diff --git a/tools/efsl-0.3.6/CHANGELOG b/packages/efsl-0.3.6/CHANGELOG similarity index 100% rename from tools/efsl-0.3.6/CHANGELOG rename to packages/efsl-0.3.6/CHANGELOG diff --git a/tools/efsl-0.3.6/Makefile b/packages/efsl-0.3.6/Makefile similarity index 100% rename from tools/efsl-0.3.6/Makefile rename to packages/efsl-0.3.6/Makefile diff --git a/tools/efsl-0.3.6/conf/config-avr.h b/packages/efsl-0.3.6/conf/config-avr.h similarity index 100% rename from tools/efsl-0.3.6/conf/config-avr.h rename to packages/efsl-0.3.6/conf/config-avr.h diff --git a/tools/efsl-0.3.6/conf/config-avr.makefile b/packages/efsl-0.3.6/conf/config-avr.makefile similarity index 100% rename from tools/efsl-0.3.6/conf/config-avr.makefile rename to packages/efsl-0.3.6/conf/config-avr.makefile diff --git a/tools/efsl-0.3.6/conf/config-linux.h b/packages/efsl-0.3.6/conf/config-linux.h similarity index 100% rename from tools/efsl-0.3.6/conf/config-linux.h rename to packages/efsl-0.3.6/conf/config-linux.h diff --git a/tools/efsl-0.3.6/conf/config-linux.makefile b/packages/efsl-0.3.6/conf/config-linux.makefile similarity index 100% rename from tools/efsl-0.3.6/conf/config-linux.makefile rename to packages/efsl-0.3.6/conf/config-linux.makefile diff --git a/tools/efsl-0.3.6/conf/config-linux64.h b/packages/efsl-0.3.6/conf/config-linux64.h similarity index 100% rename from tools/efsl-0.3.6/conf/config-linux64.h rename to packages/efsl-0.3.6/conf/config-linux64.h diff --git a/tools/efsl-0.3.6/conf/config-linux64.makefile b/packages/efsl-0.3.6/conf/config-linux64.makefile similarity index 100% rename from tools/efsl-0.3.6/conf/config-linux64.makefile rename to packages/efsl-0.3.6/conf/config-linux64.makefile diff --git a/tools/efsl-0.3.6/conf/config.h b/packages/efsl-0.3.6/conf/config.h similarity index 100% rename from tools/efsl-0.3.6/conf/config.h rename to packages/efsl-0.3.6/conf/config.h diff --git a/tools/efsl-0.3.6/conf/config.makefile b/packages/efsl-0.3.6/conf/config.makefile similarity index 100% rename from tools/efsl-0.3.6/conf/config.makefile rename to packages/efsl-0.3.6/conf/config.makefile diff --git a/tools/efsl-0.3.6/docs/Makefile b/packages/efsl-0.3.6/docs/Makefile similarity index 100% rename from tools/efsl-0.3.6/docs/Makefile rename to packages/efsl-0.3.6/docs/Makefile diff --git a/tools/efsl-0.3.6/docs/efsl-manual-0.3.5.pdf b/packages/efsl-0.3.6/docs/efsl-manual-0.3.5.pdf similarity index 100% rename from tools/efsl-0.3.6/docs/efsl-manual-0.3.5.pdf rename to packages/efsl-0.3.6/docs/efsl-manual-0.3.5.pdf diff --git a/tools/efsl-0.3.6/docs/manual.tex b/packages/efsl-0.3.6/docs/manual.tex similarity index 100% rename from tools/efsl-0.3.6/docs/manual.tex rename to packages/efsl-0.3.6/docs/manual.tex diff --git a/tools/efsl-0.3.6/docs/pages/avr.tex b/packages/efsl-0.3.6/docs/pages/avr.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/avr.tex rename to packages/efsl-0.3.6/docs/pages/avr.tex diff --git a/tools/efsl-0.3.6/docs/pages/config.tex b/packages/efsl-0.3.6/docs/pages/config.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/config.tex rename to packages/efsl-0.3.6/docs/pages/config.tex diff --git a/tools/efsl-0.3.6/docs/pages/dateandtime.tex b/packages/efsl-0.3.6/docs/pages/dateandtime.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/dateandtime.tex rename to packages/efsl-0.3.6/docs/pages/dateandtime.tex diff --git a/tools/efsl-0.3.6/docs/pages/debug.tex b/packages/efsl-0.3.6/docs/pages/debug.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/debug.tex rename to packages/efsl-0.3.6/docs/pages/debug.tex diff --git a/tools/efsl-0.3.6/docs/pages/driver.tex b/packages/efsl-0.3.6/docs/pages/driver.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/driver.tex rename to packages/efsl-0.3.6/docs/pages/driver.tex diff --git a/tools/efsl-0.3.6/docs/pages/efs_init.tex b/packages/efsl-0.3.6/docs/pages/efs_init.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/efs_init.tex rename to packages/efsl-0.3.6/docs/pages/efs_init.tex diff --git a/tools/efsl-0.3.6/docs/pages/file_fclose.tex b/packages/efsl-0.3.6/docs/pages/file_fclose.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/file_fclose.tex rename to packages/efsl-0.3.6/docs/pages/file_fclose.tex diff --git a/tools/efsl-0.3.6/docs/pages/file_fopen.tex b/packages/efsl-0.3.6/docs/pages/file_fopen.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/file_fopen.tex rename to packages/efsl-0.3.6/docs/pages/file_fopen.tex diff --git a/tools/efsl-0.3.6/docs/pages/file_read.tex b/packages/efsl-0.3.6/docs/pages/file_read.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/file_read.tex rename to packages/efsl-0.3.6/docs/pages/file_read.tex diff --git a/tools/efsl-0.3.6/docs/pages/file_write.tex b/packages/efsl-0.3.6/docs/pages/file_write.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/file_write.tex rename to packages/efsl-0.3.6/docs/pages/file_write.tex diff --git a/tools/efsl-0.3.6/docs/pages/ioman.tex b/packages/efsl-0.3.6/docs/pages/ioman.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/ioman.tex rename to packages/efsl-0.3.6/docs/pages/ioman.tex diff --git a/tools/efsl-0.3.6/docs/pages/lgpl.txt b/packages/efsl-0.3.6/docs/pages/lgpl.txt similarity index 100% rename from tools/efsl-0.3.6/docs/pages/lgpl.txt rename to packages/efsl-0.3.6/docs/pages/lgpl.txt diff --git a/tools/efsl-0.3.6/docs/pages/license.tex b/packages/efsl-0.3.6/docs/pages/license.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/license.tex rename to packages/efsl-0.3.6/docs/pages/license.tex diff --git a/tools/efsl-0.3.6/docs/pages/linux.tex b/packages/efsl-0.3.6/docs/pages/linux.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/linux.tex rename to packages/efsl-0.3.6/docs/pages/linux.tex diff --git a/tools/efsl-0.3.6/docs/pages/lsgetnext.tex b/packages/efsl-0.3.6/docs/pages/lsgetnext.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/lsgetnext.tex rename to packages/efsl-0.3.6/docs/pages/lsgetnext.tex diff --git a/tools/efsl-0.3.6/docs/pages/lsopendir.tex b/packages/efsl-0.3.6/docs/pages/lsopendir.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/lsopendir.tex rename to packages/efsl-0.3.6/docs/pages/lsopendir.tex diff --git a/tools/efsl-0.3.6/docs/pages/mkdir.tex b/packages/efsl-0.3.6/docs/pages/mkdir.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/mkdir.tex rename to packages/efsl-0.3.6/docs/pages/mkdir.tex diff --git a/tools/efsl-0.3.6/docs/pages/plibc.tex b/packages/efsl-0.3.6/docs/pages/plibc.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/plibc.tex rename to packages/efsl-0.3.6/docs/pages/plibc.tex diff --git a/tools/efsl-0.3.6/docs/pages/preface.tex b/packages/efsl-0.3.6/docs/pages/preface.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/preface.tex rename to packages/efsl-0.3.6/docs/pages/preface.tex diff --git a/tools/efsl-0.3.6/docs/pages/tms6713.tex b/packages/efsl-0.3.6/docs/pages/tms6713.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/tms6713.tex rename to packages/efsl-0.3.6/docs/pages/tms6713.tex diff --git a/tools/efsl-0.3.6/docs/pages/types.tex b/packages/efsl-0.3.6/docs/pages/types.tex similarity index 100% rename from tools/efsl-0.3.6/docs/pages/types.tex rename to packages/efsl-0.3.6/docs/pages/types.tex diff --git a/tools/efsl-0.3.6/docs/pics/sdcard.eps b/packages/efsl-0.3.6/docs/pics/sdcard.eps similarity index 100% rename from tools/efsl-0.3.6/docs/pics/sdcard.eps rename to packages/efsl-0.3.6/docs/pics/sdcard.eps diff --git a/tools/efsl-0.3.6/docs/pics/sdconnection.eps b/packages/efsl-0.3.6/docs/pics/sdconnection.eps similarity index 100% rename from tools/efsl-0.3.6/docs/pics/sdconnection.eps rename to packages/efsl-0.3.6/docs/pics/sdconnection.eps diff --git a/tools/efsl-0.3.6/docs/schematics/objectmodel.dia b/packages/efsl-0.3.6/docs/schematics/objectmodel.dia similarity index 100% rename from tools/efsl-0.3.6/docs/schematics/objectmodel.dia rename to packages/efsl-0.3.6/docs/schematics/objectmodel.dia diff --git a/tools/efsl-0.3.6/docs/schematics/objectmodel.eps b/packages/efsl-0.3.6/docs/schematics/objectmodel.eps similarity index 100% rename from tools/efsl-0.3.6/docs/schematics/objectmodel.eps rename to packages/efsl-0.3.6/docs/schematics/objectmodel.eps diff --git a/tools/efsl-0.3.6/docs/schematics/sdcard.dia b/packages/efsl-0.3.6/docs/schematics/sdcard.dia similarity index 100% rename from tools/efsl-0.3.6/docs/schematics/sdcard.dia rename to packages/efsl-0.3.6/docs/schematics/sdcard.dia diff --git a/tools/efsl-0.3.6/docs/schematics/sdcard.eps b/packages/efsl-0.3.6/docs/schematics/sdcard.eps similarity index 100% rename from tools/efsl-0.3.6/docs/schematics/sdcard.eps rename to packages/efsl-0.3.6/docs/schematics/sdcard.eps diff --git a/tools/efsl-0.3.6/docs/schematics/sector.dia b/packages/efsl-0.3.6/docs/schematics/sector.dia similarity index 100% rename from tools/efsl-0.3.6/docs/schematics/sector.dia rename to packages/efsl-0.3.6/docs/schematics/sector.dia diff --git a/tools/efsl-0.3.6/docs/schematics/sector.eps b/packages/efsl-0.3.6/docs/schematics/sector.eps similarity index 100% rename from tools/efsl-0.3.6/docs/schematics/sector.eps rename to packages/efsl-0.3.6/docs/schematics/sector.eps diff --git a/tools/efsl-0.3.6/examples/avr/Makefile b/packages/efsl-0.3.6/examples/avr/Makefile similarity index 100% rename from tools/efsl-0.3.6/examples/avr/Makefile rename to packages/efsl-0.3.6/examples/avr/Makefile diff --git a/tools/efsl-0.3.6/examples/avr/avrtest.c b/packages/efsl-0.3.6/examples/avr/avrtest.c similarity index 100% rename from tools/efsl-0.3.6/examples/avr/avrtest.c rename to packages/efsl-0.3.6/examples/avr/avrtest.c diff --git a/tools/efsl-0.3.6/examples/avr/compile b/packages/efsl-0.3.6/examples/avr/compile similarity index 100% rename from tools/efsl-0.3.6/examples/avr/compile rename to packages/efsl-0.3.6/examples/avr/compile diff --git a/tools/efsl-0.3.6/examples/avr/dumpfile.c b/packages/efsl-0.3.6/examples/avr/dumpfile.c similarity index 100% rename from tools/efsl-0.3.6/examples/avr/dumpfile.c rename to packages/efsl-0.3.6/examples/avr/dumpfile.c diff --git a/tools/efsl-0.3.6/src/base/Makefile b/packages/efsl-0.3.6/src/base/Makefile similarity index 100% rename from tools/efsl-0.3.6/src/base/Makefile rename to packages/efsl-0.3.6/src/base/Makefile diff --git a/tools/efsl-0.3.6/src/base/debug.c b/packages/efsl-0.3.6/src/base/debug.c similarity index 100% rename from tools/efsl-0.3.6/src/base/debug.c rename to packages/efsl-0.3.6/src/base/debug.c diff --git a/tools/efsl-0.3.6/src/base/disc.c b/packages/efsl-0.3.6/src/base/disc.c similarity index 100% rename from tools/efsl-0.3.6/src/base/disc.c rename to packages/efsl-0.3.6/src/base/disc.c diff --git a/tools/efsl-0.3.6/src/base/disc.c~ b/packages/efsl-0.3.6/src/base/disc.c~ similarity index 100% rename from tools/efsl-0.3.6/src/base/disc.c~ rename to packages/efsl-0.3.6/src/base/disc.c~ diff --git a/tools/efsl-0.3.6/src/base/efs.c b/packages/efsl-0.3.6/src/base/efs.c similarity index 100% rename from tools/efsl-0.3.6/src/base/efs.c rename to packages/efsl-0.3.6/src/base/efs.c diff --git a/tools/efsl-0.3.6/src/base/efs.c~ b/packages/efsl-0.3.6/src/base/efs.c~ similarity index 100% rename from tools/efsl-0.3.6/src/base/efs.c~ rename to packages/efsl-0.3.6/src/base/efs.c~ diff --git a/tools/efsl-0.3.6/src/base/extract.c b/packages/efsl-0.3.6/src/base/extract.c similarity index 100% rename from tools/efsl-0.3.6/src/base/extract.c rename to packages/efsl-0.3.6/src/base/extract.c diff --git a/tools/efsl-0.3.6/src/base/include/debug.h b/packages/efsl-0.3.6/src/base/include/debug.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/debug.h rename to packages/efsl-0.3.6/src/base/include/debug.h diff --git a/tools/efsl-0.3.6/src/base/include/disc.h b/packages/efsl-0.3.6/src/base/include/disc.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/disc.h rename to packages/efsl-0.3.6/src/base/include/disc.h diff --git a/tools/efsl-0.3.6/src/base/include/disc.h~ b/packages/efsl-0.3.6/src/base/include/disc.h~ similarity index 100% rename from tools/efsl-0.3.6/src/base/include/disc.h~ rename to packages/efsl-0.3.6/src/base/include/disc.h~ diff --git a/tools/efsl-0.3.6/src/base/include/efs.h b/packages/efsl-0.3.6/src/base/include/efs.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/efs.h rename to packages/efsl-0.3.6/src/base/include/efs.h diff --git a/tools/efsl-0.3.6/src/base/include/extract.h b/packages/efsl-0.3.6/src/base/include/extract.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/extract.h rename to packages/efsl-0.3.6/src/base/include/extract.h diff --git a/tools/efsl-0.3.6/src/base/include/interface.h b/packages/efsl-0.3.6/src/base/include/interface.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/interface.h rename to packages/efsl-0.3.6/src/base/include/interface.h diff --git a/tools/efsl-0.3.6/src/base/include/ioman.h b/packages/efsl-0.3.6/src/base/include/ioman.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/ioman.h rename to packages/efsl-0.3.6/src/base/include/ioman.h diff --git a/tools/efsl-0.3.6/src/base/include/ioman_small.h b/packages/efsl-0.3.6/src/base/include/ioman_small.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/ioman_small.h rename to packages/efsl-0.3.6/src/base/include/ioman_small.h diff --git a/tools/efsl-0.3.6/src/base/include/partition.h b/packages/efsl-0.3.6/src/base/include/partition.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/partition.h rename to packages/efsl-0.3.6/src/base/include/partition.h diff --git a/tools/efsl-0.3.6/src/base/include/partition.h~ b/packages/efsl-0.3.6/src/base/include/partition.h~ similarity index 100% rename from tools/efsl-0.3.6/src/base/include/partition.h~ rename to packages/efsl-0.3.6/src/base/include/partition.h~ diff --git a/tools/efsl-0.3.6/src/base/include/plibc.h b/packages/efsl-0.3.6/src/base/include/plibc.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/plibc.h rename to packages/efsl-0.3.6/src/base/include/plibc.h diff --git a/tools/efsl-0.3.6/src/base/include/sextract.h b/packages/efsl-0.3.6/src/base/include/sextract.h similarity index 100% rename from tools/efsl-0.3.6/src/base/include/sextract.h rename to packages/efsl-0.3.6/src/base/include/sextract.h diff --git a/tools/efsl-0.3.6/src/base/interface.c b/packages/efsl-0.3.6/src/base/interface.c similarity index 100% rename from tools/efsl-0.3.6/src/base/interface.c rename to packages/efsl-0.3.6/src/base/interface.c diff --git a/tools/efsl-0.3.6/src/base/interface.c~ b/packages/efsl-0.3.6/src/base/interface.c~ similarity index 100% rename from tools/efsl-0.3.6/src/base/interface.c~ rename to packages/efsl-0.3.6/src/base/interface.c~ diff --git a/tools/efsl-0.3.6/src/base/ioman.c b/packages/efsl-0.3.6/src/base/ioman.c similarity index 100% rename from tools/efsl-0.3.6/src/base/ioman.c rename to packages/efsl-0.3.6/src/base/ioman.c diff --git a/tools/efsl-0.3.6/src/base/ioman_small.c b/packages/efsl-0.3.6/src/base/ioman_small.c similarity index 100% rename from tools/efsl-0.3.6/src/base/ioman_small.c rename to packages/efsl-0.3.6/src/base/ioman_small.c diff --git a/tools/efsl-0.3.6/src/base/partition.c b/packages/efsl-0.3.6/src/base/partition.c similarity index 100% rename from tools/efsl-0.3.6/src/base/partition.c rename to packages/efsl-0.3.6/src/base/partition.c diff --git a/tools/efsl-0.3.6/src/base/partition.c~ b/packages/efsl-0.3.6/src/base/partition.c~ similarity index 100% rename from tools/efsl-0.3.6/src/base/partition.c~ rename to packages/efsl-0.3.6/src/base/partition.c~ diff --git a/tools/efsl-0.3.6/src/base/plibc.c b/packages/efsl-0.3.6/src/base/plibc.c similarity index 100% rename from tools/efsl-0.3.6/src/base/plibc.c rename to packages/efsl-0.3.6/src/base/plibc.c diff --git a/tools/efsl-0.3.6/src/base/sextract.c b/packages/efsl-0.3.6/src/base/sextract.c similarity index 100% rename from tools/efsl-0.3.6/src/base/sextract.c rename to packages/efsl-0.3.6/src/base/sextract.c diff --git a/tools/efsl-0.3.6/src/base/sextract.c~ b/packages/efsl-0.3.6/src/base/sextract.c~ similarity index 100% rename from tools/efsl-0.3.6/src/base/sextract.c~ rename to packages/efsl-0.3.6/src/base/sextract.c~ diff --git a/tools/efsl-0.3.6/src/fs/vfat/Makefile b/packages/efsl-0.3.6/src/fs/vfat/Makefile similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/Makefile rename to packages/efsl-0.3.6/src/fs/vfat/Makefile diff --git a/tools/efsl-0.3.6/src/fs/vfat/dir.c b/packages/efsl-0.3.6/src/fs/vfat/dir.c similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/dir.c rename to packages/efsl-0.3.6/src/fs/vfat/dir.c diff --git a/tools/efsl-0.3.6/src/fs/vfat/fat.c b/packages/efsl-0.3.6/src/fs/vfat/fat.c similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/fat.c rename to packages/efsl-0.3.6/src/fs/vfat/fat.c diff --git a/tools/efsl-0.3.6/src/fs/vfat/file.c b/packages/efsl-0.3.6/src/fs/vfat/file.c similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/file.c rename to packages/efsl-0.3.6/src/fs/vfat/file.c diff --git a/tools/efsl-0.3.6/src/fs/vfat/fs.c b/packages/efsl-0.3.6/src/fs/vfat/fs.c similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/fs.c rename to packages/efsl-0.3.6/src/fs/vfat/fs.c diff --git a/tools/efsl-0.3.6/src/fs/vfat/fs.c~ b/packages/efsl-0.3.6/src/fs/vfat/fs.c~ similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/fs.c~ rename to packages/efsl-0.3.6/src/fs/vfat/fs.c~ diff --git a/tools/efsl-0.3.6/src/fs/vfat/include/dir.h b/packages/efsl-0.3.6/src/fs/vfat/include/dir.h similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/include/dir.h rename to packages/efsl-0.3.6/src/fs/vfat/include/dir.h diff --git a/tools/efsl-0.3.6/src/fs/vfat/include/fat.h b/packages/efsl-0.3.6/src/fs/vfat/include/fat.h similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/include/fat.h rename to packages/efsl-0.3.6/src/fs/vfat/include/fat.h diff --git a/tools/efsl-0.3.6/src/fs/vfat/include/file.h b/packages/efsl-0.3.6/src/fs/vfat/include/file.h similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/include/file.h rename to packages/efsl-0.3.6/src/fs/vfat/include/file.h diff --git a/tools/efsl-0.3.6/src/fs/vfat/include/fs.h b/packages/efsl-0.3.6/src/fs/vfat/include/fs.h similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/include/fs.h rename to packages/efsl-0.3.6/src/fs/vfat/include/fs.h diff --git a/tools/efsl-0.3.6/src/fs/vfat/include/ls.h b/packages/efsl-0.3.6/src/fs/vfat/include/ls.h similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/include/ls.h rename to packages/efsl-0.3.6/src/fs/vfat/include/ls.h diff --git a/tools/efsl-0.3.6/src/fs/vfat/include/mkfs.h b/packages/efsl-0.3.6/src/fs/vfat/include/mkfs.h similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/include/mkfs.h rename to packages/efsl-0.3.6/src/fs/vfat/include/mkfs.h diff --git a/tools/efsl-0.3.6/src/fs/vfat/include/time.h b/packages/efsl-0.3.6/src/fs/vfat/include/time.h similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/include/time.h rename to packages/efsl-0.3.6/src/fs/vfat/include/time.h diff --git a/tools/efsl-0.3.6/src/fs/vfat/include/ui.h b/packages/efsl-0.3.6/src/fs/vfat/include/ui.h similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/include/ui.h rename to packages/efsl-0.3.6/src/fs/vfat/include/ui.h diff --git a/tools/efsl-0.3.6/src/fs/vfat/ls.c b/packages/efsl-0.3.6/src/fs/vfat/ls.c similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/ls.c rename to packages/efsl-0.3.6/src/fs/vfat/ls.c diff --git a/tools/efsl-0.3.6/src/fs/vfat/mkfs.c b/packages/efsl-0.3.6/src/fs/vfat/mkfs.c similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/mkfs.c rename to packages/efsl-0.3.6/src/fs/vfat/mkfs.c diff --git a/tools/efsl-0.3.6/src/fs/vfat/mkfs.c~ b/packages/efsl-0.3.6/src/fs/vfat/mkfs.c~ similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/mkfs.c~ rename to packages/efsl-0.3.6/src/fs/vfat/mkfs.c~ diff --git a/tools/efsl-0.3.6/src/fs/vfat/time.c b/packages/efsl-0.3.6/src/fs/vfat/time.c similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/time.c rename to packages/efsl-0.3.6/src/fs/vfat/time.c diff --git a/tools/efsl-0.3.6/src/fs/vfat/ui.c b/packages/efsl-0.3.6/src/fs/vfat/ui.c similarity index 100% rename from tools/efsl-0.3.6/src/fs/vfat/ui.c rename to packages/efsl-0.3.6/src/fs/vfat/ui.c diff --git a/tools/efsl-0.3.6/src/hwdrivers/atmega_spi/Makefile b/packages/efsl-0.3.6/src/hwdrivers/atmega_spi/Makefile similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/atmega_spi/Makefile rename to packages/efsl-0.3.6/src/hwdrivers/atmega_spi/Makefile diff --git a/tools/efsl-0.3.6/src/hwdrivers/atmega_spi/atmega_spi.c b/packages/efsl-0.3.6/src/hwdrivers/atmega_spi/atmega_spi.c similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/atmega_spi/atmega_spi.c rename to packages/efsl-0.3.6/src/hwdrivers/atmega_spi/atmega_spi.c diff --git a/tools/efsl-0.3.6/src/hwdrivers/atmega_spi/include/atmega_spi.h b/packages/efsl-0.3.6/src/hwdrivers/atmega_spi/include/atmega_spi.h similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/atmega_spi/include/atmega_spi.h rename to packages/efsl-0.3.6/src/hwdrivers/atmega_spi/include/atmega_spi.h diff --git a/tools/efsl-0.3.6/src/hwdrivers/linuxfile/Makefile b/packages/efsl-0.3.6/src/hwdrivers/linuxfile/Makefile similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/linuxfile/Makefile rename to packages/efsl-0.3.6/src/hwdrivers/linuxfile/Makefile diff --git a/tools/efsl-0.3.6/src/hwdrivers/linuxfile/helper.c b/packages/efsl-0.3.6/src/hwdrivers/linuxfile/helper.c similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/linuxfile/helper.c rename to packages/efsl-0.3.6/src/hwdrivers/linuxfile/helper.c diff --git a/tools/efsl-0.3.6/src/hwdrivers/linuxfile/include/helper.h b/packages/efsl-0.3.6/src/hwdrivers/linuxfile/include/helper.h similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/linuxfile/include/helper.h rename to packages/efsl-0.3.6/src/hwdrivers/linuxfile/include/helper.h diff --git a/tools/efsl-0.3.6/src/hwdrivers/linuxfile/include/linuxfile.h b/packages/efsl-0.3.6/src/hwdrivers/linuxfile/include/linuxfile.h similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/linuxfile/include/linuxfile.h rename to packages/efsl-0.3.6/src/hwdrivers/linuxfile/include/linuxfile.h diff --git a/tools/efsl-0.3.6/src/hwdrivers/linuxfile/linuxfile.c b/packages/efsl-0.3.6/src/hwdrivers/linuxfile/linuxfile.c similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/linuxfile/linuxfile.c rename to packages/efsl-0.3.6/src/hwdrivers/linuxfile/linuxfile.c diff --git a/tools/efsl-0.3.6/src/hwdrivers/tms67xx_sd/dsp67xx.c b/packages/efsl-0.3.6/src/hwdrivers/tms67xx_sd/dsp67xx.c similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/tms67xx_sd/dsp67xx.c rename to packages/efsl-0.3.6/src/hwdrivers/tms67xx_sd/dsp67xx.c diff --git a/tools/efsl-0.3.6/src/hwdrivers/tms67xx_sd/include/dsp67xx.h b/packages/efsl-0.3.6/src/hwdrivers/tms67xx_sd/include/dsp67xx.h similarity index 100% rename from tools/efsl-0.3.6/src/hwdrivers/tms67xx_sd/include/dsp67xx.h rename to packages/efsl-0.3.6/src/hwdrivers/tms67xx_sd/include/dsp67xx.h diff --git a/tools/efsl-0.3.6/src/include/error.h b/packages/efsl-0.3.6/src/include/error.h similarity index 100% rename from tools/efsl-0.3.6/src/include/error.h rename to packages/efsl-0.3.6/src/include/error.h diff --git a/tools/efsl-0.3.6/src/include/ioctl.h b/packages/efsl-0.3.6/src/include/ioctl.h similarity index 100% rename from tools/efsl-0.3.6/src/include/ioctl.h rename to packages/efsl-0.3.6/src/include/ioctl.h diff --git a/tools/efsl-0.3.6/src/include/types.h b/packages/efsl-0.3.6/src/include/types.h similarity index 100% rename from tools/efsl-0.3.6/src/include/types.h rename to packages/efsl-0.3.6/src/include/types.h diff --git a/tools/efsl-0.3.6/src/protocols/sdcard_spi/Makefile b/packages/efsl-0.3.6/src/protocols/sdcard_spi/Makefile similarity index 100% rename from tools/efsl-0.3.6/src/protocols/sdcard_spi/Makefile rename to packages/efsl-0.3.6/src/protocols/sdcard_spi/Makefile diff --git a/tools/efsl-0.3.6/src/protocols/sdcard_spi/include/sd.h b/packages/efsl-0.3.6/src/protocols/sdcard_spi/include/sd.h similarity index 100% rename from tools/efsl-0.3.6/src/protocols/sdcard_spi/include/sd.h rename to packages/efsl-0.3.6/src/protocols/sdcard_spi/include/sd.h diff --git a/tools/efsl-0.3.6/src/protocols/sdcard_spi/sd.c b/packages/efsl-0.3.6/src/protocols/sdcard_spi/sd.c similarity index 100% rename from tools/efsl-0.3.6/src/protocols/sdcard_spi/sd.c rename to packages/efsl-0.3.6/src/protocols/sdcard_spi/sd.c diff --git a/tools/efsl-0.3.6/util/fsutil/Makefile b/packages/efsl-0.3.6/util/fsutil/Makefile similarity index 100% rename from tools/efsl-0.3.6/util/fsutil/Makefile rename to packages/efsl-0.3.6/util/fsutil/Makefile diff --git a/tools/efsl-0.3.6/util/fsutil/cp.c b/packages/efsl-0.3.6/util/fsutil/cp.c similarity index 100% rename from tools/efsl-0.3.6/util/fsutil/cp.c rename to packages/efsl-0.3.6/util/fsutil/cp.c diff --git a/tools/efsl-0.3.6/util/fsutil/cpa.c b/packages/efsl-0.3.6/util/fsutil/cpa.c similarity index 100% rename from tools/efsl-0.3.6/util/fsutil/cpa.c rename to packages/efsl-0.3.6/util/fsutil/cpa.c diff --git a/tools/efsl-0.3.6/util/fsutil/cpi.c b/packages/efsl-0.3.6/util/fsutil/cpi.c similarity index 100% rename from tools/efsl-0.3.6/util/fsutil/cpi.c rename to packages/efsl-0.3.6/util/fsutil/cpi.c diff --git a/tools/efsl-0.3.6/util/fsutil/cpo.c b/packages/efsl-0.3.6/util/fsutil/cpo.c similarity index 100% rename from tools/efsl-0.3.6/util/fsutil/cpo.c rename to packages/efsl-0.3.6/util/fsutil/cpo.c diff --git a/tools/efsl-0.3.6/util/fsutil/include/init.h b/packages/efsl-0.3.6/util/fsutil/include/init.h similarity index 100% rename from tools/efsl-0.3.6/util/fsutil/include/init.h rename to packages/efsl-0.3.6/util/fsutil/include/init.h diff --git a/tools/efsl-0.3.6/util/fsutil/init.c b/packages/efsl-0.3.6/util/fsutil/init.c similarity index 100% rename from tools/efsl-0.3.6/util/fsutil/init.c rename to packages/efsl-0.3.6/util/fsutil/init.c diff --git a/tools/efsl-0.3.6/util/fsutil/list.c b/packages/efsl-0.3.6/util/fsutil/list.c similarity index 100% rename from tools/efsl-0.3.6/util/fsutil/list.c rename to packages/efsl-0.3.6/util/fsutil/list.c diff --git a/tools/efsl-0.3.6/util/fsutil/mkdir.c b/packages/efsl-0.3.6/util/fsutil/mkdir.c similarity index 100% rename from tools/efsl-0.3.6/util/fsutil/mkdir.c rename to packages/efsl-0.3.6/util/fsutil/mkdir.c diff --git a/tools/ff-0.7/doc/00index_e.html b/packages/ff-0.7/doc/00index_e.html similarity index 100% rename from tools/ff-0.7/doc/00index_e.html rename to packages/ff-0.7/doc/00index_e.html diff --git a/tools/ff-0.7/doc/css_e.css b/packages/ff-0.7/doc/css_e.css similarity index 100% rename from tools/ff-0.7/doc/css_e.css rename to packages/ff-0.7/doc/css_e.css diff --git a/tools/ff-0.7/doc/en/appnote.html b/packages/ff-0.7/doc/en/appnote.html similarity index 100% rename from tools/ff-0.7/doc/en/appnote.html rename to packages/ff-0.7/doc/en/appnote.html diff --git a/tools/ff-0.7/doc/en/chmod.html b/packages/ff-0.7/doc/en/chmod.html similarity index 100% rename from tools/ff-0.7/doc/en/chmod.html rename to packages/ff-0.7/doc/en/chmod.html diff --git a/tools/ff-0.7/doc/en/close.html b/packages/ff-0.7/doc/en/close.html similarity index 100% rename from tools/ff-0.7/doc/en/close.html rename to packages/ff-0.7/doc/en/close.html diff --git a/tools/ff-0.7/doc/en/dinit.html b/packages/ff-0.7/doc/en/dinit.html similarity index 100% rename from tools/ff-0.7/doc/en/dinit.html rename to packages/ff-0.7/doc/en/dinit.html diff --git a/tools/ff-0.7/doc/en/dioctl.html b/packages/ff-0.7/doc/en/dioctl.html similarity index 100% rename from tools/ff-0.7/doc/en/dioctl.html rename to packages/ff-0.7/doc/en/dioctl.html diff --git a/tools/ff-0.7/doc/en/dread.html b/packages/ff-0.7/doc/en/dread.html similarity index 100% rename from tools/ff-0.7/doc/en/dread.html rename to packages/ff-0.7/doc/en/dread.html diff --git a/tools/ff-0.7/doc/en/dstat.html b/packages/ff-0.7/doc/en/dstat.html similarity index 100% rename from tools/ff-0.7/doc/en/dstat.html rename to packages/ff-0.7/doc/en/dstat.html diff --git a/tools/ff-0.7/doc/en/dwrite.html b/packages/ff-0.7/doc/en/dwrite.html similarity index 100% rename from tools/ff-0.7/doc/en/dwrite.html rename to packages/ff-0.7/doc/en/dwrite.html diff --git a/tools/ff-0.7/doc/en/fattime.html b/packages/ff-0.7/doc/en/fattime.html similarity index 100% rename from tools/ff-0.7/doc/en/fattime.html rename to packages/ff-0.7/doc/en/fattime.html diff --git a/tools/ff-0.7/doc/en/filename.html b/packages/ff-0.7/doc/en/filename.html similarity index 100% rename from tools/ff-0.7/doc/en/filename.html rename to packages/ff-0.7/doc/en/filename.html diff --git a/tools/ff-0.7/doc/en/forward.html b/packages/ff-0.7/doc/en/forward.html similarity index 100% rename from tools/ff-0.7/doc/en/forward.html rename to packages/ff-0.7/doc/en/forward.html diff --git a/tools/ff-0.7/doc/en/getfree.html b/packages/ff-0.7/doc/en/getfree.html similarity index 100% rename from tools/ff-0.7/doc/en/getfree.html rename to packages/ff-0.7/doc/en/getfree.html diff --git a/tools/ff-0.7/doc/en/gets.html b/packages/ff-0.7/doc/en/gets.html similarity index 100% rename from tools/ff-0.7/doc/en/gets.html rename to packages/ff-0.7/doc/en/gets.html diff --git a/tools/ff-0.7/doc/en/lseek.html b/packages/ff-0.7/doc/en/lseek.html similarity index 100% rename from tools/ff-0.7/doc/en/lseek.html rename to packages/ff-0.7/doc/en/lseek.html diff --git a/tools/ff-0.7/doc/en/mkdir.html b/packages/ff-0.7/doc/en/mkdir.html similarity index 100% rename from tools/ff-0.7/doc/en/mkdir.html rename to packages/ff-0.7/doc/en/mkdir.html diff --git a/tools/ff-0.7/doc/en/mkfs.html b/packages/ff-0.7/doc/en/mkfs.html similarity index 100% rename from tools/ff-0.7/doc/en/mkfs.html rename to packages/ff-0.7/doc/en/mkfs.html diff --git a/tools/ff-0.7/doc/en/mount.html b/packages/ff-0.7/doc/en/mount.html similarity index 100% rename from tools/ff-0.7/doc/en/mount.html rename to packages/ff-0.7/doc/en/mount.html diff --git a/tools/ff-0.7/doc/en/mountdrv.html b/packages/ff-0.7/doc/en/mountdrv.html similarity index 100% rename from tools/ff-0.7/doc/en/mountdrv.html rename to packages/ff-0.7/doc/en/mountdrv.html diff --git a/tools/ff-0.7/doc/en/open.html b/packages/ff-0.7/doc/en/open.html similarity index 100% rename from tools/ff-0.7/doc/en/open.html rename to packages/ff-0.7/doc/en/open.html diff --git a/tools/ff-0.7/doc/en/opendir.html b/packages/ff-0.7/doc/en/opendir.html similarity index 100% rename from tools/ff-0.7/doc/en/opendir.html rename to packages/ff-0.7/doc/en/opendir.html diff --git a/tools/ff-0.7/doc/en/printf.html b/packages/ff-0.7/doc/en/printf.html similarity index 100% rename from tools/ff-0.7/doc/en/printf.html rename to packages/ff-0.7/doc/en/printf.html diff --git a/tools/ff-0.7/doc/en/putc.html b/packages/ff-0.7/doc/en/putc.html similarity index 100% rename from tools/ff-0.7/doc/en/putc.html rename to packages/ff-0.7/doc/en/putc.html diff --git a/tools/ff-0.7/doc/en/puts.html b/packages/ff-0.7/doc/en/puts.html similarity index 100% rename from tools/ff-0.7/doc/en/puts.html rename to packages/ff-0.7/doc/en/puts.html diff --git a/tools/ff-0.7/doc/en/read.html b/packages/ff-0.7/doc/en/read.html similarity index 100% rename from tools/ff-0.7/doc/en/read.html rename to packages/ff-0.7/doc/en/read.html diff --git a/tools/ff-0.7/doc/en/readdir.html b/packages/ff-0.7/doc/en/readdir.html similarity index 100% rename from tools/ff-0.7/doc/en/readdir.html rename to packages/ff-0.7/doc/en/readdir.html diff --git a/tools/ff-0.7/doc/en/rename.html b/packages/ff-0.7/doc/en/rename.html similarity index 100% rename from tools/ff-0.7/doc/en/rename.html rename to packages/ff-0.7/doc/en/rename.html diff --git a/tools/ff-0.7/doc/en/sdir.html b/packages/ff-0.7/doc/en/sdir.html similarity index 100% rename from tools/ff-0.7/doc/en/sdir.html rename to packages/ff-0.7/doc/en/sdir.html diff --git a/tools/ff-0.7/doc/en/sfatfs.html b/packages/ff-0.7/doc/en/sfatfs.html similarity index 100% rename from tools/ff-0.7/doc/en/sfatfs.html rename to packages/ff-0.7/doc/en/sfatfs.html diff --git a/tools/ff-0.7/doc/en/sfile.html b/packages/ff-0.7/doc/en/sfile.html similarity index 100% rename from tools/ff-0.7/doc/en/sfile.html rename to packages/ff-0.7/doc/en/sfile.html diff --git a/tools/ff-0.7/doc/en/sfileinfo.html b/packages/ff-0.7/doc/en/sfileinfo.html similarity index 100% rename from tools/ff-0.7/doc/en/sfileinfo.html rename to packages/ff-0.7/doc/en/sfileinfo.html diff --git a/tools/ff-0.7/doc/en/stat.html b/packages/ff-0.7/doc/en/stat.html similarity index 100% rename from tools/ff-0.7/doc/en/stat.html rename to packages/ff-0.7/doc/en/stat.html diff --git a/tools/ff-0.7/doc/en/sync.html b/packages/ff-0.7/doc/en/sync.html similarity index 100% rename from tools/ff-0.7/doc/en/sync.html rename to packages/ff-0.7/doc/en/sync.html diff --git a/tools/ff-0.7/doc/en/truncate.html b/packages/ff-0.7/doc/en/truncate.html similarity index 100% rename from tools/ff-0.7/doc/en/truncate.html rename to packages/ff-0.7/doc/en/truncate.html diff --git a/tools/ff-0.7/doc/en/unlink.html b/packages/ff-0.7/doc/en/unlink.html similarity index 100% rename from tools/ff-0.7/doc/en/unlink.html rename to packages/ff-0.7/doc/en/unlink.html diff --git a/tools/ff-0.7/doc/en/utime.html b/packages/ff-0.7/doc/en/utime.html similarity index 100% rename from tools/ff-0.7/doc/en/utime.html rename to packages/ff-0.7/doc/en/utime.html diff --git a/tools/ff-0.7/doc/en/write.html b/packages/ff-0.7/doc/en/write.html similarity index 100% rename from tools/ff-0.7/doc/en/write.html rename to packages/ff-0.7/doc/en/write.html diff --git a/tools/ff-0.7/doc/img/f1.png b/packages/ff-0.7/doc/img/f1.png similarity index 100% rename from tools/ff-0.7/doc/img/f1.png rename to packages/ff-0.7/doc/img/f1.png diff --git a/tools/ff-0.7/doc/img/f2.png b/packages/ff-0.7/doc/img/f2.png similarity index 100% rename from tools/ff-0.7/doc/img/f2.png rename to packages/ff-0.7/doc/img/f2.png diff --git a/tools/ff-0.7/doc/img/f3.png b/packages/ff-0.7/doc/img/f3.png similarity index 100% rename from tools/ff-0.7/doc/img/f3.png rename to packages/ff-0.7/doc/img/f3.png diff --git a/tools/ff-0.7/doc/img/f4.png b/packages/ff-0.7/doc/img/f4.png similarity index 100% rename from tools/ff-0.7/doc/img/f4.png rename to packages/ff-0.7/doc/img/f4.png diff --git a/tools/ff-0.7/doc/img/f5.png b/packages/ff-0.7/doc/img/f5.png similarity index 100% rename from tools/ff-0.7/doc/img/f5.png rename to packages/ff-0.7/doc/img/f5.png diff --git a/tools/ff-0.7/doc/img/layers.png b/packages/ff-0.7/doc/img/layers.png similarity index 100% rename from tools/ff-0.7/doc/img/layers.png rename to packages/ff-0.7/doc/img/layers.png diff --git a/tools/ff-0.7/doc/img/rwtest.png b/packages/ff-0.7/doc/img/rwtest.png similarity index 100% rename from tools/ff-0.7/doc/img/rwtest.png rename to packages/ff-0.7/doc/img/rwtest.png diff --git a/tools/ff-0.7/doc/img/rwtest2.png b/packages/ff-0.7/doc/img/rwtest2.png similarity index 100% rename from tools/ff-0.7/doc/img/rwtest2.png rename to packages/ff-0.7/doc/img/rwtest2.png diff --git a/tools/ff-0.7/sample/avr/Makefile_ata b/packages/ff-0.7/sample/avr/Makefile_ata similarity index 100% rename from tools/ff-0.7/sample/avr/Makefile_ata rename to packages/ff-0.7/sample/avr/Makefile_ata diff --git a/tools/ff-0.7/sample/avr/Makefile_cfc b/packages/ff-0.7/sample/avr/Makefile_cfc similarity index 100% rename from tools/ff-0.7/sample/avr/Makefile_cfc rename to packages/ff-0.7/sample/avr/Makefile_cfc diff --git a/tools/ff-0.7/sample/avr/Makefile_cfmm b/packages/ff-0.7/sample/avr/Makefile_cfmm similarity index 100% rename from tools/ff-0.7/sample/avr/Makefile_cfmm rename to packages/ff-0.7/sample/avr/Makefile_cfmm diff --git a/tools/ff-0.7/sample/avr/Makefile_mmc b/packages/ff-0.7/sample/avr/Makefile_mmc similarity index 100% rename from tools/ff-0.7/sample/avr/Makefile_mmc rename to packages/ff-0.7/sample/avr/Makefile_mmc diff --git a/tools/ff-0.7/sample/avr/ata.c b/packages/ff-0.7/sample/avr/ata.c similarity index 100% rename from tools/ff-0.7/sample/avr/ata.c rename to packages/ff-0.7/sample/avr/ata.c diff --git a/tools/ff-0.7/sample/avr/avr_ata.png b/packages/ff-0.7/sample/avr/avr_ata.png similarity index 100% rename from tools/ff-0.7/sample/avr/avr_ata.png rename to packages/ff-0.7/sample/avr/avr_ata.png diff --git a/tools/ff-0.7/sample/avr/avr_cfc.png b/packages/ff-0.7/sample/avr/avr_cfc.png similarity index 100% rename from tools/ff-0.7/sample/avr/avr_cfc.png rename to packages/ff-0.7/sample/avr/avr_cfc.png diff --git a/tools/ff-0.7/sample/avr/avr_mmc.png b/packages/ff-0.7/sample/avr/avr_mmc.png similarity index 100% rename from tools/ff-0.7/sample/avr/avr_mmc.png rename to packages/ff-0.7/sample/avr/avr_mmc.png diff --git a/tools/ff-0.7/sample/avr/cfc.c b/packages/ff-0.7/sample/avr/cfc.c similarity index 100% rename from tools/ff-0.7/sample/avr/cfc.c rename to packages/ff-0.7/sample/avr/cfc.c diff --git a/tools/ff-0.7/sample/avr/cfmm.c b/packages/ff-0.7/sample/avr/cfmm.c similarity index 100% rename from tools/ff-0.7/sample/avr/cfmm.c rename to packages/ff-0.7/sample/avr/cfmm.c diff --git a/tools/ff-0.7/sample/avr/diskio.h b/packages/ff-0.7/sample/avr/diskio.h similarity index 100% rename from tools/ff-0.7/sample/avr/diskio.h rename to packages/ff-0.7/sample/avr/diskio.h diff --git a/tools/ff-0.7/sample/avr/ff.c b/packages/ff-0.7/sample/avr/ff.c similarity index 100% rename from tools/ff-0.7/sample/avr/ff.c rename to packages/ff-0.7/sample/avr/ff.c diff --git a/tools/ff-0.7/sample/avr/ff.h b/packages/ff-0.7/sample/avr/ff.h similarity index 100% rename from tools/ff-0.7/sample/avr/ff.h rename to packages/ff-0.7/sample/avr/ff.h diff --git a/tools/ff-0.7/sample/avr/integer.h b/packages/ff-0.7/sample/avr/integer.h similarity index 100% rename from tools/ff-0.7/sample/avr/integer.h rename to packages/ff-0.7/sample/avr/integer.h diff --git a/tools/ff-0.7/sample/avr/main.c b/packages/ff-0.7/sample/avr/main.c similarity index 100% rename from tools/ff-0.7/sample/avr/main.c rename to packages/ff-0.7/sample/avr/main.c diff --git a/tools/ff-0.7/sample/avr/mmc.c b/packages/ff-0.7/sample/avr/mmc.c similarity index 100% rename from tools/ff-0.7/sample/avr/mmc.c rename to packages/ff-0.7/sample/avr/mmc.c diff --git a/tools/ff-0.7/sample/avr/rtc.c b/packages/ff-0.7/sample/avr/rtc.c similarity index 100% rename from tools/ff-0.7/sample/avr/rtc.c rename to packages/ff-0.7/sample/avr/rtc.c diff --git a/tools/ff-0.7/sample/avr/rtc.h b/packages/ff-0.7/sample/avr/rtc.h similarity index 100% rename from tools/ff-0.7/sample/avr/rtc.h rename to packages/ff-0.7/sample/avr/rtc.h diff --git a/tools/ff-0.7/sample/avr/uart.c b/packages/ff-0.7/sample/avr/uart.c similarity index 100% rename from tools/ff-0.7/sample/avr/uart.c rename to packages/ff-0.7/sample/avr/uart.c diff --git a/tools/ff-0.7/sample/avr/uart.h b/packages/ff-0.7/sample/avr/uart.h similarity index 100% rename from tools/ff-0.7/sample/avr/uart.h rename to packages/ff-0.7/sample/avr/uart.h diff --git a/tools/ff-0.7/sample/avr/xitoa.S b/packages/ff-0.7/sample/avr/xitoa.S similarity index 100% rename from tools/ff-0.7/sample/avr/xitoa.S rename to packages/ff-0.7/sample/avr/xitoa.S diff --git a/tools/ff-0.7/sample/avr/xitoa.h b/packages/ff-0.7/sample/avr/xitoa.h similarity index 100% rename from tools/ff-0.7/sample/avr/xitoa.h rename to packages/ff-0.7/sample/avr/xitoa.h diff --git a/tools/ff-0.7/sample/linux/Makefile b/packages/ff-0.7/sample/linux/Makefile similarity index 100% rename from tools/ff-0.7/sample/linux/Makefile rename to packages/ff-0.7/sample/linux/Makefile diff --git a/tools/ff-0.7/sample/linux/diskio.c b/packages/ff-0.7/sample/linux/diskio.c similarity index 100% rename from tools/ff-0.7/sample/linux/diskio.c rename to packages/ff-0.7/sample/linux/diskio.c diff --git a/tools/ff-0.7/sample/linux/diskio.h b/packages/ff-0.7/sample/linux/diskio.h similarity index 100% rename from tools/ff-0.7/sample/linux/diskio.h rename to packages/ff-0.7/sample/linux/diskio.h diff --git a/tools/ff-0.7/sample/linux/ff.c b/packages/ff-0.7/sample/linux/ff.c similarity index 100% rename from tools/ff-0.7/sample/linux/ff.c rename to packages/ff-0.7/sample/linux/ff.c diff --git a/tools/ff-0.7/sample/linux/ff.h b/packages/ff-0.7/sample/linux/ff.h similarity index 100% rename from tools/ff-0.7/sample/linux/ff.h rename to packages/ff-0.7/sample/linux/ff.h diff --git a/tools/ff-0.7/sample/linux/fftest b/packages/ff-0.7/sample/linux/fftest similarity index 100% rename from tools/ff-0.7/sample/linux/fftest rename to packages/ff-0.7/sample/linux/fftest diff --git a/tools/ff-0.7/sample/linux/integer.h b/packages/ff-0.7/sample/linux/integer.h similarity index 100% rename from tools/ff-0.7/sample/linux/integer.h rename to packages/ff-0.7/sample/linux/integer.h diff --git a/tools/ff-0.7/sample/linux/main.c b/packages/ff-0.7/sample/linux/main.c similarity index 100% rename from tools/ff-0.7/sample/linux/main.c rename to packages/ff-0.7/sample/linux/main.c diff --git a/tools/ff-0.7/sample/lpc2k/LPC2300.h b/packages/ff-0.7/sample/lpc2k/LPC2300.h similarity index 100% rename from tools/ff-0.7/sample/lpc2k/LPC2300.h rename to packages/ff-0.7/sample/lpc2k/LPC2300.h diff --git a/tools/ff-0.7/sample/lpc2k/LPC2368-ROM.ld b/packages/ff-0.7/sample/lpc2k/LPC2368-ROM.ld similarity index 100% rename from tools/ff-0.7/sample/lpc2k/LPC2368-ROM.ld rename to packages/ff-0.7/sample/lpc2k/LPC2368-ROM.ld diff --git a/tools/ff-0.7/sample/lpc2k/Makefile b/packages/ff-0.7/sample/lpc2k/Makefile similarity index 100% rename from tools/ff-0.7/sample/lpc2k/Makefile rename to packages/ff-0.7/sample/lpc2k/Makefile diff --git a/tools/ff-0.7/sample/lpc2k/asmfunc.S b/packages/ff-0.7/sample/lpc2k/asmfunc.S similarity index 100% rename from tools/ff-0.7/sample/lpc2k/asmfunc.S rename to packages/ff-0.7/sample/lpc2k/asmfunc.S diff --git a/tools/ff-0.7/sample/lpc2k/comm.c b/packages/ff-0.7/sample/lpc2k/comm.c similarity index 100% rename from tools/ff-0.7/sample/lpc2k/comm.c rename to packages/ff-0.7/sample/lpc2k/comm.c diff --git a/tools/ff-0.7/sample/lpc2k/comm.h b/packages/ff-0.7/sample/lpc2k/comm.h similarity index 100% rename from tools/ff-0.7/sample/lpc2k/comm.h rename to packages/ff-0.7/sample/lpc2k/comm.h diff --git a/tools/ff-0.7/sample/lpc2k/diskio.h b/packages/ff-0.7/sample/lpc2k/diskio.h similarity index 100% rename from tools/ff-0.7/sample/lpc2k/diskio.h rename to packages/ff-0.7/sample/lpc2k/diskio.h diff --git a/tools/ff-0.7/sample/lpc2k/ff.c b/packages/ff-0.7/sample/lpc2k/ff.c similarity index 100% rename from tools/ff-0.7/sample/lpc2k/ff.c rename to packages/ff-0.7/sample/lpc2k/ff.c diff --git a/tools/ff-0.7/sample/lpc2k/ff.h b/packages/ff-0.7/sample/lpc2k/ff.h similarity index 100% rename from tools/ff-0.7/sample/lpc2k/ff.h rename to packages/ff-0.7/sample/lpc2k/ff.h diff --git a/tools/ff-0.7/sample/lpc2k/integer.h b/packages/ff-0.7/sample/lpc2k/integer.h similarity index 100% rename from tools/ff-0.7/sample/lpc2k/integer.h rename to packages/ff-0.7/sample/lpc2k/integer.h diff --git a/tools/ff-0.7/sample/lpc2k/interrupt.h b/packages/ff-0.7/sample/lpc2k/interrupt.h similarity index 100% rename from tools/ff-0.7/sample/lpc2k/interrupt.h rename to packages/ff-0.7/sample/lpc2k/interrupt.h diff --git a/tools/ff-0.7/sample/lpc2k/lpc_mmc.png b/packages/ff-0.7/sample/lpc2k/lpc_mmc.png similarity index 100% rename from tools/ff-0.7/sample/lpc2k/lpc_mmc.png rename to packages/ff-0.7/sample/lpc2k/lpc_mmc.png diff --git a/tools/ff-0.7/sample/lpc2k/main.c b/packages/ff-0.7/sample/lpc2k/main.c similarity index 100% rename from tools/ff-0.7/sample/lpc2k/main.c rename to packages/ff-0.7/sample/lpc2k/main.c diff --git a/tools/ff-0.7/sample/lpc2k/mci.c b/packages/ff-0.7/sample/lpc2k/mci.c similarity index 100% rename from tools/ff-0.7/sample/lpc2k/mci.c rename to packages/ff-0.7/sample/lpc2k/mci.c diff --git a/tools/ff-0.7/sample/lpc2k/monitor.c b/packages/ff-0.7/sample/lpc2k/monitor.c similarity index 100% rename from tools/ff-0.7/sample/lpc2k/monitor.c rename to packages/ff-0.7/sample/lpc2k/monitor.c diff --git a/tools/ff-0.7/sample/lpc2k/monitor.h b/packages/ff-0.7/sample/lpc2k/monitor.h similarity index 100% rename from tools/ff-0.7/sample/lpc2k/monitor.h rename to packages/ff-0.7/sample/lpc2k/monitor.h diff --git a/tools/ff-0.7/sample/lpc2k/rtc.c b/packages/ff-0.7/sample/lpc2k/rtc.c similarity index 100% rename from tools/ff-0.7/sample/lpc2k/rtc.c rename to packages/ff-0.7/sample/lpc2k/rtc.c diff --git a/tools/ff-0.7/sample/lpc2k/rtc.h b/packages/ff-0.7/sample/lpc2k/rtc.h similarity index 100% rename from tools/ff-0.7/sample/lpc2k/rtc.h rename to packages/ff-0.7/sample/lpc2k/rtc.h diff --git a/tools/ff-0.7/sample/lpc2k/unicode/cc932.c b/packages/ff-0.7/sample/lpc2k/unicode/cc932.c similarity index 100% rename from tools/ff-0.7/sample/lpc2k/unicode/cc932.c rename to packages/ff-0.7/sample/lpc2k/unicode/cc932.c diff --git a/tools/ff-0.7/src/00readme.txt b/packages/ff-0.7/src/00readme.txt similarity index 100% rename from tools/ff-0.7/src/00readme.txt rename to packages/ff-0.7/src/00readme.txt diff --git a/tools/ff-0.7/src/diskio.c b/packages/ff-0.7/src/diskio.c similarity index 100% rename from tools/ff-0.7/src/diskio.c rename to packages/ff-0.7/src/diskio.c diff --git a/tools/ff-0.7/src/diskio.h b/packages/ff-0.7/src/diskio.h similarity index 100% rename from tools/ff-0.7/src/diskio.h rename to packages/ff-0.7/src/diskio.h diff --git a/tools/ff-0.7/src/ff.c b/packages/ff-0.7/src/ff.c similarity index 100% rename from tools/ff-0.7/src/ff.c rename to packages/ff-0.7/src/ff.c diff --git a/tools/ff-0.7/src/ff.h b/packages/ff-0.7/src/ff.h similarity index 100% rename from tools/ff-0.7/src/ff.h rename to packages/ff-0.7/src/ff.h diff --git a/tools/ff-0.7/src/integer.h b/packages/ff-0.7/src/integer.h similarity index 100% rename from tools/ff-0.7/src/integer.h rename to packages/ff-0.7/src/integer.h diff --git a/tools/ff-0.7/src/option/cc932.c b/packages/ff-0.7/src/option/cc932.c similarity index 100% rename from tools/ff-0.7/src/option/cc932.c rename to packages/ff-0.7/src/option/cc932.c diff --git a/tools/ff-0.7/src/option/cc936.c b/packages/ff-0.7/src/option/cc936.c similarity index 100% rename from tools/ff-0.7/src/option/cc936.c rename to packages/ff-0.7/src/option/cc936.c diff --git a/tools/ff-0.7/src/option/cc949.c b/packages/ff-0.7/src/option/cc949.c similarity index 100% rename from tools/ff-0.7/src/option/cc949.c rename to packages/ff-0.7/src/option/cc949.c diff --git a/tools/ff-0.7/src/option/cc950.c b/packages/ff-0.7/src/option/cc950.c similarity index 100% rename from tools/ff-0.7/src/option/cc950.c rename to packages/ff-0.7/src/option/cc950.c diff --git a/tools/ff-0.7/src/option/ccsbcs.c b/packages/ff-0.7/src/option/ccsbcs.c similarity index 100% rename from tools/ff-0.7/src/option/ccsbcs.c rename to packages/ff-0.7/src/option/ccsbcs.c diff --git a/tools/ff-0.7/src/option/syncobj.c b/packages/ff-0.7/src/option/syncobj.c similarity index 100% rename from tools/ff-0.7/src/option/syncobj.c rename to packages/ff-0.7/src/option/syncobj.c diff --git a/tools/vusb/Changelog.txt b/tools/vusb/Changelog.txt deleted file mode 100644 index 041268e..0000000 --- a/tools/vusb/Changelog.txt +++ /dev/null @@ -1,277 +0,0 @@ -This file documents changes in the firmware-only USB driver for atmel's AVR -microcontrollers. New entries are always appended to the end of the file. -Scroll down to the bottom to see the most recent changes. - -2005-04-01: - - Implemented endpoint 1 as interrupt-in endpoint. - - Moved all configuration options to usbconfig.h which is not part of the - driver. - - Changed interface for usbVendorSetup(). - - Fixed compatibility with ATMega8 device. - - Various minor optimizations. - -2005-04-11: - - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead() - and usbFunctionWrite() now. Added configuration options to choose which - of these functions to compile in. - - Assembler module delivers receive data non-inverted now. - - Made register and bit names compatible with more AVR devices. - -2005-05-03: - - Allow address of usbRxBuf on any memory page as long as the buffer does - not cross 256 byte page boundaries. - - Better device compatibility: works with Mega88 now. - - Code optimization in debugging module. - - Documentation updates. - -2006-01-02: - - Added (free) default Vendor- and Product-IDs bought from voti.nl. - - Added USBID-License.txt file which defines the rules for using the free - shared VID/PID pair. - - Added Readme.txt to the usbdrv directory which clarifies administrative - issues. - -2006-01-25: - - Added "configured state" to become more standards compliant. - - Added "HALT" state for interrupt endpoint. - - Driver passes the "USB Command Verifier" test from usb.org now. - - Made "serial number" a configuration option. - - Minor optimizations, we now recommend compiler option "-Os" for best - results. - - Added a version number to usbdrv.h - -2006-02-03: - - New configuration variable USB_BUFFER_SECTION for the memory section where - the USB rx buffer will go. This defaults to ".bss" if not defined. Since - this buffer MUST NOT cross 256 byte pages (not even touch a page at the - end), the user may want to pass a linker option similar to - "-Wl,--section-start=.mybuffer=0x800060". - - Provide structure for usbRequest_t. - - New defines for USB constants. - - Prepared for HID implementations. - - Increased data size limit for interrupt transfers to 8 bytes. - - New macro usbInterruptIsReady() to query interrupt buffer state. - -2006-02-18: - - Ensure that the data token which is sent as an ack to an OUT transfer is - always zero sized. This fixes a bug where the host reports an error after - sending an out transfer to the device, although all data arrived at the - device. - - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite(). - -* Release 2006-02-20 - - - Give a compiler warning when compiling with debugging turned on. - - Added Oleg Semyonov's changes for IAR-cc compatibility. - - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect() - (also thanks to Oleg!). - - Rearranged tests in usbPoll() to save a couple of instructions in the most - likely case that no actions are pending. - - We need a delay between the SET ADDRESS request until the new address - becomes active. This delay was handled in usbPoll() until now. Since the - spec says that the delay must not exceed 2ms, previous versions required - aggressive polling during the enumeration phase. We have now moved the - handling of the delay into the interrupt routine. - - We must not reply with NAK to a SETUP transaction. We can only achieve this - by making sure that the rx buffer is empty when SETUP tokens are expected. - We therefore don't pass zero sized data packets from the status phase of - a transfer to usbPoll(). This change MAY cause troubles if you rely on - receiving a less than 8 bytes long packet in usbFunctionWrite() to - identify the end of a transfer. usbFunctionWrite() will NEVER be called - with a zero length. - -* Release 2006-03-14 - - - Improved IAR C support: tiny memory model, more devices - - Added template usbconfig.h file under the name usbconfig-prototype.h - -* Release 2006-03-26 - - - Added provision for one more interrupt-in endpoint (endpoint 3). - - Added provision for one interrupt-out endpoint (endpoint 1). - - Added flowcontrol macros for USB. - - Added provision for custom configuration descriptor. - - Allow ANY two port bits for D+ and D-. - - Merged (optional) receive endpoint number into global usbRxToken variable. - - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the - variable name from the single port letter instead of computing the address - of related ports from the output-port address. - -* Release 2006-06-26 - - - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the - new features. - - Removed "#warning" directives because IAR does not understand them. Use - unused static variables instead to generate a warning. - - Do not include when compiling with IAR. - - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each - USB descriptor should be handled. It is now possible to provide descriptor - data in Flash, RAM or dynamically at runtime. - - STALL is now a status in usbTxLen* instead of a message. We can now conform - to the spec and leave the stall status pending until it is cleared. - - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the - application code to reset data toggling on interrupt pipes. - -* Release 2006-07-18 - - - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes - an assembler error. - - usbDeviceDisconnect() takes pull-up resistor to high impedance now. - -* Release 2007-02-01 - - - Merged in some code size improvements from usbtiny (thanks to Dick - Streefland for these optimizations!) - - Special alignment requirement for usbRxBuf not required any more. Thanks - again to Dick Streefland for this hint! - - Reverted to "#warning" instead of unused static variables -- new versions - of IAR CC should handle this directive. - - Changed Open Source license to GNU GPL v2 in order to make linking against - other free libraries easier. We no longer require publication of the - circuit diagrams, but we STRONGLY encourage it. If you improve the driver - itself, PLEASE grant us a royalty free license to your changes for our - commercial license. - -* Release 2007-03-29 - - - New configuration option "USB_PUBLIC" in usbconfig.h. - - Set USB version number to 1.10 instead of 1.01. - - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and - USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences - to USB_CFG_DESCR_PROPS_STRING_PRODUCT. - - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver - code. - - New assembler module for 16 MHz crystal. - - usbdrvasm.S contains common code only, clock-specific parts have been moved - to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively. - -* Release 2007-06-25 - - - 16 MHz module: Do SE0 check in stuffed bits as well. - -* Release 2007-07-07 - - - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary - for negative values. - - Added 15 MHz module contributed by V. Bosch. - - Interrupt vector name can now be configured. This is useful if somebody - wants to use a different hardware interrupt than INT0. - -* Release 2007-08-07 - - - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is - not exceeded. - - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN, - USB_COUNT_SOF - - USB_INTR_PENDING can now be a memory address, not just I/O - -* Release 2007-09-19 - - - Split out common parts of assembler modules into separate include file - - Made endpoint numbers configurable so that given interface definitions - can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h. - - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut() - can handle any number of endpoints. - - Define usbDeviceConnect() and usbDeviceDisconnect() even if no - USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this - case. - -* Release 2007-12-01 - - - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size - when USB_CFG_PULLUP_IOPORTNAME is not defined. - -* Release 2007-12-13 - - - Renamed all include-only assembler modules from *.S to *.inc so that - people don't add them to their project sources. - - Distribute leap bits in tx loop more evenly for 16 MHz module. - - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR - - Avoid compiler warnings for constant expr range by casting some values in - USB descriptors. - -* Release 2008-01-21 - - - Fixed bug in 15 and 16 MHz module where the new address set with - SET_ADDRESS was already accepted at the next NAK or ACK we send, not at - the next data packet we send. This caused problems when the host polled - too fast. Thanks to Alexander Neumann for his help and patience debugging - this issue! - -* Release 2008-02-05 - - - Fixed bug in 16.5 MHz module where a register was used in the interrupt - handler before it was pushed. This bug was introduced with version - 2007-09-19 when common parts were moved to a separate file. - - Optimized CRC routine (thanks to Reimar Doeffinger). - -* Release 2008-02-16 - - - Removed outdated IAR compatibility stuff (code sections). - - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK(). - - Added optional routine usbMeasureFrameLength() for calibration of the - internal RC oscillator. - -* Release 2008-02-28 - - - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we - start with sending USBPID_DATA0. - - Changed defaults in usbconfig-prototype.h - - Added free USB VID/PID pair for MIDI class devices - - Restructured AVR-USB as separate package, not part of PowerSwitch any more. - -* Release 2008-04-18 - - - Restructured usbdrv.c so that it is easier to read and understand. - - Better code optimization with gcc 4. - - If a second interrupt in endpoint is enabled, also add it to config - descriptor. - - Added config option for long transfers (above 254 bytes), see - USB_CFG_LONG_TRANSFERS in usbconfig.h. - - Added 20 MHz module contributed by Jeroen Benschop. - -* Release 2008-05-13 - - - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length - was not incremented, pointer to length was incremented instead. - - Added code to command line tool(s) which claims an interface. This code - is disabled by default, but may be necessary on newer Linux kernels. - - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING". - - New header "usbportability.h" prepares ports to other development - environments. - - Long transfers (above 254 bytes) did not work when usbFunctionRead() was - used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!] - - In hiddata.c (example code for sending/receiving data over HID), use - USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so - that we need not claim the interface. - - in usbPoll() loop 20 times polling for RESET state instead of 10 times. - This accounts for the higher clock rates we now support. - - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop. - - Added hook to SOF code so that oscillator can be tuned to USB frame clock. - - Added timeout to waitForJ loop. Helps preventing unexpected hangs. - - Added example code for oscillator tuning to libs-device (thanks to - Henrik Haftmann for the idea to this routine). - - Implemented option USB_CFG_SUPPRESS_INTR_CODE. - -* Release 2008-10-22 - - - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and - similar, not offset of 0x20 needs to be added. - - Allow distribution under GPLv3 for those who have to link against other - code distributed under GPLv3. - -* Release 2008-11-26 - - - Removed libusb-win32 dependency for hid-data example in Makefile.windows. - It was never required and confused many people. - - Added extern uchar usbRxToken to usbdrv.h. - - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser. - -* Release 2009-03-23 - - - Hid-mouse example used settings from hid-data example, fixed that. - - Renamed project to V-USB due to a trademark issue with Atmel(r). - - Changed CommercialLicense.txt and USBID-License.txt to make the - background of USB ID registration clearer. - -* Release 2009-04-15 diff --git a/tools/vusb/CommercialLicense.txt b/tools/vusb/CommercialLicense.txt deleted file mode 100644 index 33c9311..0000000 --- a/tools/vusb/CommercialLicense.txt +++ /dev/null @@ -1,157 +0,0 @@ -V-USB Driver Software License Agreement -Version 2009-04-14 - -THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN -ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING -THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT. - - -1 DEFINITIONS - -1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH, -Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA. - -1.2 "You" shall mean the Licensee. - -1.3 "V-USB" shall mean all files included in the package distributed under -the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/) -unless otherwise noted. This includes the firmware-only USB device -implementation for Atmel AVR microcontrollers, some simple device examples -and host side software examples and libraries. - - -2 LICENSE GRANTS - -2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source -code of V-USB. - -2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the -non-exclusive right to use, copy and distribute V-USB with your hardware -product(s), restricted by the limitations in section 3 below. - -2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify -the source code and your copy of V-USB according to your needs. - -2.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB Product -ID(s), sent to you in e-mail. These Product IDs are reserved exclusively for -you. They have been obtained from Wouter van Ooijen (www.voti.nl), who has -reserved the Vendor ID 5824 (decimal) at the USB Implementers Forum, Inc. -(www.usb.org). This mechanism ensures that there are no Product ID conflicts, -but you cannot become USB certified (enter into the USB-IF Trademark License -Agreement) as you would need your own Vendor ID for that. - - -3 LICENSE RESTRICTIONS - -3.1 Number of Units. Only one of the following three definitions is -applicable. Which one is determined by the amount you pay to OBJECTIVE -DEVELOPMENT, see section 4 ("Payment") below. - -Hobby License: You may use V-USB according to section 2 above in no more -than 5 hardware units. These units must not be sold for profit. - -Entry Level License: You may use V-USB according to section 2 above in no -more than 150 hardware units. - -Professional License: You may use V-USB according to section 2 above in -any number of hardware units, except for large scale production ("unlimited -fair use"). Quantities below 10,000 units are not considered large scale -production. If your reach quantities which are obviously large scale -production, you must pay a license fee of 0.10 EUR per unit for all units -above 10,000. - -3.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber -any copy of V-USB, or any of the rights granted herein. - -3.3 Transfer. You may not transfer your rights under this Agreement to -another party without OBJECTIVE DEVELOPMENT's prior written consent. If -such consent is obtained, you may permanently transfer this License to -another party. The recipient of such transfer must agree to all terms and -conditions of this Agreement. - -3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not -expressly granted. - -3.5 Non-Exclusive Rights. Your license rights under this Agreement are -non-exclusive. - -3.6 Third Party Rights. This Agreement cannot grant you rights controlled -by third parties. In particular, you are not allowed to use the USB logo or -other trademarks owned by the USB Implementers Forum, Inc. without their -consent. Since such consent depends on USB certification, it should be -noted that V-USB will not pass certification because it does not -implement checksum verification and the microcontroller ports do not meet -the electrical specifications. - - -4 PAYMENT - -The payment amount depends on the variation of this agreement (according to -section 3.1) into which you want to enter. Concrete prices are listed on -OBJECTIVE DEVELOPMENT's web site, usually at -http://www.obdev.at/vusb/license.html. You agree to pay the amount listed -there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor -or reseller. - - -5 COPYRIGHT AND OWNERSHIP - -V-USB is protected by copyright laws and international copyright -treaties, as well as other intellectual property laws and treaties. V-USB -is licensed, not sold. - - -6 TERM AND TERMINATION - -6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE -DEVELOPMENT may terminate this Agreement and revoke the granted license and -USB-IDs if you fail to comply with any of its terms and conditions. - -6.2 Survival of Terms. All provisions regarding secrecy, confidentiality -and limitation of liability shall survive termination of this agreement. - - -7 DISCLAIMER OF WARRANTY AND LIABILITY - -LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE -DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND -NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE -TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL -RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO -STATE/JURISDICTION. - -LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, -IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY -SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER -(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, -BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY -LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE -PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE -DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY -CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS -AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB. - - -8 MISCELLANEOUS TERMS - -8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing -purposes that you entered into this agreement. - -8.2 Entire Agreement. This document represents the entire agreement between -OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by -an authorized representative of both, OBJECTIVE DEVELOPMENT and you. - -8.3 Severability. In case a provision of these terms and conditions should -be or become partly or entirely invalid, ineffective, or not executable, -the validity of all other provisions shall not be affected. - -8.4 Applicable Law. This agreement is governed by the laws of the Republic -of Austria. - -8.5 Responsible Courts. The responsible courts in Vienna/Austria will have -exclusive jurisdiction regarding all disputes in connection with this -agreement. - diff --git a/tools/vusb/License.txt b/tools/vusb/License.txt deleted file mode 100644 index 4460cfb..0000000 --- a/tools/vusb/License.txt +++ /dev/null @@ -1,361 +0,0 @@ -OBJECTIVE DEVELOPMENT GmbH's V-USB driver software is distributed under the -terms and conditions of the GNU GPL version 2 or the GNU GPL version 3. It is -your choice whether you apply the terms of version 2 or version 3. The full -text of GPLv2 is included below. In addition to the requirements in the GPL, -we STRONGLY ENCOURAGE you to do the following: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/vusb/feedback.html for your submission. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/vusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - - - 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. - - - Copyright (C) - - 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. - - , 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. diff --git a/tools/vusb/Readme.txt b/tools/vusb/Readme.txt deleted file mode 100644 index 1ba2a43..0000000 --- a/tools/vusb/Readme.txt +++ /dev/null @@ -1,79 +0,0 @@ -This is the Readme file for V-USB and related code. V-USB is Objective -Development's firmware-only USB driver for Atmel's(r) AVR(r) microcontrollers. -For more information please visit http://www.obdev.at/vusb/. - -To avoid name confusion: This project was formerly known as AVR-USB. Due to -a trademark issue, it was renamed to V-USB in April 2009. - - -WHAT IS INCLUDED IN THIS PACKAGE? -================================= -This package consists of the device side USB driver firmware, library code -for device and host and fully working examples for device and host: - - Readme.txt .............. The file you are currently reading. - usbdrv .................. V-USB firmware, to be included in your project. - examples ................ Example code for device and host side. - libs-device ............. Useful code snippets for the device firmware. - libs-host ............... Useful code snippets for host-side drivers. - circuits ................ Example circuits using this driver. - Changelog.txt ........... Documentation of changes between versions. - License.txt ............. Free Open Source license for this package (GPL). - CommercialLicense.txt ... Alternative commercial license for this package. - USBID-License.txt ....... Terms and conditions for free USB VID/PID pairs. - -Each subdirectory contains a separate Readme file which explains its -contents. - - -PREREQUISITES -============= -The AVR code of V-USB is written in C and assembler. You need either -avr-gcc or IAR CC to compile the project. We recommend avr-gcc because it -is free and easily available. Gcc version 3 generates slightly more -efficient code than version 4 for V-USB. Not every release is tested with -the IAR compiler. Previous versions have been tested with IAR 4.10B/W32 and -4.12A/W32 on an ATmega8 with the "small" and "tiny" memory model. - -Ready made avr-gcc tool chains are available for most operating systems: - * Windows: WinAVR http://winavr.sourceforge.net/ - * Mac: CrossPack for AVR Development http://www.obdev.at/crosspack/ - * Linux and other Unixes: Most free Unixes have optional packages for AVR - development. If not, follow the instructions at - http://www.nongnu.org/avr-libc/user-manual/install_tools.html - -Our host side examples are compiled with gcc on all platforms. Gcc is the -default C compiler on Mac, Linux and many other Unixes. On windows, we -recommend MinGW (http://www.mingw.org/). Use the automated MinGW installer -for least troubles. You also need MSYS from the same site to work with -standard Makefiles. - -Most examples also depend on libusb. Libusb is available from -http://libusb.sourceforge.net/ for Unix and -http://libusb-win32.sourceforge.net/ for Windows. - - -TECHNICAL DOCUMENTATION -======================= -The API reference of the driver firmware can be found in usbdrv/usbdrv.h. -Documentation for host and device library files are in the respective header -files. For more information, see our documentation wiki at -http://www.obdev.at/goto.php?t=vusb-wiki. - - -LICENSE -======= -V-USB and related code is distributed under the terms of the GNU General -Public License (GPL) version 2 (see License.txt for details) and the GNU -General Public License (GPL) version 3. It is your choice whether you apply -the terms of version 2 or version 3. In addition to the terms of the GPL, we -strongly encourage you to publish your entire project and mail OBJECTIVE -DEVELOPMENT a link to your publication. - -Alternatively, we offer a commercial license without the restrictions of the -GPL. See CommercialLicense.txt for details. - - ----------------------------------------------------------------------------- -(c) 2009 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/USBID-License.txt b/tools/vusb/USBID-License.txt deleted file mode 100644 index c40be92..0000000 --- a/tools/vusb/USBID-License.txt +++ /dev/null @@ -1,154 +0,0 @@ -Royalty-Free Non-Exclusive Use of USB Product-IDs -================================================= - -Version 2009-04-13 - -Strictly speaking, this is not a license. You can't give a license to use -a simple number (such as e.g. 1500) for any purpose. This is a set of rules -which should make it possible to build USB devices without the requirement -for individual USB IDs. If you break one of the rules, you will run into -technical problems sooner or later, but you don't risk legal trouble. - - -OBJECTIVE DEVELOPMENT Software GmbH hereby grants you the non-exclusive -right to use four USB.org vendor-ID (VID) / product-ID (PID) pairs with -products based on Objective Development's firmware-only USB driver for -Atmel AVR microcontrollers: - - * VID = 5824 (=0x16c0) / PID = 1500 (=0x5dc) for devices implementing no - USB device class (vendor-class devices with USB class = 0xff). Devices - using this pair will be referred to as "VENDOR CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1503 (=0x5df) for HID class devices - (excluding mice and keyboards). Devices using this pair will be referred - to as "HID CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1505 (=0x5e1) for CDC class modem devices - Devices using this pair will be referred to as "CDC-ACM CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1508 (=0x5e4) for MIDI class devices - Devices using this pair will be referred to as "MIDI CLASS" devices. - -Since the granted right is non-exclusive, the same VID/PID pairs may be -used by many companies and individuals for different products. To avoid -conflicts, your device and host driver software MUST adhere to the rules -outlined below. - -OBJECTIVE DEVELOPMENT Software GmbH has obtained these VID/PID pairs from -Wouter van Ooijen (see www.voti.nl) for exclusive disposition. Wouter van -Ooijen has obtained the VID from the USB Implementers Forum, Inc. -(see www.usb.org). The VID is registered for the company name -"Van Ooijen Technische Informatica". - - -RULES AND RESTRICTIONS -====================== - -(1) The USB device MUST provide a textual representation of the -manufacturer and product identification. The manufacturer identification -MUST be available at least in USB language 0x0409 (English/US). - -(2) The textual manufacturer identification MUST contain either an Internet -domain name (e.g. "mycompany.com") registered and owned by you, or an -e-mail address under your control (e.g. "myname@gmx.net"). You can embed -the domain name or e-mail address in any string you like, e.g. "Objective -Development http://www.obdev.at/vusb/". - -(3) You are responsible for retaining ownership of the domain or e-mail -address for as long as any of your products are in use. - -(4) You may choose any string for the textual product identification, as -long as this string is unique within the scope of your textual manufacturer -identification. - -(5) Matching of device-specific drivers MUST be based on the textual -manufacturer and product identification in addition to the usual VID/PID -matching. This means that operating system features which are based on -VID/PID matching only (e.g. Windows kernel level drivers, automatic actions -when the device is plugged in etc) MUST NOT be used. The driver matching -MUST be a comparison of the entire strings, NOT a sub-string match. For -CDC-ACM CLASS and MIDI CLASS devices, a generic class driver should be used -and the matching is based on the USB device class. - -(6) The extent to which VID/PID matching is allowed for non device-specific -drivers or features depends on the operating system and particular VID/PID -pair used: - - * Mac OS X, Linux, FreeBSD and other Unixes: No VID/PID matching is - required and hence no VID/PID-only matching is allowed at all. - - * Windows: The operating system performs VID/PID matching for the kernel - level driver. You are REQUIRED to use libusb-win32 (see - http://libusb-win32.sourceforge.net/) as the kernel level driver for - VENDOR CLASS devices. HID CLASS devices all use the generic HID class - driver shipped with Windows, except mice and keyboards. You therefore - MUST NOT use any of the shared VID/PID pairs for mice or keyboards. - CDC-ACM CLASS devices require a ".inf" file which matches on the VID/PID - pair. This ".inf" file MUST load the "usbser" driver to configure the - device as modem (COM-port). - -(7) OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any -problems which are caused by the shared use of these VID/PID pairs. You -have been warned that the sharing of VID/PID pairs may cause problems. If -you want to avoid them, get your own VID/PID pair for exclusive use. - - -HOW TO IMPLEMENT THESE RULES -============================ - -The following rules are for VENDOR CLASS and HID CLASS devices. CDC-ACM -CLASS and MIDI CLASS devices use the operating system's class driver and -don't need a custom driver. - -The host driver MUST iterate over all devices with the given VID/PID -numbers in their device descriptors and query the string representation for -the manufacturer name in USB language 0x0409 (English/US). It MUST compare -the ENTIRE string with your textual manufacturer identification chosen in -(2) above. A substring search for your domain or e-mail address is NOT -acceptable. The driver MUST NOT touch the device (other than querying the -descriptors) unless the strings match. - -For all USB devices with matching VID/PID and textual manufacturer -identification, the host driver must query the textual product -identification and string-compare it with the name of the product it can -control. It may only initialize the device if the product matches exactly. - -Objective Development provides examples for these matching rules with the -"PowerSwitch" project (using libusb) and with the "Automator" project -(using Windows calls on Windows and libusb on Unix). - - -Technical Notes: -================ - -Sharing the same VID/PID pair among devices is possible as long as ALL -drivers which match the VID/PID also perform matching on the textual -identification strings. This is easy on all operating systems except -Windows, since Windows establishes a static connection between the VID/PID -pair and a kernel level driver. All devices with the same VID/PID pair must -therefore use THE SAME kernel level driver. - -We therefore demand that you use libusb-win32 for VENDOR CLASS devices. -This is a generic kernel level driver which allows all types of USB access -for user space applications. This is only a partial solution of the -problem, though, because different device drivers may come with different -versions of libusb-win32 and they may not work with the libusb version of -the respective other driver. You are therefore encouraged to test your -driver against a broad range of libusb-win32 versions. Do not use new -features in new versions, or check for their existence before you use them. -When a new libusb-win32 becomes available, make sure that your driver is -compatible with it. - -For HID CLASS devices it is necessary that all those devices bind to the -same kernel driver: Microsoft's generic USB HID driver. This is true for -all HID devices except those with a specialized driver. Currently, the only -HIDs with specialized drivers are mice and keyboards. You therefore MUST -NOT use a shared VID/PID with mouse and keyboard devices. - -Sharing the same VID/PID among different products is unusual and probably -violates the USB specification. If you do it, you do it at your own risk. - -To avoid possible incompatibilities, we highly recommend that you get your -own VID/PID pair if you intend to sell your product. Objective -Development's commercial licenses for V-USB include a PID for -unrestricted exclusive use. diff --git a/tools/vusb/circuits/Readme.txt b/tools/vusb/circuits/Readme.txt deleted file mode 100644 index 1aa5218..0000000 --- a/tools/vusb/circuits/Readme.txt +++ /dev/null @@ -1,79 +0,0 @@ -This is the Readme file for the V-USB example circuits directory. - - -CIRCUITS IN THIS DIRECTORY -========================== -Since USB requires 3.3 V levels on D+ and D- but delivers a power supply of -ca. 5 V, some kind of level conversion must be performed. There are several -ways to implement this level conversion, see the example circuits below. - -with-vreg.png and with-vreg.sch (EAGLE schematics): - This circuit uses a low drop voltage regulator to reduce the USB supply to - 3.3 V. You MUST use a low drop regulator because standard regulators such - as the LM317 require at least ca. 2 V drop. The advantage of this approach - is that it comes closest to the voltage levels required by the USB - specification and that the circuit is powered from a regulated supply. If - no USB cable is used (connector directly soldered on PCB), you can even - omit the 68 Ohm series resistors. The disadvantage is that you may want to - use other chips in your design which require 5 V. Please check that the AVR - used in your design allows the chosen clock rate at 3.3 V. - -with-zener.png and with-zener.sch (EAGLE schematics): - This circuit enforces lower voltage levels on D+ and D- with zener diodes. - The zener diodes MUST be low power / low current types to ensure that the - 1k5 pull-up resistor on D- generates a voltage of well above 2.5 V (but - below 3.6 V). The advantage of this circuit is its simplicity and that the - circuit can be powered at 5 V (usually precise enough if the cable drop is - neglected). The disadvantage is that some zener diodes have a lower voltage - than 3 V when powered through 1k5 and the choice of components becomes - relevant. In addition to that, the power consumption during USB data - transfer is increased because the current is only limited by the 68 Ohm - series resistor. The zeners may even distort the signal waveforms due to - their capacity. - -with-series-diodes.png and with-series-diodes.sch (EAGLE schematics): - This is a simplified low-cost version of the voltage regulator approach. - Instead of using a voltage regulator, we reduce the voltage by the forward - voltage of two silicon diodes (roughly 1.4 V). This gives ca. 3.6 V which - is practically inside the allowed range. The big disadvantage is that the - supply is not regulated -- it even depends strongly on the power - consumption. This cannot be tolerated for analog circuits. - -tiny45-rc.png and tiny45-rc.sch (EAGLE schematics): - This is mostly an example for connecting an 8 pin device using the internal - RC oscillator for system clock. This example uses series diodes to limit - the supply, but you may choose any other method. Please note that you must - choose a clock rate of 12.8 or 16.5 MHz because only the receiver modules - for these frequencies have a PLL to allow higher clock rate tolerances. - - -GENERAL DESIGN NOTES -==================== -All examples have D+ on hardware interrupt INT0 because this is the highest -priority interrupt on AVRs. You may use other hardware interrupts (and -configure the options at the end of usbconfig.h accordingly) if you make sure -that no higher priority interrupt is used. - -If you use USB_SOF_HOOK or USB_COUNT_SOF in usbconfig.h, you must wire D- to -the interrupt instead. This way the interrupt is triggered on USB Start Of -Frame pulses as well. - -Most examples have a 1M pull-down resistor at D+. This pull-up ensures that -in self-powered designs no interrupts occur while USB is not connected. You -may omit this resistor in bus-powered designs. Older examples had a pull-up -resistor instead. This is not compatible with the zener diode approach to -level conversion: 1M pull-up in conjunction with a 3.6 V zener diode give an -invalid logic level. - -All examples with ATMega8/88/168 have D+ at port D bit 2 (because this is -hardware interrupt 0) and D- on port D bit 4 because it is also a clock input -for timer/counter 0. This way the firmware can easily check for activity on -D- (USB frame pulses) by checking the counter value in regular intervals. If -no activity is found, the firmware should (according to the USB -specification) put the system into a low power suspend mode. - - - ----------------------------------------------------------------------------- -(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/circuits/tiny45-rc.png b/tools/vusb/circuits/tiny45-rc.png deleted file mode 100644 index 3913921..0000000 Binary files a/tools/vusb/circuits/tiny45-rc.png and /dev/null differ diff --git a/tools/vusb/circuits/tiny45-rc.sch b/tools/vusb/circuits/tiny45-rc.sch deleted file mode 100644 index 349f1ad..0000000 Binary files a/tools/vusb/circuits/tiny45-rc.sch and /dev/null differ diff --git a/tools/vusb/circuits/with-series-diodes.png b/tools/vusb/circuits/with-series-diodes.png deleted file mode 100644 index dcaa275..0000000 Binary files a/tools/vusb/circuits/with-series-diodes.png and /dev/null differ diff --git a/tools/vusb/circuits/with-series-diodes.sch b/tools/vusb/circuits/with-series-diodes.sch deleted file mode 100644 index d84d99e..0000000 Binary files a/tools/vusb/circuits/with-series-diodes.sch and /dev/null differ diff --git a/tools/vusb/circuits/with-vreg.png b/tools/vusb/circuits/with-vreg.png deleted file mode 100644 index 2aba739..0000000 Binary files a/tools/vusb/circuits/with-vreg.png and /dev/null differ diff --git a/tools/vusb/circuits/with-vreg.sch b/tools/vusb/circuits/with-vreg.sch deleted file mode 100644 index 1f1797b..0000000 Binary files a/tools/vusb/circuits/with-vreg.sch and /dev/null differ diff --git a/tools/vusb/circuits/with-zener.png b/tools/vusb/circuits/with-zener.png deleted file mode 100644 index 0ec8893..0000000 Binary files a/tools/vusb/circuits/with-zener.png and /dev/null differ diff --git a/tools/vusb/circuits/with-zener.sch b/tools/vusb/circuits/with-zener.sch deleted file mode 100644 index e7da8e5..0000000 Binary files a/tools/vusb/circuits/with-zener.sch and /dev/null differ diff --git a/tools/vusb/examples/Readme.txt b/tools/vusb/examples/Readme.txt deleted file mode 100644 index 82b10fe..0000000 --- a/tools/vusb/examples/Readme.txt +++ /dev/null @@ -1,102 +0,0 @@ -This is the Readme file for the directory "examples" of V-USB, a firmware- -only USB driver for AVR microcontrollers. - -WHAT IS IN THIS DIRECTORY? -========================== -This directory contains examples which are mostly for educational purposes. -Examples can be device firmware only, host software only or both. Here is -a summary: - -custom-class - A custom class device with host software based on libusb. It demonstrates - the straight forward way of sending small amounts of data to a device and - receiving data from the device. It does NOT demonstrate how to send large - amounts of data to the device or how to receive data generated on the fly - by the device (how to use usbFunctionWrite() and usbFunctionRead()). See - the hid-data example for how usbFunctionWrite() and usbFunctionRead() are - used. - -hid-custom-rq - This example implements the same functionality as the custom-class example - above, but declares the device as HID. This prevents the "give me a driver - CD" dialog on Windows. The device can still be controlled with libusb as in - the previous example (on Windows, the filter version of libusb-win32 must - be installed). In addition to the features presented in custom-class, this - example demonstrates how a HID class device is defined. - -hid-mouse - This example implements a mouse device. No host driver is required since - today's operating systems have drivers for USB mice built-in. It - demonstrates how a real-world HID class device is implemented and how - interrupt-in endpoints are used. - -hid-data - This example demonstrates how the HID class can be misused to transfer - arbitrary data over HID feature reports. This technique is of great value - on Windows because no driver DLLs are needed (the hid-custom-rq example - still requires the libusb-win32 DLL, although it may be in the program's - directory). The host side application requires no installation, it can - even be started directly from a CD. This example also demonstrates how - to transfer data using usbFunctionWrite() and usbFunctionRead(). - -usbtool - This is a general purpose development and debugging tool for USB devices. - You can use it during development of your device to test various requests - without special test programs. But it is also an example how all the - libusb API functions are used. - -More information about each example can be found in the Readme file in the -respective directory. - -Hardware dependencies of AVR code has been kept at a minimum. All examples -should work on any AVR chip which has enough resources to run the driver. -Makefile and usbconfig.h have been configured for the metaboard hardware (see -http://www.obdev.at/goto.php?t=metaboard for details). Edit the target -device, fuse values, clock rate and programmer in Makefile and the I/O pins -dedicated to USB in usbconfig.h. - - -WHAT IS NOT DEMONSTRATED IN THESE EXAMPLES? -=========================================== -These examples show only the most basic functionality. More elaborate -examples and real world applications showing more features of the driver are -available at http://www.obdev.at/vusb/projects.html. Most of these -features are described in our documentation wiki at -http://www.obdev.at/goto.php?t=vusb-wiki. - -To mention just a few: - -Using RC oscillator for system clock - The 12.8 MHz and 16.5 MHz modules of V-USB have been designed to cope - with clock rate deviations up to 1%. This allows an RC oscillator to be - used. Since the AVR's RC oscillator has a factory precision of only 10%, - it must be calibrated to an external reference. The EasyLogger example - shows how this can be done. - -Dynamically generated descriptors - Sometimes you want to implement different typtes of USB device depending - on a jumper or other condition. V-USB has a very flexible interface for - providing USB descriptors. See AVR-Doper for how to provide descriptors - at runtime. - -Virtual COM port - Some people prefer a virtual serial interface to communicate with their - device. We strongly discourage this method because it does things - forbidden by the USB specification. If you still want to go this route, - see AVR-CDC. - -Implementing suspend mode - V-USB does not implement suspend mode. This means that the device does - not reduce power consumption when the host goes into sleep mode. Device - firmware is free to implement suspend mode, though. See USB2LPT for an - example. - -The projects mentioned above can best be found on - - http://www.obdev.at/vusb/prjall.html - -where all projects are listed. - ----------------------------------------------------------------------------- -(c) 2009 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/examples/custom-class/Readme.txt b/tools/vusb/examples/custom-class/Readme.txt deleted file mode 100644 index 815518e..0000000 --- a/tools/vusb/examples/custom-class/Readme.txt +++ /dev/null @@ -1,64 +0,0 @@ -This is the Readme file for the custom-class example. In this example, we -show how an LED can be controlled via USB. - - -WHAT IS DEMONSTRATED? -===================== -This example shows how small amounts of data (several bytes) can be -transferred between the device and the host. In addition to a very basic -USB device, it demonstrates how to build a host side driver application -using libusb or libusb-win32. It does NOT show how usbFunctionWrite() and -usbFunctionRead() are used. See the hid-data example if you want to learn -about these functions. - - -PREREQUISITES -============= -Target hardware: You need an AVR based circuit based on one of the examples -(see the "circuits" directory at the top level of this package), e.g. the -metaboard (http://www.obdev.at/goto.php?t=metaboard). - -AVR development environment: You need the gcc tool chain for the AVR, see -the Prerequisites section in the top level Readme file for how to obtain it. - -Host development environment: A C compiler and libusb. See the top level -Readme file, section Prerequisites for more information. - - -BUILDING THE FIRMWARE -===================== -Change to the "firmware" directory and modify Makefile according to your -architecture (CPU clock, target device, fuse values) and ISP programmer. Then -edit usbconfig.h according to your pin assignments for D+ and D-. The default -settings are for the metaboard hardware. You should have wired an LED with a -current limiting resistor of ca. 270 Ohm to a free I/O pin. Change the -defines in main.c to match the port and bit number. - -Type "make hex" to build main.hex, then "make flash" to upload the firmware -to the device. Don't forget to run "make fuse" once to program the fuses. If -you use a prototyping board with boot loader, follow the instructions of the -boot loader instead. - -Please note that the first "make hex" copies the driver from the top level -into the firmware directory. If you use a different build system than our -Makefile, you must copy the driver by hand. - - -BUILDING THE HOST SOFTWARE -========================== -Since the host software is based on libusb or libusb-win32, make sure that -this library is installed. On Unix, ensure that libusb-config is in your -search PATH. On Windows, edit Makefile.windows and set the library path -appropriately. Then type "make" on Unix or "make -f Makefile.windows" on -Windows to build the command line tool. - - -USING THE COMMAND LINE TOOL -=========================== -The command line tool has three valid arguments: "status" to query the -current LED status, "on" to turn on the LED and "off" to turn it off. - - ----------------------------------------------------------------------------- -(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/examples/custom-class/commandline/Makefile b/tools/vusb/examples/custom-class/commandline/Makefile deleted file mode 100644 index aaa948a..0000000 --- a/tools/vusb/examples/custom-class/commandline/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# Name: Makefile -# Project: custom-class example -# Author: Christian Starkjohann -# Creation Date: 2008-04-06 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id: Makefile 692 2008-11-07 15:07:40Z cs $ - - -# Concigure the following definitions according to your system. -# This Makefile has been tested on Mac OS X, Linux and Windows. - -# Use the following 3 lines on Unix (uncomment the framework on Mac OS X): -USBFLAGS = `libusb-config --cflags` -USBLIBS = `libusb-config --libs` -EXE_SUFFIX = - -# Use the following 3 lines on Windows and comment out the 3 above. You may -# have to change the include paths to where you installed libusb-win32 -#USBFLAGS = -I/usr/local/include -#USBLIBS = -L/usr/local/lib -lusb -#EXE_SUFFIX = .exe - -NAME = set-led - -OBJECTS = opendevice.o $(NAME).o - -CC = gcc -CFLAGS = $(CPPFLAGS) $(USBFLAGS) -O -g -Wall -LIBS = $(USBLIBS) - -PROGRAM = $(NAME)$(EXE_SUFFIX) - - -all: $(PROGRAM) - -.c.o: - $(CC) $(CFLAGS) -c $< - -$(PROGRAM): $(OBJECTS) - $(CC) -o $(PROGRAM) $(OBJECTS) $(LIBS) - -strip: $(PROGRAM) - strip $(PROGRAM) - -clean: - rm -f *.o $(PROGRAM) diff --git a/tools/vusb/examples/custom-class/commandline/Makefile.windows b/tools/vusb/examples/custom-class/commandline/Makefile.windows deleted file mode 100644 index a8239ad..0000000 --- a/tools/vusb/examples/custom-class/commandline/Makefile.windows +++ /dev/null @@ -1,18 +0,0 @@ -# Name: Makefile.windows -# Project: custom-class example -# Author: Christian Starkjohann -# Creation Date: 2008-04-06 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id$ - -# You may use this file with -# make -f Makefile.windows -# on Windows with MinGW instead of editing the main Makefile. - -include Makefile - -USBFLAGS = -I/usr/local/mingw/include -USBLIBS = -L/usr/local/mingw/lib -lusb -EXE_SUFFIX = .exe diff --git a/tools/vusb/examples/custom-class/commandline/opendevice.c b/tools/vusb/examples/custom-class/commandline/opendevice.c deleted file mode 100644 index 137f50c..0000000 --- a/tools/vusb/examples/custom-class/commandline/opendevice.c +++ /dev/null @@ -1,203 +0,0 @@ -/* Name: opendevice.c - * Project: V-USB host-side library - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: opendevice.c 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -The functions in this module can be used to find and open a device based on -libusb or libusb-win32. -*/ - -#include -#include "opendevice.h" - -/* ------------------------------------------------------------------------- */ - -#define MATCH_SUCCESS 1 -#define MATCH_FAILED 0 -#define MATCH_ABORT -1 - -/* private interface: match text and p, return MATCH_SUCCESS, MATCH_FAILED, or MATCH_ABORT. */ -static int _shellStyleMatch(char *text, char *p) -{ -int last, matched, reverse; - - for(; *p; text++, p++){ - if(*text == 0 && *p != '*') - return MATCH_ABORT; - switch(*p){ - case '\\': - /* Literal match with following character. */ - p++; - /* FALLTHROUGH */ - default: - if(*text != *p) - return MATCH_FAILED; - continue; - case '?': - /* Match anything. */ - continue; - case '*': - while(*++p == '*') - /* Consecutive stars act just like one. */ - continue; - if(*p == 0) - /* Trailing star matches everything. */ - return MATCH_SUCCESS; - while(*text) - if((matched = _shellStyleMatch(text++, p)) != MATCH_FAILED) - return matched; - return MATCH_ABORT; - case '[': - reverse = p[1] == '^'; - if(reverse) /* Inverted character class. */ - p++; - matched = MATCH_FAILED; - if(p[1] == ']' || p[1] == '-') - if(*++p == *text) - matched = MATCH_SUCCESS; - for(last = *p; *++p && *p != ']'; last = *p) - if (*p == '-' && p[1] != ']' ? *text <= *++p && *text >= last : *text == *p) - matched = MATCH_SUCCESS; - if(matched == reverse) - return MATCH_FAILED; - continue; - } - } - return *text == 0; -} - -/* public interface for shell style matching: returns 0 if fails, 1 if matches */ -static int shellStyleMatch(char *text, char *pattern) -{ - if(pattern == NULL) /* NULL pattern is synonymous to "*" */ - return 1; - return _shellStyleMatch(text, pattern) == MATCH_SUCCESS; -} - -/* ------------------------------------------------------------------------- */ - -int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen) -{ -char buffer[256]; -int rval, i; - - if((rval = usb_get_string_simple(dev, index, buf, buflen)) >= 0) /* use libusb version if it works */ - return rval; - if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, 0x0409, buffer, sizeof(buffer), 5000)) < 0) - return rval; - if(buffer[1] != USB_DT_STRING){ - *buf = 0; - return 0; - } - if((unsigned char)buffer[0] < rval) - rval = (unsigned char)buffer[0]; - rval /= 2; - /* lossy conversion to ISO Latin1: */ - for(i=1;i buflen) /* destination buffer overflow */ - break; - buf[i-1] = buffer[2 * i]; - if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ - buf[i-1] = '?'; - } - buf[i-1] = 0; - return i-1; -} - -/* ------------------------------------------------------------------------- */ - -int usbOpenDevice(usb_dev_handle **device, int vendorID, char *vendorNamePattern, int productID, char *productNamePattern, char *serialNamePattern, FILE *printMatchingDevicesFp, FILE *warningsFp) -{ -struct usb_bus *bus; -struct usb_device *dev; -usb_dev_handle *handle = NULL; -int errorCode = USBOPEN_ERR_NOTFOUND; - - usb_find_busses(); - usb_find_devices(); - for(bus = usb_get_busses(); bus; bus = bus->next){ - for(dev = bus->devices; dev; dev = dev->next){ /* iterate over all devices on all busses */ - if((vendorID == 0 || dev->descriptor.idVendor == vendorID) - && (productID == 0 || dev->descriptor.idProduct == productID)){ - char vendor[256], product[256], serial[256]; - int len; - handle = usb_open(dev); /* we need to open the device in order to query strings */ - if(!handle){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot open VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - continue; - } - /* now check whether the names match: */ - len = vendor[0] = 0; - if(dev->descriptor.iManufacturer > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iManufacturer, vendor, sizeof(vendor)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query manufacturer for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* printf("seen device from vendor ->%s<-\n", vendor); */ - if(shellStyleMatch(vendor, vendorNamePattern)){ - len = product[0] = 0; - if(dev->descriptor.iProduct > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iProduct, product, sizeof(product)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query product for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* printf("seen product ->%s<-\n", product); */ - if(shellStyleMatch(product, productNamePattern)){ - len = serial[0] = 0; - if(dev->descriptor.iSerialNumber > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iSerialNumber, serial, sizeof(serial)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query serial for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - } - if(shellStyleMatch(serial, serialNamePattern)){ - if(printMatchingDevicesFp != NULL){ - if(serial[0] == 0){ - fprintf(printMatchingDevicesFp, "VID=0x%04x PID=0x%04x vendor=\"%s\" product=\"%s\"\n", dev->descriptor.idVendor, dev->descriptor.idProduct, vendor, product); - }else{ - fprintf(printMatchingDevicesFp, "VID=0x%04x PID=0x%04x vendor=\"%s\" product=\"%s\" serial=\"%s\"\n", dev->descriptor.idVendor, dev->descriptor.idProduct, vendor, product, serial); - } - }else{ - break; - } - } - } - } - } - } - usb_close(handle); - handle = NULL; - } - } - if(handle) /* we have found a deice */ - break; - } - if(handle != NULL){ - errorCode = 0; - *device = handle; - } - if(printMatchingDevicesFp != NULL) /* never return an error for listing only */ - errorCode = 0; - return errorCode; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/examples/custom-class/commandline/opendevice.h b/tools/vusb/examples/custom-class/commandline/opendevice.h deleted file mode 100644 index 0e04f73..0000000 --- a/tools/vusb/examples/custom-class/commandline/opendevice.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Name: opendevice.h - * Project: V-USB host-side library - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: opendevice.h 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -This module offers additional functionality for host side drivers based on -libusb or libusb-win32. It includes a function to find and open a device -based on numeric IDs and textual description. It also includes a function to -obtain textual descriptions from a device. - -To use this functionality, simply copy opendevice.c and opendevice.h into your -project and add them to your Makefile. You may modify and redistribute these -files according to the GNU General Public License (GPL) version 2 or 3. -*/ - -#ifndef __OPENDEVICE_H_INCLUDED__ -#define __OPENDEVICE_H_INCLUDED__ - -#include /* this is libusb, see http://libusb.sourceforge.net/ */ -#include - -int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen); -/* This function gets a string descriptor from the device. 'index' is the - * string descriptor index. The string is returned in ISO Latin 1 encoding in - * 'buf' and it is terminated with a 0-character. The buffer size must be - * passed in 'buflen' to prevent buffer overflows. A libusb device handle - * must be given in 'dev'. - * Returns: The length of the string (excluding the terminating 0) or - * a negative number in case of an error. If there was an error, use - * usb_strerror() to obtain the error message. - */ - -int usbOpenDevice(usb_dev_handle **device, int vendorID, char *vendorNamePattern, int productID, char *productNamePattern, char *serialNamePattern, FILE *printMatchingDevicesFp, FILE *warningsFp); -/* This function iterates over all devices on all USB busses and searches for - * a device. Matching is done first by means of Vendor- and Product-ID (passed - * in 'vendorID' and 'productID'. An ID of 0 matches any numeric ID (wildcard). - * When a device matches by its IDs, matching by names is performed. Name - * matching can be done on textual vendor name ('vendorNamePattern'), product - * name ('productNamePattern') and serial number ('serialNamePattern'). A - * device matches only if all non-null pattern match. If you don't care about - * a string, pass NULL for the pattern. Patterns are Unix shell style pattern: - * '*' stands for 0 or more characters, '?' for one single character, a list - * of characters in square brackets for a single character from the list - * (dashes are allowed to specify a range) and if the lis of characters begins - * with a caret ('^'), it matches one character which is NOT in the list. - * Other parameters to the function: If 'warningsFp' is not NULL, warning - * messages are printed to this file descriptor with fprintf(). If - * 'printMatchingDevicesFp' is not NULL, no device is opened but matching - * devices are printed to the given file descriptor with fprintf(). - * If a device is opened, the resulting USB handle is stored in '*device'. A - * pointer to a "usb_dev_handle *" type variable must be passed here. - * Returns: 0 on success, an error code (see defines below) on failure. - */ - -/* usbOpenDevice() error codes: */ -#define USBOPEN_SUCCESS 0 /* no error */ -#define USBOPEN_ERR_ACCESS 1 /* not enough permissions to open device */ -#define USBOPEN_ERR_IO 2 /* I/O error */ -#define USBOPEN_ERR_NOTFOUND 3 /* device not found */ - - -/* Obdev's free USB IDs, see USBID-License.txt for details */ - -#define USB_VID_OBDEV_SHARED 5824 /* obdev's shared vendor ID */ -#define USB_PID_OBDEV_SHARED_CUSTOM 1500 /* shared PID for custom class devices */ -#define USB_PID_OBDEV_SHARED_HID 1503 /* shared PID for HIDs except mice & keyboards */ -#define USB_PID_OBDEV_SHARED_CDCACM 1505 /* shared PID for CDC Modem devices */ -#define USB_PID_OBDEV_SHARED_MIDI 1508 /* shared PID for MIDI class devices */ - -#endif /* __OPENDEVICE_H_INCLUDED__ */ diff --git a/tools/vusb/examples/custom-class/commandline/set-led.c b/tools/vusb/examples/custom-class/commandline/set-led.c deleted file mode 100644 index 3f167dc..0000000 --- a/tools/vusb/examples/custom-class/commandline/set-led.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Name: set-led.c - * Project: custom-class, a basic USB example - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: set-led.c 692 2008-11-07 15:07:40Z cs $ - */ - -/* -General Description: -This is the host-side driver for the custom-class example device. It searches -the USB for the LEDControl device and sends the requests understood by this -device. -This program must be linked with libusb on Unix and libusb-win32 on Windows. -See http://libusb.sourceforge.net/ or http://libusb-win32.sourceforge.net/ -respectively. -*/ - -#include -#include -#include -#include /* this is libusb */ -#include "opendevice.h" /* common code moved to separate module */ - -#include "../firmware/requests.h" /* custom request numbers */ -#include "../firmware/usbconfig.h" /* device's VID/PID and names */ - -static void usage(char *name) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, " %s on ....... turn on LED\n", name); - fprintf(stderr, " %s off ...... turn off LED\n", name); - fprintf(stderr, " %s status ... ask current status of LED\n", name); -#if ENABLE_TEST - fprintf(stderr, " %s test ..... run driver reliability test\n", name); -#endif /* ENABLE_TEST */ -} - -int main(int argc, char **argv) -{ -usb_dev_handle *handle = NULL; -const unsigned char rawVid[2] = {USB_CFG_VENDOR_ID}, rawPid[2] = {USB_CFG_DEVICE_ID}; -char vendor[] = {USB_CFG_VENDOR_NAME, 0}, product[] = {USB_CFG_DEVICE_NAME, 0}; -char buffer[4]; -int cnt, vid, pid, isOn; - - usb_init(); - if(argc < 2){ /* we need at least one argument */ - usage(argv[0]); - exit(1); - } - /* compute VID/PID from usbconfig.h so that there is a central source of information */ - vid = rawVid[1] * 256 + rawVid[0]; - pid = rawPid[1] * 256 + rawPid[0]; - /* The following function is in opendevice.c: */ - if(usbOpenDevice(&handle, vid, vendor, pid, product, NULL, NULL, NULL) != 0){ - fprintf(stderr, "Could not find USB device \"%s\" with vid=0x%x pid=0x%x\n", product, vid, pid); - exit(1); - } - /* Since we use only control endpoint 0, we don't need to choose a - * configuration and interface. Reading device descriptor and setting a - * configuration and interface is done through endpoint 0 after all. - * However, newer versions of Linux require that we claim an interface - * even for endpoint 0. Enable the following code if your operating system - * needs it: */ -#if 0 - int retries = 1, usbConfiguration = 1, usbInterface = 0; - if(usb_set_configuration(handle, usbConfiguration) && showWarnings){ - fprintf(stderr, "Warning: could not set configuration: %s\n", usb_strerror()); - } - /* now try to claim the interface and detach the kernel HID driver on - * Linux and other operating systems which support the call. */ - while((len = usb_claim_interface(handle, usbInterface)) != 0 && retries-- > 0){ -#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP - if(usb_detach_kernel_driver_np(handle, 0) < 0 && showWarnings){ - fprintf(stderr, "Warning: could not detach kernel driver: %s\n", usb_strerror()); - } -#endif - } -#endif - - if(strcasecmp(argv[1], "status") == 0){ - cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, CUSTOM_RQ_GET_STATUS, 0, 0, buffer, sizeof(buffer), 5000); - if(cnt < 1){ - if(cnt < 0){ - fprintf(stderr, "USB error: %s\n", usb_strerror()); - }else{ - fprintf(stderr, "only %d bytes received.\n", cnt); - } - }else{ - printf("LED is %s\n", buffer[0] ? "on" : "off"); - } - }else if((isOn = (strcasecmp(argv[1], "on") == 0)) || strcasecmp(argv[1], "off") == 0){ - cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_SET_STATUS, isOn, 0, buffer, 0, 5000); - if(cnt < 0){ - fprintf(stderr, "USB error: %s\n", usb_strerror()); - } -#if ENABLE_TEST - }else if(strcasecmp(argv[1], "test") == 0){ - int i; - srandomdev(); - for(i = 0; i < 50000; i++){ - int value = random() & 0xffff, index = random() & 0xffff; - int rxValue, rxIndex; - if((i+1) % 100 == 0){ - fprintf(stderr, "\r%05d", i+1); - fflush(stderr); - } - cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, CUSTOM_RQ_ECHO, value, index, buffer, sizeof(buffer), 5000); - if(cnt < 0){ - fprintf(stderr, "\nUSB error in iteration %d: %s\n", i, usb_strerror()); - break; - }else if(cnt != 4){ - fprintf(stderr, "\nerror in iteration %d: %d bytes received instead of 4\n", i, cnt); - break; - } - rxValue = ((int)buffer[0] & 0xff) | (((int)buffer[1] & 0xff) << 8); - rxIndex = ((int)buffer[2] & 0xff) | (((int)buffer[3] & 0xff) << 8); - if(rxValue != value || rxIndex != index){ - fprintf(stderr, "\ndata error in iteration %d:\n", i); - fprintf(stderr, "rxValue = 0x%04x value = 0x%04x\n", rxValue, value); - fprintf(stderr, "rxIndex = 0x%04x index = 0x%04x\n", rxIndex, index); - } - } - fprintf(stderr, "\nTest completed.\n"); -#endif /* ENABLE_TEST */ - }else{ - usage(argv[0]); - exit(1); - } - usb_close(handle); - return 0; -} diff --git a/tools/vusb/examples/custom-class/firmware/Makefile b/tools/vusb/examples/custom-class/firmware/Makefile deleted file mode 100644 index e909fc6..0000000 --- a/tools/vusb/examples/custom-class/firmware/Makefile +++ /dev/null @@ -1,164 +0,0 @@ -# Name: Makefile -# Project: custom-class example -# Author: Christian Starkjohann -# Creation Date: 2008-04-07 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id: Makefile 692 2008-11-07 15:07:40Z cs $ - -DEVICE = atmega168 -F_CPU = 16000000 # in Hz -FUSE_L = # see below for fuse values for particular devices -FUSE_H = -AVRDUDE = avrdude -c usbasp -p $(DEVICE) # edit this line for your programmer - -CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0 -OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o - -COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE) - -############################################################################## -# Fuse values for particular devices -############################################################################## -# If your device is not listed here, go to -# http://palmavr.sourceforge.net/cgi-bin/fc.cgi -# and choose options for external crystal clock and no clock divider -# -################################## ATMega8 ################################## -# ATMega8 FUSE_L (Fuse low byte): -# 0x9f = 1 0 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ BODEN (BrownOut Detector enabled) -# +-------------------- BODLEVEL (2.7V) -# ATMega8 FUSE_H (Fuse high byte): -# 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000) -# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 -# | | | | | +-------- BOOTSZ1 -# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase) -# | | | +-------------- CKOPT (full output swing) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ WDTON (WDT not always on) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATMega48/88/168 ############################## -# ATMega*8 FUSE_L (Fuse low byte): -# 0xdf = 1 1 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ CKOUT (if 0: Clock output enabled) -# +-------------------- CKDIV8 (if 0: divide by 8) -# ATMega*8 FUSE_H (Fuse high byte): -# 0xde = 1 1 0 1 1 1 1 0 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V) -# | | | | + --------- EESAVE (preserve EEPROM over chip erase) -# | | | +-------------- WDTON (if 0: watchdog always on) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATTiny25/45/85 ############################### -# ATMega*5 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATMega*5 FUSE_H (Fuse high byte): -# 0xdd = 1 1 0 1 1 1 0 1 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (disable external reset -> enabled) -# -################################ ATTiny2313 ################################# -# ATTiny2313 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATTiny2313 FUSE_H (Fuse high byte): -# 0xdb = 1 1 0 1 1 0 1 1 -# ^ ^ ^ ^ \-+-/ ^ -# | | | | | +---- RSTDISBL (disable external reset -> enabled) -# | | | | +-------- BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# +-------------------- DWEN (debug wire enable) - - -# symbolic targets: -help: - @echo "This Makefile has no default rule. Use one of the following:" - @echo "make hex ....... to build main.hex" - @echo "make program ... to flash fuses and firmware" - @echo "make fuse ...... to flash the fuses" - @echo "make flash ..... to flash the firmware (use this on metaboard)" - @echo "make clean ..... to delete objects and hex file" - -hex: main.hex - -program: flash fuse - -# rule for programming fuse bits: -fuse: - @[ "$(FUSE_H)" != "" -a "$(FUSE_L)" != "" ] || \ - { echo "*** Edit Makefile and choose values for FUSE_L and FUSE_H!"; exit 1; } - $(AVRDUDE) -U hfuse:w:$(FUSE_H):m -U lfuse:w:$(FUSE_L):m - -# rule for uploading firmware: -flash: main.hex - $(AVRDUDE) -U flash:w:main.hex:i - -# rule for deleting dependent files (those which can be built by Make): -clean: - rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s - -# Generic rule for compiling C files: -.c.o: - $(COMPILE) -c $< -o $@ - -# Generic rule for assembling Assembler source files: -.S.o: - $(COMPILE) -x assembler-with-cpp -c $< -o $@ -# "-x assembler-with-cpp" should not be necessary since this is the default -# file type for the .S (with capital S) extension. However, upper case -# characters are not always preserved on Windows. To ensure WinAVR -# compatibility define the file type manually. - -# Generic rule for compiling C to assembler, used for debugging only. -.c.s: - $(COMPILE) -S $< -o $@ - -# file targets: - -# Since we don't want to ship the driver multipe times, we copy it into this project: -usbdrv: - cp -r ../../../usbdrv . - -main.elf: usbdrv $(OBJECTS) # usbdrv dependency only needed because we copy it - $(COMPILE) -o main.elf $(OBJECTS) - -main.hex: main.elf - rm -f main.hex main.eep.hex - avr-objcopy -j .text -j .data -O ihex main.elf main.hex - avr-size main.hex - -# debugging targets: - -disasm: main.elf - avr-objdump -d main.elf - -cpp: - $(COMPILE) -E main.c diff --git a/tools/vusb/examples/custom-class/firmware/main.c b/tools/vusb/examples/custom-class/firmware/main.c deleted file mode 100644 index 90eeb3c..0000000 --- a/tools/vusb/examples/custom-class/firmware/main.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Name: main.c - * Project: custom-class, a basic USB example - * Author: Christian Starkjohann - * Creation Date: 2008-04-09 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: main.c 692 2008-11-07 15:07:40Z cs $ - */ - -/* -This example should run on most AVRs with only little changes. No special -hardware resources except INT0 are used. You may have to change usbconfig.h for -different I/O pins for USB. Please note that USB D+ must be the INT0 pin, or -at least be connected to INT0 as well. -We assume that an LED is connected to port B bit 0. If you connect it to a -different port or bit, change the macros below: -*/ -#define LED_PORT_DDR DDRB -#define LED_PORT_OUTPUT PORTB -#define LED_BIT 0 - -#include -#include -#include /* for sei() */ -#include /* for _delay_ms() */ - -#include /* required by usbdrv.h */ -#include "usbdrv.h" -#include "oddebug.h" /* This is also an example for using debug macros */ -#include "requests.h" /* The custom request numbers we use */ - -/* ------------------------------------------------------------------------- */ -/* ----------------------------- USB interface ----------------------------- */ -/* ------------------------------------------------------------------------- */ - -usbMsgLen_t usbFunctionSetup(uchar data[8]) -{ -usbRequest_t *rq = (void *)data; -static uchar dataBuffer[4]; /* buffer must stay valid when usbFunctionSetup returns */ - - if(rq->bRequest == CUSTOM_RQ_ECHO){ /* echo -- used for reliability tests */ - dataBuffer[0] = rq->wValue.bytes[0]; - dataBuffer[1] = rq->wValue.bytes[1]; - dataBuffer[2] = rq->wIndex.bytes[0]; - dataBuffer[3] = rq->wIndex.bytes[1]; - usbMsgPtr = dataBuffer; /* tell the driver which data to return */ - return 4; - }else if(rq->bRequest == CUSTOM_RQ_SET_STATUS){ - if(rq->wValue.bytes[0] & 1){ /* set LED */ - LED_PORT_OUTPUT |= _BV(LED_BIT); - }else{ /* clear LED */ - LED_PORT_OUTPUT &= ~_BV(LED_BIT); - } - }else if(rq->bRequest == CUSTOM_RQ_GET_STATUS){ - dataBuffer[0] = ((LED_PORT_OUTPUT & _BV(LED_BIT)) != 0); - usbMsgPtr = dataBuffer; /* tell the driver which data to return */ - return 1; /* tell the driver to send 1 byte */ - } - return 0; /* default for not implemented requests: return no data back to host */ -} - -/* ------------------------------------------------------------------------- */ - -int main(void) -{ -uchar i; - - wdt_enable(WDTO_1S); - /* Even if you don't use the watchdog, turn it off here. On newer devices, - * the status of the watchdog (on/off, period) is PRESERVED OVER RESET! - */ - DBG1(0x00, 0, 0); /* debug output: main starts */ - /* RESET status: all port bits are inputs without pull-up. - * That's the way we need D+ and D-. Therefore we don't need any - * additional hardware initialization. - */ - odDebugInit(); - usbInit(); - usbDeviceDisconnect(); /* enforce re-enumeration, do this while interrupts are disabled! */ - i = 0; - while(--i){ /* fake USB disconnect for > 250 ms */ - wdt_reset(); - _delay_ms(1); - } - usbDeviceConnect(); - LED_PORT_DDR |= _BV(LED_BIT); /* make the LED bit an output */ - sei(); - DBG1(0x01, 0, 0); /* debug output: main loop starts */ - for(;;){ /* main event loop */ - DBG1(0x02, 0, 0); /* debug output: main loop iterates */ - wdt_reset(); - usbPoll(); - } - return 0; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/examples/custom-class/firmware/requests.h b/tools/vusb/examples/custom-class/firmware/requests.h deleted file mode 100644 index b4ecb14..0000000 --- a/tools/vusb/examples/custom-class/firmware/requests.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Name: requests.h - * Project: custom-class, a basic USB example - * Author: Christian Starkjohann - * Creation Date: 2008-04-09 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: requests.h 692 2008-11-07 15:07:40Z cs $ - */ - -/* This header is shared between the firmware and the host software. It - * defines the USB request numbers (and optionally data types) used to - * communicate between the host and the device. - */ - -#ifndef __REQUESTS_H_INCLUDED__ -#define __REQUESTS_H_INCLUDED__ - -#define CUSTOM_RQ_ECHO 0 -/* Request that the device sends back wValue and wIndex. This is used with - * random data to test the reliability of the communication. - */ -#define CUSTOM_RQ_SET_STATUS 1 -/* Set the LED status. Control-OUT. - * The requested status is passed in the "wValue" field of the control - * transfer. No OUT data is sent. Bit 0 of the low byte of wValue controls - * the LED. - */ - -#define CUSTOM_RQ_GET_STATUS 2 -/* Get the current LED status. Control-IN. - * This control transfer involves a 1 byte data phase where the device sends - * the current status to the host. The status is in bit 0 of the byte. - */ - -#endif /* __REQUESTS_H_INCLUDED__ */ diff --git a/tools/vusb/examples/custom-class/firmware/usbconfig.h b/tools/vusb/examples/custom-class/firmware/usbconfig.h deleted file mode 100644 index dd2f0a2..0000000 --- a/tools/vusb/examples/custom-class/firmware/usbconfig.h +++ /dev/null @@ -1,350 +0,0 @@ -/* Name: usbconfig.h - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2005-04-01 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbconfig-prototype.h 740 2009-04-13 18:23:31Z cs $ - */ - -#ifndef __usbconfig_h_included__ -#define __usbconfig_h_included__ - -/* -General Description: -This file is an example configuration (with inline documentation) for the USB -driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is -also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may -wire the lines to any other port, as long as D+ is also wired to INT0 (or any -other hardware interrupt, as long as it is the highest level interrupt, see -section at the end of this file). -*/ - -/* ---------------------------- Hardware Config ---------------------------- */ - -#define USB_CFG_IOPORTNAME D -/* This is the port where the USB bus is connected. When you configure it to - * "B", the registers PORTB, PINB and DDRB will be used. - */ -#define USB_CFG_DMINUS_BIT 4 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This may be any bit in the port. - */ -#define USB_CFG_DPLUS_BIT 2 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port. Please note that D+ must also be connected - * to interrupt pin INT0! [You can also use other interrupts, see section - * "Optional MCU Description" below, or you can connect D- to the interrupt, as - * it is required if you use the USB_COUNT_SOF feature. If you use D- for the - * interrupt, the USB interrupt will also be triggered at Start-Of-Frame - * markers every millisecond.] - */ -#define USB_CFG_CLOCK_KHZ (F_CPU/1000) -/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000, - * 16500 and 20000. The 12.8 MHz and 16.5 MHz versions of the code require no - * crystal, they tolerate +/- 1% deviation from the nominal frequency. All - * other rates require a precision of 2000 ppm and thus a crystal! - * Default if not specified: 12 MHz - */ -#define USB_CFG_CHECK_CRC 0 -/* Define this to 1 if you want that the driver checks integrity of incoming - * data packets (CRC checks). CRC checks cost quite a bit of code size and are - * currently only available for 18 MHz crystal clock. You must choose - * USB_CFG_CLOCK_KHZ = 18000 if you enable this option. - */ - -/* ----------------------- Optional Hardware Config ------------------------ */ - -/* #define USB_CFG_PULLUP_IOPORTNAME D */ -/* If you connect the 1.5k pullup resistor from D- to a port pin instead of - * V+, you can connect and disconnect the device from firmware by calling - * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). - * This constant defines the port on which the pullup resistor is connected. - */ -/* #define USB_CFG_PULLUP_BIT 4 */ -/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined - * above) where the 1.5k pullup resistor is connected. See description - * above for details. - */ - -/* --------------------------- Functional Range ---------------------------- */ - -#define USB_CFG_HAVE_INTRIN_ENDPOINT 0 -/* Define this to 1 if you want to compile a version with two endpoints: The - * default control endpoint 0 and an interrupt-in endpoint (any other endpoint - * number). - */ -#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 -/* Define this to 1 if you want to compile a version with three endpoints: The - * default control endpoint 0, an interrupt-in endpoint 3 (or the number - * configured below) and a catch-all default interrupt-in endpoint as above. - * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. - */ -#define USB_CFG_EP3_NUMBER 3 -/* If the so-called endpoint 3 is used, it can now be configured to any other - * endpoint number (except 0) with this macro. Default if undefined is 3. - */ -/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */ -/* The above macro defines the startup condition for data toggling on the - * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1. - * Since the token is toggled BEFORE sending any data, the first packet is - * sent with the oposite value of this configuration! - */ -#define USB_CFG_IMPLEMENT_HALT 0 -/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature - * for endpoint 1 (interrupt endpoint). Although you may not need this feature, - * it is required by the standard. We have made it a config option because it - * bloats the code considerably. - */ -#define USB_CFG_SUPPRESS_INTR_CODE 0 -/* Define this to 1 if you want to declare interrupt-in endpoints, but don't - * want to send any data over them. If this macro is defined to 1, functions - * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if - * you need the interrupt-in endpoints in order to comply to an interface - * (e.g. HID), but never want to send any data. This option saves a couple - * of bytes in flash memory and the transmit buffers in RAM. - */ -#define USB_CFG_INTR_POLL_INTERVAL 10 -/* If you compile a version with endpoint 1 (interrupt-in), this is the poll - * interval. The value is in milliseconds and must not be less than 10 ms for - * low speed devices. - */ -#define USB_CFG_IS_SELF_POWERED 0 -/* Define this to 1 if the device has its own power supply. Set it to 0 if the - * device is powered from the USB bus. - */ -#define USB_CFG_MAX_BUS_POWER 40 -/* Set this variable to the maximum USB bus power consumption of your device. - * The value is in milliamperes. [It will be divided by two since USB - * communicates power requirements in units of 2 mA.] - */ -#define USB_CFG_IMPLEMENT_FN_WRITE 0 -/* Set this to 1 if you want usbFunctionWrite() to be called for control-out - * transfers. Set it to 0 if you don't need it and want to save a couple of - * bytes. - */ -#define USB_CFG_IMPLEMENT_FN_READ 0 -/* Set this to 1 if you need to send control replies which are generated - * "on the fly" when usbFunctionRead() is called. If you only want to send - * data from a static buffer, set it to 0 and return the data from - * usbFunctionSetup(). This saves a couple of bytes. - */ -#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 -/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. - * You must implement the function usbFunctionWriteOut() which receives all - * interrupt/bulk data sent to any endpoint other than 0. The endpoint number - * can be found in 'usbRxToken'. - */ -#define USB_CFG_HAVE_FLOWCONTROL 0 -/* Define this to 1 if you want flowcontrol over USB data. See the definition - * of the macros usbDisableAllRequests() and usbEnableAllRequests() in - * usbdrv.h. - */ -#define USB_CFG_LONG_TRANSFERS 0 -/* Define this to 1 if you want to send/receive blocks of more than 254 bytes - * in a single control-in or control-out transfer. Note that the capability - * for long transfers increases the driver size. - */ -/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ -/* This macro is a hook if you want to do unconventional things. If it is - * defined, it's inserted at the beginning of received message processing. - * If you eat the received message and don't want default processing to - * proceed, do a return after doing your things. One possible application - * (besides debugging) is to flash a status LED on each packet. - */ -/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */ -/* This macro is a hook if you need to know when an USB RESET occurs. It has - * one parameter which distinguishes between the start of RESET state and its - * end. - */ -/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */ -/* This macro (if defined) is executed when a USB SET_ADDRESS request was - * received. - */ -#define USB_COUNT_SOF 0 -/* define this macro to 1 if you need the global variable "usbSofCount" which - * counts SOF packets. This feature requires that the hardware interrupt is - * connected to D- instead of D+. - */ -/* #ifdef __ASSEMBLER__ - * macro myAssemblerMacro - * in YL, TCNT0 - * sts timer0Snapshot, YL - * endm - * #endif - * #define USB_SOF_HOOK myAssemblerMacro - * This macro (if defined) is executed in the assembler module when a - * Start Of Frame condition is detected. It is recommended to define it to - * the name of an assembler macro which is defined here as well so that more - * than one assembler instruction can be used. The macro may use the register - * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages - * immediately after an SOF pulse may be lost and must be retried by the host. - * What can you do with this hook? Since the SOF signal occurs exactly every - * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in - * designs running on the internal RC oscillator. - * Please note that Start Of Frame detection works only if D- is wired to the - * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! - */ -#define USB_CFG_CHECK_DATA_TOGGLING 0 -/* define this macro to 1 if you want to filter out duplicate data packets - * sent by the host. Duplicates occur only as a consequence of communication - * errors, when the host does not receive an ACK. Please note that you need to - * implement the filtering yourself in usbFunctionWriteOut() and - * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable - * for each control- and out-endpoint to check for duplicate packets. - */ -#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 -/* define this macro to 1 if you want the function usbMeasureFrameLength() - * compiled in. This function can be used to calibrate the AVR's RC oscillator. - */ - -/* -------------------------- Device Description --------------------------- */ - -#define USB_CFG_VENDOR_ID 0xc0, 0x16 -/* USB vendor ID for the device, low byte first. If you have registered your - * own Vendor ID, define it here. Otherwise you use one of obdev's free shared - * VID/PID pairs. Be sure to read USBID-License.txt for rules! - */ -#define USB_CFG_DEVICE_ID 0xdc, 0x05 -/* This is the ID of the product, low byte first. It is interpreted in the - * scope of the vendor ID. If you have registered your own VID with usb.org - * or if you have licensed a PID from somebody else, define it here. Otherwise - * you use obdev's free shared VID/PID pair. Be sure to read the rules in - * USBID-License.txt! - */ -#define USB_CFG_DEVICE_VERSION 0x00, 0x01 -/* Version number of the device: Minor number first, then major number. - */ -#define USB_CFG_VENDOR_NAME 'o', 'b', 'd', 'e', 'v', '.', 'a', 't' -#define USB_CFG_VENDOR_NAME_LEN 8 -/* These two values define the vendor name returned by the USB device. The name - * must be given as a list of characters under single quotes. The characters - * are interpreted as Unicode (UTF-16) entities. - * If you don't want a vendor name string, undefine these macros. - * ALWAYS define a vendor name containing your Internet domain name if you use - * obdev's free shared VID/PID pair. See the file USBID-License.txt for - * details. - */ -#define USB_CFG_DEVICE_NAME 'L', 'E', 'D', 'C', 'o', 'n', 't', 'r', 'o', 'l' -#define USB_CFG_DEVICE_NAME_LEN 10 -/* Same as above for the device name. If you don't want a device name, undefine - * the macros. See the file USBID-License.txt before you assign a name if you - * use a shared VID/PID. - */ -/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ -/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ -/* Same as above for the serial number. If you don't want a serial number, - * undefine the macros. - * It may be useful to provide the serial number through other means than at - * compile time. See the section about descriptor properties below for how - * to fine tune control over USB descriptors such as the string descriptor - * for the serial number. - */ -#define USB_CFG_DEVICE_CLASS 0xff /* set to 0 if deferred to interface */ -#define USB_CFG_DEVICE_SUBCLASS 0 -/* See USB specification if you want to conform to an existing device class. - * Class 0xff is "vendor specific". - */ -#define USB_CFG_INTERFACE_CLASS 0 /* define class here if not at device level */ -#define USB_CFG_INTERFACE_SUBCLASS 0 -#define USB_CFG_INTERFACE_PROTOCOL 0 -/* See USB specification if you want to conform to an existing device class or - * protocol. The following classes must be set at interface level: - * HID class is 3, no subclass and protocol required (but may be useful!) - * CDC class is 2, use subclass 2 and protocol 1 for ACM - */ -/* #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 42 */ -/* Define this to the length of the HID report descriptor, if you implement - * an HID device. Otherwise don't define it or define it to 0. - * If you use this define, you must add a PROGMEM character array named - * "usbHidReportDescriptor" to your code which contains the report descriptor. - * Don't forget to keep the array and this define in sync! - */ - -/* #define USB_PUBLIC static */ -/* Use the define above if you #include usbdrv.c instead of linking against it. - * This technique saves a couple of bytes in flash memory. - */ - -/* ------------------- Fine Control over USB Descriptors ------------------- */ -/* If you don't want to use the driver's default USB descriptors, you can - * provide our own. These can be provided as (1) fixed length static data in - * flash memory, (2) fixed length static data in RAM or (3) dynamically at - * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more - * information about this function. - * Descriptor handling is configured through the descriptor's properties. If - * no properties are defined or if they are 0, the default descriptor is used. - * Possible properties are: - * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched - * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is - * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if - * you want RAM pointers. - * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found - * in static memory is in RAM, not in flash memory. - * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), - * the driver must know the descriptor's length. The descriptor itself is - * found at the address of a well known identifier (see below). - * List of static descriptor names (must be declared PROGMEM if in flash): - * char usbDescriptorDevice[]; - * char usbDescriptorConfiguration[]; - * char usbDescriptorHidReport[]; - * char usbDescriptorString0[]; - * int usbDescriptorStringVendor[]; - * int usbDescriptorStringDevice[]; - * int usbDescriptorStringSerialNumber[]; - * Other descriptors can't be provided statically, they must be provided - * dynamically at runtime. - * - * Descriptor properties are or-ed or added together, e.g.: - * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) - * - * The following descriptors are defined: - * USB_CFG_DESCR_PROPS_DEVICE - * USB_CFG_DESCR_PROPS_CONFIGURATION - * USB_CFG_DESCR_PROPS_STRINGS - * USB_CFG_DESCR_PROPS_STRING_0 - * USB_CFG_DESCR_PROPS_STRING_VENDOR - * USB_CFG_DESCR_PROPS_STRING_PRODUCT - * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER - * USB_CFG_DESCR_PROPS_HID - * USB_CFG_DESCR_PROPS_HID_REPORT - * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) - * - * Note about string descriptors: String descriptors are not just strings, they - * are Unicode strings prefixed with a 2 byte header. Example: - * int serialNumberDescriptor[] = { - * USB_STRING_DESCRIPTOR_HEADER(6), - * 'S', 'e', 'r', 'i', 'a', 'l' - * }; - */ - -#define USB_CFG_DESCR_PROPS_DEVICE 0 -#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 -#define USB_CFG_DESCR_PROPS_STRINGS 0 -#define USB_CFG_DESCR_PROPS_STRING_0 0 -#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 -#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 -#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 -#define USB_CFG_DESCR_PROPS_HID 0 -#define USB_CFG_DESCR_PROPS_HID_REPORT 0 -#define USB_CFG_DESCR_PROPS_UNKNOWN 0 - -/* ----------------------- Optional MCU Description ------------------------ */ - -/* The following configurations have working defaults in usbdrv.h. You - * usually don't need to set them explicitly. Only if you want to run - * the driver on a device which is not yet supported or with a compiler - * which is not fully supported (such as IAR C) or if you use a differnt - * interrupt than INT0, you may have to define some of these. - */ -/* #define USB_INTR_CFG MCUCR */ -/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ -/* #define USB_INTR_CFG_CLR 0 */ -/* #define USB_INTR_ENABLE GIMSK */ -/* #define USB_INTR_ENABLE_BIT INT0 */ -/* #define USB_INTR_PENDING GIFR */ -/* #define USB_INTR_PENDING_BIT INTF0 */ -/* #define USB_INTR_VECTOR SIG_INTERRUPT0 */ - -#endif /* __usbconfig_h_included__ */ diff --git a/tools/vusb/examples/hid-custom-rq/Readme.txt b/tools/vusb/examples/hid-custom-rq/Readme.txt deleted file mode 100644 index 6a2ab3b..0000000 --- a/tools/vusb/examples/hid-custom-rq/Readme.txt +++ /dev/null @@ -1,28 +0,0 @@ -This is the Readme file for the hid-custom-rq example. This is basically the -same as the custom-class example, except that the device conforms to the USB -HID class. - - -WHAT IS DEMONSTRATED? -===================== -This example demonstrates how custom requests can be sent to devices which -are otherwise HID compliant. This mechanism can be used to prevent the -"driver CD" dialog on Windows and still control the device with libusb-win32. -It can also be used to extend the functionality of the USB class, e.g. by -setting parameters. - -Please note that you should install the filter version of libusb-win32 to -take full advantage or this mode. The device driver version only has access -to devices which have been registered for it with a *.inf file. The filter -version has access to all devices. - - -MORE INFORMATION -================ -For information about how to build this example and how to use the command -line tool see the Readme file in the custom-class example. - - ----------------------------------------------------------------------------- -(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/examples/hid-custom-rq/commandline/Makefile b/tools/vusb/examples/hid-custom-rq/commandline/Makefile deleted file mode 100644 index 5894ca8..0000000 --- a/tools/vusb/examples/hid-custom-rq/commandline/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# Name: Makefile -# Project: hid-custom-rq example -# Author: Christian Starkjohann -# Creation Date: 2008-04-06 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id: Makefile 692 2008-11-07 15:07:40Z cs $ - - -# Concigure the following definitions according to your system. -# This Makefile has been tested on Mac OS X, Linux and Windows. - -# Use the following 3 lines on Unix (uncomment the framework on Mac OS X): -USBFLAGS = `libusb-config --cflags` -USBLIBS = `libusb-config --libs` -EXE_SUFFIX = - -# Use the following 3 lines on Windows and comment out the 3 above. You may -# have to change the include paths to where you installed libusb-win32 -#USBFLAGS = -I/usr/local/include -#USBLIBS = -L/usr/local/lib -lusb -#EXE_SUFFIX = .exe - -NAME = set-led - -OBJECTS = opendevice.o $(NAME).o - -CC = gcc -CFLAGS = $(CPPFLAGS) $(USBFLAGS) -O -g -Wall -LIBS = $(USBLIBS) - -PROGRAM = $(NAME)$(EXE_SUFFIX) - - -all: $(PROGRAM) - -.c.o: - $(CC) $(CFLAGS) -c $< - -$(PROGRAM): $(OBJECTS) - $(CC) -o $(PROGRAM) $(OBJECTS) $(LIBS) - -strip: $(PROGRAM) - strip $(PROGRAM) - -clean: - rm -f *.o $(PROGRAM) diff --git a/tools/vusb/examples/hid-custom-rq/commandline/Makefile.windows b/tools/vusb/examples/hid-custom-rq/commandline/Makefile.windows deleted file mode 100644 index 4ea1df6..0000000 --- a/tools/vusb/examples/hid-custom-rq/commandline/Makefile.windows +++ /dev/null @@ -1,18 +0,0 @@ -# Name: Makefile.windows -# Project: hid-custom-rq example -# Author: Christian Starkjohann -# Creation Date: 2008-04-06 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id$ - -# You may use this file with -# make -f Makefile.windows -# on Windows with MinGW instead of editing the main Makefile. - -include Makefile - -USBFLAGS = -I/usr/local/mingw/include -USBLIBS = -L/usr/local/mingw/lib -lusb -EXE_SUFFIX = .exe diff --git a/tools/vusb/examples/hid-custom-rq/commandline/opendevice.c b/tools/vusb/examples/hid-custom-rq/commandline/opendevice.c deleted file mode 100644 index 137f50c..0000000 --- a/tools/vusb/examples/hid-custom-rq/commandline/opendevice.c +++ /dev/null @@ -1,203 +0,0 @@ -/* Name: opendevice.c - * Project: V-USB host-side library - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: opendevice.c 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -The functions in this module can be used to find and open a device based on -libusb or libusb-win32. -*/ - -#include -#include "opendevice.h" - -/* ------------------------------------------------------------------------- */ - -#define MATCH_SUCCESS 1 -#define MATCH_FAILED 0 -#define MATCH_ABORT -1 - -/* private interface: match text and p, return MATCH_SUCCESS, MATCH_FAILED, or MATCH_ABORT. */ -static int _shellStyleMatch(char *text, char *p) -{ -int last, matched, reverse; - - for(; *p; text++, p++){ - if(*text == 0 && *p != '*') - return MATCH_ABORT; - switch(*p){ - case '\\': - /* Literal match with following character. */ - p++; - /* FALLTHROUGH */ - default: - if(*text != *p) - return MATCH_FAILED; - continue; - case '?': - /* Match anything. */ - continue; - case '*': - while(*++p == '*') - /* Consecutive stars act just like one. */ - continue; - if(*p == 0) - /* Trailing star matches everything. */ - return MATCH_SUCCESS; - while(*text) - if((matched = _shellStyleMatch(text++, p)) != MATCH_FAILED) - return matched; - return MATCH_ABORT; - case '[': - reverse = p[1] == '^'; - if(reverse) /* Inverted character class. */ - p++; - matched = MATCH_FAILED; - if(p[1] == ']' || p[1] == '-') - if(*++p == *text) - matched = MATCH_SUCCESS; - for(last = *p; *++p && *p != ']'; last = *p) - if (*p == '-' && p[1] != ']' ? *text <= *++p && *text >= last : *text == *p) - matched = MATCH_SUCCESS; - if(matched == reverse) - return MATCH_FAILED; - continue; - } - } - return *text == 0; -} - -/* public interface for shell style matching: returns 0 if fails, 1 if matches */ -static int shellStyleMatch(char *text, char *pattern) -{ - if(pattern == NULL) /* NULL pattern is synonymous to "*" */ - return 1; - return _shellStyleMatch(text, pattern) == MATCH_SUCCESS; -} - -/* ------------------------------------------------------------------------- */ - -int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen) -{ -char buffer[256]; -int rval, i; - - if((rval = usb_get_string_simple(dev, index, buf, buflen)) >= 0) /* use libusb version if it works */ - return rval; - if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, 0x0409, buffer, sizeof(buffer), 5000)) < 0) - return rval; - if(buffer[1] != USB_DT_STRING){ - *buf = 0; - return 0; - } - if((unsigned char)buffer[0] < rval) - rval = (unsigned char)buffer[0]; - rval /= 2; - /* lossy conversion to ISO Latin1: */ - for(i=1;i buflen) /* destination buffer overflow */ - break; - buf[i-1] = buffer[2 * i]; - if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ - buf[i-1] = '?'; - } - buf[i-1] = 0; - return i-1; -} - -/* ------------------------------------------------------------------------- */ - -int usbOpenDevice(usb_dev_handle **device, int vendorID, char *vendorNamePattern, int productID, char *productNamePattern, char *serialNamePattern, FILE *printMatchingDevicesFp, FILE *warningsFp) -{ -struct usb_bus *bus; -struct usb_device *dev; -usb_dev_handle *handle = NULL; -int errorCode = USBOPEN_ERR_NOTFOUND; - - usb_find_busses(); - usb_find_devices(); - for(bus = usb_get_busses(); bus; bus = bus->next){ - for(dev = bus->devices; dev; dev = dev->next){ /* iterate over all devices on all busses */ - if((vendorID == 0 || dev->descriptor.idVendor == vendorID) - && (productID == 0 || dev->descriptor.idProduct == productID)){ - char vendor[256], product[256], serial[256]; - int len; - handle = usb_open(dev); /* we need to open the device in order to query strings */ - if(!handle){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot open VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - continue; - } - /* now check whether the names match: */ - len = vendor[0] = 0; - if(dev->descriptor.iManufacturer > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iManufacturer, vendor, sizeof(vendor)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query manufacturer for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* printf("seen device from vendor ->%s<-\n", vendor); */ - if(shellStyleMatch(vendor, vendorNamePattern)){ - len = product[0] = 0; - if(dev->descriptor.iProduct > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iProduct, product, sizeof(product)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query product for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* printf("seen product ->%s<-\n", product); */ - if(shellStyleMatch(product, productNamePattern)){ - len = serial[0] = 0; - if(dev->descriptor.iSerialNumber > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iSerialNumber, serial, sizeof(serial)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query serial for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - } - if(shellStyleMatch(serial, serialNamePattern)){ - if(printMatchingDevicesFp != NULL){ - if(serial[0] == 0){ - fprintf(printMatchingDevicesFp, "VID=0x%04x PID=0x%04x vendor=\"%s\" product=\"%s\"\n", dev->descriptor.idVendor, dev->descriptor.idProduct, vendor, product); - }else{ - fprintf(printMatchingDevicesFp, "VID=0x%04x PID=0x%04x vendor=\"%s\" product=\"%s\" serial=\"%s\"\n", dev->descriptor.idVendor, dev->descriptor.idProduct, vendor, product, serial); - } - }else{ - break; - } - } - } - } - } - } - usb_close(handle); - handle = NULL; - } - } - if(handle) /* we have found a deice */ - break; - } - if(handle != NULL){ - errorCode = 0; - *device = handle; - } - if(printMatchingDevicesFp != NULL) /* never return an error for listing only */ - errorCode = 0; - return errorCode; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/examples/hid-custom-rq/commandline/opendevice.h b/tools/vusb/examples/hid-custom-rq/commandline/opendevice.h deleted file mode 100644 index 0e04f73..0000000 --- a/tools/vusb/examples/hid-custom-rq/commandline/opendevice.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Name: opendevice.h - * Project: V-USB host-side library - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: opendevice.h 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -This module offers additional functionality for host side drivers based on -libusb or libusb-win32. It includes a function to find and open a device -based on numeric IDs and textual description. It also includes a function to -obtain textual descriptions from a device. - -To use this functionality, simply copy opendevice.c and opendevice.h into your -project and add them to your Makefile. You may modify and redistribute these -files according to the GNU General Public License (GPL) version 2 or 3. -*/ - -#ifndef __OPENDEVICE_H_INCLUDED__ -#define __OPENDEVICE_H_INCLUDED__ - -#include /* this is libusb, see http://libusb.sourceforge.net/ */ -#include - -int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen); -/* This function gets a string descriptor from the device. 'index' is the - * string descriptor index. The string is returned in ISO Latin 1 encoding in - * 'buf' and it is terminated with a 0-character. The buffer size must be - * passed in 'buflen' to prevent buffer overflows. A libusb device handle - * must be given in 'dev'. - * Returns: The length of the string (excluding the terminating 0) or - * a negative number in case of an error. If there was an error, use - * usb_strerror() to obtain the error message. - */ - -int usbOpenDevice(usb_dev_handle **device, int vendorID, char *vendorNamePattern, int productID, char *productNamePattern, char *serialNamePattern, FILE *printMatchingDevicesFp, FILE *warningsFp); -/* This function iterates over all devices on all USB busses and searches for - * a device. Matching is done first by means of Vendor- and Product-ID (passed - * in 'vendorID' and 'productID'. An ID of 0 matches any numeric ID (wildcard). - * When a device matches by its IDs, matching by names is performed. Name - * matching can be done on textual vendor name ('vendorNamePattern'), product - * name ('productNamePattern') and serial number ('serialNamePattern'). A - * device matches only if all non-null pattern match. If you don't care about - * a string, pass NULL for the pattern. Patterns are Unix shell style pattern: - * '*' stands for 0 or more characters, '?' for one single character, a list - * of characters in square brackets for a single character from the list - * (dashes are allowed to specify a range) and if the lis of characters begins - * with a caret ('^'), it matches one character which is NOT in the list. - * Other parameters to the function: If 'warningsFp' is not NULL, warning - * messages are printed to this file descriptor with fprintf(). If - * 'printMatchingDevicesFp' is not NULL, no device is opened but matching - * devices are printed to the given file descriptor with fprintf(). - * If a device is opened, the resulting USB handle is stored in '*device'. A - * pointer to a "usb_dev_handle *" type variable must be passed here. - * Returns: 0 on success, an error code (see defines below) on failure. - */ - -/* usbOpenDevice() error codes: */ -#define USBOPEN_SUCCESS 0 /* no error */ -#define USBOPEN_ERR_ACCESS 1 /* not enough permissions to open device */ -#define USBOPEN_ERR_IO 2 /* I/O error */ -#define USBOPEN_ERR_NOTFOUND 3 /* device not found */ - - -/* Obdev's free USB IDs, see USBID-License.txt for details */ - -#define USB_VID_OBDEV_SHARED 5824 /* obdev's shared vendor ID */ -#define USB_PID_OBDEV_SHARED_CUSTOM 1500 /* shared PID for custom class devices */ -#define USB_PID_OBDEV_SHARED_HID 1503 /* shared PID for HIDs except mice & keyboards */ -#define USB_PID_OBDEV_SHARED_CDCACM 1505 /* shared PID for CDC Modem devices */ -#define USB_PID_OBDEV_SHARED_MIDI 1508 /* shared PID for MIDI class devices */ - -#endif /* __OPENDEVICE_H_INCLUDED__ */ diff --git a/tools/vusb/examples/hid-custom-rq/commandline/set-led.c b/tools/vusb/examples/hid-custom-rq/commandline/set-led.c deleted file mode 100644 index 52b2a3b..0000000 --- a/tools/vusb/examples/hid-custom-rq/commandline/set-led.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Name: set-led.c - * Project: hid-custom-rq example - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: set-led.c 692 2008-11-07 15:07:40Z cs $ - */ - -/* -General Description: -This is the host-side driver for the custom-class example device. It searches -the USB for the LEDControl device and sends the requests understood by this -device. -This program must be linked with libusb on Unix and libusb-win32 on Windows. -See http://libusb.sourceforge.net/ or http://libusb-win32.sourceforge.net/ -respectively. -*/ - -#include -#include -#include -#include /* this is libusb */ -#include "opendevice.h" /* common code moved to separate module */ - -#include "../firmware/requests.h" /* custom request numbers */ -#include "../firmware/usbconfig.h" /* device's VID/PID and names */ - -static void usage(char *name) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, " %s on ....... turn on LED\n", name); - fprintf(stderr, " %s off ...... turn off LED\n", name); - fprintf(stderr, " %s status ... ask current status of LED\n", name); -#if ENABLE_TEST - fprintf(stderr, " %s test ..... run driver reliability test\n", name); -#endif /* ENABLE_TEST */ -} - -int main(int argc, char **argv) -{ -usb_dev_handle *handle = NULL; -const unsigned char rawVid[2] = {USB_CFG_VENDOR_ID}, rawPid[2] = {USB_CFG_DEVICE_ID}; -char vendor[] = {USB_CFG_VENDOR_NAME, 0}, product[] = {USB_CFG_DEVICE_NAME, 0}; -char buffer[4]; -int cnt, vid, pid, isOn; - - usb_init(); - if(argc < 2){ /* we need at least one argument */ - usage(argv[0]); - exit(1); - } - /* compute VID/PID from usbconfig.h so that there is a central source of information */ - vid = rawVid[1] * 256 + rawVid[0]; - pid = rawPid[1] * 256 + rawPid[0]; - /* The following function is in opendevice.c: */ - if(usbOpenDevice(&handle, vid, vendor, pid, product, NULL, NULL, NULL) != 0){ - fprintf(stderr, "Could not find USB device \"%s\" with vid=0x%x pid=0x%x\n", product, vid, pid); - exit(1); - } - /* Since we use only control endpoint 0, we don't need to choose a - * configuration and interface. Reading device descriptor and setting a - * configuration and interface is done through endpoint 0 after all. - * However, newer versions of Linux require that we claim an interface - * even for endpoint 0. Enable the following code if your operating system - * needs it: */ -#if 0 - int retries = 1, usbConfiguration = 1, usbInterface = 0; - if(usb_set_configuration(handle, usbConfiguration) && showWarnings){ - fprintf(stderr, "Warning: could not set configuration: %s\n", usb_strerror()); - } - /* now try to claim the interface and detach the kernel HID driver on - * Linux and other operating systems which support the call. */ - while((len = usb_claim_interface(handle, usbInterface)) != 0 && retries-- > 0){ -#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP - if(usb_detach_kernel_driver_np(handle, 0) < 0 && showWarnings){ - fprintf(stderr, "Warning: could not detach kernel driver: %s\n", usb_strerror()); - } -#endif - } -#endif - - if(strcasecmp(argv[1], "status") == 0){ - cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, CUSTOM_RQ_GET_STATUS, 0, 0, buffer, sizeof(buffer), 5000); - if(cnt < 1){ - if(cnt < 0){ - fprintf(stderr, "USB error: %s\n", usb_strerror()); - }else{ - fprintf(stderr, "only %d bytes received.\n", cnt); - } - }else{ - printf("LED is %s\n", buffer[0] ? "on" : "off"); - } - }else if((isOn = (strcasecmp(argv[1], "on") == 0)) || strcasecmp(argv[1], "off") == 0){ - cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_SET_STATUS, isOn, 0, buffer, 0, 5000); - if(cnt < 0){ - fprintf(stderr, "USB error: %s\n", usb_strerror()); - } -#if ENABLE_TEST - }else if(strcasecmp(argv[1], "test") == 0){ - int i; - srandomdev(); - for(i = 0; i < 50000; i++){ - int value = random() & 0xffff, index = random() & 0xffff; - int rxValue, rxIndex; - if((i+1) % 100 == 0){ - fprintf(stderr, "\r%05d", i+1); - fflush(stderr); - } - cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, CUSTOM_RQ_ECHO, value, index, buffer, sizeof(buffer), 5000); - if(cnt < 0){ - fprintf(stderr, "\nUSB error in iteration %d: %s\n", i, usb_strerror()); - break; - }else if(cnt != 4){ - fprintf(stderr, "\nerror in iteration %d: %d bytes received instead of 4\n", i, cnt); - break; - } - rxValue = ((int)buffer[0] & 0xff) | (((int)buffer[1] & 0xff) << 8); - rxIndex = ((int)buffer[2] & 0xff) | (((int)buffer[3] & 0xff) << 8); - if(rxValue != value || rxIndex != index){ - fprintf(stderr, "\ndata error in iteration %d:\n", i); - fprintf(stderr, "rxValue = 0x%04x value = 0x%04x\n", rxValue, value); - fprintf(stderr, "rxIndex = 0x%04x index = 0x%04x\n", rxIndex, index); - } - } - fprintf(stderr, "\nTest completed.\n"); -#endif /* ENABLE_TEST */ - }else{ - usage(argv[0]); - exit(1); - } - usb_close(handle); - return 0; -} diff --git a/tools/vusb/examples/hid-custom-rq/firmware/Makefile b/tools/vusb/examples/hid-custom-rq/firmware/Makefile deleted file mode 100644 index f2372db..0000000 --- a/tools/vusb/examples/hid-custom-rq/firmware/Makefile +++ /dev/null @@ -1,164 +0,0 @@ -# Name: Makefile -# Project: hid-custom-rq example -# Author: Christian Starkjohann -# Creation Date: 2008-04-07 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id: Makefile 692 2008-11-07 15:07:40Z cs $ - -DEVICE = atmega168 -F_CPU = 16000000 # in Hz -FUSE_L = # see below for fuse values for particular devices -FUSE_H = -AVRDUDE = avrdude -c usbasp -p $(DEVICE) # edit this line for your programmer - -CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0 -OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o - -COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE) - -############################################################################## -# Fuse values for particular devices -############################################################################## -# If your device is not listed here, go to -# http://palmavr.sourceforge.net/cgi-bin/fc.cgi -# and choose options for external crystal clock and no clock divider -# -################################## ATMega8 ################################## -# ATMega8 FUSE_L (Fuse low byte): -# 0x9f = 1 0 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ BODEN (BrownOut Detector enabled) -# +-------------------- BODLEVEL (2.7V) -# ATMega8 FUSE_H (Fuse high byte): -# 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000) -# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 -# | | | | | +-------- BOOTSZ1 -# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase) -# | | | +-------------- CKOPT (full output swing) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ WDTON (WDT not always on) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATMega48/88/168 ############################## -# ATMega*8 FUSE_L (Fuse low byte): -# 0xdf = 1 1 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ CKOUT (if 0: Clock output enabled) -# +-------------------- CKDIV8 (if 0: divide by 8) -# ATMega*8 FUSE_H (Fuse high byte): -# 0xde = 1 1 0 1 1 1 1 0 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V) -# | | | | + --------- EESAVE (preserve EEPROM over chip erase) -# | | | +-------------- WDTON (if 0: watchdog always on) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATTiny25/45/85 ############################### -# ATMega*5 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATMega*5 FUSE_H (Fuse high byte): -# 0xdd = 1 1 0 1 1 1 0 1 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (disable external reset -> enabled) -# -################################ ATTiny2313 ################################# -# ATTiny2313 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATTiny2313 FUSE_H (Fuse high byte): -# 0xdb = 1 1 0 1 1 0 1 1 -# ^ ^ ^ ^ \-+-/ ^ -# | | | | | +---- RSTDISBL (disable external reset -> enabled) -# | | | | +-------- BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# +-------------------- DWEN (debug wire enable) - - -# symbolic targets: -help: - @echo "This Makefile has no default rule. Use one of the following:" - @echo "make hex ....... to build main.hex" - @echo "make program ... to flash fuses and firmware" - @echo "make fuse ...... to flash the fuses" - @echo "make flash ..... to flash the firmware (use this on metaboard)" - @echo "make clean ..... to delete objects and hex file" - -hex: main.hex - -program: flash fuse - -# rule for programming fuse bits: -fuse: - @[ "$(FUSE_H)" != "" -a "$(FUSE_L)" != "" ] || \ - { echo "*** Edit Makefile and choose values for FUSE_L and FUSE_H!"; exit 1; } - $(AVRDUDE) -U hfuse:w:$(FUSE_H):m -U lfuse:w:$(FUSE_L):m - -# rule for uploading firmware: -flash: main.hex - $(AVRDUDE) -U flash:w:main.hex:i - -# rule for deleting dependent files (those which can be built by Make): -clean: - rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s - -# Generic rule for compiling C files: -.c.o: - $(COMPILE) -c $< -o $@ - -# Generic rule for assembling Assembler source files: -.S.o: - $(COMPILE) -x assembler-with-cpp -c $< -o $@ -# "-x assembler-with-cpp" should not be necessary since this is the default -# file type for the .S (with capital S) extension. However, upper case -# characters are not always preserved on Windows. To ensure WinAVR -# compatibility define the file type manually. - -# Generic rule for compiling C to assembler, used for debugging only. -.c.s: - $(COMPILE) -S $< -o $@ - -# file targets: - -# Since we don't want to ship the driver multipe times, we copy it into this project: -usbdrv: - cp -r ../../../usbdrv . - -main.elf: usbdrv $(OBJECTS) # usbdrv dependency only needed because we copy it - $(COMPILE) -o main.elf $(OBJECTS) - -main.hex: main.elf - rm -f main.hex main.eep.hex - avr-objcopy -j .text -j .data -O ihex main.elf main.hex - avr-size main.hex - -# debugging targets: - -disasm: main.elf - avr-objdump -d main.elf - -cpp: - $(COMPILE) -E main.c diff --git a/tools/vusb/examples/hid-custom-rq/firmware/main.c b/tools/vusb/examples/hid-custom-rq/firmware/main.c deleted file mode 100644 index d4cbb01..0000000 --- a/tools/vusb/examples/hid-custom-rq/firmware/main.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Name: main.c - * Project: hid-custom-rq example - * Author: Christian Starkjohann - * Creation Date: 2008-04-07 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: main.c 692 2008-11-07 15:07:40Z cs $ - */ - -/* -This example should run on most AVRs with only little changes. No special -hardware resources except INT0 are used. You may have to change usbconfig.h for -different I/O pins for USB. Please note that USB D+ must be the INT0 pin, or -at least be connected to INT0 as well. -We assume that an LED is connected to port B bit 0. If you connect it to a -different port or bit, change the macros below: -*/ -#define LED_PORT_DDR DDRB -#define LED_PORT_OUTPUT PORTB -#define LED_BIT 0 - -#include -#include -#include /* for sei() */ -#include /* for _delay_ms() */ - -#include /* required by usbdrv.h */ -#include "usbdrv.h" -#include "oddebug.h" /* This is also an example for using debug macros */ -#include "requests.h" /* The custom request numbers we use */ - -/* ------------------------------------------------------------------------- */ -/* ----------------------------- USB interface ----------------------------- */ -/* ------------------------------------------------------------------------- */ - -PROGMEM char usbHidReportDescriptor[22] = { /* USB report descriptor */ - 0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop) - 0x09, 0x01, // USAGE (Vendor Usage 1) - 0xa1, 0x01, // COLLECTION (Application) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x01, // REPORT_COUNT (1) - 0x09, 0x00, // USAGE (Undefined) - 0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf) - 0xc0 // END_COLLECTION -}; -/* The descriptor above is a dummy only, it silences the drivers. The report - * it describes consists of one byte of undefined data. - * We don't transfer our data through HID reports, we use custom requests - * instead. - */ - -/* ------------------------------------------------------------------------- */ - -usbMsgLen_t usbFunctionSetup(uchar data[8]) -{ -usbRequest_t *rq = (void *)data; - - if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_VENDOR){ - DBG1(0x50, &rq->bRequest, 1); /* debug output: print our request */ - if(rq->bRequest == CUSTOM_RQ_SET_STATUS){ - if(rq->wValue.bytes[0] & 1){ /* set LED */ - LED_PORT_OUTPUT |= _BV(LED_BIT); - }else{ /* clear LED */ - LED_PORT_OUTPUT &= ~_BV(LED_BIT); - } - }else if(rq->bRequest == CUSTOM_RQ_GET_STATUS){ - static uchar dataBuffer[1]; /* buffer must stay valid when usbFunctionSetup returns */ - dataBuffer[0] = ((LED_PORT_OUTPUT & _BV(LED_BIT)) != 0); - usbMsgPtr = dataBuffer; /* tell the driver which data to return */ - return 1; /* tell the driver to send 1 byte */ - } - }else{ - /* calss requests USBRQ_HID_GET_REPORT and USBRQ_HID_SET_REPORT are - * not implemented since we never call them. The operating system - * won't call them either because our descriptor defines no meaning. - */ - } - return 0; /* default for not implemented requests: return no data back to host */ -} - -/* ------------------------------------------------------------------------- */ - -int main(void) -{ -uchar i; - - wdt_enable(WDTO_1S); - /* Even if you don't use the watchdog, turn it off here. On newer devices, - * the status of the watchdog (on/off, period) is PRESERVED OVER RESET! - */ - DBG1(0x00, 0, 0); /* debug output: main starts */ - /* RESET status: all port bits are inputs without pull-up. - * That's the way we need D+ and D-. Therefore we don't need any - * additional hardware initialization. - */ - odDebugInit(); - usbInit(); - usbDeviceDisconnect(); /* enforce re-enumeration, do this while interrupts are disabled! */ - i = 0; - while(--i){ /* fake USB disconnect for > 250 ms */ - wdt_reset(); - _delay_ms(1); - } - usbDeviceConnect(); - LED_PORT_DDR |= _BV(LED_BIT); /* make the LED bit an output */ - sei(); - DBG1(0x01, 0, 0); /* debug output: main loop starts */ - for(;;){ /* main event loop */ -#if 0 /* this is a bit too aggressive for a debug output */ - DBG2(0x02, 0, 0); /* debug output: main loop iterates */ -#endif - wdt_reset(); - usbPoll(); - } - return 0; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/examples/hid-custom-rq/firmware/requests.h b/tools/vusb/examples/hid-custom-rq/firmware/requests.h deleted file mode 100644 index 79282b6..0000000 --- a/tools/vusb/examples/hid-custom-rq/firmware/requests.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Name: requests.h - * Project: custom-class, a basic USB example - * Author: Christian Starkjohann - * Creation Date: 2008-04-09 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: requests.h 692 2008-11-07 15:07:40Z cs $ - */ - -/* This header is shared between the firmware and the host software. It - * defines the USB request numbers (and optionally data types) used to - * communicate between the host and the device. - */ - -#ifndef __REQUESTS_H_INCLUDED__ -#define __REQUESTS_H_INCLUDED__ - -#define CUSTOM_RQ_SET_STATUS 1 -/* Set the LED status. Control-OUT. - * The requested status is passed in the "wValue" field of the control - * transfer. No OUT data is sent. Bit 0 of the low byte of wValue controls - * the LED. - */ - -#define CUSTOM_RQ_GET_STATUS 2 -/* Get the current LED status. Control-IN. - * This control transfer involves a 1 byte data phase where the device sends - * the current status to the host. The status is in bit 0 of the byte. - */ - -#endif /* __REQUESTS_H_INCLUDED__ */ diff --git a/tools/vusb/examples/hid-custom-rq/firmware/usbconfig.h b/tools/vusb/examples/hid-custom-rq/firmware/usbconfig.h deleted file mode 100644 index 66b46b0..0000000 --- a/tools/vusb/examples/hid-custom-rq/firmware/usbconfig.h +++ /dev/null @@ -1,350 +0,0 @@ -/* Name: usbconfig.h - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2005-04-01 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbconfig-prototype.h 740 2009-04-13 18:23:31Z cs $ - */ - -#ifndef __usbconfig_h_included__ -#define __usbconfig_h_included__ - -/* -General Description: -This file is an example configuration (with inline documentation) for the USB -driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is -also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may -wire the lines to any other port, as long as D+ is also wired to INT0 (or any -other hardware interrupt, as long as it is the highest level interrupt, see -section at the end of this file). -*/ - -/* ---------------------------- Hardware Config ---------------------------- */ - -#define USB_CFG_IOPORTNAME D -/* This is the port where the USB bus is connected. When you configure it to - * "B", the registers PORTB, PINB and DDRB will be used. - */ -#define USB_CFG_DMINUS_BIT 4 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This may be any bit in the port. - */ -#define USB_CFG_DPLUS_BIT 2 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port. Please note that D+ must also be connected - * to interrupt pin INT0! [You can also use other interrupts, see section - * "Optional MCU Description" below, or you can connect D- to the interrupt, as - * it is required if you use the USB_COUNT_SOF feature. If you use D- for the - * interrupt, the USB interrupt will also be triggered at Start-Of-Frame - * markers every millisecond.] - */ -#define USB_CFG_CLOCK_KHZ (F_CPU/1000) -/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000, - * 16500 and 20000. The 12.8 MHz and 16.5 MHz versions of the code require no - * crystal, they tolerate +/- 1% deviation from the nominal frequency. All - * other rates require a precision of 2000 ppm and thus a crystal! - * Default if not specified: 12 MHz - */ -#define USB_CFG_CHECK_CRC 0 -/* Define this to 1 if you want that the driver checks integrity of incoming - * data packets (CRC checks). CRC checks cost quite a bit of code size and are - * currently only available for 18 MHz crystal clock. You must choose - * USB_CFG_CLOCK_KHZ = 18000 if you enable this option. - */ - -/* ----------------------- Optional Hardware Config ------------------------ */ - -/* #define USB_CFG_PULLUP_IOPORTNAME D */ -/* If you connect the 1.5k pullup resistor from D- to a port pin instead of - * V+, you can connect and disconnect the device from firmware by calling - * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). - * This constant defines the port on which the pullup resistor is connected. - */ -/* #define USB_CFG_PULLUP_BIT 4 */ -/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined - * above) where the 1.5k pullup resistor is connected. See description - * above for details. - */ - -/* --------------------------- Functional Range ---------------------------- */ - -#define USB_CFG_HAVE_INTRIN_ENDPOINT 1 -/* Define this to 1 if you want to compile a version with two endpoints: The - * default control endpoint 0 and an interrupt-in endpoint (any other endpoint - * number). - */ -#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 -/* Define this to 1 if you want to compile a version with three endpoints: The - * default control endpoint 0, an interrupt-in endpoint 3 (or the number - * configured below) and a catch-all default interrupt-in endpoint as above. - * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. - */ -#define USB_CFG_EP3_NUMBER 3 -/* If the so-called endpoint 3 is used, it can now be configured to any other - * endpoint number (except 0) with this macro. Default if undefined is 3. - */ -/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */ -/* The above macro defines the startup condition for data toggling on the - * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1. - * Since the token is toggled BEFORE sending any data, the first packet is - * sent with the oposite value of this configuration! - */ -#define USB_CFG_IMPLEMENT_HALT 0 -/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature - * for endpoint 1 (interrupt endpoint). Although you may not need this feature, - * it is required by the standard. We have made it a config option because it - * bloats the code considerably. - */ -#define USB_CFG_SUPPRESS_INTR_CODE 0 -/* Define this to 1 if you want to declare interrupt-in endpoints, but don't - * want to send any data over them. If this macro is defined to 1, functions - * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if - * you need the interrupt-in endpoints in order to comply to an interface - * (e.g. HID), but never want to send any data. This option saves a couple - * of bytes in flash memory and the transmit buffers in RAM. - */ -#define USB_CFG_INTR_POLL_INTERVAL 100 -/* If you compile a version with endpoint 1 (interrupt-in), this is the poll - * interval. The value is in milliseconds and must not be less than 10 ms for - * low speed devices. - */ -#define USB_CFG_IS_SELF_POWERED 0 -/* Define this to 1 if the device has its own power supply. Set it to 0 if the - * device is powered from the USB bus. - */ -#define USB_CFG_MAX_BUS_POWER 40 -/* Set this variable to the maximum USB bus power consumption of your device. - * The value is in milliamperes. [It will be divided by two since USB - * communicates power requirements in units of 2 mA.] - */ -#define USB_CFG_IMPLEMENT_FN_WRITE 0 -/* Set this to 1 if you want usbFunctionWrite() to be called for control-out - * transfers. Set it to 0 if you don't need it and want to save a couple of - * bytes. - */ -#define USB_CFG_IMPLEMENT_FN_READ 0 -/* Set this to 1 if you need to send control replies which are generated - * "on the fly" when usbFunctionRead() is called. If you only want to send - * data from a static buffer, set it to 0 and return the data from - * usbFunctionSetup(). This saves a couple of bytes. - */ -#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 -/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. - * You must implement the function usbFunctionWriteOut() which receives all - * interrupt/bulk data sent to any endpoint other than 0. The endpoint number - * can be found in 'usbRxToken'. - */ -#define USB_CFG_HAVE_FLOWCONTROL 0 -/* Define this to 1 if you want flowcontrol over USB data. See the definition - * of the macros usbDisableAllRequests() and usbEnableAllRequests() in - * usbdrv.h. - */ -#define USB_CFG_LONG_TRANSFERS 0 -/* Define this to 1 if you want to send/receive blocks of more than 254 bytes - * in a single control-in or control-out transfer. Note that the capability - * for long transfers increases the driver size. - */ -/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ -/* This macro is a hook if you want to do unconventional things. If it is - * defined, it's inserted at the beginning of received message processing. - * If you eat the received message and don't want default processing to - * proceed, do a return after doing your things. One possible application - * (besides debugging) is to flash a status LED on each packet. - */ -/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */ -/* This macro is a hook if you need to know when an USB RESET occurs. It has - * one parameter which distinguishes between the start of RESET state and its - * end. - */ -/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */ -/* This macro (if defined) is executed when a USB SET_ADDRESS request was - * received. - */ -#define USB_COUNT_SOF 0 -/* define this macro to 1 if you need the global variable "usbSofCount" which - * counts SOF packets. This feature requires that the hardware interrupt is - * connected to D- instead of D+. - */ -/* #ifdef __ASSEMBLER__ - * macro myAssemblerMacro - * in YL, TCNT0 - * sts timer0Snapshot, YL - * endm - * #endif - * #define USB_SOF_HOOK myAssemblerMacro - * This macro (if defined) is executed in the assembler module when a - * Start Of Frame condition is detected. It is recommended to define it to - * the name of an assembler macro which is defined here as well so that more - * than one assembler instruction can be used. The macro may use the register - * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages - * immediately after an SOF pulse may be lost and must be retried by the host. - * What can you do with this hook? Since the SOF signal occurs exactly every - * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in - * designs running on the internal RC oscillator. - * Please note that Start Of Frame detection works only if D- is wired to the - * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! - */ -#define USB_CFG_CHECK_DATA_TOGGLING 0 -/* define this macro to 1 if you want to filter out duplicate data packets - * sent by the host. Duplicates occur only as a consequence of communication - * errors, when the host does not receive an ACK. Please note that you need to - * implement the filtering yourself in usbFunctionWriteOut() and - * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable - * for each control- and out-endpoint to check for duplicate packets. - */ -#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 -/* define this macro to 1 if you want the function usbMeasureFrameLength() - * compiled in. This function can be used to calibrate the AVR's RC oscillator. - */ - -/* -------------------------- Device Description --------------------------- */ - -#define USB_CFG_VENDOR_ID 0xc0, 0x16 -/* USB vendor ID for the device, low byte first. If you have registered your - * own Vendor ID, define it here. Otherwise you use one of obdev's free shared - * VID/PID pairs. Be sure to read USBID-License.txt for rules! - */ -#define USB_CFG_DEVICE_ID 0xdf, 0x05 /* obdev's shared PID for HIDs */ -/* This is the ID of the product, low byte first. It is interpreted in the - * scope of the vendor ID. If you have registered your own VID with usb.org - * or if you have licensed a PID from somebody else, define it here. Otherwise - * you use obdev's free shared VID/PID pair. Be sure to read the rules in - * USBID-License.txt! - */ -#define USB_CFG_DEVICE_VERSION 0x00, 0x01 -/* Version number of the device: Minor number first, then major number. - */ -#define USB_CFG_VENDOR_NAME 'o', 'b', 'd', 'e', 'v', '.', 'a', 't' -#define USB_CFG_VENDOR_NAME_LEN 8 -/* These two values define the vendor name returned by the USB device. The name - * must be given as a list of characters under single quotes. The characters - * are interpreted as Unicode (UTF-16) entities. - * If you don't want a vendor name string, undefine these macros. - * ALWAYS define a vendor name containing your Internet domain name if you use - * obdev's free shared VID/PID pair. See the file USBID-License.txt for - * details. - */ -#define USB_CFG_DEVICE_NAME 'L', 'E', 'D', 'C', 't', 'l', 'H', 'I', 'D' -#define USB_CFG_DEVICE_NAME_LEN 9 -/* Same as above for the device name. If you don't want a device name, undefine - * the macros. See the file USBID-License.txt before you assign a name if you - * use a shared VID/PID. - */ -/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ -/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ -/* Same as above for the serial number. If you don't want a serial number, - * undefine the macros. - * It may be useful to provide the serial number through other means than at - * compile time. See the section about descriptor properties below for how - * to fine tune control over USB descriptors such as the string descriptor - * for the serial number. - */ -#define USB_CFG_DEVICE_CLASS 0 -#define USB_CFG_DEVICE_SUBCLASS 0 -/* See USB specification if you want to conform to an existing device class. - * Class 0xff is "vendor specific". - */ -#define USB_CFG_INTERFACE_CLASS 3 -#define USB_CFG_INTERFACE_SUBCLASS 0 -#define USB_CFG_INTERFACE_PROTOCOL 0 -/* See USB specification if you want to conform to an existing device class or - * protocol. The following classes must be set at interface level: - * HID class is 3, no subclass and protocol required (but may be useful!) - * CDC class is 2, use subclass 2 and protocol 1 for ACM - */ -#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 22 -/* Define this to the length of the HID report descriptor, if you implement - * an HID device. Otherwise don't define it or define it to 0. - * If you use this define, you must add a PROGMEM character array named - * "usbHidReportDescriptor" to your code which contains the report descriptor. - * Don't forget to keep the array and this define in sync! - */ - -/* #define USB_PUBLIC static */ -/* Use the define above if you #include usbdrv.c instead of linking against it. - * This technique saves a couple of bytes in flash memory. - */ - -/* ------------------- Fine Control over USB Descriptors ------------------- */ -/* If you don't want to use the driver's default USB descriptors, you can - * provide our own. These can be provided as (1) fixed length static data in - * flash memory, (2) fixed length static data in RAM or (3) dynamically at - * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more - * information about this function. - * Descriptor handling is configured through the descriptor's properties. If - * no properties are defined or if they are 0, the default descriptor is used. - * Possible properties are: - * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched - * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is - * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if - * you want RAM pointers. - * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found - * in static memory is in RAM, not in flash memory. - * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), - * the driver must know the descriptor's length. The descriptor itself is - * found at the address of a well known identifier (see below). - * List of static descriptor names (must be declared PROGMEM if in flash): - * char usbDescriptorDevice[]; - * char usbDescriptorConfiguration[]; - * char usbDescriptorHidReport[]; - * char usbDescriptorString0[]; - * int usbDescriptorStringVendor[]; - * int usbDescriptorStringDevice[]; - * int usbDescriptorStringSerialNumber[]; - * Other descriptors can't be provided statically, they must be provided - * dynamically at runtime. - * - * Descriptor properties are or-ed or added together, e.g.: - * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) - * - * The following descriptors are defined: - * USB_CFG_DESCR_PROPS_DEVICE - * USB_CFG_DESCR_PROPS_CONFIGURATION - * USB_CFG_DESCR_PROPS_STRINGS - * USB_CFG_DESCR_PROPS_STRING_0 - * USB_CFG_DESCR_PROPS_STRING_VENDOR - * USB_CFG_DESCR_PROPS_STRING_PRODUCT - * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER - * USB_CFG_DESCR_PROPS_HID - * USB_CFG_DESCR_PROPS_HID_REPORT - * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) - * - * Note about string descriptors: String descriptors are not just strings, they - * are Unicode strings prefixed with a 2 byte header. Example: - * int serialNumberDescriptor[] = { - * USB_STRING_DESCRIPTOR_HEADER(6), - * 'S', 'e', 'r', 'i', 'a', 'l' - * }; - */ - -#define USB_CFG_DESCR_PROPS_DEVICE 0 -#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 -#define USB_CFG_DESCR_PROPS_STRINGS 0 -#define USB_CFG_DESCR_PROPS_STRING_0 0 -#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 -#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 -#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 -#define USB_CFG_DESCR_PROPS_HID 0 -#define USB_CFG_DESCR_PROPS_HID_REPORT 0 -#define USB_CFG_DESCR_PROPS_UNKNOWN 0 - -/* ----------------------- Optional MCU Description ------------------------ */ - -/* The following configurations have working defaults in usbdrv.h. You - * usually don't need to set them explicitly. Only if you want to run - * the driver on a device which is not yet supported or with a compiler - * which is not fully supported (such as IAR C) or if you use a differnt - * interrupt than INT0, you may have to define some of these. - */ -/* #define USB_INTR_CFG MCUCR */ -/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ -/* #define USB_INTR_CFG_CLR 0 */ -/* #define USB_INTR_ENABLE GIMSK */ -/* #define USB_INTR_ENABLE_BIT INT0 */ -/* #define USB_INTR_PENDING GIFR */ -/* #define USB_INTR_PENDING_BIT INTF0 */ -/* #define USB_INTR_VECTOR SIG_INTERRUPT0 */ - -#endif /* __usbconfig_h_included__ */ diff --git a/tools/vusb/examples/hid-data/Readme.txt b/tools/vusb/examples/hid-data/Readme.txt deleted file mode 100644 index cb17baa..0000000 --- a/tools/vusb/examples/hid-data/Readme.txt +++ /dev/null @@ -1,75 +0,0 @@ -This is the Readme file for the hid-data example. In this example, we show -how blocks of data can be exchanged with the device using only functionality -compliant to the HID class. Since class drivers for HID are included with -Windows, you don't need to install drivers on Windows. - - -WHAT IS DEMONSTRATED? -===================== -This example demonstrates how the HID class can be misused to transfer fixed -size blocks of data (up to the driver's transfer size limit) over HID feature -reports. This technique is of great value on Windows because no driver DLLs -are needed (the hid-custom-rq example still requires the libusb-win32 DLL, -although it may be in the program's directory). The host side application -requires no installation, it can even be started directly from a CD. This -example also demonstrates how to transfer data using usbFunctionWrite() and -usbFunctionRead(). - - -PREREQUISITES -============= -Target hardware: You need an AVR based circuit based on one of the examples -(see the "circuits" directory at the top level of this package), e.g. the -metaboard (http://www.obdev.at/goto.php?t=metaboard). - -AVR development environment: You need the gcc tool chain for the AVR, see -the Prerequisites section in the top level Readme file for how to obtain it. - -Host development environment: A C compiler and libusb on Unix. On Windows -you need the Driver Development Kit (DDK) Instead of libusb. MinGW ships -with a free version of the DDK. - - -BUILDING THE FIRMWARE -===================== -Change to the "firmware" directory and modify Makefile according to your -architecture (CPU clock, target device, fuse values) and ISP programmer. Then -edit usbconfig.h according to your pin assignments for D+ and D-. The default -settings are for the metaboard hardware. - -Type "make hex" to build main.hex, then "make flash" to upload the firmware -to the device. Don't forget to run "make fuse" once to program the fuses. If -you use a prototyping board with boot loader, follow the instructions of the -boot loader instead. - -Please note that the first "make hex" copies the driver from the top level -into the firmware directory. If you use a different build system than our -Makefile, you must copy the driver by hand. - - -BUILDING THE HOST SOFTWARE -========================== -Make sure that you have libusb (on Unix) or the DDK (on Windows) installed. -We recommend MinGW on Windows since it includes a free version of the DDK. -Then change to directory "commandline" and run "make" on Unix or -"make -f Makefile.windows" on Windows. - - -USING THE COMMAND LINE TOOL -=========================== -The device implements a data store of 128 bytes in EEPROM. You can send a -block of 128 bytes to the device or read the block using the command line -tool. - -To send a block to the device, use e.g. - - hidtool write 0x01,0x02,0x03,0x04,... - -and to receive the block, use - - hidtool read - - ----------------------------------------------------------------------------- -(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/examples/hid-data/commandline/Makefile b/tools/vusb/examples/hid-data/commandline/Makefile deleted file mode 100644 index dabfa42..0000000 --- a/tools/vusb/examples/hid-data/commandline/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# Name: Makefile -# Project: hid-data example -# Author: Christian Starkjohann -# Creation Date: 2008-04-11 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id: Makefile 692 2008-11-07 15:07:40Z cs $ - -# Please read the definitions below and edit them as appropriate for your -# system: - -# Use the following 3 lines on Unix and Mac OS X: -USBFLAGS= `libusb-config --cflags` -USBLIBS= `libusb-config --libs` -EXE_SUFFIX= - -# Use the following 3 lines on Windows and comment out the 3 above: -#USBFLAGS= -#USBLIBS= -lhid -lusb -lsetupapi -#EXE_SUFFIX= .exe - -CC= gcc -CFLAGS= -O -Wall $(USBFLAGS) -LIBS= $(USBLIBS) - -OBJ= hidtool.o hiddata.o -PROGRAM= hidtool$(EXE_SUFFIX) - -all: $(PROGRAM) - -$(PROGRAM): $(OBJ) - $(CC) -o $(PROGRAM) $(OBJ) $(LIBS) - -strip: $(PROGRAM) - strip $(PROGRAM) - -clean: - rm -f $(OBJ) $(PROGRAM) - -.c.o: - $(CC) $(ARCH_COMPILE) $(CFLAGS) -c $*.c -o $*.o diff --git a/tools/vusb/examples/hid-data/commandline/Makefile.windows b/tools/vusb/examples/hid-data/commandline/Makefile.windows deleted file mode 100644 index a66dffc..0000000 --- a/tools/vusb/examples/hid-data/commandline/Makefile.windows +++ /dev/null @@ -1,18 +0,0 @@ -# Name: Makefile.windows -# Project: hid-data example -# Author: Christian Starkjohann -# Creation Date: 2008-04-11 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id$ - -# You may use this file with -# make -f Makefile.windows -# on Windows with MinGW instead of editing the main Makefile. - -include Makefile - -USBFLAGS= -USBLIBS= -lhid -lsetupapi -EXE_SUFFIX= .exe diff --git a/tools/vusb/examples/hid-data/commandline/hiddata.c b/tools/vusb/examples/hid-data/commandline/hiddata.c deleted file mode 100644 index 93795e4..0000000 --- a/tools/vusb/examples/hid-data/commandline/hiddata.c +++ /dev/null @@ -1,324 +0,0 @@ -/* Name: hiddata.c - * Author: Christian Starkjohann - * Creation Date: 2008-04-11 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: hiddata.c 743 2009-04-15 15:00:49Z cs $ - */ - -#include -#include "hiddata.h" - -/* ######################################################################## */ -#if defined(WIN32) /* ##################################################### */ -/* ######################################################################## */ - -#include -#include -#include "hidsdi.h" -#include - -#ifdef DEBUG -#define DEBUG_PRINT(arg) printf arg -#else -#define DEBUG_PRINT(arg) -#endif - -/* ------------------------------------------------------------------------ */ - -static void convertUniToAscii(char *buffer) -{ -unsigned short *uni = (void *)buffer; -char *ascii = buffer; - - while(*uni != 0){ - if(*uni >= 256){ - *ascii++ = '?'; - }else{ - *ascii++ = *uni++; - } - } - *ascii++ = 0; -} - -int usbhidOpenDevice(usbDevice_t **device, int vendor, char *vendorName, int product, char *productName, int usesReportIDs) -{ -GUID hidGuid; /* GUID for HID driver */ -HDEVINFO deviceInfoList; -SP_DEVICE_INTERFACE_DATA deviceInfo; -SP_DEVICE_INTERFACE_DETAIL_DATA *deviceDetails = NULL; -DWORD size; -int i, openFlag = 0; /* may be FILE_FLAG_OVERLAPPED */ -int errorCode = USBOPEN_ERR_NOTFOUND; -HANDLE handle = INVALID_HANDLE_VALUE; -HIDD_ATTRIBUTES deviceAttributes; - - HidD_GetHidGuid(&hidGuid); - deviceInfoList = SetupDiGetClassDevs(&hidGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE); - deviceInfo.cbSize = sizeof(deviceInfo); - for(i=0;;i++){ - if(handle != INVALID_HANDLE_VALUE){ - CloseHandle(handle); - handle = INVALID_HANDLE_VALUE; - } - if(!SetupDiEnumDeviceInterfaces(deviceInfoList, 0, &hidGuid, i, &deviceInfo)) - break; /* no more entries */ - /* first do a dummy call just to determine the actual size required */ - SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, NULL, 0, &size, NULL); - if(deviceDetails != NULL) - free(deviceDetails); - deviceDetails = malloc(size); - deviceDetails->cbSize = sizeof(*deviceDetails); - /* this call is for real: */ - SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, deviceDetails, size, &size, NULL); - DEBUG_PRINT(("checking HID path \"%s\"\n", deviceDetails->DevicePath)); -#if 0 - /* If we want to access a mouse our keyboard, we can only use feature - * requests as the device is locked by Windows. It must be opened - * with ACCESS_TYPE_NONE. - */ - handle = CreateFile(deviceDetails->DevicePath, ACCESS_TYPE_NONE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, openFlag, NULL); -#endif - /* attempt opening for R/W -- we don't care about devices which can't be accessed */ - handle = CreateFile(deviceDetails->DevicePath, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, openFlag, NULL); - if(handle == INVALID_HANDLE_VALUE){ - DEBUG_PRINT(("opening failed: %d\n", (int)GetLastError())); - /* errorCode = USBOPEN_ERR_ACCESS; opening will always fail for mouse -- ignore */ - continue; - } - deviceAttributes.Size = sizeof(deviceAttributes); - HidD_GetAttributes(handle, &deviceAttributes); - DEBUG_PRINT(("device attributes: vid=%d pid=%d\n", deviceAttributes.VendorID, deviceAttributes.ProductID)); - if(deviceAttributes.VendorID != vendor || deviceAttributes.ProductID != product) - continue; /* ignore this device */ - errorCode = USBOPEN_ERR_NOTFOUND; - if(vendorName != NULL && productName != NULL){ - char buffer[512]; - if(!HidD_GetManufacturerString(handle, buffer, sizeof(buffer))){ - DEBUG_PRINT(("error obtaining vendor name\n")); - errorCode = USBOPEN_ERR_IO; - continue; - } - convertUniToAscii(buffer); - DEBUG_PRINT(("vendorName = \"%s\"\n", buffer)); - if(strcmp(vendorName, buffer) != 0) - continue; - if(!HidD_GetProductString(handle, buffer, sizeof(buffer))){ - DEBUG_PRINT(("error obtaining product name\n")); - errorCode = USBOPEN_ERR_IO; - continue; - } - convertUniToAscii(buffer); - DEBUG_PRINT(("productName = \"%s\"\n", buffer)); - if(strcmp(productName, buffer) != 0) - continue; - } - break; /* we have found the device we are looking for! */ - } - SetupDiDestroyDeviceInfoList(deviceInfoList); - if(deviceDetails != NULL) - free(deviceDetails); - if(handle != INVALID_HANDLE_VALUE){ - *device = (usbDevice_t *)handle; - errorCode = 0; - } - return errorCode; -} - -/* ------------------------------------------------------------------------ */ - -void usbhidCloseDevice(usbDevice_t *device) -{ - CloseHandle((HANDLE)device); -} - -/* ------------------------------------------------------------------------ */ - -int usbhidSetReport(usbDevice_t *device, char *buffer, int len) -{ -BOOLEAN rval; - - rval = HidD_SetFeature((HANDLE)device, buffer, len); - return rval == 0 ? USBOPEN_ERR_IO : 0; -} - -/* ------------------------------------------------------------------------ */ - -int usbhidGetReport(usbDevice_t *device, int reportNumber, char *buffer, int *len) -{ -BOOLEAN rval = 0; - - buffer[0] = reportNumber; - rval = HidD_GetFeature((HANDLE)device, buffer, *len); - return rval == 0 ? USBOPEN_ERR_IO : 0; -} - -/* ------------------------------------------------------------------------ */ - -/* ######################################################################## */ -#else /* defined WIN32 #################################################### */ -/* ######################################################################## */ - -#include -#include - -#define usbDevice usb_dev_handle /* use libusb's device structure */ - -/* ------------------------------------------------------------------------- */ - -#define USBRQ_HID_GET_REPORT 0x01 -#define USBRQ_HID_SET_REPORT 0x09 - -#define USB_HID_REPORT_TYPE_FEATURE 3 - - -static int usesReportIDs; - -/* ------------------------------------------------------------------------- */ - -static int usbhidGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen) -{ -char buffer[256]; -int rval, i; - - if((rval = usb_get_string_simple(dev, index, buf, buflen)) >= 0) /* use libusb version if it works */ - return rval; - if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, 0x0409, buffer, sizeof(buffer), 5000)) < 0) - return rval; - if(buffer[1] != USB_DT_STRING){ - *buf = 0; - return 0; - } - if((unsigned char)buffer[0] < rval) - rval = (unsigned char)buffer[0]; - rval /= 2; - /* lossy conversion to ISO Latin1: */ - for(i=1;i buflen) /* destination buffer overflow */ - break; - buf[i-1] = buffer[2 * i]; - if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ - buf[i-1] = '?'; - } - buf[i-1] = 0; - return i-1; -} - -int usbhidOpenDevice(usbDevice_t **device, int vendor, char *vendorName, int product, char *productName, int _usesReportIDs) -{ -struct usb_bus *bus; -struct usb_device *dev; -usb_dev_handle *handle = NULL; -int errorCode = USBOPEN_ERR_NOTFOUND; -static int didUsbInit = 0; - - if(!didUsbInit){ - usb_init(); - didUsbInit = 1; - } - usb_find_busses(); - usb_find_devices(); - for(bus=usb_get_busses(); bus; bus=bus->next){ - for(dev=bus->devices; dev; dev=dev->next){ - if(dev->descriptor.idVendor == vendor && dev->descriptor.idProduct == product){ - char string[256]; - int len; - handle = usb_open(dev); /* we need to open the device in order to query strings */ - if(!handle){ - errorCode = USBOPEN_ERR_ACCESS; - fprintf(stderr, "Warning: cannot open USB device: %s\n", usb_strerror()); - continue; - } - if(vendorName == NULL && productName == NULL){ /* name does not matter */ - break; - } - /* now check whether the names match: */ - len = usbhidGetStringAscii(handle, dev->descriptor.iManufacturer, string, sizeof(string)); - if(len < 0){ - errorCode = USBOPEN_ERR_IO; - fprintf(stderr, "Warning: cannot query manufacturer for device: %s\n", usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* fprintf(stderr, "seen device from vendor ->%s<-\n", string); */ - if(strcmp(string, vendorName) == 0){ - len = usbhidGetStringAscii(handle, dev->descriptor.iProduct, string, sizeof(string)); - if(len < 0){ - errorCode = USBOPEN_ERR_IO; - fprintf(stderr, "Warning: cannot query product for device: %s\n", usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* fprintf(stderr, "seen product ->%s<-\n", string); */ - if(strcmp(string, productName) == 0) - break; - } - } - } - usb_close(handle); - handle = NULL; - } - } - if(handle) - break; - } - if(handle != NULL){ - errorCode = 0; - *device = (void *)handle; - usesReportIDs = _usesReportIDs; - } - return errorCode; -} - -/* ------------------------------------------------------------------------- */ - -void usbhidCloseDevice(usbDevice_t *device) -{ - if(device != NULL) - usb_close((void *)device); -} - -/* ------------------------------------------------------------------------- */ - -int usbhidSetReport(usbDevice_t *device, char *buffer, int len) -{ -int bytesSent; - - if(!usesReportIDs){ - buffer++; /* skip dummy report ID */ - len--; - } - bytesSent = usb_control_msg((void *)device, USB_TYPE_CLASS | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, USBRQ_HID_SET_REPORT, USB_HID_REPORT_TYPE_FEATURE << 8 | (buffer[0] & 0xff), 0, buffer, len, 5000); - if(bytesSent != len){ - if(bytesSent < 0) - fprintf(stderr, "Error sending message: %s\n", usb_strerror()); - return USBOPEN_ERR_IO; - } - return 0; -} - -/* ------------------------------------------------------------------------- */ - -int usbhidGetReport(usbDevice_t *device, int reportNumber, char *buffer, int *len) -{ -int bytesReceived, maxLen = *len; - - if(!usesReportIDs){ - buffer++; /* make room for dummy report ID */ - maxLen--; - } - bytesReceived = usb_control_msg((void *)device, USB_TYPE_CLASS | USB_RECIP_DEVICE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT, USB_HID_REPORT_TYPE_FEATURE << 8 | reportNumber, 0, buffer, maxLen, 5000); - if(bytesReceived < 0){ - fprintf(stderr, "Error sending message: %s\n", usb_strerror()); - return USBOPEN_ERR_IO; - } - *len = bytesReceived; - if(!usesReportIDs){ - buffer[-1] = reportNumber; /* add dummy report ID */ - (*len)++; - } - return 0; -} - -/* ######################################################################## */ -#endif /* defined WIN32 ################################################### */ -/* ######################################################################## */ diff --git a/tools/vusb/examples/hid-data/commandline/hiddata.h b/tools/vusb/examples/hid-data/commandline/hiddata.h deleted file mode 100644 index fce0743..0000000 --- a/tools/vusb/examples/hid-data/commandline/hiddata.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Name: hiddata.h - * Author: Christian Starkjohann - * Creation Date: 2008-04-11 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: hiddata.h 692 2008-11-07 15:07:40Z cs $ - */ - -#ifndef __HIDDATA_H_INCLUDED__ -#define __HIDDATA_H_INCLUDED__ - -/* -General Description: -This module implements an abstraction layer for data transfer over HID feature -requests. The implementation uses native Windows functions on Windows so that -no driver installation is required and libusb on Unix. You must link the -appropriate libraries in either case: "-lhid -lusb -lsetupapi" on Windows and -`libusb-config --libs` on Unix. -*/ - -/* ------------------------------------------------------------------------ */ - -#define USBOPEN_SUCCESS 0 /* no error */ -#define USBOPEN_ERR_ACCESS 1 /* not enough permissions to open device */ -#define USBOPEN_ERR_IO 2 /* I/O error */ -#define USBOPEN_ERR_NOTFOUND 3 /* device not found */ - -/* ------------------------------------------------------------------------ */ - -typedef struct usbDevice usbDevice_t; -/* Opaque data type representing the USB device. This can be a Windows handle - * or a libusb handle, depending on the backend implementation. - */ - -/* ------------------------------------------------------------------------ */ - -int usbhidOpenDevice(usbDevice_t **device, int vendorID, char *vendorName, int productID, char *productName, int usesReportIDs); -/* This function opens a USB device. 'vendorID' and 'productID' are the numeric - * Vendor-ID and Product-ID of the device we want to open. If 'vendorName' and - * 'productName' are both not NULL, only devices with matching manufacturer- - * and product name strings are accepted. If the device uses report IDs, - * 'usesReportIDs' must be set to a non-zero value. - * Returns: If a matching device has been found, USBOPEN_SUCCESS is returned - * and '*device' is set to an opaque pointer representing the device. The - * device must be closed with usbhidCloseDevice(). If the device has not been - * found or opening failed, an error code is returned. - */ -void usbhidCloseDevice(usbDevice_t *device); -/* Every device opened with usbhidOpenDevice() must be closed with this function. - */ -int usbhidSetReport(usbDevice_t *device, char *buffer, int len); -/* This function sends a feature report to the device. The report ID must be - * in the first byte of buffer and the length 'len' of the report is specified - * including this report ID. If no report IDs are used, buffer[0] must be set - * to 0 (dummy report ID). - * Returns: 0 on success, an error code otherwise. - */ -int usbhidGetReport(usbDevice_t *device, int reportID, char *buffer, int *len); -/* This function obtains a feature report from the device. The requested - * report-ID is passed in 'reportID'. The caller must pass a buffer of the size - * of the expected report in 'buffer' and initialize the variable pointed to by - * 'len' to the total size of this buffer. Upon successful return, the report - * (prefixed with the report-ID) is in 'buffer' and the actual length of the - * report is returned in '*len'. - * Returns: 0 on success, an error code otherwise. - */ - -/* ------------------------------------------------------------------------ */ - -#endif /* __HIDDATA_H_INCLUDED__ */ diff --git a/tools/vusb/examples/hid-data/commandline/hidsdi.h b/tools/vusb/examples/hid-data/commandline/hidsdi.h deleted file mode 100644 index a549ab1..0000000 --- a/tools/vusb/examples/hid-data/commandline/hidsdi.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Name: hidsdi.h - * Author: Christian Starkjohann - * Creation Date: 2006-02-02 - * Tabsize: 4 - * Copyright: (c) 2006-2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: hidsdi.h 692 2008-11-07 15:07:40Z cs $ - */ - -/* -General Description -This file is a replacement for hidsdi.h from the Windows DDK. It defines some -of the types and function prototypes of this header for our project. If you -have the Windows DDK version of this file or a version shipped with MinGW, use -that instead. -*/ - -#ifndef _HIDSDI_H -#define _HIDSDI_H - -#include - -#include -#include - -typedef struct{ - ULONG Size; - USHORT VendorID; - USHORT ProductID; - USHORT VersionNumber; -}HIDD_ATTRIBUTES; - -void __stdcall HidD_GetHidGuid(OUT LPGUID hidGuid); - -BOOLEAN __stdcall HidD_GetAttributes(IN HANDLE device, OUT HIDD_ATTRIBUTES *attributes); - -BOOLEAN __stdcall HidD_GetManufacturerString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen); -BOOLEAN __stdcall HidD_GetProductString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen); -BOOLEAN __stdcall HidD_GetSerialNumberString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen); - -BOOLEAN __stdcall HidD_GetFeature(IN HANDLE device, OUT void *reportBuffer, IN ULONG bufferLen); -BOOLEAN __stdcall HidD_SetFeature(IN HANDLE device, IN void *reportBuffer, IN ULONG bufferLen); - -BOOLEAN __stdcall HidD_GetNumInputBuffers(IN HANDLE device, OUT ULONG *numBuffers); -BOOLEAN __stdcall HidD_SetNumInputBuffers(IN HANDLE device, OUT ULONG numBuffers); - -#include - -#endif diff --git a/tools/vusb/examples/hid-data/commandline/hidtool.c b/tools/vusb/examples/hid-data/commandline/hidtool.c deleted file mode 100644 index 9b581cd..0000000 --- a/tools/vusb/examples/hid-data/commandline/hidtool.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Name: hidtool.c - * Project: hid-data example - * Author: Christian Starkjohann - * Creation Date: 2008-04-11 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: hidtool.c 723 2009-03-16 19:04:32Z cs $ - */ - -#include -#include -#include -#include "hiddata.h" -#include "../firmware/usbconfig.h" /* for device VID, PID, vendor name and product name */ - -/* ------------------------------------------------------------------------- */ - -static char *usbErrorMessage(int errCode) -{ -static char buffer[80]; - - switch(errCode){ - case USBOPEN_ERR_ACCESS: return "Access to device denied"; - case USBOPEN_ERR_NOTFOUND: return "The specified device was not found"; - case USBOPEN_ERR_IO: return "Communication error with device"; - default: - sprintf(buffer, "Unknown USB error %d", errCode); - return buffer; - } - return NULL; /* not reached */ -} - -static usbDevice_t *openDevice(void) -{ -usbDevice_t *dev = NULL; -unsigned char rawVid[2] = {USB_CFG_VENDOR_ID}, rawPid[2] = {USB_CFG_DEVICE_ID}; -char vendorName[] = {USB_CFG_VENDOR_NAME, 0}, productName[] = {USB_CFG_DEVICE_NAME, 0}; -int vid = rawVid[0] + 256 * rawVid[1]; -int pid = rawPid[0] + 256 * rawPid[1]; -int err; - - if((err = usbhidOpenDevice(&dev, vid, vendorName, pid, productName, 0)) != 0){ - fprintf(stderr, "error finding %s: %s\n", productName, usbErrorMessage(err)); - return NULL; - } - return dev; -} - -/* ------------------------------------------------------------------------- */ - -static void hexdump(char *buffer, int len) -{ -int i; -FILE *fp = stdout; - - for(i = 0; i < len; i++){ - if(i != 0){ - if(i % 16 == 0){ - fprintf(fp, "\n"); - }else{ - fprintf(fp, " "); - } - } - fprintf(fp, "0x%02x", buffer[i] & 0xff); - } - if(i != 0) - fprintf(fp, "\n"); -} - -static int hexread(char *buffer, char *string, int buflen) -{ -char *s; -int pos = 0; - - while((s = strtok(string, ", ")) != NULL && pos < buflen){ - string = NULL; - buffer[pos++] = (char)strtol(s, NULL, 0); - } - return pos; -} - -/* ------------------------------------------------------------------------- */ - -static void usage(char *myName) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, " %s read\n", myName); - fprintf(stderr, " %s write \n", myName); -} - -int main(int argc, char **argv) -{ -usbDevice_t *dev; -char buffer[129]; /* room for dummy report ID */ -int err; - - if(argc < 2){ - usage(argv[0]); - exit(1); - } - if((dev = openDevice()) == NULL) - exit(1); - if(strcasecmp(argv[1], "read") == 0){ - int len = sizeof(buffer); - if((err = usbhidGetReport(dev, 0, buffer, &len)) != 0){ - fprintf(stderr, "error reading data: %s\n", usbErrorMessage(err)); - }else{ - hexdump(buffer + 1, sizeof(buffer) - 1); - } - }else if(strcasecmp(argv[1], "write") == 0){ - int i, pos; - memset(buffer, 0, sizeof(buffer)); - for(pos = 1, i = 2; i < argc && pos < sizeof(buffer); i++){ - pos += hexread(buffer + pos, argv[i], sizeof(buffer) - pos); - } - if((err = usbhidSetReport(dev, buffer, sizeof(buffer))) != 0) /* add a dummy report ID */ - fprintf(stderr, "error writing data: %s\n", usbErrorMessage(err)); - }else{ - usage(argv[0]); - exit(1); - } - usbhidCloseDevice(dev); - return 0; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/examples/hid-data/firmware/Makefile b/tools/vusb/examples/hid-data/firmware/Makefile deleted file mode 100644 index 5876ab0..0000000 --- a/tools/vusb/examples/hid-data/firmware/Makefile +++ /dev/null @@ -1,164 +0,0 @@ -# Name: Makefile -# Project: hid-data example -# Author: Christian Starkjohann -# Creation Date: 2008-04-07 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id: Makefile 692 2008-11-07 15:07:40Z cs $ - -DEVICE = atmega168 -F_CPU = 16000000 # in Hz -FUSE_L = # see below for fuse values for particular devices -FUSE_H = -AVRDUDE = avrdude -c usbasp -p $(DEVICE) # edit this line for your programmer - -CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0 -OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o - -COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE) - -############################################################################## -# Fuse values for particular devices -############################################################################## -# If your device is not listed here, go to -# http://palmavr.sourceforge.net/cgi-bin/fc.cgi -# and choose options for external crystal clock and no clock divider -# -################################## ATMega8 ################################## -# ATMega8 FUSE_L (Fuse low byte): -# 0x9f = 1 0 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ BODEN (BrownOut Detector enabled) -# +-------------------- BODLEVEL (2.7V) -# ATMega8 FUSE_H (Fuse high byte): -# 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000) -# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 -# | | | | | +-------- BOOTSZ1 -# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase) -# | | | +-------------- CKOPT (full output swing) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ WDTON (WDT not always on) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATMega48/88/168 ############################## -# ATMega*8 FUSE_L (Fuse low byte): -# 0xdf = 1 1 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ CKOUT (if 0: Clock output enabled) -# +-------------------- CKDIV8 (if 0: divide by 8) -# ATMega*8 FUSE_H (Fuse high byte): -# 0xde = 1 1 0 1 1 1 1 0 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V) -# | | | | + --------- EESAVE (preserve EEPROM over chip erase) -# | | | +-------------- WDTON (if 0: watchdog always on) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATTiny25/45/85 ############################### -# ATMega*5 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATMega*5 FUSE_H (Fuse high byte): -# 0xdd = 1 1 0 1 1 1 0 1 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (disable external reset -> enabled) -# -################################ ATTiny2313 ################################# -# ATTiny2313 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATTiny2313 FUSE_H (Fuse high byte): -# 0xdb = 1 1 0 1 1 0 1 1 -# ^ ^ ^ ^ \-+-/ ^ -# | | | | | +---- RSTDISBL (disable external reset -> enabled) -# | | | | +-------- BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# +-------------------- DWEN (debug wire enable) - - -# symbolic targets: -help: - @echo "This Makefile has no default rule. Use one of the following:" - @echo "make hex ....... to build main.hex" - @echo "make program ... to flash fuses and firmware" - @echo "make fuse ...... to flash the fuses" - @echo "make flash ..... to flash the firmware (use this on metaboard)" - @echo "make clean ..... to delete objects and hex file" - -hex: main.hex - -program: flash fuse - -# rule for programming fuse bits: -fuse: - @[ "$(FUSE_H)" != "" -a "$(FUSE_L)" != "" ] || \ - { echo "*** Edit Makefile and choose values for FUSE_L and FUSE_H!"; exit 1; } - $(AVRDUDE) -U hfuse:w:$(FUSE_H):m -U lfuse:w:$(FUSE_L):m - -# rule for uploading firmware: -flash: main.hex - $(AVRDUDE) -U flash:w:main.hex:i - -# rule for deleting dependent files (those which can be built by Make): -clean: - rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s - -# Generic rule for compiling C files: -.c.o: - $(COMPILE) -c $< -o $@ - -# Generic rule for assembling Assembler source files: -.S.o: - $(COMPILE) -x assembler-with-cpp -c $< -o $@ -# "-x assembler-with-cpp" should not be necessary since this is the default -# file type for the .S (with capital S) extension. However, upper case -# characters are not always preserved on Windows. To ensure WinAVR -# compatibility define the file type manually. - -# Generic rule for compiling C to assembler, used for debugging only. -.c.s: - $(COMPILE) -S $< -o $@ - -# file targets: - -# Since we don't want to ship the driver multipe times, we copy it into this project: -usbdrv: - cp -r ../../../usbdrv . - -main.elf: usbdrv $(OBJECTS) # usbdrv dependency only needed because we copy it - $(COMPILE) -o main.elf $(OBJECTS) - -main.hex: main.elf - rm -f main.hex main.eep.hex - avr-objcopy -j .text -j .data -O ihex main.elf main.hex - avr-size main.hex - -# debugging targets: - -disasm: main.elf - avr-objdump -d main.elf - -cpp: - $(COMPILE) -E main.c diff --git a/tools/vusb/examples/hid-data/firmware/main.c b/tools/vusb/examples/hid-data/firmware/main.c deleted file mode 100644 index 71d0eb2..0000000 --- a/tools/vusb/examples/hid-data/firmware/main.c +++ /dev/null @@ -1,141 +0,0 @@ -/* Name: main.c - * Project: hid-data, example how to use HID for data transfer - * Author: Christian Starkjohann - * Creation Date: 2008-04-11 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: main.c 692 2008-11-07 15:07:40Z cs $ - */ - -/* -This example should run on most AVRs with only little changes. No special -hardware resources except INT0 are used. You may have to change usbconfig.h for -different I/O pins for USB. Please note that USB D+ must be the INT0 pin, or -at least be connected to INT0 as well. -*/ - -#include -#include -#include /* for sei() */ -#include /* for _delay_ms() */ -#include - -#include /* required by usbdrv.h */ -#include "usbdrv.h" -#include "oddebug.h" /* This is also an example for using debug macros */ - -/* ------------------------------------------------------------------------- */ -/* ----------------------------- USB interface ----------------------------- */ -/* ------------------------------------------------------------------------- */ - -PROGMEM char usbHidReportDescriptor[22] = { /* USB report descriptor */ - 0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop) - 0x09, 0x01, // USAGE (Vendor Usage 1) - 0xa1, 0x01, // COLLECTION (Application) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x80, // REPORT_COUNT (128) - 0x09, 0x00, // USAGE (Undefined) - 0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf) - 0xc0 // END_COLLECTION -}; -/* Since we define only one feature report, we don't use report-IDs (which - * would be the first byte of the report). The entire report consists of 128 - * opaque data bytes. - */ - -/* The following variables store the status of the current data transfer */ -static uchar currentAddress; -static uchar bytesRemaining; - -/* ------------------------------------------------------------------------- */ - -/* usbFunctionRead() is called when the host requests a chunk of data from - * the device. For more information see the documentation in usbdrv/usbdrv.h. - */ -uchar usbFunctionRead(uchar *data, uchar len) -{ - if(len > bytesRemaining) - len = bytesRemaining; - eeprom_read_block(data, (uchar *)0 + currentAddress, len); - currentAddress += len; - bytesRemaining -= len; - return len; -} - -/* usbFunctionWrite() is called when the host sends a chunk of data to the - * device. For more information see the documentation in usbdrv/usbdrv.h. - */ -uchar usbFunctionWrite(uchar *data, uchar len) -{ - if(bytesRemaining == 0) - return 1; /* end of transfer */ - if(len > bytesRemaining) - len = bytesRemaining; - eeprom_write_block(data, (uchar *)0 + currentAddress, len); - currentAddress += len; - bytesRemaining -= len; - return bytesRemaining == 0; /* return 1 if this was the last chunk */ -} - -/* ------------------------------------------------------------------------- */ - -usbMsgLen_t usbFunctionSetup(uchar data[8]) -{ -usbRequest_t *rq = (void *)data; - - if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){ /* HID class request */ - if(rq->bRequest == USBRQ_HID_GET_REPORT){ /* wValue: ReportType (highbyte), ReportID (lowbyte) */ - /* since we have only one report type, we can ignore the report-ID */ - bytesRemaining = 128; - currentAddress = 0; - return USB_NO_MSG; /* use usbFunctionRead() to obtain data */ - }else if(rq->bRequest == USBRQ_HID_SET_REPORT){ - /* since we have only one report type, we can ignore the report-ID */ - bytesRemaining = 128; - currentAddress = 0; - return USB_NO_MSG; /* use usbFunctionWrite() to receive data from host */ - } - }else{ - /* ignore vendor type requests, we don't use any */ - } - return 0; -} - -/* ------------------------------------------------------------------------- */ - -int main(void) -{ -uchar i; - - wdt_enable(WDTO_1S); - /* Even if you don't use the watchdog, turn it off here. On newer devices, - * the status of the watchdog (on/off, period) is PRESERVED OVER RESET! - */ - DBG1(0x00, 0, 0); /* debug output: main starts */ - /* RESET status: all port bits are inputs without pull-up. - * That's the way we need D+ and D-. Therefore we don't need any - * additional hardware initialization. - */ - odDebugInit(); - usbInit(); - usbDeviceDisconnect(); /* enforce re-enumeration, do this while interrupts are disabled! */ - i = 0; - while(--i){ /* fake USB disconnect for > 250 ms */ - wdt_reset(); - _delay_ms(1); - } - usbDeviceConnect(); - sei(); - DBG1(0x01, 0, 0); /* debug output: main loop starts */ - for(;;){ /* main event loop */ - DBG1(0x02, 0, 0); /* debug output: main loop iterates */ - wdt_reset(); - usbPoll(); - } - return 0; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/examples/hid-data/firmware/usbconfig.h b/tools/vusb/examples/hid-data/firmware/usbconfig.h deleted file mode 100644 index 467d1b8..0000000 --- a/tools/vusb/examples/hid-data/firmware/usbconfig.h +++ /dev/null @@ -1,350 +0,0 @@ -/* Name: usbconfig.h - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2005-04-01 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbconfig-prototype.h 740 2009-04-13 18:23:31Z cs $ - */ - -#ifndef __usbconfig_h_included__ -#define __usbconfig_h_included__ - -/* -General Description: -This file is an example configuration (with inline documentation) for the USB -driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is -also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may -wire the lines to any other port, as long as D+ is also wired to INT0 (or any -other hardware interrupt, as long as it is the highest level interrupt, see -section at the end of this file). -*/ - -/* ---------------------------- Hardware Config ---------------------------- */ - -#define USB_CFG_IOPORTNAME D -/* This is the port where the USB bus is connected. When you configure it to - * "B", the registers PORTB, PINB and DDRB will be used. - */ -#define USB_CFG_DMINUS_BIT 4 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This may be any bit in the port. - */ -#define USB_CFG_DPLUS_BIT 2 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port. Please note that D+ must also be connected - * to interrupt pin INT0! [You can also use other interrupts, see section - * "Optional MCU Description" below, or you can connect D- to the interrupt, as - * it is required if you use the USB_COUNT_SOF feature. If you use D- for the - * interrupt, the USB interrupt will also be triggered at Start-Of-Frame - * markers every millisecond.] - */ -#define USB_CFG_CLOCK_KHZ (F_CPU/1000) -/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000, - * 16500 and 20000. The 12.8 MHz and 16.5 MHz versions of the code require no - * crystal, they tolerate +/- 1% deviation from the nominal frequency. All - * other rates require a precision of 2000 ppm and thus a crystal! - * Default if not specified: 12 MHz - */ -#define USB_CFG_CHECK_CRC 0 -/* Define this to 1 if you want that the driver checks integrity of incoming - * data packets (CRC checks). CRC checks cost quite a bit of code size and are - * currently only available for 18 MHz crystal clock. You must choose - * USB_CFG_CLOCK_KHZ = 18000 if you enable this option. - */ - -/* ----------------------- Optional Hardware Config ------------------------ */ - -/* #define USB_CFG_PULLUP_IOPORTNAME D */ -/* If you connect the 1.5k pullup resistor from D- to a port pin instead of - * V+, you can connect and disconnect the device from firmware by calling - * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). - * This constant defines the port on which the pullup resistor is connected. - */ -/* #define USB_CFG_PULLUP_BIT 4 */ -/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined - * above) where the 1.5k pullup resistor is connected. See description - * above for details. - */ - -/* --------------------------- Functional Range ---------------------------- */ - -#define USB_CFG_HAVE_INTRIN_ENDPOINT 1 -/* Define this to 1 if you want to compile a version with two endpoints: The - * default control endpoint 0 and an interrupt-in endpoint (any other endpoint - * number). - */ -#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 -/* Define this to 1 if you want to compile a version with three endpoints: The - * default control endpoint 0, an interrupt-in endpoint 3 (or the number - * configured below) and a catch-all default interrupt-in endpoint as above. - * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. - */ -#define USB_CFG_EP3_NUMBER 3 -/* If the so-called endpoint 3 is used, it can now be configured to any other - * endpoint number (except 0) with this macro. Default if undefined is 3. - */ -/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */ -/* The above macro defines the startup condition for data toggling on the - * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1. - * Since the token is toggled BEFORE sending any data, the first packet is - * sent with the oposite value of this configuration! - */ -#define USB_CFG_IMPLEMENT_HALT 0 -/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature - * for endpoint 1 (interrupt endpoint). Although you may not need this feature, - * it is required by the standard. We have made it a config option because it - * bloats the code considerably. - */ -#define USB_CFG_SUPPRESS_INTR_CODE 0 -/* Define this to 1 if you want to declare interrupt-in endpoints, but don't - * want to send any data over them. If this macro is defined to 1, functions - * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if - * you need the interrupt-in endpoints in order to comply to an interface - * (e.g. HID), but never want to send any data. This option saves a couple - * of bytes in flash memory and the transmit buffers in RAM. - */ -#define USB_CFG_INTR_POLL_INTERVAL 100 -/* If you compile a version with endpoint 1 (interrupt-in), this is the poll - * interval. The value is in milliseconds and must not be less than 10 ms for - * low speed devices. - */ -#define USB_CFG_IS_SELF_POWERED 0 -/* Define this to 1 if the device has its own power supply. Set it to 0 if the - * device is powered from the USB bus. - */ -#define USB_CFG_MAX_BUS_POWER 20 -/* Set this variable to the maximum USB bus power consumption of your device. - * The value is in milliamperes. [It will be divided by two since USB - * communicates power requirements in units of 2 mA.] - */ -#define USB_CFG_IMPLEMENT_FN_WRITE 1 -/* Set this to 1 if you want usbFunctionWrite() to be called for control-out - * transfers. Set it to 0 if you don't need it and want to save a couple of - * bytes. - */ -#define USB_CFG_IMPLEMENT_FN_READ 1 -/* Set this to 1 if you need to send control replies which are generated - * "on the fly" when usbFunctionRead() is called. If you only want to send - * data from a static buffer, set it to 0 and return the data from - * usbFunctionSetup(). This saves a couple of bytes. - */ -#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 -/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. - * You must implement the function usbFunctionWriteOut() which receives all - * interrupt/bulk data sent to any endpoint other than 0. The endpoint number - * can be found in 'usbRxToken'. - */ -#define USB_CFG_HAVE_FLOWCONTROL 0 -/* Define this to 1 if you want flowcontrol over USB data. See the definition - * of the macros usbDisableAllRequests() and usbEnableAllRequests() in - * usbdrv.h. - */ -#define USB_CFG_LONG_TRANSFERS 0 -/* Define this to 1 if you want to send/receive blocks of more than 254 bytes - * in a single control-in or control-out transfer. Note that the capability - * for long transfers increases the driver size. - */ -/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ -/* This macro is a hook if you want to do unconventional things. If it is - * defined, it's inserted at the beginning of received message processing. - * If you eat the received message and don't want default processing to - * proceed, do a return after doing your things. One possible application - * (besides debugging) is to flash a status LED on each packet. - */ -/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */ -/* This macro is a hook if you need to know when an USB RESET occurs. It has - * one parameter which distinguishes between the start of RESET state and its - * end. - */ -/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */ -/* This macro (if defined) is executed when a USB SET_ADDRESS request was - * received. - */ -#define USB_COUNT_SOF 0 -/* define this macro to 1 if you need the global variable "usbSofCount" which - * counts SOF packets. This feature requires that the hardware interrupt is - * connected to D- instead of D+. - */ -/* #ifdef __ASSEMBLER__ - * macro myAssemblerMacro - * in YL, TCNT0 - * sts timer0Snapshot, YL - * endm - * #endif - * #define USB_SOF_HOOK myAssemblerMacro - * This macro (if defined) is executed in the assembler module when a - * Start Of Frame condition is detected. It is recommended to define it to - * the name of an assembler macro which is defined here as well so that more - * than one assembler instruction can be used. The macro may use the register - * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages - * immediately after an SOF pulse may be lost and must be retried by the host. - * What can you do with this hook? Since the SOF signal occurs exactly every - * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in - * designs running on the internal RC oscillator. - * Please note that Start Of Frame detection works only if D- is wired to the - * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! - */ -#define USB_CFG_CHECK_DATA_TOGGLING 0 -/* define this macro to 1 if you want to filter out duplicate data packets - * sent by the host. Duplicates occur only as a consequence of communication - * errors, when the host does not receive an ACK. Please note that you need to - * implement the filtering yourself in usbFunctionWriteOut() and - * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable - * for each control- and out-endpoint to check for duplicate packets. - */ -#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 -/* define this macro to 1 if you want the function usbMeasureFrameLength() - * compiled in. This function can be used to calibrate the AVR's RC oscillator. - */ - -/* -------------------------- Device Description --------------------------- */ - -#define USB_CFG_VENDOR_ID 0xc0, 0x16 -/* USB vendor ID for the device, low byte first. If you have registered your - * own Vendor ID, define it here. Otherwise you use one of obdev's free shared - * VID/PID pairs. Be sure to read USBID-License.txt for rules! - */ -#define USB_CFG_DEVICE_ID 0xdf, 0x05 /* obdev's shared PID for HIDs */ -/* This is the ID of the product, low byte first. It is interpreted in the - * scope of the vendor ID. If you have registered your own VID with usb.org - * or if you have licensed a PID from somebody else, define it here. Otherwise - * you use obdev's free shared VID/PID pair. Be sure to read the rules in - * USBID-License.txt! - */ -#define USB_CFG_DEVICE_VERSION 0x00, 0x01 -/* Version number of the device: Minor number first, then major number. - */ -#define USB_CFG_VENDOR_NAME 'o', 'b', 'd', 'e', 'v', '.', 'a', 't' -#define USB_CFG_VENDOR_NAME_LEN 8 -/* These two values define the vendor name returned by the USB device. The name - * must be given as a list of characters under single quotes. The characters - * are interpreted as Unicode (UTF-16) entities. - * If you don't want a vendor name string, undefine these macros. - * ALWAYS define a vendor name containing your Internet domain name if you use - * obdev's free shared VID/PID pair. See the file USBID-License.txt for - * details. - */ -#define USB_CFG_DEVICE_NAME 'D', 'a', 't', 'a', 'S', 't', 'o', 'r', 'e' -#define USB_CFG_DEVICE_NAME_LEN 9 -/* Same as above for the device name. If you don't want a device name, undefine - * the macros. See the file USBID-License.txt before you assign a name if you - * use a shared VID/PID. - */ -/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ -/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ -/* Same as above for the serial number. If you don't want a serial number, - * undefine the macros. - * It may be useful to provide the serial number through other means than at - * compile time. See the section about descriptor properties below for how - * to fine tune control over USB descriptors such as the string descriptor - * for the serial number. - */ -#define USB_CFG_DEVICE_CLASS 0 -#define USB_CFG_DEVICE_SUBCLASS 0 -/* See USB specification if you want to conform to an existing device class. - * Class 0xff is "vendor specific". - */ -#define USB_CFG_INTERFACE_CLASS 3 -#define USB_CFG_INTERFACE_SUBCLASS 0 -#define USB_CFG_INTERFACE_PROTOCOL 0 -/* See USB specification if you want to conform to an existing device class or - * protocol. The following classes must be set at interface level: - * HID class is 3, no subclass and protocol required (but may be useful!) - * CDC class is 2, use subclass 2 and protocol 1 for ACM - */ -#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 22 -/* Define this to the length of the HID report descriptor, if you implement - * an HID device. Otherwise don't define it or define it to 0. - * If you use this define, you must add a PROGMEM character array named - * "usbHidReportDescriptor" to your code which contains the report descriptor. - * Don't forget to keep the array and this define in sync! - */ - -/* #define USB_PUBLIC static */ -/* Use the define above if you #include usbdrv.c instead of linking against it. - * This technique saves a couple of bytes in flash memory. - */ - -/* ------------------- Fine Control over USB Descriptors ------------------- */ -/* If you don't want to use the driver's default USB descriptors, you can - * provide our own. These can be provided as (1) fixed length static data in - * flash memory, (2) fixed length static data in RAM or (3) dynamically at - * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more - * information about this function. - * Descriptor handling is configured through the descriptor's properties. If - * no properties are defined or if they are 0, the default descriptor is used. - * Possible properties are: - * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched - * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is - * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if - * you want RAM pointers. - * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found - * in static memory is in RAM, not in flash memory. - * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), - * the driver must know the descriptor's length. The descriptor itself is - * found at the address of a well known identifier (see below). - * List of static descriptor names (must be declared PROGMEM if in flash): - * char usbDescriptorDevice[]; - * char usbDescriptorConfiguration[]; - * char usbDescriptorHidReport[]; - * char usbDescriptorString0[]; - * int usbDescriptorStringVendor[]; - * int usbDescriptorStringDevice[]; - * int usbDescriptorStringSerialNumber[]; - * Other descriptors can't be provided statically, they must be provided - * dynamically at runtime. - * - * Descriptor properties are or-ed or added together, e.g.: - * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) - * - * The following descriptors are defined: - * USB_CFG_DESCR_PROPS_DEVICE - * USB_CFG_DESCR_PROPS_CONFIGURATION - * USB_CFG_DESCR_PROPS_STRINGS - * USB_CFG_DESCR_PROPS_STRING_0 - * USB_CFG_DESCR_PROPS_STRING_VENDOR - * USB_CFG_DESCR_PROPS_STRING_PRODUCT - * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER - * USB_CFG_DESCR_PROPS_HID - * USB_CFG_DESCR_PROPS_HID_REPORT - * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) - * - * Note about string descriptors: String descriptors are not just strings, they - * are Unicode strings prefixed with a 2 byte header. Example: - * int serialNumberDescriptor[] = { - * USB_STRING_DESCRIPTOR_HEADER(6), - * 'S', 'e', 'r', 'i', 'a', 'l' - * }; - */ - -#define USB_CFG_DESCR_PROPS_DEVICE 0 -#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 -#define USB_CFG_DESCR_PROPS_STRINGS 0 -#define USB_CFG_DESCR_PROPS_STRING_0 0 -#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 -#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 -#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 -#define USB_CFG_DESCR_PROPS_HID 0 -#define USB_CFG_DESCR_PROPS_HID_REPORT 0 -#define USB_CFG_DESCR_PROPS_UNKNOWN 0 - -/* ----------------------- Optional MCU Description ------------------------ */ - -/* The following configurations have working defaults in usbdrv.h. You - * usually don't need to set them explicitly. Only if you want to run - * the driver on a device which is not yet supported or with a compiler - * which is not fully supported (such as IAR C) or if you use a differnt - * interrupt than INT0, you may have to define some of these. - */ -/* #define USB_INTR_CFG MCUCR */ -/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ -/* #define USB_INTR_CFG_CLR 0 */ -/* #define USB_INTR_ENABLE GIMSK */ -/* #define USB_INTR_ENABLE_BIT INT0 */ -/* #define USB_INTR_PENDING GIFR */ -/* #define USB_INTR_PENDING_BIT INTF0 */ -/* #define USB_INTR_VECTOR SIG_INTERRUPT0 */ - -#endif /* __usbconfig_h_included__ */ diff --git a/tools/vusb/examples/hid-mouse/Readme.txt b/tools/vusb/examples/hid-mouse/Readme.txt deleted file mode 100644 index e0c8142..0000000 --- a/tools/vusb/examples/hid-mouse/Readme.txt +++ /dev/null @@ -1,48 +0,0 @@ -This is the Readme file for hid-mouse, an example of a USB mouse device. In -order to have as little dependencies on hardware and architecture as -possible, mouse movements are computed internally so that the mouse pointer -moves in a circle. - - -WHAT IS DEMONSTRATED? -===================== -This example demonstrates how HID class devices are implemented. The example -is kept as simple as possible, except the report descriptor which is taken -from a real-world mouse. - -It does NOT include a host side driver because all modern operating systems -include one. It does NOT implement USBRQ_HID_SET_REPORT and report-IDs. See -the "hid-data" example for this topic. It does NOT implement any special -features such as suspend mode etc. - - -PREREQUISITES -============= -Target hardware: You need an AVR based circuit based on one of the examples -(see the "circuits" directory at the top level of this package), e.g. the -metaboard (http://www.obdev.at/goto.php?t=metaboard). - -AVR development environment: You need the gcc tool chain for the AVR, see -the Prerequisites section in the top level Readme file for how to obtain it. - - -BUILDING THE FIRMWARE -===================== -Change to the "firmware" directory and modify Makefile according to your -architecture (CPU clock, target device, fuse values) and ISP programmer. Then -edit usbconfig.h according to your pin assignments for D+ and D-. The default -settings are for the metaboard hardware. - -Type "make hex" to build main.hex, then "make flash" to upload the firmware -to the device. Don't forget to run "make fuse" once to program the fuses. If -you use a prototyping board with boot loader, follow the instructions of the -boot loader instead. - -Please note that the first "make hex" copies the driver from the top level -into the firmware directory. If you use a different build system than our -Makefile, you must copy the driver by hand. - - ----------------------------------------------------------------------------- -(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/examples/hid-mouse/firmware/Makefile b/tools/vusb/examples/hid-mouse/firmware/Makefile deleted file mode 100644 index 22b1227..0000000 --- a/tools/vusb/examples/hid-mouse/firmware/Makefile +++ /dev/null @@ -1,164 +0,0 @@ -# Name: Makefile -# Project: hid-mouse example -# Author: Christian Starkjohann -# Creation Date: 2008-04-07 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id: Makefile 692 2008-11-07 15:07:40Z cs $ - -DEVICE = atmega168 -F_CPU = 16000000 # in Hz -FUSE_L = # see below for fuse values for particular devices -FUSE_H = -AVRDUDE = avrdude -c usbasp -p $(DEVICE) # edit this line for your programmer - -CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0 -OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o - -COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE) - -############################################################################## -# Fuse values for particular devices -############################################################################## -# If your device is not listed here, go to -# http://palmavr.sourceforge.net/cgi-bin/fc.cgi -# and choose options for external crystal clock and no clock divider -# -################################## ATMega8 ################################## -# ATMega8 FUSE_L (Fuse low byte): -# 0x9f = 1 0 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ BODEN (BrownOut Detector enabled) -# +-------------------- BODLEVEL (2.7V) -# ATMega8 FUSE_H (Fuse high byte): -# 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000) -# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 -# | | | | | +-------- BOOTSZ1 -# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase) -# | | | +-------------- CKOPT (full output swing) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ WDTON (WDT not always on) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATMega48/88/168 ############################## -# ATMega*8 FUSE_L (Fuse low byte): -# 0xdf = 1 1 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ CKOUT (if 0: Clock output enabled) -# +-------------------- CKDIV8 (if 0: divide by 8) -# ATMega*8 FUSE_H (Fuse high byte): -# 0xde = 1 1 0 1 1 1 1 0 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V) -# | | | | + --------- EESAVE (preserve EEPROM over chip erase) -# | | | +-------------- WDTON (if 0: watchdog always on) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATTiny25/45/85 ############################### -# ATMega*5 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATMega*5 FUSE_H (Fuse high byte): -# 0xdd = 1 1 0 1 1 1 0 1 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (disable external reset -> enabled) -# -################################ ATTiny2313 ################################# -# ATTiny2313 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATTiny2313 FUSE_H (Fuse high byte): -# 0xdb = 1 1 0 1 1 0 1 1 -# ^ ^ ^ ^ \-+-/ ^ -# | | | | | +---- RSTDISBL (disable external reset -> enabled) -# | | | | +-------- BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# +-------------------- DWEN (debug wire enable) - - -# symbolic targets: -help: - @echo "This Makefile has no default rule. Use one of the following:" - @echo "make hex ....... to build main.hex" - @echo "make program ... to flash fuses and firmware" - @echo "make fuse ...... to flash the fuses" - @echo "make flash ..... to flash the firmware (use this on metaboard)" - @echo "make clean ..... to delete objects and hex file" - -hex: main.hex - -program: flash fuse - -# rule for programming fuse bits: -fuse: - @[ "$(FUSE_H)" != "" -a "$(FUSE_L)" != "" ] || \ - { echo "*** Edit Makefile and choose values for FUSE_L and FUSE_H!"; exit 1; } - $(AVRDUDE) -U hfuse:w:$(FUSE_H):m -U lfuse:w:$(FUSE_L):m - -# rule for uploading firmware: -flash: main.hex - $(AVRDUDE) -U flash:w:main.hex:i - -# rule for deleting dependent files (those which can be built by Make): -clean: - rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s - -# Generic rule for compiling C files: -.c.o: - $(COMPILE) -c $< -o $@ - -# Generic rule for assembling Assembler source files: -.S.o: - $(COMPILE) -x assembler-with-cpp -c $< -o $@ -# "-x assembler-with-cpp" should not be necessary since this is the default -# file type for the .S (with capital S) extension. However, upper case -# characters are not always preserved on Windows. To ensure WinAVR -# compatibility define the file type manually. - -# Generic rule for compiling C to assembler, used for debugging only. -.c.s: - $(COMPILE) -S $< -o $@ - -# file targets: - -# Since we don't want to ship the driver multipe times, we copy it into this project: -usbdrv: - cp -r ../../../usbdrv . - -main.elf: usbdrv $(OBJECTS) # usbdrv dependency only needed because we copy it - $(COMPILE) -o main.elf $(OBJECTS) - -main.hex: main.elf - rm -f main.hex main.eep.hex - avr-objcopy -j .text -j .data -O ihex main.elf main.hex - avr-size main.hex - -# debugging targets: - -disasm: main.elf - avr-objdump -d main.elf - -cpp: - $(COMPILE) -E main.c diff --git a/tools/vusb/examples/hid-mouse/firmware/main.c b/tools/vusb/examples/hid-mouse/firmware/main.c deleted file mode 100644 index cfd3287..0000000 --- a/tools/vusb/examples/hid-mouse/firmware/main.c +++ /dev/null @@ -1,165 +0,0 @@ -/* Name: main.c - * Project: hid-mouse, a very simple HID example - * Author: Christian Starkjohann - * Creation Date: 2008-04-07 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: main.c 692 2008-11-07 15:07:40Z cs $ - */ - -/* -This example should run on most AVRs with only little changes. No special -hardware resources except INT0 are used. You may have to change usbconfig.h for -different I/O pins for USB. Please note that USB D+ must be the INT0 pin, or -at least be connected to INT0 as well. - -We use VID/PID 0x046D/0xC00E which is taken from a Logitech mouse. Don't -publish any hardware using these IDs! This is for demonstration only! -*/ - -#include -#include -#include /* for sei() */ -#include /* for _delay_ms() */ - -#include /* required by usbdrv.h */ -#include "usbdrv.h" -#include "oddebug.h" /* This is also an example for using debug macros */ - -/* ------------------------------------------------------------------------- */ -/* ----------------------------- USB interface ----------------------------- */ -/* ------------------------------------------------------------------------- */ - -PROGMEM char usbHidReportDescriptor[52] = { /* USB report descriptor, size must match usbconfig.h */ - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x02, // USAGE (Mouse) - 0xa1, 0x01, // COLLECTION (Application) - 0x09, 0x01, // USAGE (Pointer) - 0xA1, 0x00, // COLLECTION (Physical) - 0x05, 0x09, // USAGE_PAGE (Button) - 0x19, 0x01, // USAGE_MINIMUM - 0x29, 0x03, // USAGE_MAXIMUM - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x95, 0x03, // REPORT_COUNT (3) - 0x75, 0x01, // REPORT_SIZE (1) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x95, 0x01, // REPORT_COUNT (1) - 0x75, 0x05, // REPORT_SIZE (5) - 0x81, 0x03, // INPUT (Const,Var,Abs) - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x30, // USAGE (X) - 0x09, 0x31, // USAGE (Y) - 0x09, 0x38, // USAGE (Wheel) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7F, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x03, // REPORT_COUNT (3) - 0x81, 0x06, // INPUT (Data,Var,Rel) - 0xC0, // END_COLLECTION - 0xC0, // END COLLECTION -}; -/* This is the same report descriptor as seen in a Logitech mouse. The data - * described by this descriptor consists of 4 bytes: - * . . . . . B2 B1 B0 .... one byte with mouse button states - * X7 X6 X5 X4 X3 X2 X1 X0 .... 8 bit signed relative coordinate x - * Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 .... 8 bit signed relative coordinate y - * W7 W6 W5 W4 W3 W2 W1 W0 .... 8 bit signed relative coordinate wheel - */ -typedef struct{ - uchar buttonMask; - char dx; - char dy; - char dWheel; -}report_t; - -static report_t reportBuffer; -static int sinus = 7 << 6, cosinus = 0; -static uchar idleRate; /* repeat rate for keyboards, never used for mice */ - - -/* The following function advances sin/cos by a fixed angle - * and stores the difference to the previous coordinates in the report - * descriptor. - * The algorithm is the simulation of a second order differential equation. - */ -static void advanceCircleByFixedAngle(void) -{ -char d; - -#define DIVIDE_BY_64(val) (val + (val > 0 ? 32 : -32)) >> 6 /* rounding divide */ - reportBuffer.dx = d = DIVIDE_BY_64(cosinus); - sinus += d; - reportBuffer.dy = d = DIVIDE_BY_64(sinus); - cosinus -= d; -} - -/* ------------------------------------------------------------------------- */ - -usbMsgLen_t usbFunctionSetup(uchar data[8]) -{ -usbRequest_t *rq = (void *)data; - - /* The following requests are never used. But since they are required by - * the specification, we implement them in this example. - */ - if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){ /* class request type */ - DBG1(0x50, &rq->bRequest, 1); /* debug output: print our request */ - if(rq->bRequest == USBRQ_HID_GET_REPORT){ /* wValue: ReportType (highbyte), ReportID (lowbyte) */ - /* we only have one report type, so don't look at wValue */ - usbMsgPtr = (void *)&reportBuffer; - return sizeof(reportBuffer); - }else if(rq->bRequest == USBRQ_HID_GET_IDLE){ - usbMsgPtr = &idleRate; - return 1; - }else if(rq->bRequest == USBRQ_HID_SET_IDLE){ - idleRate = rq->wValue.bytes[1]; - } - }else{ - /* no vendor specific requests implemented */ - } - return 0; /* default for not implemented requests: return no data back to host */ -} - -/* ------------------------------------------------------------------------- */ - -int main(void) -{ -uchar i; - - wdt_enable(WDTO_1S); - /* Even if you don't use the watchdog, turn it off here. On newer devices, - * the status of the watchdog (on/off, period) is PRESERVED OVER RESET! - */ - DBG1(0x00, 0, 0); /* debug output: main starts */ - /* RESET status: all port bits are inputs without pull-up. - * That's the way we need D+ and D-. Therefore we don't need any - * additional hardware initialization. - */ - odDebugInit(); - usbInit(); - usbDeviceDisconnect(); /* enforce re-enumeration, do this while interrupts are disabled! */ - i = 0; - while(--i){ /* fake USB disconnect for > 250 ms */ - wdt_reset(); - _delay_ms(1); - } - usbDeviceConnect(); - sei(); - DBG1(0x01, 0, 0); /* debug output: main loop starts */ - for(;;){ /* main event loop */ - DBG1(0x02, 0, 0); /* debug output: main loop iterates */ - wdt_reset(); - usbPoll(); - if(usbInterruptIsReady()){ - /* called after every poll of the interrupt endpoint */ - advanceCircleByFixedAngle(); - DBG1(0x03, 0, 0); /* debug output: interrupt report prepared */ - usbSetInterrupt((void *)&reportBuffer, sizeof(reportBuffer)); - } - } - return 0; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/examples/hid-mouse/firmware/usbconfig.h b/tools/vusb/examples/hid-mouse/firmware/usbconfig.h deleted file mode 100644 index 809ee51..0000000 --- a/tools/vusb/examples/hid-mouse/firmware/usbconfig.h +++ /dev/null @@ -1,350 +0,0 @@ -/* Name: usbconfig.h - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2005-04-01 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbconfig-prototype.h 740 2009-04-13 18:23:31Z cs $ - */ - -#ifndef __usbconfig_h_included__ -#define __usbconfig_h_included__ - -/* -General Description: -This file is an example configuration (with inline documentation) for the USB -driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is -also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may -wire the lines to any other port, as long as D+ is also wired to INT0 (or any -other hardware interrupt, as long as it is the highest level interrupt, see -section at the end of this file). -*/ - -/* ---------------------------- Hardware Config ---------------------------- */ - -#define USB_CFG_IOPORTNAME D -/* This is the port where the USB bus is connected. When you configure it to - * "B", the registers PORTB, PINB and DDRB will be used. - */ -#define USB_CFG_DMINUS_BIT 4 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This may be any bit in the port. - */ -#define USB_CFG_DPLUS_BIT 2 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port. Please note that D+ must also be connected - * to interrupt pin INT0! [You can also use other interrupts, see section - * "Optional MCU Description" below, or you can connect D- to the interrupt, as - * it is required if you use the USB_COUNT_SOF feature. If you use D- for the - * interrupt, the USB interrupt will also be triggered at Start-Of-Frame - * markers every millisecond.] - */ -#define USB_CFG_CLOCK_KHZ (F_CPU/1000) -/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000, - * 16500 and 20000. The 12.8 MHz and 16.5 MHz versions of the code require no - * crystal, they tolerate +/- 1% deviation from the nominal frequency. All - * other rates require a precision of 2000 ppm and thus a crystal! - * Default if not specified: 12 MHz - */ -#define USB_CFG_CHECK_CRC 0 -/* Define this to 1 if you want that the driver checks integrity of incoming - * data packets (CRC checks). CRC checks cost quite a bit of code size and are - * currently only available for 18 MHz crystal clock. You must choose - * USB_CFG_CLOCK_KHZ = 18000 if you enable this option. - */ - -/* ----------------------- Optional Hardware Config ------------------------ */ - -/* #define USB_CFG_PULLUP_IOPORTNAME D */ -/* If you connect the 1.5k pullup resistor from D- to a port pin instead of - * V+, you can connect and disconnect the device from firmware by calling - * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). - * This constant defines the port on which the pullup resistor is connected. - */ -/* #define USB_CFG_PULLUP_BIT 4 */ -/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined - * above) where the 1.5k pullup resistor is connected. See description - * above for details. - */ - -/* --------------------------- Functional Range ---------------------------- */ - -#define USB_CFG_HAVE_INTRIN_ENDPOINT 1 -/* Define this to 1 if you want to compile a version with two endpoints: The - * default control endpoint 0 and an interrupt-in endpoint (any other endpoint - * number). - */ -#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 -/* Define this to 1 if you want to compile a version with three endpoints: The - * default control endpoint 0, an interrupt-in endpoint 3 (or the number - * configured below) and a catch-all default interrupt-in endpoint as above. - * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. - */ -#define USB_CFG_EP3_NUMBER 3 -/* If the so-called endpoint 3 is used, it can now be configured to any other - * endpoint number (except 0) with this macro. Default if undefined is 3. - */ -/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */ -/* The above macro defines the startup condition for data toggling on the - * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1. - * Since the token is toggled BEFORE sending any data, the first packet is - * sent with the oposite value of this configuration! - */ -#define USB_CFG_IMPLEMENT_HALT 0 -/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature - * for endpoint 1 (interrupt endpoint). Although you may not need this feature, - * it is required by the standard. We have made it a config option because it - * bloats the code considerably. - */ -#define USB_CFG_SUPPRESS_INTR_CODE 0 -/* Define this to 1 if you want to declare interrupt-in endpoints, but don't - * want to send any data over them. If this macro is defined to 1, functions - * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if - * you need the interrupt-in endpoints in order to comply to an interface - * (e.g. HID), but never want to send any data. This option saves a couple - * of bytes in flash memory and the transmit buffers in RAM. - */ -#define USB_CFG_INTR_POLL_INTERVAL 100 -/* If you compile a version with endpoint 1 (interrupt-in), this is the poll - * interval. The value is in milliseconds and must not be less than 10 ms for - * low speed devices. - */ -#define USB_CFG_IS_SELF_POWERED 0 -/* Define this to 1 if the device has its own power supply. Set it to 0 if the - * device is powered from the USB bus. - */ -#define USB_CFG_MAX_BUS_POWER 20 -/* Set this variable to the maximum USB bus power consumption of your device. - * The value is in milliamperes. [It will be divided by two since USB - * communicates power requirements in units of 2 mA.] - */ -#define USB_CFG_IMPLEMENT_FN_WRITE 0 -/* Set this to 1 if you want usbFunctionWrite() to be called for control-out - * transfers. Set it to 0 if you don't need it and want to save a couple of - * bytes. - */ -#define USB_CFG_IMPLEMENT_FN_READ 0 -/* Set this to 1 if you need to send control replies which are generated - * "on the fly" when usbFunctionRead() is called. If you only want to send - * data from a static buffer, set it to 0 and return the data from - * usbFunctionSetup(). This saves a couple of bytes. - */ -#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 -/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. - * You must implement the function usbFunctionWriteOut() which receives all - * interrupt/bulk data sent to any endpoint other than 0. The endpoint number - * can be found in 'usbRxToken'. - */ -#define USB_CFG_HAVE_FLOWCONTROL 0 -/* Define this to 1 if you want flowcontrol over USB data. See the definition - * of the macros usbDisableAllRequests() and usbEnableAllRequests() in - * usbdrv.h. - */ -#define USB_CFG_LONG_TRANSFERS 0 -/* Define this to 1 if you want to send/receive blocks of more than 254 bytes - * in a single control-in or control-out transfer. Note that the capability - * for long transfers increases the driver size. - */ -/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ -/* This macro is a hook if you want to do unconventional things. If it is - * defined, it's inserted at the beginning of received message processing. - * If you eat the received message and don't want default processing to - * proceed, do a return after doing your things. One possible application - * (besides debugging) is to flash a status LED on each packet. - */ -/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */ -/* This macro is a hook if you need to know when an USB RESET occurs. It has - * one parameter which distinguishes between the start of RESET state and its - * end. - */ -/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */ -/* This macro (if defined) is executed when a USB SET_ADDRESS request was - * received. - */ -#define USB_COUNT_SOF 0 -/* define this macro to 1 if you need the global variable "usbSofCount" which - * counts SOF packets. This feature requires that the hardware interrupt is - * connected to D- instead of D+. - */ -/* #ifdef __ASSEMBLER__ - * macro myAssemblerMacro - * in YL, TCNT0 - * sts timer0Snapshot, YL - * endm - * #endif - * #define USB_SOF_HOOK myAssemblerMacro - * This macro (if defined) is executed in the assembler module when a - * Start Of Frame condition is detected. It is recommended to define it to - * the name of an assembler macro which is defined here as well so that more - * than one assembler instruction can be used. The macro may use the register - * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages - * immediately after an SOF pulse may be lost and must be retried by the host. - * What can you do with this hook? Since the SOF signal occurs exactly every - * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in - * designs running on the internal RC oscillator. - * Please note that Start Of Frame detection works only if D- is wired to the - * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! - */ -#define USB_CFG_CHECK_DATA_TOGGLING 0 -/* define this macro to 1 if you want to filter out duplicate data packets - * sent by the host. Duplicates occur only as a consequence of communication - * errors, when the host does not receive an ACK. Please note that you need to - * implement the filtering yourself in usbFunctionWriteOut() and - * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable - * for each control- and out-endpoint to check for duplicate packets. - */ -#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 -/* define this macro to 1 if you want the function usbMeasureFrameLength() - * compiled in. This function can be used to calibrate the AVR's RC oscillator. - */ - -/* -------------------------- Device Description --------------------------- */ - -#define USB_CFG_VENDOR_ID 0xc0, 0x16 -/* USB vendor ID for the device, low byte first. If you have registered your - * own Vendor ID, define it here. Otherwise you use one of obdev's free shared - * VID/PID pairs. Be sure to read USBID-License.txt for rules! - */ -#define USB_CFG_DEVICE_ID 0xe8, 0x03 /* VOTI's lab use PID */ -/* This is the ID of the product, low byte first. It is interpreted in the - * scope of the vendor ID. If you have registered your own VID with usb.org - * or if you have licensed a PID from somebody else, define it here. Otherwise - * you use obdev's free shared VID/PID pair. Be sure to read the rules in - * USBID-License.txt! - */ -#define USB_CFG_DEVICE_VERSION 0x00, 0x01 -/* Version number of the device: Minor number first, then major number. - */ -#define USB_CFG_VENDOR_NAME 'o', 'b', 'd', 'e', 'v', '.', 'a', 't' -#define USB_CFG_VENDOR_NAME_LEN 8 -/* These two values define the vendor name returned by the USB device. The name - * must be given as a list of characters under single quotes. The characters - * are interpreted as Unicode (UTF-16) entities. - * If you don't want a vendor name string, undefine these macros. - * ALWAYS define a vendor name containing your Internet domain name if you use - * obdev's free shared VID/PID pair. See the file USBID-License.txt for - * details. - */ -#define USB_CFG_DEVICE_NAME 'M', 'o', 'u', 's', 'e' -#define USB_CFG_DEVICE_NAME_LEN 5 -/* Same as above for the device name. If you don't want a device name, undefine - * the macros. See the file USBID-License.txt before you assign a name if you - * use a shared VID/PID. - */ -/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ -/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ -/* Same as above for the serial number. If you don't want a serial number, - * undefine the macros. - * It may be useful to provide the serial number through other means than at - * compile time. See the section about descriptor properties below for how - * to fine tune control over USB descriptors such as the string descriptor - * for the serial number. - */ -#define USB_CFG_DEVICE_CLASS 0 -#define USB_CFG_DEVICE_SUBCLASS 0 -/* See USB specification if you want to conform to an existing device class. - * Class 0xff is "vendor specific". - */ -#define USB_CFG_INTERFACE_CLASS 3 -#define USB_CFG_INTERFACE_SUBCLASS 0 -#define USB_CFG_INTERFACE_PROTOCOL 0 -/* See USB specification if you want to conform to an existing device class or - * protocol. The following classes must be set at interface level: - * HID class is 3, no subclass and protocol required (but may be useful!) - * CDC class is 2, use subclass 2 and protocol 1 for ACM - */ -#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 52 -/* Define this to the length of the HID report descriptor, if you implement - * an HID device. Otherwise don't define it or define it to 0. - * If you use this define, you must add a PROGMEM character array named - * "usbHidReportDescriptor" to your code which contains the report descriptor. - * Don't forget to keep the array and this define in sync! - */ - -/* #define USB_PUBLIC static */ -/* Use the define above if you #include usbdrv.c instead of linking against it. - * This technique saves a couple of bytes in flash memory. - */ - -/* ------------------- Fine Control over USB Descriptors ------------------- */ -/* If you don't want to use the driver's default USB descriptors, you can - * provide our own. These can be provided as (1) fixed length static data in - * flash memory, (2) fixed length static data in RAM or (3) dynamically at - * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more - * information about this function. - * Descriptor handling is configured through the descriptor's properties. If - * no properties are defined or if they are 0, the default descriptor is used. - * Possible properties are: - * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched - * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is - * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if - * you want RAM pointers. - * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found - * in static memory is in RAM, not in flash memory. - * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), - * the driver must know the descriptor's length. The descriptor itself is - * found at the address of a well known identifier (see below). - * List of static descriptor names (must be declared PROGMEM if in flash): - * char usbDescriptorDevice[]; - * char usbDescriptorConfiguration[]; - * char usbDescriptorHidReport[]; - * char usbDescriptorString0[]; - * int usbDescriptorStringVendor[]; - * int usbDescriptorStringDevice[]; - * int usbDescriptorStringSerialNumber[]; - * Other descriptors can't be provided statically, they must be provided - * dynamically at runtime. - * - * Descriptor properties are or-ed or added together, e.g.: - * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) - * - * The following descriptors are defined: - * USB_CFG_DESCR_PROPS_DEVICE - * USB_CFG_DESCR_PROPS_CONFIGURATION - * USB_CFG_DESCR_PROPS_STRINGS - * USB_CFG_DESCR_PROPS_STRING_0 - * USB_CFG_DESCR_PROPS_STRING_VENDOR - * USB_CFG_DESCR_PROPS_STRING_PRODUCT - * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER - * USB_CFG_DESCR_PROPS_HID - * USB_CFG_DESCR_PROPS_HID_REPORT - * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) - * - * Note about string descriptors: String descriptors are not just strings, they - * are Unicode strings prefixed with a 2 byte header. Example: - * int serialNumberDescriptor[] = { - * USB_STRING_DESCRIPTOR_HEADER(6), - * 'S', 'e', 'r', 'i', 'a', 'l' - * }; - */ - -#define USB_CFG_DESCR_PROPS_DEVICE 0 -#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 -#define USB_CFG_DESCR_PROPS_STRINGS 0 -#define USB_CFG_DESCR_PROPS_STRING_0 0 -#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 -#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 -#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 -#define USB_CFG_DESCR_PROPS_HID 0 -#define USB_CFG_DESCR_PROPS_HID_REPORT 0 -#define USB_CFG_DESCR_PROPS_UNKNOWN 0 - -/* ----------------------- Optional MCU Description ------------------------ */ - -/* The following configurations have working defaults in usbdrv.h. You - * usually don't need to set them explicitly. Only if you want to run - * the driver on a device which is not yet supported or with a compiler - * which is not fully supported (such as IAR C) or if you use a differnt - * interrupt than INT0, you may have to define some of these. - */ -/* #define USB_INTR_CFG MCUCR */ -/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ -/* #define USB_INTR_CFG_CLR 0 */ -/* #define USB_INTR_ENABLE GIMSK */ -/* #define USB_INTR_ENABLE_BIT INT0 */ -/* #define USB_INTR_PENDING GIFR */ -/* #define USB_INTR_PENDING_BIT INTF0 */ -/* #define USB_INTR_VECTOR SIG_INTERRUPT0 */ - -#endif /* __usbconfig_h_included__ */ diff --git a/tools/vusb/examples/usbtool/Makefile b/tools/vusb/examples/usbtool/Makefile deleted file mode 100644 index d41aba6..0000000 --- a/tools/vusb/examples/usbtool/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# Name: Makefile -# Project: usbtool -# Author: Christian Starkjohann -# Creation Date: 2008-04-06 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id: Makefile 692 2008-11-07 15:07:40Z cs $ - - -# Concigure the following definitions according to your system. -# This Makefile has been tested on Mac OS X, Linux and Windows. - -# Use the following 3 lines on Unix (uncomment the framework on Mac OS X): -USBFLAGS = `libusb-config --cflags` -USBLIBS = `libusb-config --libs` -EXE_SUFFIX = - -# Use the following 3 lines on Windows and comment out the 3 above. You may -# have to change the include paths to where you installed libusb-win32 -#USBFLAGS = -I/usr/local/include -#USBLIBS = -L/usr/local/lib -lusb -#EXE_SUFFIX = .exe - -NAME = usbtool - -OBJECTS = opendevice.o $(NAME).o - -CC = gcc -CFLAGS = $(CPPFLAGS) $(USBFLAGS) -O -g -Wall -LIBS = $(USBLIBS) - -PROGRAM = $(NAME)$(EXE_SUFFIX) - - -all: $(PROGRAM) - -.c.o: - $(CC) $(CFLAGS) -c $< - -$(PROGRAM): $(OBJECTS) - $(CC) -o $(PROGRAM) $(OBJECTS) $(LIBS) - -strip: $(PROGRAM) - strip $(PROGRAM) - -clean: - rm -f *.o $(PROGRAM) diff --git a/tools/vusb/examples/usbtool/Makefile.windows b/tools/vusb/examples/usbtool/Makefile.windows deleted file mode 100644 index fa910fc..0000000 --- a/tools/vusb/examples/usbtool/Makefile.windows +++ /dev/null @@ -1,18 +0,0 @@ -# Name: Makefile.windows -# Project: usbtool -# Author: Christian Starkjohann -# Creation Date: 2008-04-06 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id$ - -# You may use this file with -# make -f Makefile.windows -# on Windows with MinGW instead of editing the main Makefile. - -include Makefile - -USBFLAGS = -I/usr/local/mingw/include -USBLIBS = -L/usr/local/mingw/lib -lusb -EXE_SUFFIX = .exe diff --git a/tools/vusb/examples/usbtool/Readme.txt b/tools/vusb/examples/usbtool/Readme.txt deleted file mode 100644 index 33f527c..0000000 --- a/tools/vusb/examples/usbtool/Readme.txt +++ /dev/null @@ -1,209 +0,0 @@ -This is the Readme file for usbtool, a general purpose command line utility -which can send USB requests to arbitrary devices. Usbtool is based on libusb. - - -WHAT IS USBTOOL GOOD FOR? -========================= -When you implement a communication protocol like USB, you must usually write -two programs: one on each end of the communication. For USB, this means that -you must write a firmware for the device and driver software for the host. - -Usbtool can save you the work of writing the host software, at least during -firmware development and testing. Usbtool can send control-in and -out -requests to arbitrary devices and send and receive data on interrupt- and -bulk-endpoints. - -Usbtool is not only a useful developer tool, it's also an example for using -libusb for communication with the device. - - -SYNOPSIS -======== - usbtool [options] - - -COMMANDS -======== - list - This command prints a list of devices found on all available USB busses. - Options -v, -V, -p and -P can be used to filter the list. - - control in|out - Sends a control-in or control-out request to the device. The request - parameters are: - type ........ Type of request, can be "standard", "class", "vendor" or - "reserved". The type determines which software module in - the device is responsible for answering the request: - Standard requests are answered by the driver, class - requests by the class implementation (e.g. HID, CDC) and - vendor requests by custom code. - recipient ... Recipient of the request in the device. Can be "device", - "interface", "endpoint" or "other". For standard and - class requests, the specification defines a recipient for - each request. For vendor requests, choose whatever your - code expects. - request ..... 8 bit numeric value identifying the request. - value ....... 16 bit numeric value passed to the device. - index ....... another 16 bit numeric value passed to the device. - Use options -v, -V, -p and -P to single out a particular device. Use - options -d or -D to to send data in an OUT request. Use options -n, -O - and -b to determine what to do with data received in an IN request. - - interrupt in|out - Sends or receives data on an interrupt-out resp. -in endpoint. - Use options -v, -V, -p and -P to single out a particular device. Use - options -d or -D to to send data to an OUT endpoint. Use options -n, -O - and -b to determine what to do with data received from an IN endpoint. - Use option -e to set the endpoint number, -c to choose a configuration - -i to claim a particular interface. - - bulk in|out - Same as "interrupt in" and "interrupt out", but for bulk endpoints. - - -OPTIONS -======= -Most options have already been mentioned at the commands which use them. -here is a complete list: - - -h or -? - Prints a short help. - - -v - Numeric vendor ID, can be "*" to allow any VID. Take only devices with - matching vendor ID into account. - - -p - Numeric product ID, can be "*" to allow any PID. Take only devices with - matching product ID into account. - - -V - Shell style matching pattern for vendor name. Take only devices into - account which have a vendor name that matches this pattern. - - -P - Shell style matching pattern for product name. Take only devices into - account which have a product name that matches this pattern. - - -S - Shell style matching pattern for serial number. Take only devices into - account which have a serial number that matches this pattern. - - -d - Data bytes to send to the device, comma separated list of numeric values. - E.g.: "1,2,3,4,5". - - -D - Binary data sent to the device should be taken from this file. - - -O - Write received data bytes to the given file. Format is either hex or - binary, depending on the -b flag. By default, received data is printed - to standard output. - - -b - Request binary output format for files and standard output. Default is - a hexadecimal listing. - - -n - Numeric value: Maximum number of bytes to receive. This value is passed - directly to the libusb API functions. - - -e - Numeric value: Endpoint number for interrupt and bulk commands. - - -t - Numeric value: Timeout in milliseconds for the request. This value is - passed directly to the libusb API functions. - - -c - Numeric value: Interrupt and bulk endpoints can usually only be used if - a configuration and an interface has been chosen. Use -c and -i to - specify configuration and interface values. - - -i - Numeric value: Interrupt and bulk endpoints can usually only be used if - a configuration and an interface has been chosen. Use -c and -i to - specify configuration and interface values. - - -w - Usbtool may be too verbose with warnings for some applications. Use this - option to suppress USB warnings. - - -NUMERIC VALUES -============== -All numeric values can be given in hexadecimal, decimal or octal. Hex values -are identified by their 0x or 0X prefix, octal values by a leading "0" (the -digit zero) and decimal values because they start with a non-zero digit. An -optional sign character is allowed. The special value "*" is translated to -zero and stands for "any value" in some contexts. - - -SHELL STYLE MATCHING PATTERNS -============================= -Some options take shell style matching patterns as an argument. This refers -to Unix shells and their file wildcard operations: - + "*" (asterisk character) matches any number (0 to infinite) of any - characters. - + "?" matches exactly one arbitrary character. - + A list of characters in square brackets (e.g. "[abc]") matches any of the - characters in the list. If a dash ("-") is in the list, it must be the - first or the last character. If a caret ("^") is in the list, it must - not be the first character. A closing square bracket ("]") must be the - first character in the list. A range of characters can be specified in - the way "[a-z]". This matches all characters with numeric representation - (usually ASCII) starting with "a" and ending with "z". The entire - construct matches only one character. - + A list of characters in square brackets starting with a caret ("^"), e.g. - ("[^abc]") matches any character NOT in the list. The other rules are as - above. - + "\" (backslash) followed by any character matches that following - character. This can be used to escape "*", "?", "[" and "\". - - -BUILDING USBTOOL -================ -Usbtool uses libusb on Unix and libusb-win32 on Windows. These libraries can -be obtained from http://libusb.sourceforge.net/ and -http://libusb-win32.sourceforge.net/ respectively. On Unix, a simple "make" -should compile the sources (although you may have to edit Makefile to -include or remove additional libraries). On Windows, we recommend that you -use MinGW and MSYS. See the top level Readme file for details. Edit -Makefile.windows according to your library installation paths and build with -"make -f Makefile.windows". - - -EXAMPLES -======== -To list all devices connected to your computer, do - - usbtool -w list - -To check whether our selection options single out the desired device, use eg. - - usbtool -w -P LEDControl list - -This command shows all LEDControl devices connected or prints nothing if -none is found. LEDControl is the device from the "custom-class" example. - -You can also send commands to the LEDControl device using usbtool. From -the file requests.h in custom-class/firmware, we know that the set-status -request has numeric value 1 and the get-status request is 2. See this file -for details of the protocol used. We can therefore query the status with - - usbtool -w -P LEDControl control in vendor device 2 0 0 - -This command prints 0x00 if the LED is off or 0x01 if it is on. To turn the -LED on, use - - usbtool -w -P LEDControl control out vendor device 1 1 0 - -and to turn it off, use - - usbtool -w -P LEDControl control out vendor device 1 0 0 - - ----------------------------------------------------------------------------- -(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/examples/usbtool/opendevice.c b/tools/vusb/examples/usbtool/opendevice.c deleted file mode 100644 index 137f50c..0000000 --- a/tools/vusb/examples/usbtool/opendevice.c +++ /dev/null @@ -1,203 +0,0 @@ -/* Name: opendevice.c - * Project: V-USB host-side library - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: opendevice.c 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -The functions in this module can be used to find and open a device based on -libusb or libusb-win32. -*/ - -#include -#include "opendevice.h" - -/* ------------------------------------------------------------------------- */ - -#define MATCH_SUCCESS 1 -#define MATCH_FAILED 0 -#define MATCH_ABORT -1 - -/* private interface: match text and p, return MATCH_SUCCESS, MATCH_FAILED, or MATCH_ABORT. */ -static int _shellStyleMatch(char *text, char *p) -{ -int last, matched, reverse; - - for(; *p; text++, p++){ - if(*text == 0 && *p != '*') - return MATCH_ABORT; - switch(*p){ - case '\\': - /* Literal match with following character. */ - p++; - /* FALLTHROUGH */ - default: - if(*text != *p) - return MATCH_FAILED; - continue; - case '?': - /* Match anything. */ - continue; - case '*': - while(*++p == '*') - /* Consecutive stars act just like one. */ - continue; - if(*p == 0) - /* Trailing star matches everything. */ - return MATCH_SUCCESS; - while(*text) - if((matched = _shellStyleMatch(text++, p)) != MATCH_FAILED) - return matched; - return MATCH_ABORT; - case '[': - reverse = p[1] == '^'; - if(reverse) /* Inverted character class. */ - p++; - matched = MATCH_FAILED; - if(p[1] == ']' || p[1] == '-') - if(*++p == *text) - matched = MATCH_SUCCESS; - for(last = *p; *++p && *p != ']'; last = *p) - if (*p == '-' && p[1] != ']' ? *text <= *++p && *text >= last : *text == *p) - matched = MATCH_SUCCESS; - if(matched == reverse) - return MATCH_FAILED; - continue; - } - } - return *text == 0; -} - -/* public interface for shell style matching: returns 0 if fails, 1 if matches */ -static int shellStyleMatch(char *text, char *pattern) -{ - if(pattern == NULL) /* NULL pattern is synonymous to "*" */ - return 1; - return _shellStyleMatch(text, pattern) == MATCH_SUCCESS; -} - -/* ------------------------------------------------------------------------- */ - -int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen) -{ -char buffer[256]; -int rval, i; - - if((rval = usb_get_string_simple(dev, index, buf, buflen)) >= 0) /* use libusb version if it works */ - return rval; - if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, 0x0409, buffer, sizeof(buffer), 5000)) < 0) - return rval; - if(buffer[1] != USB_DT_STRING){ - *buf = 0; - return 0; - } - if((unsigned char)buffer[0] < rval) - rval = (unsigned char)buffer[0]; - rval /= 2; - /* lossy conversion to ISO Latin1: */ - for(i=1;i buflen) /* destination buffer overflow */ - break; - buf[i-1] = buffer[2 * i]; - if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ - buf[i-1] = '?'; - } - buf[i-1] = 0; - return i-1; -} - -/* ------------------------------------------------------------------------- */ - -int usbOpenDevice(usb_dev_handle **device, int vendorID, char *vendorNamePattern, int productID, char *productNamePattern, char *serialNamePattern, FILE *printMatchingDevicesFp, FILE *warningsFp) -{ -struct usb_bus *bus; -struct usb_device *dev; -usb_dev_handle *handle = NULL; -int errorCode = USBOPEN_ERR_NOTFOUND; - - usb_find_busses(); - usb_find_devices(); - for(bus = usb_get_busses(); bus; bus = bus->next){ - for(dev = bus->devices; dev; dev = dev->next){ /* iterate over all devices on all busses */ - if((vendorID == 0 || dev->descriptor.idVendor == vendorID) - && (productID == 0 || dev->descriptor.idProduct == productID)){ - char vendor[256], product[256], serial[256]; - int len; - handle = usb_open(dev); /* we need to open the device in order to query strings */ - if(!handle){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot open VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - continue; - } - /* now check whether the names match: */ - len = vendor[0] = 0; - if(dev->descriptor.iManufacturer > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iManufacturer, vendor, sizeof(vendor)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query manufacturer for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* printf("seen device from vendor ->%s<-\n", vendor); */ - if(shellStyleMatch(vendor, vendorNamePattern)){ - len = product[0] = 0; - if(dev->descriptor.iProduct > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iProduct, product, sizeof(product)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query product for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* printf("seen product ->%s<-\n", product); */ - if(shellStyleMatch(product, productNamePattern)){ - len = serial[0] = 0; - if(dev->descriptor.iSerialNumber > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iSerialNumber, serial, sizeof(serial)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query serial for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - } - if(shellStyleMatch(serial, serialNamePattern)){ - if(printMatchingDevicesFp != NULL){ - if(serial[0] == 0){ - fprintf(printMatchingDevicesFp, "VID=0x%04x PID=0x%04x vendor=\"%s\" product=\"%s\"\n", dev->descriptor.idVendor, dev->descriptor.idProduct, vendor, product); - }else{ - fprintf(printMatchingDevicesFp, "VID=0x%04x PID=0x%04x vendor=\"%s\" product=\"%s\" serial=\"%s\"\n", dev->descriptor.idVendor, dev->descriptor.idProduct, vendor, product, serial); - } - }else{ - break; - } - } - } - } - } - } - usb_close(handle); - handle = NULL; - } - } - if(handle) /* we have found a deice */ - break; - } - if(handle != NULL){ - errorCode = 0; - *device = handle; - } - if(printMatchingDevicesFp != NULL) /* never return an error for listing only */ - errorCode = 0; - return errorCode; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/examples/usbtool/opendevice.h b/tools/vusb/examples/usbtool/opendevice.h deleted file mode 100644 index 0e04f73..0000000 --- a/tools/vusb/examples/usbtool/opendevice.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Name: opendevice.h - * Project: V-USB host-side library - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: opendevice.h 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -This module offers additional functionality for host side drivers based on -libusb or libusb-win32. It includes a function to find and open a device -based on numeric IDs and textual description. It also includes a function to -obtain textual descriptions from a device. - -To use this functionality, simply copy opendevice.c and opendevice.h into your -project and add them to your Makefile. You may modify and redistribute these -files according to the GNU General Public License (GPL) version 2 or 3. -*/ - -#ifndef __OPENDEVICE_H_INCLUDED__ -#define __OPENDEVICE_H_INCLUDED__ - -#include /* this is libusb, see http://libusb.sourceforge.net/ */ -#include - -int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen); -/* This function gets a string descriptor from the device. 'index' is the - * string descriptor index. The string is returned in ISO Latin 1 encoding in - * 'buf' and it is terminated with a 0-character. The buffer size must be - * passed in 'buflen' to prevent buffer overflows. A libusb device handle - * must be given in 'dev'. - * Returns: The length of the string (excluding the terminating 0) or - * a negative number in case of an error. If there was an error, use - * usb_strerror() to obtain the error message. - */ - -int usbOpenDevice(usb_dev_handle **device, int vendorID, char *vendorNamePattern, int productID, char *productNamePattern, char *serialNamePattern, FILE *printMatchingDevicesFp, FILE *warningsFp); -/* This function iterates over all devices on all USB busses and searches for - * a device. Matching is done first by means of Vendor- and Product-ID (passed - * in 'vendorID' and 'productID'. An ID of 0 matches any numeric ID (wildcard). - * When a device matches by its IDs, matching by names is performed. Name - * matching can be done on textual vendor name ('vendorNamePattern'), product - * name ('productNamePattern') and serial number ('serialNamePattern'). A - * device matches only if all non-null pattern match. If you don't care about - * a string, pass NULL for the pattern. Patterns are Unix shell style pattern: - * '*' stands for 0 or more characters, '?' for one single character, a list - * of characters in square brackets for a single character from the list - * (dashes are allowed to specify a range) and if the lis of characters begins - * with a caret ('^'), it matches one character which is NOT in the list. - * Other parameters to the function: If 'warningsFp' is not NULL, warning - * messages are printed to this file descriptor with fprintf(). If - * 'printMatchingDevicesFp' is not NULL, no device is opened but matching - * devices are printed to the given file descriptor with fprintf(). - * If a device is opened, the resulting USB handle is stored in '*device'. A - * pointer to a "usb_dev_handle *" type variable must be passed here. - * Returns: 0 on success, an error code (see defines below) on failure. - */ - -/* usbOpenDevice() error codes: */ -#define USBOPEN_SUCCESS 0 /* no error */ -#define USBOPEN_ERR_ACCESS 1 /* not enough permissions to open device */ -#define USBOPEN_ERR_IO 2 /* I/O error */ -#define USBOPEN_ERR_NOTFOUND 3 /* device not found */ - - -/* Obdev's free USB IDs, see USBID-License.txt for details */ - -#define USB_VID_OBDEV_SHARED 5824 /* obdev's shared vendor ID */ -#define USB_PID_OBDEV_SHARED_CUSTOM 1500 /* shared PID for custom class devices */ -#define USB_PID_OBDEV_SHARED_HID 1503 /* shared PID for HIDs except mice & keyboards */ -#define USB_PID_OBDEV_SHARED_CDCACM 1505 /* shared PID for CDC Modem devices */ -#define USB_PID_OBDEV_SHARED_MIDI 1508 /* shared PID for MIDI class devices */ - -#endif /* __OPENDEVICE_H_INCLUDED__ */ diff --git a/tools/vusb/examples/usbtool/usbtool.c b/tools/vusb/examples/usbtool/usbtool.c deleted file mode 100644 index dc7e4eb..0000000 --- a/tools/vusb/examples/usbtool/usbtool.c +++ /dev/null @@ -1,356 +0,0 @@ -/* Name: usbtool.c - * Project: V-USB examples, host side - * Author: Christian Starkjohann - * Creation Date: 2008-04-06 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbtool.c 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -This command line tool can perform various USB requests at arbitrary -USB devices. It is intended as universal host side tool for experimentation -and debugging purposes. It must be linked with libusb, a library for accessing -the USB bus from Linux, FreeBSD, Mac OS X and other Unix operating systems. -Libusb can be obtained from http://libusb.sourceforge.net/. -On Windows use libusb-win32 from http://libusb-win32.sourceforge.net/. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include /* this is libusb, see http://libusb.sourceforge.net/ */ -#include "opendevice.h" /* common code moved to separate module */ - -#define DEFAULT_USB_VID 0 /* any */ -#define DEFAULT_USB_PID 0 /* any */ - -static void usage(char *name) -{ - fprintf(stderr, "usage: %s [options] \n", name); - fprintf(stderr, - "Options are:\n" - " -h or -? (print this help and exit)\n" - " -v (defaults to 0x%x, can be '*' for any VID)\n" - " -p (defaults to 0x%x, can be '*' for any PID)\n" - " -V (shell style matching, defaults to '*')\n" - " -P (shell style matching, defaults to '*')\n" - " -S (shell style matching, defaults to '*')\n" - " -d (data byte for request, comma separated list)\n" - " -D (binary data for request taken from file)\n" - " -O (write received data bytes to file)\n" - " -b (binary output format, default is hex)\n" - " -n (maximum number of bytes to receive)\n" - " -e (specify endpoint for some commands)\n" - " -t (specify USB timeout in milliseconds)\n" - " -c (device configuration to choose)\n" - " -i (configuration interface to claim)\n" - " -w (suppress USB warnings, default is verbose)\n" - "\n" - "Commands are:\n" - " list (list all matching devices by name)\n" - " control in|out (send control request)\n" - " interrupt in|out (send or receive interrupt data)\n" - " bulk in|out (send or receive bulk data)\n" - "For valid enum values for and pass \"x\" for the value.\n" - "Objective Development's free VID/PID pairs are:\n" - " 5824/1500 for vendor class devices\n" - " 5824/1503 for HID class devices excluding mice and keyboards\n" - " 5824/1505 for CDC-ACM class devices\n" - " 5824/1508 for MIDI class devices\n" - , DEFAULT_USB_VID, DEFAULT_USB_PID - ); - - -} - -static int vendorID = DEFAULT_USB_VID; -static int productID = DEFAULT_USB_PID; -static char *vendorNamePattern = "*"; -static char *productNamePattern = "*"; -static char *serialPattern = "*"; -static char *sendBytes = NULL; -static int sendByteCount; -static char *outputFile = NULL; -static int endpoint = 0; -static int outputFormatIsBinary = 0; -static int showWarnings = 1; -static int usbTimeout = 5000; -static int usbCount = 128; -static int usbConfiguration = 1; -static int usbInterface = 0; - -static int usbDirection, usbType, usbRecipient, usbRequest, usbValue, usbIndex; /* arguments of control transfer */ - -/* ------------------------------------------------------------------------- */ - -/* ASCII to integer (number parsing) which allows hex (0x prefix), - * octal (0 prefix) and decimal (1-9 prefix) input. - */ -static int myAtoi(char *text) -{ -long l; -char *endPtr; - - if(strcmp(text, "*") == 0) - return 0; - l = strtol(text, &endPtr, 0); - if(endPtr == text){ - fprintf(stderr, "warning: can't parse numeric parameter ->%s<-, defaults to 0.\n", text); - l = 0; - }else if(*endPtr != 0){ - fprintf(stderr, "warning: numeric parameter ->%s<- only partially parsed.\n", text); - } - return l; -} - -static int parseEnum(char *text, ...) -{ -va_list vlist; -char *entries[64]; -int i, numEntries; - - va_start(vlist, text); - for(i = 0; i < 64; i++){ - entries[i] = va_arg(vlist, char *); - if(entries[i] == NULL) - break; - } - numEntries = i; - va_end(vlist); - for(i = 0; i < numEntries; i++){ - if(strcasecmp(text, entries[i]) == 0) - return i; - } - if(isdigit(*text)){ - return myAtoi(text); - } - fprintf(stderr, "Enum value \"%s\" not allowed. Allowed values are:\n", text); - for(i = 0; i < numEntries; i++){ - fprintf(stderr, " %s\n", entries[i]); - } - exit(1); -} - -/* ------------------------------------------------------------------------- */ - -#define ACTION_LIST 0 -#define ACTION_CONTROL 1 -#define ACTION_INTERRUPT 2 -#define ACTION_BULK 3 - -int main(int argc, char **argv) -{ -usb_dev_handle *handle = NULL; -int opt, len, action, argcnt; -char *myName = argv[0], *s, *rxBuffer = NULL; -FILE *fp; - - while((opt = getopt(argc, argv, "?hv:p:V:P:S:d:D:O:e:n:tbw")) != -1){ - switch(opt){ - case 'h': - case '?': /* -h or -? (print this help and exit) */ - usage(myName); - exit(1); - case 'v': /* -v (defaults to 0x%x, can be '*' for any VID) */ - vendorID = myAtoi(optarg); - break; - case 'p': /* -p (defaults to 0x%x, can be '*' for any PID) */ - productID = myAtoi(optarg); - break; - case 'V': /* -V (shell style matching, defaults to '*') */ - vendorNamePattern = optarg; - break; - case 'P': /* -P (shell style matching, defaults to '*') */ - productNamePattern = optarg; - break; - case 'S': /* -S (shell style matching, defaults to '*') */ - serialPattern = optarg; - break; - case 'd': /* -d (data bytes for requests given on command line) */ - while((s = strtok(optarg, ", ")) != NULL){ - optarg = NULL; - if(sendBytes != NULL){ - sendBytes = realloc(sendBytes, sendByteCount + 1); - }else{ - sendBytes = malloc(sendByteCount + 1); - } - sendBytes[sendByteCount++] = myAtoi(s); - } - break; - case 'D': /* -D (data bytes for request taken from file) */ - if((fp = fopen(optarg, "rb")) == NULL){ - fprintf(stderr, "error opening %s: %s\n", optarg, strerror(errno)); - exit(1); - } - fseek(fp, 0, SEEK_END); - len = ftell(fp); - fseek(fp, 0, SEEK_SET); - if(sendBytes != NULL){ - sendBytes = realloc(sendBytes, sendByteCount + len); - }else{ - sendBytes = malloc(sendByteCount + len); - } - fread(sendBytes + sendByteCount, 1, len, fp); /* would need error checking */ - sendByteCount += len; - fclose(fp); - break; - case 'O': /* -O (write received data bytes to file) */ - outputFile = optarg; - break; - case 'e': /* -e (specify endpoint for some commands) */ - endpoint = myAtoi(optarg); - break; - case 't': /* -t (specify USB timeout in milliseconds) */ - usbTimeout = myAtoi(optarg); - break; - case 'b': /* -b (binary output format, default is hex) */ - outputFormatIsBinary = 1; - break; - case 'n': /* -n (maximum number of bytes to receive) */ - usbCount = myAtoi(optarg); - break; - case 'c': /* -c (device configuration to choose) */ - usbConfiguration = myAtoi(optarg); - break; - case 'i': /* -i (configuration interface to claim) */ - usbInterface = myAtoi(optarg); - break; - case 'w': /* -w (suppress USB warnings, default is verbose) */ - showWarnings = 0; - break; - default: - fprintf(stderr, "Option -%c unknown\n", opt); - exit(1); - } - } - argc -= optind; - argv += optind; - if(argc < 1){ - usage(myName); - exit(1); - } - argcnt = 2; - if(strcasecmp(argv[0], "list") == 0){ - action = ACTION_LIST; - argcnt = 1; - }else if(strcasecmp(argv[0], "control") == 0){ - action = ACTION_CONTROL; - argcnt = 7; - }else if(strcasecmp(argv[0], "interrupt") == 0){ - action = ACTION_INTERRUPT; - }else if(strcasecmp(argv[0], "bulk") == 0){ - action = ACTION_BULK; - }else{ - fprintf(stderr, "command %s not known\n", argv[0]); - usage(myName); - exit(1); - } - if(argc < argcnt){ - fprintf(stderr, "Not enough arguments.\n"); - usage(myName); - exit(1); - } - if(argc > argcnt){ - fprintf(stderr, "Warning: only %d arguments expected, rest ignored.\n", argcnt); - } - usb_init(); - if(usbOpenDevice(&handle, vendorID, vendorNamePattern, productID, productNamePattern, serialPattern, action == ACTION_LIST ? stdout : NULL, showWarnings ? stderr : NULL) != 0){ - fprintf(stderr, "Could not find USB device with VID=0x%x PID=0x%x Vname=%s Pname=%s Serial=%s\n", vendorID, productID, vendorNamePattern, productNamePattern, serialPattern); - exit(1); - } - if(action == ACTION_LIST) - exit(0); /* we've done what we were asked to do already */ - usbDirection = parseEnum(argv[1], "out", "in", NULL); - if(usbDirection){ /* IN transfer */ - rxBuffer = malloc(usbCount); - } - if(action == ACTION_CONTROL){ - int requestType; - usbType = parseEnum(argv[2], "standard", "class", "vendor", "reserved", NULL); - usbRecipient = parseEnum(argv[3], "device", "interface", "endpoint", "other", NULL); - usbRequest = myAtoi(argv[4]); - usbValue = myAtoi(argv[5]); - usbIndex = myAtoi(argv[6]); - requestType = ((usbDirection & 1) << 7) | ((usbType & 3) << 5) | (usbRecipient & 0x1f); - if(usbDirection){ /* IN transfer */ - len = usb_control_msg(handle, requestType, usbRequest, usbValue, usbIndex, rxBuffer, usbCount, usbTimeout); - }else{ /* OUT transfer */ - len = usb_control_msg(handle, requestType, usbRequest, usbValue, usbIndex, sendBytes, sendByteCount, usbTimeout); - } - }else{ /* must be ACTION_INTERRUPT or ACTION_BULK */ - int retries = 1; - if(usb_set_configuration(handle, usbConfiguration) && showWarnings){ - fprintf(stderr, "Warning: could not set configuration: %s\n", usb_strerror()); - } - /* now try to claim the interface and detach the kernel HID driver on - * linux and other operating systems which support the call. - */ - while((len = usb_claim_interface(handle, usbInterface)) != 0 && retries-- > 0){ -#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP - if(usb_detach_kernel_driver_np(handle, 0) < 0 && showWarnings){ - fprintf(stderr, "Warning: could not detach kernel driver: %s\n", usb_strerror()); - } -#endif - } - if(len != 0 && showWarnings) - fprintf(stderr, "Warning: could not claim interface: %s\n", usb_strerror()); - if(action == ACTION_INTERRUPT){ - if(usbDirection){ /* IN transfer */ - len = usb_interrupt_read(handle, endpoint, rxBuffer, usbCount, usbTimeout); - }else{ - len = usb_interrupt_write(handle, endpoint, sendBytes, sendByteCount, usbTimeout); - } - }else{ - if(usbDirection){ /* IN transfer */ - len = usb_bulk_read(handle, endpoint, rxBuffer, usbCount, usbTimeout); - }else{ - len = usb_bulk_write(handle, endpoint, sendBytes, sendByteCount, usbTimeout); - } - } - } - if(len < 0){ - fprintf(stderr, "USB error: %s\n", usb_strerror()); - exit(1); - } - if(usbDirection == 0) /* OUT */ - printf("%d bytes sent.\n", len); - if(rxBuffer != NULL){ - FILE *fp = stdout; - if(outputFile != NULL){ - fp = fopen(outputFile, outputFormatIsBinary ? "wb" : "w"); - if(fp == NULL){ - fprintf(stderr, "Error writing \"%s\": %s\n", outputFile, strerror(errno)); - exit(1); - } - } - if(outputFormatIsBinary){ - fwrite(rxBuffer, 1, len, fp); - }else{ - int i; - for(i = 0; i < len; i++){ - if(i != 0){ - if(i % 16 == 0){ - fprintf(fp, "\n"); - }else{ - fprintf(fp, " "); - } - } - fprintf(fp, "0x%02x", rxBuffer[i] & 0xff); - } - if(i != 0) - fprintf(fp, "\n"); - } - } - usb_close(handle); - if(rxBuffer != NULL) - free(rxBuffer); - return 0; -} diff --git a/tools/vusb/libs-device/Readme.txt b/tools/vusb/libs-device/Readme.txt deleted file mode 100644 index 76518dc..0000000 --- a/tools/vusb/libs-device/Readme.txt +++ /dev/null @@ -1,22 +0,0 @@ -This is the Readme file for the libs-device directory. This directory contains -code snippets which may be useful for USB device firmware. - - -WHAT IS INCLUDED IN THIS DIRECTORY? -=================================== - -osccal.c and osccal.h - This module contains a function which calibrates the AVR's built-in RC - oscillator based on the USB frame clock. See osccal.h for a documentation - of the API. - -osctune.h - This header file contains a code snippet for usbconfig.h. With this code, - you can keep the AVR's internal RC oscillator in sync with the USB frame - clock. This is a continuous synchronization, not a single calibration at - USB reset as with osccal.c above. Please note that this code works only - if D- is wired to the interrupt, not D+. - ----------------------------------------------------------------------------- -(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/libs-device/osccal.c b/tools/vusb/libs-device/osccal.c deleted file mode 100644 index 09e2936..0000000 --- a/tools/vusb/libs-device/osccal.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Name: osccal.c - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: osccal.c 692 2008-11-07 15:07:40Z cs $ - */ - -#include - -/* ------------------------------------------------------------------------- */ -/* ------------------------ Oscillator Calibration ------------------------- */ -/* ------------------------------------------------------------------------- */ - -/* Calibrate the RC oscillator. Our timing reference is the Start Of Frame - * signal (a single SE0 bit) repeating every millisecond immediately after - * a USB RESET. We first do a binary search for the OSCCAL value and then - * optimize this value with a neighboorhod search. - */ -void calibrateOscillator(void) -{ -uchar step = 128; -uchar trialValue = 0, optimumValue; -int x, optimumDev, targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5); - - /* do a binary search: */ - do{ - OSCCAL = trialValue + step; - x = usbMeasureFrameLength(); /* proportional to current real frequency */ - if(x < targetValue) /* frequency still too low */ - trialValue += step; - step >>= 1; - }while(step > 0); - /* We have a precision of +/- 1 for optimum OSCCAL here */ - /* now do a neighborhood search for optimum value */ - optimumValue = trialValue; - optimumDev = x; /* this is certainly far away from optimum */ - for(OSCCAL = trialValue - 1; OSCCAL <= trialValue + 1; OSCCAL++){ - x = usbMeasureFrameLength() - targetValue; - if(x < 0) - x = -x; - if(x < optimumDev){ - optimumDev = x; - optimumValue = OSCCAL; - } - } - OSCCAL = optimumValue; -} -/* -Note: This calibration algorithm may try OSCCAL values of up to 192 even if -the optimum value is far below 192. It may therefore exceed the allowed clock -frequency of the CPU in low voltage designs! -You may replace this search algorithm with any other algorithm you like if -you have additional constraints such as a maximum CPU clock. -For version 5.x RC oscillators (those with a split range of 2x128 steps, e.g. -ATTiny25, ATTiny45, ATTiny85), it may be useful to search for the optimum in -both regions. -*/ diff --git a/tools/vusb/libs-device/osccal.h b/tools/vusb/libs-device/osccal.h deleted file mode 100644 index 1a5872a..0000000 --- a/tools/vusb/libs-device/osccal.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Name: osccal.h - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: osccal.h 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -This module contains a function which calibrates the AVR's internal RC -oscillator so that the CPU runs at F_CPU (F_CPU is a macro which must be -defined when the module is compiled, best passed in the compiler command -line). The time reference is the USB frame clock of 1 kHz available -immediately after a USB RESET condition. Timing is done by counting CPU -cycles, so all interrupts must be disabled while the calibration runs. For -low level timing measurements, usbMeasureFrameLength() is called. This -function must be enabled in usbconfig.h by defining -USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1. It is also recommended to call -calibrateOscillator() from the reset hook in usbconfig.h: - -#ifndef __ASSEMBLER__ -#include /* for sei() */ -extern void calibrateOscillator(void); -#endif -#define USB_RESET_HOOK(resetStarts) if(!resetStarts){cli(); calibrateOscillator(); sei();} - -This routine is an alternative to the continuous synchronization described -in osctune.h. - -Algorithm used: -calibrateOscillator() first does a binary search in the OSCCAL register for -the best matching oscillator frequency. Then it does a next neighbor search -to find the value with the lowest clock rate deviation. It is guaranteed to -find the best match among neighboring values, but for version 5 oscillators -(which have a discontinuous relationship between OSCCAL and frequency) a -better match might be available in another OSCCAL region. - -Limitations: -This calibration algorithm may try OSCCAL values of up to 192 even if the -optimum value is far below 192. It may therefore exceed the allowed clock -frequency of the CPU in low voltage designs! -Precision depends on the OSCCAL vs. frequency dependency of the oscillator. -Typical precision for an ATMega168 (derived from the OSCCAL vs. F_RC diagram -in the data sheet) should be in the range of 0.4%. Only the 12.8 MHz and -16.5 MHz versions of V-USB (with built-in receiver PLL) can tolerate this -deviation! All other frequency modules require at least 0.2% precision. -*/ - -#ifndef __OSCCAL_H_INCLUDED__ -#define __OSCCAL_H_INCLUDED__ - -void calibrateOscillator(void); -/* This function calibrates the RC oscillator so that the CPU runs at F_CPU. - * It MUST be called immediately after the end of a USB RESET condition! - * Disable all interrupts during the call! - * It is recommended that you store the resulting value in EEPROM so that a - * good guess value is available after the next reset. - */ - - -#endif /* __OSCCAL_H_INCLUDED__ */ diff --git a/tools/vusb/libs-device/osctune.h b/tools/vusb/libs-device/osctune.h deleted file mode 100644 index c751648..0000000 --- a/tools/vusb/libs-device/osctune.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Name: osctune.h - * Author: Christian Starkjohann - * Creation Date: 2008-10-18 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: osctune.h 692 2008-11-07 15:07:40Z cs $ - */ - -/* -General Description: -This file is declared as C-header file although it is mostly documentation -how the RC oscillator can be kept in sync to the USB frame rate. The code -shown here must be added to usbconfig.h or this header file is included from -there. This code works only if D- is wired to the interrupt, not D+!!! - -This is an alternative to the osccal routine in osccal.c. It has the advantage -that the synchronization is done continuously and that it has more compact -code size. The disadvantages are slow synchronization (it may take a while -until the driver works), that messages immediately after the SOF pulse may be -lost (and need to be retried by the host) and that the interrupt is on D- -contrary to most examples. - -You may want to store a good calibration value in EEPROM for the next startup. -You know that the calibration value is good when the first USB message is -received. Do not store the value on every received message because the EEPROM -has a limited endurance. - -Notes: -(*) You must declare the global character variable "lastTimer0Value" in your -main code. - -(*) Timer 0 must be free running (not written by your code) and the prescaling -must be consistent with the TIMER0_PRESCALING define. - -(*) Good values for Timer 0 prescaling depend on how precise the clock must -be tuned and how far away from the default clock rate the target clock is. -For precise tuning, choose a low prescaler factor, for a broad range of tuning -choose a high one. A prescaler factor of 64 is good for the entire OSCCAL -range and allows a precision of better than +/-1%. A prescaler factor of 8 -allows tuning to slightly more than +/-6% of the default frequency and is -more precise than one step of OSCCAL. It is therefore not suitable to tune an -8 MHz oscillator to 12.5 MHz. - -Thanks to Henrik Haftmann for the idea to this routine! -*/ - -#define TIMER0_PRESCALING 64 /* must match the configuration for TIMER0 in main */ -#define TOLERATED_DEVIATION_PPT 5 /* max clock deviation before we tune in 1/10 % */ -/* derived constants: */ -#define EXPECTED_TIMER0_INCREMENT ((F_CPU / (1000 * TIMER0_PRESCALING)) & 0xff) -#define TOLERATED_DEVIATION (TOLERATED_DEVIATION_PPT * F_CPU / (1000000 * TIMER0_PRESCALING)) - -#ifdef __ASSEMBLER__ -macro tuneOsccal - push YH ;[0] - in YL, TCNT0 ;[2] - lds YH, lastTimer0Value ;[3] - sts lastTimer0Value, YL ;[5] - sub YL, YH ;[7] time passed since last frame - subi YL, EXPECTED_TIMER0_INCREMENT ;[8] -#if OSCCAL > 0x3f /* outside I/O addressable range */ - lds YH, OSCCAL ;[6] -#else - in YH, OSCCAL ;[6] assembler modle uses __SFR_OFFSET == 0 -#endif - cpi YL, TOLERATED_DEVIATION + 1 ;[10] - brmi notTooHigh ;[11] - subi YH, 1 ;[12] clock rate was too high -; brcs tuningOverflow ; optionally check for overflow - rjmp osctuneDone ;[13] -notTooHigh: - cpi YL, -TOLERATED_DEVIATION ;[13] - brpl osctuneDone ;[14] not too low - inc YH ;[15] clock rate was too low -; breq tuningOverflow ; optionally check for overflow -osctuneDone: -#if OSCCAL > 0x3f /* outside I/O addressable range */ - sts OSCCAL, YH ;[12-13] store tuned value -#else - out OSCCAL, YH ;[12-13] store tuned value -#endif -tuningOverflow: - pop YH ;[17] - endm ;[19] max number of cycles -#endif - -#define USB_SOF_HOOK tuneOsccal diff --git a/tools/vusb/libs-host/Readme.txt b/tools/vusb/libs-host/Readme.txt deleted file mode 100644 index 5117d18..0000000 --- a/tools/vusb/libs-host/Readme.txt +++ /dev/null @@ -1,26 +0,0 @@ -This is the Readme file for the libs-host directory. This directory contains -code snippets which may be useful for host side USB software. - - -WHAT IS INCLUDED IN THIS DIRECTORY? -=================================== - -opendevice.c and opendevice.h - This module contains a function to find and open a device given its - numeric IDs (VID, PID), names (vendor name and product name) and serial - number. It is based on libusb/libusb-win32 and returns a libusb device - handle. See opendevice.h for an API documentation. - -hiddata.c and hiddata.h - This module contains functions for data transfer over HID feature reports. - It is based on libusb on Unix and native Windows functions on Windows. No - driver DLL is needed on Windows. See hiddata.h for an API documentation. - -hidsdi.h - This DDK header file is missing in the free MinGW version of the Windows - DDK. Use this version if you get an "include file not found" error. - - ----------------------------------------------------------------------------- -(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/libs-host/hiddata.c b/tools/vusb/libs-host/hiddata.c deleted file mode 100644 index 93795e4..0000000 --- a/tools/vusb/libs-host/hiddata.c +++ /dev/null @@ -1,324 +0,0 @@ -/* Name: hiddata.c - * Author: Christian Starkjohann - * Creation Date: 2008-04-11 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: hiddata.c 743 2009-04-15 15:00:49Z cs $ - */ - -#include -#include "hiddata.h" - -/* ######################################################################## */ -#if defined(WIN32) /* ##################################################### */ -/* ######################################################################## */ - -#include -#include -#include "hidsdi.h" -#include - -#ifdef DEBUG -#define DEBUG_PRINT(arg) printf arg -#else -#define DEBUG_PRINT(arg) -#endif - -/* ------------------------------------------------------------------------ */ - -static void convertUniToAscii(char *buffer) -{ -unsigned short *uni = (void *)buffer; -char *ascii = buffer; - - while(*uni != 0){ - if(*uni >= 256){ - *ascii++ = '?'; - }else{ - *ascii++ = *uni++; - } - } - *ascii++ = 0; -} - -int usbhidOpenDevice(usbDevice_t **device, int vendor, char *vendorName, int product, char *productName, int usesReportIDs) -{ -GUID hidGuid; /* GUID for HID driver */ -HDEVINFO deviceInfoList; -SP_DEVICE_INTERFACE_DATA deviceInfo; -SP_DEVICE_INTERFACE_DETAIL_DATA *deviceDetails = NULL; -DWORD size; -int i, openFlag = 0; /* may be FILE_FLAG_OVERLAPPED */ -int errorCode = USBOPEN_ERR_NOTFOUND; -HANDLE handle = INVALID_HANDLE_VALUE; -HIDD_ATTRIBUTES deviceAttributes; - - HidD_GetHidGuid(&hidGuid); - deviceInfoList = SetupDiGetClassDevs(&hidGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE); - deviceInfo.cbSize = sizeof(deviceInfo); - for(i=0;;i++){ - if(handle != INVALID_HANDLE_VALUE){ - CloseHandle(handle); - handle = INVALID_HANDLE_VALUE; - } - if(!SetupDiEnumDeviceInterfaces(deviceInfoList, 0, &hidGuid, i, &deviceInfo)) - break; /* no more entries */ - /* first do a dummy call just to determine the actual size required */ - SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, NULL, 0, &size, NULL); - if(deviceDetails != NULL) - free(deviceDetails); - deviceDetails = malloc(size); - deviceDetails->cbSize = sizeof(*deviceDetails); - /* this call is for real: */ - SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, deviceDetails, size, &size, NULL); - DEBUG_PRINT(("checking HID path \"%s\"\n", deviceDetails->DevicePath)); -#if 0 - /* If we want to access a mouse our keyboard, we can only use feature - * requests as the device is locked by Windows. It must be opened - * with ACCESS_TYPE_NONE. - */ - handle = CreateFile(deviceDetails->DevicePath, ACCESS_TYPE_NONE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, openFlag, NULL); -#endif - /* attempt opening for R/W -- we don't care about devices which can't be accessed */ - handle = CreateFile(deviceDetails->DevicePath, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, openFlag, NULL); - if(handle == INVALID_HANDLE_VALUE){ - DEBUG_PRINT(("opening failed: %d\n", (int)GetLastError())); - /* errorCode = USBOPEN_ERR_ACCESS; opening will always fail for mouse -- ignore */ - continue; - } - deviceAttributes.Size = sizeof(deviceAttributes); - HidD_GetAttributes(handle, &deviceAttributes); - DEBUG_PRINT(("device attributes: vid=%d pid=%d\n", deviceAttributes.VendorID, deviceAttributes.ProductID)); - if(deviceAttributes.VendorID != vendor || deviceAttributes.ProductID != product) - continue; /* ignore this device */ - errorCode = USBOPEN_ERR_NOTFOUND; - if(vendorName != NULL && productName != NULL){ - char buffer[512]; - if(!HidD_GetManufacturerString(handle, buffer, sizeof(buffer))){ - DEBUG_PRINT(("error obtaining vendor name\n")); - errorCode = USBOPEN_ERR_IO; - continue; - } - convertUniToAscii(buffer); - DEBUG_PRINT(("vendorName = \"%s\"\n", buffer)); - if(strcmp(vendorName, buffer) != 0) - continue; - if(!HidD_GetProductString(handle, buffer, sizeof(buffer))){ - DEBUG_PRINT(("error obtaining product name\n")); - errorCode = USBOPEN_ERR_IO; - continue; - } - convertUniToAscii(buffer); - DEBUG_PRINT(("productName = \"%s\"\n", buffer)); - if(strcmp(productName, buffer) != 0) - continue; - } - break; /* we have found the device we are looking for! */ - } - SetupDiDestroyDeviceInfoList(deviceInfoList); - if(deviceDetails != NULL) - free(deviceDetails); - if(handle != INVALID_HANDLE_VALUE){ - *device = (usbDevice_t *)handle; - errorCode = 0; - } - return errorCode; -} - -/* ------------------------------------------------------------------------ */ - -void usbhidCloseDevice(usbDevice_t *device) -{ - CloseHandle((HANDLE)device); -} - -/* ------------------------------------------------------------------------ */ - -int usbhidSetReport(usbDevice_t *device, char *buffer, int len) -{ -BOOLEAN rval; - - rval = HidD_SetFeature((HANDLE)device, buffer, len); - return rval == 0 ? USBOPEN_ERR_IO : 0; -} - -/* ------------------------------------------------------------------------ */ - -int usbhidGetReport(usbDevice_t *device, int reportNumber, char *buffer, int *len) -{ -BOOLEAN rval = 0; - - buffer[0] = reportNumber; - rval = HidD_GetFeature((HANDLE)device, buffer, *len); - return rval == 0 ? USBOPEN_ERR_IO : 0; -} - -/* ------------------------------------------------------------------------ */ - -/* ######################################################################## */ -#else /* defined WIN32 #################################################### */ -/* ######################################################################## */ - -#include -#include - -#define usbDevice usb_dev_handle /* use libusb's device structure */ - -/* ------------------------------------------------------------------------- */ - -#define USBRQ_HID_GET_REPORT 0x01 -#define USBRQ_HID_SET_REPORT 0x09 - -#define USB_HID_REPORT_TYPE_FEATURE 3 - - -static int usesReportIDs; - -/* ------------------------------------------------------------------------- */ - -static int usbhidGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen) -{ -char buffer[256]; -int rval, i; - - if((rval = usb_get_string_simple(dev, index, buf, buflen)) >= 0) /* use libusb version if it works */ - return rval; - if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, 0x0409, buffer, sizeof(buffer), 5000)) < 0) - return rval; - if(buffer[1] != USB_DT_STRING){ - *buf = 0; - return 0; - } - if((unsigned char)buffer[0] < rval) - rval = (unsigned char)buffer[0]; - rval /= 2; - /* lossy conversion to ISO Latin1: */ - for(i=1;i buflen) /* destination buffer overflow */ - break; - buf[i-1] = buffer[2 * i]; - if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ - buf[i-1] = '?'; - } - buf[i-1] = 0; - return i-1; -} - -int usbhidOpenDevice(usbDevice_t **device, int vendor, char *vendorName, int product, char *productName, int _usesReportIDs) -{ -struct usb_bus *bus; -struct usb_device *dev; -usb_dev_handle *handle = NULL; -int errorCode = USBOPEN_ERR_NOTFOUND; -static int didUsbInit = 0; - - if(!didUsbInit){ - usb_init(); - didUsbInit = 1; - } - usb_find_busses(); - usb_find_devices(); - for(bus=usb_get_busses(); bus; bus=bus->next){ - for(dev=bus->devices; dev; dev=dev->next){ - if(dev->descriptor.idVendor == vendor && dev->descriptor.idProduct == product){ - char string[256]; - int len; - handle = usb_open(dev); /* we need to open the device in order to query strings */ - if(!handle){ - errorCode = USBOPEN_ERR_ACCESS; - fprintf(stderr, "Warning: cannot open USB device: %s\n", usb_strerror()); - continue; - } - if(vendorName == NULL && productName == NULL){ /* name does not matter */ - break; - } - /* now check whether the names match: */ - len = usbhidGetStringAscii(handle, dev->descriptor.iManufacturer, string, sizeof(string)); - if(len < 0){ - errorCode = USBOPEN_ERR_IO; - fprintf(stderr, "Warning: cannot query manufacturer for device: %s\n", usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* fprintf(stderr, "seen device from vendor ->%s<-\n", string); */ - if(strcmp(string, vendorName) == 0){ - len = usbhidGetStringAscii(handle, dev->descriptor.iProduct, string, sizeof(string)); - if(len < 0){ - errorCode = USBOPEN_ERR_IO; - fprintf(stderr, "Warning: cannot query product for device: %s\n", usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* fprintf(stderr, "seen product ->%s<-\n", string); */ - if(strcmp(string, productName) == 0) - break; - } - } - } - usb_close(handle); - handle = NULL; - } - } - if(handle) - break; - } - if(handle != NULL){ - errorCode = 0; - *device = (void *)handle; - usesReportIDs = _usesReportIDs; - } - return errorCode; -} - -/* ------------------------------------------------------------------------- */ - -void usbhidCloseDevice(usbDevice_t *device) -{ - if(device != NULL) - usb_close((void *)device); -} - -/* ------------------------------------------------------------------------- */ - -int usbhidSetReport(usbDevice_t *device, char *buffer, int len) -{ -int bytesSent; - - if(!usesReportIDs){ - buffer++; /* skip dummy report ID */ - len--; - } - bytesSent = usb_control_msg((void *)device, USB_TYPE_CLASS | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, USBRQ_HID_SET_REPORT, USB_HID_REPORT_TYPE_FEATURE << 8 | (buffer[0] & 0xff), 0, buffer, len, 5000); - if(bytesSent != len){ - if(bytesSent < 0) - fprintf(stderr, "Error sending message: %s\n", usb_strerror()); - return USBOPEN_ERR_IO; - } - return 0; -} - -/* ------------------------------------------------------------------------- */ - -int usbhidGetReport(usbDevice_t *device, int reportNumber, char *buffer, int *len) -{ -int bytesReceived, maxLen = *len; - - if(!usesReportIDs){ - buffer++; /* make room for dummy report ID */ - maxLen--; - } - bytesReceived = usb_control_msg((void *)device, USB_TYPE_CLASS | USB_RECIP_DEVICE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT, USB_HID_REPORT_TYPE_FEATURE << 8 | reportNumber, 0, buffer, maxLen, 5000); - if(bytesReceived < 0){ - fprintf(stderr, "Error sending message: %s\n", usb_strerror()); - return USBOPEN_ERR_IO; - } - *len = bytesReceived; - if(!usesReportIDs){ - buffer[-1] = reportNumber; /* add dummy report ID */ - (*len)++; - } - return 0; -} - -/* ######################################################################## */ -#endif /* defined WIN32 ################################################### */ -/* ######################################################################## */ diff --git a/tools/vusb/libs-host/hiddata.h b/tools/vusb/libs-host/hiddata.h deleted file mode 100644 index fce0743..0000000 --- a/tools/vusb/libs-host/hiddata.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Name: hiddata.h - * Author: Christian Starkjohann - * Creation Date: 2008-04-11 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: hiddata.h 692 2008-11-07 15:07:40Z cs $ - */ - -#ifndef __HIDDATA_H_INCLUDED__ -#define __HIDDATA_H_INCLUDED__ - -/* -General Description: -This module implements an abstraction layer for data transfer over HID feature -requests. The implementation uses native Windows functions on Windows so that -no driver installation is required and libusb on Unix. You must link the -appropriate libraries in either case: "-lhid -lusb -lsetupapi" on Windows and -`libusb-config --libs` on Unix. -*/ - -/* ------------------------------------------------------------------------ */ - -#define USBOPEN_SUCCESS 0 /* no error */ -#define USBOPEN_ERR_ACCESS 1 /* not enough permissions to open device */ -#define USBOPEN_ERR_IO 2 /* I/O error */ -#define USBOPEN_ERR_NOTFOUND 3 /* device not found */ - -/* ------------------------------------------------------------------------ */ - -typedef struct usbDevice usbDevice_t; -/* Opaque data type representing the USB device. This can be a Windows handle - * or a libusb handle, depending on the backend implementation. - */ - -/* ------------------------------------------------------------------------ */ - -int usbhidOpenDevice(usbDevice_t **device, int vendorID, char *vendorName, int productID, char *productName, int usesReportIDs); -/* This function opens a USB device. 'vendorID' and 'productID' are the numeric - * Vendor-ID and Product-ID of the device we want to open. If 'vendorName' and - * 'productName' are both not NULL, only devices with matching manufacturer- - * and product name strings are accepted. If the device uses report IDs, - * 'usesReportIDs' must be set to a non-zero value. - * Returns: If a matching device has been found, USBOPEN_SUCCESS is returned - * and '*device' is set to an opaque pointer representing the device. The - * device must be closed with usbhidCloseDevice(). If the device has not been - * found or opening failed, an error code is returned. - */ -void usbhidCloseDevice(usbDevice_t *device); -/* Every device opened with usbhidOpenDevice() must be closed with this function. - */ -int usbhidSetReport(usbDevice_t *device, char *buffer, int len); -/* This function sends a feature report to the device. The report ID must be - * in the first byte of buffer and the length 'len' of the report is specified - * including this report ID. If no report IDs are used, buffer[0] must be set - * to 0 (dummy report ID). - * Returns: 0 on success, an error code otherwise. - */ -int usbhidGetReport(usbDevice_t *device, int reportID, char *buffer, int *len); -/* This function obtains a feature report from the device. The requested - * report-ID is passed in 'reportID'. The caller must pass a buffer of the size - * of the expected report in 'buffer' and initialize the variable pointed to by - * 'len' to the total size of this buffer. Upon successful return, the report - * (prefixed with the report-ID) is in 'buffer' and the actual length of the - * report is returned in '*len'. - * Returns: 0 on success, an error code otherwise. - */ - -/* ------------------------------------------------------------------------ */ - -#endif /* __HIDDATA_H_INCLUDED__ */ diff --git a/tools/vusb/libs-host/hidsdi.h b/tools/vusb/libs-host/hidsdi.h deleted file mode 100644 index a549ab1..0000000 --- a/tools/vusb/libs-host/hidsdi.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Name: hidsdi.h - * Author: Christian Starkjohann - * Creation Date: 2006-02-02 - * Tabsize: 4 - * Copyright: (c) 2006-2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: hidsdi.h 692 2008-11-07 15:07:40Z cs $ - */ - -/* -General Description -This file is a replacement for hidsdi.h from the Windows DDK. It defines some -of the types and function prototypes of this header for our project. If you -have the Windows DDK version of this file or a version shipped with MinGW, use -that instead. -*/ - -#ifndef _HIDSDI_H -#define _HIDSDI_H - -#include - -#include -#include - -typedef struct{ - ULONG Size; - USHORT VendorID; - USHORT ProductID; - USHORT VersionNumber; -}HIDD_ATTRIBUTES; - -void __stdcall HidD_GetHidGuid(OUT LPGUID hidGuid); - -BOOLEAN __stdcall HidD_GetAttributes(IN HANDLE device, OUT HIDD_ATTRIBUTES *attributes); - -BOOLEAN __stdcall HidD_GetManufacturerString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen); -BOOLEAN __stdcall HidD_GetProductString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen); -BOOLEAN __stdcall HidD_GetSerialNumberString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen); - -BOOLEAN __stdcall HidD_GetFeature(IN HANDLE device, OUT void *reportBuffer, IN ULONG bufferLen); -BOOLEAN __stdcall HidD_SetFeature(IN HANDLE device, IN void *reportBuffer, IN ULONG bufferLen); - -BOOLEAN __stdcall HidD_GetNumInputBuffers(IN HANDLE device, OUT ULONG *numBuffers); -BOOLEAN __stdcall HidD_SetNumInputBuffers(IN HANDLE device, OUT ULONG numBuffers); - -#include - -#endif diff --git a/tools/vusb/libs-host/opendevice.c b/tools/vusb/libs-host/opendevice.c deleted file mode 100644 index 137f50c..0000000 --- a/tools/vusb/libs-host/opendevice.c +++ /dev/null @@ -1,203 +0,0 @@ -/* Name: opendevice.c - * Project: V-USB host-side library - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: opendevice.c 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -The functions in this module can be used to find and open a device based on -libusb or libusb-win32. -*/ - -#include -#include "opendevice.h" - -/* ------------------------------------------------------------------------- */ - -#define MATCH_SUCCESS 1 -#define MATCH_FAILED 0 -#define MATCH_ABORT -1 - -/* private interface: match text and p, return MATCH_SUCCESS, MATCH_FAILED, or MATCH_ABORT. */ -static int _shellStyleMatch(char *text, char *p) -{ -int last, matched, reverse; - - for(; *p; text++, p++){ - if(*text == 0 && *p != '*') - return MATCH_ABORT; - switch(*p){ - case '\\': - /* Literal match with following character. */ - p++; - /* FALLTHROUGH */ - default: - if(*text != *p) - return MATCH_FAILED; - continue; - case '?': - /* Match anything. */ - continue; - case '*': - while(*++p == '*') - /* Consecutive stars act just like one. */ - continue; - if(*p == 0) - /* Trailing star matches everything. */ - return MATCH_SUCCESS; - while(*text) - if((matched = _shellStyleMatch(text++, p)) != MATCH_FAILED) - return matched; - return MATCH_ABORT; - case '[': - reverse = p[1] == '^'; - if(reverse) /* Inverted character class. */ - p++; - matched = MATCH_FAILED; - if(p[1] == ']' || p[1] == '-') - if(*++p == *text) - matched = MATCH_SUCCESS; - for(last = *p; *++p && *p != ']'; last = *p) - if (*p == '-' && p[1] != ']' ? *text <= *++p && *text >= last : *text == *p) - matched = MATCH_SUCCESS; - if(matched == reverse) - return MATCH_FAILED; - continue; - } - } - return *text == 0; -} - -/* public interface for shell style matching: returns 0 if fails, 1 if matches */ -static int shellStyleMatch(char *text, char *pattern) -{ - if(pattern == NULL) /* NULL pattern is synonymous to "*" */ - return 1; - return _shellStyleMatch(text, pattern) == MATCH_SUCCESS; -} - -/* ------------------------------------------------------------------------- */ - -int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen) -{ -char buffer[256]; -int rval, i; - - if((rval = usb_get_string_simple(dev, index, buf, buflen)) >= 0) /* use libusb version if it works */ - return rval; - if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, 0x0409, buffer, sizeof(buffer), 5000)) < 0) - return rval; - if(buffer[1] != USB_DT_STRING){ - *buf = 0; - return 0; - } - if((unsigned char)buffer[0] < rval) - rval = (unsigned char)buffer[0]; - rval /= 2; - /* lossy conversion to ISO Latin1: */ - for(i=1;i buflen) /* destination buffer overflow */ - break; - buf[i-1] = buffer[2 * i]; - if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ - buf[i-1] = '?'; - } - buf[i-1] = 0; - return i-1; -} - -/* ------------------------------------------------------------------------- */ - -int usbOpenDevice(usb_dev_handle **device, int vendorID, char *vendorNamePattern, int productID, char *productNamePattern, char *serialNamePattern, FILE *printMatchingDevicesFp, FILE *warningsFp) -{ -struct usb_bus *bus; -struct usb_device *dev; -usb_dev_handle *handle = NULL; -int errorCode = USBOPEN_ERR_NOTFOUND; - - usb_find_busses(); - usb_find_devices(); - for(bus = usb_get_busses(); bus; bus = bus->next){ - for(dev = bus->devices; dev; dev = dev->next){ /* iterate over all devices on all busses */ - if((vendorID == 0 || dev->descriptor.idVendor == vendorID) - && (productID == 0 || dev->descriptor.idProduct == productID)){ - char vendor[256], product[256], serial[256]; - int len; - handle = usb_open(dev); /* we need to open the device in order to query strings */ - if(!handle){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot open VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - continue; - } - /* now check whether the names match: */ - len = vendor[0] = 0; - if(dev->descriptor.iManufacturer > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iManufacturer, vendor, sizeof(vendor)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query manufacturer for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* printf("seen device from vendor ->%s<-\n", vendor); */ - if(shellStyleMatch(vendor, vendorNamePattern)){ - len = product[0] = 0; - if(dev->descriptor.iProduct > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iProduct, product, sizeof(product)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query product for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - }else{ - errorCode = USBOPEN_ERR_NOTFOUND; - /* printf("seen product ->%s<-\n", product); */ - if(shellStyleMatch(product, productNamePattern)){ - len = serial[0] = 0; - if(dev->descriptor.iSerialNumber > 0){ - len = usbGetStringAscii(handle, dev->descriptor.iSerialNumber, serial, sizeof(serial)); - } - if(len < 0){ - errorCode = USBOPEN_ERR_ACCESS; - if(warningsFp != NULL) - fprintf(warningsFp, "Warning: cannot query serial for VID=0x%04x PID=0x%04x: %s\n", dev->descriptor.idVendor, dev->descriptor.idProduct, usb_strerror()); - } - if(shellStyleMatch(serial, serialNamePattern)){ - if(printMatchingDevicesFp != NULL){ - if(serial[0] == 0){ - fprintf(printMatchingDevicesFp, "VID=0x%04x PID=0x%04x vendor=\"%s\" product=\"%s\"\n", dev->descriptor.idVendor, dev->descriptor.idProduct, vendor, product); - }else{ - fprintf(printMatchingDevicesFp, "VID=0x%04x PID=0x%04x vendor=\"%s\" product=\"%s\" serial=\"%s\"\n", dev->descriptor.idVendor, dev->descriptor.idProduct, vendor, product, serial); - } - }else{ - break; - } - } - } - } - } - } - usb_close(handle); - handle = NULL; - } - } - if(handle) /* we have found a deice */ - break; - } - if(handle != NULL){ - errorCode = 0; - *device = handle; - } - if(printMatchingDevicesFp != NULL) /* never return an error for listing only */ - errorCode = 0; - return errorCode; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/libs-host/opendevice.h b/tools/vusb/libs-host/opendevice.h deleted file mode 100644 index 0e04f73..0000000 --- a/tools/vusb/libs-host/opendevice.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Name: opendevice.h - * Project: V-USB host-side library - * Author: Christian Starkjohann - * Creation Date: 2008-04-10 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: opendevice.h 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -This module offers additional functionality for host side drivers based on -libusb or libusb-win32. It includes a function to find and open a device -based on numeric IDs and textual description. It also includes a function to -obtain textual descriptions from a device. - -To use this functionality, simply copy opendevice.c and opendevice.h into your -project and add them to your Makefile. You may modify and redistribute these -files according to the GNU General Public License (GPL) version 2 or 3. -*/ - -#ifndef __OPENDEVICE_H_INCLUDED__ -#define __OPENDEVICE_H_INCLUDED__ - -#include /* this is libusb, see http://libusb.sourceforge.net/ */ -#include - -int usbGetStringAscii(usb_dev_handle *dev, int index, char *buf, int buflen); -/* This function gets a string descriptor from the device. 'index' is the - * string descriptor index. The string is returned in ISO Latin 1 encoding in - * 'buf' and it is terminated with a 0-character. The buffer size must be - * passed in 'buflen' to prevent buffer overflows. A libusb device handle - * must be given in 'dev'. - * Returns: The length of the string (excluding the terminating 0) or - * a negative number in case of an error. If there was an error, use - * usb_strerror() to obtain the error message. - */ - -int usbOpenDevice(usb_dev_handle **device, int vendorID, char *vendorNamePattern, int productID, char *productNamePattern, char *serialNamePattern, FILE *printMatchingDevicesFp, FILE *warningsFp); -/* This function iterates over all devices on all USB busses and searches for - * a device. Matching is done first by means of Vendor- and Product-ID (passed - * in 'vendorID' and 'productID'. An ID of 0 matches any numeric ID (wildcard). - * When a device matches by its IDs, matching by names is performed. Name - * matching can be done on textual vendor name ('vendorNamePattern'), product - * name ('productNamePattern') and serial number ('serialNamePattern'). A - * device matches only if all non-null pattern match. If you don't care about - * a string, pass NULL for the pattern. Patterns are Unix shell style pattern: - * '*' stands for 0 or more characters, '?' for one single character, a list - * of characters in square brackets for a single character from the list - * (dashes are allowed to specify a range) and if the lis of characters begins - * with a caret ('^'), it matches one character which is NOT in the list. - * Other parameters to the function: If 'warningsFp' is not NULL, warning - * messages are printed to this file descriptor with fprintf(). If - * 'printMatchingDevicesFp' is not NULL, no device is opened but matching - * devices are printed to the given file descriptor with fprintf(). - * If a device is opened, the resulting USB handle is stored in '*device'. A - * pointer to a "usb_dev_handle *" type variable must be passed here. - * Returns: 0 on success, an error code (see defines below) on failure. - */ - -/* usbOpenDevice() error codes: */ -#define USBOPEN_SUCCESS 0 /* no error */ -#define USBOPEN_ERR_ACCESS 1 /* not enough permissions to open device */ -#define USBOPEN_ERR_IO 2 /* I/O error */ -#define USBOPEN_ERR_NOTFOUND 3 /* device not found */ - - -/* Obdev's free USB IDs, see USBID-License.txt for details */ - -#define USB_VID_OBDEV_SHARED 5824 /* obdev's shared vendor ID */ -#define USB_PID_OBDEV_SHARED_CUSTOM 1500 /* shared PID for custom class devices */ -#define USB_PID_OBDEV_SHARED_HID 1503 /* shared PID for HIDs except mice & keyboards */ -#define USB_PID_OBDEV_SHARED_CDCACM 1505 /* shared PID for CDC Modem devices */ -#define USB_PID_OBDEV_SHARED_MIDI 1508 /* shared PID for MIDI class devices */ - -#endif /* __OPENDEVICE_H_INCLUDED__ */ diff --git a/tools/vusb/tests/Makefile b/tools/vusb/tests/Makefile deleted file mode 100644 index 74b2518..0000000 --- a/tools/vusb/tests/Makefile +++ /dev/null @@ -1,127 +0,0 @@ -# Name: Makefile -# Project: custom-class example -# Author: Christian Starkjohann -# Creation Date: 2008-04-07 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id: Makefile 719 2009-03-16 18:51:56Z cs $ - -DEVICE = attiny2313 -F_CPU = 16000000 # in Hz -DEFINES = - -CFLAGS = $(DEFINES) -Iusbdrv -I. -DDEBUG_LEVEL=0 -OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o - -COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE) - -SIZES_TMP = /tmp/sizetmp.txt - -# symbolic targets: -help: - @echo "This Makefile has no default rule. Use one of the following:" - @echo "make clean ..... to delete objects and hex file" - @echo "make sizes ..... compute code and RAM sizes for various options" - @echo "make test ...... test with all features whether everything compiles" - -sizes sizes.txt: - rm -f $(SIZES_TMP) sizes.txt - $(MAKE) null.elf - avr-size null.elf | tail -1 | awk '{print "null", $$1+$$2, $$3+$$2}' >$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf - avr-size main.elf | tail -1 | awk '{print "Minimum_with_16_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf F_CPU=12000000 - avr-size main.elf | tail -1 | awk '{print "Minimum_with_12_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf F_CPU=12800000 - avr-size main.elf | tail -1 | awk '{print "Minimum_with_12_8_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf F_CPU=15000000 - avr-size main.elf | tail -1 | awk '{print "Minimum_with_15_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf F_CPU=16500000 - avr-size main.elf | tail -1 | awk '{print "Minimum_with_16_5_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf F_CPU=18000000 - avr-size main.elf | tail -1 | awk '{print "Minimum_with_18_MHz+CRC", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf F_CPU=20000000 - avr-size main.elf | tail -1 | awk '{print "Minimum_with_20_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf DEFINES=-DUSB_CFG_IMPLEMENT_FN_WRITE=1 - avr-size main.elf | tail -1 | awk '{print "With_usbFunctionWrite", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf DEFINES=-DUSB_CFG_IMPLEMENT_FN_READ=1 - avr-size main.elf | tail -1 | awk '{print "With_usbFunctionRead", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_IMPLEMENT_FN_READ=1 -DUSB_CFG_IMPLEMENT_FN_WRITE=1" - avr-size main.elf | tail -1 | awk '{print "With_usbFunctionRead_and_Write", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_IMPLEMENT_FN_WRITEOUT=1" - avr-size main.elf | tail -1 | awk '{print "With_usbFunctionWriteOut", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_HAVE_INTRIN_ENDPOINT=1" - avr-size main.elf | tail -1 | awk '{print "With_Interrupt_In_Endpoint_1", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_IMPLEMENT_HALT=1 -DUSB_CFG_HAVE_INTRIN_ENDPOINT=1" - avr-size main.elf | tail -1 | awk '{print "With_Interrupt_In_Endpoint_1_and_Halt", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_HAVE_INTRIN_ENDPOINT3=1" - avr-size main.elf | tail -1 | awk '{print "With_Interrupt_In_Endpoint_1_and_3", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSE_DYNAMIC_DESCRIPTOR=1" - avr-size main.elf | tail -1 | awk '{print "With_Dynamic_Descriptor", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_LONG_TRANSFERS=1" - avr-size main.elf | tail -1 | awk '{print "With_Long_Transfers", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP) - cat $(SIZES_TMP) | awk 'BEGIN{printf("%39s %5s %5s %5s %5s\n"), "Variation", "Flash", "RAM", "+F", "+RAM"}\ - /^null/{nullRom=$$2; nullRam=$$3; next} \ - {rom=$$2-nullRom; ram=$$3-nullRam; if(!refRom){refRom=rom; refRam=ram} \ - printf("%39s %5d %5d %+5d %+5d\n", $$1, rom, ram, rom-refRom, ram-refRam)}' | tee sizes.txt - rm $(SIZES_TMP) - -test: - for freq in 12000000 12800000 15000000 16000000 16500000 18000000 20000000; do \ - for opt in USB_COUNT_SOF USB_CFG_HAVE_INTRIN_ENDPOINT USB_CFG_HAVE_INTRIN_ENDPOINT3 USB_CFG_HAVE_MEASURE_FRAME_LENGTH USB_CFG_LONG_TRANSFERS; do \ - $(MAKE) clean; $(MAKE) main.elf F_CPU=$$freq "DEFINES=-D$$opt=1" || exit 1; \ - $(MAKE) clean; $(MAKE) main.elf F_CPU=$$freq "DEFINES=-D$$opt=1 -DDUSB_CFG_IMPLEMENT_FN_WRITEOUT=1" || exit 1; \ - done \ - done - -# The following rule is used to check the compiler -devices: #exclude devices without RAM for stack and atmega603 for gcc 3 - excludes="at90s1200 attiny11 attiny12 attiny15 attiny28"; \ - for gccVersion in 3 4; do \ - avr-gcc-select $$gccVersion; \ - for device in `echo | avr-gcc -xc -mmcu=x - 2>&1 | egrep '^ *at[a-zA-Z0-9_-]+$$'`; do \ - if echo "$$excludes" | grep "$$device" >/dev/null; then continue; fi; \ - if [ "$$gccVersion" = 3 -a "$$device" = atmega603 ]; then continue; fi; \ - $(MAKE) clean; $(MAKE) null.elf DEVICE=$$device || exit 1; \ - done \ - done - $(MAKE) clean - avr-gcc-select 3 - @echo "+++ Device test succeeded!" - -# rule for deleting dependent files (those which can be built by Make): -clean: - rm -f *.hex *.lst *.map *.elf *.o - rm -rf usbdrv - -# Generic rule for compiling C files: -.c.o: - $(COMPILE) -c $< -o $@ - -# Generic rule for assembling Assembler source files: -.S.o: - $(COMPILE) -x assembler-with-cpp -c $< -o $@ -# "-x assembler-with-cpp" should not be necessary since this is the default -# file type for the .S (with capital S) extension. However, upper case -# characters are not always preserved on Windows. To ensure WinAVR -# compatibility define the file type manually. - -# Generic rule for compiling C to assembler, used for debugging only. -.c.s: - $(COMPILE) -S $< -o $@ - -# file targets: - -# Since we don't want to ship the driver multipe times, we copy it into this project: -usbdrv: - cp -r ../usbdrv . - -main.elf: usbdrv $(OBJECTS) # usbdrv dependency only needed because we copy it - $(COMPILE) -o main.elf $(OBJECTS) - -main_i.elf: usbdrv main.o usbdrv/usbdrvasm.o # usbdrv dependency only needed because we copy it - $(COMPILE) -o main_i.elf main.o usbdrv/usbdrvasm.o - -null.elf: null.o - $(COMPILE) -o null.elf null.o diff --git a/tools/vusb/tests/Readme.txt b/tools/vusb/tests/Readme.txt deleted file mode 100644 index 3f0d36d..0000000 --- a/tools/vusb/tests/Readme.txt +++ /dev/null @@ -1,13 +0,0 @@ -This is the Readme file for the directory "tests" of V-USB, a firmware-only -USB driver for AVR microcontrollers. - -WHAT IS IN THIS DIRECTORY? -========================== -This directory is for driver development only. It contains tests to check -whether all branches of #ifdef code compile as they should and whether the -code size of the driver increased. - - ----------------------------------------------------------------------------- -(c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. -http://www.obdev.at/ diff --git a/tools/vusb/tests/compare-sizes.awk b/tools/vusb/tests/compare-sizes.awk deleted file mode 100755 index 8135729..0000000 --- a/tools/vusb/tests/compare-sizes.awk +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/awk -f -# Name: compare-sizes.awk -# Project: v-usb -# Author: Christian Starkjohann -# Creation Date: 2008-04-29 -# Tabsize: 4 -# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH -# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) -# This Revision: $Id$ - -BEGIN{ - opt = 0; - if(ARGC != 3){ - printf("usage: compare-sizes.awk file1 file2\n"); - printf(" computes size differences between two size lists\n"); - exit 1; - } - file1 = ARGV[1]; - file2 = ARGV[2]; -} - -{ - if(($2 + 0) != 0){ - if(!hadOption[$1]){ - hadOption[$1] = 1; - options[opt++] = $1; - } - flash[FILENAME, $1] = $2; - ram[FILENAME, $1] = $3; - } -} - -END{ - if(opt > 0){ - printf ("%39s %6s %5s\n", "Variation", "+Flash", "+RAM"); - } - for(i = 0; i < opt; i++){ - option = options[i]; - if(!flash[file2, option] || !flash[file1, option]){ - printf("%39s %6s %5s\n", option, "n/a", "n/a"); - }else{ - printf("%39s %+6d %+5d\n", option, flash[file2, option] - flash[file1, option], ram[file2, option] - ram[file1, option]); - } - } -} diff --git a/tools/vusb/tests/main.c b/tools/vusb/tests/main.c deleted file mode 100644 index f1beb87..0000000 --- a/tools/vusb/tests/main.c +++ /dev/null @@ -1,159 +0,0 @@ -/* Name: main.c - * Project: Testing driver features - * Author: Christian Starkjohann - * Creation Date: 2008-04-29 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: main.c 692 2008-11-07 15:07:40Z cs $ - */ - -/* -This module is a do-nothing test code linking against (or including) the USB -driver. It is used to determine the code size for various options and to -check whether the code compiles with all options. -*/ -#include -#include /* for sei() */ -#include /* required by usbdrv.h */ -#include /* for _delay_ms() */ -#include "usbdrv.h" -#if USE_INCLUDE -#include "usbdrv.c" -#endif - -/* ------------------------------------------------------------------------- */ -/* ----------------------------- USB interface ----------------------------- */ -/* ------------------------------------------------------------------------- */ - -#if USB_CFG_IMPLEMENT_FN_WRITE -uchar usbFunctionWrite(uchar *data, uchar len) -{ - return 1; -} -#endif - -#if USB_CFG_IMPLEMENT_FN_READ -uchar usbFunctionRead(uchar *data, uchar len) -{ - return len; -} -#endif - -#if USB_CFG_IMPLEMENT_FN_WRITEOUT -void usbFunctionWriteOut(uchar *data, uchar len) -{ -} -#endif - -#if USE_DYNAMIC_DESCRIPTOR - -static PROGMEM char myDescriptorDevice[] = { /* USB device descriptor */ - 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */ - USBDESCR_DEVICE, /* descriptor type */ - 0x10, 0x01, /* USB version supported */ - USB_CFG_DEVICE_CLASS, - USB_CFG_DEVICE_SUBCLASS, - 0, /* protocol */ - 8, /* max packet size */ - /* the following two casts affect the first byte of the constant only, but - * that's sufficient to avoid a warning with the default values. - */ - (char)USB_CFG_VENDOR_ID,/* 2 bytes */ - (char)USB_CFG_DEVICE_ID,/* 2 bytes */ - USB_CFG_DEVICE_VERSION, /* 2 bytes */ - USB_CFG_DESCR_PROPS_STRING_VENDOR != 0 ? 1 : 0, /* manufacturer string index */ - USB_CFG_DESCR_PROPS_STRING_PRODUCT != 0 ? 2 : 0, /* product string index */ - USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER != 0 ? 3 : 0, /* serial number string index */ - 1, /* number of configurations */ -}; - -static PROGMEM char myDescriptorConfiguration[] = { /* USB configuration descriptor */ - 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ - USBDESCR_CONFIG, /* descriptor type */ - 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + (USB_CFG_DESCR_PROPS_HID & 0xff), 0, - /* total length of data returned (including inlined descriptors) */ - 1, /* number of interfaces in this configuration */ - 1, /* index of this configuration */ - 0, /* configuration name string index */ -#if USB_CFG_IS_SELF_POWERED - USBATTR_SELFPOWER, /* attributes */ -#else - (char)USBATTR_BUSPOWER, /* attributes */ -#endif - USB_CFG_MAX_BUS_POWER/2, /* max USB current in 2mA units */ -/* interface descriptor follows inline: */ - 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ - USBDESCR_INTERFACE, /* descriptor type */ - 0, /* index of this interface */ - 0, /* alternate setting for this interface */ - USB_CFG_HAVE_INTRIN_ENDPOINT, /* endpoints excl 0: number of endpoint descriptors to follow */ - USB_CFG_INTERFACE_CLASS, - USB_CFG_INTERFACE_SUBCLASS, - USB_CFG_INTERFACE_PROTOCOL, - 0, /* string index for interface */ -#if (USB_CFG_DESCR_PROPS_HID & 0xff) /* HID descriptor */ - 9, /* sizeof(usbDescrHID): length of descriptor in bytes */ - USBDESCR_HID, /* descriptor type: HID */ - 0x01, 0x01, /* BCD representation of HID version */ - 0x00, /* target country code */ - 0x01, /* number of HID Report (or other HID class) Descriptor infos to follow */ - 0x22, /* descriptor type: report */ - USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0, /* total length of report descriptor */ -#endif -#if USB_CFG_HAVE_INTRIN_ENDPOINT /* endpoint descriptor for endpoint 1 */ - 7, /* sizeof(usbDescrEndpoint) */ - USBDESCR_ENDPOINT, /* descriptor type = endpoint */ - (char)0x81, /* IN endpoint number 1 */ - 0x03, /* attrib: Interrupt endpoint */ - 8, 0, /* maximum packet size */ - USB_CFG_INTR_POLL_INTERVAL, /* in ms */ -#endif -}; - -USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(usbRequest_t *rq) -{ -uchar *p = 0, len = 0; - - if(rq->wValue.bytes[1] == USBDESCR_DEVICE){ - p = (uchar *)myDescriptorDevice; - len = sizeof(myDescriptorDevice); - }else{ /* must be configuration descriptor */ - p = (uchar *)(myDescriptorConfiguration); - len = sizeof(myDescriptorConfiguration); - } - usbMsgPtr = p; - return len; -} -#endif - -USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]) -{ -usbRequest_t *rq = (void *)data; - - if(rq->bRequest == 0) /* request using usbFunctionRead()/usbFunctionWrite() */ - return 0xff; - return 0; /* default for not implemented requests: return no data back to host */ -} - -/* ------------------------------------------------------------------------- */ - -int main(void) -{ -uchar i; - - usbInit(); - usbDeviceDisconnect(); /* enforce re-enumeration, do this while interrupts are disabled! */ - i = 0; - while(--i){ /* fake USB disconnect for > 250 ms */ - _delay_ms(1); - } - usbDeviceConnect(); - sei(); - for(;;){ /* main event loop */ - usbPoll(); - } - return 0; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/tests/null.c b/tools/vusb/tests/null.c deleted file mode 100644 index dc6848d..0000000 --- a/tools/vusb/tests/null.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Name: null.c - * Project: Testing driver features - * Author: Christian Starkjohann - * Creation Date: 2008-04-29 - * Tabsize: 4 - * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: null.c 692 2008-11-07 15:07:40Z cs $ - */ - -/* -This is a NULL main() function to find out the code size required by libusb's -startup code, interrupt vectors etc. -*/ -#include - - -/* ------------------------------------------------------------------------- */ - -int main(void) -{ - for(;;); - return 0; -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/tests/sizes-reference/sizes-20080418-gcc3.4.6.txt b/tools/vusb/tests/sizes-reference/sizes-20080418-gcc3.4.6.txt deleted file mode 100644 index 2257e89..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20080418-gcc3.4.6.txt +++ /dev/null @@ -1,13 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1154 45 +0 +0 - Minimum_with_12_MHz 1274 45 +120 +0 - Minimum_with_15_MHz 1260 45 +106 +0 - Minimum_with_16_5_MHz 1276 45 +122 +0 - With_usbFunctionWrite 1214 45 +60 +0 - With_usbFunctionRead 1200 45 +46 +0 - With_usbFunctionRead_and_Write 1246 45 +92 +0 - With_usbFunctionWriteOut 1178 45 +24 +0 - With_Interrupt_In_Endpoint_1 1284 58 +130 +13 - With_Interrupt_In_Endpoint_1_and_Halt 1372 58 +218 +13 - With_Interrupt_In_Endpoint_1_and_3 1386 69 +232 +24 - With_Dynamic_Descriptor 1186 45 +32 +0 diff --git a/tools/vusb/tests/sizes-reference/sizes-20080418-gcc4.2.2.txt b/tools/vusb/tests/sizes-reference/sizes-20080418-gcc4.2.2.txt deleted file mode 100644 index f776893..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20080418-gcc4.2.2.txt +++ /dev/null @@ -1,13 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1208 45 +0 +0 - Minimum_with_12_MHz 1328 45 +120 +0 - Minimum_with_15_MHz 1314 45 +106 +0 - Minimum_with_16_5_MHz 1330 45 +122 +0 - With_usbFunctionWrite 1268 45 +60 +0 - With_usbFunctionRead 1264 45 +56 +0 - With_usbFunctionRead_and_Write 1314 45 +106 +0 - With_usbFunctionWriteOut 1218 45 +10 +0 - With_Interrupt_In_Endpoint_1 1340 58 +132 +13 - With_Interrupt_In_Endpoint_1_and_Halt 1414 58 +206 +13 - With_Interrupt_In_Endpoint_1_and_3 1426 69 +218 +24 - With_Dynamic_Descriptor 1238 45 +30 +0 diff --git a/tools/vusb/tests/sizes-reference/sizes-20080513-gcc3.4.6.txt b/tools/vusb/tests/sizes-reference/sizes-20080513-gcc3.4.6.txt deleted file mode 100644 index d292bfb..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20080513-gcc3.4.6.txt +++ /dev/null @@ -1,15 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1154 45 +0 +0 - Minimum_with_12_MHz 1274 45 +120 +0 - Minimum_with_15_MHz 1260 45 +106 +0 - Minimum_with_16_5_MHz 1276 45 +122 +0 - Minimum_with_20_MHz 1136 45 -18 +0 - With_usbFunctionWrite 1214 45 +60 +0 - With_usbFunctionRead 1192 45 +38 +0 - With_usbFunctionRead_and_Write 1234 45 +80 +0 - With_usbFunctionWriteOut 1178 45 +24 +0 - With_Interrupt_In_Endpoint_1 1280 57 +126 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1370 57 +216 +12 - With_Interrupt_In_Endpoint_1_and_3 1346 69 +192 +24 - With_Dynamic_Descriptor 1182 45 +28 +0 - With_Long_Transfers 1200 47 +46 +2 diff --git a/tools/vusb/tests/sizes-reference/sizes-20080513-gcc4.3.0.txt b/tools/vusb/tests/sizes-reference/sizes-20080513-gcc4.3.0.txt deleted file mode 100644 index e3218b4..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20080513-gcc4.3.0.txt +++ /dev/null @@ -1,15 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1192 45 +0 +0 - Minimum_with_12_MHz 1312 45 +120 +0 - Minimum_with_15_MHz 1298 45 +106 +0 - Minimum_with_16_5_MHz 1314 45 +122 +0 - Minimum_with_20_MHz 1174 45 -18 +0 - With_usbFunctionWrite 1246 45 +54 +0 - With_usbFunctionRead 1242 45 +50 +0 - With_usbFunctionRead_and_Write 1280 45 +88 +0 - With_usbFunctionWriteOut 1208 45 +16 +0 - With_Interrupt_In_Endpoint_1 1320 57 +128 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1410 57 +218 +12 - With_Interrupt_In_Endpoint_1_and_3 1428 69 +236 +24 - With_Dynamic_Descriptor 1212 45 +20 +0 - With_Long_Transfers 1270 47 +78 +2 diff --git a/tools/vusb/tests/sizes-reference/sizes-20081022-gcc3.4.6.txt b/tools/vusb/tests/sizes-reference/sizes-20081022-gcc3.4.6.txt deleted file mode 100644 index 0dfafa7..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20081022-gcc3.4.6.txt +++ /dev/null @@ -1,16 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1152 45 +0 +0 - Minimum_with_12_MHz 1202 45 +50 +0 - Minimum_with_12_8_MHz 1522 45 +370 +0 - Minimum_with_15_MHz 1258 45 +106 +0 - Minimum_with_16_5_MHz 1274 45 +122 +0 - Minimum_with_20_MHz 1134 45 -18 +0 - With_usbFunctionWrite 1212 45 +60 +0 - With_usbFunctionRead 1190 45 +38 +0 - With_usbFunctionRead_and_Write 1232 45 +80 +0 - With_usbFunctionWriteOut 1176 45 +24 +0 - With_Interrupt_In_Endpoint_1 1278 57 +126 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1368 57 +216 +12 - With_Interrupt_In_Endpoint_1_and_3 1344 69 +192 +24 - With_Dynamic_Descriptor 1180 45 +28 +0 - With_Long_Transfers 1198 47 +46 +2 diff --git a/tools/vusb/tests/sizes-reference/sizes-20081022-gcc4.3.0.txt b/tools/vusb/tests/sizes-reference/sizes-20081022-gcc4.3.0.txt deleted file mode 100644 index 42e2ba9..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20081022-gcc4.3.0.txt +++ /dev/null @@ -1,16 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1194 45 +0 +0 - Minimum_with_12_MHz 1244 45 +50 +0 - Minimum_with_12_8_MHz 1564 45 +370 +0 - Minimum_with_15_MHz 1300 45 +106 +0 - Minimum_with_16_5_MHz 1316 45 +122 +0 - Minimum_with_20_MHz 1176 45 -18 +0 - With_usbFunctionWrite 1248 45 +54 +0 - With_usbFunctionRead 1244 45 +50 +0 - With_usbFunctionRead_and_Write 1282 45 +88 +0 - With_usbFunctionWriteOut 1210 45 +16 +0 - With_Interrupt_In_Endpoint_1 1322 57 +128 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1412 57 +218 +12 - With_Interrupt_In_Endpoint_1_and_3 1430 69 +236 +24 - With_Dynamic_Descriptor 1214 45 +20 +0 - With_Long_Transfers 1272 47 +78 +2 diff --git a/tools/vusb/tests/sizes-reference/sizes-20081126-gcc3.4.6.txt b/tools/vusb/tests/sizes-reference/sizes-20081126-gcc3.4.6.txt deleted file mode 100644 index 0dfafa7..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20081126-gcc3.4.6.txt +++ /dev/null @@ -1,16 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1152 45 +0 +0 - Minimum_with_12_MHz 1202 45 +50 +0 - Minimum_with_12_8_MHz 1522 45 +370 +0 - Minimum_with_15_MHz 1258 45 +106 +0 - Minimum_with_16_5_MHz 1274 45 +122 +0 - Minimum_with_20_MHz 1134 45 -18 +0 - With_usbFunctionWrite 1212 45 +60 +0 - With_usbFunctionRead 1190 45 +38 +0 - With_usbFunctionRead_and_Write 1232 45 +80 +0 - With_usbFunctionWriteOut 1176 45 +24 +0 - With_Interrupt_In_Endpoint_1 1278 57 +126 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1368 57 +216 +12 - With_Interrupt_In_Endpoint_1_and_3 1344 69 +192 +24 - With_Dynamic_Descriptor 1180 45 +28 +0 - With_Long_Transfers 1198 47 +46 +2 diff --git a/tools/vusb/tests/sizes-reference/sizes-20081126-gcc4.3.0.txt b/tools/vusb/tests/sizes-reference/sizes-20081126-gcc4.3.0.txt deleted file mode 100644 index 42e2ba9..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20081126-gcc4.3.0.txt +++ /dev/null @@ -1,16 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1194 45 +0 +0 - Minimum_with_12_MHz 1244 45 +50 +0 - Minimum_with_12_8_MHz 1564 45 +370 +0 - Minimum_with_15_MHz 1300 45 +106 +0 - Minimum_with_16_5_MHz 1316 45 +122 +0 - Minimum_with_20_MHz 1176 45 -18 +0 - With_usbFunctionWrite 1248 45 +54 +0 - With_usbFunctionRead 1244 45 +50 +0 - With_usbFunctionRead_and_Write 1282 45 +88 +0 - With_usbFunctionWriteOut 1210 45 +16 +0 - With_Interrupt_In_Endpoint_1 1322 57 +128 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1412 57 +218 +12 - With_Interrupt_In_Endpoint_1_and_3 1430 69 +236 +24 - With_Dynamic_Descriptor 1214 45 +20 +0 - With_Long_Transfers 1272 47 +78 +2 diff --git a/tools/vusb/tests/sizes-reference/sizes-20090323-gcc3.4.6.txt b/tools/vusb/tests/sizes-reference/sizes-20090323-gcc3.4.6.txt deleted file mode 100644 index 18e72a6..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20090323-gcc3.4.6.txt +++ /dev/null @@ -1,17 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1152 45 +0 +0 - Minimum_with_12_MHz 1202 45 +50 +0 - Minimum_with_12_8_MHz 1522 45 +370 +0 - Minimum_with_15_MHz 1258 45 +106 +0 - Minimum_with_16_5_MHz 1274 45 +122 +0 - Minimum_with_18_MHz+CRC 2268 45 +1116 +0 - Minimum_with_20_MHz 1134 45 -18 +0 - With_usbFunctionWrite 1212 45 +60 +0 - With_usbFunctionRead 1190 45 +38 +0 - With_usbFunctionRead_and_Write 1232 45 +80 +0 - With_usbFunctionWriteOut 1176 45 +24 +0 - With_Interrupt_In_Endpoint_1 1278 57 +126 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1368 57 +216 +12 - With_Interrupt_In_Endpoint_1_and_3 1344 69 +192 +24 - With_Dynamic_Descriptor 1180 45 +28 +0 - With_Long_Transfers 1198 47 +46 +2 diff --git a/tools/vusb/tests/sizes-reference/sizes-20090323-gcc4.3.2.txt b/tools/vusb/tests/sizes-reference/sizes-20090323-gcc4.3.2.txt deleted file mode 100644 index 9b4f4ee..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20090323-gcc4.3.2.txt +++ /dev/null @@ -1,17 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1224 45 +0 +0 - Minimum_with_12_MHz 1274 45 +50 +0 - Minimum_with_12_8_MHz 1594 45 +370 +0 - Minimum_with_15_MHz 1330 45 +106 +0 - Minimum_with_16_5_MHz 1346 45 +122 +0 - Minimum_with_18_MHz+CRC 2298 45 +1074 +0 - Minimum_with_20_MHz 1206 45 -18 +0 - With_usbFunctionWrite 1284 45 +60 +0 - With_usbFunctionRead 1280 45 +56 +0 - With_usbFunctionRead_and_Write 1318 45 +94 +0 - With_usbFunctionWriteOut 1246 45 +22 +0 - With_Interrupt_In_Endpoint_1 1358 57 +134 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1448 57 +224 +12 - With_Interrupt_In_Endpoint_1_and_3 1466 69 +242 +24 - With_Dynamic_Descriptor 1250 45 +26 +0 - With_Long_Transfers 1302 47 +78 +2 diff --git a/tools/vusb/tests/sizes-reference/sizes-20090415-gcc3.4.6.txt b/tools/vusb/tests/sizes-reference/sizes-20090415-gcc3.4.6.txt deleted file mode 100644 index 18e72a6..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20090415-gcc3.4.6.txt +++ /dev/null @@ -1,17 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1152 45 +0 +0 - Minimum_with_12_MHz 1202 45 +50 +0 - Minimum_with_12_8_MHz 1522 45 +370 +0 - Minimum_with_15_MHz 1258 45 +106 +0 - Minimum_with_16_5_MHz 1274 45 +122 +0 - Minimum_with_18_MHz+CRC 2268 45 +1116 +0 - Minimum_with_20_MHz 1134 45 -18 +0 - With_usbFunctionWrite 1212 45 +60 +0 - With_usbFunctionRead 1190 45 +38 +0 - With_usbFunctionRead_and_Write 1232 45 +80 +0 - With_usbFunctionWriteOut 1176 45 +24 +0 - With_Interrupt_In_Endpoint_1 1278 57 +126 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1368 57 +216 +12 - With_Interrupt_In_Endpoint_1_and_3 1344 69 +192 +24 - With_Dynamic_Descriptor 1180 45 +28 +0 - With_Long_Transfers 1198 47 +46 +2 diff --git a/tools/vusb/tests/sizes-reference/sizes-20090415-gcc4.3.2.txt b/tools/vusb/tests/sizes-reference/sizes-20090415-gcc4.3.2.txt deleted file mode 100644 index 9b4f4ee..0000000 --- a/tools/vusb/tests/sizes-reference/sizes-20090415-gcc4.3.2.txt +++ /dev/null @@ -1,17 +0,0 @@ - Variation Flash RAM +F +RAM - Minimum_with_16_MHz 1224 45 +0 +0 - Minimum_with_12_MHz 1274 45 +50 +0 - Minimum_with_12_8_MHz 1594 45 +370 +0 - Minimum_with_15_MHz 1330 45 +106 +0 - Minimum_with_16_5_MHz 1346 45 +122 +0 - Minimum_with_18_MHz+CRC 2298 45 +1074 +0 - Minimum_with_20_MHz 1206 45 -18 +0 - With_usbFunctionWrite 1284 45 +60 +0 - With_usbFunctionRead 1280 45 +56 +0 - With_usbFunctionRead_and_Write 1318 45 +94 +0 - With_usbFunctionWriteOut 1246 45 +22 +0 - With_Interrupt_In_Endpoint_1 1358 57 +134 +12 - With_Interrupt_In_Endpoint_1_and_Halt 1448 57 +224 +12 - With_Interrupt_In_Endpoint_1_and_3 1466 69 +242 +24 - With_Dynamic_Descriptor 1250 45 +26 +0 - With_Long_Transfers 1302 47 +78 +2 diff --git a/tools/vusb/tests/usbconfig.h b/tools/vusb/tests/usbconfig.h deleted file mode 100644 index a2e9b6b..0000000 --- a/tools/vusb/tests/usbconfig.h +++ /dev/null @@ -1,317 +0,0 @@ -/* Name: usbconfig.h - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2005-04-01 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbconfig.h 740 2009-04-13 18:23:31Z cs $ - */ - -#ifndef __usbconfig_h_included__ -#define __usbconfig_h_included__ - -/* -General Description: -This file is an example configuration (with inline documentation) for the USB -driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is -also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may -wire the lines to any other port, as long as D+ is also wired to INT0 (or any -other hardware interrupt, as long as it is the highest level interrupt, see -section at the end of this file). -*/ - -/* ---------------------------- Hardware Config ---------------------------- */ - -#define USB_CFG_IOPORTNAME D -/* This is the port where the USB bus is connected. When you configure it to - * "B", the registers PORTB, PINB and DDRB will be used. - */ -#define USB_CFG_DMINUS_BIT 4 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This may be any bit in the port. - */ -#define USB_CFG_DPLUS_BIT 2 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port. Please note that D+ must also be connected - * to interrupt pin INT0! [You can also use other interrupts, see section - * "Optional MCU Description" below, or you can connect D- to the interrupt, as - * it is required if you use the USB_COUNT_SOF feature. If you use D- for the - * interrupt, the USB interrupt will also be triggered at Start-Of-Frame - * markers every millisecond.] - */ -#define USB_CFG_CLOCK_KHZ (F_CPU/1000) -/* Clock rate of the AVR in MHz. Legal values are 12000, 15000, 16000 or 16500. - * The 16.5 MHz version of the code requires no crystal, it tolerates +/- 1% - * deviation from the nominal frequency. All other rates require a precision - * of 2000 ppm and thus a crystal! - * Default if not specified: 12 MHz - */ -#define USB_CFG_CHECK_CRC (USB_CFG_CLOCK_KHZ == 18000) -/* Define this to 1 if you want that the driver checks data integrity of data - * packets (CRC checks). CRC checks cost quite a bit of code size and are - * currently only available for 18 MHz crystal clock. You must choose - * USB_CFG_CLOCK_KHZ = 18000 if you enable this option. - */ - - -/* ----------------------- Optional Hardware Config ------------------------ */ - -/* #define USB_CFG_PULLUP_IOPORTNAME D */ -/* If you connect the 1.5k pullup resistor from D- to a port pin instead of - * V+, you can connect and disconnect the device from firmware by calling - * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). - * This constant defines the port on which the pullup resistor is connected. - */ -/* #define USB_CFG_PULLUP_BIT 4 */ -/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined - * above) where the 1.5k pullup resistor is connected. See description - * above for details. - */ - -/* --------------------------- Functional Range ---------------------------- */ - -#ifndef USB_CFG_HAVE_INTRIN_ENDPOINT3 -#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 -#endif -/* Define this to 1 if you want to compile a version with three endpoints: The - * default control endpoint 0, an interrupt-in endpoint 3 (or the number - * configured below) and a catch-all default interrupt-in endpoint as above. - * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. - */ -#ifndef USB_CFG_HAVE_INTRIN_ENDPOINT -#define USB_CFG_HAVE_INTRIN_ENDPOINT USB_CFG_HAVE_INTRIN_ENDPOINT3 -#endif -/* Define this to 1 if you want to compile a version with two endpoints: The - * default control endpoint 0 and an interrupt-in endpoint (any other endpoint - * number). - */ -#define USB_CFG_EP3_NUMBER 3 -/* If the so-called endpoint 3 is used, it can now be configured to any other - * endpoint number (except 0) with this macro. Default if undefined is 3. - */ -/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */ -/* The above macro defines the startup condition for data toggling on the - * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1. - * Since the token is toggled BEFORE sending any data, the first packet is - * sent with the oposite value of this configuration! - */ -//#define USB_CFG_IMPLEMENT_HALT 0 -/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature - * for endpoint 1 (interrupt endpoint). Although you may not need this feature, - * it is required by the standard. We have made it a config option because it - * bloats the code considerably. - */ -#define USB_CFG_INTR_POLL_INTERVAL 10 -/* If you compile a version with endpoint 1 (interrupt-in), this is the poll - * interval. The value is in milliseconds and must not be less than 10 ms for - * low speed devices. - */ -#define USB_CFG_IS_SELF_POWERED 0 -/* Define this to 1 if the device has its own power supply. Set it to 0 if the - * device is powered from the USB bus. - */ -#define USB_CFG_MAX_BUS_POWER 40 -/* Set this variable to the maximum USB bus power consumption of your device. - * The value is in milliamperes. [It will be divided by two since USB - * communicates power requirements in units of 2 mA.] - */ -//#define USB_CFG_IMPLEMENT_FN_WRITE 0 -/* Set this to 1 if you want usbFunctionWrite() to be called for control-out - * transfers. Set it to 0 if you don't need it and want to save a couple of - * bytes. - */ -//#define USB_CFG_IMPLEMENT_FN_READ 0 -/* Set this to 1 if you need to send control replies which are generated - * "on the fly" when usbFunctionRead() is called. If you only want to send - * data from a static buffer, set it to 0 and return the data from - * usbFunctionSetup(). This saves a couple of bytes. - */ -//#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 -/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. - * You must implement the function usbFunctionWriteOut() which receives all - * interrupt/bulk data sent to any endpoint other than 0. The endpoint number - * can be found in 'usbRxToken'. - */ -#define USB_CFG_HAVE_FLOWCONTROL 0 -/* Define this to 1 if you want flowcontrol over USB data. See the definition - * of the macros usbDisableAllRequests() and usbEnableAllRequests() in - * usbdrv.h. - */ -//#define USB_CFG_LONG_TRANSFERS 0 -/* Define this to 1 if you want to send/receive blocks of more than 254 bytes - * in a single control-in or control-out transfer. Note that the capability - * for long transfers increases the driver size. - */ -/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ -/* This macro is a hook if you want to do unconventional things. If it is - * defined, it's inserted at the beginning of received message processing. - * If you eat the received message and don't want default processing to - * proceed, do a return after doing your things. One possible application - * (besides debugging) is to flash a status LED on each packet. - */ -/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */ -/* This macro is a hook if you need to know when an USB RESET occurs. It has - * one parameter which distinguishes between the start of RESET state and its - * end. - */ -/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */ -/* This macro (if defined) is executed when a USB SET_ADDRESS request was - * received. - */ -//#define USB_COUNT_SOF 0 -/* define this macro to 1 if you need the global variable "usbSofCount" which - * counts SOF packets. This feature requires that the hardware interrupt is - * connected to D- instead of D+. - */ -//#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 -/* define this macro to 1 if you want the function usbMeasureFrameLength() - * compiled in. This function can be used to calibrate the AVR's RC oscillator. - */ - -/* -------------------------- Device Description --------------------------- */ - -#define USB_CFG_VENDOR_ID 0xc0, 0x16 -/* USB vendor ID for the device, low byte first. If you have registered your - * own Vendor ID, define it here. Otherwise you use one of obdev's free shared - * VID/PID pairs. Be sure to read USBID-License.txt for rules! - */ -#define USB_CFG_DEVICE_ID 0x08, 0x3e /* 1000 dec, "free for lab use" */ -/* This is the ID of the product, low byte first. It is interpreted in the - * scope of the vendor ID. If you have registered your own VID with usb.org - * or if you have licensed a PID from somebody else, define it here. Otherwise - * you use obdev's free shared VID/PID pair. Be sure to read the rules in - * USBID-License.txt! - */ -#define USB_CFG_DEVICE_VERSION 0x00, 0x01 -/* Version number of the device: Minor number first, then major number. - */ -#define USB_CFG_VENDOR_NAME 'o', 'b', 'd', 'e', 'v', '.', 'a', 't' -#define USB_CFG_VENDOR_NAME_LEN 8 -/* These two values define the vendor name returned by the USB device. The name - * must be given as a list of characters under single quotes. The characters - * are interpreted as Unicode (UTF-16) entities. - * If you don't want a vendor name string, undefine these macros. - * ALWAYS define a vendor name containing your Internet domain name if you use - * obdev's free shared VID/PID pair. See the file USBID-License.txt for - * details. - */ -#define USB_CFG_DEVICE_NAME 'T', 'e', 's', 't' -#define USB_CFG_DEVICE_NAME_LEN 4 -/* Same as above for the device name. If you don't want a device name, undefine - * the macros. See the file USBID-License.txt before you assign a name if you - * use a shared VID/PID. - */ -/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ -/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ -/* Same as above for the serial number. If you don't want a serial number, - * undefine the macros. - * It may be useful to provide the serial number through other means than at - * compile time. See the section about descriptor properties below for how - * to fine tune control over USB descriptors such as the string descriptor - * for the serial number. - */ -#define USB_CFG_DEVICE_CLASS 0xff /* set to 0 if deferred to interface */ -#define USB_CFG_DEVICE_SUBCLASS 0 -/* See USB specification if you want to conform to an existing device class. - * Class 0xff is "vendor specific". - */ -#define USB_CFG_INTERFACE_CLASS 0 /* define class here if not at device level */ -#define USB_CFG_INTERFACE_SUBCLASS 0 -#define USB_CFG_INTERFACE_PROTOCOL 0 -/* See USB specification if you want to conform to an existing device class or - * protocol. The following classes must be set at interface level: - * HID class is 3, no subclass and protocol required (but may be useful!) - * CDC class is 2, use subclass 2 and protocol 1 for ACM - */ -/* #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 42 */ -/* Define this to the length of the HID report descriptor, if you implement - * an HID device. Otherwise don't define it or define it to 0. - * If you use this define, you must add a PROGMEM character array named - * "usbHidReportDescriptor" to your code which contains the report descriptor. - * Don't forget to keep the array and this define in sync! - */ - -/* #define USB_PUBLIC static */ -/* Use the define above if you #include usbdrv.c instead of linking against it. - * This technique saves a couple of bytes in flash memory. - */ - -/* ------------------- Fine Control over USB Descriptors ------------------- */ -/* If you don't want to use the driver's default USB descriptors, you can - * provide our own. These can be provided as (1) fixed length static data in - * flash memory, (2) fixed length static data in RAM or (3) dynamically at - * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more - * information about this function. - * Descriptor handling is configured through the descriptor's properties. If - * no properties are defined or if they are 0, the default descriptor is used. - * Possible properties are: - * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched - * at runtime via usbFunctionDescriptor(). - * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found - * in static memory is in RAM, not in flash memory. - * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), - * the driver must know the descriptor's length. The descriptor itself is - * found at the address of a well known identifier (see below). - * List of static descriptor names (must be declared PROGMEM if in flash): - * char usbDescriptorDevice[]; - * char usbDescriptorConfiguration[]; - * char usbDescriptorHidReport[]; - * char usbDescriptorString0[]; - * int usbDescriptorStringVendor[]; - * int usbDescriptorStringDevice[]; - * int usbDescriptorStringSerialNumber[]; - * Other descriptors can't be provided statically, they must be provided - * dynamically at runtime. - * - * Descriptor properties are or-ed or added together, e.g.: - * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) - * - * The following descriptors are defined: - * USB_CFG_DESCR_PROPS_DEVICE - * USB_CFG_DESCR_PROPS_CONFIGURATION - * USB_CFG_DESCR_PROPS_STRINGS - * USB_CFG_DESCR_PROPS_STRING_0 - * USB_CFG_DESCR_PROPS_STRING_VENDOR - * USB_CFG_DESCR_PROPS_STRING_PRODUCT - * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER - * USB_CFG_DESCR_PROPS_HID - * USB_CFG_DESCR_PROPS_HID_REPORT - * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) - * - */ - -#if USE_DYNAMIC_DESCRIPTOR -#define USB_CFG_DESCR_PROPS_DEVICE USB_PROP_IS_DYNAMIC -#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC -#else -#define USB_CFG_DESCR_PROPS_DEVICE 0 -#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 -#endif -#define USB_CFG_DESCR_PROPS_STRINGS 0 -#define USB_CFG_DESCR_PROPS_STRING_0 0 -#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 -#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 -#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 -#define USB_CFG_DESCR_PROPS_HID 0 -#define USB_CFG_DESCR_PROPS_HID_REPORT 0 -#define USB_CFG_DESCR_PROPS_UNKNOWN 0 - -/* ----------------------- Optional MCU Description ------------------------ */ - -/* The following configurations have working defaults in usbdrv.h. You - * usually don't need to set them explicitly. Only if you want to run - * the driver on a device which is not yet supported or with a compiler - * which is not fully supported (such as IAR C) or if you use a differnt - * interrupt than INT0, you may have to define some of these. - */ -/* #define USB_INTR_CFG MCUCR */ -/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ -/* #define USB_INTR_CFG_CLR 0 */ -/* #define USB_INTR_ENABLE GIMSK */ -/* #define USB_INTR_ENABLE_BIT INT0 */ -/* #define USB_INTR_PENDING GIFR */ -/* #define USB_INTR_PENDING_BIT INTF0 */ -/* #define USB_INTR_VECTOR SIG_INTERRUPT0 */ - -#endif /* __usbconfig_h_included__ */ diff --git a/tools/vusb/usbdrv/Changelog.txt b/tools/vusb/usbdrv/Changelog.txt deleted file mode 100644 index 041268e..0000000 --- a/tools/vusb/usbdrv/Changelog.txt +++ /dev/null @@ -1,277 +0,0 @@ -This file documents changes in the firmware-only USB driver for atmel's AVR -microcontrollers. New entries are always appended to the end of the file. -Scroll down to the bottom to see the most recent changes. - -2005-04-01: - - Implemented endpoint 1 as interrupt-in endpoint. - - Moved all configuration options to usbconfig.h which is not part of the - driver. - - Changed interface for usbVendorSetup(). - - Fixed compatibility with ATMega8 device. - - Various minor optimizations. - -2005-04-11: - - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead() - and usbFunctionWrite() now. Added configuration options to choose which - of these functions to compile in. - - Assembler module delivers receive data non-inverted now. - - Made register and bit names compatible with more AVR devices. - -2005-05-03: - - Allow address of usbRxBuf on any memory page as long as the buffer does - not cross 256 byte page boundaries. - - Better device compatibility: works with Mega88 now. - - Code optimization in debugging module. - - Documentation updates. - -2006-01-02: - - Added (free) default Vendor- and Product-IDs bought from voti.nl. - - Added USBID-License.txt file which defines the rules for using the free - shared VID/PID pair. - - Added Readme.txt to the usbdrv directory which clarifies administrative - issues. - -2006-01-25: - - Added "configured state" to become more standards compliant. - - Added "HALT" state for interrupt endpoint. - - Driver passes the "USB Command Verifier" test from usb.org now. - - Made "serial number" a configuration option. - - Minor optimizations, we now recommend compiler option "-Os" for best - results. - - Added a version number to usbdrv.h - -2006-02-03: - - New configuration variable USB_BUFFER_SECTION for the memory section where - the USB rx buffer will go. This defaults to ".bss" if not defined. Since - this buffer MUST NOT cross 256 byte pages (not even touch a page at the - end), the user may want to pass a linker option similar to - "-Wl,--section-start=.mybuffer=0x800060". - - Provide structure for usbRequest_t. - - New defines for USB constants. - - Prepared for HID implementations. - - Increased data size limit for interrupt transfers to 8 bytes. - - New macro usbInterruptIsReady() to query interrupt buffer state. - -2006-02-18: - - Ensure that the data token which is sent as an ack to an OUT transfer is - always zero sized. This fixes a bug where the host reports an error after - sending an out transfer to the device, although all data arrived at the - device. - - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite(). - -* Release 2006-02-20 - - - Give a compiler warning when compiling with debugging turned on. - - Added Oleg Semyonov's changes for IAR-cc compatibility. - - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect() - (also thanks to Oleg!). - - Rearranged tests in usbPoll() to save a couple of instructions in the most - likely case that no actions are pending. - - We need a delay between the SET ADDRESS request until the new address - becomes active. This delay was handled in usbPoll() until now. Since the - spec says that the delay must not exceed 2ms, previous versions required - aggressive polling during the enumeration phase. We have now moved the - handling of the delay into the interrupt routine. - - We must not reply with NAK to a SETUP transaction. We can only achieve this - by making sure that the rx buffer is empty when SETUP tokens are expected. - We therefore don't pass zero sized data packets from the status phase of - a transfer to usbPoll(). This change MAY cause troubles if you rely on - receiving a less than 8 bytes long packet in usbFunctionWrite() to - identify the end of a transfer. usbFunctionWrite() will NEVER be called - with a zero length. - -* Release 2006-03-14 - - - Improved IAR C support: tiny memory model, more devices - - Added template usbconfig.h file under the name usbconfig-prototype.h - -* Release 2006-03-26 - - - Added provision for one more interrupt-in endpoint (endpoint 3). - - Added provision for one interrupt-out endpoint (endpoint 1). - - Added flowcontrol macros for USB. - - Added provision for custom configuration descriptor. - - Allow ANY two port bits for D+ and D-. - - Merged (optional) receive endpoint number into global usbRxToken variable. - - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the - variable name from the single port letter instead of computing the address - of related ports from the output-port address. - -* Release 2006-06-26 - - - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the - new features. - - Removed "#warning" directives because IAR does not understand them. Use - unused static variables instead to generate a warning. - - Do not include when compiling with IAR. - - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each - USB descriptor should be handled. It is now possible to provide descriptor - data in Flash, RAM or dynamically at runtime. - - STALL is now a status in usbTxLen* instead of a message. We can now conform - to the spec and leave the stall status pending until it is cleared. - - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the - application code to reset data toggling on interrupt pipes. - -* Release 2006-07-18 - - - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes - an assembler error. - - usbDeviceDisconnect() takes pull-up resistor to high impedance now. - -* Release 2007-02-01 - - - Merged in some code size improvements from usbtiny (thanks to Dick - Streefland for these optimizations!) - - Special alignment requirement for usbRxBuf not required any more. Thanks - again to Dick Streefland for this hint! - - Reverted to "#warning" instead of unused static variables -- new versions - of IAR CC should handle this directive. - - Changed Open Source license to GNU GPL v2 in order to make linking against - other free libraries easier. We no longer require publication of the - circuit diagrams, but we STRONGLY encourage it. If you improve the driver - itself, PLEASE grant us a royalty free license to your changes for our - commercial license. - -* Release 2007-03-29 - - - New configuration option "USB_PUBLIC" in usbconfig.h. - - Set USB version number to 1.10 instead of 1.01. - - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and - USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences - to USB_CFG_DESCR_PROPS_STRING_PRODUCT. - - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver - code. - - New assembler module for 16 MHz crystal. - - usbdrvasm.S contains common code only, clock-specific parts have been moved - to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively. - -* Release 2007-06-25 - - - 16 MHz module: Do SE0 check in stuffed bits as well. - -* Release 2007-07-07 - - - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary - for negative values. - - Added 15 MHz module contributed by V. Bosch. - - Interrupt vector name can now be configured. This is useful if somebody - wants to use a different hardware interrupt than INT0. - -* Release 2007-08-07 - - - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is - not exceeded. - - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN, - USB_COUNT_SOF - - USB_INTR_PENDING can now be a memory address, not just I/O - -* Release 2007-09-19 - - - Split out common parts of assembler modules into separate include file - - Made endpoint numbers configurable so that given interface definitions - can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h. - - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut() - can handle any number of endpoints. - - Define usbDeviceConnect() and usbDeviceDisconnect() even if no - USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this - case. - -* Release 2007-12-01 - - - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size - when USB_CFG_PULLUP_IOPORTNAME is not defined. - -* Release 2007-12-13 - - - Renamed all include-only assembler modules from *.S to *.inc so that - people don't add them to their project sources. - - Distribute leap bits in tx loop more evenly for 16 MHz module. - - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR - - Avoid compiler warnings for constant expr range by casting some values in - USB descriptors. - -* Release 2008-01-21 - - - Fixed bug in 15 and 16 MHz module where the new address set with - SET_ADDRESS was already accepted at the next NAK or ACK we send, not at - the next data packet we send. This caused problems when the host polled - too fast. Thanks to Alexander Neumann for his help and patience debugging - this issue! - -* Release 2008-02-05 - - - Fixed bug in 16.5 MHz module where a register was used in the interrupt - handler before it was pushed. This bug was introduced with version - 2007-09-19 when common parts were moved to a separate file. - - Optimized CRC routine (thanks to Reimar Doeffinger). - -* Release 2008-02-16 - - - Removed outdated IAR compatibility stuff (code sections). - - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK(). - - Added optional routine usbMeasureFrameLength() for calibration of the - internal RC oscillator. - -* Release 2008-02-28 - - - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we - start with sending USBPID_DATA0. - - Changed defaults in usbconfig-prototype.h - - Added free USB VID/PID pair for MIDI class devices - - Restructured AVR-USB as separate package, not part of PowerSwitch any more. - -* Release 2008-04-18 - - - Restructured usbdrv.c so that it is easier to read and understand. - - Better code optimization with gcc 4. - - If a second interrupt in endpoint is enabled, also add it to config - descriptor. - - Added config option for long transfers (above 254 bytes), see - USB_CFG_LONG_TRANSFERS in usbconfig.h. - - Added 20 MHz module contributed by Jeroen Benschop. - -* Release 2008-05-13 - - - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length - was not incremented, pointer to length was incremented instead. - - Added code to command line tool(s) which claims an interface. This code - is disabled by default, but may be necessary on newer Linux kernels. - - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING". - - New header "usbportability.h" prepares ports to other development - environments. - - Long transfers (above 254 bytes) did not work when usbFunctionRead() was - used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!] - - In hiddata.c (example code for sending/receiving data over HID), use - USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so - that we need not claim the interface. - - in usbPoll() loop 20 times polling for RESET state instead of 10 times. - This accounts for the higher clock rates we now support. - - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop. - - Added hook to SOF code so that oscillator can be tuned to USB frame clock. - - Added timeout to waitForJ loop. Helps preventing unexpected hangs. - - Added example code for oscillator tuning to libs-device (thanks to - Henrik Haftmann for the idea to this routine). - - Implemented option USB_CFG_SUPPRESS_INTR_CODE. - -* Release 2008-10-22 - - - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and - similar, not offset of 0x20 needs to be added. - - Allow distribution under GPLv3 for those who have to link against other - code distributed under GPLv3. - -* Release 2008-11-26 - - - Removed libusb-win32 dependency for hid-data example in Makefile.windows. - It was never required and confused many people. - - Added extern uchar usbRxToken to usbdrv.h. - - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser. - -* Release 2009-03-23 - - - Hid-mouse example used settings from hid-data example, fixed that. - - Renamed project to V-USB due to a trademark issue with Atmel(r). - - Changed CommercialLicense.txt and USBID-License.txt to make the - background of USB ID registration clearer. - -* Release 2009-04-15 diff --git a/tools/vusb/usbdrv/CommercialLicense.txt b/tools/vusb/usbdrv/CommercialLicense.txt deleted file mode 100644 index 33c9311..0000000 --- a/tools/vusb/usbdrv/CommercialLicense.txt +++ /dev/null @@ -1,157 +0,0 @@ -V-USB Driver Software License Agreement -Version 2009-04-14 - -THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN -ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING -THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT. - - -1 DEFINITIONS - -1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH, -Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA. - -1.2 "You" shall mean the Licensee. - -1.3 "V-USB" shall mean all files included in the package distributed under -the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/) -unless otherwise noted. This includes the firmware-only USB device -implementation for Atmel AVR microcontrollers, some simple device examples -and host side software examples and libraries. - - -2 LICENSE GRANTS - -2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source -code of V-USB. - -2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the -non-exclusive right to use, copy and distribute V-USB with your hardware -product(s), restricted by the limitations in section 3 below. - -2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify -the source code and your copy of V-USB according to your needs. - -2.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB Product -ID(s), sent to you in e-mail. These Product IDs are reserved exclusively for -you. They have been obtained from Wouter van Ooijen (www.voti.nl), who has -reserved the Vendor ID 5824 (decimal) at the USB Implementers Forum, Inc. -(www.usb.org). This mechanism ensures that there are no Product ID conflicts, -but you cannot become USB certified (enter into the USB-IF Trademark License -Agreement) as you would need your own Vendor ID for that. - - -3 LICENSE RESTRICTIONS - -3.1 Number of Units. Only one of the following three definitions is -applicable. Which one is determined by the amount you pay to OBJECTIVE -DEVELOPMENT, see section 4 ("Payment") below. - -Hobby License: You may use V-USB according to section 2 above in no more -than 5 hardware units. These units must not be sold for profit. - -Entry Level License: You may use V-USB according to section 2 above in no -more than 150 hardware units. - -Professional License: You may use V-USB according to section 2 above in -any number of hardware units, except for large scale production ("unlimited -fair use"). Quantities below 10,000 units are not considered large scale -production. If your reach quantities which are obviously large scale -production, you must pay a license fee of 0.10 EUR per unit for all units -above 10,000. - -3.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber -any copy of V-USB, or any of the rights granted herein. - -3.3 Transfer. You may not transfer your rights under this Agreement to -another party without OBJECTIVE DEVELOPMENT's prior written consent. If -such consent is obtained, you may permanently transfer this License to -another party. The recipient of such transfer must agree to all terms and -conditions of this Agreement. - -3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not -expressly granted. - -3.5 Non-Exclusive Rights. Your license rights under this Agreement are -non-exclusive. - -3.6 Third Party Rights. This Agreement cannot grant you rights controlled -by third parties. In particular, you are not allowed to use the USB logo or -other trademarks owned by the USB Implementers Forum, Inc. without their -consent. Since such consent depends on USB certification, it should be -noted that V-USB will not pass certification because it does not -implement checksum verification and the microcontroller ports do not meet -the electrical specifications. - - -4 PAYMENT - -The payment amount depends on the variation of this agreement (according to -section 3.1) into which you want to enter. Concrete prices are listed on -OBJECTIVE DEVELOPMENT's web site, usually at -http://www.obdev.at/vusb/license.html. You agree to pay the amount listed -there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor -or reseller. - - -5 COPYRIGHT AND OWNERSHIP - -V-USB is protected by copyright laws and international copyright -treaties, as well as other intellectual property laws and treaties. V-USB -is licensed, not sold. - - -6 TERM AND TERMINATION - -6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE -DEVELOPMENT may terminate this Agreement and revoke the granted license and -USB-IDs if you fail to comply with any of its terms and conditions. - -6.2 Survival of Terms. All provisions regarding secrecy, confidentiality -and limitation of liability shall survive termination of this agreement. - - -7 DISCLAIMER OF WARRANTY AND LIABILITY - -LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE -DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND -NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE -TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL -RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO -STATE/JURISDICTION. - -LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, -IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY -SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER -(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, -BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY -LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE -PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE -DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY -CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS -AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB. - - -8 MISCELLANEOUS TERMS - -8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing -purposes that you entered into this agreement. - -8.2 Entire Agreement. This document represents the entire agreement between -OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by -an authorized representative of both, OBJECTIVE DEVELOPMENT and you. - -8.3 Severability. In case a provision of these terms and conditions should -be or become partly or entirely invalid, ineffective, or not executable, -the validity of all other provisions shall not be affected. - -8.4 Applicable Law. This agreement is governed by the laws of the Republic -of Austria. - -8.5 Responsible Courts. The responsible courts in Vienna/Austria will have -exclusive jurisdiction regarding all disputes in connection with this -agreement. - diff --git a/tools/vusb/usbdrv/License.txt b/tools/vusb/usbdrv/License.txt deleted file mode 100644 index 4460cfb..0000000 --- a/tools/vusb/usbdrv/License.txt +++ /dev/null @@ -1,361 +0,0 @@ -OBJECTIVE DEVELOPMENT GmbH's V-USB driver software is distributed under the -terms and conditions of the GNU GPL version 2 or the GNU GPL version 3. It is -your choice whether you apply the terms of version 2 or version 3. The full -text of GPLv2 is included below. In addition to the requirements in the GPL, -we STRONGLY ENCOURAGE you to do the following: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/vusb/feedback.html for your submission. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/vusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - - - 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. - - - Copyright (C) - - 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. - - , 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. diff --git a/tools/vusb/usbdrv/Readme.txt b/tools/vusb/usbdrv/Readme.txt deleted file mode 100644 index aade7c0..0000000 --- a/tools/vusb/usbdrv/Readme.txt +++ /dev/null @@ -1,158 +0,0 @@ -This is the Readme file to Objective Development's firmware-only USB driver -for Atmel AVR microcontrollers. For more information please visit -http://www.obdev.at/vusb/ - -This directory contains the USB firmware only. Copy it as-is to your own -project and add all .c and .S files to your project (these files are marked -with an asterisk in the list below). Then copy usbconfig-prototype.h as -usbconfig.h to your project and edit it according to your configuration. - - -TECHNICAL DOCUMENTATION -======================= -The technical documentation (API) for the firmware driver is contained in the -file "usbdrv.h". Please read all of it carefully! Configuration options are -documented in "usbconfig-prototype.h". - -The driver consists of the following files: - Readme.txt ............. The file you are currently reading. - Changelog.txt .......... Release notes for all versions of the driver. - usbdrv.h ............... Driver interface definitions and technical docs. -* usbdrv.c ............... High level language part of the driver. Link this - module to your code! -* usbdrvasm.S ............ Assembler part of the driver. This module is mostly - a stub and includes one of the usbdrvasm*.S files - depending on processor clock. Link this module to - your code! - usbdrvasm*.inc ......... Assembler routines for particular clock frequencies. - Included by usbdrvasm.S, don't link it directly! - asmcommon.inc .......... Common assembler routines. Included by - usbdrvasm*.inc, don't link it directly! - usbconfig-prototype.h .. Prototype for your own usbdrv.h file. -* oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is - defined to a value greater than 0. Link this module - to your code! - oddebug.h .............. Interface definitions of the debug module. - usbportability.h ....... Header with compiler-dependent stuff. - usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this - module instead of usbdrvasm.S when you assembler - with IAR's tools. - License.txt ............ Open Source license for this driver. - CommercialLicense.txt .. Optional commercial license for this driver. - USBID-License.txt ...... Terms and conditions for using particular USB ID - values for particular purposes. - -(*) ... These files should be linked to your project. - - -CPU CORE CLOCK FREQUENCY -======================== -We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz, -16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The -actual clock rate must be configured in usbdrv.h unless you use the default -12 MHz. - -12 MHz Clock -This is the traditional clock rate of V-USB because it's the lowest clock -rate where the timing constraints of the USB spec can be met. - -15 MHz Clock -Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock -rate allows for some loops which make the resulting code size somewhat smaller -than the 12 MHz version. - -16 MHz Clock -This clock rate has been added for users of the Arduino board and other -ready-made boards which come with a fixed 16 MHz crystal. It's also an option -if you need the slightly higher clock rate for performance reasons. Since -16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code -is somewhat tricky and has to insert a leap cycle every third byte. - -12.8 MHz and 16.5 MHz Clock -The assembler modules for these clock rates differ from the other modules -because they have been built for an RC oscillator with only 1% precision. The -receiver code inserts leap cycles to compensate for clock deviations. 1% is -also the precision which can be achieved by calibrating the internal RC -oscillator of the AVR. Please note that only AVRs with internal 64 MHz PLL -oscillator can reach 16.5 MHz with the RC oscillator. This includes the very -popular ATTiny25, ATTiny45, ATTiny85 series as well as the ATTiny26. Almost -all AVRs can reach 12.8 MHz, although this is outside the specified range. - -See the EasyLogger example at http://www.obdev.at/vusb/easylogger.html for -code which calibrates the RC oscillator based on the USB frame clock. - -18 MHz Clock -This module is closer to the USB specification because it performs an on the -fly CRC check for incoming packets. Packets with invalid checksum are -discarded as required by the spec. If you also implement checks for data -PID toggling on application level (see option USB_CFG_CHECK_DATA_TOGGLING -in usbconfig.h for more info), this ensures data integrity. Due to the CRC -tables and alignment requirements, this code is bigger than modules for other -clock rates. To activate this module, you must define USB_CFG_CHECK_CRC to 1 -and USB_CFG_CLOCK_KHZ to 18000 in usbconfig.h. - -20 MHz Clock -This module is for people who won't do it with less than the maximum. Since -20 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code -uses similar tricks as the 16 MHz module to insert leap cycles. - - -USB IDENTIFIERS -=============== -Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs -are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you -can assign PIDs at will. - -Since an entry level cost of 1,500 USD is too high for most small companies -and hobbyists, we provide some VID/PID pairs for free. See the file -USBID-License.txt for details. - -Objective Development also has some license offerings which include product -IDs. See http://www.obdev.at/vusb/ for details. - - -DEVELOPMENT SYSTEM -================== -This driver has been developed and optimized for the GNU compiler version 3 -(gcc 3). It does work well with gcc 4, but with bigger code size. We recommend -that you use the GNU compiler suite because it is freely available. V-USB -has also been ported to the IAR compiler and assembler. It has been tested -with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the "small" and "tiny" -memory model. Not every release is tested with IAR CC and the driver may -therefore fail to compile with IAR. Please note that gcc is more efficient for -usbdrv.c because this module has been deliberately optimized for gcc. - - -USING V-USB FOR FREE -==================== -The AVR firmware driver is published under the GNU General Public License -Version 2 (GPL2) and the GNU General Public License Version 3 (GPL3). It is -your choice whether you apply the terms of version 2 or version 3. - -If you decide for the free GPL2 or GPL3, we STRONGLY ENCOURAGE you to do the -following things IN ADDITION to the obligations from the GPL: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/vusb/feedback.html for your submission. -If you don't have a web site, you can publish the project in obdev's -documentation wiki at -http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/vusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - -COMMERCIAL LICENSES FOR V-USB -============================= -If you don't want to publish your source code under the terms of the GPL, -you can simply pay money for V-USB. As an additional benefit you get -USB PIDs for free, reserved exclusively to you. See the file -"CommercialLicense.txt" for details. - diff --git a/tools/vusb/usbdrv/USBID-License.txt b/tools/vusb/usbdrv/USBID-License.txt deleted file mode 100644 index c40be92..0000000 --- a/tools/vusb/usbdrv/USBID-License.txt +++ /dev/null @@ -1,154 +0,0 @@ -Royalty-Free Non-Exclusive Use of USB Product-IDs -================================================= - -Version 2009-04-13 - -Strictly speaking, this is not a license. You can't give a license to use -a simple number (such as e.g. 1500) for any purpose. This is a set of rules -which should make it possible to build USB devices without the requirement -for individual USB IDs. If you break one of the rules, you will run into -technical problems sooner or later, but you don't risk legal trouble. - - -OBJECTIVE DEVELOPMENT Software GmbH hereby grants you the non-exclusive -right to use four USB.org vendor-ID (VID) / product-ID (PID) pairs with -products based on Objective Development's firmware-only USB driver for -Atmel AVR microcontrollers: - - * VID = 5824 (=0x16c0) / PID = 1500 (=0x5dc) for devices implementing no - USB device class (vendor-class devices with USB class = 0xff). Devices - using this pair will be referred to as "VENDOR CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1503 (=0x5df) for HID class devices - (excluding mice and keyboards). Devices using this pair will be referred - to as "HID CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1505 (=0x5e1) for CDC class modem devices - Devices using this pair will be referred to as "CDC-ACM CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1508 (=0x5e4) for MIDI class devices - Devices using this pair will be referred to as "MIDI CLASS" devices. - -Since the granted right is non-exclusive, the same VID/PID pairs may be -used by many companies and individuals for different products. To avoid -conflicts, your device and host driver software MUST adhere to the rules -outlined below. - -OBJECTIVE DEVELOPMENT Software GmbH has obtained these VID/PID pairs from -Wouter van Ooijen (see www.voti.nl) for exclusive disposition. Wouter van -Ooijen has obtained the VID from the USB Implementers Forum, Inc. -(see www.usb.org). The VID is registered for the company name -"Van Ooijen Technische Informatica". - - -RULES AND RESTRICTIONS -====================== - -(1) The USB device MUST provide a textual representation of the -manufacturer and product identification. The manufacturer identification -MUST be available at least in USB language 0x0409 (English/US). - -(2) The textual manufacturer identification MUST contain either an Internet -domain name (e.g. "mycompany.com") registered and owned by you, or an -e-mail address under your control (e.g. "myname@gmx.net"). You can embed -the domain name or e-mail address in any string you like, e.g. "Objective -Development http://www.obdev.at/vusb/". - -(3) You are responsible for retaining ownership of the domain or e-mail -address for as long as any of your products are in use. - -(4) You may choose any string for the textual product identification, as -long as this string is unique within the scope of your textual manufacturer -identification. - -(5) Matching of device-specific drivers MUST be based on the textual -manufacturer and product identification in addition to the usual VID/PID -matching. This means that operating system features which are based on -VID/PID matching only (e.g. Windows kernel level drivers, automatic actions -when the device is plugged in etc) MUST NOT be used. The driver matching -MUST be a comparison of the entire strings, NOT a sub-string match. For -CDC-ACM CLASS and MIDI CLASS devices, a generic class driver should be used -and the matching is based on the USB device class. - -(6) The extent to which VID/PID matching is allowed for non device-specific -drivers or features depends on the operating system and particular VID/PID -pair used: - - * Mac OS X, Linux, FreeBSD and other Unixes: No VID/PID matching is - required and hence no VID/PID-only matching is allowed at all. - - * Windows: The operating system performs VID/PID matching for the kernel - level driver. You are REQUIRED to use libusb-win32 (see - http://libusb-win32.sourceforge.net/) as the kernel level driver for - VENDOR CLASS devices. HID CLASS devices all use the generic HID class - driver shipped with Windows, except mice and keyboards. You therefore - MUST NOT use any of the shared VID/PID pairs for mice or keyboards. - CDC-ACM CLASS devices require a ".inf" file which matches on the VID/PID - pair. This ".inf" file MUST load the "usbser" driver to configure the - device as modem (COM-port). - -(7) OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any -problems which are caused by the shared use of these VID/PID pairs. You -have been warned that the sharing of VID/PID pairs may cause problems. If -you want to avoid them, get your own VID/PID pair for exclusive use. - - -HOW TO IMPLEMENT THESE RULES -============================ - -The following rules are for VENDOR CLASS and HID CLASS devices. CDC-ACM -CLASS and MIDI CLASS devices use the operating system's class driver and -don't need a custom driver. - -The host driver MUST iterate over all devices with the given VID/PID -numbers in their device descriptors and query the string representation for -the manufacturer name in USB language 0x0409 (English/US). It MUST compare -the ENTIRE string with your textual manufacturer identification chosen in -(2) above. A substring search for your domain or e-mail address is NOT -acceptable. The driver MUST NOT touch the device (other than querying the -descriptors) unless the strings match. - -For all USB devices with matching VID/PID and textual manufacturer -identification, the host driver must query the textual product -identification and string-compare it with the name of the product it can -control. It may only initialize the device if the product matches exactly. - -Objective Development provides examples for these matching rules with the -"PowerSwitch" project (using libusb) and with the "Automator" project -(using Windows calls on Windows and libusb on Unix). - - -Technical Notes: -================ - -Sharing the same VID/PID pair among devices is possible as long as ALL -drivers which match the VID/PID also perform matching on the textual -identification strings. This is easy on all operating systems except -Windows, since Windows establishes a static connection between the VID/PID -pair and a kernel level driver. All devices with the same VID/PID pair must -therefore use THE SAME kernel level driver. - -We therefore demand that you use libusb-win32 for VENDOR CLASS devices. -This is a generic kernel level driver which allows all types of USB access -for user space applications. This is only a partial solution of the -problem, though, because different device drivers may come with different -versions of libusb-win32 and they may not work with the libusb version of -the respective other driver. You are therefore encouraged to test your -driver against a broad range of libusb-win32 versions. Do not use new -features in new versions, or check for their existence before you use them. -When a new libusb-win32 becomes available, make sure that your driver is -compatible with it. - -For HID CLASS devices it is necessary that all those devices bind to the -same kernel driver: Microsoft's generic USB HID driver. This is true for -all HID devices except those with a specialized driver. Currently, the only -HIDs with specialized drivers are mice and keyboards. You therefore MUST -NOT use a shared VID/PID with mouse and keyboard devices. - -Sharing the same VID/PID among different products is unusual and probably -violates the USB specification. If you do it, you do it at your own risk. - -To avoid possible incompatibilities, we highly recommend that you get your -own VID/PID pair if you intend to sell your product. Objective -Development's commercial licenses for V-USB include a PID for -unrestricted exclusive use. diff --git a/tools/vusb/usbdrv/asmcommon.inc b/tools/vusb/usbdrv/asmcommon.inc deleted file mode 100644 index 07d692b..0000000 --- a/tools/vusb/usbdrv/asmcommon.inc +++ /dev/null @@ -1,188 +0,0 @@ -/* Name: asmcommon.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2007-11-05 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id$ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file contains assembler code which is shared among the USB driver -implementations for different CPU cocks. Since the code must be inserted -in the middle of the module, it's split out into this file and #included. - -Jump destinations called from outside: - sofError: Called when no start sequence was found. - se0: Called when a package has been successfully received. - overflow: Called when receive buffer overflows. - doReturn: Called after sending data. - -Outside jump destinations used by this module: - waitForJ: Called to receive an already arriving packet. - sendAckAndReti: - sendNakAndReti: - sendCntAndReti: - usbSendAndReti: - -The following macros must be defined before this file is included: - .macro POP_STANDARD - .endm - .macro POP_RETI - .endm -*/ - -#define token x1 - -overflow: - ldi x2, 1< 0 - -#warning "Never compile production devices with debugging enabled" - -static void uartPutc(char c) -{ - while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ - ODDBG_UDR = c; -} - -static uchar hexAscii(uchar h) -{ - h &= 0xf; - if(h >= 10) - h += 'a' - (uchar)10 - '0'; - h += '0'; - return h; -} - -static void printHex(uchar c) -{ - uartPutc(hexAscii(c >> 4)); - uartPutc(hexAscii(c)); -} - -void odDebug(uchar prefix, uchar *data, uchar len) -{ - printHex(prefix); - uartPutc(':'); - while(len--){ - uartPutc(' '); - printHex(*data++); - } - uartPutc('\r'); - uartPutc('\n'); -} - -#endif diff --git a/tools/vusb/usbdrv/oddebug.h b/tools/vusb/usbdrv/oddebug.h deleted file mode 100644 index d61309d..0000000 --- a/tools/vusb/usbdrv/oddebug.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Name: oddebug.h - * Project: AVR library - * Author: Christian Starkjohann - * Creation Date: 2005-01-16 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: oddebug.h 692 2008-11-07 15:07:40Z cs $ - */ - -#ifndef __oddebug_h_included__ -#define __oddebug_h_included__ - -/* -General Description: -This module implements a function for debug logs on the serial line of the -AVR microcontroller. Debugging can be configured with the define -'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging -calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is -2, DBG1 and DBG2 logs will be printed. - -A debug log consists of a label ('prefix') to indicate which debug log created -the output and a memory block to dump in hex ('data' and 'len'). -*/ - - -#ifndef F_CPU -# define F_CPU 12000000 /* 12 MHz */ -#endif - -/* make sure we have the UART defines: */ -#include "usbportability.h" - -#ifndef uchar -# define uchar unsigned char -#endif - -#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */ -# warning "Debugging disabled because device has no UART" -# undef DEBUG_LEVEL -#endif - -#ifndef DEBUG_LEVEL -# define DEBUG_LEVEL 0 -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -# define DBG1(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG1(prefix, data, len) -#endif - -#if DEBUG_LEVEL > 1 -# define DBG2(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG2(prefix, data, len) -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -extern void odDebug(uchar prefix, uchar *data, uchar len); - -/* Try to find our control registers; ATMEL likes to rename these */ - -#if defined UBRR -# define ODDBG_UBRR UBRR -#elif defined UBRRL -# define ODDBG_UBRR UBRRL -#elif defined UBRR0 -# define ODDBG_UBRR UBRR0 -#elif defined UBRR0L -# define ODDBG_UBRR UBRR0L -#endif - -#if defined UCR -# define ODDBG_UCR UCR -#elif defined UCSRB -# define ODDBG_UCR UCSRB -#elif defined UCSR0B -# define ODDBG_UCR UCSR0B -#endif - -#if defined TXEN -# define ODDBG_TXEN TXEN -#else -# define ODDBG_TXEN TXEN0 -#endif - -#if defined USR -# define ODDBG_USR USR -#elif defined UCSRA -# define ODDBG_USR UCSRA -#elif defined UCSR0A -# define ODDBG_USR UCSR0A -#endif - -#if defined UDRE -# define ODDBG_UDRE UDRE -#else -# define ODDBG_UDRE UDRE0 -#endif - -#if defined UDR -# define ODDBG_UDR UDR -#elif defined UDR0 -# define ODDBG_UDR UDR0 -#endif - -static inline void odDebugInit(void) -{ - ODDBG_UCR |= (1<len & 0x10){ /* packet buffer was empty */ - txStatus->buffer[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* toggle token */ - }else{ - txStatus->len = USBPID_NAK; /* avoid sending outdated (overwritten) interrupt data */ - } - p = txStatus->buffer + 1; - i = len; - do{ /* if len == 0, we still copy 1 byte, but that's no problem */ - *p++ = *data++; - }while(--i > 0); /* loop control at the end is 2 bytes shorter than at beginning */ - usbCrc16Append(&txStatus->buffer[1], len); - txStatus->len = len + 4; /* len must be given including sync byte */ - DBG2(0x21 + (((int)txStatus >> 3) & 3), txStatus->buffer, len + 3); -} - -USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len) -{ - usbGenericSetInterrupt(data, len, &usbTxStatus1); -} -#endif - -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 -USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len) -{ - usbGenericSetInterrupt(data, len, &usbTxStatus3); -} -#endif -#endif /* USB_CFG_SUPPRESS_INTR_CODE */ - -/* ------------------ utilities for code following below ------------------- */ - -/* Use defines for the switch statement so that we can choose between an - * if()else if() and a switch/case based implementation. switch() is more - * efficient for a LARGE set of sequential choices, if() is better in all other - * cases. - */ -#if USB_CFG_USE_SWITCH_STATEMENT -# define SWITCH_START(cmd) switch(cmd){{ -# define SWITCH_CASE(value) }break; case (value):{ -# define SWITCH_CASE2(v1,v2) }break; case (v1): case(v2):{ -# define SWITCH_CASE3(v1,v2,v3) }break; case (v1): case(v2): case(v3):{ -# define SWITCH_DEFAULT }break; default:{ -# define SWITCH_END }} -#else -# define SWITCH_START(cmd) {uchar _cmd = cmd; if(0){ -# define SWITCH_CASE(value) }else if(_cmd == (value)){ -# define SWITCH_CASE2(v1,v2) }else if(_cmd == (v1) || _cmd == (v2)){ -# define SWITCH_CASE3(v1,v2,v3) }else if(_cmd == (v1) || _cmd == (v2) || (_cmd == v3)){ -# define SWITCH_DEFAULT }else{ -# define SWITCH_END }} -#endif - -#ifndef USB_RX_USER_HOOK -#define USB_RX_USER_HOOK(data, len) -#endif -#ifndef USB_SET_ADDRESS_HOOK -#define USB_SET_ADDRESS_HOOK() -#endif - -/* ------------------------------------------------------------------------- */ - -/* We use if() instead of #if in the macro below because #if can't be used - * in macros and the compiler optimizes constant conditions anyway. - * This may cause problems with undefined symbols if compiled without - * optimizing! - */ -#define GET_DESCRIPTOR(cfgProp, staticName) \ - if(cfgProp){ \ - if((cfgProp) & USB_PROP_IS_RAM) \ - flags = 0; \ - if((cfgProp) & USB_PROP_IS_DYNAMIC){ \ - len = usbFunctionDescriptor(rq); \ - }else{ \ - len = USB_PROP_LENGTH(cfgProp); \ - usbMsgPtr = (uchar *)(staticName); \ - } \ - } - -/* usbDriverDescriptor() is similar to usbFunctionDescriptor(), but used - * internally for all types of descriptors. - */ -static inline usbMsgLen_t usbDriverDescriptor(usbRequest_t *rq) -{ -usbMsgLen_t len = 0; -uchar flags = USB_FLG_MSGPTR_IS_ROM; - - SWITCH_START(rq->wValue.bytes[1]) - SWITCH_CASE(USBDESCR_DEVICE) /* 1 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_DEVICE, usbDescriptorDevice) - SWITCH_CASE(USBDESCR_CONFIG) /* 2 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_CONFIGURATION, usbDescriptorConfiguration) - SWITCH_CASE(USBDESCR_STRING) /* 3 */ -#if USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC - if(USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_RAM) - flags = 0; - len = usbFunctionDescriptor(rq); -#else /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ - SWITCH_START(rq->wValue.bytes[0]) - SWITCH_CASE(0) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_0, usbDescriptorString0) - SWITCH_CASE(1) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_VENDOR, usbDescriptorStringVendor) - SWITCH_CASE(2) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_PRODUCT, usbDescriptorStringDevice) - SWITCH_CASE(3) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER, usbDescriptorStringSerialNumber) - SWITCH_DEFAULT - if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ - len = usbFunctionDescriptor(rq); - } - SWITCH_END -#endif /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ -#if USB_CFG_DESCR_PROPS_HID_REPORT /* only support HID descriptors if enabled */ - SWITCH_CASE(USBDESCR_HID) /* 0x21 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID, usbDescriptorConfiguration + 18) - SWITCH_CASE(USBDESCR_HID_REPORT)/* 0x22 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID_REPORT, usbDescriptorHidReport) -#endif - SWITCH_DEFAULT - if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ - len = usbFunctionDescriptor(rq); - } - SWITCH_END - usbMsgFlags = flags; - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbDriverSetup() is similar to usbFunctionSetup(), but it's used for - * standard requests instead of class and custom requests. - */ -static inline usbMsgLen_t usbDriverSetup(usbRequest_t *rq) -{ -uchar len = 0, *dataPtr = usbTxBuf + 9; /* there are 2 bytes free space at the end of the buffer */ -uchar value = rq->wValue.bytes[0]; -#if USB_CFG_IMPLEMENT_HALT -uchar index = rq->wIndex.bytes[0]; -#endif - - dataPtr[0] = 0; /* default reply common to USBRQ_GET_STATUS and USBRQ_GET_INTERFACE */ - SWITCH_START(rq->bRequest) - SWITCH_CASE(USBRQ_GET_STATUS) /* 0 */ - uchar recipient = rq->bmRequestType & USBRQ_RCPT_MASK; /* assign arith ops to variables to enforce byte size */ - if(USB_CFG_IS_SELF_POWERED && recipient == USBRQ_RCPT_DEVICE) - dataPtr[0] = USB_CFG_IS_SELF_POWERED; -#if USB_CFG_IMPLEMENT_HALT - if(recipient == USBRQ_RCPT_ENDPOINT && index == 0x81) /* request status for endpoint 1 */ - dataPtr[0] = usbTxLen1 == USBPID_STALL; -#endif - dataPtr[1] = 0; - len = 2; -#if USB_CFG_IMPLEMENT_HALT - SWITCH_CASE2(USBRQ_CLEAR_FEATURE, USBRQ_SET_FEATURE) /* 1, 3 */ - if(value == 0 && index == 0x81){ /* feature 0 == HALT for endpoint == 1 */ - usbTxLen1 = rq->bRequest == USBRQ_CLEAR_FEATURE ? USBPID_NAK : USBPID_STALL; - usbResetDataToggling(); - } -#endif - SWITCH_CASE(USBRQ_SET_ADDRESS) /* 5 */ - usbNewDeviceAddr = value; - USB_SET_ADDRESS_HOOK(); - SWITCH_CASE(USBRQ_GET_DESCRIPTOR) /* 6 */ - len = usbDriverDescriptor(rq); - goto skipMsgPtrAssignment; - SWITCH_CASE(USBRQ_GET_CONFIGURATION) /* 8 */ - dataPtr = &usbConfiguration; /* send current configuration value */ - len = 1; - SWITCH_CASE(USBRQ_SET_CONFIGURATION) /* 9 */ - usbConfiguration = value; - usbResetStall(); - SWITCH_CASE(USBRQ_GET_INTERFACE) /* 10 */ - len = 1; -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE - SWITCH_CASE(USBRQ_SET_INTERFACE) /* 11 */ - usbResetDataToggling(); - usbResetStall(); -#endif - SWITCH_DEFAULT /* 7=SET_DESCRIPTOR, 12=SYNC_FRAME */ - /* Should we add an optional hook here? */ - SWITCH_END - usbMsgPtr = dataPtr; -skipMsgPtrAssignment: - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbProcessRx() is called for every message received by the interrupt - * routine. It distinguishes between SETUP and DATA packets and processes - * them accordingly. - */ -static inline void usbProcessRx(uchar *data, uchar len) -{ -usbRequest_t *rq = (void *)data; - -/* usbRxToken can be: - * 0x2d 00101101 (USBPID_SETUP for setup data) - * 0xe1 11100001 (USBPID_OUT: data phase of setup transfer) - * 0...0x0f for OUT on endpoint X - */ - DBG2(0x10 + (usbRxToken & 0xf), data, len + 2); /* SETUP=1d, SETUP-DATA=11, OUTx=1x */ - USB_RX_USER_HOOK(data, len) -#if USB_CFG_IMPLEMENT_FN_WRITEOUT - if(usbRxToken < 0x10){ /* OUT to endpoint != 0: endpoint number in usbRxToken */ - usbFunctionWriteOut(data, len); - return; - } -#endif - if(usbRxToken == (uchar)USBPID_SETUP){ - if(len != 8) /* Setup size must be always 8 bytes. Ignore otherwise. */ - return; - usbMsgLen_t replyLen; - usbTxBuf[0] = USBPID_DATA0; /* initialize data toggling */ - usbTxLen = USBPID_NAK; /* abort pending transmit */ - usbMsgFlags = 0; - uchar type = rq->bmRequestType & USBRQ_TYPE_MASK; - if(type != USBRQ_TYPE_STANDARD){ /* standard requests are handled by driver */ - replyLen = usbFunctionSetup(data); - }else{ - replyLen = usbDriverSetup(rq); - } -#if USB_CFG_IMPLEMENT_FN_READ || USB_CFG_IMPLEMENT_FN_WRITE - if(replyLen == USB_NO_MSG){ /* use user-supplied read/write function */ - /* do some conditioning on replyLen, but on IN transfers only */ - if((rq->bmRequestType & USBRQ_DIR_MASK) != USBRQ_DIR_HOST_TO_DEVICE){ - if(sizeof(replyLen) < sizeof(rq->wLength.word)){ /* help compiler with optimizing */ - replyLen = rq->wLength.bytes[0]; - }else{ - replyLen = rq->wLength.word; - } - } - usbMsgFlags = USB_FLG_USE_USER_RW; - }else /* The 'else' prevents that we limit a replyLen of USB_NO_MSG to the maximum transfer len. */ -#endif - if(sizeof(replyLen) < sizeof(rq->wLength.word)){ /* help compiler with optimizing */ - if(!rq->wLength.bytes[1] && replyLen > rq->wLength.bytes[0]) /* limit length to max */ - replyLen = rq->wLength.bytes[0]; - }else{ - if(replyLen > rq->wLength.word) /* limit length to max */ - replyLen = rq->wLength.word; - } - usbMsgLen = replyLen; - }else{ /* usbRxToken must be USBPID_OUT, which means data phase of setup (control-out) */ -#if USB_CFG_IMPLEMENT_FN_WRITE - if(usbMsgFlags & USB_FLG_USE_USER_RW){ - uchar rval = usbFunctionWrite(data, len); - if(rval == 0xff){ /* an error occurred */ - usbTxLen = USBPID_STALL; - }else if(rval != 0){ /* This was the final package */ - usbMsgLen = 0; /* answer with a zero-sized data packet */ - } - } -#endif - } -} - -/* ------------------------------------------------------------------------- */ - -/* This function is similar to usbFunctionRead(), but it's also called for - * data handled automatically by the driver (e.g. descriptor reads). - */ -static uchar usbDeviceRead(uchar *data, uchar len) -{ - if(len > 0){ /* don't bother app with 0 sized reads */ -#if USB_CFG_IMPLEMENT_FN_READ - if(usbMsgFlags & USB_FLG_USE_USER_RW){ - len = usbFunctionRead(data, len); - }else -#endif - { - uchar i = len, *r = usbMsgPtr; - if(usbMsgFlags & USB_FLG_MSGPTR_IS_ROM){ /* ROM data */ - do{ - uchar c = USB_READ_FLASH(r); /* assign to char size variable to enforce byte ops */ - *data++ = c; - r++; - }while(--i); - }else{ /* RAM data */ - do{ - *data++ = *r++; - }while(--i); - } - usbMsgPtr = r; - } - } - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbBuildTxBlock() is called when we have data to transmit and the - * interrupt routine's transmit buffer is empty. - */ -static inline void usbBuildTxBlock(void) -{ -usbMsgLen_t wantLen; -uchar len; - - wantLen = usbMsgLen; - if(wantLen > 8) - wantLen = 8; - usbMsgLen -= wantLen; - usbTxBuf[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* DATA toggling */ - len = usbDeviceRead(usbTxBuf + 1, wantLen); - if(len <= 8){ /* valid data packet */ - usbCrc16Append(&usbTxBuf[1], len); - len += 4; /* length including sync byte */ - if(len < 12) /* a partial package identifies end of message */ - usbMsgLen = USB_NO_MSG; - }else{ - len = USBPID_STALL; /* stall the endpoint */ - usbMsgLen = USB_NO_MSG; - } - usbTxLen = len; - DBG2(0x20, usbTxBuf, len-1); -} - -/* ------------------------------------------------------------------------- */ - -static inline void usbHandleResetHook(uchar notResetState) -{ -#ifdef USB_RESET_HOOK -static uchar wasReset; -uchar isReset = !notResetState; - - if(wasReset != isReset){ - USB_RESET_HOOK(isReset); - wasReset = isReset; - } -#endif -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbPoll(void) -{ -schar len; -uchar i; - - len = usbRxLen - 3; - if(len >= 0){ -/* We could check CRC16 here -- but ACK has already been sent anyway. If you - * need data integrity checks with this driver, check the CRC in your app - * code and report errors back to the host. Since the ACK was already sent, - * retries must be handled on application level. - * unsigned crc = usbCrc16(buffer + 1, usbRxLen - 3); - */ - usbProcessRx(usbRxBuf + USB_BUFSIZE + 1 - usbInputBufOffset, len); -#if USB_CFG_HAVE_FLOWCONTROL - if(usbRxLen > 0) /* only mark as available if not inactivated */ - usbRxLen = 0; -#else - usbRxLen = 0; /* mark rx buffer as available */ -#endif - } - if(usbTxLen & 0x10){ /* transmit system idle */ - if(usbMsgLen != USB_NO_MSG){ /* transmit data pending? */ - usbBuildTxBlock(); - } - } - for(i = 20; i > 0; i--){ - uchar usbLineStatus = USBIN & USBMASK; - if(usbLineStatus != 0) /* SE0 has ended */ - goto isNotReset; - } - /* RESET condition, called multiple times during reset */ - usbNewDeviceAddr = 0; - usbDeviceAddr = 0; - usbResetStall(); - DBG1(0xff, 0, 0); -isNotReset: - usbHandleResetHook(i); -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbInit(void) -{ -#if USB_INTR_CFG_SET != 0 - USB_INTR_CFG |= USB_INTR_CFG_SET; -#endif -#if USB_INTR_CFG_CLR != 0 - USB_INTR_CFG &= ~(USB_INTR_CFG_CLR); -#endif - USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT); - usbResetDataToggling(); -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE - usbTxLen1 = USBPID_NAK; -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 - usbTxLen3 = USBPID_NAK; -#endif -#endif -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/vusb/usbdrv/usbdrv.h b/tools/vusb/usbdrv/usbdrv.h deleted file mode 100644 index c0fb569..0000000 --- a/tools/vusb/usbdrv/usbdrv.h +++ /dev/null @@ -1,733 +0,0 @@ -/* Name: usbdrv.h - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2004-12-29 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrv.h 748 2009-04-15 15:05:07Z cs $ - */ - -#ifndef __usbdrv_h_included__ -#define __usbdrv_h_included__ -#include "usbconfig.h" -#include "usbportability.h" - -/* -Hardware Prerequisites: -======================= -USB lines D+ and D- MUST be wired to the same I/O port. We recommend that D+ -triggers the interrupt (best achieved by using INT0 for D+), but it is also -possible to trigger the interrupt from D-. If D- is used, interrupts are also -triggered by SOF packets. D- requires a pull-up of 1.5k to +3.5V (and the -device must be powered at 3.5V) to identify as low-speed USB device. A -pull-down or pull-up of 1M SHOULD be connected from D+ to +3.5V to prevent -interference when no USB master is connected. If you use Zener diodes to limit -the voltage on D+ and D-, you MUST use a pull-down resistor, not a pull-up. -We use D+ as interrupt source and not D- because it does not trigger on -keep-alive and RESET states. If you want to count keep-alive events with -USB_COUNT_SOF, you MUST use D- as an interrupt source. - -As a compile time option, the 1.5k pull-up resistor on D- can be made -switchable to allow the device to disconnect at will. See the definition of -usbDeviceConnect() and usbDeviceDisconnect() further down in this file. - -Please adapt the values in usbconfig.h according to your hardware! - -The device MUST be clocked at exactly 12 MHz, 15 MHz, 16 MHz or 20 MHz -or at 12.8 MHz resp. 16.5 MHz +/- 1%. See usbconfig-prototype.h for details. - - -Limitations: -============ -Robustness with respect to communication errors: -The driver assumes error-free communication. It DOES check for errors in -the PID, but does NOT check bit stuffing errors, SE0 in middle of a byte, -token CRC (5 bit) and data CRC (16 bit). CRC checks can not be performed due -to timing constraints: We must start sending a reply within 7 bit times. -Bit stuffing and misplaced SE0 would have to be checked in real-time, but CPU -performance does not permit that. The driver does not check Data0/Data1 -toggling, but application software can implement the check. - -Input characteristics: -Since no differential receiver circuit is used, electrical interference -robustness may suffer. The driver samples only one of the data lines with -an ordinary I/O pin's input characteristics. However, since this is only a -low speed USB implementation and the specification allows for 8 times the -bit rate over the same hardware, we should be on the safe side. Even the spec -requires detection of asymmetric states at high bit rate for SE0 detection. - -Number of endpoints: -The driver supports the following endpoints: - -- Endpoint 0, the default control endpoint. -- Any number of interrupt- or bulk-out endpoints. The data is sent to - usbFunctionWriteOut() and USB_CFG_IMPLEMENT_FN_WRITEOUT must be defined - to 1 to activate this feature. The endpoint number can be found in the - global variable 'usbRxToken'. -- One default interrupt- or bulk-in endpoint. This endpoint is used for - interrupt- or bulk-in transfers which are not handled by any other endpoint. - You must define USB_CFG_HAVE_INTRIN_ENDPOINT in order to activate this - feature and call usbSetInterrupt() to send interrupt/bulk data. -- One additional interrupt- or bulk-in endpoint. This was endpoint 3 in - previous versions of this driver but can now be configured to any endpoint - number. You must define USB_CFG_HAVE_INTRIN_ENDPOINT3 in order to activate - this feature and call usbSetInterrupt3() to send interrupt/bulk data. The - endpoint number can be set with USB_CFG_EP3_NUMBER. - -Please note that the USB standard forbids bulk endpoints for low speed devices! -Most operating systems allow them anyway, but the AVR will spend 90% of the CPU -time in the USB interrupt polling for bulk data. - -Maximum data payload: -Data payload of control in and out transfers may be up to 254 bytes. In order -to accept payload data of out transfers, you need to implement -'usbFunctionWrite()'. - -USB Suspend Mode supply current: -The USB standard limits power consumption to 500uA when the bus is in suspend -mode. This is not a problem for self-powered devices since they don't need -bus power anyway. Bus-powered devices can achieve this only by putting the -CPU in sleep mode. The driver does not implement suspend handling by itself. -However, the application may implement activity monitoring and wakeup from -sleep. The host sends regular SE0 states on the bus to keep it active. These -SE0 states can be detected by using D- as the interrupt source. Define -USB_COUNT_SOF to 1 and use the global variable usbSofCount to check for bus -activity. - -Operation without an USB master: -The driver behaves neutral without connection to an USB master if D- reads -as 1. To avoid spurious interrupts, we recommend a high impedance (e.g. 1M) -pull-down or pull-up resistor on D+ (interrupt). If Zener diodes are used, -use a pull-down. If D- becomes statically 0, the driver may block in the -interrupt routine. - -Interrupt latency: -The application must ensure that the USB interrupt is not disabled for more -than 25 cycles (this is for 12 MHz, faster clocks allow longer latency). -This implies that all interrupt routines must either be declared as "INTERRUPT" -instead of "SIGNAL" (see "avr/signal.h") or that they are written in assembler -with "sei" as the first instruction. - -Maximum interrupt duration / CPU cycle consumption: -The driver handles all USB communication during the interrupt service -routine. The routine will not return before an entire USB message is received -and the reply is sent. This may be up to ca. 1200 cycles @ 12 MHz (= 100us) if -the host conforms to the standard. The driver will consume CPU cycles for all -USB messages, even if they address another (low-speed) device on the same bus. - -*/ - -/* ------------------------------------------------------------------------- */ -/* --------------------------- Module Interface ---------------------------- */ -/* ------------------------------------------------------------------------- */ - -#define USBDRV_VERSION 20090415 -/* This define uniquely identifies a driver version. It is a decimal number - * constructed from the driver's release date in the form YYYYMMDD. If the - * driver's behavior or interface changes, you can use this constant to - * distinguish versions. If it is not defined, the driver's release date is - * older than 2006-01-25. - */ - - -#ifndef USB_PUBLIC -#define USB_PUBLIC -#endif -/* USB_PUBLIC is used as declaration attribute for all functions exported by - * the USB driver. The default is no attribute (see above). You may define it - * to static either in usbconfig.h or from the command line if you include - * usbdrv.c instead of linking against it. Including the C module of the driver - * directly in your code saves a couple of bytes in flash memory. - */ - -#ifndef __ASSEMBLER__ -#ifndef uchar -#define uchar unsigned char -#endif -#ifndef schar -#define schar signed char -#endif -/* shortcuts for well defined 8 bit integer types */ - -#if USB_CFG_LONG_TRANSFERS /* if more than 254 bytes transfer size required */ -# define usbMsgLen_t unsigned -#else -# define usbMsgLen_t uchar -#endif -/* usbMsgLen_t is the data type used for transfer lengths. By default, it is - * defined to uchar, allowing a maximum of 254 bytes (255 is reserved for - * USB_NO_MSG below). If the usbconfig.h defines USB_CFG_LONG_TRANSFERS to 1, - * a 16 bit data type is used, allowing up to 16384 bytes (the rest is used - * for flags in the descriptor configuration). - */ -#define USB_NO_MSG ((usbMsgLen_t)-1) /* constant meaning "no message" */ - -struct usbRequest; /* forward declaration */ - -USB_PUBLIC void usbInit(void); -/* This function must be called before interrupts are enabled and the main - * loop is entered. - */ -USB_PUBLIC void usbPoll(void); -/* This function must be called at regular intervals from the main loop. - * Maximum delay between calls is somewhat less than 50ms (USB timeout for - * accepting a Setup message). Otherwise the device will not be recognized. - * Please note that debug outputs through the UART take ~ 0.5ms per byte - * at 19200 bps. - */ -extern uchar *usbMsgPtr; -/* This variable may be used to pass transmit data to the driver from the - * implementation of usbFunctionWrite(). It is also used internally by the - * driver for standard control requests. - */ -USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]); -/* This function is called when the driver receives a SETUP transaction from - * the host which is not answered by the driver itself (in practice: class and - * vendor requests). All control transfers start with a SETUP transaction where - * the host communicates the parameters of the following (optional) data - * transfer. The SETUP data is available in the 'data' parameter which can - * (and should) be casted to 'usbRequest_t *' for a more user-friendly access - * to parameters. - * - * If the SETUP indicates a control-in transfer, you should provide the - * requested data to the driver. There are two ways to transfer this data: - * (1) Set the global pointer 'usbMsgPtr' to the base of the static RAM data - * block and return the length of the data in 'usbFunctionSetup()'. The driver - * will handle the rest. Or (2) return USB_NO_MSG in 'usbFunctionSetup()'. The - * driver will then call 'usbFunctionRead()' when data is needed. See the - * documentation for usbFunctionRead() for details. - * - * If the SETUP indicates a control-out transfer, the only way to receive the - * data from the host is through the 'usbFunctionWrite()' call. If you - * implement this function, you must return USB_NO_MSG in 'usbFunctionSetup()' - * to indicate that 'usbFunctionWrite()' should be used. See the documentation - * of this function for more information. If you just want to ignore the data - * sent by the host, return 0 in 'usbFunctionSetup()'. - * - * Note that calls to the functions usbFunctionRead() and usbFunctionWrite() - * are only done if enabled by the configuration in usbconfig.h. - */ -USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq); -/* You need to implement this function ONLY if you provide USB descriptors at - * runtime (which is an expert feature). It is very similar to - * usbFunctionSetup() above, but it is called only to request USB descriptor - * data. See the documentation of usbFunctionSetup() above for more info. - */ -#if USB_CFG_HAVE_INTRIN_ENDPOINT -USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len); -/* This function sets the message which will be sent during the next interrupt - * IN transfer. The message is copied to an internal buffer and must not exceed - * a length of 8 bytes. The message may be 0 bytes long just to indicate the - * interrupt status to the host. - * If you need to transfer more bytes, use a control read after the interrupt. - */ -#define usbInterruptIsReady() (usbTxLen1 & 0x10) -/* This macro indicates whether the last interrupt message has already been - * sent. If you set a new interrupt message before the old was sent, the - * message already buffered will be lost. - */ -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 -USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len); -#define usbInterruptIsReady3() (usbTxLen3 & 0x10) -/* Same as above for endpoint 3 */ -#endif -#endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */ -#if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */ -#define usbHidReportDescriptor usbDescriptorHidReport -/* should be declared as: PROGMEM char usbHidReportDescriptor[]; */ -/* If you implement an HID device, you need to provide a report descriptor. - * The HID report descriptor syntax is a bit complex. If you understand how - * report descriptors are constructed, we recommend that you use the HID - * Descriptor Tool from usb.org, see http://www.usb.org/developers/hidpage/. - * Otherwise you should probably start with a working example. - */ -#endif /* USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH */ -#if USB_CFG_IMPLEMENT_FN_WRITE -USB_PUBLIC uchar usbFunctionWrite(uchar *data, uchar len); -/* This function is called by the driver to provide a control transfer's - * payload data (control-out). It is called in chunks of up to 8 bytes. The - * total count provided in the current control transfer can be obtained from - * the 'length' property in the setup data. If an error occurred during - * processing, return 0xff (== -1). The driver will answer the entire transfer - * with a STALL token in this case. If you have received the entire payload - * successfully, return 1. If you expect more data, return 0. If you don't - * know whether the host will send more data (you should know, the total is - * provided in the usbFunctionSetup() call!), return 1. - * NOTE: If you return 0xff for STALL, 'usbFunctionWrite()' may still be called - * for the remaining data. You must continue to return 0xff for STALL in these - * calls. - * In order to get usbFunctionWrite() called, define USB_CFG_IMPLEMENT_FN_WRITE - * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. - */ -#endif /* USB_CFG_IMPLEMENT_FN_WRITE */ -#if USB_CFG_IMPLEMENT_FN_READ -USB_PUBLIC uchar usbFunctionRead(uchar *data, uchar len); -/* This function is called by the driver to ask the application for a control - * transfer's payload data (control-in). It is called in chunks of up to 8 - * bytes each. You should copy the data to the location given by 'data' and - * return the actual number of bytes copied. If you return less than requested, - * the control-in transfer is terminated. If you return 0xff, the driver aborts - * the transfer with a STALL token. - * In order to get usbFunctionRead() called, define USB_CFG_IMPLEMENT_FN_READ - * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. - */ -#endif /* USB_CFG_IMPLEMENT_FN_READ */ - -extern uchar usbRxToken; /* may be used in usbFunctionWriteOut() below */ -#if USB_CFG_IMPLEMENT_FN_WRITEOUT -USB_PUBLIC void usbFunctionWriteOut(uchar *data, uchar len); -/* This function is called by the driver when data is received on an interrupt- - * or bulk-out endpoint. The endpoint number can be found in the global - * variable usbRxToken. You must define USB_CFG_IMPLEMENT_FN_WRITEOUT to 1 in - * usbconfig.h to get this function called. - */ -#endif /* USB_CFG_IMPLEMENT_FN_WRITEOUT */ -#ifdef USB_CFG_PULLUP_IOPORTNAME -#define usbDeviceConnect() ((USB_PULLUP_DDR |= (1<device, 1=device->host - * t ..... type: 0=standard, 1=class, 2=vendor, 3=reserved - * r ..... recipient: 0=device, 1=interface, 2=endpoint, 3=other - */ - -/* USB setup recipient values */ -#define USBRQ_RCPT_MASK 0x1f -#define USBRQ_RCPT_DEVICE 0 -#define USBRQ_RCPT_INTERFACE 1 -#define USBRQ_RCPT_ENDPOINT 2 - -/* USB request type values */ -#define USBRQ_TYPE_MASK 0x60 -#define USBRQ_TYPE_STANDARD (0<<5) -#define USBRQ_TYPE_CLASS (1<<5) -#define USBRQ_TYPE_VENDOR (2<<5) - -/* USB direction values: */ -#define USBRQ_DIR_MASK 0x80 -#define USBRQ_DIR_HOST_TO_DEVICE (0<<7) -#define USBRQ_DIR_DEVICE_TO_HOST (1<<7) - -/* USB Standard Requests */ -#define USBRQ_GET_STATUS 0 -#define USBRQ_CLEAR_FEATURE 1 -#define USBRQ_SET_FEATURE 3 -#define USBRQ_SET_ADDRESS 5 -#define USBRQ_GET_DESCRIPTOR 6 -#define USBRQ_SET_DESCRIPTOR 7 -#define USBRQ_GET_CONFIGURATION 8 -#define USBRQ_SET_CONFIGURATION 9 -#define USBRQ_GET_INTERFACE 10 -#define USBRQ_SET_INTERFACE 11 -#define USBRQ_SYNCH_FRAME 12 - -/* USB descriptor constants */ -#define USBDESCR_DEVICE 1 -#define USBDESCR_CONFIG 2 -#define USBDESCR_STRING 3 -#define USBDESCR_INTERFACE 4 -#define USBDESCR_ENDPOINT 5 -#define USBDESCR_HID 0x21 -#define USBDESCR_HID_REPORT 0x22 -#define USBDESCR_HID_PHYS 0x23 - -#define USBATTR_BUSPOWER 0x80 -#define USBATTR_SELFPOWER 0x40 -#define USBATTR_REMOTEWAKE 0x20 - -/* USB HID Requests */ -#define USBRQ_HID_GET_REPORT 0x01 -#define USBRQ_HID_GET_IDLE 0x02 -#define USBRQ_HID_GET_PROTOCOL 0x03 -#define USBRQ_HID_SET_REPORT 0x09 -#define USBRQ_HID_SET_IDLE 0x0a -#define USBRQ_HID_SET_PROTOCOL 0x0b - -/* ------------------------------------------------------------------------- */ - -#endif /* __usbdrv_h_included__ */ diff --git a/tools/vusb/usbdrv/usbdrvasm.S b/tools/vusb/usbdrv/usbdrvasm.S deleted file mode 100644 index 84121be..0000000 --- a/tools/vusb/usbdrv/usbdrvasm.S +++ /dev/null @@ -1,305 +0,0 @@ -/* Name: usbdrvasm.S - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2007-06-13 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm.S 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -This module is the assembler part of the USB driver. This file contains -general code (preprocessor acrobatics and CRC computation) and then includes -the file appropriate for the given clock rate. -*/ - -#define __SFR_OFFSET 0 /* used by avr-libc's register definitions */ -#include "usbportability.h" -#include "usbdrv.h" /* for common defs */ - -/* register names */ -#define x1 r16 -#define x2 r17 -#define shift r18 -#define cnt r19 -#define x3 r20 -#define x4 r21 -#define x5 r22 -#define bitcnt x5 -#define phase x4 -#define leap x4 - -/* Some assembler dependent definitions and declarations: */ - -#ifdef __IAR_SYSTEMS_ASM__ - extern usbRxBuf, usbDeviceAddr, usbNewDeviceAddr, usbInputBufOffset - extern usbCurrentTok, usbRxLen, usbRxToken, usbTxLen - extern usbTxBuf, usbTxStatus1, usbTxStatus3 -# if USB_COUNT_SOF - extern usbSofCount -# endif - public usbCrc16 - public usbCrc16Append - - COMMON INTVEC -# ifndef USB_INTR_VECTOR - ORG INT0_vect -# else /* USB_INTR_VECTOR */ - ORG USB_INTR_VECTOR -# undef USB_INTR_VECTOR -# endif /* USB_INTR_VECTOR */ -# define USB_INTR_VECTOR usbInterruptHandler - rjmp USB_INTR_VECTOR - RSEG CODE - -#else /* __IAR_SYSTEMS_ASM__ */ - -# ifndef USB_INTR_VECTOR /* default to hardware interrupt INT0 */ -# define USB_INTR_VECTOR SIG_INTERRUPT0 -# endif - .text - .global USB_INTR_VECTOR - .type USB_INTR_VECTOR, @function - .global usbCrc16 - .global usbCrc16Append -#endif /* __IAR_SYSTEMS_ASM__ */ - - -#if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */ -# define USB_LOAD_PENDING(reg) in reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) out USB_INTR_PENDING, reg -#else /* It's a memory address, use lds and sts */ -# define USB_LOAD_PENDING(reg) lds reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) sts USB_INTR_PENDING, reg -#endif - -#define usbTxLen1 usbTxStatus1 -#define usbTxBuf1 (usbTxStatus1 + 1) -#define usbTxLen3 usbTxStatus3 -#define usbTxBuf3 (usbTxStatus3 + 1) - - -;---------------------------------------------------------------------------- -; Utility functions -;---------------------------------------------------------------------------- - -#ifdef __IAR_SYSTEMS_ASM__ -/* Register assignments for usbCrc16 on IAR cc */ -/* Calling conventions on IAR: - * First parameter passed in r16/r17, second in r18/r19 and so on. - * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) - * Result is passed in r16/r17 - * In case of the "tiny" memory model, pointers are only 8 bit with no - * padding. We therefore pass argument 1 as "16 bit unsigned". - */ -RTMODEL "__rt_version", "3" -/* The line above will generate an error if cc calling conventions change. - * The value "3" above is valid for IAR 4.10B/W32 - */ -# define argLen r18 /* argument 2 */ -# define argPtrL r16 /* argument 1 */ -# define argPtrH r17 /* argument 1 */ - -# define resCrcL r16 /* result */ -# define resCrcH r17 /* result */ - -# define ptrL ZL -# define ptrH ZH -# define ptr Z -# define byte r22 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#else /* __IAR_SYSTEMS_ASM__ */ -/* Register assignments for usbCrc16 on gcc */ -/* Calling conventions on gcc: - * First parameter passed in r24/r25, second in r22/23 and so on. - * Callee must preserve r1-r17, r28/r29 - * Result is passed in r24/r25 - */ -# define argLen r22 /* argument 2 */ -# define argPtrL r24 /* argument 1 */ -# define argPtrH r25 /* argument 1 */ - -# define resCrcL r24 /* result */ -# define resCrcH r25 /* result */ - -# define ptrL XL -# define ptrH XH -# define ptr x -# define byte r18 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#endif - -; extern unsigned usbCrc16(unsigned char *data, unsigned char len); -; data: r24/25 -; len: r22 -; temp variables: -; r18: data byte -; r19: bit counter -; r20/21: polynomial -; r23: scratch -; r24/25: crc-sum -; r26/27=X: ptr -usbCrc16: - mov ptrL, argPtrL - mov ptrH, argPtrH - ldi resCrcL, 0 - ldi resCrcH, 0 - ldi polyL, lo8(0xa001) - ldi polyH, hi8(0xa001) - com argLen ; argLen = -argLen - 1 -crcByteLoop: - subi argLen, -1 - brcc crcReady ; modified loop to ensure that carry is set below - ld byte, ptr+ - ldi bitCnt, -8 ; strange loop counter to ensure that carry is set where we need it - eor resCrcL, byte -crcBitLoop: - ror resCrcH ; carry is always set here - ror resCrcL - brcs crcNoXor - eor resCrcL, polyL - eor resCrcH, polyH -crcNoXor: - subi bitCnt, -1 - brcs crcBitLoop - rjmp crcByteLoop -crcReady: - ret -; Thanks to Reimar Doeffinger for optimizing this CRC routine! - -; extern unsigned usbCrc16Append(unsigned char *data, unsigned char len); -usbCrc16Append: - rcall usbCrc16 - st ptr+, resCrcL - st ptr+, resCrcH - ret - -#undef argLen -#undef argPtrL -#undef argPtrH -#undef resCrcL -#undef resCrcH -#undef ptrL -#undef ptrH -#undef ptr -#undef byte -#undef bitCnt -#undef polyL -#undef polyH -#undef scratch - - -#if USB_CFG_HAVE_MEASURE_FRAME_LENGTH -#ifdef __IAR_SYSTEMS_ASM__ -/* Register assignments for usbMeasureFrameLength on IAR cc */ -/* Calling conventions on IAR: - * First parameter passed in r16/r17, second in r18/r19 and so on. - * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) - * Result is passed in r16/r17 - * In case of the "tiny" memory model, pointers are only 8 bit with no - * padding. We therefore pass argument 1 as "16 bit unsigned". - */ -# define resL r16 -# define resH r17 -# define cnt16L r30 -# define cnt16H r31 -# define cntH r18 - -#else /* __IAR_SYSTEMS_ASM__ */ -/* Register assignments for usbMeasureFrameLength on gcc */ -/* Calling conventions on gcc: - * First parameter passed in r24/r25, second in r22/23 and so on. - * Callee must preserve r1-r17, r28/r29 - * Result is passed in r24/r25 - */ -# define resL r24 -# define resH r25 -# define cnt16L r24 -# define cnt16H r25 -# define cntH r26 -#endif -# define cnt16 cnt16L - -; extern unsigned usbMeasurePacketLength(void); -; returns time between two idle strobes in multiples of 7 CPU clocks -.global usbMeasureFrameLength -usbMeasureFrameLength: - ldi cntH, 6 ; wait ~ 10 ms for D- == 0 - clr cnt16L - clr cnt16H -usbMFTime16: - dec cntH - breq usbMFTimeout -usbMFWaitStrobe: ; first wait for D- == 0 (idle strobe) - sbiw cnt16, 1 ;[0] [6] - breq usbMFTime16 ;[2] - sbic USBIN, USBMINUS ;[3] - rjmp usbMFWaitStrobe ;[4] -usbMFWaitIdle: ; then wait until idle again - sbis USBIN, USBMINUS ;1 wait for D- == 1 - rjmp usbMFWaitIdle ;2 - ldi cnt16L, 1 ;1 represents cycles so far - clr cnt16H ;1 -usbMFWaitLoop: - in cntH, USBIN ;[0] [7] - adiw cnt16, 1 ;[1] - breq usbMFTimeout ;[3] - andi cntH, USBMASK ;[4] - brne usbMFWaitLoop ;[5] -usbMFTimeout: -#if resL != cnt16L - mov resL, cnt16L - mov resH, cnt16H -#endif - ret - -#undef resL -#undef resH -#undef cnt16 -#undef cnt16L -#undef cnt16H -#undef cntH - -#endif /* USB_CFG_HAVE_MEASURE_FRAME_LENGTH */ - -;---------------------------------------------------------------------------- -; Now include the clock rate specific code -;---------------------------------------------------------------------------- - -#ifndef USB_CFG_CLOCK_KHZ -# define USB_CFG_CLOCK_KHZ 12000 -#endif - -#if USB_CFG_CHECK_CRC /* separate dispatcher for CRC type modules */ -# if USB_CFG_CLOCK_KHZ == 18000 -# include "usbdrvasm18-crc.inc" -# else -# error "USB_CFG_CLOCK_KHZ is not one of the supported crc-rates!" -# endif -#else /* USB_CFG_CHECK_CRC */ -# if USB_CFG_CLOCK_KHZ == 12000 -# include "usbdrvasm12.inc" -# elif USB_CFG_CLOCK_KHZ == 12800 -# include "usbdrvasm128.inc" -# elif USB_CFG_CLOCK_KHZ == 15000 -# include "usbdrvasm15.inc" -# elif USB_CFG_CLOCK_KHZ == 16000 -# include "usbdrvasm16.inc" -# elif USB_CFG_CLOCK_KHZ == 16500 -# include "usbdrvasm165.inc" -# elif USB_CFG_CLOCK_KHZ == 20000 -# include "usbdrvasm20.inc" -# else -# error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!" -# endif -#endif /* USB_CFG_CHECK_CRC */ diff --git a/tools/vusb/usbdrv/usbdrvasm.asm b/tools/vusb/usbdrv/usbdrvasm.asm deleted file mode 100644 index 9cc4e4d..0000000 --- a/tools/vusb/usbdrv/usbdrvasm.asm +++ /dev/null @@ -1,21 +0,0 @@ -/* Name: usbdrvasm.asm - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2006-03-01 - * Tabsize: 4 - * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id$ - */ - -/* -General Description: -The IAR compiler/assembler system prefers assembler files with file extension -".asm". We simply provide this file as an alias for usbdrvasm.S. - -Thanks to Oleg Semyonov for his help with the IAR tools port! -*/ - -#include "usbdrvasm.S" - -end diff --git a/tools/vusb/usbdrv/usbdrvasm12.inc b/tools/vusb/usbdrv/usbdrvasm12.inc deleted file mode 100644 index c116758..0000000 --- a/tools/vusb/usbdrv/usbdrvasm12.inc +++ /dev/null @@ -1,393 +0,0 @@ -/* Name: usbdrvasm12.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2004-12-29 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrvasm12.inc 740 2009-04-13 18:23:31Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 12 MHz version of the asssembler part of the USB driver. It -requires a 12 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! - - -Timing constraints according to spec (in bit times): -timing subject min max CPUcycles ---------------------------------------------------------------------------- -EOP of OUT/SETUP to sync pattern of DATA0 (both rx) 2 16 16-128 -EOP of IN to sync pattern of DATA0 (rx, then tx) 2 7.5 16-60 -DATAx (rx) to ACK/NAK/STALL (tx) 2 7.5 16-60 -*/ - -;Software-receiver engine. Strict timing! Don't change unless you can preserve timing! -;interrupt response time: 4 cycles + insn running = 7 max if interrupts always enabled -;max allowable interrupt latency: 34 cycles -> max 25 cycles interrupt disable -;max stack usage: [ret(2), YL, SREG, YH, shift, x1, x2, x3, cnt, x4] = 11 bytes -;Numbers in brackets are maximum cycles since SOF. -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt - push YL ;2 [35] push only what is necessary to sync with edge ASAP - in YL, SREG ;1 [37] - push YL ;2 [39] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of 1/4 bit which meets the spec. - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YH ;2 [2] - lds YL, usbInputBufOffset;2 [4] - clr YH ;1 [5] - subi YL, lo8(-(usbRxBuf));1 [6] - sbci YH, hi8(-(usbRxBuf));1 [7] - - sbis USBIN, USBMINUS ;1 [8] we want two bits K [sample 1 cycle too early] - rjmp haveTwoBitsK ;2 [10] - pop YH ;2 [11] undo the push from before - rjmp waitForK ;2 [13] this was not the end of sync, retry -haveTwoBitsK: -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- - push shift ;2 [16] - push x1 ;2 [12] - push x2 ;2 [14] - - in x1, USBIN ;1 [17] <-- sample bit 0 - ldi shift, 0xff ;1 [18] - bst x1, USBMINUS ;1 [19] - bld shift, 0 ;1 [20] - push x3 ;2 [22] - push cnt ;2 [24] - - in x2, USBIN ;1 [25] <-- sample bit 1 - ser x3 ;1 [26] [inserted init instruction] - eor x1, x2 ;1 [27] - bst x1, USBMINUS ;1 [28] - bld shift, 1 ;1 [29] - ldi cnt, USB_BUFSIZE;1 [30] [inserted init instruction] - rjmp rxbit2 ;2 [32] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -unstuff0: ;1 (branch taken) - andi x3, ~0x01 ;1 [15] - mov x1, x2 ;1 [16] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [17] <-- sample bit 1 again - ori shift, 0x01 ;1 [18] - rjmp didUnstuff0 ;2 [20] - -unstuff1: ;1 (branch taken) - mov x2, x1 ;1 [21] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [22] - ori shift, 0x02 ;1 [23] - nop ;1 [24] - in x1, USBIN ;1 [25] <-- sample bit 2 again - rjmp didUnstuff1 ;2 [27] - -unstuff2: ;1 (branch taken) - andi x3, ~0x04 ;1 [29] - ori shift, 0x04 ;1 [30] - mov x1, x2 ;1 [31] x2 contains last sampled (stuffed) bit - nop ;1 [32] - in x2, USBIN ;1 [33] <-- sample bit 3 - rjmp didUnstuff2 ;2 [35] - -unstuff3: ;1 (branch taken) - in x2, USBIN ;1 [34] <-- sample stuffed bit 3 [one cycle too late] - andi x3, ~0x08 ;1 [35] - ori shift, 0x08 ;1 [36] - rjmp didUnstuff3 ;2 [38] - -unstuff4: ;1 (branch taken) - andi x3, ~0x10 ;1 [40] - in x1, USBIN ;1 [41] <-- sample stuffed bit 4 - ori shift, 0x10 ;1 [42] - rjmp didUnstuff4 ;2 [44] - -unstuff5: ;1 (branch taken) - andi x3, ~0x20 ;1 [48] - in x2, USBIN ;1 [49] <-- sample stuffed bit 5 - ori shift, 0x20 ;1 [50] - rjmp didUnstuff5 ;2 [52] - -unstuff6: ;1 (branch taken) - andi x3, ~0x40 ;1 [56] - in x1, USBIN ;1 [57] <-- sample stuffed bit 6 - ori shift, 0x40 ;1 [58] - rjmp didUnstuff6 ;2 [60] - -; extra jobs done during bit interval: -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs] -; bit 1: se0 check -; bit 2: overflow check -; bit 3: recovery from delay [bit 0 tasks took too long] -; bit 4: none -; bit 5: none -; bit 6: none -; bit 7: jump, eor -rxLoop: - eor x3, shift ;1 [0] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;1 [1] <-- sample bit 0 - st y+, x3 ;2 [3] store data - ser x3 ;1 [4] - nop ;1 [5] - eor x2, x1 ;1 [6] - bst x2, USBMINUS;1 [7] - bld shift, 0 ;1 [8] - in x2, USBIN ;1 [9] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [10] - breq se0 ;1 [11] SE0 check for bit 1 - andi shift, 0xf9 ;1 [12] -didUnstuff0: - breq unstuff0 ;1 [13] - eor x1, x2 ;1 [14] - bst x1, USBMINUS;1 [15] - bld shift, 1 ;1 [16] -rxbit2: - in x1, USBIN ;1 [17] <-- sample bit 2 (or possibly bit 1 stuffed) - andi shift, 0xf3 ;1 [18] - breq unstuff1 ;1 [19] do remaining work for bit 1 -didUnstuff1: - subi cnt, 1 ;1 [20] - brcs overflow ;1 [21] loop control - eor x2, x1 ;1 [22] - bst x2, USBMINUS;1 [23] - bld shift, 2 ;1 [24] - in x2, USBIN ;1 [25] <-- sample bit 3 (or possibly bit 2 stuffed) - andi shift, 0xe7 ;1 [26] - breq unstuff2 ;1 [27] -didUnstuff2: - eor x1, x2 ;1 [28] - bst x1, USBMINUS;1 [29] - bld shift, 3 ;1 [30] -didUnstuff3: - andi shift, 0xcf ;1 [31] - breq unstuff3 ;1 [32] - in x1, USBIN ;1 [33] <-- sample bit 4 - eor x2, x1 ;1 [34] - bst x2, USBMINUS;1 [35] - bld shift, 4 ;1 [36] -didUnstuff4: - andi shift, 0x9f ;1 [37] - breq unstuff4 ;1 [38] - nop2 ;2 [40] - in x2, USBIN ;1 [41] <-- sample bit 5 - eor x1, x2 ;1 [42] - bst x1, USBMINUS;1 [43] - bld shift, 5 ;1 [44] -didUnstuff5: - andi shift, 0x3f ;1 [45] - breq unstuff5 ;1 [46] - nop2 ;2 [48] - in x1, USBIN ;1 [49] <-- sample bit 6 - eor x2, x1 ;1 [50] - bst x2, USBMINUS;1 [51] - bld shift, 6 ;1 [52] -didUnstuff6: - cpi shift, 0x02 ;1 [53] - brlo unstuff6 ;1 [54] - nop2 ;2 [56] - in x2, USBIN ;1 [57] <-- sample bit 7 - eor x1, x2 ;1 [58] - bst x1, USBMINUS;1 [59] - bld shift, 7 ;1 [60] -didUnstuff7: - cpi shift, 0x04 ;1 [61] - brsh rxLoop ;2 [63] loop control -unstuff7: - andi x3, ~0x80 ;1 [63] - ori shift, 0x80 ;1 [64] - in x2, USBIN ;1 [65] <-- sample stuffed bit 7 - nop ;1 [66] - rjmp didUnstuff7 ;2 [68] - -macro POP_STANDARD ; 12 cycles - pop cnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;---------------------------------------------------------------------------- -; Transmitting data -;---------------------------------------------------------------------------- - -txByteLoop: -txBitloop: -stuffN1Delay: ; [03] - ror shift ;[-5] [11] [59] - brcc doExorN1 ;[-4] [60] - subi x4, 1 ;[-3] - brne commonN1 ;[-2] - lsl shift ;[-1] compensate ror after rjmp stuffDelay - nop ;[00] stuffing consists of just waiting 8 cycles - rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear - -sendNakAndReti: ;0 [-19] 19 cycles until SOP - ldi x3, USBPID_NAK ;1 [-18] - rjmp usbSendX3 ;2 [-16] -sendAckAndReti: ;0 [-19] 19 cycles until SOP - ldi x3, USBPID_ACK ;1 [-18] - rjmp usbSendX3 ;2 [-16] -sendCntAndReti: ;0 [-17] 17 cycles until SOP - mov x3, cnt ;1 [-16] -usbSendX3: ;0 [-16] - ldi YL, 20 ;1 [-15] 'x3' is R20 - ldi YH, 0 ;1 [-14] - ldi cnt, 2 ;1 [-13] -; rjmp usbSendAndReti fallthrough - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 -; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 -; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte -;uses: x1...x2, x4, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x4 = bitstuff cnt] -;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) -usbSendAndReti: - in x2, USBDDR ;[-12] 12 cycles until SOP - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS ;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - out USBDDR, x2 ;[-8] <--- acquire bus - in x1, USBOUT ;[-7] port mirror for tx loop - ldi shift, 0x40 ;[-6] sync byte is first byte sent (we enter loop after ror) - ldi x2, USBMASK ;[-5] - push x4 ;[-4] -doExorN1: - eor x1, x2 ;[-2] [06] [62] - ldi x4, 6 ;[-1] [07] [63] -commonN1: -stuffN2Delay: - out USBOUT, x1 ;[00] [08] [64] <--- set bit - ror shift ;[01] - brcc doExorN2 ;[02] - subi x4, 1 ;[03] - brne commonN2 ;[04] - lsl shift ;[05] compensate ror after rjmp stuffDelay - rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear -doExorN2: - eor x1, x2 ;[04] [12] - ldi x4, 6 ;[05] [13] -commonN2: - nop ;[06] [14] - subi cnt, 171 ;[07] [15] trick: (3 * 171) & 0xff = 1 - out USBOUT, x1 ;[08] [16] <--- set bit - brcs txBitloop ;[09] [25] [41] - -stuff6Delay: - ror shift ;[42] [50] - brcc doExor6 ;[43] - subi x4, 1 ;[44] - brne common6 ;[45] - lsl shift ;[46] compensate ror after rjmp stuffDelay - nop ;[47] stuffing consists of just waiting 8 cycles - rjmp stuff6Delay ;[48] after ror, C bit is reliably clear -doExor6: - eor x1, x2 ;[45] [53] - ldi x4, 6 ;[46] -common6: -stuff7Delay: - ror shift ;[47] [55] - out USBOUT, x1 ;[48] <--- set bit - brcc doExor7 ;[49] - subi x4, 1 ;[50] - brne common7 ;[51] - lsl shift ;[52] compensate ror after rjmp stuffDelay - rjmp stuff7Delay ;[53] after ror, C bit is reliably clear -doExor7: - eor x1, x2 ;[51] [59] - ldi x4, 6 ;[52] -common7: - ld shift, y+ ;[53] - tst cnt ;[55] - out USBOUT, x1 ;[56] <--- set bit - brne txByteLoop ;[57] - -;make SE0: - cbr x1, USBMASK ;[58] prepare SE0 [spec says EOP may be 15 to 18 cycles] - lds x2, usbNewDeviceAddr;[59] - lsl x2 ;[61] we compare with left shifted address - subi YL, 2 + 20 ;[62] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[63] - out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[01] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 12.5625 MHz -max frequency: 69.286 cycles for 8 bit -> 12.99 MHz -nominal frequency: 12.77 MHz ( = sqrt(min * max)) - -sampling positions: (next even number in range [+/- 0.5]) -cycle index range: 0 ... 66 -bits: -.5, 8.875, 17.25, 25.625, 34, 42.375, 50.75, 59.125 -[0/1], [9], [17], [25/+26], [34], [+42/43], [51], [59] - -bit number: 0 1 2 3 4 5 6 7 -spare cycles 1 2 1 2 1 1 1 0 - -operations to perform: duration cycle - ---------------- - eor fix, shift 1 -> 00 - andi phase, USBMASK 1 -> 08 - breq se0 1 -> 16 (moved to 11) - st y+, data 2 -> 24, 25 - mov data, fix 1 -> 33 - ser data 1 -> 41 - subi cnt, 1 1 -> 49 - brcs overflow 1 -> 50 - -layout of samples and operations: -[##] = sample bit -<##> = sample phase -*##* = operation - -0: *00* [01] 02 03 04 <05> 06 07 -1: *08* [09] 10 11 12 <13> 14 15 *16* -2: [17] 18 19 20 <21> 22 23 -3: *24* *25* [26] 27 28 29 <30> 31 32 -4: *33* [34] 35 36 37 <38> 39 40 -5: *41* [42] 43 44 45 <46> 47 48 -6: *49* *50* [51] 52 53 54 <55> 56 57 58 -7: [59] 60 61 62 <63> 64 65 66 -*****************************************************************************/ - -/* we prefer positive expressions (do if condition) instead of negative - * (skip if condition), therefore use defines for skip instructions: - */ -#define ifioclr sbis -#define ifioset sbic -#define ifrclr sbrs -#define ifrset sbrc - -/* The registers "fix" and "data" swap their meaning during the loop. Use - * defines to keep their name constant. - */ -#define fix x2 -#define data x1 -#undef phase /* phase has a default definition to x4 */ -#define phase x3 - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt, r0 - push YL ;2 push only what is necessary to sync with edge ASAP - in YL, SREG ;1 - push YL ;2 -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of 1/4 bit which meets the spec. - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS ;[0] - rjmp foundK ;[1] -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError - -foundK: -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YH ;[2] - lds YL, usbInputBufOffset;[4] - clr YH ;[6] - subi YL, lo8(-(usbRxBuf));[7] - sbci YH, hi8(-(usbRxBuf));[8] - - sbis USBIN, USBMINUS ;[9] we want two bits K [we want to sample at 8 + 4 - 1.5 = 10.5] - rjmp haveTwoBitsK ;[10] - pop YH ;[11] undo the push from before - rjmp waitForK ;[13] this was not the end of sync, retry -haveTwoBitsK: -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -#define fix x2 -#define data x1 - - push shift ;[12] - push x1 ;[14] - push x2 ;[16] - ldi shift, 0x80 ;[18] prevent bit-unstuffing but init low bits to 0 - ifioset USBIN, USBMINUS ;[19] [01] <--- bit 0 [10.5 + 8 = 18.5] - ori shift, 1<<0 ;[02] - push x3 ;[03] - push cnt ;[05] - push r0 ;[07] - ifioset USBIN, USBMINUS ;[09] <--- bit 1 - ori shift, 1<<1 ;[10] - ser fix ;[11] - ldi cnt, USB_BUFSIZE ;[12] - mov data, shift ;[13] - lsl shift ;[14] - nop2 ;[15] - ifioset USBIN, USBMINUS ;[17] <--- bit 2 - ori data, 3<<2 ;[18] store in bit 2 AND bit 3 - eor shift, data ;[19] do nrzi decoding - andi data, 1<<3 ;[20] - in phase, USBIN ;[21] <- phase - brne jumpToEntryAfterSet ;[22] if USBMINS at bit 3 was 1 - nop ;[23] - rjmp entryAfterClr ;[24] -jumpToEntryAfterSet: - rjmp entryAfterSet ;[24] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -#undef fix -#define fix x1 -#undef data -#define data x2 - -bit7IsSet: - ifrclr phase, USBMINUS ;[62] check phase only if D- changed - lpm ;[63] - in phase, USBIN ;[64] <- phase (one cycle too late) - ori shift, 1 << 7 ;[65] - nop ;[66] -;;;;rjmp bit0AfterSet ; -> [00] == [67] moved block up to save jump -bit0AfterSet: - eor fix, shift ;[00] -#undef fix -#define fix x2 -#undef data -#define data x1 /* we now have result in data, fix is reset to 0xff */ - ifioclr USBIN, USBMINUS ;[01] <--- sample 0 - rjmp bit0IsClr ;[02] - andi shift, ~(7 << 0) ;[03] - breq unstuff0s ;[04] - in phase, USBIN ;[05] <- phase - rjmp bit1AfterSet ;[06] -unstuff0s: - in phase, USBIN ;[06] <- phase (one cycle too late) - andi fix, ~(1 << 0) ;[07] - ifioclr USBIN, USBMINUS ;[00] - ifioset USBIN, USBPLUS ;[01] - rjmp bit0IsClr ;[02] executed if first expr false or second true -jumpToSe0AndStore: - rjmp se0AndStore ;[03] executed only if both bits 0 -bit0IsClr: - ifrset phase, USBMINUS ;[04] check phase only if D- changed - lpm ;[05] - in phase, USBIN ;[06] <- phase (one cycle too late) - ori shift, 1 << 0 ;[07] -bit1AfterClr: - andi phase, USBMASK ;[08] - ifioset USBIN, USBMINUS ;[09] <--- sample 1 - rjmp bit1IsSet ;[10] - breq jumpToSe0AndStore ;[11] - andi shift, ~(7 << 1) ;[12] - in phase, USBIN ;[13] <- phase - breq unstuff1c ;[14] - rjmp bit2AfterClr ;[15] -unstuff1c: - andi fix, ~(1 << 1) ;[16] - nop2 ;[08] - nop2 ;[10] -bit1IsSet: - ifrclr phase, USBMINUS ;[12] check phase only if D- changed - lpm ;[13] - in phase, USBIN ;[14] <- phase (one cycle too late) - ori shift, 1 << 1 ;[15] - nop ;[16] -bit2AfterSet: - ifioclr USBIN, USBMINUS ;[17] <--- sample 2 - rjmp bit2IsClr ;[18] - andi shift, ~(7 << 2) ;[19] - breq unstuff2s ;[20] - in phase, USBIN ;[21] <- phase - rjmp bit3AfterSet ;[22] -unstuff2s: - in phase, USBIN ;[22] <- phase (one cycle too late) - andi fix, ~(1 << 2) ;[23] - nop2 ;[16] - nop2 ;[18] -bit2IsClr: - ifrset phase, USBMINUS ;[20] check phase only if D- changed - lpm ;[21] - in phase, USBIN ;[22] <- phase (one cycle too late) - ori shift, 1 << 2 ;[23] -bit3AfterClr: - st y+, data ;[24] -entryAfterClr: - ifioset USBIN, USBMINUS ;[26] <--- sample 3 - rjmp bit3IsSet ;[27] - andi shift, ~(7 << 3) ;[28] - breq unstuff3c ;[29] - in phase, USBIN ;[30] <- phase - rjmp bit4AfterClr ;[31] -unstuff3c: - in phase, USBIN ;[31] <- phase (one cycle too late) - andi fix, ~(1 << 3) ;[32] - nop2 ;[25] - nop2 ;[27] -bit3IsSet: - ifrclr phase, USBMINUS ;[29] check phase only if D- changed - lpm ;[30] - in phase, USBIN ;[31] <- phase (one cycle too late) - ori shift, 1 << 3 ;[32] -bit4AfterSet: - mov data, fix ;[33] undo this move by swapping defines -#undef fix -#define fix x1 -#undef data -#define data x2 - ifioclr USBIN, USBMINUS ;[34] <--- sample 4 - rjmp bit4IsClr ;[35] - andi shift, ~(7 << 4) ;[36] - breq unstuff4s ;[37] - in phase, USBIN ;[38] <- phase - rjmp bit5AfterSet ;[39] -unstuff4s: - in phase, USBIN ;[39] <- phase (one cycle too late) - andi fix, ~(1 << 4) ;[40] - nop2 ;[33] - nop2 ;[35] -bit4IsClr: - ifrset phase, USBMINUS ;[37] check phase only if D- changed - lpm ;[38] - in phase, USBIN ;[39] <- phase (one cycle too late) - ori shift, 1 << 4 ;[40] -bit5AfterClr: - ser data ;[41] - ifioset USBIN, USBMINUS ;[42] <--- sample 5 - rjmp bit5IsSet ;[43] - andi shift, ~(7 << 5) ;[44] - breq unstuff5c ;[45] - in phase, USBIN ;[46] <- phase - rjmp bit6AfterClr ;[47] -unstuff5c: - in phase, USBIN ;[47] <- phase (one cycle too late) - andi fix, ~(1 << 5) ;[48] - nop2 ;[41] - nop2 ;[43] -bit5IsSet: - ifrclr phase, USBMINUS ;[45] check phase only if D- changed - lpm ;[46] - in phase, USBIN ;[47] <- phase (one cycle too late) - ori shift, 1 << 5 ;[48] -bit6AfterSet: - subi cnt, 1 ;[49] - brcs jumpToOverflow ;[50] - ifioclr USBIN, USBMINUS ;[51] <--- sample 6 - rjmp bit6IsClr ;[52] - andi shift, ~(3 << 6) ;[53] - cpi shift, 2 ;[54] - in phase, USBIN ;[55] <- phase - brlt unstuff6s ;[56] - rjmp bit7AfterSet ;[57] - -jumpToOverflow: - rjmp overflow - -unstuff6s: - andi fix, ~(1 << 6) ;[50] - lpm ;[51] -bit6IsClr: - ifrset phase, USBMINUS ;[54] check phase only if D- changed - lpm ;[55] - in phase, USBIN ;[56] <- phase (one cycle too late) - ori shift, 1 << 6 ;[57] - nop ;[58] -bit7AfterClr: - ifioset USBIN, USBMINUS ;[59] <--- sample 7 - rjmp bit7IsSet ;[60] - andi shift, ~(1 << 7) ;[61] - cpi shift, 4 ;[62] - in phase, USBIN ;[63] <- phase - brlt unstuff7c ;[64] - rjmp bit0AfterClr ;[65] -> [00] == [67] -unstuff7c: - andi fix, ~(1 << 7) ;[58] - nop ;[59] - rjmp bit7IsSet ;[60] - -se0AndStore: - st y+, x1 ;[15/17] cycles after start of byte - rjmp se0 ;[17/19] - -bit7IsClr: - ifrset phase, USBMINUS ;[62] check phase only if D- changed - lpm ;[63] - in phase, USBIN ;[64] <- phase (one cycle too late) - ori shift, 1 << 7 ;[65] - nop ;[66] -;;;;rjmp bit0AfterClr ; -> [00] == [67] moved block up to save jump -bit0AfterClr: - eor fix, shift ;[00] -#undef fix -#define fix x2 -#undef data -#define data x1 /* we now have result in data, fix is reset to 0xff */ - ifioset USBIN, USBMINUS ;[01] <--- sample 0 - rjmp bit0IsSet ;[02] - andi shift, ~(7 << 0) ;[03] - breq unstuff0c ;[04] - in phase, USBIN ;[05] <- phase - rjmp bit1AfterClr ;[06] -unstuff0c: - in phase, USBIN ;[06] <- phase (one cycle too late) - andi fix, ~(1 << 0) ;[07] - ifioclr USBIN, USBMINUS ;[00] - ifioset USBIN, USBPLUS ;[01] - rjmp bit0IsSet ;[02] executed if first expr false or second true - rjmp se0AndStore ;[03] executed only if both bits 0 -bit0IsSet: - ifrclr phase, USBMINUS ;[04] check phase only if D- changed - lpm ;[05] - in phase, USBIN ;[06] <- phase (one cycle too late) - ori shift, 1 << 0 ;[07] -bit1AfterSet: - andi phase, USBMASK ;[08] - ifioclr USBIN, USBMINUS ;[09] <--- sample 1 - rjmp bit1IsClr ;[10] - andi shift, ~(7 << 1) ;[11] - breq unstuff1s ;[12] - in phase, USBIN ;[13] <- phase - nop ;[14] - rjmp bit2AfterSet ;[15] -unstuff1s: - in phase, USBIN ;[14] <- phase (one cycle too late) - andi fix, ~(1 << 1) ;[15] - nop2 ;[08] - nop2 ;[10] -bit1IsClr: - ifrset phase, USBMINUS ;[12] check phase only if D- changed - lpm ;[13] - in phase, USBIN ;[14] <- phase (one cycle too late) - breq se0AndStore ;[15] if we come from unstuff1s, Z bit is never set - ori shift, 1 << 1 ;[16] -bit2AfterClr: - ifioset USBIN, USBMINUS ;[17] <--- sample 2 - rjmp bit2IsSet ;[18] - andi shift, ~(7 << 2) ;[19] - breq unstuff2c ;[20] - in phase, USBIN ;[21] <- phase - rjmp bit3AfterClr ;[22] -unstuff2c: - in phase, USBIN ;[22] <- phase (one cycle too late) - andi fix, ~(1 << 2) ;[23] - nop2 ;[16] - nop2 ;[18] -bit2IsSet: - ifrclr phase, USBMINUS ;[20] check phase only if D- changed - lpm ;[21] - in phase, USBIN ;[22] <- phase (one cycle too late) - ori shift, 1 << 2 ;[23] -bit3AfterSet: - st y+, data ;[24] -entryAfterSet: - ifioclr USBIN, USBMINUS ;[26] <--- sample 3 - rjmp bit3IsClr ;[27] - andi shift, ~(7 << 3) ;[28] - breq unstuff3s ;[29] - in phase, USBIN ;[30] <- phase - rjmp bit4AfterSet ;[31] -unstuff3s: - in phase, USBIN ;[31] <- phase (one cycle too late) - andi fix, ~(1 << 3) ;[32] - nop2 ;[25] - nop2 ;[27] -bit3IsClr: - ifrset phase, USBMINUS ;[29] check phase only if D- changed - lpm ;[30] - in phase, USBIN ;[31] <- phase (one cycle too late) - ori shift, 1 << 3 ;[32] -bit4AfterClr: - mov data, fix ;[33] undo this move by swapping defines -#undef fix -#define fix x1 -#undef data -#define data x2 - ifioset USBIN, USBMINUS ;[34] <--- sample 4 - rjmp bit4IsSet ;[35] - andi shift, ~(7 << 4) ;[36] - breq unstuff4c ;[37] - in phase, USBIN ;[38] <- phase - rjmp bit5AfterClr ;[39] -unstuff4c: - in phase, USBIN ;[39] <- phase (one cycle too late) - andi fix, ~(1 << 4) ;[40] - nop2 ;[33] - nop2 ;[35] -bit4IsSet: - ifrclr phase, USBMINUS ;[37] check phase only if D- changed - lpm ;[38] - in phase, USBIN ;[39] <- phase (one cycle too late) - ori shift, 1 << 4 ;[40] -bit5AfterSet: - ser data ;[41] - ifioclr USBIN, USBMINUS ;[42] <--- sample 5 - rjmp bit5IsClr ;[43] - andi shift, ~(7 << 5) ;[44] - breq unstuff5s ;[45] - in phase, USBIN ;[46] <- phase - rjmp bit6AfterSet ;[47] -unstuff5s: - in phase, USBIN ;[47] <- phase (one cycle too late) - andi fix, ~(1 << 5) ;[48] - nop2 ;[41] - nop2 ;[43] -bit5IsClr: - ifrset phase, USBMINUS ;[45] check phase only if D- changed - lpm ;[46] - in phase, USBIN ;[47] <- phase (one cycle too late) - ori shift, 1 << 5 ;[48] -bit6AfterClr: - subi cnt, 1 ;[49] - brcs overflow ;[50] - ifioset USBIN, USBMINUS ;[51] <--- sample 6 - rjmp bit6IsSet ;[52] - andi shift, ~(3 << 6) ;[53] - cpi shift, 2 ;[54] - in phase, USBIN ;[55] <- phase - brlt unstuff6c ;[56] - rjmp bit7AfterClr ;[57] -unstuff6c: - andi fix, ~(1 << 6) ;[50] - lpm ;[51] -bit6IsSet: - ifrclr phase, USBMINUS ;[54] check phase only if D- changed - lpm ;[55] - in phase, USBIN ;[56] <- phase (one cycle too late) - ori shift, 1 << 6 ;[57] -bit7AfterSet: - ifioclr USBIN, USBMINUS ;[59] <--- sample 7 - rjmp bit7IsClr ;[60] - andi shift, ~(1 << 7) ;[61] - cpi shift, 4 ;[62] - in phase, USBIN ;[63] <- phase - brlt unstuff7s ;[64] - rjmp bit0AfterSet ;[65] -> [00] == [67] -unstuff7s: - andi fix, ~(1 << 7) ;[58] - nop ;[59] - rjmp bit7IsClr ;[60] - -macro POP_STANDARD ; 14 cycles - pop r0 - pop cnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;---------------------------------------------------------------------------- -; Transmitting data -;---------------------------------------------------------------------------- - -txByteLoop: -txBitloop: -stuffN1Delay: ; [03] - ror shift ;[-5] [11] [63] - brcc doExorN1 ;[-4] [64] - subi x3, 1 ;[-3] - brne commonN1 ;[-2] - lsl shift ;[-1] compensate ror after rjmp stuffDelay - nop ;[00] stuffing consists of just waiting 8 cycles - rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear - -sendNakAndReti: - ldi cnt, USBPID_NAK ;[-19] - rjmp sendCntAndReti ;[-18] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov r0, cnt ;[-16] - ldi YL, 0 ;[-15] R0 address is 0 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 -; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 -; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte -;uses: x1...x3, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x3 = bitstuff cnt] -;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) -usbSendAndReti: - in x2, USBDDR ;[-10] 10 cycles until SOP - ori x2, USBMASK ;[-9] - sbi USBOUT, USBMINUS ;[-8] prepare idle state; D+ and D- must have been 0 (no pullups) - out USBDDR, x2 ;[-6] <--- acquire bus - in x1, USBOUT ;[-5] port mirror for tx loop - ldi shift, 0x40 ;[-4] sync byte is first byte sent (we enter loop after ror) - ldi x2, USBMASK ;[-3] -doExorN1: - eor x1, x2 ;[-2] [06] [62] - ldi x3, 6 ;[-1] [07] [63] -commonN1: -stuffN2Delay: - out USBOUT, x1 ;[00] [08] [64] <--- set bit - ror shift ;[01] - brcc doExorN2 ;[02] - subi x3, 1 ;[03] - brne commonN2 ;[04] - lsl shift ;[05] compensate ror after rjmp stuffDelay - rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear -doExorN2: - eor x1, x2 ;[04] [12] - ldi x3, 6 ;[05] [13] -commonN2: - nop2 ;[06] [14] - subi cnt, 171 ;[08] [16] trick: (3 * 171) & 0xff = 1 - out USBOUT, x1 ;[09] [17] <--- set bit - brcs txBitloop ;[10] [27] [44] - -stuff6Delay: - ror shift ;[45] [53] - brcc doExor6 ;[46] - subi x3, 1 ;[47] - brne common6 ;[48] - lsl shift ;[49] compensate ror after rjmp stuffDelay - nop ;[50] stuffing consists of just waiting 8 cycles - rjmp stuff6Delay ;[51] after ror, C bit is reliably clear -doExor6: - eor x1, x2 ;[48] [56] - ldi x3, 6 ;[49] -common6: -stuff7Delay: - ror shift ;[50] [58] - out USBOUT, x1 ;[51] <--- set bit - brcc doExor7 ;[52] - subi x3, 1 ;[53] - brne common7 ;[54] - lsl shift ;[55] compensate ror after rjmp stuffDelay - rjmp stuff7Delay ;[56] after ror, C bit is reliably clear -doExor7: - eor x1, x2 ;[54] [62] - ldi x3, 6 ;[55] -common7: - ld shift, y+ ;[56] - nop ;[58] - tst cnt ;[59] - out USBOUT, x1 ;[60] [00]<--- set bit - brne txByteLoop ;[61] [01] -;make SE0: - cbr x1, USBMASK ;[02] prepare SE0 [spec says EOP may be 15 to 18 cycles] - lds x2, usbNewDeviceAddr;[03] - lsl x2 ;[05] we compare with left shifted address - subi YL, 2 + 0 ;[06] Only assign address on data packets, not ACK/NAK in r0 - sbci YH, 0 ;[07] - out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[01] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 0) - echo "$s\n"; - } -} - -function printBit($isAfterSet, $bitNum) -{ - ob_start(); - if($isAfterSet){ -?> - ifioclr USBIN, USBMINUS ;[00] <--- sample - rjmp bit#IsClr ;[01] - andi shift, ~(7 << #) ;[02] - breq unstuff#s ;[03] - in phase, USBIN ;[04] <- phase - rjmp bit@AfterSet ;[05] -unstuff#s: - in phase, USBIN ;[05] <- phase (one cycle too late) - andi fix, ~(1 << #) ;[06] - nop2 ;[-1] - nop2 ;[01] -bit#IsClr: - ifrset phase, USBMINUS ;[03] check phase only if D- changed - lpm ;[04] - in phase, USBIN ;[05] <- phase (one cycle too late) - ori shift, 1 << # ;[06] - - ifioset USBIN, USBMINUS ;[00] <--- sample - rjmp bit#IsSet ;[01] - andi shift, ~(7 << #) ;[02] - breq unstuff#c ;[03] - in phase, USBIN ;[04] <- phase - rjmp bit@AfterClr ;[05] -unstuff#c: - in phase, USBIN ;[05] <- phase (one cycle too late) - andi fix, ~(1 << #) ;[06] - nop2 ;[-1] - nop2 ;[01] -bit#IsSet: - ifrclr phase, USBMINUS ;[03] check phase only if D- changed - lpm ;[04] - in phase, USBIN ;[05] <- phase (one cycle too late) - ori shift, 1 << # ;[06] - -*****************************************************************************/ diff --git a/tools/vusb/usbdrv/usbdrvasm15.inc b/tools/vusb/usbdrv/usbdrvasm15.inc deleted file mode 100644 index 401b7f8..0000000 --- a/tools/vusb/usbdrv/usbdrvasm15.inc +++ /dev/null @@ -1,423 +0,0 @@ -/* Name: usbdrvasm15.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: contributed by V. Bosch - * Creation Date: 2007-08-06 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm15.inc 740 2009-04-13 18:23:31Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 15 MHz version of the asssembler part of the USB driver. It -requires a 15 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! -*/ - -;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 15 MHz -> 10.0 cycles per bit, 80.0 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -;---------------------------------------------------------------------------- -; order of registers pushed: -; YL, SREG [sofError] YH, shift, x1, x2, x3, bitcnt, cnt, x4 -;---------------------------------------------------------------------------- -USB_INTR_VECTOR: - push YL ;2 push only what is necessary to sync with edge ASAP - in YL, SREG ;1 - push YL ;2 -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -; -; sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -; sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -;------------------------------------------------------------------------------- -; The following code results in a sampling window of < 1/4 bit -; which meets the spec. -;------------------------------------------------------------------------------- -waitForK: ;- - sbis USBIN, USBMINUS ;1 [00] <-- sample - rjmp foundK ;2 [01] - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -;------------------------------------------------------------------------------ -; {3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for -; center sampling] -; we have 1 bit time for setup purposes, then sample again. -; Numbers in brackets are cycles from center of first sync (double K) -; bit after the instruction -;------------------------------------------------------------------------------ -foundK: ;- [02] - lds YL, usbInputBufOffset;2 [03+04] tx loop - push YH ;2 [05+06] - clr YH ;1 [07] - subi YL, lo8(-(usbRxBuf)) ;1 [08] [rx loop init] - sbci YH, hi8(-(usbRxBuf)) ;1 [09] [rx loop init] - push shift ;2 [10+11] - ser shift ;1 [12] - sbis USBIN, USBMINUS ;1 [-1] [13] <--sample:we want two bits K (sample 1 cycle too early) - rjmp haveTwoBitsK ;2 [00] [14] - pop shift ;2 [15+16] undo the push from before - pop YH ;2 [17+18] undo the push from before - rjmp waitForK ;2 [19+20] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 20 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;- [01] - push x1 ;2 [02+03] - push x2 ;2 [04+05] - push x3 ;2 [06+07] - push bitcnt ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - bst x1, USBMINUS ;1 [01] - bld shift, 0 ;1 [02] - push cnt ;2 [03+04] - ldi cnt, USB_BUFSIZE ;1 [05] - push x4 ;2 [06+07] tx loop - rjmp rxLoop ;2 [08] -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -unstuff0: ;- [07] (branch taken) - andi x3, ~0x01 ;1 [08] - mov x1, x2 ;1 [09] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [00] [10] <-- sample bit 1 again - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 1 - ori shift, 0x01 ;1 [03] 0b00000001 - nop ;1 [04] - rjmp didUnstuff0 ;2 [05] -;----------------------------------------------------- -unstuff1: ;- [05] (branch taken) - mov x2, x1 ;1 [06] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [07] - ori shift, 0x02 ;1 [08] 0b00000010 - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 again - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - rjmp didUnstuff1 ;2 [03] -;----------------------------------------------------- -unstuff2: ;- [05] (branch taken) - andi x3, ~0x04 ;1 [06] - ori shift, 0x04 ;1 [07] 0b00000100 - mov x1, x2 ;1 [08] x2 contains last sampled (stuffed) bit - nop ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - rjmp didUnstuff2 ;2 [03] -;----------------------------------------------------- -unstuff3: ;- [00] [10] (branch taken) - in x2, USBIN ;1 [01] [11] <-- sample stuffed bit 3 one cycle too late - andi x2, USBMASK ;1 [02] - breq se0Hop ;1 [03] SE0 check for stuffed bit 3 - andi x3, ~0x08 ;1 [04] - ori shift, 0x08 ;1 [05] 0b00001000 - rjmp didUnstuff3 ;2 [06] -;---------------------------------------------------------------------------- -; extra jobs done during bit interval: -; -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs], -; overflow check, jump to the head of rxLoop -; bit 1: SE0 check -; bit 2: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 3: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 4: SE0 check, none -; bit 5: SE0 check, none -; bit 6: SE0 check, none -; bit 7: SE0 check, reconstruct: x3 is 0 at bit locations we changed, 1 at others -;---------------------------------------------------------------------------- -rxLoop: ;- [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [01] - brne SkipSe0Hop ;1 [02] -se0Hop: ;- [02] - rjmp se0 ;2 [03] SE0 check for bit 1 -SkipSe0Hop: ;- [03] - ser x3 ;1 [04] - andi shift, 0xf9 ;1 [05] 0b11111001 - breq unstuff0 ;1 [06] -didUnstuff0: ;- [06] - eor x1, x2 ;1 [07] - bst x1, USBMINUS ;1 [08] - bld shift, 1 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 (or possibly bit 1 stuffed) - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - andi shift, 0xf3 ;1 [03] 0b11110011 - breq unstuff1 ;1 [04] do remaining work for bit 1 -didUnstuff1: ;- [04] - eor x2, x1 ;1 [05] - bst x2, USBMINUS ;1 [06] - bld shift, 2 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 (or possibly bit 2 stuffed) - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - andi shift, 0xe7 ;1 [03] 0b11100111 - breq unstuff2 ;1 [04] -didUnstuff2: ;- [04] - eor x1, x2 ;1 [05] - bst x1, USBMINUS ;1 [06] - bld shift, 3 ;1 [07] -didUnstuff3: ;- [07] - andi shift, 0xcf ;1 [08] 0b11001111 - breq unstuff3 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 4 - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 4 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 4 ;1 [05] -didUnstuff4: ;- [05] - andi shift, 0x9f ;1 [06] 0b10011111 - breq unstuff4 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 5 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 5 ;1 [05] -didUnstuff5: ;- [05] - andi shift, 0x3f ;1 [06] 0b00111111 - breq unstuff5 ;1 [07] - nop2 ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 6 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 6 ;1 [05] -didUnstuff6: ;- [05] - cpi shift, 0x02 ;1 [06] 0b00000010 - brlo unstuff6 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 7 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 7 ;1 [05] -didUnstuff7: ;- [05] - cpi shift, 0x04 ;1 [06] 0b00000100 - brlo unstuff7 ;1 [07] - eor x3, shift ;1 [08] reconstruct: x3 is 0 at bit locations we changed, 1 at others - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - st y+, x3 ;2 [01+02] store data - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 0 ;1 [05] - subi cnt, 1 ;1 [06] - brcs overflow ;1 [07] - rjmp rxLoop ;2 [08] -;----------------------------------------------------- -unstuff4: ;- [08] - andi x3, ~0x10 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 4 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 4 - ori shift, 0x10 ;1 [03] - rjmp didUnstuff4 ;2 [04] -;----------------------------------------------------- -unstuff5: ;- [08] - ori shift, 0x20 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 5 - andi x3, ~0x20 ;1 [03] - rjmp didUnstuff5 ;2 [04] -;----------------------------------------------------- -unstuff6: ;- [08] - andi x3, ~0x40 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 6 - ori shift, 0x40 ;1 [03] - rjmp didUnstuff6 ;2 [04] -;----------------------------------------------------- -unstuff7: ;- [08] - andi x3, ~0x80 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 7 - ori shift, 0x80 ;1 [03] - rjmp didUnstuff7 ;2 [04] - -macro POP_STANDARD ; 16 cycles - pop x4 - pop cnt - pop bitcnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;--------------------------------------------------------------------------- -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies -;--------------------------------------------------------------------------- -bitstuffN: ;- [04] - eor x1, x4 ;1 [05] - clr x2 ;1 [06] - nop ;1 [07] - rjmp didStuffN ;1 [08] -;--------------------------------------------------------------------------- -bitstuff6: ;- [04] - eor x1, x4 ;1 [05] - clr x2 ;1 [06] - rjmp didStuff6 ;1 [07] -;--------------------------------------------------------------------------- -bitstuff7: ;- [02] - eor x1, x4 ;1 [03] - clr x2 ;1 [06] - nop ;1 [05] - rjmp didStuff7 ;1 [06] -;--------------------------------------------------------------------------- -sendNakAndReti: ;- [-19] - ldi x3, USBPID_NAK ;1 [-18] - rjmp sendX3AndReti ;1 [-17] -;--------------------------------------------------------------------------- -sendAckAndReti: ;- [-17] - ldi cnt, USBPID_ACK ;1 [-16] -sendCntAndReti: ;- [-16] - mov x3, cnt ;1 [-15] -sendX3AndReti: ;- [-15] - ldi YL, 20 ;1 [-14] x3==r20 address is 20 - ldi YH, 0 ;1 [-13] - ldi cnt, 2 ;1 [-12] -; rjmp usbSendAndReti fallthrough -;--------------------------------------------------------------------------- -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -;We need not to match the transfer rate exactly because the spec demands -;only 1.5% precision anyway. -usbSendAndReti: ;- [-13] 13 cycles until SOP - in x2, USBDDR ;1 [-12] - ori x2, USBMASK ;1 [-11] - sbi USBOUT, USBMINUS ;2 [-09-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;1 [-08] port mirror for tx loop - out USBDDR, x2 ;1 [-07] <- acquire bus - ; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;1 [-06] exor mask - ldi shift, 0x80 ;1 [-05] sync byte is first byte sent - ldi bitcnt, 6 ;1 [-04] -txBitLoop: ;- [-04] [06] - sbrs shift, 0 ;1 [-03] [07] - eor x1, x4 ;1 [-02] [08] - ror shift ;1 [-01] [09] -didStuffN: ;- [09] - out USBOUT, x1 ;1 [00] [10] <-- out N - ror x2 ;1 [01] - cpi x2, 0xfc ;1 [02] - brcc bitstuffN ;1 [03] - dec bitcnt ;1 [04] - brne txBitLoop ;1 [05] - sbrs shift, 0 ;1 [06] - eor x1, x4 ;1 [07] - ror shift ;1 [08] -didStuff6: ;- [08] - nop ;1 [09] - out USBOUT, x1 ;1 [00] [10] <-- out 6 - ror x2 ;1 [01] - cpi x2, 0xfc ;1 [02] - brcc bitstuff6 ;1 [03] - sbrs shift, 0 ;1 [04] - eor x1, x4 ;1 [05] - ror shift ;1 [06] - ror x2 ;1 [07] -didStuff7: ;- [07] - ldi bitcnt, 6 ;1 [08] - cpi x2, 0xfc ;1 [09] - out USBOUT, x1 ;1 [00] [10] <-- out 7 - brcc bitstuff7 ;1 [01] - ld shift, y+ ;2 [02+03] - dec cnt ;1 [04] - brne txBitLoop ;1 [05] -makeSE0: - cbr x1, USBMASK ;1 [06] prepare SE0 [spec says EOP may be 19 to 23 cycles] - lds x2, usbNewDeviceAddr;2 [07+08] - lsl x2 ;1 [09] we compare with left shifted address -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - out USBOUT, x1 ;1 [00] [10] <-- out SE0-- from now 2 bits==20 cycl. until bus idle - subi YL, 20 + 2 ;1 [01] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;1 [02] - breq skipAddrAssign ;1 [03] - sts usbDeviceAddr, x2 ;2 [04+05] if not skipped: SE0 is one cycle longer -;---------------------------------------------------------------------------- -;end of usbDeviceAddress transfer -skipAddrAssign: ;- [03/04] - ldi x2, 1< 10.6666666 cycles per bit, 85.333333333 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt - push YL ;[-25] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-23] - push YL ;[-22] - push YH ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push bitcnt ;[-12] -; [---] ;[-11] - lds YL, usbInputBufOffset;[-10] -; [---] ;[-9] - clr YH ;[-8] - subi YL, lo8(-(usbRxBuf));[-7] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-6] [rx loop init] - push shift ;[-5] -; [---] ;[-4] - ldi bitcnt, 0x55 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop shift ;[0] undo the push from before - pop bitcnt ;[2] undo the push from before - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 21 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[1] - push x2 ;[3] - push x3 ;[5] - ldi shift, 0 ;[7] - ldi x3, 1<<4 ;[8] [rx loop init] first sample is inverse bit, compensate that - push x4 ;[9] == leap - - in x1, USBIN ;[11] <-- sample bit 0 - andi x1, USBMASK ;[12] - bst x1, USBMINUS ;[13] - bld shift, 7 ;[14] - push cnt ;[15] - ldi leap, 0 ;[17] [rx loop init] - ldi cnt, USB_BUFSIZE;[18] [rx loop init] - rjmp rxbit1 ;[19] arrives at [21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -unstuff6: - andi x2, USBMASK ;[03] - ori x3, 1<<6 ;[04] will not be shifted any more - andi shift, ~0x80;[05] - mov x1, x2 ;[06] sampled bit 7 is actually re-sampled bit 6 - subi leap, 3 ;[07] since this is a short (10 cycle) bit, enforce leap bit - rjmp didUnstuff6 ;[08] - -unstuff7: - ori x3, 1<<7 ;[09] will not be shifted any more - in x2, USBIN ;[00] [10] re-sample bit 7 - andi x2, USBMASK ;[01] - andi shift, ~0x80;[02] - subi leap, 3 ;[03] since this is a short (10 cycle) bit, enforce leap bit - rjmp didUnstuff7 ;[04] - -unstuffEven: - ori x3, 1<<6 ;[09] will be shifted right 6 times for bit 0 - in x1, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x1, USBMASK ;[02] - breq se0 ;[03] - subi leap, 3 ;[04] since this is a short (10 cycle) bit, enforce leap bit - nop ;[05] - rjmp didUnstuffE ;[06] - -unstuffOdd: - ori x3, 1<<5 ;[09] will be shifted right 4 times for bit 1 - in x2, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x2, USBMASK ;[02] - breq se0 ;[03] - subi leap, 3 ;[04] since this is a short (10 cycle) bit, enforce leap bit - nop ;[05] - rjmp didUnstuffO ;[06] - -rxByteLoop: - andi x1, USBMASK ;[03] - eor x2, x1 ;[04] - subi leap, 1 ;[05] - brpl skipLeap ;[06] - subi leap, -3 ;1 one leap cycle every 3rd byte -> 85 + 1/3 cycles per byte - nop ;1 -skipLeap: - subi x2, 1 ;[08] - ror shift ;[09] -didUnstuff6: - cpi shift, 0xfc ;[10] - in x2, USBIN ;[00] [11] <-- sample bit 7 - brcc unstuff6 ;[01] - andi x2, USBMASK ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] -didUnstuff7: - cpi shift, 0xfc ;[06] - brcc unstuff7 ;[07] - eor x3, shift ;[08] reconstruct: x3 is 1 at bit locations we changed, 0 at others - st y+, x3 ;[09] store data -rxBitLoop: - in x1, USBIN ;[00] [11] <-- sample bit 0/2/4 - andi x1, USBMASK ;[01] - eor x2, x1 ;[02] - andi x3, 0x3f ;[03] topmost two bits reserved for 6 and 7 - subi x2, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffEven ;[07] -didUnstuffE: - lsr x3 ;[08] - lsr x3 ;[09] -rxbit1: - in x2, USBIN ;[00] [10] <-- sample bit 1/3/5 - andi x2, USBMASK ;[01] - breq se0 ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffOdd ;[07] -didUnstuffO: - subi bitcnt, 0xab;[08] == addi 0x55, 0x55 = 0x100/3 - brcs rxBitLoop ;[09] - - subi cnt, 1 ;[10] - in x1, USBIN ;[00] [11] <-- sample bit 6 - brcc rxByteLoop ;[01] - rjmp overflow - -macro POP_STANDARD ; 14 cycles - pop cnt - pop x4 - pop x3 - pop x2 - pop x1 - pop shift - pop bitcnt - endm -macro POP_RETI ; 7 cycles - pop YH - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies - -bitstuffN: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] - nop2 ;[7] - nop ;[9] - out USBOUT, x1 ;[10] <-- out - rjmp didStuffN ;[0] - -bitstuff6: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] Carry is zero due to brcc - rol shift ;[7] compensate for ror shift at branch destination - rjmp didStuff6 ;[8] - -bitstuff7: - ldi x2, 0 ;[2] Carry is zero due to brcc - rjmp didStuff7 ;[3] - - -sendNakAndReti: - ldi x3, USBPID_NAK ;[-18] - rjmp sendX3AndReti ;[-17] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov x3, cnt ;[-16] -sendX3AndReti: - ldi YL, 20 ;[-15] x3==r20 address is 20 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -;We don't match the transfer rate exactly (don't insert leap cycles every third -;byte) because the spec demands only 1.5% precision anyway. -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-7] <- acquire bus -; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-6] exor mask - ldi shift, 0x80 ;[-5] sync byte is first byte sent -txByteLoop: - ldi bitcnt, 0x35 ;[-4] [6] binary 0011 0101 -txBitLoop: - sbrs shift, 0 ;[-3] [7] - eor x1, x4 ;[-2] [8] - out USBOUT, x1 ;[-1] [9] <-- out N - ror shift ;[0] [10] - ror x2 ;[1] -didStuffN: - cpi x2, 0xfc ;[2] - brcc bitstuffN ;[3] - lsr bitcnt ;[4] - brcc txBitLoop ;[5] - brne txBitLoop ;[6] - - sbrs shift, 0 ;[7] - eor x1, x4 ;[8] -didStuff6: - out USBOUT, x1 ;[-1] [9] <-- out 6 - ror shift ;[0] [10] - ror x2 ;[1] - cpi x2, 0xfc ;[2] - brcc bitstuff6 ;[3] - ror shift ;[4] -didStuff7: - ror x2 ;[5] - sbrs x2, 7 ;[6] - eor x1, x4 ;[7] - nop ;[8] - cpi x2, 0xfc ;[9] - out USBOUT, x1 ;[-1][10] <-- out 7 - brcc bitstuff7 ;[0] [11] - ld shift, y+ ;[1] - dec cnt ;[3] - brne txByteLoop ;[4] -;make SE0: - cbr x1, USBMASK ;[5] prepare SE0 [spec says EOP may be 21 to 25 cycles] - lds x2, usbNewDeviceAddr;[6] - lsl x2 ;[8] we compare with left shifted address - subi YL, 20 + 2 ;[9] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[10] - out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[0] - sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< max 52 cycles interrupt disable -;max stack usage: [ret(2), r0, SREG, YL, YH, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 16.5 MHz -> 11 cycles per bit -; 16.3125 MHz < F_CPU < 16.6875 MHz (+/- 1.1%) -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], r0, YH, shift, x1, x2, x3, x4, cnt - push YL ;[-23] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-21] - push YL ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push r0 ;[-12] -; [---] ;[-11] - push YH ;[-10] -; [---] ;[-9] - lds YL, usbInputBufOffset;[-8] -; [---] ;[-7] - clr YH ;[-6] - subi YL, lo8(-(usbRxBuf));[-5] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-4] [rx loop init] - mov r0, x2 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop YH ;[0] undo the pushes from before - pop r0 ;[2] - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 22 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;[1] - push shift ;[1] - push x1 ;[3] - push x2 ;[5] - push x3 ;[7] - ldi shift, 0xff ;[9] [rx loop init] - ori x3, 0xff ;[10] [rx loop init] == ser x3, clear zero flag - - in x1, USBIN ;[11] <-- sample bit 0 - bst x1, USBMINUS ;[12] - bld shift, 0 ;[13] - push x4 ;[14] == phase -; [---] ;[15] - push cnt ;[16] -; [---] ;[17] - ldi phase, 0 ;[18] [rx loop init] - ldi cnt, USB_BUFSIZE;[19] [rx loop init] - rjmp rxbit1 ;[20] -; [---] ;[21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -/* -byte oriented operations done during loop: -bit 0: store data -bit 1: SE0 check -bit 2: overflow check -bit 3: catch up -bit 4: rjmp to achieve conditional jump range -bit 5: PLL -bit 6: catch up -bit 7: jump, fixup bitstuff -; 87 [+ 2] cycles ------------------------------------------------------------------- -*/ -continueWithBit5: - in x2, USBIN ;[055] <-- bit 5 - eor r0, x2 ;[056] - or phase, r0 ;[057] - sbrc phase, USBMINUS ;[058] - lpm ;[059] optional nop3; modifies r0 - in phase, USBIN ;[060] <-- phase - eor x1, x2 ;[061] - bst x1, USBMINUS ;[062] - bld shift, 5 ;[063] - andi shift, 0x3f ;[064] - in x1, USBIN ;[065] <-- bit 6 - breq unstuff5 ;[066] *** unstuff escape - eor phase, x1 ;[067] - eor x2, x1 ;[068] - bst x2, USBMINUS ;[069] - bld shift, 6 ;[070] -didUnstuff6: ;[ ] - in r0, USBIN ;[071] <-- phase - cpi shift, 0x02 ;[072] - brlo unstuff6 ;[073] *** unstuff escape -didUnstuff5: ;[ ] - nop2 ;[074] -; [---] ;[075] - in x2, USBIN ;[076] <-- bit 7 - eor x1, x2 ;[077] - bst x1, USBMINUS ;[078] - bld shift, 7 ;[079] -didUnstuff7: ;[ ] - eor r0, x2 ;[080] - or phase, r0 ;[081] - in r0, USBIN ;[082] <-- phase - cpi shift, 0x04 ;[083] - brsh rxLoop ;[084] -; [---] ;[085] -unstuff7: ;[ ] - andi x3, ~0x80 ;[085] - ori shift, 0x80 ;[086] - in x2, USBIN ;[087] <-- sample stuffed bit 7 - nop ;[088] - rjmp didUnstuff7 ;[089] -; [---] ;[090] - ;[080] - -unstuff5: ;[067] - eor phase, x1 ;[068] - andi x3, ~0x20 ;[069] - ori shift, 0x20 ;[070] - in r0, USBIN ;[071] <-- phase - mov x2, x1 ;[072] - nop ;[073] - nop2 ;[074] -; [---] ;[075] - in x1, USBIN ;[076] <-- bit 6 - eor r0, x1 ;[077] - or phase, r0 ;[078] - eor x2, x1 ;[079] - bst x2, USBMINUS ;[080] - bld shift, 6 ;[081] no need to check bitstuffing, we just had one - in r0, USBIN ;[082] <-- phase - rjmp didUnstuff5 ;[083] -; [---] ;[084] - ;[074] - -unstuff6: ;[074] - andi x3, ~0x40 ;[075] - in x1, USBIN ;[076] <-- bit 6 again - ori shift, 0x40 ;[077] - nop2 ;[078] -; [---] ;[079] - rjmp didUnstuff6 ;[080] -; [---] ;[081] - ;[071] - -unstuff0: ;[013] - eor r0, x2 ;[014] - or phase, r0 ;[015] - andi x2, USBMASK ;[016] check for SE0 - in r0, USBIN ;[017] <-- phase - breq didUnstuff0 ;[018] direct jump to se0 would be too long - andi x3, ~0x01 ;[019] - ori shift, 0x01 ;[020] - mov x1, x2 ;[021] mov existing sample - in x2, USBIN ;[022] <-- bit 1 again - rjmp didUnstuff0 ;[023] -; [---] ;[024] - ;[014] - -unstuff1: ;[024] - eor r0, x1 ;[025] - or phase, r0 ;[026] - andi x3, ~0x02 ;[027] - in r0, USBIN ;[028] <-- phase - ori shift, 0x02 ;[029] - mov x2, x1 ;[030] - rjmp didUnstuff1 ;[031] -; [---] ;[032] - ;[022] - -unstuff2: ;[035] - eor r0, x2 ;[036] - or phase, r0 ;[037] - andi x3, ~0x04 ;[038] - in r0, USBIN ;[039] <-- phase - ori shift, 0x04 ;[040] - mov x1, x2 ;[041] - rjmp didUnstuff2 ;[042] -; [---] ;[043] - ;[033] - -unstuff3: ;[043] - in x2, USBIN ;[044] <-- bit 3 again - eor r0, x2 ;[045] - or phase, r0 ;[046] - andi x3, ~0x08 ;[047] - ori shift, 0x08 ;[048] - nop ;[049] - in r0, USBIN ;[050] <-- phase - rjmp didUnstuff3 ;[051] -; [---] ;[052] - ;[042] - -unstuff4: ;[053] - andi x3, ~0x10 ;[054] - in x1, USBIN ;[055] <-- bit 4 again - ori shift, 0x10 ;[056] - rjmp didUnstuff4 ;[057] -; [---] ;[058] - ;[048] - -rxLoop: ;[085] - eor x3, shift ;[086] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;[000] <-- bit 0 - st y+, x3 ;[001] -; [---] ;[002] - eor r0, x1 ;[003] - or phase, r0 ;[004] - eor x2, x1 ;[005] - in r0, USBIN ;[006] <-- phase - ser x3 ;[007] - bst x2, USBMINUS ;[008] - bld shift, 0 ;[009] - andi shift, 0xf9 ;[010] -rxbit1: ;[ ] - in x2, USBIN ;[011] <-- bit 1 - breq unstuff0 ;[012] *** unstuff escape - andi x2, USBMASK ;[013] SE0 check for bit 1 -didUnstuff0: ;[ ] Z only set if we detected SE0 in bitstuff - breq se0 ;[014] - eor r0, x2 ;[015] - or phase, r0 ;[016] - in r0, USBIN ;[017] <-- phase - eor x1, x2 ;[018] - bst x1, USBMINUS ;[019] - bld shift, 1 ;[020] - andi shift, 0xf3 ;[021] -didUnstuff1: ;[ ] - in x1, USBIN ;[022] <-- bit 2 - breq unstuff1 ;[023] *** unstuff escape - eor r0, x1 ;[024] - or phase, r0 ;[025] - subi cnt, 1 ;[026] overflow check - brcs overflow ;[027] - in r0, USBIN ;[028] <-- phase - eor x2, x1 ;[029] - bst x2, USBMINUS ;[030] - bld shift, 2 ;[031] - andi shift, 0xe7 ;[032] -didUnstuff2: ;[ ] - in x2, USBIN ;[033] <-- bit 3 - breq unstuff2 ;[034] *** unstuff escape - eor r0, x2 ;[035] - or phase, r0 ;[036] - eor x1, x2 ;[037] - bst x1, USBMINUS ;[038] - in r0, USBIN ;[039] <-- phase - bld shift, 3 ;[040] - andi shift, 0xcf ;[041] -didUnstuff3: ;[ ] - breq unstuff3 ;[042] *** unstuff escape - nop ;[043] - in x1, USBIN ;[044] <-- bit 4 - eor x2, x1 ;[045] - bst x2, USBMINUS ;[046] - bld shift, 4 ;[047] -didUnstuff4: ;[ ] - eor r0, x1 ;[048] - or phase, r0 ;[049] - in r0, USBIN ;[050] <-- phase - andi shift, 0x9f ;[051] - breq unstuff4 ;[052] *** unstuff escape - rjmp continueWithBit5;[053] -; [---] ;[054] - -macro POP_STANDARD ; 16 cycles - pop cnt - pop x4 - pop x3 - pop x2 - pop x1 - pop shift - pop YH - pop r0 - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies - -bitstuff7: - eor x1, x4 ;[4] - ldi x2, 0 ;[5] - nop2 ;[6] C is zero (brcc) - rjmp didStuff7 ;[8] - -bitstuffN: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] - lpm ;[7] 3 cycle NOP, modifies r0 - out USBOUT, x1 ;[10] <-- out - rjmp didStuffN ;[0] - -#define bitStatus x3 - -sendNakAndReti: - ldi cnt, USBPID_NAK ;[-19] - rjmp sendCntAndReti ;[-18] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov r0, cnt ;[-16] - ldi YL, 0 ;[-15] R0 address is 0 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-7] <- acquire bus -; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-6] exor mask - ldi shift, 0x80 ;[-5] sync byte is first byte sent - ldi bitStatus, 0xff ;[-4] init bit loop counter, works for up to 12 bytes -byteloop: -bitloop: - sbrs shift, 0 ;[8] [-3] - eor x1, x4 ;[9] [-2] - out USBOUT, x1 ;[10] [-1] <-- out - ror shift ;[0] - ror x2 ;[1] -didStuffN: - cpi x2, 0xfc ;[2] - brcc bitstuffN ;[3] - nop ;[4] - subi bitStatus, 37 ;[5] 256 / 7 ~=~ 37 - brcc bitloop ;[6] when we leave the loop, bitStatus has almost the initial value - sbrs shift, 0 ;[7] - eor x1, x4 ;[8] - ror shift ;[9] -didStuff7: - out USBOUT, x1 ;[10] <-- out - ror x2 ;[0] - cpi x2, 0xfc ;[1] - brcc bitstuff7 ;[2] - ld shift, y+ ;[3] - dec cnt ;[5] - brne byteloop ;[6] -;make SE0: - cbr x1, USBMASK ;[7] prepare SE0 [spec says EOP may be 21 to 25 cycles] - lds x2, usbNewDeviceAddr;[8] - lsl x2 ;[10] we compare with left shifted address - out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - subi YL, 2 ;[0] Only assign address on data packets, not ACK/NAK in r0 - sbci YH, 0 ;[1] - breq skipAddrAssign ;[2] - sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 12 cycles per bit -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts -;register use in receive loop to receive the data bytes: -; shift assembles the byte currently being received -; x1 holds the D+ and D- line state -; x2 holds the previous line state -; cnt holds the number of bytes left in the receive buffer -; x3 holds the higher crc byte (see algorithm below) -; x4 is used as temporary register for the crc algorithm -; x5 is used for unstuffing: when unstuffing the last received bit is inverted in shift (to prevent further -; unstuffing calls. In the same time the corresponding bit in x5 is cleared to mark the bit as beening iverted -; zl lower crc value and crc table index -; zh used for crc table accesses - -;-------------------------------------------------------------------------------------------------------------- -; CRC mods: -; table driven crc checker, Z points to table in prog space -; ZL is the lower crc byte, x3 is the higher crc byte -; x4 is used as temp register to store different results -; the initialization of the crc register is not 0xFFFF but 0xFE54. This is because during the receipt of the -; first data byte an virtual zero data byte is added to the crc register, this results in the correct initial -; value of 0xFFFF at beginning of the second data byte before the first data byte is added to the crc. -; The magic number 0xFE54 results form the crc table: At tabH[0x54] = 0xFF = crcH (required) and -; tabL[0x54] = 0x01 -> crcL = 0x01 xor 0xFE = 0xFF -; bitcnt is renamed to x5 and is used for unstuffing purposes, the unstuffing works like in the 12MHz version -;-------------------------------------------------------------------------------------------------------------- -; CRC algorithm: -; The crc register is formed by x3 (higher byte) and ZL (lower byte). The algorithm uses a 'reversed' form -; i.e. that it takes the least significant bit first and shifts to the right. So in fact the highest order -; bit seen from the polynomial devision point of view is the lsb of ZL. (If this sounds strange to you i -; propose a research on CRC :-) ) -; Each data byte received is xored to ZL, the lower crc byte. This byte now builds the crc -; table index. Next the new high byte is loaded from the table and stored in x4 until we have space in x3 -; (its destination). -; Afterwards the lower table is loaded from the table and stored in ZL (the old index is overwritten as -; we don't need it anymore. In fact this is a right shift by 8 bits.) Now the old crc high value is xored -; to ZL, this is the second shift of the old crc value. Now x4 (the temp reg) is moved to x3 and the crc -; calculation is done. -; Prior to the first byte the two CRC register have to be initialized to 0xFFFF (as defined in usb spec) -; however the crc engine also runs during the receipt of the first byte, therefore x3 and zl are initialized -; to a magic number which results in a crc value of 0xFFFF after the first complete byte. -; -; This algorithm is split into the extra cycles of the different bits: -; bit7: XOR the received byte to ZL -; bit5: load the new high byte to x4 -; bit6: load the lower xor byte from the table, xor zl and x3, store result in zl (=the new crc low value) -; move x4 (the new high byte) to x3, the crc value is ready -; - - -macro POP_STANDARD ; 18 cycles - pop ZH - pop ZL - pop cnt - pop x5 - pop x3 - pop x2 - pop x1 - pop shift - pop x4 - endm -macro POP_RETI ; 7 cycles - pop YH - pop YL - out SREG, YL - pop YL - endm - -macro CRC_CLEANUP_AND_CHECK - ; the last byte has already been xored with the lower crc byte, we have to do the table lookup and xor - ; x3 is the higher crc byte, zl the lower one - ldi ZH, hi8(usbCrcTableHigh);[+1] get the new high byte from the table - lpm x2, Z ;[+2][+3][+4] - ldi ZH, hi8(usbCrcTableLow);[+5] get the new low xor byte from the table - lpm ZL, Z ;[+6][+7][+8] - eor ZL, x3 ;[+7] xor the old high byte with the value from the table, x2:ZL now holds the crc value - cpi ZL, 0x01 ;[+8] if the crc is ok we have a fixed remainder value of 0xb001 in x2:ZL (see usb spec) - brne ignorePacket ;[+9] detected a crc fault -> paket is ignored and retransmitted by the host - cpi x2, 0xb0 ;[+10] - brne ignorePacket ;[+11] detected a crc fault -> paket is ignored and retransmitted by the host - endm - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG, YH, [sofError], x4, shift, x1, x2, x3, x5, cnt, ZL, ZH - push YL ;[-28] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-26] - push YL ;[-25] - push YH ;[-23] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-17] - rjmp foundK ;[-16] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-15] -;{3, 5} after falling D- edge, average delay: 4 cycles -;bit0 should be at 30 (2.5 bits) for center sampling. Currently at 4 so 26 cylces till bit 0 sample -;use 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push x4 ;[-14] -; [---] ;[-13] - lds YL, usbInputBufOffset;[-12] used to toggle the two usb receive buffers -; [---] ;[-11] - clr YH ;[-10] - subi YL, lo8(-(usbRxBuf));[-9] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-8] [rx loop init] - push shift ;[-7] -; [---] ;[-6] - ldi shift, 0x80 ;[-5] the last bit is the end of byte marker for the pid receiver loop - clc ;[-4] the carry has to be clear for receipt of pid bit 0 - sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) - rjmp haveTwoBitsK ;[-2] - pop shift ;[-1] undo the push from before - pop x4 ;[1] - rjmp waitForK ;[3] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 24 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[0] - push x2 ;[2] - push x3 ;[4] crc high byte - ldi x2, 1< jump back and store the byte - ori shift, 0x01 ;[11] invert the last received bit to prevent furhter unstuffing - in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - andi x5, 0xFE ;[1] mark this bit as inverted (will be corrected before storing shift) - eor x1, x2 ;[2] x1 and x2 have to be different because the stuff bit is always a zero - andi x1, USBMASK ;[3] mask the interesting bits - breq stuffErr ;[4] if the stuff bit is a 1-bit something went wrong - mov x1, x2 ;[5] the next bit expects the last state to be in x1 - rjmp didunstuff0 ;[6] - ;[7] jump delay of rjmp didunstuffX - -unstuff1: ;[11] this is the jump delay of breq unstuffX - in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - ori shift, 0x02 ;[1] invert the last received bit to prevent furhter unstuffing - andi x5, 0xFD ;[2] mark this bit as inverted (will be corrected before storing shift) - eor x2, x1 ;[3] x1 and x2 have to be different because the stuff bit is always a zero - andi x2, USBMASK ;[4] mask the interesting bits - breq stuffErr ;[5] if the stuff bit is a 1-bit something went wrong - mov x2, x1 ;[6] the next bit expects the last state to be in x2 - nop2 ;[7] - ;[8] - rjmp didunstuff1 ;[9] - ;[10] jump delay of rjmp didunstuffX - -unstuff2: ;[9] this is the jump delay of breq unstuffX - ori shift, 0x04 ;[10] invert the last received bit to prevent furhter unstuffing - andi x5, 0xFB ;[11] mark this bit as inverted (will be corrected before storing shift) - in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - eor x1, x2 ;[1] x1 and x2 have to be different because the stuff bit is always a zero - andi x1, USBMASK ;[2] mask the interesting bits - breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong - mov x1, x2 ;[4] the next bit expects the last state to be in x1 - nop2 ;[5] - ;[6] - rjmp didunstuff2 ;[7] - ;[8] jump delay of rjmp didunstuffX - -unstuff3: ;[9] this is the jump delay of breq unstuffX - ori shift, 0x08 ;[10] invert the last received bit to prevent furhter unstuffing - andi x5, 0xF7 ;[11] mark this bit as inverted (will be corrected before storing shift) - in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - eor x2, x1 ;[1] x1 and x2 have to be different because the stuff bit is always a zero - andi x2, USBMASK ;[2] mask the interesting bits - breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong - mov x2, x1 ;[4] the next bit expects the last state to be in x2 - nop2 ;[5] - ;[6] - rjmp didunstuff3 ;[7] - ;[8] jump delay of rjmp didunstuffX - - - -; the include has to be here due to branch distance restirctions -#define __USE_CRC__ -#include "asmcommon.inc" - - - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies -; 7.5 bit times is 90 cycles. ...there is plenty of time - - -sendNakAndReti: - ldi x3, USBPID_NAK ;[-18] - rjmp sendX3AndReti ;[-17] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov x3, cnt ;[-16] -sendX3AndReti: - ldi YL, 20 ;[-15] x3==r20 address is 20 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent - -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-6] <- acquire bus - ldi x2, 0 ;[-6] init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-5] exor mask - ldi shift, 0x80 ;[-4] sync byte is first byte sent -txByteLoop: - ldi bitcnt, 0x40 ;[-3]=[9] binary 01000000 -txBitLoop: ; the loop sends the first 7 bits of the byte - sbrs shift, 0 ;[-2]=[10] if we have to send a 1 don't change the line state - eor x1, x4 ;[-1]=[11] - out USBOUT, x1 ;[0] - ror shift ;[1] - ror x2 ;[2] transfers the last sent bit to the stuffing history -didStuffN: - nop ;[3] - nop ;[4] - cpi x2, 0xfc ;[5] if we sent six consecutive ones - brcc bitstuffN ;[6] - lsr bitcnt ;[7] - brne txBitLoop ;[8] restart the loop while the 1 is still in the bitcount - -; transmit bit 7 - sbrs shift, 0 ;[9] - eor x1, x4 ;[10] -didStuff7: - ror shift ;[11] - out USBOUT, x1 ;[0] transfer bit 7 to the pins - ror x2 ;[1] move the bit into the stuffing history - cpi x2, 0xfc ;[2] - brcc bitstuff7 ;[3] - ld shift, y+ ;[4] get next byte to transmit - dec cnt ;[5] decrement byte counter - brne txByteLoop ;[7] if we have more bytes start next one - ;[8] branch delay - -;make SE0: - cbr x1, USBMASK ;[8] prepare SE0 [spec says EOP may be 25 to 30 cycles] - lds x2, usbNewDeviceAddr;[9] - lsl x2 ;[11] we compare with left shifted address - out USBOUT, x1 ;[0] <-- out SE0 -- from now 2 bits = 24 cycles until bus idle - subi YL, 20 + 2 ;[1] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[2] -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[3] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< -int main (int argc, char **argv) -{ - int i, j; - for (i=0; i<512; i++){ - unsigned short crc = i & 0xff; - for(j=0; j<8; j++) crc = (crc >> 1) ^ ((crc & 1) ? 0xa001 : 0); - if((i & 7) == 0) printf("\n.byte "); - printf("0x%02x, ", (i > 0xff ? (crc >> 8) : crc) & 0xff); - if(i == 255) printf("\n"); - } - return 0; -} - -// Use the following algorithm to compute CRC values: -ushort computeCrc(uchar *msg, uchar msgLen) -{ - uchar i; - ushort crc = 0xffff; - for(i = 0; i < msgLen; i++) - crc = usbCrcTable16[lo8(crc) ^ msg[i]] ^ hi8(crc); - return crc; -} -*/ - -.balign 256 -usbCrcTableLow: -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 - -; .balign 256 -usbCrcTableHigh: -.byte 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2 -.byte 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04 -.byte 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E -.byte 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8 -.byte 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A -.byte 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC -.byte 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6 -.byte 0xD2, 0x12, 0x13, 0xD3, 0x11, 0xD1, 0xD0, 0x10 -.byte 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32 -.byte 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4 -.byte 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE -.byte 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38 -.byte 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA -.byte 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C -.byte 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26 -.byte 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0 -.byte 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62 -.byte 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4 -.byte 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE -.byte 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68 -.byte 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA -.byte 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C -.byte 0xB4, 0x74, 0x75, 0xB5, 0x77, 0xB7, 0xB6, 0x76 -.byte 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0 -.byte 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92 -.byte 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54 -.byte 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E -.byte 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98 -.byte 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A -.byte 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C -.byte 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86 -.byte 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 - diff --git a/tools/vusb/usbdrv/usbdrvasm20.inc b/tools/vusb/usbdrv/usbdrvasm20.inc deleted file mode 100644 index 303abaf..0000000 --- a/tools/vusb/usbdrv/usbdrvasm20.inc +++ /dev/null @@ -1,360 +0,0 @@ -/* Name: usbdrvasm20.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Jeroen Benschop - * Based on usbdrvasm16.inc from Christian Starkjohann - * Creation Date: 2008-03-05 - * Tabsize: 4 - * Copyright: (c) 2008 by Jeroen Benschop and OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm20.inc 740 2009-04-13 18:23:31Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 20 MHz version of the asssembler part of the USB driver. It -requires a 20 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! -*/ - -#define leap2 x3 -#ifdef __IAR_SYSTEMS_ASM__ -#define nextInst $+2 -#else -#define nextInst .+0 -#endif - -;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 20 MHz -> 13.333333 cycles per bit, 106.666667 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts -;register use in receive loop: -; shift assembles the byte currently being received -; x1 holds the D+ and D- line state -; x2 holds the previous line state -; x4 (leap) is used to add a leap cycle once every three bytes received -; X3 (leap2) is used to add a leap cycle once every three stuff bits received -; bitcnt is used to determine when a stuff bit is due -; cnt holds the number of bytes left in the receive buffer - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt - push YL ;[-28] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-26] - push YL ;[-25] - push YH ;[-23] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-19] - rjmp foundK ;[-18] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-16] -;{3, 5} after falling D- edge, average delay: 4 cycles -;bit0 should be at 34 for center sampling. Currently at 4 so 30 cylces till bit 0 sample -;use 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push bitcnt ;[-16] -; [---] ;[-15] - lds YL, usbInputBufOffset;[-14] -; [---] ;[-13] - clr YH ;[-12] - subi YL, lo8(-(usbRxBuf));[-11] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-10] [rx loop init] - push shift ;[-9] -; [---] ;[-8] - ldi shift,0x40 ;[-7] set msb to "1" so processing bit7 can be detected - nop2 ;[-6] -; [---] ;[-5] - ldi bitcnt, 5 ;[-4] [rx loop init] - sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) - rjmp haveTwoBitsK ;[-2] - pop shift ;[-1] undo the push from before - pop bitcnt ;[1] - rjmp waitForK ;[3] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 27 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[0] - push x2 ;[2] - push x3 ;[4] (leap2) - ldi leap2, 0x55 ;[6] add leap cycle on 2nd,5th,8th,... stuff bit - push x4 ;[7] == leap - ldi leap, 0x55 ;[9] skip leap cycle on 2nd,5th,8th,... byte received - push cnt ;[10] - ldi cnt, USB_BUFSIZE ;[12] [rx loop init] - ldi x2, 1< -#ifndef __IAR_SYSTEMS_ASM__ -# include -#endif - -#define __attribute__(arg) /* not supported on IAR */ - -#ifdef __IAR_SYSTEMS_ASM__ -# define __ASSEMBLER__ /* IAR does not define standard macro for asm */ -#endif - -#ifdef __HAS_ELPM__ -# define PROGMEM __farflash -#else -# define PROGMEM __flash -#endif - -#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) - -/* The following definitions are not needed by the driver, but may be of some - * help if you port a gcc based project to IAR. - */ -#define cli() __disable_interrupt() -#define sei() __enable_interrupt() -#define wdt_reset() __watchdog_reset() -#define _BV(x) (1 << (x)) - -/* assembler compatibility macros */ -#define nop2 rjmp $+2 /* jump to next instruction */ -#define XL r26 -#define XH r27 -#define YL r28 -#define YH r29 -#define ZL r30 -#define ZH r31 -#define lo8(x) LOW(x) -#define hi8(x) (((x)>>8) & 0xff) /* not HIGH to allow XLINK to make a proper range check */ - -/* Depending on the device you use, you may get problems with the way usbdrv.h - * handles the differences between devices. Since IAR does not use #defines - * for MCU registers, we can't check for the existence of a particular - * register with an #ifdef. If the autodetection mechanism fails, include - * definitions for the required USB_INTR_* macros in your usbconfig.h. See - * usbconfig-prototype.h and usbdrv.h for details. - */ - -/* ------------------------------------------------------------------------- */ -#elif __CODEVISIONAVR__ /* check for CodeVision AVR */ -/* ------------------------------------------------------------------------- */ -/* This port is not working (yet) */ - -/* #define F_CPU _MCU_CLOCK_FREQUENCY_ seems to be defined automatically */ - -#include -#include - -#define __attribute__(arg) /* not supported on IAR */ - -#define PROGMEM __flash -#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) - -#ifndef __ASSEMBLER__ -static inline void cli(void) -{ - #asm("cli"); -} -static inline void sei(void) -{ - #asm("sei"); -} -#endif -#define _delay_ms(t) delay_ms(t) -#define _BV(x) (1 << (x)) -#define USB_CFG_USE_SWITCH_STATEMENT 1 /* macro for if() cascase fails for unknown reason */ - -#define macro .macro -#define endm .endmacro -#define nop2 rjmp .+0 /* jump to next instruction */ - -/* ------------------------------------------------------------------------- */ -#else /* default development environment is avr-gcc/avr-libc */ -/* ------------------------------------------------------------------------- */ - -#include -#ifdef __ASSEMBLER__ -# define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */ -#else -# include -#endif - -#define USB_READ_FLASH(addr) pgm_read_byte(addr) - -#define macro .macro -#define endm .endm -#define nop2 rjmp .+0 /* jump to next instruction */ - -#endif /* development environment */ - -/* for conveniecne, ensure that PRG_RDB exists */ -#ifndef PRG_RDB -# define PRG_RDB(addr) USB_READ_FLASH(addr) -#endif -#endif /* __usbportability_h_INCLUDED__ */ diff --git a/tools/zsnes/docs/README.LINUX b/tools/zsnes/docs/README.LINUX deleted file mode 100644 index dfbe481..0000000 --- a/tools/zsnes/docs/README.LINUX +++ /dev/null @@ -1,11 +0,0 @@ -This is the first release of the linux zsnes version, so don't expect it to be -perfect. Anyway, most of the feature of the windows version are already -implemented including windowed and fullscreen rendering, sound, joystick -support, zip support, ... - -To use this version, you need to install SDL 1.2.0 (www.libsdl.org). -If you find any bug/missing feature in this version, please report it on the -zsnes-devel mailing list or on sourceforge bugtracker. Check -http://www.sourceforge.net/projects/zsnes for more information. - -If you are using debian or ubuntu be sure to install libsdl-dev diff --git a/tools/zsnes/docs/README.SVN b/tools/zsnes/docs/README.SVN deleted file mode 100644 index 27e5826..0000000 --- a/tools/zsnes/docs/README.SVN +++ /dev/null @@ -1,9 +0,0 @@ -If you are using the SVN version of ZSNES, you will need to run the following -command directly after checkout out the repository: - -sh autogen.sh - -This will create the ./configure file that you need to run before compiling -ZSNES. - -If you are not sure if you are using the SVN version, you are probably not. diff --git a/tools/zsnes/docs/authors.txt b/tools/zsnes/docs/authors.txt deleted file mode 100644 index 115f775..0000000 --- a/tools/zsnes/docs/authors.txt +++ /dev/null @@ -1,41 +0,0 @@ --------------- -The ZSNES Team --------------- - -zsKnight -_Demo_ -pagefault -Nach - ------------------- -Assistant Coders ------------------- -pharos -stainless -grinvader -Jonas Quinn -ipher - - ------------------- -Additional Authors ------------------- - -teuf -relnev -prometheus -theoddone33 -EvilTypeGuy -StatMat -MKendora -hpsolo -aaronl -Diablo-D3 - -------------- -Miscellaneous -------------- - -Wilbern Cobb - initial OpenBSD work -Thorsten "mirabile" Glaser - more OpenBSD integration -Mitchell "The Khan Artist/Noxious Ninja" Mebane - manpage diff --git a/tools/zsnes/docs/install.txt b/tools/zsnes/docs/install.txt deleted file mode 100644 index 95e5831..0000000 --- a/tools/zsnes/docs/install.txt +++ /dev/null @@ -1,183 +0,0 @@ -Compiling the Source Code: --------------------------- - -Well, for the moment, zsnes source 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 - -Note to see the bottom of this document if you are compiling releases for -distribution as opposed to CVS/SVN/WIP for personal use. - -First, you need the following software: - -DOS port: -- NASM v0.98.39 or higher : http://nasm.sourceforge.net -- DJGPP v2.03 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. -- zlib v1.2.3 or higher : http://www.zlib.net -- libpng : http://www.libpng.org/ - Build the static versions of both of these libraries using - DJGPP and do a 'make install' to put them where DJGPP - can find them. Afterwards you can go ahead and delete - the source for them from your hard drive. -- PDCurses : http://pdcurses.sourceforge.net - Only needed if you compile with the debugger. - -Then to build the executable, go to the src directory and type: -make -f makefile.ms PLATFORM=dos - -You may also want to compress zsnes.exe with upx (http://upx.sourceforge.net), -it will divide its size by 10. - - -DOS port cross compiling: --You need to get the DJGPP cross compiler and everything else mentioned above. --You might need to edit makefile.ms and change - i386-pc-msdosdjgpp-gcc and i386-pc-msdosdjgpp-g++ to something else. - -Then to build the executable, go to the src directory and type: -make -f makefile.ms PLATFORM=dos-cross - -If you have any problems we will probably not help you as cross compiling - is an advanced feature only for people who know what they are doing. - - - -Windows port with MSVC: -- GNU Make : http://unxutils.sourceforge.net/ -- NASM v0.98.39 : http://nasm.sf.net/ -- 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) - I have been able to successfully build ZSNES using the - Intel C++ drop-in replacement for Microsoft's C++ compiler - that comes with MSVC++ 5 and above. Since ZSNES contains - relatively small amounts of C, I don't see how Intel's - compiler could provide any useful optimizations (maybe - for winlink.cpp?). -- DX8.0 SDK or higher : you can get it at microsoft.com. It is quite big. - Also, edit makefile.ms 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 v1.2.3 or higher : http://www.zlib.net - you need the Win9x/WinNT static library (the dll version - doesn't seem to work with zsnes). Rename the static version - to zlib.lib and put it somewhere where vc++ will find it - (for example, the lib directory in vc++ dir). -- libpng : http://www.libpng.org/ - I'm not sure if the dynamically linked version of libpng - will work with ZSNES. To be safe I would recommend to just - go ahead and build the static version. Rename it to libpng.lib - and put it somewhere where MSVC++ will find it (usually the - lib subdirectory of your main MSVC++ directory). -- PDCurses : http://pdcurses.sourceforge.net - -Then to build the executable, go to the src directory and type: -make -f makefile.ms PLATFORM=msvc - -You may also want to compress zsnesw.exe with upx (http://upx.sourceforge.net), -it will divide its size by 10. - - - -Windows port with MinGW: -- GNU Make (don't use included in mingw): http://unxutils.sourceforge.net/ -- NASM v0.98.39 : http://nasm.sf.net/ -- MinGW : http://www.mingw.org -- Latest Win32API : http://www.mingw.org -- DirectX 8+ for MinGW : Parts of it are included with Win32API, parts aren't. - Check http://www.talula.demon.co.uk/allegro/wip.html - and http://www.talula.demon.co.uk/allegro/wip.html - for the rest of DirectX for MinGW. -- zlib v1.2.3 or higher : http://www.zlib.net -- libpng : http://www.libpng.org/ -- PDCurses : http://pdcurses.sourceforge.net - Only needed if you compile with the debugger. - -Then to build the executable, go to the src directory and type: -make -f makefile.ms PLATFORM=win32 - -You may also want to compress zsnesw.exe with upx (http://upx.sourceforge.net), -it will divide its size by 10. - - -Windows port cross compiling: --You need to get the MinGW cross compiler and everything else mentioned above. --You might need to edit makefile.ms and change - i586-mingw32-gcc, i586-mingw32-g++, and i586-mingw32-windres - to something else. - -Then to build the executable, go to the src directory and type: -make -f makefile.ms PLATFORM=win32-cross - -If you have any problems we will probably not help you as cross compiling - is an advanced feature only for people who know what they are doing. - - - -Linux/SDL/POSIX port: -I assume the standard development tools are installed (gcc, make, ...) -You'll also need : -- SDL (Simple DirectMedia Layer) : check www.libsdl.org to grab SDL 1.2.0 or - later. If you are using rpm packages, don't - forget the -devel package. -- NASM v0.98.39 : http://nasm.sf.net/ -- zlib v1.2.3 or higher : http://www.zlib.net - it is probably already installed on your - system, maybe you are just missing the - development headers. Check in the - packages available with your distribution - or go to the page above -- libpng : http://www.libpng.org/ - You might also need libpng, ZSNES will compile without - PNG support but I have found doing so to make ZSNES - unstable for some weird reason. If you don't have - libpng, either get it and install it or pass the - --without-png option to the 'configure' script. -- Curses/NCurses - Check your distro. One of these is needed if you compile with - the debugger enabled. You may also have to symlink ncurses.h - to curses.h in your include directory. - -Then to build the executable, go to the src directory and type: -sh ./autogen.sh && gmake && gmake install - -Note: This only covers SVN/WIP builds, for releases see instructions below. - -Note: autogen.sh requires automake and autoconf installed. Any parse errors -you recieve about configure.in are due to those not being installed. - -Note: you require root to install zsnes to the the default (/usr/local/*) -directory - -Also Note: libpng (optional) needs to be recent, or zsnes will not use it - -You may also want to compress the zsnes executable with upx -(http://upx.sourceforge.net), it will divide its size by 10. - - -Compiling for official builds: -Windows - MSVC: make -f makefile.ms PLATFORM=msvc RELEASE=yes -Windows - MinGW: make -f makefile.ms PLATFORM=win32 RELEASE=yes -DOS: make -f makefile.ms PLATFORM=dos RELEASE=yes -SDL - Package Maintainers: ./configure --enable-release --disable-cpucheck force_arch=i586 -SDL - Personal: ./configure --enable-release - -Note this is important to remove certain debug messages, as well -as provide heavy optimization (which could take up to an hour -to compile). It also ensures the builds will work with CPUs -matching i586 or higher. -If compiling for personal use, on DOS and Windows-MinGW, add -CPU=your_cpu, where your_cpu matches a GCC -march option. -You can use the archopt utility in tools/ to tell you what is -best. For SDL, remove --disable-cpucheck force_arch=i586. - -If you are providing an SDL package for a particular arch -greater than i586, replace force_arch=i586 with the proper -one. diff --git a/tools/zsnes/docs/license.txt b/tools/zsnes/docs/license.txt deleted file mode 100644 index 1bcc46f..0000000 --- a/tools/zsnes/docs/license.txt +++ /dev/null @@ -1,342 +0,0 @@ - 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. - - - Copyright (C) - - 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. - - , 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. - - diff --git a/tools/zsnes/docs/opengl.txt b/tools/zsnes/docs/opengl.txt deleted file mode 100644 index 5c069d5..0000000 --- a/tools/zsnes/docs/opengl.txt +++ /dev/null @@ -1,100 +0,0 @@ -This document is no longer up-to-date, but is a good start to -understanding how the OpenGL code works for non-filtered modes. -------------------------------------------------------------------------- - - OpenGL is currently only available on Linux and via CVS. For the most -part, it works and fairly stable. Please send all comments, suggestions, -and bug fixes to hpsolo@my-deja.com. DO NOT EMAIL THE OTHER DEVELOPERS -SINCE THEY ARE not INVOLVED WITH THIS CODE. And please make sure you've -read through the list of known issues before sending your bug report. - - -HOW OPENGL RENDERS THE SNES VIDEO BUFFER - - The SNES video buffer has dimensions 288x224 (sometimes 288x239 for -certain games; however I have not come across any). The first 16 and last -16 column of pixels are not displayed (perhaps used as a scrolling -buffer?), so the only important part of the video buffer is the middle -256x224 pixels. The SNES video buffer pointer is vidbuffer. With OpenGL, -only the visible 256x224 pixels are needed and they are cropped into -glvidbuffer. glvidbuffer is then turned into a texture that gets bound to -a QUAD whose size depends on whether ZSNES uses aspect ratio to display -each frame. - - -HI-RES FILTERS WITH OPENGL - - The video mode selection is taken care of by SDL, including full -screen mode. The current code does not allow for many hi-res filter -options. While it is not difficult to implement the hi-res features using -the current filtering code (in copyvwin.asm), it appears that the code for -copy640x480x16bwin() causes memory corruption and sometimes segfaults when -you exit ZSNES. For this reason, the filters have been left out. You can, -however, add it in yourself by: - - 1. allocating enough memory space for glvidbuffer (use realloc) - 2. assign glvidbuffer to the destination pointer SurfBufD (instead of - surface->pixels) - 3. setting Temp1 to surface->pitch, i.e. Temp1 = 2*SurfaceX - 4. calling copy640x480x16bwin() - 5. correctly binding the glvidbuffer as a texture to a QUAD - -There is a old patch that enables these filters and it is located at: -http://www.students.uiuc.edu/~handuong/opengl.patch2 - - -3DFX USERS (VOODOO2 AND OLDER HARDWARE) - - Lord_Nightmare managed to get OpenGL to work on a Voodoo2. Some -things you'll need to do in order to get ZSNES OpenGL to work on your -Voodoo: - - 1. Make sure to have the latest Mesa drivers and compile it with - the following option: - - make -f Makefile.X11 linux-386-glide - - Voodoo2 users might want to use: - - make -f Makefile.X11 linux-386-opt-glide - - since that is optimized for Voodoo2 cards. According the the - XFree86 website, Voodoo3 users (and later) should have DRI - support via the tdfx driver so this might not be needed. - - 2. When you run ZSNES, make sure to set the environment variable - MESA_GLX_FX to either w or f (window/full screen). E.g. use - - export MESA_GLX_FX=f - - if you use a bash shell. Theoretically using the w option - should work, but it not only is slow (5fps) but seems - broken. Voodoo Rush users might be able to get by. - -Note that only the 640x480 full screen mode works on the Voodoo2 cards -so please do not email me about the other video modes. Files which -might be useful to have before compiling anything: - -Device3Dfx, Glide_SDK, Glide_V2 (or Glide_XXXX depending on your card) - -I believe Glide 2 is what you want, as Glide 3 doesn't work for older -hardware. Also Device3Dfx may not be implemented the same way for 2.4.x -kernels. - - -KNOWN ISSUES (AND SOME WORK-AROUNDS) - -- after many video mode switches (all windowed), switching to full screen - then back to window mode cases an SDL parachute exit; try not to use too - many video mode changes, and restart ZSNES every once in a while if you - are just testing out video modes - -- segfault after having compiled the source -- this might be due to an old - zguicfg.dat file; delete this and see if the problem gets fixed - - -TODO - -- use something like SDL_GL_UpdateRects with hi-res filters - - -- hpsolo -- diff --git a/tools/zsnes/docs/readme.1st b/tools/zsnes/docs/readme.1st deleted file mode 100644 index 6b75722..0000000 --- a/tools/zsnes/docs/readme.1st +++ /dev/null @@ -1,4 +0,0 @@ -If you need help to compile ZSNES, read install.txt, or if you want a directory -to the sources, read srcinfo.txt. The offical website is at http://www.zsnes.com -and the sourceforge mirror is at http://zsnes.sourceforge.net/. The development chat is on -#zsnes on irc.freenode.net. diff --git a/tools/zsnes/docs/readme.htm/about.htm b/tools/zsnes/docs/readme.htm/about.htm deleted file mode 100644 index 5d8135b..0000000 --- a/tools/zsnes/docs/readme.htm/about.htm +++ /dev/null @@ -1,265 +0,0 @@ - - - - - About - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - -
- -
- -

About

- -
-

About ZSNES

-

ZSNES is a SNES emulator that has been worked on since 1997. Originally programmed by zsKnight and _Demo_, the project has since then attracted a number of new developers and contributors.

-

On April 2, 2001, the ZSNES project was GPL'ed and its source released to the public. Written in a mixture of x86 assembler, C, and C++, ZSNES currently runs on Windows, DOS, x86 versions of Linux and FreeBSD, x86 Macintosh computers, and the Microsoft Xbox.

- -
-

Donations

- -

If you enjoy using ZSNES to re-live and enhance your experiences with the Super Nintendo, please consider making a donation to support further development.

-

You have two options when making a donation. You can choose to make a donation through the ZSNES SourceForge Project Donation Page: Donate to ZSNES through SourceForge.

-

Alternatively, you can send money to the ZSNES creator's PayPal account: Donate directly to zsKnight, creator of ZSNES.

-
-
- -
-

About the Documentation

- -

The ZSNES Documentation Project was started by RichardC in an attempt to update and reorganize all of the ZSNES documentation into an easy to read, easy to access collection. It made its public debut upon the release of ZSNES v1.40. It is officially available in HTML, CHM, and text formats.

-

If you have any suggestions or corrections that you would like to submit, feel free to let us know at our forum on the ZSNES Message Board.

-

RichardC would like to give a special thanks to Nach and the ZSNES community for all the help and support that they have given to him and the project.

-
- -
-

Credits

- -
-

Founding Developers

- -
    -
  • zsKnight
  • -
  • _Demo_
  • -
-
- -
-

Current / Active Developers

- -
    -
  • pagefault - primary core developer, primary Win port developer.
  • -
  • Nach - primary non-core developer, mostly works on significant back-end overhauling and large new features.
  • -
  • grinvader - primary ASM to C porter, primary Unix build maintainer, many GUI improvements and other, and power of no pants.
  • -
  • Jonas Quinn - primary bug fixer, also video code contributor.
  • -
  • ipher - ZSNES GUI expert, WIP distributor.
  • -
  • Deathlike2 - minor feature adder, also an ASM to C porter.
  • -
-
- -
-

Assistant Coders

- -
    -
  • hpsolo
  • -
  • Pharos
  • -
  • Siloh (a.k.a. Stainless, a.k.a. randilyn)
  • -
  • StatMan
  • -
  • teuf
  • -
  • theoddone33
  • -
-
- -
-

Contributors (in alphabetical order)

- -
    -
  • aaronl
  • -
  • Aerdan
  • -
  • amit
  • -
  • anomie
  • -
  • BRPXQZME
  • -
  • byuu
  • -
  • Diablo-D3
  • -
  • EvilTypeGuy
  • -
  • hector
  • -
  • Khan Artist (a.k.a. Noxious Ninja)
  • -
  • kode54
  • -
  • Kreed
  • -
  • MaxSt
  • -
  • MKendora
  • -
  • Neviksti
  • -
  • Overload
  • -
  • prometheus
  • -
  • relnev
  • -
  • snes6502
  • -
  • TRAC
  • -
  • zinx
  • -
-
- -
-

Documentation Writers/Contributors

- -

Contributors are listed loosely based on their dates of contribution.

-
    -
  • RichardC - founder of the ZSNES Documentation Project. First active administrator. He had the dirty job of doing the initial conversion of the docs into HTML.
  • -
  • Nach - programmer extraordinaire, and knows ZSNES very well. He helps a lot in documenting the obscure things we writers don't know about.
  • -
  • LDAWG - updated v1.40 changelog, based on a 2 year summary by Nach, as well as another 6 months of developer notes.
  • -
  • kevman - helped with the v1.40 FAQ updates.
  • -
  • xamenus - joined the project shortly after RichardC's initial release, and made many grammar fixes and updated the content. Combined the three separate, port-specific documentations into one. Still contributes some content from time to time.
  • -
  • Noxious Ninja - manpage expert. No longer active in the emulation "scene", he always had something useful to contribute.
  • -
  • Clements - maintainer of the CHM file. Also assists with coding and content.
  • -
  • AspiringSquire - designer and maintainer of the TXT version of the docs; occasionally contributes content. Also an expert with grammar and vocabulary corrections.
  • -
  • Jipcy - current active administrator and mark-up chief. Manages and contributes to all parts of the docs.
  • -
  • Jonas Quinn - mainly helps in super-optimizing the images.
  • -
  • Deathlike2 - ZBoard tech help expert. Also makes many suggestions/corrections to the docs.
  • -
-

Special thanks to Radio. He designed the ZSNES.com main page layout, from which we stole this design for the HTML docs. Also special thanks to Roman Rudenko, for finding the elusive "display:inline" fix for floated items in IE.

-

Also thanks to SnesCentral for providing some info!

-
- -
-

Thanks

- -

All ports of ZSNES use NASM v0.98+, GNU Make, zlib, libpng, and JMAlib to compile, link, compress, decompress, and execute.

-

In addition to the above, ZSNES Win uses Visual C++ 2003 (or MinGW), DirectX 8, UPX, and ManyMouse; ZSNES SDL uses GCC, SDL v1.20, and ManyMouse; and ZSNES DOS uses DJGPP, CWSDPMI, and UPX.

-

Thanks to those who produced these fine programs!

- -
Special Thanks to:
-
    -
  • wnelson; without him, ZSNES would have never existed!
  • -
  • Y0SHi for his excellent SNES docs, his help, and his excellent support!
  • -
  • Ashley, Barubary, CyberWarriorX, DCX, DooMStalK, Fanwen, GreenImp, Hucard, Kaiden, PolestaR, Stalphos Knight, Star Creator, TeleKawaru, the people on the ZSNES IRC channel, and the regulars of the ZSNES message board!
  • -
  • All of our beta testers for being a great help!
  • -
  • The MAME team; info on 256x256x256 scanlines mode is from the MAME source!
  • -
- -
Also Thanks to:
-
    -
  • The_Teach of Snes9x for some great info and the nice chats!
  • -
  • Trepalium of Snes9x for some great info and help!
  • -
  • Gary of Snes9x and Steve Snake of Kega for being the source of info for sound decompression!
  • -
  • Gary of Snes9x for being the source of info for TCall/PCall and also for lots of help!
  • -
  • MrGrim for his great support!
  • -
  • Crono for info on Sound Blaster programming, surround sound, sound interpolation, and other sound stuff!
  • -
  • Aquis for the ZSNES logo!
  • -
  • Alucard for helping us with an issue in the 65816!
  • -
  • Vertigo for making a compatibility list!
  • -
  • EFX for being a great supporter and also giving a lot of help and stuff!
  • -
  • Zophar for being a great supporter and also maintaining the mirror site!
  • -
  • Chris Hickman for redesigning the ZSNES web page!
  • -
  • CSoft for (previously) hosting our web page!
  • -
  • Marius Fodor for the code for VSync, Sidewinder, Gamepad Pro, and some optimization info!
  • -
  • Sardu for some great info and help!
  • -
  • Lord ESNES for some great help!
  • -
  • Robert Grubbs for the Sidewinder info!
  • -
  • Nerlaska for some useful info on optimizing and also for some help!
  • -
  • Diskdude for writing SNESkart which we used for the info on cheat codes!
  • -
  • DarkForce for some great help!
  • -
  • Pharos for some keyboard coding help!
  • -
  • Ivar and Gary of the Snes9x team for all their great help, which includes their SuperFX info and code, DSP-1 info, info on interleave formats (HiROM and SuperFX), offset per tile mode, FIR filter, and some insights on SPC700 and HDMA bugs!
  • -
  • WolfWings ShadowFlight for help on several issues of NASM!
  • -
  • Wildfire for some help!
  • -
  • A CoolMan for the algorithm for EAGLE!
  • -
  • Neill Corlett for some info on the .ips format and also helping out a lot on improving the sound engine!
  • -
  • Kreed for the 2xSaI and Super Eagle source codes!
  • -
  • Markus Oberhumer and Laszlo Molnar for the UPX compression utility.
  • -
  • Jean-loup Gailly, Mark Adler, and Gilles Vollant for the unzip routines!
  • -
  • kode54 for the low pass filter routines!
  • -
  • Andy Goth for some help on the design of the key combination engine!
  • -
  • Yamaha of XYZZ (Scott Scriven) for his water effect code.
  • -
  • ipher for compiling and releasing WIP builds!
  • -
  • cdbsi for the ZSNES icons!
  • -
  • The Dumper for lots of help with special chips.
  • -
  • snes6502 for the Xbox port!
  • -
  • hector and BRPXQZME for helping to port ZSNES to Mac OS X!
  • -
  • The NSRT Team, for their excellent utility, JMA compression, NSRT headers, and a great database!
  • -
  • All those people who contributed by either updating the docs, helping us, supporting us, or reporting bugs!
  • -
-

The changelog contains innumerable credits to people for their contributions or individual fixes. Many of them are not listed on this page.

-

Also thanks to all those whom we forgot!

-

Also, good luck to all those who are writing emulators, especially those who are writing SNES emulators, including Snes9x, SNEeSe, Super Sleuth, and bsnes!

-
- -
- -
- - - -
- - - - \ No newline at end of file diff --git a/tools/zsnes/docs/readme.htm/advanced.htm b/tools/zsnes/docs/readme.htm/advanced.htm deleted file mode 100644 index 5ad8393..0000000 --- a/tools/zsnes/docs/readme.htm/advanced.htm +++ /dev/null @@ -1,827 +0,0 @@ - - - - - Advanced Usage - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - -
- -
- -

Advanced Usage

- -
-

This page documents the advanced features of ZSNES, probably not useful for most end users.

-
- -
-

Movie Dumping

- -

Please note that ZSNES does not support real-time video encoding. ZSNES only encodes existing ZMV (ZSNES movie) files. Refer to the GUI page for instructions on recording movies.

-

All instructions in this section assume that you are using the default settings of the zmovie.cfg file. If you are smart enough to edit zmovie.cfg, you had better be smart enough to dump movies with whatever new settings you've created.

-

You can dump video output alone, audio output alone, both at the same time (to separate files), or both to the same file (merged). If you choose to dump audio output, you can choose to dump that audio output uncompressed or compressed to MP3. Both uncompressed and compressed audio can be merged with the video.

- -
-

About Video Encoding

-

Video encoding requires MEncoder.

-
- -
-

About Audio Encoding

-

Audio encoding requires LAME. Currently, Windows users must use this fixed LAME build due to a bug in the official versions.

-

You have a choice of dumping audio either in uncompressed PCM format with WAV header, or compressed as MP3. ZSNES uses LAME for MP3, so you can expect high-quality audio, given the bit rate.

-

When dumping audio to a separate file (not merged with video), audio compressed to MP3 will be about 6% of the size of the same uncompressed PCM audio.

-
- -
-

Dumping a Movie

-
    -
  1. Place your MEncoder (mencoder.exe) and LAME (lame.exe) binaries in the same directory as ZSNES. Alternatively, configure your PATH environment variable to include the directories where MEncoder and LAME are installed.
  2. -
  3. Start ZSNES and load a game.
  4. -
  5. Open the Movie Options dialog. (Misc Menu->Movie Opt).
  6. -
  7. Make sure to select the correct movie slot, depending on which movie slot you used to record a ZMV.
  8. -
  9. Select the Dumping tab, and configure the Video Options and Audio Options to your liking.
  10. -
  11. Hit the Start button.
  12. -
  13. ZSNES will then exit the GUI and start playing back the previously recorded movie. If you chose to encode the video and/or audio output, you will see a console window appear, showing the progress of encoding. Don't worry if ZSNES slows down while playing back the movie; it needs to do this because the encoding process takes a lot of processor time.
  14. -
  15. ZSNES will indicate when the movie has finished playback (and encoding). You can now look in your ZSNES directory for the newly created file(s).
  16. -
-

Note: ZSNES does not create an uncompressed temporary file and then encode it. Instead, the output stream is directly encoded. The only output files will be the finished, compressed files. Because ZSNES must encode the output stream as it is generated, ZSNES may delay the output of new frames of video/audio to give more time to MEncoder/LAME to compress the current frame. This means that you should not worry if you see the playback of your movie slow down while ZSNES is dumping it. The dumped file(s) will play back at full speed!

-
- -
- -
-

Configuration Files

- -

Every time you run ZSNES, it checks to see if these files are present in the same directory as the ZSNES executable. If they are not, ZSNES will create them with their default values. Thus, if you are having weird problems with ZSNES, try deleting these files.

- -

If there are any missing or invalid lines in zsnes*.cfg, ZSNES will insert or replace the lines with their default values.

- -
-

zsnes*.cfg

-

Almost every option available in ZSNES can be configured in this file. If there is something you don't understand in this file, please refrain from changing it, and instead set the option from within the ZSNES GUI.

-

The last letter of the filename is different for each port. Windows: zsnesw.cfg. SDL: zsnesl.cfg. DOS: zsnes.cfg.

-
- -
-

zmovie.cfg

-

This file contains movie-dumping configuration information.

-

You can edit this file to make ZSNES use something other than MEncoder or LAME, or to tweak options. Read the MEncoder and LAME manuals to see what options you can tweak. If you choose other applications, they must support stream input via stdin and raw video (in the case of video encoding). Refer to the appropriate documentation for more information.

-

Unfortunately, you're on your own if wish to play with this.

-
- -
-

zfont.txt

-

This file contains the font data for the ZSNES GUI. You can edit this file to customize the font.

-
    -
  • Comments are preceded by a ; and can be up to 99 characters in length. -
    • In the default file, each comment precedes the character it's labeling.
    -
  • -
  • Each letter is represented by a block of five rows, each containing 8 bits. Only the first five columns of bits are used for font data; ZSNES uses a 5x5 font. The last three columns of bits should always be zeros. -
    • There are characters for English, Hiragana, and Katakana scripts.
    -
  • -
  • In case it isn't obvious, a 1 means the pixel is on in that location. A 0 means it's off. If you view zfont.txt, you should be able to figure it out.
  • -
  • The file terminates on the EOF+newline character or the last character (whichever comes first).
  • -
-

The absolute ordering of each and every line in this file is important. If you're missing a single line, things might start messing up. Just so you know, the last line of data should be on line 846, followed by the EOF character on line 847.

-

If you mess something up, just delete zfont.txt, and ZSNES will re-generate it as normal.

-
-
- -
-

Debugger

- -

The debugger, now available in all ports, is enabled only when you enter ZSNES with a -d. (If you are using the DOS port, just type "zsnes -d" at the commandline. Win port users should add a "-d" after their ZSNES shortcut target). Loading a ROM via a command line will start ZSNES in debugger mode; otherwise press F1 to reach it.

-

Average users, however, should have no need to use the debugger.

- -
-

Debugger Keys:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyFunction
1Enable/Disable SPC700 display
2Enable/Disable 65816 display
TTrace (in 65816 opcodes)
B65816 break point
SSPC break point
CClear counter
M65816 modify
ASPC modify
DDebug dump (SPC/DSPRAM dump only)
WBreak at signal (used only by the programmers)
F1Switch between debugger input and game input
F2Save state
F4Load state
EscExit entire program
-
-
- -
-

KitchenSync (Win port only)

- -

This makes NTSC games (60Hz) run at 120Hz, and PAL games (50Hz) run at 100Hz. To enable it, just start ZSNESw with the -ks switch. Alternatively, you can create a shortcut to ZSNESw that starts with this switch enabled, every time. First create a shortcut to ZSNESw in Windows. Next, right-click on the shortcut and choose Properties. Then, put the cursor right after the quotation marks in the Target box, press the space bar, and type -ks. Finally, click OK. If ZSNESw crashes or refuses to start after enabling this, your monitor does not support the 100/120 Hz refresh rate.

-

If your monitor supports 100Hz and not 120Hz, you can instead use the -kp switch for PAL only. This way, you will not have to disable the -ks switch every time you wish to play an NTSC game.

- -
- -
-

Command-Line Arguments

- -

ZSNES supports execution arguments via the command line. More detailed descriptions of how to use the arguments with each port is forthcoming.

-

Clicking on the description of an argument will take you to the corresponding GUI option, if one exists.

-

Usage : zsnes* [-d,-f #, ... ] filename.sfc

-

Example : zsnes* -s -r 2 game.sfc

-

*Fill in the appropriate letter for your port when entering this into the command line.

- -
-

Universal Switches

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ArgumentSub-ArgumentDescription
-1 #/-2 #Select Player 1/2 Input
0None
1Keyboard
-dStart with debugger enabled
-ddDisable sound SPC700/DSP emulation, which also disables sound output
-dhDisable ROM-specific hacks
-dsDisable sound output
-f #[0...9]Enable fixed frame rate
-g #[0...15]Specify gamma correction value
-hForce HiROM
-jDisable Mouse (Automatically turns off right mouse-click)
-k #[0...100]Set volume level
-lForce LoROM
-mDisable GUI (must specify ROM filename)
-mcExit ZSNES when closing a movie (use with -zm)
-md #Dump video (use with -zm)
1Raw
2FFV1
3x264
4XviD
5Custom
-ml #Define movie dump length in amount of frames (use with -md)
-n #Enable scanlines (when available)
0None
1Full
225%
350%
-oDisable MMX support
-p #[50...150]Percentage of instructions to execute
-r #Set sound sampling rate
08000Hz
111025Hz
222050Hz
344100Hz
416000Hz
532000Hz
648000Hz
-sEnable sound output and enable SPC700/DSP emulation
-saShow all extensions in GUI (*.*)
-tForce NTSC timing
-uForce PAL timing
-v8Grayscale mode
-yEnable Interpolation graphics filter
-zDisable stereo sound
-zm #[0...9]Auto load specified movie slot on startup
-zs #[0...99]Auto load specified save state slot on startup
- -
- -
-

Windows-only Switches

- -

From the Windows NT command-line, you can use the following command to view the accepted command-line input for a given ZSNES binary: zsnesw -? | more. Typing zsnesw -? does not work.

-

Users of any flavor of Windows can use the following command to output to a file the same information returned from the command above: zsnesw -? > commands.txt.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ArgumentSub-ArgumentDescription
-3Enable triple buffering (disables VSync)
-6 #[50...180]Force a user-specified refresh rate for fullscreen modes
-js #[0...32767]Set joystick sensitivity
-kpEnable the KitchenSync for PAL only (100Hz)
-ksEnable the KitchenSync for NTSC and PAL (120Hz/100Hz)
-v #Select Video Mode:
0256x224 R WIN
1256x224 R FULL
2512x448 R WIN
3512x448 DR WIN
4640x480 S WIN
5640x480 DS WIN
6640x480 DR FULL
7640x480 DS FULL
8640x480 S FULL
9768x672 R WIN
10768x672 DR WIN
11800x600 S WIN
12800x600 DS WIN
13800x600 S FULL
14800x600 DR FULL
15800x600 DS FULL
161024x768 S WIN
171024x768 DS WIN
181024x768 S FULL
191024x768 DR FULL
201024x768 DS FULL
211024x896 R WIN
221024x896 DR WIN
231280x960 S WIN
241280x960 DS WIN
251280x960 S FULL
261280x960 DR FULL
271280x960 DS FULL
281280x1024 S WIN
291280x1024 DS WIN
301280x1024 S FULL
311280x1024 DR FULL
321280x1024 DS FULL
331600x1200 S WIN
341600x1200 DS WIN
351600x1200 DR FULL
361600x1200 DS FULL
371600x1200 S FULL
38CUSTOM D WIN
39CUSTOM DS FULL
40CUSTOM WIN
41CUSTOM S FULL
42CUSTOM DR FULL
-wEnable VSync (disables triple buffering)
- -
- -
-

SDL-only Switches

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ArgumentSub-ArgumentDescription
-ad <>Audio Driver (note you may not have all of these):
autoSelect a driver automatically - uses SDL without libao
nullNo sound, only available with libao
ossOpen Sound System, only available with libao on UNIX systems with OSS
alsaAdvanced Linux Sound Architecture, only available with libao on Linux systems with ALSA
alsa09Advanced Linux Sound Architecture, only available with libao on Linux systems with ALSA
polyppolypaudio (next generation GNOME sound server), only available with libao and new versions of GNOME
esdESounD or Enlightened Sound Daemon, only available with libao and ESD installed
sunSun Microsystem's audio system, only available with libao and Solaris or certain BSD systems
irixIRIX audio system, only available with libao and IRIX systems
nasNetwork Audio System, only available with libao and NAS installed
artsAnalog RealTime Synthesizer sound, only available with libao on systems with aRts (KDE)
sdlSimple DirectMedia Layer sound
-js #[0...32767]Set joystick sensitivity
-v #Select Video Mode:
0256x224 R WIN
1256x224 R FULL
2512x448 DR WIN
3512x448 DR FULL
4640x480 DR FULL
5256x224 OR WIN
6512x448 ODR WIN
7640x480 ODS FULL
8640x480 ODS WIN
9640x560 ODR WIN
10768x672 ODR WIN
11800x600 ODS FULL
12800x600 ODS WIN
13896x784 ODR WIN
141024x768 ODS FULL
151024x768 ODS WIN
161024x896 ODR WIN
171280x960 ODS FULL
181280x1024 ODS FULL
191600x1200 ODS FULL
20VARIABLE ODR WIN
21VARIABLE ODS WIN
22CUSTOM OD FULL
- -
- -
-

DOS-only Switches

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ArgumentSub-ArgumentDescription
-0Force black background in 8-bit modes
-1 #/-2 #Select Player 1/2 Input:
22 Button
34 Button
46 Button
58 Button
6Sidewinder #1
7Sidewinder #2
8Sidewinder #3
9Sidewinder #4
10Gamepad Pro #0
11Gamepad Pro #1
12LPT1 #1
13LPT1 #2
14LPT1 #3
15LPT1 #4
16LPT1 #5
-3Enable triple buffering (disables VSync)
-8Force 8-bit sound
-cEnable full/wide screen (when available)
-ccEnable small screen (when available)
-spReport sound detection information
-v #Select Video Mode:
0256x224x8B (MODEQ)
1256x240x8B (MODEQ)
2256x256x8B (MODEQ)
3320x224x8B (MODEX)
4320x240x8B (MODEX)
5320x256x8B (MODEX)
6640x480x16B (VESA1)*
7320x240x8B (VESA2)
8320x240x16B (VESA2)
9320x480x8B (VESA2)
10320x480x16B (VESA2)
11512x384x8B (VESA2)
12512x384x16B (VESA2)
13640x400x8B (VESA2)
14640x400x16B (VESA2)
15640x480x8B (VESA2)
16640x480x16B (VESA2)
17800x600x8B (VESA2)
18800x600x16B (VESA2)
-wEnable VSync (disables triple buffering)
- -

*The 640x480x16B (VESA1) video mode is compatible with many video cards, but can also be very slow. We recommend that you use a VESA2 mode if your video card supports it. Please see the system requirements for more information.

-
- -
- -
- - - -
- - - - diff --git a/tools/zsnes/docs/readme.htm/faq.htm b/tools/zsnes/docs/readme.htm/faq.htm deleted file mode 100644 index 8156eb6..0000000 --- a/tools/zsnes/docs/readme.htm/faq.htm +++ /dev/null @@ -1,591 +0,0 @@ - - - - - Frequently Asked Questions - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - -
- -
-

FAQ

- -
-

The FAQ page was first included in version 0.390 of ZSNES, released on April 11, 1998.

-
- -
-

Question Index

- -
-

UNIVERSAL QUESTIONS

- - -
- - - - - - -
- -
-

UNIVERSAL QUESTIONS

- -
-

General

- -
-
Q: Where do I download games / ROMs?
-
A: Due to the questionable legality of ROM images of commercial games, the ZSNES Team cannot and will not provide you with any games / ROMs. We must do this in order to keep ZSNES, as an emulator, legal. Please see the disclaimer.
- -
Q: What is the "save directory"?
-
A: Please read more about the types of files ZSNES generates and where they are created here. -

By default, in the Win and DOS ports of ZSNES, these files will go into their corresponding ROM directory (e.g. If your Chrono Trigger ROM is in C:\SNES Games\RPG, its files will go into that folder; if your Harvest Moon ROM is in C:\SNES Games\Simulation, its files will go into that folder). In the SDL port of ZSNES, however, saves will go into ~/.zsnes by default. ZSNES SDL under Mac OS X will place them in ~/Library/Application Support/ZSNES instead.

-

If you dislike the default settings, you can configure a single, universal save path by either going to the Config -> Paths menu in the GUI or by editing the ZSNES configuration file.

-
- -
Q: Why are my games not saving?
-
A: If your ROM images are stored on a CD-ROM, you need to define a save directory that points to your hard drive. In order to do this, either go to Config-->Paths and enter a directory, or edit the ZSNES configuration file by typing in a directory after "SaveDirectory=". Make sure that this directory is not marked read-only. -

If this still does not solve your problem, enable SRAM Check + Save under the Config-->Saves menu.

-
- -
Q: Are the ZSNES data files compatible among the various ZSNES ports (Win/DOS/SDL)?
-
A: Yes. Unlike certain PC applications and games, ZSNES's various save files and formats are completely port-independent; you can share any of your files with any user using any port of ZSNES (although some things may be version-dependent). Note, however, that ZSNES's configuration file contains port-specific options which don't exist in other ports, so while they can be transfered between ports, some things won't work as expected. Note that when transfering various files, make sure they're named properly and in the proper location. -
- -
Q: Is there Toaster Support?
-
A: While we'd love for ZSNES to lace our shoes, feed us, breathe for us, and amass wealth for us, we can't add every crazy feature that comes up. Even though ZSNES does have many, many features that are not necessarily SNES related, they normally don't go beyond features that you'd expect from an advanced gaming system. -

Regarding toaster support itself, rumor has it ZSNES does bread toasting if you happen to be using it after midnight while paying your respects to the master of all controls and considering monetary options.

-
-
-
- -
-

Games

- -
-
Q: Why don't my games work after applying IPS patches to them?
-
A: If your patched game crashes early or just displays a black screen, you probably need to either add or remove the 512 byte offset from the patch. Use the program IPSEDIT to do this, which is bundled along with NSRT. -

Alternatively, you could either add or remove a header from your ROM before patching. Again, NSRT is capable of doing this.

-
- -
Q: Does ZSNES support Snes9x, GoodSNES, and NSRT ROMs? Or only ZSNES ones?
-
A: ZSNES, Snes9x, GoodSNES, and NSRT ROMs do not exist. All these programs work with SNES ROMs. As ZSNES is an SNES emulator, it will work with all SNES ROMs (except where ZSNES has a bug or the ROM is in an unsupported interleave format). -
-
-
- -
-

Video

- -
-
Q: Why do my scanlines look awful?
-
A: Scanlines can be negatively affected by the method of vertical scaling that your video card uses, depending on the video mode you have selected for ZSNES. This can sometimes result in scanlines that are not of uniform darkness. The effect of this video scaling is most noticeable with Full scanlines, with 50% and 25% scanlines being less noticeable. To display the scanlines effect properly, you should use resolutions based on a multiple of 256x224 in windowed modes (e.g. 512x448) and 320x240 for fullscreen modes (e.g. 640x480).
- -
Q: Why am I missing some video filter options?
-
A: Please make sure you have MMX Support enabled in the Options dialog. Refer to the Video Config description in GUI.htm to see what video options require MMX support.
-
-
- -
-

Sound

- -
-
Q: Why does ZSNES produce a lot of static?
-
A: There could be many reasons why you are hearing static. If you are using the Windows port and you have an ISA sound card, this could be your problem. If you are using the DOS port, and you have a PCI sound card, this could also be your problem. If your sound card is using SoundBlaster emulation, you probably need to use 8-bit sound, but this can make sound output worse. You can also try doing the following things to improve your sound: Reduce your sampling rate or disable lowpass filtering and stereo sound; Win port users can also enable the Primary Sound Buffer.
- -
Q: Why am I missing some sound options?
-
A: Please make sure you have MMX Support enabled in the Options dialog. Refer to the Sound Config description in GUI.htm to see what sound options require MMX support.
-
-
- -
-

Input

- -
-
Q: Why can't I press more than two keys at a time?
-
A: Many PC keyboards limit the number of key signals that can be transmitted simultaneously. For example, certain combinations of three or more alphanumeric keys may not work. Conversely, there may be some combinations of three or more keys that do work. You would just have to test by trial-and-error to find out, since these combinations can vary between keyboards. Joysticks and gamepads generally don't have this limitation. -

If you must use a keyboard, you can set multiple game keys to a single keyboard key. Alternatively, you could set some keys to the right and left Ctrl and Shift keys, since most keyboards do not restrict signals from these keys.

-
- -
Q: Why is one direction of the d-pad always held down, even when I'm not pressing any keys?
-
A: ZSNES auto-calibrates any connected gamepads/joysticks when it first starts. Thus, if one of the buttons or directions is accidentally held down while ZSNES is starting, ZSNES will think this is "normal" or "zero" input, even when you let go of the button. To fix the problem, simply close ZSNES, make sure no buttons are pressed and all axis are centered on your gamepad/joystick, and restart ZSNES. It will then auto-calibrate to the correct "zero" settings.
- -
Q: How do I use both my keyboard and joystick for the 1st or 2nd player?
-
A: First, configure the Player 1 pad (Config-->Input--> #1) for your normal set-up (for example, a keyboard). Next, configure the Player 3 pad (Config-->Input--> #3) to use your alternative set-up (for example, a joystick or gamepad). When you want to switch between your regular and alternative set-up, go to the Config-->Options menu and check Use Pl3/4 as Pl1/2. Now the Player 3 controls act as the Player 1 pad, and Player 4's controls act as the Player 2 pad. To return to the normal controls, simply uncheck this option. Follow the same procedure to create a similar set-up for Players 2 and 4. Note: Enabling the option Use Pl3/4 as Pl1/2 disables MultiTap emulation.
- -
Q: Why can't I set the keys/buttons for Player 2?
-
A: You need to set the Current Device before ZSNES will allow you to set the individual keys for Player 2 (or Players 3, 4, or 5). If NONE is shown after CURRENT:, the input cannot be changed (or used, for that matter). See the Input section of the GUI page for further instructions.
- -
Q: Why won't ZSNES accept input when I'm configuring the keys for my gamepad?
-
A: Exit ZSNES and calibrate your input device. Then restart ZSNES and see if it works.
- -
Q: This game tells me that it is not compatible with the MultiTap (or an external device attached). What should I do?
-
A: Set the input devices of player 3, 4, and 5 to "None". You may also need to go to the Config-->Options and check Use Pl3/4 as Pl1/2. Additionally, you could add an NSRT header to your ROM if you desire.
-
-
- -
-

Speed

- -
-
Q: Why is ZSNES slow?
-
A: First and foremost, does your computer meet the minimum system requirements to run ZSNES? If not, there is little you can do to improve performance. That being said, you can still try a number of things. -
    -
  • Make sure that any major program(s) is/are closed (such as Winamp).
  • -
  • Try the default settings of ZSNES before you do anything else. You can reset ZSNES to the default settings by deleting all three of its configuration files.
  • -
  • Ensure that MMX Support is enabled in the Options dialog; this mode should provide a noticeable speed increase for computers that can use it.
  • -
  • Certain system configurations and video cards work better with certain video modes. Try switching between different video modes until you find one that has good/better performance. Things to remember when doing this are that lower resolutions are faster than higher resolutions, full screen modes are faster than windowed modes, and 'R' modes are faster than 'S' modes (because no scaling is necessary).
  • -
  • Make sure you are using Auto Frame Skipping. If you already are, try increasing the Max Frame Skip.
  • -
  • Do not use VSync; if you must use VSync, try also enabling Triple Buffering.
  • -
  • Disable all video filters.
  • -
  • Compile ZSNES yourself with optimizations for your CPU's architecture.
  • -
  • If you still need more speed, disable sound. If that's not enough, disable SPC emulation (you must restart ZSNES for this option to take effect). Some games will not work without SPC emulation.
  • -
-

If you have an old computer, such as one with a 486/100 processor, you will probably be better off using older DOS versions of ZSNES, as the minimum system requirements have increased slightly with subsequent releases. To achieve greater speed, you may want to avoid using VESA video modes (although this will disable transparencies). Experiment with the different video modes and try the recommendations above to see which configuration provides the best speed for you.

-
- -
Q: Why does the game slow down even though I'm using auto frame rate and the FPS is pretty high?
-
A: If you have ever played a real SNES, you may notice that some games slow down even on it. To the extent that ZSNES accurately emulates an SNES, a game will slow down in ZSNES in the same places it would slown down on a real SNES.
- -
Q: My games are running too quickly! How do I slow them down?
-
A: You may have disabled auto frame skipping. Re-enable it in the Config-->Speed menu. -

If you don't want to use auto frame skipping, and you want to play in windowed mode, you might want to set your monitor's refresh rate to 60hz and enable VSync in ZSNES.

-

If you want to use fullscreen mode without using auto frame skipping, you can enable the KitchenSync by using either the -ks (for NTSC/PAL) or -kp (for PAL) command-line parameter (Windows port only). Also be sure to enable triple buffering.

-
-
-
- -
-

Miscellaneous

- -
-
Q: Does ZSNES support loading ROMs which are compressed?
-
A: Yes, but it depends on what compression format is used. ZSNES can currently load ROMs that are compressed in the ZIP (method 0 - store and method 8 - deflate), GZip, and JMA compression formats. -

Many tools are available to create ZIP files. If you want a fast, commandline based ZIP program that is available on many platforms, get Info-ZIP. Info-ZIP also has a Windows front end called WiZ available if you prefer a GUI.

-

For creating GZip files, there are not too many choices. A fast, commandline based compressor for the GZip format, available for several platforms, may be downloaded at the GZip site. If you use Windows, there is a program with a GUI called 7-Zip that has support for ZIP, GZip, and others. ZIP and GZip files created by 7-Zip are smaller than those created with other programs, but 7-Zip takes a longer time creating them. For users of Unix based operating systems who would like a GUI front end for both ZIP and GZip, get Ark, which is part of the KDE project.

-

To create JMA files, a format invented by Nach and the rest of the NSRT team which offers the best compression ratio for SNES ROMs, you must use NSRT. NSRT is also capable of compressing SNES ROMs into ZIP and GZip formats.

-
- -
Q: Why doesn't ZSNES support the 7z, RAR, or ZIP deflate64 compression formats?
-
A: ZSNES only supports formats which have an open-source, portable, and easy-to-use library. The 7z and RAR formats do not yet have libraries that fill those criteria. If you want the best compression ratio for your SNES ROMs, you should use JMA. Currently, the only publicly available program that can compress and decompress with JMA is NSRT. ZIP deflate64 lacks a decompression library which ZSNES can use, but rumor has it that Nach is working on one.
- -
Q: Does ZSNES support multiple ROMs in a single ZIP or JMA file?
-
A: ZSNES currently does not support more than one ROM in a ZIP or JMA file, although such support will probably be implemented in the future.
- -
Q: Can you make a Mac/PocketPC/PS2/PSP/whatever port?
-
A: Since ZSNES is written in assembly, ports to any systems that are not 100% x86 compatible are impossible. Try Snes9x for portability. -

Apple Computer, Inc. recently switched their the Macintosh computers to use Intel processors, and as such ZSNES has already been modified to run on said computers. Just compile the SDL port with an up-to-date NASM and zlib and everything normally required.

-

Another third party developer recently ported ZSNES to the Microsoft Xbox as well, and released it under the name "ZsneXbox". Unfortunately, we can not provide a download link as this port is being illegally distributed as a compiled XBE file. As a result, any link or support requests regarding this port will be promptly ignored.

-
-
-
-
- -
-

WIN-SPECIFIC QUESTIONS

- -
-

General

- -
-
Q: Why does ZSNESw crash and give me an error with dinput.dll?
-
A: If you get this error, download and install the latest version of DirectX. -

You might also try running the DirectX Diagnostic Tool. You can do this by clicking the Start button, then selecting "Run...". Type "dxdiag" after "Open:", and click "OK". There are lots of options you can play with, so please read everything before you start messing around. Specifically, go to the "Display" tab, and under the "DirectX Features" section, click the "Disable" button beside each feature. After they are all disabled, re-enable them. Exit dxdiag, and try ZSNES again.

-

If none of that worked, try re-installing DirectX.

-
- -
Q: I just switched from the DOS port to the Windows port of ZSNES; why don't my savestates work? Are they incompatible?
-
A: The saves and savestates will work just as well with any port of ZSNES. You simply need to rename all files that have .srm and .zst (and .zs1, .zs2, etc.) extensions to match the filenames of your ROMs (or the jma/zip archives that contain them). -

For example, if you have "Super Mario World.zip" and "Super Mario RPG.zip", both games will have saves that are labeled "SUPERM~1.SRM", "SUPERM~1.ZS2", etc., and they will be differentiated only by the number after the "~" in the filename.

-

If you need to find out which "~" number a game uses, open a DOS prompt (a.k.a. Command Prompt), change to the ROM directory, and enter "dir /on /p" (On some newer systems like Win2k you need to add the "/x" switch for the DOS filenames to be displayed). Unfortunately, this method may not be accurate if you have moved your ROMs to a different folder or another computer; you may need to guess and hope for the best, trying to swap filenames a few different ways between the saves before it works for all your games. If it comes down to guessing, we recommend that you backup your save files before renaming them.

-

Don't forget to put the files into your Save directory.

-
-
-
- -
-

Video

- -
-
Q: Why am I seeing double, with strange colors?
-
A: Any change of resolution within ZSNES should correct the problem. Fullscreen modes are recommended because they are faster than windowed modes. -

If you still experience problems, see if these suggestions help (each should be done/tried separately):

-
    -
  • The issue can be completely resolved with up-to-date video card drivers. Keeping your device drivers fully updated will provide other benefits unrelated to ZSNES.
  • -
  • Set the resolution for ZSNES to the same one used by the Windows desktop.
  • -
  • Try enabling 16-bit color depth in Windows.
  • -
-
- -
Q: Why is the video choppy with an FPS of 60 and VSync on?
-
A: If you have VSync on, your monitor needs to be set to a refresh rate that is a multiple of the framerate of the game. NTSC games natively run at ~60 FPS. PAL games natively run at 50 FPS. Thus your monitor would need to be either 60Hz or 120Hz for NTSC games, or 50Hz/100Hz for PAL games. If you run ZSNES with the -6 switch, with a sub-argument of '60', ZSNES will try to switch your monitor to 60Hz refresh rate. You can use the -ks switch to make ZSNES try to switch your monitor to 120Hz refresh rate. These two switches only work in fullscreen modes and are for the Windows port only. -

You can also try enabling Triple Buffering (using the -3 switch or the GUI option), however this currently only works in Full Screen modes. One last thing you can try is to turn off auto frame-skipping, and set manual frame rate to "0".

-
-
-
- -
-

Sound

- -
-
Q: How come I don't get any sound?
-
A: Either you accidentally disabled sound, you don't have a sound card, the sound drivers aren't properly installed in your system, or your sound card is not compatible with DirectSound (part of Microsoft's DirectX API). Also make sure that Disable SPC Emulation is NOT checked. -

Try (re-)installing the latest version of DirectX, and make sure you have the latest drivers for your sound card (WHQL Certified, if possible).

-

Please also note that ISA sound cards tend not to work with Windows, while they do with DOS.

-
-
-
- -
-

SDL-SPECIFIC QUESTIONS

- -
-

General

- -
-
Q: Can I run ZSNES without X?
-
A: Yes, but you'll need to have SDL compiled to use SVGAlib.
- -
Q: I got ZSNES from my distro and I found a bug. To whom should I report it?
-
A: Compile ZSNES yourself and see if the bug still exists. If it does, please tell us, otherwise be happy that ZSNES works now, and give your distro a heads-up if you feel motivated enough.
- -
Q: Should I use SVN?
-
A: SVN is the best way to get the most up-to-date ZSNES source. It is best to double-check with SVN if you have a problem, since we might have already fixed it. If you find a new problem in SVN, please tell us, but be warned that we won't take it too seriously if it involves something that's currently being worked on. -

To check out and install ZSNES from SVN, refer to this thread on the ZSNES board.

-
- -
Q: I'm getting an error about gzdirect() missing when I try to compile ZSNES. What's up?
-
A: Make sure you're using zlib 1.2.3 or higher. Some distributions say you have zlib 1.2.3 but in reality give you an older version. If your distribution is being problematic, compile zlib yourself. Grab the latest version of zlib at the official website.
-
-
-
- -
-

DOS-SPECIFIC QUESTIONS

- -
-

Video

- -
-
Q: How do you enable transparencies?
-
A: First, try setting the video mode to a 16-bit color mode in the GUI. (If 320x240x16b doesn't work, then try 640x480x16b). If it gives you an error that says that your video card isn't compatible with VESA 2.0, you might want to get Scitech Display Doctor. It provides certain cards with VESA 2.0 support. Running with transparencies on is definitely slower because of the extra math equations, memory, and video space involved.
- -
Q: Why is there a layer of fog blocking my view?
-
A: You need to either enable transparencies (see above), or you can disable certain backgrounds by pressing the 1, 2, 3, or 4 keys. If you get lost while pressing those keys, press 6 to re-enable all of the backgrounds.
- -
Q: Why am I getting error messages regarding VESA 2 drivers?
-
A: Here is a list of the various error codes that you may be coming across, along with descriptions of what they mean: -
    -
  • VBE not detected - ZSNES failed to detect any VBE interrupts (Your video card doesn't support VESA).
  • -
  • VESA not detected - ZSNES failed to detect any VESA extensions (Your video card doesn't support VESA).
  • -
  • VESA 2.0 or greater required - Your video card supports VESA, but it has an older version. You may want to use Scitech Display Doctor to upgrade your VESA driver.
  • -
  • VESA 2 mode does not work on your video card/driver - Meaning that the resolution you requested does not exist in the supported resolutions of your video card. Choose a different resolution or upgrade with SDD, which can sometimes help increase the number of resolutions supported.
  • -
  • Unable to initialize video mode - A VESA 2.0 driver is found, but the video mode failed to start. There could possibly be an error on the video card setting, or it may be a defective piece of hardware.
  • -
  • Linear frame buffer not detected - Meaning that your video card does not support linear frame buffering, which is required for the ZSNES VESA 2 routines.
  • -
-
-
-
- -
-

Sound

- -
-
Q: Why is there no sound?
-
A: There could be several situations: -
    -
  • You haven't enabled sound. You can enable it through the GUI or through zsnes.cfg. Also make sure that Disable SPC Emulation is NOT checked.
  • -
  • You need to make sure that the SET BLASTER variable is set properly. To do this, type SET in DOS and look for a string starting with "BLASTER=". If such a string exists, then this is not your problem.
  • -
  • You don't have a SB2.0 compatible sound card. If this is your case, there is nothing you can do at the moment. ZSNES uses auto-initialization mode for sound which requires SB2.0+.
  • -
  • Your SB IRQ conflicts with another device. If this is the case, you might want to check your sound card settings through Control Panel -> System.
  • -
  • ZSNES doesn't like your sound card.
  • -
  • You can try using VDMSound.
  • -
-
- -
Q: Are there any plans to improve detection for non-SoundBlaster cards (or supporting non-SB cards)?
-
A: There is little effort put into major changes to the DOS code, since so few people use that port these days. However, we will gladly accept anyone's help in improving the DOS sound code.
- -
Q: I get a sound initialization error using my SB Live! (or any other PCI card). How do I fix it?
-
A: Here is a solution: (Thanks CyberGodz for the post on the forums!) -

SB Live! uses what is known as a NMI, or Non Maskable Interrupt, to emulate SB 16 sound. Don't ask us exactly what it does (it's a type of IRQ) but that is pretty much all it is good for.

-

The problem is that many sound cards either lack NMI support or don't have it enabled (No NMI = No DOS support).

-

To try and solve this problem, do the following:

-
    -
  • Check your BIOS. If there is an option for RAM parity checking, enable it; it usually turns on NMI support. If there is something that says "NMI", turn it on.
  • -
  • If you don't find anything in your BIOS, then go to your motherboard's website and download the latest BIOS flash. Install it and try your DOS sound (You may still have to enable the stuff in the BIOS afterwards).
  • -
  • Failing the first two things, you could either get a new motherboard or get another compatible sound card alongside the SB Live!. Just attach a cable from the line out of the SB 16 to the line in of the SB Live!. Enable line in on the mixer of your SB Live! and it should route the sound through the old sound card (Don't use the SPDIF to connect the cards if you have one; wave sound doesn't pass through SPDIF--only MIDI).
  • -
-
-
-
- -
-

Input

- -
-
Q: Why doesn't my Sidewinder pad work?
-
A: First, for non-USB Sidewinders, you should disable the Sidewinder profiler from the Win9x icon tray, run ZSNES, set Input #1 as SidewinderPad1, then press the mode button a few times. If that doesn't work, try the following: -
    -
  • Try checking or unchecking the Sidewinder Fix option under Config Menu -> Options and repeat the above steps.
  • -
  • Fully disable the Win9x Sidewinder drivers by going to Control Panel/Game Controllers. Then remove the Sidewinder (Thanks Scarlet-Slider for this info!).
  • -
  • Run ZSNES under pure DOS.
  • -
  • Again, try checking or unchecking the Sidewinder Fix in the options menu of the GUI and repeat the above 2 steps.
  • -
  • Make sure your Sidewinder is plugged in and is not broken.
  • -
-

For USB joysticks, you can either set ZSNES as a 6-button joystick or simulate keyboard keys through the Sidewinder profiler by setting Input #1 as a keyboard with those defined keys.

-
- -
Q: How do I get my daisy-chained Sidewinder to work?
-
A: First, run ZSNES. Temporarily disconnect the second Sidewinder pad from the first one, get the first one to work, then re-connect the second Sidewinder pad.
- -
Q: Why doesn't my Gamepad Pro work?
-
A: For the non-USB version, be sure to have your Gamepad Pro set on 'GrIP' mode. Then set the input device as Gamepad Pro P0. For the USB version, you can use a keyboard emulator, which should be included with the software that came with your joystick.
- -
Q: Why doesn't my joystick work anymore?
-
A: You might have accidentally clicked the Use Joystick Port 209H check box. Just uncheck it.
- -
Q: Why does JB5/JB6 keep getting pressed whenever I try to change a key?
-
A: Try changing your joystick type from 6-button to 4-button.
-
-
- -
-

Freezing/Crashing Issues

- -
-
Q: Why does ZSNES freeze when I run it under pure DOS?
-
A: Try loading your mouse driver or run ZSNES using the -j switch. For the most compatible result, use the Microsoft Mouse driver if possible.
- -
Q: Why does ZSNES crash when I load a ROM?
-
A: It could be that ZSNES doesn't recognize your sound configuration. To fix it, disable sound or try changing your sound configuration. Also see this question.
- -
Q: Why does ZSNES freeze when I try to enter the GUI?
-
A: Run ZSNES using the commandline -j.
- -
Q: ZSNES gives me an "out of memory" error and I only have 16MB of RAM. How do I fix this?
-
A: If you are running the DOS port of ZSNES from within Windows, try restarting the computer in DOS mode; more RAM should then presumably be available for ZSNES to use. To get it running under Win9x, first create a shortcut to the DOS prompt on the desktop (the filename 'target' can be C:\command.com). Next, right-click on the icon and go to Properties. Then, select the Memory tab and look below for Protected Mode (DPMI) settings and set a high value (like 20000). Last, double-click on that icon and load ZSNES as usual.
-
-
- -
-

Miscellaneous

- -
-
Q: I'm using DJGPP 2.03 and I get an error about missing stdint.h. What's wrong?
-
A: You're probably missing this file. Download the latest version of this file and put it in DJGPP's include directory.
-
-
-
- -
- - - -
- - - - diff --git a/tools/zsnes/docs/readme.htm/games.htm b/tools/zsnes/docs/readme.htm/games.htm deleted file mode 100644 index 2c021c0..0000000 --- a/tools/zsnes/docs/readme.htm/games.htm +++ /dev/null @@ -1,514 +0,0 @@ - - - - - Games - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - - -
- -
-

Games

- -
-

ROMs

- -

ROMs are not included with ZSNES!!! You must find them on your own.

-

Please read Wikipedia's article on ROM Images for a general overview.

-

In relation to SNES emulation, a "ROM image" is a computer file which is an exact copy of the data that is contained in a Read Only Memory chip inside a game cartridge. This file contains the same data that a real SNES console reads from the game cartridge. An SNES emulator loads this ROM into its own memory, very much like how a real SNES operates.

-

A problem appears when you have a ROM image that is not an exact copy of the data on a real SNES cartridge. Many of the ROMs available for download on the Internet are not in fact exact copies of real SNES games. There are a variety of reasons why a ROM that appears to be a real game is not an exact copy of the cartridge data. For example, the ROM may have been incorrectly "dumped" from the cartridge, which can introduce errors. Certain prolific ROM "releasers" will "hack" a ROM to include an introduction that advertises the releaser. Regardless of the reason for an imperfect ROM image, these "bad" ROMs can display errors when they are played in an emulator.

-

Emulator developers generally try to make their emulators work with "good" ROMs; that is, ROMs that are perfect copies of the data on a real game cartridge. The developers of ZSNES in particular are unable to provide any help to people who are using "bad" ROMs. You must use a good ROM if you want any chance of playing an error-free game.

-

We recommend using NSRT to verify that your ROMs are "good" dumps. In some cases, NSRT can actually modify a "bad" ROM in such a way that it becomes a "good" ROM. Please read the documentation included with NSRT for additional information.

-
- -
-

Compatibility

- -

There are many reasons why a particular ROM may not work correctly with ZSNES. Here is a list of things you can do to improve your chances of a ROM working with ZSNES:

-
    -
  • Make sure your ROM is actually a "good dump." Often a ROM appears to be from a particular game/cartridge, but it is not in fact a perfect copy of the data on that cartridge. You can use NSRT to scan your ROM and tell you if it is a good dump. In some cases, NSRT can actually modify a "bad" ROM in such a way that it becomes a "good" ROM.
  • -
  • Your ROM may be a game that uses the SuperFX special chip. It may also be "interleaved." ZSNES cannot detect when a ROM is interleaved with the SuperFX interleave method. There is more information about this below. In cases where ZSNES cannot detect a ROM's interleave method, ZSNES will incorrectly report the ROM as not interleaved, and the ROM will fail to load.
  • -
  • If you have turned off sound, you should re-enable it. If you wish to mute the sound output, simply move the volume slider to 0%. Many games require sound emulation to be active in order to work correctly, so disabling sound can "break" a lot of games.
  • -
  • If you have changed the percentage of execution in the ZSNES configuration file, change it back to 100. However, there are a few particular games that may work better if the percentage to execute is set to either 120% or 80%.
  • -
-

The developers of ZSNES make no guarantee that any particular game will work. While we wish to play these incompatible games as much as you do, sometimes it is just not possible. Furthermore, ZSNES is in a constant state of development. Compatibility with a particular game may change between releases of ZSNES.

-

In the past, ZSNES developers programmed the emulator to "hack" certain games. These "hacks" would modify in-memory certain incompatible games, to get them to work with ZSNES. Some hacks were also used make certain games run at full speed if they were too slow. Sometimes, however, a particular game hack will break other parts of accurate SNES emulation.

-

As the emulation accuracy of ZSNES has improved, these hacks have become less necessary. In general, game hacks are removed whenever possible. With the current state of emulation in ZSNES, no new game hacks will be added.

-

In conclusion, if you have tried the steps above, and your game still doesn't work, we're sorry; however there is nothing we can do. ZSNES is developed for emulation accuracy, with game compatibility as a side effect, not the other way around. The most you can do is try another emulator or hope that ZSNES will become accurate enough to be able to run your particular game.

-
- -
-

Special-Chip Games

- -

The approximate percentage of emulation progress for these special chips is listed under Current Progress.

-

The NSRT SNES Add-on Chip information article was frequently referenced for the information assembled on this page.

-

You may find that the section on Enhancement chips in the Super Nintendo article at Wikipedia contains some interesting historical information, not covered in this FAQ.

-

A number of games developed for the Super Nintendo included additional special-purpose processors on the game cartridge. A game would use this special processor to accomplish something that wasn't possible using just the standard SNES hardware. It is impossible to represent these processors with ROM data; in order for these games to work, ZSNES must emulate these special processors, in addition to all the standard SNES hardware (which ZSNES already emulates).

-

Below is a list of all known special processors, followed by a list of the games known to use each processor.

- -
-

C4

- -

The C4 chip is a math co-processor with limited graphical processing capabilities.

-
    -
  • Megaman X 2 (USA) / Rockman X 2 (Japan)
  • -
  • Megaman X 3 (USA, Europe) / Rockman X 3 (Japan)
  • -
-
- -
-

Nintendo DSP

- -

Each of the Nintendo DSP chips have identical hardware, but different software (firmware).

- -
-
DSP-1
-
    -
  • Ace wo Nerae!
  • -
  • Armored Trooper Votoms
  • -
  • Ballz 3D / 3 Jigen Kakutou Ballz
  • -
  • Battle Racers
  • -
  • Drift King Shutokou Battle '94
  • -
  • Drift King Shutokou Battle 2
  • -
  • Final Stretch
  • -
  • Hashiriya Kon
  • -
  • Korean League
  • -
  • Lock On
  • -
  • Michael Andretti's Indy Car Challenge
  • -
  • Pilotwings
  • -
  • Super 3D Baseball
  • -
  • Super Air Diver
  • -
  • Super Air Diver 2
  • -
  • Super Bases Loaded II
  • -
  • Super F1 Circus Gaiden
  • -
  • Super Mario Kart
  • -
  • Suzuka 8 Hours
  • -
-
- -
-
DSP-2
-
    -
  • Dungeon Master
  • -
-
- -
-
DSP-3
-
    -
  • SD Gundam GX
  • -
-
- -
-
DSP-4
-
    -
  • Top Gear 3000 (USA) / Planets Champ TG 3000 (Japan)
  • -
-
-
- -
-

OBC-1

- -
    -
  • Metal Combat
  • -
-
- -
-

SA-1

- -

The SA-1 is a 65816 chip, although at a higher clock then the SNES's internal one.

- -
    -
  • Asahi Shinbun Rensai - Katou Ichi-Ni-San Kudan Shougi Shingiru
  • -
  • Daisenryaku Expert WWII
  • -
  • Derby Jockey 2
  • -
  • Dragon Ball Z - Hyper Dimension
  • -
  • Hanyuu Meijin no Omoshiro Shougi
  • -
  • Harukanaru Augusta 3 - Masters New
  • -
  • Hayashi Kaihou Kudan no Igo Taidou
  • -
  • Itoi Shigesato no Bass Tsuri No.1
  • -
  • J. League '96 Dream Stadium
  • -
  • Jikkyou Oshaberi Parodius
  • -
  • Jumpin' Derby
  • -
  • Kakinoki Shougi
  • -
  • Kirby Super Star (USA) / Hoshi no Kirby - Super Deluxe (Japan) / Kirby's Fun Pak (Europe)
  • -
  • Kirby's Dream Land 3 (USA) / Hoshi no Kirby 3 (Japan)
  • -
  • Marvelous
  • -
  • Mini Yonku Shining Scorpion - Let's & Go!!
  • -
  • Pebble Beach no Hatou New - Tournament Edition
  • -
  • PGA European Tour
  • -
  • PGA Tour 96
  • -
  • Power Rangers Zeo - Battle Racers
  • -
  • Saikousoku Shikou Shougi Mahjong
  • -
  • SD F-1 Grand Prix
  • -
  • SD Gundam G-NEXT cartridge ROM (G-NEXT.SFC)
  • -
  • Shin Shougi Club
  • -
  • Shougi no Hanamichi
  • -
  • Shougi Saikyou
  • -
  • Shougi Saikyou II
  • -
  • Super Bomberman - Panic Bomber W
  • -
  • Super Mario RPG
  • -
  • Super Robot Wars Gaiden
  • -
  • Super Shougi 3 - Kitaihei
  • -
  • Taikyoku Igo - Idaten
  • -
  • Takemiya Masaki Kudan no Igo Daishou
  • -
- -
- -
-

S-DD1

- -
    -
  • Star Ocean
  • -
  • Street Fighter Alpha 2 (USA/Europe) / Street Fighter Zero 2 (Japan)
  • -
-
- -
-

Seta DSP

- -

Seta's DSP has 2 major firmwares.

- -
-
Seta 10 / ST010
-
    -
  • F1 ROC II (USA) / Exhaust Heat II (Japan)
  • -
-
- -
-
Seta 11 / ST011
-
    -
  • Hayazashi Nidan Morita Shougi
  • -
-
-
- -
-

Seta RISC

- -

The Seta RISC chip is not emulated.

- -
-
Seta 18 / ST018
-
    -
  • Hayazashi Nidan Morita Shougi 2
  • -
-
-
- -
-

SPC7110

- -
    -
  • Far East of Eden Zero
  • -
  • Far East of Eden Zero - Shounen Jump no Shou
  • -
  • Momotarou Dentetsu Happy
  • -
  • Super Power League 4
  • -
-

ZSNES does not fully support the SPC7110 chip yet. However, you may use some third party graphics decompression packs to get the four above games to work.

-

The SPC7110 graphic packs are mirrored on a number of sites on the Internet. Here are a few:

- -

After you have downloaded all of the parts, extract them all into a new directory on your disk. Then go to the Config-->Paths menu in the GUI and enter in the location of the folder in the appropriate field.

-
- -
-

S-RTC

- -
    -
  • Daikaijuu Monogatari II
  • -
-
- -
-

SuperFX

- -
    -
  • Dirt Racer
  • -
  • Dirt Trax FX
  • -
  • Doom
  • -
  • Star Fox (USA / Japan) / Starwing (Europe)
  • -
  • Stunt Race FX (USA / Europe) / Wild Trax (Japan)
  • -
  • Super Mario World 2: Yoshi's Island
  • -
  • Vortex
  • -
  • Winter Gold
  • -
- -

ZSNES does not support interleaved SuperFX ROMs! An interleaved ROM is one in which the data is arranged differently than in the original, real SNES cartridge. While ZSNES has the ability to read the most common types of interleaved ROMs, it cannot read interleaved SuperFX ROMs, or even determine that they are interleaved.

-

You can use NSRT to deinterleave your SuperFX ROMs, or if you prefer, all your ROMs. Consequently, the creator of NSRT (Nach) has also written a document about the technical details of interleaved SNES ROMs, if you are interested.

-
- -
- -
-

Special Cartridges

- -

The approximate percentage of emulation progress for these special cartridges is listed under Current Progress.

-
-

Same Game; SD Gundam G-Next

- -

These were special games released only in Japan. They could be played by themselves, standing alone, but they could also be played with special additional cartridges, which plugged into the top of the main cartridge. These extra cartridges used the same form-factor as the BS-X memory cartridges, and they would improve or change the main game in some small way (similar to the Sonic and Knuckles cartridge for Sega Genesis).

-

You can play the original cartridges by themselves by loading them like any normal ROM. In order to play these games as if they had an expansion cartridge plugged in, you must first configure the paths to the base cartridge ROMs under Config -> Paths. After defining the path to the base ROMs, you can now load the expansion ROM like any normal ROM. ZSNES will virtually "plug in" the expansion ROM to the base ROM, and load both of them at the same time.

-

The NSRT file names for these ROMs are SAMEGAME.SFC and G-NEXT.SFC, respectively.

-
- -
-

Sufami Turbo

- -

Gamers Graveyard has some pictures and information on the Sufami Turbo.

-

The Sufami Turbo is a special add-on, manufactured by Bandai, and released only in Japan. The games were sold on small, GameBoy-sized mini-cartridges, two of which could simultaneously be plugged into the Sufami Turbo main cartridge. Certain combinations of games could interact with each other.

-

To emulate the Sufami Turbo, you will first need the Sufami Turbo BIOS. You must configure the path to this BIOS under Config -> Paths.

-

The NSRT file name for the Sufami Turbo BIOS is STBIOS.BIN.

-

If you use NSRT, your Sufami Turbo ROMs will have .st extensions. In order to load two ROMs at once (to emulate two simultaneously loaded cartridges), you must use the command line. As an example, you would type in zsnesw.exe "C:\Path\To\ROMs\sufami turbo rom 1.st" "C:\Path\To\ROMs\sufami turbo rom 2.st". Note that you must type the FULL path to both ROM images. The example is specific to the Windows command line and ZSNES port, but you get the idea.

-

You may occasionally come across a Sufami Turbo ROM that is hacked to include the BIOS with it. Use NSRT with the -split command to separate the BIOS from the ROM. This will give you at least two separate files: one will be the game, and the other will be the BIOS. You may even get 3 files: Two games and one BIOS. After you have separated the BIOS and the game(s), simply follow the directions stated above.

-
-
- -
-

Broadcast Satellaview (BS-X)

- -

Please read the Satellaview article on Wikipedia for additional information.

-

This add-on was released only in Japan. It allowed gamers to connect to a satellite feed at certain times of the day, which would transmit games to the Super Famicom. Downloaded games were optionally stored on a small, eight-megabit mini-cartridge, which plugged into the top of the BS-X main cartridge (which in turn plugged directly into the Super Famicom). Many games, some of which had time limits, were made exclusively for the BS Satellaview.

-

Currently, ZSNES can partially emulate the BS-X; some games will have graphics glitches, some games can be coaxed into running by changing certain settings, but some games won't run at all.

-

Also note that there is a BIOS for the BS-X. You may configure the path to the BS-X BIOS under Config -> Paths; however, it's not currently required to run BS games. It may be required in the future.

-

The NSRT file name for the BS-X BIOS is BS Satellaview BS-X (BIOS) (J).sfc.

-
- -
-

Super GameBoy

- -

The Super GameBoy is not emulated. There are currently no plans to support it. This is because the Super GameBoy cartridge contains a complete set of GameBoy hardware (without screen and speakers, of course). Thus, to fully support the Super GameBoy, ZSNES would have to emulate both the SNES and a GameBoy. In addition, there are some very complex interactions between the Super GameBoy and SNES hardware that are not yet fully understood.

-

"But wait," you say, "I have a Super GameBoy BIOS! Won't this allow ZSNES to emulate a Super GameBoy?"

-

The answer is "no." The BIOS you have is only the software for the Super GameBoy, not the hardware, and thus is no help in emulating the Super GameBoy hardware. In the meantime, there are some GameBoy emulators, such as KiGB, BGB, and VisualBoyAdvance, that faithfully support some of the more useful features of the Super GameBoy.

-
- -
-

Individual Game Issues

- -
-

Chrono Trigger

- -

How do you get past the part in Chrono Trigger where you have to press the L, R, and A buttons?

-

Assign two or all three of these SNES controller buttons to the same keyboard key. You can do this under Config Menu -> Input. Please read this note about keyboard limitations.

-
- -
-

Star Ocean

- -

This game is difficult to emulate correctly, and there are also bugs within the game itself. The battles in the game are emulated at an incorrect speed, and the game will often freeze or crash randomly. You may encounter more issues. You can find detailed information about the bugs in this game at RPGClassics.

-

For best results, we recommend that you use an emulator that runs the game more accurately, such as Snes9x.

-
-
- -
-

Games Supported by ManyMouse

- -

ZSNES supports Ryan C. Gordon's ManyMouse library, which allows you to take advantage of games that support usage of two SNES add-on devices at once. You will need two mice plugged into your computer.

-

Here is a list of known games that support two SNES add-on devices simultaneously:

-
    -
  • Arkanoid - Doh It Again
  • -
  • Bishoujo Senshi Sailor Moon S - Kondo ha Puzzle de Oshiokiyo!
  • -
  • Fun 'N Games
  • -
  • Koutetsu no Kishi (and its two sequels)
  • -
  • Lamborghini - American Challenge
  • -
  • Lord Monarch
  • -
  • Motoko-chan no Wonder Kitchen
  • -
  • Operation Thunderbolt
  • -
  • Revolution X
  • -
  • Shien's Revenge
  • -
  • Super Castles
  • -
  • T2 - The Arcade Game
  • -
  • Tin Star
  • -
  • Tokimeki Memorial
  • -
-

Linux users should remember to type chmod a+r /dev/input/* at the shell after both mice are plugged in.

-

This feature is not implemented in the DOS port.

-

ManyMouse currently does not support BSD either, so Windows, Linux, or Mac OS X is required.

-
- -
-

List of Multiplayer Games

- -

Please note that this list does not include any sports games (since they are easy to recognize and most of them are multiplayer). It also does not include games with only 2-player alternating modes nor games that require the SNES Mouse/Super Scope. Also, this list does not generally have sequels or other derivatives listed; if the original is listed here, it's likely its sequels and derivatives support multiplayer, too.

-

This list is not necessarily complete.

-
    -
  • Aero Fighters
  • -
  • Art of Fighting
  • -
  • Battletoads in Battlemaniacs
  • -
  • Battletoads vs DoubleDragon
  • -
  • Brawl Brothers
  • -
  • Brutal: Paws of Fury
  • -
  • Captain Commando
  • -
  • Clay Fighter
  • -
  • Contra 3
  • -
  • Darius Twin
  • -
  • Double Dragon 5
  • -
  • Dragonball Z Super Butoden
  • -
  • Dragonball Z Hyper Dimension
  • -
  • Faceball
  • -
  • Fatal Fury
  • -
  • Fighter's History
  • -
  • Final Fight 2 & 3
  • -
  • Ghoul Patrol
  • -
  • Goemon
  • -
  • Goof Troop
  • -
  • Gundam Wing: Endless Duel
  • -
  • Joe & Mac
  • -
  • Jurassic Park 2 - The Chaos Continues
  • -
  • Killer Instinct
  • -
  • King of Dragons
  • -
  • King of the Monsters
  • -
  • Kirby's Avalanche
  • -
  • Kirby's Dreamland 3
  • -
  • Kirby Super Star
  • -
  • Legend of the Mystical Ninja
  • -
  • Lemmings
  • -
  • Megaman 7 (Secret Code - password 1415/5585/7823/6251 and press L+R+Start)
  • -
  • Metal Warriors
  • -
  • Mortal Kombat
  • -
  • Ms. Pac-Man
  • -
  • NP Mario Picross Series
  • -
  • Peace Keapers
  • -
  • Pirates of the Dark Water
  • -
  • Pocky & Rocky
  • -
  • Pop'n Twinbee
  • -
  • Power Instinct
  • -
  • Primal Rage
  • -
  • Puzzle Bobble
  • -
  • Raiden
  • -
  • Rampart
  • -
  • Ranma 1/2
  • -
  • Rise of the Robots
  • -
  • Rival Turf
  • -
  • Rock N' Roll Racing
  • -
  • Run Saber
  • -
  • Sailor Moon
  • -
  • Samurai Shodown
  • -
  • Secret of Mana
  • -
  • Seiken Densetsu 3
  • -
  • Shaq Fu
  • -
  • Star Fox 2
  • -
  • Star Trek Starfleet Academy
  • -
  • Street Fighter 2
  • -
  • Street Fighter 2 Turbo
  • -
  • Street Fighter Alpha 2
  • -
  • Street Racer
  • -
  • Stunt Race FX
  • -
  • Sunset Riders
  • -
  • Super Bomberman
  • -
  • Super Mario All-Stars (SMB3 minigame)
  • -
  • Super Mario Kart
  • -
  • Super Mario World 2: Yoshi's Island (At map, press X,X,Y,B,A)
  • -
  • Super Offroad
  • -
  • Super Smash TV
  • -
  • Super Street Fighter 2
  • -
  • Suzuka 8 Hours
  • -
  • Teenage Mutant Ninja Turtles 4 - Turtles in Time
  • -
  • Teenage Mutant Ninja Turtles 5 - Tournament Fighters
  • -
  • Tetris
  • -
  • The Great Circus Mystery
  • -
  • Top Gear 2
  • -
  • Top Gear 3000
  • -
  • Tuff E Nuff
  • -
  • Ultimate Mortal Kombat 3
  • -
  • Uniracers
  • -
  • Wild Guns
  • -
  • World Heroes
  • -
  • Wrecking Crew '98
  • -
  • Zombies Ate My Neighbors
  • -
-
- -
- - - -
- - - - diff --git a/tools/zsnes/docs/readme.htm/gui.htm b/tools/zsnes/docs/readme.htm/gui.htm deleted file mode 100644 index 8630f1e..0000000 --- a/tools/zsnes/docs/readme.htm/gui.htm +++ /dev/null @@ -1,1224 +0,0 @@ - - - - - Graphical User Interface - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - -
- -
-

The ZSNES GUI

- -
- The ZSNES graphical user interface (GUI) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
QuickGameConfigCheatNetplayMisc
1.LoadInputAdd CodeInternetMisc Keys
2.RunDevicesBrowseGUI Opts
3.ResetChip CFGSearchMovie Opt
...Save StateOptionsKey Comb.
8.Open StateVideoSave CFG
9.Pick StateSoundAbout
0.QuitPaths
Freeze Data:Saves
Clear All DataSpeed
- -

ZSNES uses a custom GUI, introduced in v0.600.

-

You can move the ZSNES window either by clicking and dragging its title bar, or right-clicking anywhere in the ZSNES window and dragging. You can move dialogs within ZSNES by clicking and dragging their respective title bars.

-

If any dialog is open within ZSNES, pressing ESC will close the top-most window.

-

If a game is loaded and running, you can press ESC to pause emulation and show the GUI. Pressing ESC again will hide the GUI and resume emulation.

-

Certain options throughout the GUI have an associated hotkey. Notice that many options have a letter in them that is underlined; pressing that letter on your keyboard will toggle the option.

- -
- -
-

Game Menu

- - ZSNES GUI showing the Game Menu - -
-

Load

- -

This opens the file loading dialog. Use this dialog to browse for a ROM to load and begin emulation.

-
    -
  • Filename box - Displays files in the current directory in alphabetical order. Double-click on a file to load it. Use the Show All Extensions option to change what types of files are displayed in this box.
  • -
  • Directory box - Displays all subdirectories in the current directory. Double-click on items in this box to navigate between folders. The first item in this box is always two dots (..); double-click this item to move to the parent directory of the current directory. Displayed below the current subdirectories are all drive letters detected on your system. Use these drive letters to change between drives.
  • -
  • Current directory - Below these two boxes, the current directory is displayed. By default, the current directory will be the same directory in which the ZSNES executable is located.
  • -
  • Address box - By typing letters into this box, you can go to the first filename or directory that matches the string of letters you typed.
  • -
  • Current selection - Below the text box, the current / highlighted selection is displayed. In the DOS port, this line does not display the current selection, but instead says "Display Type:".
  • -
  • Display Type: - Choose what type of filename to display in the Filename box. -
      -
    • Long Filename (Win/SDL) or Win9x Long Filename (DOS) displays the actual name of the files in the current directory, along with their extensions.
    • -
    • SNES Header Name will display the internal SNES header names of the files in the current directory. -
        -
      • ZSNES can display header names using English and Kanji characters. Characters in other languages are not supported and will be displayed as garbled text. Improper or invalid header names will also be garbled text.
      • -
      • The header names of compressed files will not be displayed.
      • -
      • If for some reason the header of a file cannot be displayed, the filename of that file will instead be displayed.
      • -
      • Warning: Using this option can make navigating folders a slow process, since each time you navigate to a new folder, ZSNES must scan all files in the folder for their header names.
      • -
      -
    • -
    • DOS 8.3 Format (DOS only, default for DOS) will truncate all filenames to be compatible with DOS filename length restrictions (up to eight letters in the filename, plus a three letter extension).
    • -
    -
  • -
  • Show All Extensions (off by default) - When this option is not checked, only files with common SNES ROM extensions (.smc, .sfc, ...) will be displayed. When this option is checked, all files will be displayed, regardless of extension. When used in combination with the SNES Header Name option above, non-ROM files will be shown as ** Invalid File **.
  • -
  • Force - Checking these boxes will force ROMs to be loaded as if they had those settings, rather than having ZSNES automatically detect those settings. Don't check any of these boxes unless you know what you're doing. -
      -
    • NTSC / PAL: Force one of these display types for all ROMs loaded.
    • -
    • HiROM / LoROM: Force one of these memory mapping settings for all ROMs loaded.
    • -
    -
  • -
  • Load button will load the current selection and begin emulation.
  • -
-

Keyboard usage with the file load dialog is as follows:

-
    -
  • Left / Right Arrows - Switch between the file and directory boxes.
  • -
  • Up / Down Arrows - Move up and down in the list.
  • -
  • PageUp / PageDown - Move up and down the list in larger increments.
  • -
  • Home / End - Go to the top or bottom of the list.
  • -
  • Typing characters - Go to the first item in the list that matches the typed characters.
  • -
  • Enter / Return - Load the currently selected file or open the currently selected folder.
  • -
-

Address box details:

-
    -
  • If you input a single space, ZSNES will randomly select a game or folder within the current directory, depending on which box is highlighted. Then hit Load or press Enter to open the selection.
  • -
  • When you press enter with text in the box without any '\' or ':' in the filename, ZSNES will first look for a directory matching the text and will then change its directory if one is found. Otherwise, it will load the current file or directory highlighted by the selection cursor.
  • -
  • You can type in the full filename or directory including path (e.g. "d:\games\mario.smc" or just "d:").
  • -
-
- -
-

Run

- -

Hides the GUI and resumes emulation. Equivalent to pressing ESC.

-
- -
-

Reset

- -

Resets the game; asks for confirmation.

-
- -
-

Save State

- -

Creates a save state of the game in the current save state slot; asks for confirmation.

-
- -
-

Open State

- -

Loads a save state from the current save state slot; asks for confirmation.

-
- -
-

Pick State

- -

Opens a dialog that allows you to pick the current save state slot. It's easier to use the F3 Menu.

- -
    -
  • Select Save Slot: - Click on a radio button to use that save slot.
  • -
  • Slot Level: - Use the + and - buttons to choose the slot level.
  • -
-
- -
-

Quit

- -

Exit the emulator. On exit, ZSNES will save any changes to its configuration files. It will also save any changes to the Save RAM file, although you can also configure ZSNES to write changes to the disk whenever Save RAM changes.

-
-
- -
-

Quick Menu

- - ZSNES GUI showing the Quick Game Load Menu - -
-

The list of numbers

- -

The ten most recently loaded games are displayed here. By clicking on one of these entries, you can load that game. This is a quicker way to load a recently played game then using the Game->Load function and navigating to the ROM. The most recently played game is #1.

-
- -
-

Freeze Data :

- -
    -
  • Off - The list will change as normal, reflecting the ten most recently loaded ROMs.
  • -
  • On - The list will not change anymore. You can use this feature to create a list of your ten favorite ROMs, for easy access at all times.
  • -
-
- -
-

Clear All Data

- -

Clears the entire list.

-
-
- -
-

Config Menu

- - ZSNES GUI showing the Configuration Menu - -
-

Input

- -

This dialog allows you to customize the input options for all five SNES controllers.

-
    -
  • Tabs #1-#5 - Choose the SNES controller to configure. You can use the Tab key to cycle through these tabs.
  • -
  • Device: - Use your mouse to choose your desired device, and use the Set button to set your choice. -
      -
    • None - Equivalent to unplugging the SNES controller from that port.
    • -
    • Keyboard/Gamepad (Win/SDL only) - Equivalent to plugging in the SNES controller to that port. Using this device should allow input from all attached keyboards, gamepads and joysticks.
    • -
    • If you are using the DOS port, you must manually choose the appropriate device from the list.
    • -
    -
  • -
  • Current: - Shows the device that is currently active.
  • -
  • Buttons -
      -
    • Set - Set your choice made in the Device: box. Using this button will reset key assignments to their defaults.
    • -
    • Set Keys - ZSNES will automatically cycle through each of the standard SNES buttons, prompting you to assign a key to each one.
    • -
    • Calibrate (DOS only) - This option is here for those older joysticks that need to be calibrated in-game before they can be used properly.
    • -
    -
  • -
  • Keys: - These are the standard SNES buttons, and the only ones required to be configured. Click inside the black box beside each one of these to configure a key for it. Press ESC to clear the current assignment.
  • -
  • Turbo: - You can assign keys to these buttons in the same way you assign them to the standard SNES buttons. Holding down the key assigned to the turbo button is the same as if you were repeatedly pressing the normal button very, very fast. You can control the rate of key presses per second with the Turbo at 30Hz option, below.
  • -
  • Diagonals: - It may be more convenient to assign a single key to a diagonal direction of the D-Pad, rather than pressing two keys at the same time. Just in case it's not obvious: DL=Down+Left, DR=Down+Right, UL=Up+Left, UR=Up+Right.
  • -
  • Game Specific - This option allows for input configurations that are specific to individual games.
  • -
  • Sidewinder Fix (DOS port only) - If your Sidewinder doesn't work after disabling the Sidewinder profiler and having pressed the mode button twice, enable this.
  • -
  • Allow U+D/L+R - This option allows for the simultaneous pressing of opposing directional keys (up and down; left and right) on the SNES pad. This feature was implemented for those who need it to exploit bugs in certain games for recording "speed-run" ZMVs. Warning: Do not use this for normal gameplay, as the resulting bugs disrupt the "natural" gaming experience.
  • -
  • Turbo at 30Hz - Default: Checked. When enabled, turbo keys will equal 30 button presses per second in NTSC games or 25 presses per second in PAL games. Otherwise, turbo keys will repeat 60 times per second in NTSC games or 50 times per second in PAL games. This option is enabled by default mainly because some games can't handle excessive key presses.
  • -
  • Use Pl3/4 as Pl1/2 - The key assignments for Player 3, in addition to those for Player 1, will be used for SNES controller port #1. The key assignments for Player 4, in addition to those for Player 2, will be used for SNES controller port #2. As a result, MultiTap support will be disabled (which means only two controllers will be active). The primary use of this option is to allow you to assign two different devices for the same SNES controller. For example, you might use a gamepad as input for Player 1, and a keyboard as input for Player 3. Then, with this option enabled, you may use either one of these devices (or both simultaneously) to control Player 1.
  • -
  • Use Joystick Port 209H (DOS only) - Use the 209H hardware port; use this if you have moved the port's jumper (or if your joystick does not work when this feature is disabled).
  • -
- -
-

Note: A keyboard is a poor replacement for a proper gamepad. SNES games are designed to be played with a gamepad, so if you find that you're having trouble with the keyboard, use a gamepad.

-

There is another important limitation with keyboards. Many keyboards have a limit on the maximum number of simultaneous key-presses, above which they will not detect input. This means combinations of, for example, three or more keys may not be properly detected. One way to get around this kind of keyboard limitation is to assign multiple SNES buttons to the same keyboard key. There is a slightly longer explanation in the FAQ.

-
-
- -
-

Devices

- -

This dialog allows you to select special input devices for Ports 1 and 2 of the SNES.

-
    -
  • Port 1: - Select a device to be plugged into Port 1. The SNES Mouse is the only special device supported on Port 1. -
      -
    • Gamepad - Use the key assignments for Player #1, configured in the Input dialog.
    • -
    • Mouse - Use your computer's mouse just like it is a connected SNES Mouse.
    • -
    -
  • -
  • Port 2: - Select a device to be plugged into Port 2. -
      -
    • Gamepad - Use the key assignments for Player #2, configured in the Input dialog.
    • -
    • Mouse - Use your computer's mouse just like it is a connected SNES Mouse.
    • -
    • Super Scope - Use your mouse as if it were a Super Scope. Default key assignments are here.
    • -
    • 1 Justifier - Simulates the movements for the Konami Justifier; required for only one game, Lethal Enforcers.
    • -
    • 2 Justifiers -
    • -
    -
  • -
  • Cycle P1:, Cycle P2: - You can assign a key to each of these functions. Pressing the key will cycle through the list of special controllers available for that port.
  • -
  • Left Handed - Check one of these boxes to reverse the mouse buttons for the special controllers on that port.
  • -
  • Super Scope Keys: - They can now be customized! -
      -
    • Auto-Fire - Default: =. Toggle auto-fire on or off.
    • -
    • SS Pause - Default: Backspace. Assign a key for the Super Scope pause button.
    • -
    -
  • -
-

Note: ZSNES will automatically enable the appropriate add-on for special controller games that have NSRT headers (e.g. the SNES mouse will automatically hook up after loading Mario Paint).

-

Note: ZSNES supports the ManyMouse library by Ryan C. Gordon, which means that ZSNES can emulate two SNES devices (one connected in each port) if you have two mice plugged in. For a list of known affected games (and for other information), please see the ManyMouse section of the Games page.

-
- -
-

Chip CFG

- -

These are special settings for the Nintendo Super System. Generally, there is no need for a user to change these settings.

-
    -
  • Super System: - Set which DIP switches are enabled. -
      -
    • DIP 1/2/3/4/5/6 -
    • -
    -
  • -
-

The Nintendo Super System was an arcade machine that used the SNES hardware. Changing the settings in this window will only affect games designed for the NSS. You can find information at Coin-Op Museum and Wikipedia.

-
- -
-

Options

- -

You can change various options here, some of which affect gameplay, while others merely change GUI behavior.

-
    -
  • System: -
      -
    • Enable MMX Support - Enables MMX copying routines for a slight speed increase (MMX processors only). Certain video filters, audio interpolation and low-pass filters require MMX support. These options will not be visible unless the MMX Support option is checked. (See below for the particular options requiring MMX support).
    • -
    • Pause Emu in Background (Win only) - If enabled, then game emulation will automatically be paused when the ZSNES window loses focus, and it will unpause when ZSNES regains focus.
    • -
    • Increase Emu Priority (Win only) - Enabling this will give ZSNES more processor time, if needed. This may improve the performance of ZSNES on your machine; however, it will reduce the amount of resources given to applications running in the background. Processing priority is set to "High" on a Win9x OS and "Above Normal" on 2k/XP/2003/Vista.
    • -
    • Disable Power Management (Win only) - Disables power management while ZSNES is running, so that your gameplay will not be interrupted if you're using a gamepad.
    • -
    -
  • -
  • Gfx Engines: -
      -
    • Use New Gfx Eng - Default: Checked. Check to use the new graphics engine; uncheck to use the old graphics engine. The new graphics engine should be adequate for most games; however, the old one may be necessary for some. You can read about the differences in Current Progress.
    • -
    • Use Alt Old Gfx Eng - Only visible when the new graphics engine is disabled, this option will enable the Old Gfx Engine Mode 2, which fixes many transparency bugs that currently plague ZSNES in the current engine. However, it also creates some new ones. This mode can be slower at times, so it's recommended that you only turn it on when you need it.
    • -
    -
  • -
  • SShots: - Choose what image format to use for snapshots of the game screen. This setting is also configurable via the F1 Menu. -
      -
    • BMP - Snapshots will be saved as bitmap pictures (16-bit color). If you are using an 8-bit video mode in the DOS port, the bitmap will be saved with 8-bit color.
    • -
    • PNG - Snapshots will be saved as PNG files (32-bit ARGB color). This option is not available if you did not compile with PNG support.
    • -
    -
  • -
  • ROM: -
      -
    • Enable IPS Auto-Patching - When checked, ZSNES will automatically soft patch ROMs if a corresponding .ips file is found in your Saves directory. More information about the IPS patching feature can be found in the Readme.
    • -
    • Show ROM Info on Load - Briefly displays some internal information about the ROM when loaded. Please refer to this information when submitting bug reports.
    • -
    • Log ROM Info - When checked, ZSNES will create a file named rominfo.txt when you load a ROM; it contains information about the ROM.
    • -
    -
  • -
  • Overlays: -
      -
    • Show FPS Cntr On Emu Load - When checked, the Frames per Second counter will be enabled each time you start ZSNES, even if it has been disabled during a session. The FPS counter can be manually enabled/disabled via the F1 Menu or with the 'Display FPS' quick key, once it has been assigned. This counter is only visible when using Auto Frame Rate.
    • -
    • Show Clock - The current system time will be displayed in the lower right-hand corner of the game screen. -
        -
      • 12 Hour Mode - Used in conjunction with the option above, this will display the system time in 12 hour mode instead of the default 24 hour mode.
      • -
      • Show Clock Box - Also used in conjunction with "Enable Clock", this option places a black box behind the clock to increase readability.
      • -
      -
    • -
    -
  • -
  • Messages: -
      -
    • Use Small Message Text - On-screen messages that pop up when you save a state, disable a background, etc. will be smaller.
    • -
    • Use Transparent Text - On-screen messages will be slightly transparent rather than solid. Using the Small Message Text option overrides this choice.
    • -
    -
  • -
-
- -
-

Video

- -

This dialog allows you to change the numerous video settings available in ZSNES.

-

Please note that the internal resolution of the SNES is 256x224. Certain special high-resolution modes can produce up to 512x448 resolution. You may notice that the internal resolution has an 8:7 aspect ratio. SNES video output is not intended to be viewed at this aspect ratio, however. The 8:7 video signal would normally be scaled to a more-typical 4:3 aspect ratio when viewed on a television.

- -
-
Modes tab
- -
    -
  • Video Mode box - The large box on the left lists all available video modes. You can use your mouse or the Up / Down / PgUp / PgDown / Home / End keys to scroll through this list. -
      -
    • Win/SDL port: -
        -
      • First column: lists the resolution, in pixels, W x H. -
          -
        • W x H - These video modes use a fixed resolution, in pixels, of the width and height shown.
        • -
        • Variable (SDL only) - Video output is scaled to the size of the window, and the window can be resized with the mouse; however, aspect ratio is locked, depending on which options are set.
        • -
        • Custom - Specify a custom, fixed resolution in the boxes to the right.
        • -
        -
      • -
      • Second column: -
          -
        • O (SDL only) - Indicates whether the video mode uses the OpenGL API.
        • -
        • D - The video mode supports graphics-enhancing filters. Non-D modes will usually be (automatically) interpolated by your graphics card.
        • -
        • R - The video aspect ratio is locked to the internal SNES ratio of 8:7.
        • -
        • S - Video output is stretched to fill the entire window.
        • -
        -
      • -
      • Third column: indicates whether the video mode is Windowed or Fullscreen.
      • -
      -
    • -
    • DOS port: -
        -
      • First column: lists the resolution (in pixels) and color depth (in bits), W x H x B.
      • -
      • Second column: shows the mode type -
          -
        • ModeQ - A tweaked VGA video mode. Supports 256x256 resolution and 256 colors. Accesses hardware directly.
        • -
        • ModeX - A different tweaked VGA video mode, similar to ModeQ, although slower. Accesses hardware directly.
        • -
        • Vesa1 - VESA VBE 1.2. A standardized method of accessing VGA cards.
        • -
        • Vesa2 - VESA VBE 2. Faster and more features than VESA1. Read the Wikipedia article for an overview. The first and third external links from that article provide some more detailed information.
        • -
        -
      • -
      -
    • -
    • Your video card may be compatible with only some of the video modes listed. You should try each video mode to find the right combination of speed, compatibility, and enhancement features (listed below).
    • -
    -
  • -
  • Set button - use the currently selected/highlighted video mode. ZSNES will now attempt to change to the new video mode. If the new video mode does not work, wait for ten seconds without pressing any keys, and ZSNES will return to the previous mode. Pressing Enter does the same thing as the Set button.
  • -
  • Custom: (Win/SDL only) - use in conjunction with one of the custom video modes at the bottom of the list to set a custom resolution. -
      -
    • Set button - save the current custom resolution.
    • -
    • Type in the custom width and height, respectively, in pixels, in the two black boxes.
    • -
    -
  • -
  • Current: - shows the current video mode.
  • -
-

Note: Some video modes may work better / faster than others, depending on your system configuration. Play around to see what's best.

-
- -
-
Filters tab
- -
    -
  • Video Filters: - Choose one video filter. You must use a D video mode to use any of these filters. Furthermore, filters marked with a * require MMX Support. -
      -
    • Interpolation - Enable interpolation, a simple filter that smooths the image and makes it appear less pixellated. This is software-driven and can be accelerated with MMX support.
    • -
    • Bilinear Filter (OpenGL modes only) - This produces an effect similar to Interpolation. The option replaces Interpolation and, as long as you aren't using Mesa, is hardware-driven. This means that as long as you aren't using Mesa, it requires less CPU overhead. Another advantage of the bilinear filter is that it can also be used alongside the other filters, though this may be slow.
    • -
    • NTSC (Win/SDL only) - Written by blargg. It is recommended to use a video mode with at least 602x448 resolution. Makes the video output appear to be that of an NTSC CRT television. This filter is not available in the SDL port while using OpenGL modes.
    • -
    • 2xSaI Engine* - Written by Kreed. SaI stands for "Scale and Interpolation." This is a "smart" filter that tries to make a lo-res image (like SNES video output) appear to have a higher resolution. The image should look smoother, less blocky, when using this filter.
    • -
    • Super Eagle* - Written by Kreed. Similar to the 2XSaI engine, but does more blending.
    • -
    • Super 2xSaI* - Written by Kreed. This filter smoothes the graphics, but it blends more than the Super Eagle engine.
    • -
    • HQ2X* (Win/SDL only) - Written by MaxSt. Applies an advanced algorithm to smooth the appearance of a low-resolution image. It is recommended to use a 2x scaled image with this filter.
    • -
    • HQ3X* (Win only) - Written by MaxSt. More advanced than HQ2X, and it is recommended to use a 3x scaled image with this filter.
    • -
    • HQ4X* (Win only) - Written by MaxSt. More advanced than HQ3X, and it is recommended to use a 4x scaled image with this filter.
    • -
    • Note: The HQxX filters and the NTSC filter have particularly high system requirements to run smoothly.
    • -
    -
  • -
  • Scanlines: - Choose one Scanline mode. Requires a D video mode. -
      -
    • None - This will disable scanlines.
    • -
    • 25% - This will enable scanline mode, except that each line is 25% darker than the line above it.
    • -
    • 50% - This will enable scanline mode, except that each line is 50% darker than the line above it.
    • -
    • Full - This mode adds a blank line in between every line to produce a scanline effect similar to a TV.
    • -
    -
  • -
  • Misc Filters: - Choose miscellaneous filters. -
      -
    • Grayscale Mode - Makes the game display in monochrome color, i.e. black and white. This option is just there for fun and is probably not something you want to use continuously.
    • -
    • Hi-Res Mode 7 - Requires a D video mode and at least 512x448 resolution. Enabling this will double the vertical resolution used when rendering Mode 7 graphics. Thus, the resolution becomes 256*448 rather than the normal 256*224.
    • -
    -
  • -
  • Monitor Sync: - Select monitor synchronization options. -
      -
    • VSync (Win/DOS only) - Synchronizes frame drawing to the monitor's refresh rate. This may reduce frame rate on your computer, but will reduce screen tearing.
    • -
    • Triple Buffering (Win/DOS only) - This setting is only visible while using a fullscreen video mode, and only applies while in fullscreen. Whereas VSync has only two frame buffers: the frame being drawn and the frame waiting to draw, Triple Buffering can write frame data to a third buffer. The primary use is to reduce the impact of VSync on slower systems. This option has precedence over VSync in Fullscreen modes.
    • -
    -
  • -
  • Display Options: - Select how you want the image to be displayed. -
      -
    • Use 4:3 Ratio (Win/SDL only) - This only applies when using a custom mode. Using this option will lock the video output at 4:3 aspect ratio, regardless of the aspect ratio of the custom resolution you've chosen.
    • -
    • Small Screen (DOS only) - Video output will be at 256x224 (the native internal resolution of the SNES), instead of whatever resolution you are using.
    • -
    • Full Screen / Wide Screen (DOS only) - Horizontally stretches video output to fill the screen.
    • -
    -
  • -
  • Not all of the video options above are available in every video mode and every port of ZSNES. Also note that you will need a fast computer for some of them if you don't want to see any slow-downs in emulation.
  • -
-
- -
-
NTSC tab - Only visible when using the NTSC filter.
- -
    -
  • Blend Frames - Enable this for smoother transitions between frames when using a non-60Hz refresh rate.
  • -
  • Refresh - If this is enabled, changes to the NTSC filter will be applied as you are adjusting the sliders (below), rather than when you release the mouse button.
  • -
  • The sliders below are used to adjust various properties of the NTSC output. -
      -
    • Hue
    • -
    • Saturation
    • -
    • Contrast
    • -
    • Brightness
    • -
    • Sharpness
    • -
    -
  • -
  • Presets - Press the appropriate button for instant configuration of the filter, instead of manually configuring. -
      -
    • Composite
    • -
    • S-Video
    • -
    • RGB
    • -
    • Monochrome
    • -
    -
  • -
  • Reset button - Reset all settings on this tab only to their defaults.
  • -
  • Reset All button - Reset all settings on both NTSC tabs to their defaults.
  • -
-
- -
-
Adv NTSC tab - Only visible when using the NTSC filter.
- -
    -
  • The sliders below are used to adjust various properties of the NTSC output. -
      -
    • Gamma
    • -
    • Resolution
    • -
    • Artifacts
    • -
    • Fringing
    • -
    • Bleed
    • -
    • Hue Warping
    • -
    -
  • -
  • Reset button - Reset all settings on this tab only to their defaults.
  • -
  • Reset All button - Reset all settings on both NTSC tabs to their defaults.
  • -
-
-
- -
-

Sound

- -

Configure various sound settings here.

-

The default settings are those that are most accurate to a Super Nintendo.

-
    -
  • Sound Switches: -
      -
    • Disable SPC Emulation - Disables the emulation of the SPC700 chip. Do not disable this unless you are having severe performance issues (i.e. ZSNES is unacceptably slow and you've tried everything else). Disabling this will likely result in sound errors.
    • -
    • Enable Sound - Default: Checked. Unchecking this disables sound output. Do not disable this unless you are having severe performance issues (i.e. ZSNES is unacceptably slow and you've tried everything else). If you wish to mute ZSNES, just move the volume slider down to 0%.
    • -
    • Enable Stereo Sound - Default: Checked. Unchecking this will disable stereo sound output; thus, sound output will be mono instead. Disabling this is a relatively safe way to improve speed, if necessary.
    • -
    • Reverse Stereo Channels - Reverse/swap the left and right stereo channels. This makes no difference if stereo sound is disabled.
    • -
    • Simulate Surround Sound - This is a novelty feature that simulates surround sound in games that don't have it natively. Do not use this in conjunction with games that have native surround sound. This option is only available when stereo sound is enabled.
    • -
    • Force 8-bit Output (DOS only) - Force ZSNES to output sound in 8-bit mode. Using this may work around problems with certain sound cards, but will reduce sound quality. Note that if you use stereo sound in addition to this option, you will not be able to use sampling rates above 22050Hz.
    • -
    • Use Primary Buffer (Win only) - Enable this only if your sound card is having problems designating the sound buffer with DirectSound. This will prevent sharing the sound card with other programs. This option is primarily useful for troubleshooting in Win9x. You must restart ZSNES for this feature to take effect.
    • -
    -
  • -
  • Sampling Rate: - Default: 32000Hz. Click inside the black box to cycle through all available sampling rates. Note that if you use sampling rates that are below the default, the sound will be distorted and inaccurate. Sampling rates higher than 32000Hz can also cause problems; however, sampling rates of 41000Hz and higher may resolve crackling issues that occur with some onboard sound cards.
  • -
  • Volume Level - To change, just slide the bar. Sliding this to 0% is a better method of muting sound output than unchecking the Enable Sound box.
  • -
  • Interpolation: - This feature smoothes out the wave forms of lower frequency sounds. -
      -
    • None - Use no interpolation. This is not accurate to the SNES!
    • -
    • Gaussian - Default. Based on the Gaussian curve, it smoothes the transition of the sound effects. This method of interpolation is used by a real SNES.
    • -
    • Cubic Spline - This method is calculated by a cubic equation rather than being based on a curve like the Gaussian method. This results in better approximation than the Gaussian method.
    • -
    • 8-point* - Takes 8 points on the sound curve and smoothes them out.
    • -
    -
  • -
  • LowPass: - Low-pass filters accentuate bass frequencies by reducing higher frequencies. None of these filters are native to the SNES; if you want authentic SNES sound, do not use any of these. Using a filter will probably be most noticeable if you have a subwoofer. -
      -
    • None - Use no low-pass filter.
    • -
    • Simple - Allows lower frequencies to pass through (e.g. drums and the like). Certain higher ranges are not heard though.
    • -
    • Dynamic - Allows greater range of frequencies to pass through; the music will seem more detailed depending on the loudness or softness of the audio.
    • -
    • Hi Quality* - It's better than the simple filter, and seems to work well with lower quality speakers that have decent sound cards.
    • -
    -
  • -
  • *Requires MMX Support.
  • -
-
- -
-

Paths

- -

Set and change paths used for save directories, graphics packs, and base cartridges.

-
    -
  • Saves: - Configure the directory where ZSNES will save and load SRAM, save state, and ZMV files. If you do not specify a path here, ZSNES Win and DOS will save all files to the same directory as the currently loaded ROM. ZSNES SDL will place them in ~/.zsnes. ZSNES SDL under Mac OS X will place them in ~/Library/Application Support/ZSNES.
  • -
  • Snapshots: - Configure the directory to which in-game snapshots will be saved. If you do not specify a path here, snapshots will be saved to your Saves directory (above).
  • -
  • SPCs: - Configure the directory to which SPC700 sound dumps (.spc; SNES music files) and sound buffer dumps will be saved. If you do not specify a path here, these files will be saved to your Saves directory (above).
  • -
  • BIOS/Base Carts - Set the path to BIOS and base cartridges of various special games. -
      -
    • BS-X: - Specify the full path and filename to the Broadcast Satellaview BIOS. Currently, the BIOS is not required to run BS games.
    • -
    • Sufami Turbo - Specify the full path and filename to the Sufami Turbo BIOS, which is required to play ST games.
    • -
    • Same Game: - Specify the full path and filename to the Same Game base cartridge ROM.
    • -
    • SD Gundam G-Next - Specify the full path and filename to the SD Gundam G-Next base cartridge ROM.
    • -
    -
  • -
  • SPC7110 Graphic Packs - Enter the directories that contain SPC7110 graphic packs in the appropriate fields here. More information about this chip is in the Games page. -
      -
    • FEOEZ: - Far East of Eden Zero
    • -
    • FEOEZ-SJNS: - Far East of Eden Zero - Shounen Jump no Shou
    • -
    • MDH: - Momotarou Dentetsu Happy
    • -
    • SPL4 - Super Power League 4
    • -
    -
  • -
- -
-
Notes
-
    -
  • One limitation of ZSNES is that it only accepts one case of input. Since most UNIX-based systems are case-sensitive, SDL port users should edit their paths in the configuration file instead.
  • -
  • Paths can be absolute (e.g. C:\ZSNES\saves) or relative (e.g. ..\..\saves).
  • -
  • If you are using the Win port, you can paste text from the clipboard into the text boxes by using the key combination Ctrl+V.
  • -
  • Remember to always press Enter or Return after typing in your path, or it may not work!
  • -
-
-
- -
-

Saves

- -

Configure various options regarding save states and in-game saves.

-
    -
  • # of Rewind States - This sets how many times you can rewind back. Note that you must restart your game for this feature to take effect.
  • -
  • 1/5 Seconds Per Rewind - This sets how many fifths of a second ZSNES will rewind back each time.
  • -
  • Do Not Save SRAM - When enabled, SRAM will never be saved at any given point. This is useful when you want to look into savestates or movies without saving the modified data to disk. This also prevents SRAM Check+Save from working.
  • -
  • SRAM Check+Save - Normally, ZSNES will write SRAM data to disk when you exit the emulator or exit to the GUI. When this option is enabled, ZSNES will instead write SRAM data shortly after a game modifies it. If you have problems with in-game saves not working correctly, or if you fear something may prevent ZSNES from exiting normally (i.e. crashing), turn this on. The reason this is not enabled by default is because some games use SRAM as working memory instead of for persistent saved games. Since these games constantly modify SRAM, ZSNES would write to the disk every few seconds (if this option is enabled).
  • -
  • Load Save State w/SRAM - When enabled, the SRAM data from the save states you load will overwrite any other SRAM data for the game that you have. Beware, though: if you are really far in a certain game, loading an old save state from a point earlier in the game will make you lose all of your progress beyond that save state. However, this option may be needed to load complete states in certain games.
  • -
  • Start at Latest Save - With this enabled, every time you load a ROM, the save state slot containing the most recent save state for that game will be set as the currently selected slot.
  • -
  • Auto Increment Save Slot - When enabled, the save slot will automatically move to the next slot after you save a state. This option is very useful in that it decreases the risk of accidentally saving over a previous save state, if you forget to manually advance the chosen slot.
  • -
  • Auto State Save/Load - If this is enabled, ZSNES will automatically create a save state when you quit a game (either by loading another game or by exiting the emulator). When you return to the game at a later time, ZSNES will automatically load the save state it created before.
  • -
  • Pause After... - Press the P key to unpause. -
      -
    • Loading State - Pauses emulation after you load a save state.
    • -
    • Rewind - Pauses emulation after you press the rewind key.
    • -
    -
  • -
  • State Shortcuts: - Click in a black box to assign a key to that function. Press ESC to clear the current assignment. -
      -
    • ST0 through ST9 - Choose which save state slot to use.
    • -
    • ST+ - Increment the selected save state slot by one.
    • -
    • ST- - Decrement the selected save state slot by one.
    • -
    • Save - Default: F2. Save a state to the current slot.
    • -
    • Load - Default: F4. Load a state from the current slot.
    • -
    • Pick - Default: F3. Open a dialog to choose the current save state slot. This will show a graphical preview of each save state. Learn more about how to use this dialog here.
    • -
    • Rewind - With each use, this key will backtrack the gameplay incrementally, according to the options you have set for '# of Rewind States' and '1/5 Seconds Per Rewind' (see above).
    • -
    -
  • -
-
- -
-

Speed

- -

Change speed settings and frame skipping settings here.

-
    -
  • Max Frame Skip - Set the maximum number of frames that may be skipped in direct sequence when rendering, only as needed to keep a constant emulation speed. Applicable only when using Auto Frame Rate (below).
  • -
  • Frame Rate - Set a static number of frames to skip rendering between each rendered frame, when not using Auto Frame Rate (below).
  • -
  • FastFwd Ratio - Set the number by which the default emulation speed will be multiplied while using Fast Forward.
  • -
  • SlowDwn Ratio - Set the number by which the default emulation speed will be divided while using Slow Down (e.g. "4" is 1/4 of normal speed).
  • -
  • Shortcuts: - Assign keys to various speed options. -
      -
    • Fast Forward - Default: ~ key. When used, the speed of emulation will increase (according to the FastFwd Ratio, above). Useful for quickly bypassing game intros or other sequences that you may not want to watch.
    • -
    • Slow Down - When used, the speed of emulation will decrease (according to the SlowDwn Ratio, above). This function requires having Auto Frame Rate (below) enabled. You might use this to watch very fast animated sequences, or to give yourself an advantage when you need to react quickly to something in the game.
    • -
    • + Emu Speed - Move the Emu Speed slider to the right by one step, increasing emulation speed sequentially (e.g. 1x -> 2x, 2x -> 3x, etc.).
    • -
    • + Frame Rate - Increase the static number of frames to skip rendering. Using this key will disable Auto Frame Rate.
    • -
    • Reset Speed - Sets the emulation speed back to normal (1x).
    • -
    • - Emu Speed - Move the Emu Speed slider to the left by one step, decreasing emulation speed sequentially (e.g. 1x -> 1/2x, 1/2x -> 1/3x, etc.).
    • -
    • - Frame Rate - Decrease the static number of frames to skip rendering. If you decrease it enough times, Auto Frame Rate will be enabled.
    • -
    • Pause Game - Default: P key. Pauses emulation.
    • -
    • Increment Frame - Only usable when emulation is paused, this feature will increment one frame each time the key is pressed.
    • -
    -
  • -
  • Toggled FFwd/SlwDwn - When unchecked, you must hold down the Fast Forward or Slow Down keys for as long as you want them to operate. When checked, press and release the assigned key once to enable the desired mode, and once again to turn it off.
  • -
  • Auto Frame Rate - Default: Checked. When enabled, ZSNES will attempt to maintain emulation at full speed. If necessary to maintain full-speed emulation, ZSNES will skip rendering frames of video. When disabled, ZSNES will skip a static number of frames for each rendered frame. If your priority is full-speed emulation, you should have this enabled, and increase Max Frame Skip (above) to its maximum. If your priority is to have every frame of video rendered, you should either have this enabled and set Max Frame Skip to zero OR disable this and set Frame Rate (above) to zero.
  • -
  • Emu Speed: - Default: 1x. Only available when using Auto Frame Rate. This slider sets the number by which normal emulation speed will be multiplied or divided (to speed up or slow down emulation speed, respectively).
  • -
-
-
- -
-

Cheat Menu

- - ZSNES GUI showing the Cheat Menu - -

The Cheat dialogs are only accessible if a game is loaded.

-

Read the Cheat Codes section in the Readme for general information.

-

Nach, the creator of NSRT, has a complete list of all official Game Genie codes.

- -
-

Cheat Browser

- -

Selecting Add Code from the Cheat menu opens this dialog with the cursor in the Enter Code: text box. Selecting Browse from the Cheat menu starts with the cheat list highlighted.

- -

Use this dialog to add, remove, and browse cheat codes.

- -
    -
  • Cheat Browser - This lists all cheats that you have added for the currently loaded game. You can have up to 255 codes per game. Each cheat is represented on a single row (except in the case of multi-line cheats). Each column gives different information about the cheat, as follows: -
      -
    • Address - Memory address that the cheat edits.
    • -
    • CV - Current value of the selected memory address.
    • -
    • PV - Previous value of the selected memory address.
    • -
    • Tgl - Shows whether the cheat is toggled (active) or not.
    • -
    • Description - The description for the cheat that you typed into the Description: box when adding the cheat.
    • -
    -
  • -
  • Buttons -
      -
    • Remove - Remove the currently highlighted cheat.
    • -
    • Toggle - Toggle on or off the currently highlighted cheat. This can also be accomplished by double-clicking on a code.
    • -
    • Save - Save all cheats in the list to a .cht file.
    • -
    • Load - If a .cht file exists in your saves directory, this will load all cheats from that file into the Cheat Browser.
    • -
    • Fix - If you have entered a cheat and it doesn't appear to work, you can try using this button to change the memory address that the cheat edits, which might fix the problem.
    • -
    -
  • -
  • Enter Code: - Type in the cheat code. Game Genie, Pro Action Replay, and GoldFinger codes are supported. Remember that Game Genie codes require the - (dash).
  • -
  • Description: - Type in a description for your code.
  • -
  • Add button - Add the code to the Cheat Browser once you have filled in the previous two boxes.
  • -
  • Auto-load .cht file at game load - When you load a ROM, ZSNES will look in your saves directory for a matching .cht file, and load it. This prevents you from having to hit the Load button, above.
  • -
- -
-
Notes on usage
- -
    -
  • To use a multi-line cheat code, just enter each line as a separate code!
  • -
  • You can also quickly modify the value of the currently selected cheat code (in the browse window) by typing a 2 digit hex number in the cheat code enter space.
  • -
  • You can allow a value of one cheat code to be mirrored from a value of another cheat code. To do this, type an 'R' at the end of any cheat code as the destination, then type another cheat code (Without the 'R') as the source. For example, if you want address 7E1000 to reflect the value at address 7F2000 (whatever value written to 7F2000 from the game will also be written to 7E1000), enter cheat code 7E1000FFR, then cheat code 7F2000FF (where FF can be any value).
  • -
-
- -
-
Keyboard usage
- -
    -
  • Use the Up and Down arrows to scroll through the Cheat Browser.
  • -
  • Use the R, T, S, L, and F keys to duplicate the functions of the five buttons below the Cheat Browser.
  • -
  • Use Tab to move from the Enter Code: box to the Description: box.
  • -
-
-
- - - -
-

Exact Value Searches

- -
-
Input Value
-
    -
  • Enter Value: - Enter the value for which you want to search and press the Search button.
  • -
  • Max Value: - This is a reminder of the maximum value for which you can search. Change this on the Setup Page (first step).
  • -
  • # of Results: - Displays the number of results for the current search. Before you start a search, this will display the number of searchable memory addresses for the currently loaded game.
  • -
  • Buttons -
      -
    • Restart - Move back to the Setup Page to change options.
    • -
    • View - View the results of the current search. If you have not yet run your own search, this will display all searchable memory addresses for the currently loaded game.
    • -
    • Search - Search for the value you entered in the box above. After you press this button, this page will change to reflect the number of results for your search. Press the View button to see those results.
    • -
    -
  • -
-
- -
-
View Results
- -

This page lists all the results of your current search. If you pressed the View button before running a search, this page will list all searchable memory addresses for the currently loaded game.

-

This list has two columns, the left column showing the memory Address, the right column showing the Value at that address.

-
    -
  • Return - Move back to the Input Page.
  • -
  • Add - Use this to select the currently highlighted address for editing.
  • -
-
- -
-
Add Cheat
- -

On this page, you can add the previously selected memory address as a cheat.

-
    -
  • Enter New Value: - Enter a value to insert into the memory address.
  • -
  • Enter Cheat Description: - Do just what it says.
  • -
  • PAR Code Equivalent: - This box will display the equivalent Pro Action Replay code for the value and memory address you are working with.
  • -
  • Max Value: - This is a reminder of the maximum value for which you can search. Change this on the Setup Page (first step).
  • -
  • Use Only Upper Byte - Use this option to change how PAR Code Equivalent is calculated.
  • -
  • Return button - Return to the Results Page.
  • -
  • Add button - Add the new cheat to the Cheat Browser.
  • -
-
-
- -
-

Comparative Searches

- -

This section isn't finished yet. Hopefully you can figure it out given the description of Comparative searches in the Cheat Setup dialog, above.

-
    -
  • New Value Is... -
      -
    • > Old Value -
    • -
    • < Old Value -
    • -
    • = Old Value -
    • -
    • != Old Value -
    • -
    -
  • -
  • # of Results: -
  • -
  • Restart -
  • -
  • View -
  • -
  • Search -
  • -
-
- -
- -
-

Netplay Menu (Win and SDL ports only)

- - ZSNES GUI showing the Netplay Menu for the Windows and SDL ports - -

Netplay has been disabled for the indefinite future, until the core becomes more accurate and/or non-random. We recommend using ZSNES v1.36 or v1.42n until this is resolved.

- - - - -
- -
-

Misc Menu

- - ZSNES GUI showing the Miscellaneous Menu - -
-

Misc (Miscellaneous) Keys

- -

Here you can change various function keys that are not configured elsewhere. Clicking inside a black box will bring a box, prompting you to assign a key to that function. Press the key you wish to assign, or press ESC to clear the existing assignment.

-
    -
  • BG Disables: -
      -
    • BG1 through BG4 - Toggle the various background layers on or off.
    • -
    • OBJ - Toggle the sprite/background layer on or off.
    • -
    -
  • -
  • Sound Keys: -
      -
    • Ch1 through Ch8 - Toggle the various sound channels on or off.
    • -
    • +Vol - Increase the volume.
    • -
    • -Vol - Decrease the volume.
    • -
    -
  • -
  • Quick Keys: -
      -
    • Load - Opens the Load dialog (accessed from the Game menu).
    • -
    • Reset - Performs a soft reset of the game. Also available under Game->Reset.
    • -
    • Exit - Exits ZSNES.
    • -
    • Clock - Toggle the clock, displaying system time on-screen during gameplay.
    • -
    • Chat - This is available only while using Netplay. After pressing this key, type your message, then press Enter/Return to send it to the other user.
    • -
    • Snapshot - Save a snapshot of the game screen and place it in your Snapshots directory. Also accessible through the F1 Menu.
    • -
    • Save SPC - Save SPC data to your SPCs directory. Also accessible through the F1 Menu.
    • -
    -
  • -
  • Misc Toggles: -
      -
    • Use PL12/34 - Toggles on or off the Use Pl3/4 as Pl1/2 option.
    • -
    • Panic Key - Restores default settings for several toggles. Enables Offset Mode, Windowing, and all Backgrounds, Sprites, and Sound Channels; disables Add-ons; resets Emu Speed throttle.
    • -
    • Display FPS - Toggles on or off the Frames per Second counter. Also accessible through the F1 Menu. You can also make this a persistent option under Config->Options.
    • -
    • Battery Power (Win/SDL only) - Displays the amount of battery life remaining and, if possible, time remaining, as reported by your operating system. This feature is intended for laptop or notebook PCs.
    • -
    -
  • -
  • GFX Toggles: -
      -
    • New GFX Engine - Switches between the faster, newer graphics engine (default) and an older one. The new one is recommended, but using the older one may fix graphics corruption in some games.
    • -
    • BG Window - A graphical feature that toggles windowing effects in certain SNES games.
    • -
    • Offset Mode - A graphical feature that toggles using offsets for tiles in certain SNES games.
    • -
    • + Gamma - Increase gamma level. This makes the video appear brighter.
    • -
    • - Gamma - Decrease gamma level. This makes the video appear darker.
    • -
    -
  • -
-
- -
-

GUI Opts (Options)

- -

Configure various GUI settings not set elsewhere (like Config->Options).

-
    -
  • GUI Switches: -
      -
    • RClick Opens GUI - When enabled, clicking the right mouse button will switch to and from the GUI when running a game (similar to pressing ESC). However, this can slow down emulation, since ZSNES has to check the mouse button status once in a while. If you are running in a windowed video mode, the right-click button won't return back to the game.
    • -
    • Swap L/R MButtons - Enabling this will swap the functions of buttons 0 and 1 of your mouse.
    • -
    • Show Mouse Shadow - Disables/Enables the mouse shadow.
    • -
    • Mice Wrap GUI Win - Allows the mouse pointer to wrap (to the other side of the screen) at the borders of the screen. You should probably only enable this while in Fullscreen; in Windowed mode this behavior can be annoying.
    • -
    • Trap Mouse Cursor (Win only) - Prevents the mouse cursor from exiting the ZSNES GUI. You will have to move the mouse with extra speed to make the cursor exit the GUI with this feature enabled.
    • -
    • Wheel Mice Scroll (Win only) - This feature allows you to use your mouse wheel to quickly scroll through various lists in the GUI (e.g. game list in load menu, video modes, etc.). In the SDL port, the Wheel should always be enabled.
    • -
    • ESC to Game Menu - While running a game, pressing Esc will take you back to the GUI with the Game Menu open, regardless of which menu was open last. It will also make the Game Menu be already open when you start ZSNES. If this is unchecked, you will have difficulty navigating the GUI without a mouse.
    • -
    • Ctrl GUI w/GPad1 - When enabled, it allows you to use the device configured for SNES Controller #1 to access the GUI. This way you can use your gamepad or joystick instead of your mouse/keyboard. The equivalent SNES keys to the keyboard keys are: -
        -
      • SNES D-Pad = Move mouse cursor
      • -
      • SNES A = Enter
      • -
      • SNES B = Esc
      • -
      • SNES L = PageUp
      • -
      • SNES R = PageDown
      • -
      -
    • -
    • Filtered GUI - Any video filter settings will be applied to the GUI, in addition to the game video output.
    • -
    • Use Custom Font - When checked, ZSNES will load font data from zfont.txt.
    • -
    • Save GUI Win Pos - When enabled, the GUI doesn't reset the locations of the windows when you exit/enter the GUI.
    • -
    -
  • -
  • BG Effects: - Only one of the following screen saver-like effects can be enabled at a time. They are visible in the background while the GUI is open. -
      -
    • None - no effect is active.
    • -
    • Snow - Looks like falling snow.
    • -
    • Burning - Looks like fire rising from the bottom of the window.
    • -
    • Smoke - Looks like smoke rising from the bottom of the window.
    • -
    • Water A - Looks like a water strider skimming across water.
    • -
    • Water B - Looks like rain drops falling on water and creating ripples.
    • -
    -
  • -
  • Color: - This section allows you to customize the colors used by the GUI. -
      -
    • Choose which part of the GUI to configure by selecting one of the following: -
        -
      • Back - Configure the color of the background of the GUI. Defaults: R=10; G=15; B=31.
      • -
      • Title - Configre color of the GUI's title bar. Defaults: R=0; G=10; B=31.
      • -
      • Win - Configure the background color of a dialog window. Dialog title bar colors are not configurable. Defaults: R=8; G=8; B=25.
      • -
      -
    • -
    • Use the sliders to change the relative quantities of Red, Green, and Blue color for the part of the GUI you have chosen to configure.
    • -
    -
  • -
  • Main Windows Options: -
      -
    • Emu Always on Top (Win only) - ZSNES will stay visible above other windows, even if it loses focus. Minimize ZSNES if you need to access other windows.
    • -
    • Save Main Window Position (Win only) - Saves the location of the ZSNES window between sessions.
    • -
    • Allow Multiple Instances of Emu (Win only) - Allows you to open more than one instance of ZSNES at a time. In the SDL port, multiple instances are always allowed.
    • -
    -
  • -
-
- -
-

Movie Opt (Options)

- -

The Movie Options dialog is only accessible if a game is loaded.

-

You can record your gameplay so that you can play it back at a later date either to amuse your friends, torture your friends, or whatever. Also be sure to check out the Movies section of the Readme, where you can find more information on subtitles, re-recording, and more.

-

Warning: Playing back a previously recorded movie will overwrite any SRAM data for the current game with the SRAM data contained in the ZMV file. This means you should back up your SRAM files when playing around with movies!!

-
    -
  • Select Movie: - Choose the movie recording slot to be used for recording/playback. The number of the slot corresponds to the ZMV extension (0 corresponding to .zmv, 1 to .zm1, ... 9 to .zm9).
  • -
  • Status: - Simply tells you if a record/playback is currently in progress.
  • -
- -
-
Controls tab
- -
    -
  • Record From: -
      -
    • Now - Begins recording the movie from the current point in the game.
    • -
    • Power - This will perform a hard reset (equivalent to shutting off the SNES, then turning it back on again), then begin recording.
    • -
    • Reset - This will perform a soft reset (equivalent to using the Reset button on the SNES), then begin recording.
    • -
    • Power+SRAM Clear - Performs a hard reset, then clears SRAM data (in-game save data). Useful if, for example, you don't want to see your saved games in the game menu when making your movie.
    • -
    -
  • -
  • Main controls: -
      -
    • Play - Begins playing the movie that is recorded in the current slot.
    • -
    • Record - Begins recording a movie to the current slot. While in playback mode, you can use this to start recording and redo the remainder of the movie.
    • -
    • Stop - Stops playing or recording a movie.
    • -
    • Append - This is usable only if you already have an existing ZMV using the new ZMV format. It allows you to continue recording a movie from the point where it is stopped. Press this button only when the movie status is inactive.
    • -
    -
  • -
  • Chapters: - You can assign a key to each of these functions by clicking in the black box next to each button and pressing a key. -
      -
    • Insert - During recording or playback, this can create a point (chapter) to which you can seek during playback.
    • -
    • Previous - Only usable during playback, this "rewinds" the movie to a previous chapter earlier in the movie.
    • -
    • Next - Only usable during playback, this "fast forwards" the movie to a chapter that is found at a later point in the movie.
    • -
    • There is currently no method for deleting a chapter.
    • -
    -
  • -
  • On Movie State Load: - Allow mode status to be changed when you are loading a movie state. -
      -
    • Do Not Switch Modes - Don't change the current mode.
    • -
    • Switch to Record - Set the current mode to Record on load.
    • -
    • Switch to Playback - Set the current mode to Playback on load.
    • -
    -
  • -
  • Display Frame Counter - Enable this to see the frame counter in the bottom-left corner of the screen during playback/recording. This is useful for determining where you can insert movie subtitles and for deciding where you want to end a movie when dumping it with the Dump # of Frames option.
  • -
-
- -
-
Dumping tab
- -

Video/Audio Dumping is recommended only for advanced users. More information is found in the Movie Dumping section of the Advanced Usage page.

-
    -
  • Video Options - You can only choose one of the following: -
      -
    • No Video Dump - Use this option when you want only audio.
    • -
    • Raw Video (No compression) - Dump raw 24 bit BGR video. This produces a file that no typical media player can read. Only use this option if you plan on manually encoding it. On UNIX systems, you can use a FIFO file to encode this in real-time, as an alternative to ZSNES's internal use of MEncoder. Caution: Raw movies require a tremendous amount of disk space, so make sure you have plenty of room before you begin!
    • -
    • FFV1 (Some compression) - Dump in an AVI container using FFMPEG's lossless video codec. The size of this file will be about 8% of the size of the raw video file.
    • -
    • x264 Lossless (Most compression) - Dump in an AVI container using the very advanced x264 codec in practically lossless mode (slow). The size of this file will be about 38% of the size of an XviD file, about 6% of the size of an FFV1 file, and about 0.5% of the size of a raw video file.
    • -
    • XviD Lossless (More compression) - Dump in an AVI container using the popular XviD codec in practically lossless mode (fast). The size of this file will be about 15% of the size of an FFV1 file, and about 1% of the size of a raw video file.
    • -
    • Custom - Uses alternative, user-defined parameters from the zmovie.cfg file. This option allows the use of multi-pass movie dumping to massively reduce the size of the outputted video file. Caution: This mode dumps lossy video; however, the default settings should look good for most games.
    • -
    -
  • -
  • Audio Options - You can choose any combination of the following: -
      -
    • Dump Audio - Enable audio dumping.
    • -
    • Compress Audio - Audio output will be compressed to MP3 as it is dumped. We recommend that you use this setting. When unchecked, audio output will be in WAV format.
    • -
    • Merge With Video - Place the outputted audio in the AVI along with the video.
    • -
    -
  • -
  • Dumping Length: - Choose the length of the video/audio file(s) to be created. -
      -
    • ZMV Length - Simply dump the entire movie.
    • -
    • Dump # of Frames - This sets the exact number of frames of the movie to dump, according to what you have typed in the black box at the right.
    • -
    • Until Stop - Keep recording until you stop dumping. This is primarily used for recording a movie even after the ZMV has completed playback. You may want to dump the ending of a game, which TAS (Tool-Assisted Speedruns) reach but often don't capture in the ZMV.
    • -
    -
  • -
  • Dumping: -
      -
    • Start - Start dumping the movie in the selected slot, using the current settings.
    • -
    • Stop - Use this to stop dumping a movie before the process has finished.
    • -
    -
  • -
-
-

Saving or loading a state during recording will allow you to undo mistakes, i.e. re-record, while making a movie. These states created during record can also be loaded during playback, like chapters. However, unlike chapters, you're limited to 100 of them.

-

Loading another game will halt the play/record process.

-

Movie dumping options can be tweaked by advanced users in the zmovie.cfg file.

-
- -
-

Key Comb. (Key Combination Editor)

- -

Allows you to specify certain keyboard combination routines with a single keystroke/joystick button press.

- -
    -
  • List of combinations
  • -
  • Clear - Clears the current key combination field.
  • -
  • Add - Adds the key combination fields below as a new entry.
  • -
  • Replace - Copies the contents of the key combination fields below to the current highlighted key combination above.
  • -
  • Delete - Deletes the highlighted key combination above.
  • -
  • Key - Clicking on this box will allow you to select which key/button to use.
  • -
  • Description - Allows you type in the description of the combination key.
  • -
  • P# - Selects which player # will use those keys.
  • -
  • > = Last </> - Enabling this would mean that the event symbol > will mean the last left or right direction the user presses in the game and the symbol < is the opposite of that direction. When disabled, > means right and < means left.
  • -
  • Game Specific - Enabling this will tell ZSNES to use separate key combination files for each individual game.
  • -
  • Combination Keys - This window will display the sequence of events selected by the user.
  • -
  • Events: -
      -
    • Press+Rel - The key will be pressed and held. It will be released once another key is pressed after any amount of frame or second delay.
    • -
    • Press Only - The key will be pressed and held.
    • -
    • Rel Only - The key will be released if it is pressed by a press only event.
    • -
    • Frame Delay - Delays for the specified number of frames.
    • -
    • Second Delay - Delays for the specified number of seconds.
    • -
    • Del - Deletes the event at the end of the combination keys list if one exists.
    • -
    -
  • -
- -

Note: A 1 frame delay exists after the combination key list has finished processing.

- -

Example Key Combination: (Down / Down+Right / Right / L):

-
    -
  • Method 1: Press+Rel Down / 2 Frame Delay / Press+Rel Down / Press+Rel Right / 2 Frame Delay / Press+Rel Right / 2 Frame Delay / Press+Rel L
  • -
  • Method 2: Press Only Down / 2 Frame Delay / Press Only Right / 2 Frame Delay / Rel Only Down / 2 Frame Delay / Rel Only Right / Press Only L
  • -
-
- -
-

Save CFG

- -

Saves the configuration files. ZSNES normally writes to the configuration files on exit. This function overrides the "cfgdontsave" option in the .cfg file.

-
- -
-

About

- -

Just shows some information about ZSNES.

-
    -
  • Version number
  • -
  • Build date
  • -
  • Port name
  • -
  • www.ZSNES.com button (Win/SDL only) - Opens your default web browser and loads the ZSNES.com Home Page.
  • -
  • Documentation button (Win/SDL only) - Opens your default web browser and loads the ZSNES Documentation Home Page.
  • -
  • Coded By: - Main developers are listed. More information in the About page of the documentation.
  • -
  • Assistant Coders: - Assistant developers are listed. More information in the About page of the documentation.
  • -
  • Disclaimer. Please read the GNU General Public License.
  • -
-
-
- -
-

F1 Menu

- - The F1 menu, which gives quick access to a number of frequently-used features - -

Use this menu to access oft-used functions. Most of these are related to dumping data from the game you are running.

-
    -
  • Save Snapshot - Creates an image of the game screen in your Snapshots directory.
  • -
  • Show/Hide FPS - Shows or hides the frames-per-second display which appears on the bottom-left corner of the screen. The value shown on the right side of the display is the rate that the SNES should be maintaining. This counter is available only when in auto frame rate mode. You can have this display enabled by default under Config->Options.
  • -
  • Save SPC Data - Using this will search for the beginning of the next song and save the data into an SPC file. To capture a song, it is best/recommended to initiate this feature approximately 2 seconds before the next song starts. This does have potential to fail though, so don't expect it to work all the time. The .spc file will be placed in your SPCs directory.
  • -
  • Sound Buffer Dump - This dumps ZSNES' sound buffer and also filters out any unoccupied space. The sound buffer contains decompressed samples which are written to when ZSNES plays/decodes a sample from sound memory. Because of the way ZSNES buffers the sound data, this can produce inaccurate results. The dump will be placed in your SPCs directory.
  • -
  • Snapshot/Incr Frame - Same as snapshot, but it returns to the F1 menu after a couple of frames. Useful for making animations.
  • -
  • Incr Frame Only - Move forward one frame without taking a snapshot.
  • -
  • Move This Window - Moves the F1 menu to a different location.
  • -
  • Image Format: - Choose what image format to use for snapshots of the game screen. This setting is also configurable under Config->Options. -
      -
    • BMP - Snapshots will be saved as bitmap pictures (16-bit color). If you are using an 8-bit video mode in the DOS port, the bitmap will be saved with 8-bit color.
    • -
    • PNG - Snapshots will be saved as PNG files (32-bit ARGB color). This is not selectable while using an 8-bit mode or if you did not compile with PNG support.
    • -
    -
  • -
-
- -
-

Save State Slot Chooser

- - The Save State Slot chooser screen, which allows you to quickly choose a save state slot using a graphical preview. - -

Use this dialog to pick which save state slot to use. A graphical preview of the save state will be shown above this dialog (it is not visible in the above picture).

- -
-

How to Use:

- -
    -
  1. Press F3 to open this dialog.
  2. -
  3. Use Up / Down arrow keys to move between save state levels.
  4. -
  5. Use Left / Right arrow keys to move between save states on a certain level.
  6. -
  7. Use Enter or Return or ESC to use the selected save slot.
  8. -
  9. Use either F2 to save a state or F4 to load a state in the slot you just selected.
  10. -
-
- -
-

Color Key:

-
    -
  • Slots with blue backgrounds do not have a save state in them.
  • -
  • Slots with red backgrounds have a save state in them.
  • -
  • The slot with the orange background contains the most recent save state within that state level.
  • -
-
-
-
- - - -
- - - - diff --git a/tools/zsnes/docs/readme.htm/history.htm b/tools/zsnes/docs/readme.htm/history.htm deleted file mode 100644 index 3665ea8..0000000 --- a/tools/zsnes/docs/readme.htm/history.htm +++ /dev/null @@ -1,2703 +0,0 @@ - - - - - History - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - -
- -
-

History

- -
-

The following is the history of ZSNES, including the changelogs for every official ZSNES release, and other major events. ZSNES was first released on October 14, 1997.

-

Spanning the releases between version 0.715 and version 0.990, an ASM-only version was offered alongside the normal ASM+C version. Differences between sister C/A releases are marked as appropriate.

-

Note: All changelogs before v1.40 were copied from their original text source inside the ZSNES official release packages. We edited the old changelogs as little as possible in order to minimize the accidental loss of information. Therefore, you may find spelling mistakes and formatting differences between different versions.

-
    -
  1. v1.51 - January 25, 2007
  2. -
  3. v1.50 - December 22, 2006
  4. -
  5. v1.42 - January 19, 2005
  6. -
  7. v1.41 - January 18, 2005
  8. -
  9. v1.40 - December 25, 2004
  10. -
  11. v1.36 - July 15, 2002
  12. -
  13. v1.35 - June 23, 2002
  14. -
  15. v1.337 - September 30, 2001
  16. -
  17. zsKnight Leaves - July 23, 2001
  18. -
  19. v1.31b - July 3, 2001
  20. -
  21. v1.31 - June 27, 2001
  22. -
  23. v1.30b - June 16, 2001
  24. -
  25. v1.30 - June 13, 2001
  26. -
  27. v1.29 - June 1, 2001
  28. -
  29. v1.28b - May 28, 2001
  30. -
  31. v1.28 - Unknown Release Date
  32. -
  33. v1.26 - May 17, 2001
  34. -
  35. v1.25 - May 15, 2001
  36. -
  37. v1.20b - April 30, 2001
  38. -
  39. Source Code Released - April 2, 2001
  40. -
  41. v1.17b - December 27, 2000
  42. -
  43. v1.17 - December 25, 2000
  44. -
  45. v1.14 - November 27, 2000
  46. -
  47. v1.12 - November 14, 2000
  48. -
  49. v1.11 - November 12, 2000
  50. -
  51. v1.10 - November 7, 2000
  52. -
  53. v1.01 - September 9, 2000
  54. -
  55. v1.000 - September 1, 2000 - First Windows Release
  56. -
  57. v0.991 - May 24, 2000
  58. -
  59. v0.990 - May 24, 2000
  60. -
  61. v0.9891c/a - February 21, 2000
  62. -
  63. v0.989c/a - February 12, 2000
  64. -
  65. v0.988c/a - December 6, 1999
  66. -
  67. v0.987c/a - November 26, 1999
  68. -
  69. v0.986c/a - November 23, 1999
  70. -
  71. v0.985c - November 15, 1999
  72. -
  73. v0.963c/a - September 19, 1999
  74. -
  75. v0.962c/a - September 18, 1999
  76. -
  77. v0.960c - September 17, 1999
  78. -
  79. v0.953c/a - August 4, 1999
  80. -
  81. v0.952c - August 3, 1999
  82. -
  83. v0.951c - August 3, 1999
  84. -
  85. v0.950c - August 2, 1999
  86. -
  87. v0.941c/a - July 18, 1999
  88. -
  89. v0.940c/a - July 18, 1999
  90. -
  91. v0.915c/a - July 7, 1999
  92. -
  93. v0.910c/a - July 6, 1999
  94. -
  95. v0.900c/a - July 4, 1999
  96. -
  97. v0.800a - December 25, 1998
  98. -
  99. v0.800c - December 24, 1998
  100. -
  101. v0.715 - October 29, 1998
  102. -
  103. v0.700 - October 26, 1998
  104. -
  105. v0.635 - September 24, 1998
  106. -
  107. v0.625 - September 18, 1998
  108. -
  109. v0.605 - September 10, 1998
  110. -
  111. v0.601 - September 9, 1998
  112. -
  113. v0.600 - September 9, 1998
  114. -
  115. v0.400 - May 19, 1998
  116. -
  117. v0.393 - April 15, 1998
  118. -
  119. v0.391 - April 13, 1998
  120. -
  121. v0.390 - April 11, 1998
  122. -
  123. v0.305 - February 12, 1998
  124. -
  125. v0.300b - February 10, 1998
  126. -
  127. v0.300 - February 9, 1998
  128. -
  129. v0.297 - January 31, 1998
  130. -
  131. v0.296 - Not Released?
  132. -
  133. v0.295 - January 29, 1998
  134. -
  135. v0.270 - December 25, 1997
  136. -
  137. v0.201b - November 5, 1997
  138. -
  139. v0.201 - November 5, 1997
  140. -
  141. v0.200 - November 4, 1997
  142. -
  143. v0.182 - October 23, 1997
  144. -
  145. v0.180 - October 22, 1997
  146. -
  147. v0.170 - October 16, 1997
  148. -
  149. v0.150 - October 14, 1997 - Initial Release
  150. -
-
- -
-

v1.51 - January 25, 2007

- -
-

All Ports:

- -
    -
  • Rejoice for finally having 224 lines and them being shown properly in all cases. [pagefault]
  • -
  • IRQ and timing fixes (fixes Chrono Trigger issues, Super Mario World, and others). [pagefault]
  • -
  • Fixed bug with certain commandline parameters permanently overwriting config file settings. [Nach]
  • -
  • Fixed bug with loading new ZMVs of a different version. [Nach]
  • -
  • Loading ZMV with ROM mismatch prints a message. [Nach]
  • -
  • Movie menu now has tabs and only shows proper options when available. [Deathlike, Nach, grinvader]
  • -
  • Slight improvement to the Custom Res functionality. [Deathlike, Nach]
  • -
  • Keep4_3Ratio option now only shows when necessary. [Deathlike]
  • -
  • PNG files now use extended height in extended height mode. [Nach]
  • -
  • Pausing, rewinding, and fast fowarding are disabled during movie dumping. [Nach, SamB]
  • -
  • You can now force a movie dump length shorter or longer than the actual ZMV length. [Nach, Deathlike]
  • -
  • Fixes for MEncoder check; added LAME check. [Nach]
  • -
  • Custom dumping with multiple passes implemented. [Nach]
  • -
  • Fixed some bad memory reads in command-line parser. Thanks grinvader. [Nach]
  • -
  • Now there's an option to switch to replay mode while recording movies when loading a state and vice versa. [Nach, Deathlike]
  • -
  • Fixed a bunch of bugs with certain save selection techniques not working right. [Deathlike]
  • -
  • Fixed gui font overwrite problem after fixing a cheat. The dots should be gone now. [Jonas Quinn]
  • -
  • You can now select the level of HQ filtering where applicable. [Deathlike]
  • -
  • Many tweaks made to reduce GUI mem usage on all ports. [Deathlike]
  • -
  • ZSNES now properly adheres to the command-line when Auto State Save/Load is used. [Deathlike]
  • -
  • Quick exit key now adheres to Auto State Save/Load. [Deathlike]
  • -
  • Inc/Dec Gamma toggles actually DO something. Gamma level is now definable in the config file. [Deathlike]
  • -
  • Fixed bugs with playing back ZMVs of 2+ players at once. [Nach]
  • -
  • Fix crash if you rewind farther than the game start in Kirby Super Star, Secret of Mana and some other games. [Jonas Quinn]
  • -
  • Fix crashing if using rewind in a movie before rewind slot is filled. Thanks BoltR. [Nach]
  • -
  • Readded the smoke effect. [Jonas Quinn]
  • -
  • Fixed the Winter Gold crash (but not the freeze). [Jonas Quinn]
  • -
  • Fixed crash in Super Demo World and possibly certain other large games. [Jonas Quinn]
  • -
  • Fixed loading many old ZSTs. [Jonas Quinn]
  • -
  • Fixed some bugs with movies which load from power on with SRAM. [Nach]
  • -
  • Fixed some issues with DSP-4 movies. [Nach]
  • -
  • Added ability to have game-specific input. Main input is now stored in zinput.cfg. [Nach, Deathlike]
  • -
  • Added option in Config->Options for Screenshot format. [Deathlike]
  • -
  • Fix crash on creation of ZMV if save path does not exist. Thanks Maximus. [Nach]
  • -
  • Logo support for AVI dumping. Set the logo file in zmovie.cfg; it can be gzip'd if you want. [Nach]
  • -
  • Pick state menu (default - F3) now has wraparound. Praise Pac-Man! [Deathlike]
  • -
  • Config file cleanup for more understandability. [Deathlike]
  • -
  • New Don't Save SRAM option. [Deathlike]
  • -
  • More GUI cleanup and tweaking, also reorganization. [Deathlike]
  • -
  • Removed the horrible-sounding Mono Surround Sound code. [Deathlike]
  • -
  • Source cleanup. [Deathlike, Phil^, Nach, grinvader]
  • -
  • Parsegen now allows one to define inside a PSR file to have it reject arrays from older config files. [Nach]
  • -
  • Our assembly syntax shortener now is case-insensitive with new case-insensitive string class. [Nach]
  • -
  • Archopt has updated flags, added GCC 4.2's -march=native support. [Nach]
  • -
  • Parsegen now has atoui() which should fix reading very large values. [Nach]
  • -
  • Ported more assembly to C. [Jonas Quinn]
  • -
  • Misc. bug fixes. [Deathlike, Jonas Quinn, SamB, Nach, grinvader]
  • -
-
- -
-

DOS Port:

- -
    -
  • Fixed snapshots key from attempting to take a PNG when it cannot. [Deathlike]
  • -
  • Removed old DOS debugger at last. [SamB]
  • -
  • Clock box option now does something in 8-bit modes. [Deathlike]
  • -
-
- -
-

Win Port:

- -
    -
  • Updated and improved NTSC filter. [Blargg, pagefault, Deathlike]
  • -
  • Added 1600x1200 S Full to Windows port for consistency. Fixed details of 1600x1200 S Win. [Deathlike]
  • -
  • Fixed crash with HQ4x in windowed mode with Hi-Res Mode 7 on. [Deathlike]
  • -
-
- -
-

SDL Port:

- -
    -
  • Fixed broken option on Mac OS X; load menu shouldn't crash anymore. Thanks phf. [Nach]
  • -
  • Made WIP launch message berate users for not using --enable-release if it was an official release. [Nach]
  • -
  • Added option to define configuration directory. [Aerdan]
  • -
  • Mac OS X config directory now defaults to Library/Application Support/ZSNES. [Nach]
  • -
  • Symlink support for matching ROM name to files. [Nach]
  • -
  • Updated and improved NTSC filter. [Blargg, pagefault, Deathlike]
  • -
  • More accurate NTSC ratio. [pagefault]
  • -
  • You can now use libao for sound, compile with --enable-libao, also see zsnes --help for a list of drivers to use. [Nach, Bisqwit, grinvader]
  • -
  • Unit testing done; off by one errors in audio sample output fixed. Thanks hakonrk and grinvader. [Nach]
  • -
  • Now supports ~ (home directory) in various places, most notably ROM loading. [Nach]
  • -
  • Fixed some filtering and video refreshing issues. [Deathlike]
  • -
  • Fixed Bilinear Filtering on startup. [Deathlike]
  • -
-
-
- -
-

v1.50 - December 22, 2006

- -
-

All Ports:

- -

For this release, we spent much time rewriting, porting, and improving many internal subsystems. ZSNES is a program with over 200,000 lines of source code, and in this release, over 25% of that has been modified; also, around 15% of the assembly has been ported to C. The upcoming list, while large, can't fully describe the amount of work done and the amount of improvements made. Be sure to see the readme to find out how to use all the new features.

- -
-
Subsystem Additions/Updates/Rewrites/Fixes/Improvements
-
    -
  • Ryan C. Gordon's ManyMouse support added. [Nach, pagefault]
    This allows the systems compatible with ManyMouse (Windows XP, Linux via evdev if read permission set, Mac OS X) to handle each mouse plugged into the system separately. So now games with two mouse-using devices can be played with 2 players (or 1 player controlling both) on a single PC.
    Left Handed Mouse Support. [Nach, Deathlike, Jonas Quinn]
    So lefties can have the buttons for a particular mouse swapped if they so desire.
  • -
  • Rewrote directory handling system. [Nach, Jonas Quinn, grinvader, Deathlike]
    The old system, dubbed "ZFile", only kept track of files in a limited manner allowing for many many bugs. The new system, dubbed "ZPath", now tracks files and paths in a clean systematic manner to eliminate all file/path related bugs that have made previous versions annoying. All file handling code is now done in C and has many functions to make it easier for anyone else to jump right into this bit of development. This also allows for many new features to be written, and we wrote quite a few. A debug system has also been added, making it easy to track file issues regardless of the operation system in question.
  • -
  • ZMV Rewritten - Movie Support. [Nach, grinvader, ipher]
    Added support for subtitles while playing a ZMV. [Nach]
    Can now load movies via command line parameter. [Nach]
    Added parameter to close ZSNES when movie is closed. [Nach]
    Our movie subsystem - ZMV has been completely rewritten from the ground up. Now features such as rerecording (via states and rewind), appending, mouse recording, Super Scope recording (buggy), chapters, start types, frame count, input compression, among other things are now all supported. Note ZSNES can still load old ZMVs; however, it should be noted that ZMVs are somewhat version reliant and may desync on a version it was not recorded with. Also, most of the new features will not work when using an old ZMV.
  • -
  • Can now dump ZMVs to AVI and WAV. [Nach, Bisqwit]
    For years, users have requested being able to convert a ZMV to something else; it is now possible.
  • -
  • Added IPS multipatch support. Goes from IPS, IP0, IP1, IP2, ..., IP9. [Nach]
    So you can have IPS autopatching apply more than one to a game loaded.
    IPS files now loaded from save directory then ROM directory. [Nach]
    Making it easier for a user to auto patch.
    Fixed silly mistake with size adjustment of IPS patches. [Nach]
    So now the very rare broken IPS should work.
  • -
  • Rewind and ZST code fully merged; rewind should now work where save states do (Fixes rewinding in Super Bomberman games). [grinvader, Nach]
    Can now use 100 save states instead of 10. [Deathlike, Nach, Jonas Quinn]
    SRAM is now stored in save states and can be optionally loaded from them. [grinvader, Nach]
    Can now select how many rewind states you want. [grinvader, Nach, ipher]
    Can now select how much time is in between rewinds. [grinvader, Nach, ipher]
    Our state saving subsystem has been completely rewritten (although another rewrite is planned) to fix many bugs that used to be present. With the ZST and rewind code merged, it also means no more issues where one works but not the other. This is also now all done in C, making it easier to deal with, as well as allowing many new features as listed above.
  • -
  • Parsegen invented (thanks grinvader, gladius). [Nach]
    Binary and text config files merged into one and heavily updated. [Nach, grinvader, Deathlike]
    We invented a new programming language (PSR), and a compiler for it (parsegen), which allows one to keep track of variables in a simple manner for both developers and end users. Developers can just declare a particular variable to be tracked and forget about it, letting the system manage everything else, making it easy to add as many configuration options as one likes. For the end user, the config file is all in text, making it easy to modify any feature they like or features for advanced users not changeable from within the GUI. It also provides a level of future compatibility so users should normally not have to delete config files between versions. It also allows partial config files, so users can delete certain settings and have them restored to their defaults. All this is possible while maintaining a high level of flexibility.
  • -
  • Netplay, Modem, IPX code removed. [grinvader, Nach. ipher]
    As much as we hated to, we had to remove all computer-to-computer playing options in order to fix up the other subsystems since the code was spread throughout ZSNES. We hope to reimplement it in future versions and also provide new features.
  • -
  • Created new macros and greatly eased GUI development and cut down on size of GUI code. [ipher]
    Cleaned up GUI and reorganized it. [ipher, Nach, grinvader, Deathlike, Jonas Quinn]
    Added tab support to the GUI and made good use of it. [grinvader]
    Rewrote the load game menu, it can now handle thousands upon thousands of ROMs at a time. [Nach, grinvader]
    Added a custom font system. [ipher, Deathlike]
    Nach input boxes (video, path) now have a normal blink rate. [Nach]
    Now using our custom GUI should be easier and more straight forward. Almost everywhere you look, you should see a cleaner design, new features, and fewer bugs. See below for more specifics.
  • -
  • New unified ZSNES loader which is also less buggy. [Nach, grinvader, Deathlike, Jonas Quinn]
    Now command line options are handled in a more efficient manner, as well as making it much easier for us to add more.
  • -
  • Committed the ZSNES development toolkit. [Nach, grinvader]
    Code is now always in executable sections, fixes NX and many other issues. [Nach]
    Added utility to auto detect best -march option to compile with; SDL port uses it automatically. [Nach, grinvader]
    For various developers, we now added many utilities to make working on ZSNES much easier. Some of these utilities should be built into the assembler but aren't. These new utilities have also allowed us to easily track down several critical bugs and fix them effortlessly. We also have a utility now to aid the person compiling to get the best optimization out of their build, perhaps now allowing them to use HQ4x or other filters that weren't possible before.
  • -
  • Updated build setups. [grinvader, Nach]
    Added file dependency utility. [Nach]
    All the build setups have been updated to make it easier and more flexible for one to compile ZSNES and encounter fewer bugs along the way. File dependencies can now also be calculated automatically (most notably for SDL), so one updating ZSNES doesn't run into weird issues with only half of a fix being compiled.
  • -
  • Ported much assembly to C. [grinvader, Deathlike, Nach, Jonas Quinn, theoddone33, pagefault, byuu]
    Removed dead code. [grinvader, Nach, pagefault, Jonas Quinn, Deathlike]
    Lastly on our big rewrite, a lot of old junk went, and many complex and annoying features are now in C, meaning that if you know C, now is a good time to start helping out ZSNES development.
  • -
-
-
-
Special Chips
-
    -
  • Fixed all remaining bugs with the SPC7110. SPL4 and MDH are working correctly, now. Special thanks to John Weidman and Dark Force for working on reverse engineering. [Jonas Quinn]
  • -
  • Super FX updates (Starfox 2 now 99% working). [pagefault]
  • -
  • OBC-1 code ported to C and integrated properly. Metal Combat doesn't have graphical problems anymore (thanks Nach). [Jonas Quinn]
  • -
  • DSP-1 finished. [The Dumper, Andreas Naive, Nach]
  • -
  • SA-1 detection updated (Fixed loading of SD F-1 Grand Prix (Sample)). [Nach]
  • -
  • Partial Seta 11 emulation (thanks anonymous and Jonas Quinn). [Nach]
  • -
  • DSP-3 support (opcodes RE'd by Overload and Feather). Thanks Jonas Quinn for finding a bug in my glue code. [Nach]
  • -
  • DSP-4 Support (Top Gear 3000). [Nach, pagefault]
  • -
  • C4 emulation should be virtually perfect now. [Nach, Jonas Quinn]
  • -
  • Now got mapping done correctly for dual Sufami Turbo (thanks byuu); now have two sets of SRAM. [Nach, Jonas Quinn]
  • -
-
-
-
As for everything else, much was done, including a multitude of emulation updates; it is even hard to count how many emulation bugs are no longer present. Several new features were also added.
-
    -
  • Many Mode 7 fixes, also implemented anomie's Matrix formula (Fixed Energy Breakers world map, IOG intro, Battlemanicas Battlecoptor intro). [Jonas Quinn]
  • -
  • Added some preliminary NMI and IRQ timing. Proper behavior of H-IRQ when V-IRQ is active. Flickering fix in H-IRQ timing. [pagefault]
  • -
  • Fixes for DMA, HDMA, so we can have the recent improvements without breaking tons of other games. (SSF2, SFA2, FFMQ, TOP, CT, YI, probably others). [pagefault]
  • -
  • Init DMA values to FF (thanks Overload). [pagefault]
  • -
  • Fixed windowing issues in Dragon Quest, Star Ocean, Final Fantasy V, Gradius III, and probably other games. [Jonas Quinn, pagefault]
  • -
  • Fixed transparency issues in several games, including U.N. Squadron, Final Fantasy 3u/6j, and Star Ocean. [Jonas Quinn, pagefault]
  • -
  • Fixed SRAM Mapping. Ys III, Dezaemon, Tokimeki Memorial, Dragon Knight 4, Fire Emblem - Thracia 776, *should* all work nicely now. [Jonas Quinn, Nach]
  • -
  • Fixed a special chip SRAM bug. [Nach]
  • -
  • Fast ROM is now actually set. [Nach]
  • -
  • Straightened out the 48Mb/64Mb ROM map. [Jonas Quinn, Nach]
  • -
  • Fixed Uchuu no Kishi Tekkaman Blade. [Jonas Quinn]
  • -
  • Fixed ENVxbehavior. [pagefault]
  • -
  • Some fixes regarding WRAM. Some Open Bus. Thanks _Demo_ & byuu. [Nach, pagefault]
  • -
  • Fixed the source of the Super Turrican crash. It also fixes my current Robotrek game. I pray this doesn't break anything else... [Deathlike]
  • -
  • Behold true ROM mirroring. If your translation breaks now, fix it. [Nach, grinvader]
  • -
  • Evened out ROM scoring quite a bit. A bunch of beta ROMs which didn't load before now should. Special thanks to Cowering for the Reset Vector Popular Opcode Check code. [Nach]
  • -
  • Say goodbye to speedhacks. [pagefault]
  • -
  • Changed cycles for scanline 0. [pagefault]
  • -
  • Removed special timing for EHi roms. [Jonas Quinn]
  • -
  • Fixed game title in SPC files for EHi Roms. [Jonas Quinn]
  • -
  • Workaround to fix crashing of certain games (Sim City PAL and Super Tetris 2 + Bombliss) on resolution change. [Jonas Quinn]
  • -
  • Silly DSP code removed; should fix a lot of games (including EWJ2). [pagefault]
  • -
  • Fixed program counter in RET macro. Dirt Racer now plays with some blinking, making progress :) [pagefault]
  • -
  • Implemented some RTO (fixes some FF3 issues). [pagefault]
  • -
  • Many hacks removed (we now have less than a dozen, and we have the least of all the emulators that use hacks). [pagefault, grinvader, Nach, Jonas Quinn]
  • -
  • Fixed small screen extra line issues (fixes Super Metroid annoying line issue, so now that guy who keeps on coming into the channel annoying us about it can rest in peace). [pagefault, Nach]
  • -
  • Fixed bug in hi-res mode (for example, Lufia 2 ending). [MaxSt]
  • -
  • Fix some randomness in the SPC core for now. [pagefault]
  • -
  • Fixed loading of small ROMs. [Nach]
  • -
  • Fixed a bug when the background was cleared to a strange color. [pagefault]
  • -
  • Updated the bg scroll registers; fixes a couple of games (thanks anomie, byuu). [pagefault, grinvader, Jonas Quinn]
  • -
  • Memory mapping code is now somewhat sane and can be followed. [grinvader, Nach]
  • -
  • Updated timing. [pagefault]
  • -
  • Readded corrected noise frequencies. [TRAC]
  • -
  • SPC RAM cleared properly on soft reset. [pagefault, Nach]
  • -
  • Fixed some init glitches. [Nach]
  • -
  • Pass some more tests on the test cart. [pagefault, Jonas Quinn]
  • -
  • SPC700 init to ffc0. [byuu]
  • -
  • Proper logic when drawing sprites while subscreen is present; fixes SMRPG characters disappearing when entering buildings. [pagefault]
  • -
  • Removed the Sound Buffering option because it isn't doing anything. [Jonas Quinn]
  • -
  • GUI/Exiting SRAM saving only saves if SRAM Check+Save is off or it's on and SRAM has been modified recently without save. [Nach]
  • -
  • Super Scope buttons are now configurable. [Deathlike]
  • -
  • srand() is performed once! and always once per z execution. Water effect B now also has a lot more effecting. [Nach]
  • -
  • Cleaned up GZip reader. GZip reader now also supports transparent reading, namely a regular file with a .gz extension for no apparent reason. [Nach]
  • -
  • Added "Show Clock Box" and "Show Rom Info On Load" to the Options menu. [Deathlike]
  • -
  • Fixed some bugs that were discovered with Valgrind. [Nach]
  • -
  • Changed the default keys for Player 2 to saner defaults. [Deathlike]
  • -
  • Fixed some memory leaks. [Nach]
  • -
  • Remove B CPU core. [pagefault]
  • -
  • No more TURB! [Nach]
  • -
  • FPS now displayed correctly for large numbers. [grinvader]
  • -
  • Fixed crash after SuperFX savestates are loaded. [Jonas Quinn]
  • -
  • No more alpha for PNGs. [Nach, grinvader]
  • -
  • Removing unused and probably out of date SPCDUMP. [Nach]
  • -
  • Prevented 'auto state save/load' & 'auto increment state slot' from interacting. Former takes precedence. [grinvader]
  • -
  • ZSNES will no longer jump back into the GUI randomly if you press F2 / F4 or some other buttons repeatedly. Special thanks to Dan for the clues on how to recreate it. [Jonas Quinn]
  • -
  • Added 12 hour clock toggle. [pagefault]
  • -
  • GUI special case horizon fixed (thanks Motley, Dan). [Nach]
  • -
  • Crammed a "Documentation" button right below the "WWW.ZSNES.COM" button. [ipher, Nach]
  • -
  • Fixed crash after enabling Sound Interpolation mid-game. Fixed Gaussian always selected bug when MMX Support is disabled. Some options that are only available with MMX enabled are now hidden if MMX is disabled. [Jonas Quinn]
  • -
  • Fixed Clear2xSaIBuffer to clear the first line, too. [Jonas Quinn]
  • -
  • Removed off by 1 line fix. [Jonas Quinn]
  • -
  • Fixed burning effect in executables compiled with GCC. [Jonas Quinn]
  • -
  • Removed some DOS only code from other ports and vice versa. [Jonas Quinn]
  • -
  • Added "+ Gamma" and "- Gamma" hotkeys to the Misc Keys menu. [pagefault, ipher]
  • -
  • Hacks can now be disabled via command line (-dh). [Jonas Quinn]
  • -
  • Get_Date returns correct year now. [Jonas Quinn]
  • -
  • SPC filenames are no longer truncated if there is a dot in the filename. [Jonas Quinn]
  • -
  • Made gui option save config override dontsave option. Fixed bug #13. [Nach]
  • -
  • Fixed crash when MMX is disabled and 25% scanlines with interpolation is enabled (bug #142). [Jonas Quinn]
  • -
  • Fixed corrupted graphics when alt-tabbing. [pagefault]
  • -
  • Can now display battery power status on laptops. [Nach, pagefault, ipher, David Lee Lambert, drizztbsd]
  • -
  • Stupid (and old) mistake successfully corrected after manual tracking; fixed bug #52, and probably lots of other sound issues upon state load... [grinvader, Jonas Quinn]
  • -
  • Added new video modes. [Aerdan]
  • -
  • Fixed vars in bss section that had no space reserved. Fixed bug #18 on bug tracker. [Jonas Quinn]
  • -
  • ZSNES now decodes shift-jis headers correctly... but the font is still limited to 5x5. [grinvader]
  • -
  • GCC 4.0 support. [Nach]
  • -
  • Fixed a jump to not disable ENV when it shouldn't. [Jonas Quinn]
  • -
  • Optimization to frame draw code, only draw frames that change. [pagefault, Nach]
  • -
  • Added error message if hard patching fails. [Nach]
  • -
  • Fixed the exit procedure. [Nach, Jonas Quinn]
  • -
  • Updated license. [Nach]
  • -
  • Option to allow Up+Down/Left+Right for speedruns' sake. [grinvader]
  • -
  • New variable slow down/speed up options. [grinvader. ipher]
  • -
  • Lower memory usage. [Nach, Jonas Quinn, Deathlike]
  • -
  • Panic key now resets offset mode and windowing state. [pagefault]
  • -
  • Primary Buffer option shouldn't be reversed anymore. [Jonas Quinn]
  • -
  • Added pause and frame increment options (buggy). [Nach, grinvader, ipher]
  • -
  • Key combos for player 5. [ipher]
  • -
  • Mode 4 offset change overflow fix in rendering code. [pagefault]
  • -
  • Fixed crashes related to wrong MMX detection. [Jonas Quinn, Deathlike, hector]
  • -
  • Major framerate improvement when using new graphics engine. [pagefault]
  • -
  • JMA: Fixed some bugs in decompression. Improved performance. Lower memory requirements. Support for JMA v1 files. [Nach]
  • -
  • Changed video change accept key to spacebar. [Nach]
  • -
  • Added info on load if ROM is patched. [Nach]
  • -
  • Fixed 100% CPU usage when no game is running. [pagefault]
  • -
  • ZSNESW can now be compiled in MinGW without any fancy NASM patches. [TRAC, Nach]
  • -
  • Fixed bugs with SRAM Check+Save option. [grinvader, Nach, Jonas Quinn]
  • -
  • Initialized many vars which were not. [Nach]
  • -
  • Added comments so people have more of a clue. [pagefault, grinvader, Nach, ipher]
  • -
  • Fixed warnings. [Nach, theoddone33, grinvader, Jonas Quinn]
  • -
  • Configure script fix for Gentoo users, and debug builds now use -O0, because we can. [grinvader]
  • -
  • Partial scons support [theoddone33, Aerdan, Snarius]
  • -
  • Added CPU parameter for specific CPU optimizations when compiling for an MS platform. [Nach]
  • -
  • Added debug build support for MS ports. [Nach]
  • -
  • Can now compile without JMA support. [Nach]
  • -
  • Greatly updated, overhauled, and unified documentation. [AspiringSquire, Deathlike, Jipcy, Nach, Noxious Ninja, Richard C., xamenus, and others]
  • -
-
-
- -
-

DOS Port:

- -
    -
  • Fixed sample rate to not be able to select 32000 Hz or bigger rates when they are not available under certain circumstances. [Jonas Quinn]
  • -
  • 8 bit modes now save images as BMP. [Nach]
  • -
  • Can now compile without a debugger. [Nach, Jonas Quinn]
  • -
  • Can choose old or new debugger. [SamB]
  • -
  • Fixed ROM loading from the command line for DOS when a VESA2 mode is selected. [Jonas Quinn]
  • -
  • Now runs proper clean up code on exiting. [Nach]
  • -
  • Updates to input code, now supports more parallel pads. [Deathlike]
  • -
  • Can now set via command line player 1 and 2 to any input.
  • -
  • Rewind can now be used. [Nach]
  • -
  • Quick load menu now shows full internal names, or if LFN, as much as the other ports show. [Nach]
  • -
-
- -
-

Win Port:

- -
    -
  • Fixed a really strange crash problem on Windows 2003 systems. [pagefault]
  • -
  • You can now use gamepad in the background without ZSNES having focus. [pagefault]
  • -
  • Fixed bugs so ZSNES can be run in VMWare. [pagefault]
  • -
  • Can pause emulation in the background. [pagefault]
  • -
  • Fixed black screen after the computer was locked. [Jonas Quinn]
  • -
  • Fixed inline assembler in winlink.cpp when compiled with optimizations. [Jonas Quinn]
  • -
  • Added custom video modes. [Deathlike2, Nach]
  • -
  • Debugger now works in this port. [SamB, pagefault]
  • -
  • Added KitchenSyncPal and fixed a lot for KitchenSync issues [Deathlike, Poobah]
  • -
  • Added ForceRefreshRate as a replacement for Force60Hz. I'm sure someone will fail reading the cfg file for help. [Deathlike]
  • -
  • Added Keep 4:3 ratio as requested a while back by gltamarin. This is useful for laptops/LCDs that use non 4:3 resolutions. [Deathlike]
  • -
  • Can now set joystick sensitivity. [Deathlike]
  • -
  • Can now view ROMs by SNES internal name. [Nach, Deathlike]
  • -
  • Changed default option the Windows port uses due to sanity reasons. Also, a check was added to prevent the black screen (and maybe double vision) issue. A message box will now pop up to tell you what options you have. [Deathlike]
  • -
  • Disable Screensaver Option now disables all annoying power management stuff. [Deathlike]
  • -
  • Changed "High Priority Mode" to "Use A Higher Priority" and Above Normal Priority is used on NT. [Deathlike]
  • -
  • Nach input boxes (video, path) now allow pasting via ctrl+v. [Nach]
  • -
  • Added NTSC filter. [Blargg, pagefault, ipher]
  • -
  • Fixed strange sprite priority bugs after switch to window/fullscreen. [Jonas Quinn]
  • -
-
- -
-

SDL Port:

- -
    -
  • Fixed bilinear filter in GUI [grinvader]
  • -
  • Fixed video change freeze problems in port. [Nach]
  • -
  • Make sound processing use less CPU cycles. [Nach]
  • -
  • Fixed input responsiveness for controllers 3+. [bssteph]
  • -
  • Added freedesktop.org file [pagefault]
  • -
  • Fixed screen refresh for SDL software modes when toggling hq2x. [grinvader]
  • -
  • Fixed a key repeating bug when changing resolutions. [grinvader]
  • -
  • Fixed bug where mouse buttons were conflicting, right mouse click by itself on 3+ button mouse. [Nach]
  • -
  • Updated wheel handling. [Nach]
  • -
  • Added a Variable OGL mode to center ZSNES output with proper ratio. [NBondoux]
  • -
  • Added custom video modes. [Deathlike2, Nach]
  • -
  • New scancode handling system, should fix problems with non US keyboard and Mac OS X. Thanks hector.
  • -
  • Debugger now works in this port. [SamB]
  • -
  • Can now set joystick sensitivity. [Nach]
  • -
  • Added Keep 4:3 ratio as requested a while back by gltamarin. This is useful for laptops/LCDs that use non 4:3 resolutions. [Deathlike]
  • -
  • Can now view ROMs by SNES internal name. [Nach, Deathlike]
  • -
  • Hopefully fixed numlock keypad quick select in the F3 menu. [Deathlike]
  • -
  • Fixed bug when trackballs are present; also cleaned up joystick code a bit. [spoon0042]
  • -
  • Make stack non executable for ELF. Thanks drizztbsd. [Nach]
  • -
  • Mac OS X support. [Nach, hector, BRPXQZME]
  • -
  • Removed dangerous checking of environment variable for user's home path. [Nach]
  • -
  • Fix compilation on OpenBSD. [pagefault, Nach]
  • -
  • Added NTSC filter. [Blargg, pagefault, ipher]
  • -
-
-
- -
-

v1.42 - January 19, 2005

- -
-

All Ports:

- -
    -
  • Corrected output of BRR decode for invalid range values (>12). [TRAC]
  • -
  • Fixed sustain level 4 (5/8). [TRAC]
  • -
  • More window boxes now have borders. [ipher]
  • -
  • Close zip files properly when IPS is not found in zip (fixes crashing with certain zlibs). [Nach]
  • -
  • Cleaned up some code. [Nach, ipher, grinvader]
  • -
  • Ported chip detection to C, improved BS detection. [Nach]
  • -
  • Ported rewind to C (thanks Nach, TRAC). [grinvader]
  • -
  • New reminder text. [grinvader, AspiringSquire]
  • -
  • Rollback of "Improved accuracy of base rates used for ADSR, GAIN, noise, and echo emulation". [ipher]
  • -
-
- -
-

DOS Port:

- -
    -
  • Fixed label for Fullscreen/Widescreen options. [ipher]
  • -
-
- -
-

SDL Port:

- -
    -
  • DESTDIR support. [theoddone33]
  • -
-
-
- -
-

v1.41 - January 18, 2005

- -
-

All Ports:

-
    -
  • Improved accuracy of base rates used for ADSR, GAIN, noise, and echo emulation. [TRAC]
  • -
  • Fixed GUI escape stack corruption if .srm file could not be written to. [Nach]
  • -
  • Stereo settings now obey config file. [Nach]
  • -
  • Fixed framerate loading from config file. [ipher]
  • -
  • ZSNES no longer hacks itself in order to access variables; this eliminates a few issues we had. [Nach]
  • -
  • Source code cleanup. [Nach, ipher]
  • -
  • Makefile overhaul; ZSNES can now be cross compiled. [Nach, ipher, malcster, SamB]
  • -
  • Fixed some invalid memory reads. [Nach]
  • -
  • Ported config file creation/loading to C. [MKendora, Nach]
  • -
  • Percent of execution now takes h-blank values into consideration. [pagefault]
  • -
  • Fixed Winter Gold FX crash. [Nach]
  • -
  • Filtered GUI is now enabled by default. [Nach]
  • -
  • Save location can now be edited in the GUI. [Nach]
  • -
  • Added option to enable/disable auto IPS patching. [Nach, ipher]
  • -
  • Saving last ROM info to rominfo.txt can now be turned off. [ipher, Nach]
  • -
  • Organized options menu, and split off save related options into its own menu. [ipher]
  • -
  • Moved Super System DIP switches to the chip configuration menu. [ipher]
  • -
  • More boxes have borders now! [ipher]
  • -
  • New one-time user reminder text. [grinvader]
  • -
  • Updated about box. [Nach, ipher]
  • -
  • Overhauled toaster support. [Nach]
  • -
-
- -
-

DOS Port:

- -
    -
  • Fixed a number of keyboard shortcuts in the GUI. [ipher]
  • -
-
- -
-

Win Port:

- -
    -
  • Get_Date() now returns the proper value (it always returned the proper value in DOS). [Nach]
  • -
  • Correct timing when compiled with MinGW (Special thanks to Jonas Quinn for all his help in getting ZSNESw compiled with MinGW and working). [Nach]
  • -
  • More informative error messages when some DirectX component fails to load. [Nach]
  • -
  • Return 0 instead of random value on exit (keeps certain frontends happy). [Nach]
  • -
  • Fixed keyboard shortcut for "Trap Mouse Cursor". [ipher]
  • -
  • Changed text in netplay window to be more clear about TCP/UDP. [pagefault]
  • -
  • Updated ZSNESw compilation instructions in install.txt. [Nach]
  • -
-
- -
-

SDL Port:

- -
    -
  • Get_Date() now returns the proper value (it always returned the proper value in DOS). [Nach]
  • -
  • Fixed a memory leak. [Nach]
  • -
  • Fixed buffer underflow in sound code when rate was changed several times. [Nach]
  • -
  • Save files can now be correctly saved in locations other than ~/.zsnes. [Nach]
  • -
  • Updated video selection menu. (Thanks, Aerdan!) [ipher, Nach]
  • -
  • 256x224 R Full for is now actually 256x224, not 320x240. (Thanks, Pieter Hulshoff!) [ipher]
  • -
  • 640x480 ODS Win is now actually 640x480, not 512x448. [ipher]
  • -
  • Added 1280x1024. [ipher]
  • -
  • Changed text in netplay window to be more clear about TCP/UDP. [pagefault]
  • -
  • Homepage button to open browser now appears in about box. [Nach]
  • -
-
-
- -
-

v1.40 - December 25, 2004

- -
-

All Ports:

- -
    -
  • Added multiple timing tweaks, fixed various emulation bugs, and many other technical updates, including (but not limited to): SPC core updates (with improved sound decoding), safer memory allocation in certain areas, HIRQ and VIRQ fixes, color add/sub and color bleeding fixes, HDMA improvements, sprite priority and flickering fixes, and a slew of SRAM fixes. Many more games work :D. [pagefault, _Demo_, Nach, TRAC, Overload, theoddone33]
  • -
  • Overhauled a lot of code, such as checksum calculation and mirroring code. Overhauled and added much better EHi/Hi/Lo ROM code, improved reset vector, and changed much hard coding to variables. Fixed more SRAM bugs than we can count. Made optimizations to complex loading functions, syntax, memory init (Thanks kode54), execution, and initialization code. Also greatly improved PAL/NTSC detection. Also now has much better chip detection and gives more informative chip names. More games which never loaded before now load properly, such as Dai Kaiju Monogatari 2; it now loads and plays great without the Dejap patch. [Nach]
  • -
  • Cleaned up, overhauled, removed, and ported a lot of code (asm to C). [pagefault, MKendora, Nach]
  • -
  • Overhauled IO latch behavior, added proper latching behavior and other latch fixes (such as proper latching of bit 7 on $4201), and added proper behavior of RDIO regs. [pagefault]
  • -
  • Removed many, many hacks. [Nach, pagefault]
  • -
  • There have been some modifications and reorganizations of the GUI, including new path setup and chip configuration windows and a reorganization of the Game Key window. [pagefault, Nach]
  • -
  • Updates to the video code, with enhancements of triple buffering, better input support in the video dialog, and other general video code updates and bug fixes, such as a fix for the 60hz mode. [pagefault, MaxSt]
  • -
  • New extra options are now available in various locations, like the "GUI burning effect", new commandline options, a new quick key to control players 1/2 with 3/4, and smaller message text. Some obsolete ones have been removed. [pagefault]
  • -
  • Some changes in the Input configuaration: Hitting "Set Keys" is now prevented if controller is set to "None". Also, if no controller is selected, the settings of the individual keys are now locked. [Nach]
  • -
  • Updated default configuration, in general. For example, stereo sound is now enabled by default at 32khz, with gaussian interpolation. [pagefault]
  • -
  • Signed saturation fix for gaussian interpolation (Thanks kode54). [pagefault]
  • -
  • Fixed several Netplay issues. [_Demo_, pagefault, Nach]
  • -
  • Fixed some of our .zmv movie recording problems. [Nach]
  • -
  • Fixed a small bug in SPC saving. [pagefault]
  • -
  • Fixed issues with config file saving. [pagefault, Nach]
  • -
  • Fixed PNG snapshot filenames and PNG height. [StatMat, Nach]
  • -
  • Fixed DIP switch 2 on Super System. [pagefault]
  • -
  • Fixed an auto frameskip issue (Thanks MKendora). [pagefault]
  • -
  • Fixed rewind when using commandline filename. [StatMat]
  • -
  • Fixed some issues when loading ROMs via command line. [Nach]
  • -
  • Removed ROM info that appears when loading via command line. [Nach]
  • -
  • Added a command-line savestate fix. [StatMat]
  • -
  • Fixed an annoying savestate bug. [pagefault]
  • -
  • Super Bases Loaded 2 works better, due to a fix in DSP-1 mapping. [_Demo_]
  • -
  • Horai Gakuen works better, due to a special fix. [_Demo_]
  • -
  • Lufia 2 problems are now fixed. [pagefault]
  • -
  • Emerald Dragon now works - again. [pagefault]
  • -
  • Many updates on the SPC7110, such as normal timing, special ratio removal, and better pack loading code. [_Demo_, pagefault, Nach]
  • -
  • Removed SPC7110 logger and S-DD1 test. [grinvader]
  • -
  • Removed support for interleaved SuperFX ROMs. [Nach]
  • -
  • Added several improvements and memory map adjustments for more accurate BS emulation. [Nach, pagefault]
  • -
  • Added call init code for DSP-2,3, and 4. [pagefault]
  • -
  • Added better support for split ROMs with headers and detecting interleaved ROMs. [Nach]
  • -
  • Added support for many more ROM extensions. [Nach]
  • -
  • ROM info now dumped to rominfo.txt on game load. [Nach]
  • -
  • Added more information lines on ROM load, such as CRC32, video, and bank information. [pagefault, Nach]
  • -
  • Added support for some NSRT features, such as NSRT header support and support for ROMs using NSRT's JMA compression format. [Nach]
  • -
  • Zipped ROMs no longer need a temporary directory. [Nach]
  • -
  • Added better handling of bad files. [_Demo_, Nach]
  • -
  • Implemented soft IPS patching functionality, with in-zip file support, buffering, and RLE support. [Nach]
  • -
  • Added a compatibility update to PPU. Passes one more electronics test (Thanks MKendora!). [pagefault]
  • -
  • Fixed variable types in many locations; ZSNES can now play games without hacking the binary to make code segments writable. [Nach]
  • -
  • Made ZSNES more HTPC friendly. [pagefault]
  • -
  • Fixed many compiler warnings, added compiler optimizations, and more compiler fixes and code cleanups. [Nach, MKendora, theoddone33, pagefault, ipher, SamB]
  • -
  • Unicode support partially supported. Will complete later. [pagefault]
  • -
  • ZSNES now displays the day it was compiled in the about box. [Nach]
  • -
  • Updated authors.txt, support.txt, thanks.txt, and todo.txt. [pagefault]
  • -
-
- -
-

DOS Port:

- -
    -
  • Fixed cubic spline interpolation. It should actually save the option now! [pagefault]
  • -
  • Fixed other various DOS sound bugs. [Nach, pagefault]
  • -
  • Fixed a frameskipping bug. [pagefault]
  • -
-
- -
-

Win Port:

- -
    -
  • Updated icon with Windows XP compliancy. [cdbsi]
  • -
  • Added new disable screensaver code. [pagefault]
  • -
  • Added a CPU utilization fix. [kode54, pagefault]
  • -
  • Added 48khz sound support, updated sound code, and fixed sound bugs. [pagefault, Nach, ipher, StatMat]
  • -
  • Fixed a couple of input bugs, such as one concerning the 5th joystick and another that made the mouse get stuck in an endless loop. [pagefault]
  • -
  • Removed alternate timer. [pagefault]
  • -
  • Fixed Netplay freezing bug. [pagefault]
  • -
  • Many new video features, including (but not limited to): HQ2X, HQ3X, and HQ4X graphic filters, support for hi-res and D modes in 32bpp windowed mode (now default), new aspect ratio code for scaling, and the KitchenSync (usable only via the commandline). [MaxSt, pagefault, Darkfalz]
  • -
  • Fixes for video code errors, such as those that occured when alt-tabbing in fullscreen, MMX interpolation fixes, and blitter fixes. [pagefault, zsKnight]
  • -
  • Snapshots are now numbered and use the full ROM file name. [Nach]
  • -
  • Renamed Windows version to Win32. [pagefault]
  • -
  • Win32 port can now also be compiled with MinGW (but we won't support it till the next release). [Nach, Jonas Quinn]
  • -
-
- -
-

SDL Port:

- -
    -
  • Updated icon. [cdbsi]
  • -
  • Updated Linux video code to Windows version. [pagefault]
  • -
  • Fixed problems with nVidia cards. [Diablo-D3]
  • -
  • Fixed audio problems with broken drivers. [Diablo-D3]
  • -
  • Added 48khz sound support. [pagefault]
  • -
  • Updated joystick input support. [theoddone33, Sander]
  • -
  • Fixed savestate incrementor; this caused some crashes. [pagefault]
  • -
  • Cleaned up the Linux Autoconfigure [Diablo-D3]
  • -
  • Added a couple of things for the start of BeOS compatibility. [theoddone33]
  • -
  • Fixed 16->32bpp LUT related bug. [kode54]
  • -
  • Added hardcoded alt-enter fullscreen toggle. [theoddone33]
  • -
  • Added dialog for why the video mode couldn't be set. [theoddone33]
  • -
  • Added circle buffer patch (savestate fix). [zinx]
  • -
  • Fixed problem with man page when installing (when man1 directory doesn't exist). [hpsolo]
  • -
  • Fixed cmd line sound quality. [pagefault]
  • -
  • Fixed zlib and libpng issues. [theoddone33, pagefault]
  • -
  • Updated libpng version checking [theoddone33]
  • -
  • Added -lm to acinclude.m4 so AC_TRY_RUN doesn't return negative on some systems looking for libpng. [theoddone33]
  • -
  • Overhauled makefile. [theoddone33]
  • -
  • Fixed install target; -D should not be used. [theoddone33]
  • -
  • Added the name of the start address to the error message that occurs when mprotect fails. [theoddone33]
  • -
  • Update config.sub. This allows configuration on 64-bit targets, and requires autogen.sh to be rerun. [theoddone33]
  • -
  • Added HQ2X filter! [MaxSt, pagefault, zinx]
  • -
  • Snapshots are now numbered and use the full ROM file name. [Nach]
  • -
  • Renamed Linux version to SDL. [pagefault]
  • -
-
- -
-

We have also greatly improved support for special hardware in ZSNES v1.40. These require special mention:

- -
    -
  • SuperFX core updates: -
      -
    • pagefault
    • -
    -
  • -
  • SA-1 core updates: -
      -
    • pagefault
    • -
    -
  • -
  • C4 core updates: -
      -
    • Research: anomie
    • -
    • Main Code: Nach
    • -
    • Special thanks to The Dumper and TRAC!
    • -
    -
  • -
  • DSP-1 core updates: -
      -
    • Data Retrieval: pagefault, Overload, The Dumper
    • -
    • Main Code: pagefault, Overload, The Dumper, neviksti, Andreas Naive, _Demo_
    • -
    • Integration: MKendora, Nach
    • -
    • Processing Code: pagefault, Nach
    • -
    -
  • -
  • DSP-2 emulation: -
      -
    • Data Retrieval: Overload
    • -
    • Research: Overload, neviksti, MKendora, The Dumper, CaitSith2
    • -
    • Main Code: kentaro-k.21
    • -
    • Processing Code: pagefault, kentaro-k.21
    • -
    • Special thanks to Lord Nightmare!
    • -
    -
  • -
  • S-DD1 emulation: -
      -
    • Data Retrieval: The Dumper, Dark Force, zsKnight, Gary Henderson
    • -
    • Research: Andreas Naive
    • -
    • Main Code: anomie
    • -
    • Processing Code: _Demo_, Nach
    • -
    • Special thanks to all the other developers and users who worked on this hard project!
    • -
    -
  • -
  • ST010 emulation: -
      -
    • Data Retrieval: The Dumper, MKendora
    • -
    • Main Code: The Dumper, Overload, Feather, Nach
    • -
    • Processing Code: The Dumper
    • -
    • Code Fixes: pagefault
    • -
    -
  • -
  • Sufami Turbo support (preliminary): -
      -
    • Nach
    • -
    -
  • -
  • SD Gundam G-Next and Same Game expansion pack support: -
      -
    • Nach
    • -
    -
  • -
-
-
- -
-

v1.36 - July 15, 2002

- -
    -
  • Fixed Gunforce, added invalid HDMA modes. [_Demo_] (Thanks Overload!)
  • -
  • New BRR decoding method, this should resolve all the sound issues introduced in 1.35 and fix new ones. (Noise simulation isn't used anymore) [_Demo_]
  • -
  • Fixed another bug with command-line netplay. (Windows only) [pagefault]
  • -
  • Fixed hang in NBA Live 95 and 96. [_Demo_] (Thanks Overload!)
  • -
  • Fixed sound not working on first run. (Windows only) [pagefault]
  • -
  • Fixed some more mode 4 issues in the new gfx engine. [pagefault]
  • -
  • Added offset mode disable toggle to 8-bit new gfx engine. [pagefault]
  • -
  • Fixed SPC hang in 90 Minutes European Prime Goal by clearing spcram. [_Demo_]
  • -
  • Updated fix for Clayfighter to fix some bugs in battle. [_Demo_]
  • -
  • Fixed crash with certain games. (SDL/*nix only) [theoddone33]
  • -
  • Added better OBC1 detection. [_Demo_]
  • -
  • Special hack for Samurai Showdown IRQ problem. [_Demo_]
  • -
  • Special hack for Kamen Rider menu, requires special latch reading. [_Demo_]
  • -
  • Special hack for Super Famista 1 & 2 SPC bugs. [_Demo_]
  • -
  • Fixed some more bugs in video code. (Thanks Perryman for the video table) (Windows only) [pagefault]
  • -
  • Fixed Digital Devil Story hang by modifying the spc code. You must start a new game for the fix to work. [_Demo_]
  • -
  • Modified work ram init value to 0x55. (Thanks TRAC)
  • -
-
- -
-

v1.35 - June 23, 2002

- -
    -
  • Fixed triple buffering corruption on some VESA 2.x video modes, a very nasty bug which accidentally slipped into version 1.337. [stainless] (DOS only)
  • -
  • Added full scanlines to 320x256x8b Mode-X. Uses the same timings as the 256x256x8b full scanlines, so it may or may not work correctly depending on your video card. [stainless] (DOS only)
  • -
  • Linked the EAGLE engine to the filtered GUI option and fixed guassian interpolation which has been broken since version 1.71b. [stainless, kode54] (DOS only/all ports)
  • -
  • Cleaned up the 320x480x8b and 320x240x16b blitters and added MMX support to 320x480x8b for a nice speed increase. [stainless] (DOS only)
  • -
  • Added 640x400 alternatives to 512x384 video modes for video cards which don't have them. Added a small screen option to the 512x384 and 640x400 video modes with MMX support. Also added a "wide screen" option to 640x400 video modes. [stainless] (DOS only)
  • -
  • Added a full screen option to the 320x480 video modes, along with a basic interpolation to 320x240x16b and 320x480x16b. Full screen in 320x480x16b has full/25%/50% scanlines and interpolation has full scanlines. [stainless] (DOS only)
  • -
  • Added experimental 800x600 video modes. Fixed 'n' command-line option to allow toggling of 25%/50% in addition to full, also cleaned up the command-line options message and the config file. Noticed some video modes were way off-centered, fixed that too, should now be perfect. [stainless] (DOS only)
  • -
  • Fixed printing of MMX enabled message on the GUI background if you checked MMX SUPPORT under CONFIG -> OPTIONS. Also, if you check MMX SUPPORT by using the keyboard shortcut it will now attempt to actually detect MMX before enabling it. :) [stainless, pagefault] (DOS only)
  • -
  • Command line support in windows port [StatMat]
  • -
  • Fixed problem when some video modes were not being saved. (Windows only) [pagefault]
  • -
  • Lots of updates to Linux/SDL version, including sound fixes, video code updates and other misc bugs. [theoddone33, Thorsten Glaser, Wilbern Cobb]
  • -
  • Fixed gamma in PNG snapshots. [pagefault]
  • -
  • Added several new goodies to the GUI, which include a force 8-bit sound option (fixes a few cards under WinMe), a second water effect, and an experimental smoke effect. [stainless] (DOS only/all ports)
  • -
  • Fixed problem with sound getting disabled when running command-line network games. (Windows only) [pagefault]
  • -
  • Updated video code in Windows port to properly display 239 line modes. (Windows only) [pagefault]
  • -
  • Commented, unified, and cleaned up the Mode-Q and Mode-X blitters. I did a major overhaul to the DOS video code, I cleaned up and reorganized it alot, and there seem to be no problems as of yet. [stainless, TRAC] (DOS only)
  • -
  • Fixed a bug in sprite priority rotation. (fix damage in FFMQ) [TRAC]
  • -
  • Fixed long delay between battles and fixed flickering colours on map in Front Mission. [pagefault]
  • -
  • Fixed hang when picking up apples in Equinox. [pagefault]
  • -
  • Fixed keyon bug in DSP code, fixes sounds in Flaskback 3 Language Edition (Thanks neviski) [_Demo_]
  • -
  • Fixed "disco colours" in NBA Hangtime when the ball drops. [pagefault]
  • -
  • Fixed an NMI issue with register $4212, fixes hang in Cu-On-Pa, Bubsy and others. [pagefault]
  • -
  • Fixed a mode 4 bug in the new graphics engine that was causing the title screen in The Lost Vikings to be scrambled. [pagefault]
  • -
  • Added support for Super System arcade system, set DIP switches in add-on's menu in GUI. Games MUST be zipped in order to load. [pagefault]
  • -
  • Added special support for Earthworm Jim 2 sound effects. [_Demo_]
  • -
  • Added hack for Deaetonosama Apareitiban. [_Demo_]
  • -
  • Fixed super scope position reading. [_Demo_]
  • -
  • Modified a few timing things. [_Demo_]
  • -
  • Fixed some 65816 instructions in processor emulation mode. [_Demo_]
  • -
  • Added special timing for Grand Prix 3. [_Demo_]
  • -
  • Modified sound decoding another time (helps various noise sounds like DQ6). [_Demo_]
  • -
  • Modified joypad reading for VS Collection. [_Demo_]
  • -
  • Special modification for Bahamut Lagoon and Clay Fighter to delay write to the hdma register. (those games need dma delay implemented) [_Demo_]
  • -
  • Lots of other minor fixes and things we forgot to mention.
  • -
-
- -
-

v1.337 - September 30, 2001

- -

This release is dedicated to zsKnight and his family

- -
-

All ports

- -
    -
  • Added a customizable key to toggle display of the game clock [pagefault]
  • -
  • Added support for up to 100 SPC file saves per game [pagefault]
  • -
  • Added customisable keys to increment and decrement the save state slot [pagefault]
  • -
  • Added a customisable key to quickly save an SPC file [pagefault]
  • -
  • Added force NTSC/PAL and force HiROM/LoROM options to GUI [pagefault]
  • -
  • Added a customisable key to toggle the display of the FPS counter [pagefault]
  • -
  • Added keyboard shortcuts to video options menu [pagefault]
  • -
  • Added feature to automatically increment save state slot after each save [pagefault]
  • -
  • Added new 8-point sound interpolation and two new lowpass filters (requires a fast processor, 8pt interpolation and high quality lowpass requires an MMX processor) [kode54]
  • -
  • Fixed an annoying bug when the menu selection bar would be floating in thin air (Thanks to EMu LoRd for pointing this out) [pagefault]
  • -
  • Fixed MMX toggle option, now saved when you restart ZSNES [pagefault]
  • -
  • Fixed freeze/crash when saving SPC files [pagefault]
  • -
  • Fixed filtered GUI option with 2xSaI enabled not refreshing the screen [pagefault]
  • -
  • Fixed graphics when reseting a game with 2xSaI engine on and the FPS counter and/or game clock on [pagefault]
  • -
  • Fixed Vortex, Clayfighter 2, Mr. Nutz, Tenchi Wo Kurau Sangokushi Gunyuden and others now working again [_Demo_]
  • -
  • Fixed Umi Hara Kawa Se and Tin Tin in Tibet [_Demo_]
  • -
  • Fixed LoROM/HiROM detection code, Star Trek: Deep Space Nine and possibly others now working [pagefault]
  • -
  • Fixed Front Mission: Gun Hazard and Pocky and Rocky, now working again [_Demo_]
  • -
  • Fixed Neugier and Battle Grand Prix freezing after a certain point in the game. [_Demo_]
  • -
  • Fixed bug in rom header information and checksum status display, fixes Tales of Phantasia and others [pagefault]
  • -
  • Fixed Marko's Magical Football copy protection [pagefault]
  • -
  • Fixed problem with Filtered GUI enabled and parts of game screen would show up in GUI menus [pagefault]
  • -
  • Fixed frameskip command-line offset [pagefault]
  • -
  • Fixed Sim Earth, now loads but map is still not visible [_Demo_]
  • -
  • Fixed crash in Home Alone when starting a new game [_Demo_]
  • -
  • Fixed sprites in Super James Pond 2 and Kirby Avalanche (Thanks Snes9X for the info) [_Demo_]
  • -
  • Fixed 256x239 SNES resolution offset in Windows and Linux ports, games that use this resolution should now be displayed properly in these ports [_Demo_]
  • -
  • Fixed freeze in Accelebrid after a few seconds of gameplay [_Demo_]
  • -
  • Fixed cursor getting messed up in Windows and Linux ports when using a 16-bit desktop [_Demo_]
  • -
  • Fixed bugs when switching between fullscreen and windowed modes with fullscreen button in Windows and Linux port [pagefault]
  • -
  • Fixed Triple Buffering and vsync options so they can't be enabled at the time (Triple buffering includes vsync automatically) [pagefault]
  • -
  • Fixed sprite layer disappearing when changing screenshot formats or moving the F1 menu [pagefault]
  • -
  • Fixed a clipping offset bug in the new gfx engine [pagefault]
  • Fixed BG3 issue with sub-screens in new graphics engine, fixes gfx in Bahamut Lagoon's intro and lots of other games [pagefault]
  • -
  • Fixed timing problem in Clock Tower that caused it to freeze randomly in-game, implemented a hack for now [pagefault]
  • -
  • Fixed Cu-On-Pa freezing when starting a new game (Thanks to Lordtech for the help) [_Demo_]
  • -
  • Optimised global code base, most people should see a performance increase [pagefault, stainless]
  • -
  • Moved vsync option from game options menu to video options [pagefault]
  • -
  • Improved S-DD1 decompressed pack loading and execution, increases performance in S-DD1 decompressed pack games [pagefault]
  • -
  • Lots of debugger fixes and additions [byuu, bongo]
  • -
  • Removed disable screensaver text from DOS and Linux ports [pagefault]
  • -
  • Updated water effect code to using lighting effects [stainless, kode54]
  • -
  • Improved SPC700 sample processing, fixes sounds in numerous games [_Demo_]
  • -
  • Disabled H-DMA for Bahamut Lagoon and Mortal Kombat, fixes some gfx problems [pagefault]
  • -
  • Changed default keyboard layout for player 2 as some keys were overlapping player 1 (Oops!), If you were having problems buying things in FF4 or in other games make sure to change your keys for player 2. [pagefault]
  • -
  • Cleaned up config file in Windows and Linux ports, removed DOS related comments [pagefault]
  • -
  • MMX option now checks for a MMX processor when enabling it in the GUI, also no longer crashes on processors without a cpuid when detecting MMX [pagefault, kode54]
  • -
  • Last netplay IP address used is now saved in Windows and Linux ports [pagefault]
  • -
  • Reorganized sound menu; removed sound interpolation checkbox and made a new list of different types of interpolation: gaussian (original interpolation with enable interpolation option), cubic spline and 8-point interpolation. Also made a new list of lowpass filters. [pagefault]
  • -
  • Removed FPU copy from -? option on command line message, since it is no longer supported. Also cleaned up that message in general [stainless]
  • -
  • FPS at program start option no longer enables FPS display when auto framerate is not enabled [pagefault]
  • -
  • Updated video interpolation code, now looks better than before [kode54]
  • -
  • Lots of misc GUI fixes and cosmetic tweaks [pagefault]
  • -
  • (UPDATE) Added surround sound to Windows and Linux ports, updated filter in DOS port (This was left out of the previous whatsnew file) [kode54]
  • -
-
- -
-

DOS v1.337

- -
    -
  • Added grayscale mode toggle to GUI [pagefault]
  • -
  • Added support for 5 SNES gamepads on LPT1 [ZDrumm]
  • -
  • Added two new 256 color linear VGA video modes, 256x224 and 256x240 [stainless]
  • -
  • Added proper gamma correction, now ranges from 0 (1.0) to 15 (~2.0) in 8bpp modes [stainless]
  • -
  • Fixed Filtered GUI option, now works [pagefault]
  • -
  • Fixed full scanlines disappearing in some modes [pagefault]
  • -
  • Fixed a handful of bugs in the joystick code which may cause the joystick not to work if it has a driver installed under Win9x control panel [stainless]
  • -
  • Fixed date problem in S-RTC games not reporting the proper day of the week [stainless]
  • -
  • Fixed issue with some sound blaster compatible cards not working properly in the DOS port [kode54]
  • -
  • Reordered video modes in alphabetical order [stainless]
  • -
  • Improved SNES pad reading routine, any speed hit now should be minimum when using a snespad adaptor [pagefault]
  • -
  • Improved interpolation performance [stainless]
  • -
  • Default keys for player 1 are now the same as Windows and Linux ports [pagefault]
  • -
  • You can now use / in command line options in addition to the previous - character [stainless]
  • -
-
- -
-

Win v1.06

- -
    -
  • Added option to toggle the trap mouse cursor feature which prevents the mouse cursor from leaving the window by accident [pagefault]
  • -
  • Added 640x480 DS WIN; 1024x768 DR FULL; 1280x960 S/DS WIN, S FULL; 1280x1024 DR/R/DS WIN and FULL resolutions [pagefault]
  • -
  • Added a more meaningful message when changing to a resolution isn't supported [pagefault]
  • -
  • Fixed problem with SRAM not being saved when pressing ALT-F4 in game [pagefault]
  • -
  • Updated icon yet again, looks really nice. [enigMa]
  • -
  • Fixed possible crash when exiting [pagefault]
  • -
  • Fixed bug when scrolling in scrollboxes in the GUI would not trap the mouse cursor inside the scrollbox like the DOS port does [pagefault]
  • -
  • Either alt key can now be used when using the alt-enter combination to switch to fullscreen [pagefault]
  • -
  • Removed triple buffering option from windowed video modes (it does not work in windowed mode) [pagefault]
  • -
  • Optimised some Windows port specific code, should give a small speed boost for most people [pagefault]
  • -
  • Rewrote mouse input code, much more efficient now. [pagefault]
  • -
  • Reordered video modes in alphabetical order; removed 64x52 and 128x112 resolutions (Thanks to Terrorcide and McGuiver for helping me test this out) [pagefault]
  • -
  • Improved performance in 32bpp windowed modes [pagefault]
  • -
  • Rewrote some of the audio code to be much more efficient, also added MMX optimisations [pagefault, kode54]
  • -
  • When switching to windowed mode from fullscreen, the window position is now remembered [pagefault]
  • -
  • Removed large sound buffer and exclusive mode option, they shouldn't be needed anymore [pagefault]
  • -
  • Now uses idle task priority when in GUI and window is not active, should also smooth task swtiching on slower computers [pagefault]
  • -
  • (UPDATE) Fixed server IP bug when using zbattle.net or command-line options to connect [pagefault]
  • -
-
- -
-

Linux v0.37

- -
    -
  • Added autoconf support for easy compiling [Diablo-D3, amit, theoddone33]
  • -
  • Fixed sound buffering in linux port to improve sound on some cards [Diablo-D3]
  • -
  • Implemented S-RTC time functions, FEoEZ and other S-RTC games will now report system time in game [pagefault]
  • -
  • Now supports compiling with gcc 3.0.0 [EvilTypeGuy]
  • -
-
-
- -
-

zsKnight Leaves - July 23, 2001

- -

I'm sorry to say this, but this marks my permanent leave from the ZSNES project, anything related to this, and emulation overall. The reason why is that my dad just passed away today (he died in his sleep, which is strange since he was perfectly healthy yesterday night), so I'm going to have to spend more of my energy devoted to helping my family. My dad is also the main person who provides the finances to the family (since my mom doesn't work), plus I still have about 2 more years to go before I graduate from university, so my immediate future doesn't look that great because with my dad gone, that would mean that I need to put up more responsibility towards taking care of the family instead of studying. But I just hope that everything will go well. Thanks to all you supporters for everything. Sorry for the lack of a proper goodbye though, so I'll probably update once more after I get out of this shock in another day.

-

- zsKnight

-
- -
-

v1.31b - July 3, 2001

- -
-

All ports

- -
    -
  • Fixed Super Punchout, now working [zsKnight, _Demo_]
  • -
  • Fixed SD Gundam GNext again [_Demo_]
  • -
  • Final Fantasy Mystic Quest now works again [zsKnight]
  • -
-
- -
-

Win v1.04

- -
    -
  • Fixed grayscale toggle [pagefault]
  • -
  • Updated icon again for black backgrounds [enigMa]
  • -
-
- -
-

Linux v0.31

- -
    -
  • Now compiles and runs on QNX6 systems [TheAlien]
  • -
-
-
- -
-

v1.31 - June 27, 2001

- -
-

All ports

- -
    -
  • Fixed Mode 4 offset bug (Fixes Bust-A-Move, Puzzle Bobble possibly others) [zsKnight]
  • -
  • Emerald Dragon is now working [_Demo_]
  • -
  • Fixed Last Bible 3 DMA problem (Thanks to SNES9x for the info) [_Demo_]
  • -
  • Fixed Super Robot Was Ex (Thanks again to SNES9x for the help on this) [_Demo_]
  • -
  • Moved disable SPC emulation option to sound menu where it should be [pagefault]
  • -
  • Fixed Wizardry 4 and Honkakuha Igo Gosei, interleaved funny [_Demo_]
  • -
  • SD Gundam GNext no longer crashes ZSNES, and actually is playable now. [_Demo_]
  • -
  • Spindizzy worlds should work again [_Demo_, zsKnight]
  • -
  • Dezaemon sprites working now, had to clear OAM address when first address byte is written to [zsKnight]
  • -
  • Power Rangers the Movie working, was reading from register 2144 [_Demo_]
  • -
  • King of Rally now working [_Demo_]
  • -
  • Emerald Dragon working, added a hack to disable ENVx for that game [_Demo_, zsKnight]
  • -
  • Full Throttle Racing working, fixed a bug with the wai 65816 instruction [_Demo_, zsKnight]
  • -
  • Renamed black and white mode to grayscale mode [pagefault]
  • -
  • Got Traverse Starlight and Prairie to go further, but it still freezes after several scenes [zsKnight]
  • -
  • Mario RPG minecart Mode 2 scene working better now [zsKnight]
  • -
-
- -
-

Win v1.03

- -
    -
  • Added disable screensaver feature to disable screen saver while ZSNES is active [pagefault]
  • -
  • Fixed yet another DirectInput slowdown [pagefault]
  • -
  • Added joystick POV hat support (Thanks to kode54 for testing and fixing my code) [pagefault, kode54]
  • -
  • Added error messages and directions if DirectX 8.0 is not installed [kode54]
  • -
  • Fixed another Windows 2000 freeze on exit bug [pagefault]
  • -
  • Fixed BSOD when loading roms on some systems [pagefault]
  • -
  • Hopefully fixed a crash when multiple roms where in a single zip file (only one rom can be loaded per zip file) [pagefault]
  • -
  • Fixed a possible crash when loading/continuing a game (Thanks to Metus for pointing this out) [pagefault]
  • -
-
- -
-

Linux v0.29

- -
    -
  • No changes
  • -
-
-
- -
-

v1.30b - June 16, 2001

- -
-

All ports

- -
    -
  • Support for Star Ocean S-DD1 decompressed pack is now enabled. [zsKnight]
  • -
  • Fixed bug in H-DMA code, fixes Hook and Bugs Bunny and maybe others (Thanks to Gary of Snes9X for help on this) [_Demo_]
  • -
  • Updated documentation [Matt Kendora]
  • -
  • Fixed new gfx mode checkbox in options menu [pagefault]
  • -
-
- -
-

Win v1.02

- -
    -
  • Added 800x600 DR FULL mode (scroll down to the bottom of the mode list to see it)
  • -
  • Fixed timing problem in games when 58 seconds was 1 minute in ZSNES [kode54, pagefault]
  • -
  • Fixed voices in ToP opening and Star Ocean [pagefault]
  • -
  • Fixed another DirectInput slowdown [pagefault]
  • -
  • Fixed joystick 5, it should be working now [pagefault]
  • -
  • Optimised code some more, giving 3-5 FPS boost on most systems [pagefault]
  • -
-
-
- -
-

v1.30 - June 13, 2001

- -
-

All ports

- -
    -
  • Bubsy 2 working again [zsKnight]
  • -
  • Batman: the return of the joker working now [_Demo_]
  • -
  • Sound Novel T-Cool and Derby Stallion 96 memory mapper added [_Demo_]
  • -
  • Fixed BRR block header bug (fixes Raiden Densetsu, Chrono Trigger, Gundam Wing: Endless Duel, and a few other games) [_Demo_]
  • -
  • Updated documentation [Matt Kendora]
  • -
  • New whatsnew.txt format [pagefault]
  • -
-
- -
-

Win v1.01

- -
    -
  • Updated icon [enigMa]
  • -
  • Added 1280x960 DR, DR FULL modes to Windows port [pagefault]
  • -
  • Fixed random crash when loading roms in Windows port [pagefault]
  • -
  • Rewrote resolution switching code [pagefault]
  • -
  • Window now moves much smoother and faster [pagefault]
  • -
  • Readded large sound buffer option [pagefault]
  • -
  • Fixed CPU usage when window was minimized [pagefault]
  • -
  • Fixed multiple instances when window was minimized [pagefault]
  • -
-
- -
-

Linux v0.29

- -
    -
  • OpenGL support [hpsolo]
  • -
  • Bilinear option (w/ filtered GUI) [hpsolo]
  • -
  • Fixed video mode descriptions (zsnesl.cfg) [hpsolo]
  • -
  • Resizable windows [amit]
  • -
  • Filter options (scanlines, 2xSaI, etc) for OpenGL modes [zinx]
  • -
  • Many more video modes for OpenGL, including full screen [hpsolo]
  • -
  • Joystick POV hat support [hpsolo]
  • -
  • Added support for 5th Joystick [hpsolo]
  • -
-
-
- -
-

v1.29, Win v1.00 - June 1, 2001

- -
    -
  • Implemented triple buffering in full screen mode (Huge thanks to whatabubba for his help on this and cleaning up the code) [whatabubba, pagefault]
  • -
  • Fixed top 8 lines being invisible of FFMQ [zsKnight]
  • -
  • Optimised DirectDraw code some more giving a 10-15% speed increase [pagefault]
  • -
  • Fixed black screen when switching windows [pagefault]
  • -
  • Improved loading and shutdown time [pagefault]
  • -
  • Rock 'N Roll Racing is working again [zsKnight]
  • -
  • Fixed Lennus 2's sprites [zsKnight]
  • -
  • Almost figured out Wizardry 4's rom format. It seems like this game was incorrectly dumped so everything in it is out of order. [zsKnight]
  • -
  • Final Fight 2 is working again [zsKnight]
  • -
  • Vsync option now works in triple buffering mode [pagefault]
  • -
  • Now shows minimize window animation when minimizing [pagefault]
  • -
  • Fixed mouse pointer under full screen mode [kode54]
  • -
  • New ZSNES icon in Windows port (Thanks for all your entries) [enigMa]
  • -
-
- -
-

v1.28b, Win v0.99 - May 28, 2001

- -
    -
  • Added a filtered GUI option to allow graphics engines such as 2xSaI to be used in the GUI [zsKnight]
  • -
  • Fixed SA-1 save states [zsKnight]
  • -
  • Fixed Breath of Fire crashing bug when loading [theoddone33]
  • -
-
- -
-

v1.28, Win v0.99 - Unknown Release Date

- -
    -
  • Added option to allow multiple instances of ZSNES (off by default) [pagefault]
  • -
  • Fixed Lufia 2 sprite disappearing bug [zsKnight]
  • -
  • Fixed quick menu crash problem when the entries other than the first one is selected when the load menu is opened [zsKnight]
  • -
  • Modified SPC700<->65816 timing again to get Hook working [zsKnight]
  • -
  • Added more keyboard shortcuts to GUI [pagefault]
  • -
  • Fixed vram read to get Smash Tennis working again [zsKnight]
  • -
  • Hopefully fixed lockup when exiting Windows port [pagefault]
  • -
  • Added a spc700 timing hack for Super Final Match Tennis until I re-write the timing engine later (but not anytime soon though) [zsKnight]
  • -
  • Kinda got Rendering Ranger 2 to go further, but this game seems to use some picky timing, so this will have to wait until I re-write timing in the future. [zsKnight]
  • -
  • Removed large sound buffer option since it wasn't really useful [pagefault]
  • -
  • Fixed 16bit access to address $001FFF (or equivalent). Fixes Super Tetris 2+Bombliss. [zsKnight]
  • -
  • Implemented 128KB sram support. Dezaemon runs now (but it suffers graphics glitches at the moment) [zsKnight]
  • -
  • Fixed Wordtris (reading from 002100) [zsKnight]
  • -
  • Fixed reset function in William's Arcade Classics [zsKnight]
  • -
  • Tuff-E-Nuff works now (another timing hack *sigh* )
  • -
  • Added exclusive DirectSound mode option [pagefault]
  • -
  • Fixed corrupt graphics in Rock'n Roll racing (reading from invalid memory) [zsKnight]
  • -
  • Added alternate timer for people having problems with zsnes running too fast [bootgod,pagefault,zsKnight]
  • -
  • Fixed corrupt graphics in Captain America (also reading from invalid memory) [zsKnight]
  • -
  • Implemented latest save state selection in Windows port [pagefault]
  • -
  • Added v-sync to Windows port (enable in options to use it, should fix most graphical tearing issues) [pagefault]
  • -
  • Fixed mid-screen OAM updating. Uniracers works in 2 player mode. [zsKnight]
  • -
  • Combined the new header detection method with the old one, producing a much better method [zsKnight]
  • -
  • Added SA-1 read/write to BWRAM bitmap mode in the lower banks [zsKnight]
  • -
  • Fixed "freeze data" text [hpsolo]
  • -
  • Fixed SA-1 write to BWRAM bitmap mode. It seems like this was the main cause of the level-up screen not working in Mario RPG. [zsKnight]
  • -
  • Fixed cpu usage when ZSNES is in the background doing nothing [pagefault]
  • -
  • Re-wrote character conversion 1 for 2bpp, implemented cc1 for 4bpp [zsKnight]
  • -
  • Fixed vertical high resolution mode for tile priority 1 [zsKnight]
  • -
  • Fixed Terranigma overworld glitch in the new graphics engine 16bit engine [zsKnight]
  • -
  • Enabled RTC in Windows port [pagefault]
  • -
  • Moved the Transparent Message option from the Options to the GUI Optns section. [pagefault]
  • -
  • Added Trainered rom support [zsKnight]
  • -
  • Fixed BG4 graphics in certain games (fixes Digital Devil Story) [zsKnight]
  • -
-
- -
-

v1.26, Win v0.97 - May 17, 2001

- -
    -
  • OBC1 support broke in a recent CVS update. Fixed now. [zsKnight]
  • -
  • Added full scanlines to the Win/Linux port [zsKnight]
  • -
  • Added Mouse Wheel switch [zsKnight,pagefault]
  • -
  • Fixed problem with interpolation/2xSaI/scanlines being saved in the windows port [zsKnight]
  • -
  • Improved 512 byte header support. This should improve compatibility with some games [zsKnight]
  • -
  • Added 768x672 and 1024x896 DR, R windowed video modes to Windows port [pagefault]
  • -
  • Windows port now uses the primary DirectSound buffer [pagefault]
  • -
  • Modified 65816<->SPC700 timing. I hope this doesn't break anything [zsKnight]
  • -
  • Fixed a vram read behavior problem (fixed Equinox dungeons) [zsKnight]
  • -
-
- -
-

v1.25, Win v0.93 - May 15, 2001

- -
    -
  • Fixed cheat menu text when game was not loaded [pagefault]
  • -
  • Fixed unlabed checkbox in DOS port [pagefault]
  • -
  • DSP1 - Fixed plane controls in Pilotwings [_Demo_]
  • -
  • dosintrf.asm - Fixed header detection in the dos port [zsKnight]
  • -
  • gui.asm - Video mode checking done at initialization [zsKnight]
  • -
  • Enabled mouse wrap in the Windows and Linux ports [pagefault]
  • -
  • Fixed full screen mode switch when the user starts ZSNESw before selecting any full screen modes [zsKnight]
  • -
  • Made default video mode 512x448 windowed in Windows port [pagefault]
  • -
  • Prevented enter key from affecting gameplay on returning from F1 and F3 menus [zsKnight]
  • -
  • Added minimize button to the Windows port [pagefault]
  • -
  • Added always on top option in GUI options menu [pagefault]
  • -
  • Menu fix for 8bit graphics modes [zsKnight]
  • -
  • ZSNESW now remembers the window position on your desktop (can be disabled in GUI options) [pagefault]
  • -
  • Fixed crashing problem with some IPS's in ZIP's [Teuf, zsKnight]
  • -
  • Ported to DirectX 8.0 which fixed some problems and improved performance (DirectX 8.0 is now required to run ZSNESW) [pagefault]
  • -
  • DSP1 - Fixed map offset problem in Pilotwings [zsKnight]
  • -
  • DSP1 - Fixed rings being mysteriously passed problem in Pilotwings [zsKnight]
  • -
  • Fixed DirectSound crash when a normal priority buffer could not be acquired [pagefault]
  • -
  • Fixed DirectInput compatibility on some computers [pagefault]
  • -
  • Optimized DSP1 code for better performance [teuf]
  • -
  • Added proper full main/sub-screen window clipping in the new gfx 16bit engine (fixed Illusion of Gaia/DKC2 selection screens, etc) [zsKnight]
  • -
  • Added checksum/header name/chip type header display upon game load [zsKnight]
  • -
  • Added PNG snapshot support which is selectable in the F1 menu [Matt Kendora]
  • -
  • Stunt Race FX old graphics engine force fixed [zsKnight]
  • -
  • Fixed MegamanX copy protection schemes [zsKnight, Matthew Kendora]
  • -
  • Fixed TopGear 2 PAL version from detecting a PAL system [zsKnight]
  • -
  • Implemented OBC1 chip (for Metal Combat) [zsKnight]
  • -
  • Fixed Mode 7 bug in Super Ghouls and Ghosts [zsKnight]
  • -
  • Added turbo keys for L & R keys [zsKnight]
  • -
  • OBC1 emulation support. Metal Combat works! [zsKnight]
  • -
  • You can now customizable the colors to the title bar and window colors. [zsKnight]
  • -
  • Optimised global code to provide up to a 50% speed increase on it on most processors [pagefault]
  • -
  • Added black and white mode to Windows and Linux ports [pagefault]
  • -
  • ZSNESW is now packed with the newest version of UPX [pagefault]
  • -
  • Cleaned up the cfg files for windows/linux ports [pagefault]
  • -
  • Fixed command-line crash in the Windows port (Thanks Matt Kendora) [pagefault]
  • -
  • Save/Load state now displays which state is being loaded [hpsolo]
  • -
  • Added double buffering support to Linux port [teuf]
  • -
-
- -
-

v1.20b, Win v0.88 - April 30, 2001

- -
    -
  • Final Fantasy Mystic Quest works again.
  • -
  • Fixed Empire Strikes Back crashing bug in the millenium falcon sequence (hopefully this will fix some other games too)
  • -
  • Removed all self-modifying code in ZSNES. This will make ZSNES crash a lot less on certain systems, especially during mode 7 sequences. Thanks Ivar!
  • -
  • Implemented S-RTC chip, using the system clock as the actual time (The game will make you set the time though, but it will just be replaced with the system time in-game). Thanks to John Weidman and Dark Force for the info on this chip!
  • -
  • Fixed crashing bug in certain mosaic scenes (eg. FF3 Phantom Forest) in the new graphics engine
  • -
  • Fixed a nasty crashing/corruption bug in the new graphics engine (both 8bit and 16bit)
  • -
  • SPC7110 emulation! This is based on the information reverse engineered by the hard working folks at dejap translations, Dark Force and John Weidman.
  • -
  • Altered HiROM/LoROM detection a bit - Fievel goes West works now
  • -
  • Open source preparations [teuf]
  • -
  • In-game clock working for the windows port. [kode54]
  • -
  • Fixed a memory leak problem in the new graphics engine [TRAC]
  • -
  • Added Cubic Spline Interpolation [Anti Resonance]
  • -
  • Fixed a assign/compare size bug in the new graphics engine [TRAC]
  • -
  • Fixed b flag setting in BRK instruction in 6502 emulation mode [zsKnight]
  • -
  • Added SPC7110 logger file output to help in the filesize clipping of the SPC7110 data files [zsKnight]
  • -
  • Fixed a memory leak bug, fixing that nasty Win2K crash bug [Matthew Kendora]
  • -
  • Fixed key combination release [Maxim]
  • -
  • Fixed source code warnings/added necessary includes [Maxim]
  • -
  • Added high priority mode for Windows 2000 users and slower computers (works on Windows 9x as well) [pagefault]
  • -
  • Added large sound buffer option for people having DirectSound problems. [pagefault]
  • -
  • Fixed problem with ZSNESW and Opera causing a BSOD. [pagefault]
  • -
  • Fixed up error reporting for people experiencing problems. [pagefault]
  • -
  • Improved performance on 3dfx cards by compiling with DirectX 8 SDK. [pagefault]
  • -
  • Fixed a sound problem with people with messed up config files. [pagefault]
  • -
  • Fixed FF3 flashing line problem [zsKnight]
  • -
  • Fixed mysterious sprite disappearing bug in the new graphics engine [zsKnight]
  • -
  • Reduced noise in ToP opening theme. It works fine in the DOS port, but the windows port still seems to produce some static, probably because of the way how sound is updated in that port. [zsKnight]
  • -
  • Updated Super 2xSaI and Super Eagle code (should be much faster now on MMX processors) [Kreed, added by pagefault]
  • -
  • Added gzip support [teuf]
  • -
  • Added support for ViBRA16 cards [Peter Santing]
  • -
  • No longer requires zlib.dll file, now statically linked. ZSNESw won't crash anymore if you try to load a .zip file without that dll file. [pagefault]
  • -
  • Now compiled using an optimising compiler [pagefault]
  • -
  • Almost a fully re-written DSP-1 emulation engine! [zsKnight, theoddone33, pagefault, teuf]. Also thanks to CrASH_Man for the 3x3 inverse matrix formula.
  • -
  • Fixed memory leak problem in the windows port during exit [pagefault]
  • -
  • And more ...
  • -
-
- -
-

Source Code Released - April 2, 2001

- -

The ZSNES Sources have finally been released in the CVS repository of the sourceforge page. We also would like to welcome Teuf as a member of the ZSNES team as an assistant coder! He's helped us with quite a lot in the past while, including (but not limited to) setting up the Source Forge page, helping us to write the open source documentation, fixing up the ZSNES sources to not require a custom version of nasm, organizing the sources into directories, modifying the make file, etc. With the sources released, we also hope to release an updated binary soon. Click on the Sourceforge link on the left side of the screen to access the sources. The sources will also be available in a ZIP file for those who don't want to use CVS.

-
- -
-

v1.17b - December 27, 2000

- -
    -
  • A nasty bug has crept into the DOS version in the 8-bit video modes, so a fixed version (v1.17b) is released (it has the same filename as v1.17 so just overwrite it).
  • -
-
- -
-

v1.17, Win v0.85 - December 25, 2000

- -
    -
  • Added slow-down key. You can configure it in Misc -> Game Keys
  • -
  • Invulnerability bug of the 3rd boss in Demon's Crest in the good checksum roms is fixed through rom mirroring. I also noticed that this fix is the same as what the author of SNEeSe told me before about on some MegamanX1 roms, but I never had that rom so I never added this until now. Guess that rom is also fixed too.
  • -
  • Changed memory initialization values - Lost Viking 2 works again
  • -
  • 65816: Fixed WAI instruction timing with HIRQ's. Top Gear 2 - 2 player mode works now
  • -
  • Improved IRQ re-execution timing precision
  • -
  • Starfox 2 beta now runs with sound!
  • -
  • Fixed flickering problem in Starfox 2 beta
  • -
  • Added Mode 2 16x16 tile offset per tile mode
  • -
  • (Win32) Improved the timestamps on UDP headers. This should (hopefully) solve those out of sync (where both sides see different things) problems with certain connections (ie. T1/LAN connections) in netplay.
  • -
  • (Win32) Added a big notice in netplay.txt. For all of you who used netplay and had poor experiences with a ping time of less than 300ms, read it! Also added a more realistic system requirements description for decent netplay in netplay.txt rather than a cpu speed estimate.
  • -
  • Changed reverse stereo method to become invisible to the sound registers in emulation
  • -
-
- -
-

v1.14, Win v0.80 - November 27, 2000

- -
    -
  • Fixed configuration files from removing spaces from directory names
  • -
  • (DOS) Fixed 640x480 vesa2 scanline+interpolation display problem
  • -
  • (Win32) Improved Windows speed in 32-bit windowed mode. Should give around an 18% speed increase in FPS.
  • -
  • (Win32) More netplay improvements. Shouldn't be as jumpy when one side lacks input.
  • -
  • (Win32) Starting netplay will now force the max frameskip to 3 if it is less than it and also force on auto frameskip.
  • -
  • (Win32) MMX optimised netplay with back buffer enabled.
  • -
  • (Win32) Fixed load state in netplay to load properly instead of sometimes stalling for no reason
  • -
  • (DOS) Accidently deleted the code to initialize IPX. Fixed now.
  • -
  • Fixed a configuration loading problem when loading ZSNES from a different directory.
  • -
  • (Win32) Attempted to fix those out of sync problems (although I don't know if it's fixed now since those problems rarely happen to me)
  • -
  • (Win32) Displayed the current filename in the load window for those files with extra long names.
  • -
  • (Win32) Added nickname support to NetPlay. There's a 9 character nickname size limit.
  • -
  • (Win32) Added actions to chat (similar to how mIRC works - use /me <action> )
  • -
  • (Win32) Nicknames can be changed in the windowed chat by typing /nick <new nickname>
  • -
  • Added a small buffer to the in-game chat to allow up to 5 chat strings displayed at once.
  • -
  • Local chat strings now appear in that buffer
  • -
  • Thickened black borders on the 5x5 font
  • -
  • Extended in-game chat length by around 30 characters
  • -
  • Fixed up Interpolation
  • -
-
- -
-

v1.12, Win v0.74 - November 14, 2000

- -
    -
  • (Win32) Hopefully fixed up those green display bugs in scanlines/2xSaI in 1:5:5:5 16bit modes.
  • -
  • (Win32) Improved lost packet recovery time and reduced the number of lost packet stalls in UDP netplay (should produce more fluid netplay)
  • -
  • (Win32) Fixed up crashing bug in Tales of Phantasia with a 512 byte header
  • -
  • Extended filename length of the Quick Menu
  • -
  • (Win32) Hopefully fixed up the mouse wheel support for certain mice
  • -
  • Temp .ZIP directory is now cleared if it exists prior to another .ZIP file being loaded.
  • -
  • (Win32) Improved DirectInput error handling
  • -
-
- -
-

v1.11, Win v0.72 - November 12, 2000

- -
    -
  • (Win32) ZSNESw won't crash anymore if you don't have a soundcard or if DirectSound fails to initialize.
  • -
  • (Win32) Fixed a nasty performance bug with certain types of joystick/drivers installed, causing the FPS to be slower for no reason.
  • -
  • (Win32) Wrote an MMX optimised blitter for 16bit non-D windowed and full screen modes.
  • -
  • (Win32) Added simple wheel mouse support.
  • -
-
- -
-

v1.10, Win v0.70 - November 7, 2000

- -
    -
  • Fixed games that turns on the x239 resolution (eg. Chrono Trigger battles) when scanline mode is enabled
  • -
  • (Win32) Fixed up crashing bugs on extra long filenames with underscores
  • -
  • (Win32) Hopefully fixed the odd colored interpolation in 1:5:5:5 16bit color settings
  • -
  • (Win32) Hopefully won't crash anymore when the temporary directory exists prior to unzipping a .zip file
  • -
  • (Win32) Fixed loading of .zip files with more than 2 '.'s in the filename. Thanks to DCX for helping us troubleshoot this.
  • -
  • (Win32) Fixed up short filename saveram/save states loading when the long filename has spaces in it.
  • -
  • Added TCP/IP Support. It is recommended that for playable netplay, you'd have an average ping time of less than 300ms (type ping <ip address> in dos) and that packet loss is minimal for TCP/IP (not UDP). At the moment, you cannot have more than 2 connections. Thanks for all the testers for testing this, especially DooMStalK, GreenImp, and TeleKawaru! Also added back buffer support. This will sacrifice cpu power for netplay to make it much more playable. WARNING: High cpu speed recommendations (~450mhz+). Please see netplay.txt for details.
  • -
  • Added save states to netplay (just use them like you normally do)
  • -
  • Save Ram is now defaulted to load/save on the server's side Save Ram are not supported in SA-1/SuperFX games due to their size, but you can use save states instead in that case.
  • -
  • Increased chat line length in the out-of-game chatbox by a lot
  • -
  • Partly increased the chat line length in-game
  • -
  • in-game chat text now stays longer on-screen by 2 seconds
  • -
  • Added reset in netplay
  • -
  • Fixed up movie recording feature
  • -
  • (Win32) Mouse shouldn't get stuck on the left side anymore.
  • -
  • (Win32) Video mode 3 (256x224FS) shouldn't crash anymore. Thanks to kode54 for his assistance on the above 2 bugfixes.
  • -
  • (Win32) Fixed the instability bug where the window can sometimes start shaking for no reason and takes away windows resources.
  • -
  • (Win32) Re-wrote keyboard character input routines
  • -
  • Fixed up FF2(4)'s music in lower sampling rates
  • -
  • (Win32) Coded in the UDP protocol as a replacement for TCP/IP. Some network configurations won't work with UDP. However, it is strongly recommended that you use UDP if you can because of the speed increase. In order to disable UDP and use TCP/IP, both sides must de-select UDP.
  • -
  • (Win32) Added a small multiplayer game list (multi.txt)
  • -
  • Added an updated Windows FAQ, courtesy of TuxedoMsk of VGNetwork who updated it.
  • -
  • Added a more user friendly input selection routine (changed Direct Input to Keyb/Joystick and it also auto-sets keyb/Joystick when you set a key)
  • -
  • Hopefully fixed up the sprite priority problems (eg. FF2/4's damage points)
  • -
  • (Win32) Added rewind support for up to 8 levels (in 8 second intervals) (NOTE: Windows Port only! - Sorry DOS Port users). In order to activate this, assign a key to the Rewind Key in the Misc -> GameKeys option.
  • -
  • Note: Netplay plays really nice as long as the net connection is not unstable, both sides have a fast cpu (speed requirements depend on the game), and at least have a 28.8 connection.
  • -
  • *** PLEASE READ ZSNESW.TXT IF YOU ARE STILL HAVING PROBLEMS WITH THE WINDOWS PORT
  • -
-
- -
-

v1.01 - September 9, 2000

- -
    -
  • Fixed a problem with offset per tile mode with MMX2 in the new 16bit engine
  • -
  • Fixed crashing problem in MMX2 (Win port)
  • -
  • Removed clock option (Win port)
  • -
  • Disabling the new graphics 16bit engine is now properly saved in the configuration files
  • -
  • Added the win port version number to the about box (Win port)
  • -
  • Fixed the % of execution problem in IPX/Modem modes (DOS port)
  • -
-
- -
-

v1.000 - September 1, 2000 - First Windows Release

- -
    -
  • Implemented C4 emulation : -
      -
    • C4 Sprite structure -> OAM conversion routines
    • -
    • Sprite Rotate/Scale ability
    • -
    • Sprite disintegrate function
    • -
    • All in-game used math co-processor functions (hopefully)
    • -
    • Both wireframe modes
    • -
    • There are still some problems with C4 emulation, but I'd consider them to be quite minor to just leave them there.
    • -
    • Thanks to StarCreator for recording a bunch of movies off of the real snes for me to compare!
    • -
    -
  • -
  • Tweaked ADSR a bit
  • -
  • Decreased envelope when key on is issued while sound is still playing. This fixed static/popping sound bugs that affected many games.
  • -
  • Added the ability to select the Add-on device (Snes Mouse/Super Scope) from the GUI through the Add-on option in the Config Menu
  • -
  • Added a hack to allow the mouse to control the cursor in Lethal Enforcers (Press '7' 4 times to activate or select it from the Add-on option in the Config Menu). Unfortunately, this method has problems (ie. mouse moves things that it shouldn't) but it should be good enough, especially for those who asked for this. I doubt this works in LE2, however.
  • -
  • Added a manual load entry box so that you can type in the filenames/directories manually or type in part of the filename and the GUI will seek to whichever filename contains or closely contains that part
  • -
  • Pharos coded a water effect, getting help from Scott Scriven's water effect code.
  • -
  • You can enable/disable the Water Effect and Snow Effect from the GUI Options (MISC Menu in the GUI)
  • -
  • Implemented Sprite Windowing to the new gfx 8bit engine. This completes all the features that I have planned for that engine.
  • -
  • Fixed a really nasty stereo bug that caused volume levels/pans to sound completely off on one of the speakers
  • -
  • Added player 5 as a normal player instead of just being available in modem/ipx play
  • -
  • Implemented an option to turn in-game messages/fps display to be transparent
  • -
  • Added a Set Keys feature to the Input Routines in the GUI that allows you to set all of the standard SNES keys all at once instead of clicking on the inputs separately to set them
  • -
  • Ported the new graphics 8bit engine to 16bit: -
      -
    • All the standard snes features from the 8bit engine
    • -
    • Works with all 16bit resolution modes/effects
    • -
    • Ported high resolution Mode 7
    • -
    • Added proper main/sub screen support and windowing support
    • -
    • Added all transparencies modes
    • -
    • Added Direct Color Mode7
    • -
    • 2xSaI and 50/75% scanlines can now co-exist with high resolution modes
    • -
    • This is now the default engine for 16bit. Some games won't work well with this engine such as some SuperFX games (eg. Stunt Race FX in the menus). You can switch back to the old graphics engine by pressing the '8' key.
    • -
    • Implemented a dual cache system in the tile modes. I don't know how much of a speed increase this gives since my system can already run the old graphics engine at full speed and framerate.
    • -
    • Full 15bit transparencies for MMX cpus only.
    • -
    -
  • -
  • High Resolution Mode7 can be toggled on/off in the Video Options. It is disabled by default since this feature requires a fast CPU.
  • -
  • Added 48khz sound sampling rate
  • -
  • Tweaked VBlank timing a bit
  • -
  • Tweaked 65816 CPU cycle execution a bit
  • -
  • Added Kreed's Super 2xSaI engine. It's written in C, so it requires a really fast cpu to run it.
  • -
  • Added picture preview to the save states in the F3 window. Newly created save states will contain a small picture in them. Pictures will not appear in old save states, however.
  • -
-
- -
-

v0.991 - May 24, 2000

- -
    -
  • Disabled 2xSaI/Super Eagle when in the GUI
  • -
  • Fixed up cheat code search (Got broken in v0.990 during port preparation)
  • -
-
- -
-

v0.990 - May 24, 2000

- -
    -
  • Added speed hack for Kirby Super Star (US)
  • -
  • SPC700 (Sound cpu emulation) is now enabled by default whether sound is enabled or not. Emulation will now be slower than normal if you usually run with sound off, but the compatibility is higher. However, you can disable this through the options window in the GUI if speed is of your concern. Also, a few games only run with it disabled so this option may be useful in those cases.
  • -
  • Decreased cheat code description length by 1 since the last letter was causing some corruption to the next cheat code
  • -
  • Added an option to raise the pitch level to the pre-v0.989 pitch levels, mainly for non-Creative brand sound cards.
  • -
  • You can now change the sound settings (Enable Sound, Stereo, Sound Frequency) with immediate effects without re-starting ZSNES. However, there seems to be some problems with stereo switching on SB Live!'s.
  • -
  • Configuration is now saved whenever you exit the GUI instead of just exiting the program
  • -
  • Lots of port preparation done on the source.
  • -
  • Memory/Commandline fix on the C version. A version should not be needed anymore (hopefully)
  • -
  • The GUI is now using the standard in-game video blitter rather than it own.
  • -
  • Fixed up SnapShot key in 8bit mode
  • -
  • Implemented 4-point gaussian interpolation. This is the interpolation used by the actual snes! Many thanks goes to Neill Corlett for his work on finding this info! Of course, this routine takes up an extra cpu load so emulation will slow down a bit if your computer isn't fast enough, but you can always disable interpolation through the sound options.
  • -
  • Fixed up Pitch Modulation method. Thanks again, Neill!
  • -
  • Pitch modulation was modulating from the wrong channel. Fixed.
  • -
  • Tweaked SuperFX timing.
  • -
  • Added a move window feature to the F1 menu
  • -
  • Expanded filename length in the GUI display for long filenames by 3, but had to decrease the directory name by 2.
  • -
  • Added support for % codes in long filenames
  • -
-
- -
-

v0.9891c/a - February 21, 2000

- -
    -
  • Slightly changed SB16 initialization
  • -
  • Forgot to remove DSP1 debug code
  • -
  • Fixed a pitch modulation bug when Voice 0 modulates Voice 1. Thanks to kode54 for this fix!
  • -
-
- -
-

v0.989c/a - February 12, 2000

- -
    -
  • Fixed some SA-1 sudden slowdowns. This does slow down the overall emulation speed in SA-1 games though.
  • -
  • All sounds were being played at the wrong pitch (slightly higher than normal. It's now fixed so Zsnes should sound better now. Thanks to kode54 for helping out here!
  • -
-
- -
-

v0.988c/a - December 6, 1999

- -
    -
  • Added some SA-1 speed hacks (Kirby DX/Parodius 3)
  • -
  • Implemented SDD-1 MMC. But none of the SDD-1 games run properly yet because of the compression chip.
  • -
  • Fixed up some slowdown problems in SA-1 games
  • -
  • Fixed up dirty CPUID fix for Cyrix CPUs so that you don't have to re-run Zsnes twice every time.
  • -
-
- -
-

v0.987c/a - November 26, 1999

- -
    -
  • Forgot to re-enable pitch modulation after disabling it for debugging purposes.
  • -
-
- -
-

v0.986c/a - November 23, 1999

- -
    -
  • Re-added Sound Buffering. I was hoping to re-write it, but later found out that it wasn't worth the trouble.
  • -
  • Fixed some Triple Buffering bugs, but I can't figure out that flicker glitch on NVidia cards
  • -
  • Added Simulated Triple Buffering for cards without VESA 3.0 Hardware triple buffering. This method does some lose frames, but should be faster than v-sync. This only works on VESA 2.0 modes.
  • -
  • Fixed up directory sorting to always put ./.. at the top.
  • -
-
- -
-

v0.985c - November 15, 1999

- -
    -
  • Added some more speedups to the SA-1
  • -
  • SA-1: Fixed a branch problem with the BRL instruction
  • -
  • Implemented Save Ram support into netplay. Thanks to The Minder for help testing this!
  • -
  • Added a hack to get Mario Paint trainered rom with the trainer removed to work with the snes mouse instead of the keyboard/joystick
  • -
  • Prevented Joystick Keys/Buttons to be selected as the diagonal keys in the GUI
  • -
  • Fixed some crashing problems with the Modem Mode
  • -
  • Implemented a key combination editor in the GUI
  • -
  • Sped up V-Sync
  • -
  • Fixed an SA-1 memory map bug! Fixes DBZ:HD.
  • -
  • Added an small speed hack for DBZ:HD
  • -
  • Implemented SA-1 Super MMC
  • -
  • Finally, after many, many hours of hacking. Figured out what caused the odd noise sounds! So far, simulated noise is implemented since the true nature of how this noise is produced is unknown so it will sound somewhat off compared to the original sounds. There is also a slight chance that some sounds will become noise incorrectly and vice versa.
  • -
  • Fixed up Pitch Modulation
  • -
  • Fixed SNES Mouse/Super Scope support when Pl3/4 as Pl1/2 option is enabled
  • -
  • ADSR/GAIN overhaul (Sound DSP) : -
      -
    • Fixed several GAIN bugs
    • -
    • Implemented Increase Bentline/Decrease Exp GAIN modes properly
    • -
    • Rewrote Decay/Sustain modes in ADSR
    • -
    • Fixed a restarting ADSR bug
    • -
    -
  • -
  • Removed Sound Buffering. I don't think it's worth losing the quality of the sound for a small amount of speed boost.
  • -
  • Implemented an option to disable the Noise Simulation for those games that aren't working properly because of it
  • -
  • Implemented Triple Buffering. You can enable this through the Video Options in the GUI. Unfortunately, Triple Buffering won't work with 2xSaI/Super Eagle engine at the moment since they rely on the previous screen for updating nor will it work properly with high resolution games in the old gfx engine. Thanks to GreenImp for patiently helping through testing!
  • -
  • Implemented Full Screen Interpolation. Only works on MMX CPU's at the moment.
  • -
  • Implemented Cheat Code Reflector (See Guinotes.txt for details)
  • -
  • Any proper VESA 2 error messages now doesn't exit the program when in the GUI but instead display the error message in a box and allows the user to continue.
  • -
  • Thanks to Daniel for lending me his copier which helped me hack the SNES Sound Noise/ADSR stuff!
  • -
-
- -
-

v0.963c/a - September 19, 1999

- -
    -
  • NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files in the assembly only version. Use v0.963c for those features. The only time when you should use this version is if v0.963c doesn't work for you.
  • -
  • Fixed DMA position reader to fix the high sample rate problem in SB-Live! cards. Thanks to ShihTzu for helping us with this!
  • -
  • Removed SB16 only message under stereo option in commandline help. Shouldn't really be there since v0.600.
  • -
  • Low Pass Filter is now disabled by default. But you can still enable it through the GUI.
  • -
  • Implemented an option in the GUI to not allow Zsnes to change the current start-up game path in the configuration. You can access this in Config->Options.
  • -
  • Joystick calibration values have been reset since there seems to be some problems with it. You may have to re-calibrate your joystick if it doesn't respond correctly.
  • -
-
- -
-

v0.962c/a - September 18, 1999

- -
    -
  • Exit text now only displays when text mode is 80x25
  • -
  • Used hardware DMA counter to determine which sound block to write to rather than assuming it always starts at the first one for the sound routines. This should hopefully fix all those nasty sound static problems many people seems to have. Many thanks to Crono for the code and for his help!
  • -
  • Removed Re-Init Every 30 Second option. Shouldn't be needed anymore
  • -
  • Added the ability to disable the Low Pass Filter
  • -
  • Implemented Diagonal Keys
  • -
  • Implemented some SA-1 speedups
  • -
- -
-

A Only:

- -
    -
  • NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files in the assembly only version. Use v0.962c for those features. The only time when you should use this version is if v0.962c doesn't work for you.
  • -
  • All changes from v0.960c
  • -
-
-
- -
-

v0.960c - September 17, 1999

- -
    -
  • Modified header reader a bit
  • -
  • DSP/SPC700: Modified EndX register usage to fix some compatibility
  • -
  • DSP/SPC700: Fixed up timing registers
  • -
  • DSP/SPC700: Fixed a sample looping bug causing many sounds to not sound correctly
  • -
  • SPC700: Fixed a small bug in TCALL. Not sure if it fixes anything
  • -
  • Added small optimisations to the MMX video copy routines
  • -
  • Fixed an adsr -> gain switching bug
  • -
  • Extended maximum number of cheat codes from 75 to 255
  • -
  • Altered .spc format again, this time to suit the ID666 format
  • -
  • Worked a bit on SDD-1 emulation. Don't think we can go any further since we can't seem to figure out the compression algorithm used in that chip.
  • -
  • DSP/SPC700: Added low-pass filter by kode54. Thanks kode54 for the code! This enhances bass in some games.
  • -
  • SA-1: Fixed memory map access problems with several stack instructions and d-page instructions
  • -
  • SA-1: Minor fix to the timing
  • -
  • SA-1: Fixed a load state problem which causes Zsnes to crash sometimes
  • -
  • SA-1: Fixed a small problem with the cpu communication register
  • -
  • SA-1: Added a small speed hack for Kirby 3
  • -
  • Added some transparency hacks (Kirby3, FF3)
  • -
  • Added an sram fix hack for Donkey Kong Country 2 trainer version
  • -
  • GUI now displays a message when SAVE CFG is selected
  • -
  • Added on-screen messages to the Background/Sound channel toggle keys
  • -
  • Added the missing video mode descriptions in the .cfg and commandline help
  • -
-
- -
-

v0.953c/a - August 4, 1999

- -
    -
  • Echo should sound better now
  • -
  • Restored the old Sound Blaster routines since the new ones seems to create some static in certain computer configurations
  • -
  • Increased volume intensity of more quiet samples
  • -
- -
-

C Only:

- -
    -
  • Fixed up crashing bug in pure dos when vesa 2 initialization failed
  • -
  • Included cwsdpmi.exe with the zsnes archive.
  • -
-
- -
-

A Only:

- -
    -
  • NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files in the assembly only version
  • -
  • Fixed a small H+V IRQ timing problem
  • -
  • Fixed some vertical off by 1 line bugs
  • -
  • Attempting to save over read-only files shouldn't mess up anymore
  • -
  • Start with newest save option now works with the save directory defined
  • -
  • Fixed up a crashing bug when a read only file is loaded
  • -
  • The volume level didn't modify the echo volume. Now fixed.
  • -
  • Fixed up a display problem in the F1 menu in 256 color mode
  • -
  • Fixed an echo delay bug
  • -
  • Hopefully fixed the random beep encounter bug that occurs in some games with sound enabled
  • -
  • Several sound volume fixes
  • -
  • Fixed Save Snapshot + Increment frame enter key affecting the game bug
  • -
  • Added Increment Frame Only option to the F1 menu
  • -
  • Made some minor changes to the Sound Blaster routines
  • -
  • Fixed some more sync bugs in .ZMV recording
  • -
  • Fixed a speed hack bug that occurred from v0.800 to v0.900. Hopefully the speed is better now.
  • -
  • Slightly improved the sound skipper when sound is disabled
  • -
  • You can now quickly modify the currently selected cheat code's value by typing a 2 digit hex number in the cheat code enter space
  • -
  • Added a hack to Chrono Trigger to prevent the screen from flashing before battles
  • -
  • Fixed a 16-bit mode 7 windowing distortion/crashing bug
  • -
  • Fixed a read memory leak bug in the 16-bit old gfx engine. Interesting that this bug plagued ZSNES all this time, but its effects didn't show until the recent versions.
  • -
-
-
- -
-

v0.952c - August 3, 1999

- -
    -
  • Fixed a small H+V IRQ timing problem
  • -
  • Fixed the bug which caused HiROM games from not loading properly through the commandline
  • -
  • Fixed some vertical off by 1 line bugs
  • -
  • Attempting to save over read-only files shouldn't mess up anymore
  • -
-
- -
-

v0.951c - August 3, 1999

- -
    -
  • Fixed up the directory changing bugs that plagued v0.950
  • -
  • Start with newest save option now works with the save directory defined
  • -
  • Fixed up a crashing bug when a read only file is loaded
  • -
  • The volume level didn't modify the echo volume. Now fixed.
  • -
-
- -
-

v0.950c - August 2, 1999

- -
    -
  • Fixed up a pretty nasty .ZIP support bug where .ZIP files from the root directory weren't loaded up properly
  • -
  • Fixed up a display problem in the F1 menu in 256 color mode
  • -
  • Fixed an echo delay bug
  • -
  • Hopefully fixed the random beep encounter bug that occurs in some games with sound enabled
  • -
  • Several sound volume fixes
  • -
  • Sorry about those new problems in v0.941c. We traced some of the problems to the dos extender zsnes was using (thanks Maxim- for some help on this!) so we spent some time rewritng the file system so that it would be compatible with other extenders in pure dos.
  • -
  • Fixed Save Snapshot + Increment frame enter key affecting the game bug
  • -
  • Added Increment Frame Only option to the F1 menu
  • -
  • Made some minor changes to the Sound Blaster routines
  • -
  • Fixed some more sync bugs in .ZMV recording
  • -
  • Fixed a speed hack bug that occurred from v0.800 to v0.900. Hopefully the speed is better now.
  • -
  • Slightly improved the sound skipper when sound is disabled
  • -
  • You can now quickly modify the currently selected cheat code's value by typing a 2 digit hex number in the cheat code enter space
  • -
  • Added a hack to Chrono Trigger to prevent the screen from flashing before battles
  • -
  • Fixed a 16-bit mode 7 windowing distortion/crashing bug
  • -
  • Fixed a read memory leak bug in the 16-bit old gfx engine. Interesting that this bug plagued ZSNES all this time, but its effects didn't show until the recent versions.
  • -
-
- -
-

v0.941c/a - July 18, 1999

- -
    -
  • Fixed a small newly created timing bug
  • -
  • Fixed flicker bug in 320x480x65536 video mode during high snes resolution mode
  • -
-
- -
-

v0.940c/a - July 18, 1999

- -
    -
  • Fixed a major SuperFX bug! Starfox and other SuperFX games now show polygons! Note that the SuperFX still has bugs.
  • -
  • Fixed an offset per tile mode bug
  • -
  • Optimised SuperFX plot instruction.
  • -
  • Implemented a hack to get Winter Gold working. Thanks to Gary Henderson for this fix!
  • -
  • Fixed a flag setting bug in the XCE instruction (65816).
  • -
  • Fixed another HIRQ bug
  • -
  • Seems like a sprite cache bug that was fixed in v0.800 re-appeared in v0.900. Fixed now.
  • -
  • Fixed an SA-1 arithmetic calculation result timing bug
  • -
  • Forced the old gfx engine on when running Stunt Race FX since the new gfx engine was having lots of problems in 256 color mode
  • -
  • Fixed a new gfx 8bit engine mosaic crashing bug with certain games
  • -
  • Fixed a sprite cache bug in the new gfx engine
  • -
  • Fixed a DSP envelope bug which was causing some games to not work
  • -
  • WRAM data is now cleared by 0xFF
  • -
  • Fixed 320x480x16bit mode when switching from a 256 color mode
  • -
-
- -
-

v0.915c/a - July 7, 1999

- -
    -
  • NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files in the assembly only version
  • -
  • Skipped scanline length check/set in VESA 1.2 routines
  • -
  • Fixed a 256 color mode 7 slowdown bug that occurred in v0.910c
  • -
  • Added hi-res mode 7 hack to 320x480x256 video mode
  • -
  • Implemented 2xSaI engine for ARGB cards. Thanks to Kreed for the updated source!
  • -
  • 2xSaI was missing a couple lines at the bottom. Now fixed
  • -
  • A: 320x480 modes can now be selected in the GUI
  • -
  • properly cleared 320x480x256 video mode
  • -
  • F3 menu should now be correct during hi-res mode 7
  • -
-
- -
-

v0.910c/a - July 6, 1999

- -
    -
  • NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files in the assembly only version
  • -
  • The bug where enabling auto-cheat load, having an Sram directory, and loading a rom without a .cht file which results in Zsnes changing the loading directory to the sram directory is fixed.
  • -
  • A: Fixed cheat search engine
  • -
  • Tweaked HIRQ timing to fix some flickering in some games
  • -
  • Fixed screen shot capture in ARGB cards in 640x480x65536 mode with scanlines enabled
  • -
  • Implemented adjustable time interval for the sound reinitialization feature so that it can be set to values other than 30 seconds. It can be modified in zsnes.cfg (ReInitTime)
  • -
  • Cheat Search 'Add' button now works properly
  • -
  • Corrected Register 4212h to adjust to the new NMI timing
  • -
  • Implemented ARGB video mode support to VESA 1.2
  • -
  • Implemented 320x480x256 and 320x480x65536 video modes
  • -
  • Fixed a x448 resolution bug when scanlines are enabled
  • -
  • Prevented those with ARGB videocards from checking 2xSaI or Super Eagle engine for now
  • -
-
- -
-

v0.900c/a - July 4, 1999

- -
    -
  • NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files in the assembly only version
  • -
  • Fixed another sprite priority bug
  • -
  • A: Fixed an IRQ problem that was caused during the C -> ASM conversion
  • -
  • HBlank is supposed to be noticed during VBlank
  • -
  • Fixed an IRQ bug that occured between v0.715 and v0.800
  • -
  • Fixed a 65816 DPage usage bug that occured between v0.715 and v0.800
  • -
  • Rewrote 65816 flag handling system.
  • -
  • Optimised SA-1 emulation
  • -
  • Optimised the 65816 main loop.
  • -
  • Implemented Surround Sound. It is defaulted off since it seems to create some bad static in some games. Thanks to Crono for info!
  • -
  • Wrote Interpolation in MMX. MMX cpu is required.
  • -
  • Implemented MMX auto-detection for MMX Interpolation and MMX Copy.
  • -
  • Fixed an 224HDMA line bug, thanks to Gary Henderson!
  • -
  • Optimised 320x240x16b and 640x480x16b for ARGB cards.
  • -
  • Removed Snow
  • -
  • Clock option is now visible to anyone. You can enable the in-game clock through the GUI in Config->Options.
  • -
  • Altered method of writing to file in Movie Recording mode, hoping that it will fix some problems after recording movies for a long period of time.
  • -
  • Altered data alignment size in source
  • -
  • Fixed a VESA2 divide by 0 bug in Banshee cards by checking the scanline length instead of setting it immediately. Thanks to Crono for some help!
  • -
  • Altered sound echo volume
  • -
  • Added sound interpolation based on Crono's code. Thanks to Crono for his help!
  • -
  • Added an option to turn off sound interpolation for speed
  • -
  • Implemented Pitch Modulation, thanks goes to Gary Henderson for clarification info!
  • -
  • Implemented an option in the GUI (Config->Options) to allow the Fast Forward key to act as a toggle (disabled by default)
  • -
  • Fixed a bug that prevented high resolution to sometimes not display in a 16bit video mode
  • -
  • Fixed a game stalling bug when pressing F3 during games that are sensitive to changes in the ENVX DSP register (Bomberman Series)
  • -
  • Added a hack for the graphic glitches in Dragon Quest 6
  • -
  • Fixed up in-game clock in the new gfx 16bit engine
  • -
  • Fixed a nasty bug in the ADSR engine. It was sometimes using an incorrect decay value, causing the sound to stick instead of fading out
  • -
  • Slightly fixed ADSR by completely skipping the attack stage when the attack duration is 0
  • -
  • Fixed a GAIN decrease->increase bug
  • -
  • Implemented a safe recovery feature for those computers that don't support the CPUID instruction (used for MMX detection). If ZSNES crashes at the very start, just re-run it.
  • -
  • Fixed a fixed color dual windowing bug in the subscreen which caused transparency to sometimes shift unexpectedly when the background scrolls
  • -
  • Implemented 50% Scanlines (Lance McKay's idea) and 25% Scanlines (Similar to Snes9x TV-Mode's scanline intensity) in 640x480x65536 video mode. These modes don't work on videocards with an ARGB setting yet.
  • -
  • Added MMX Support to 50% and 25% Scanlines modes
  • -
  • Implemented back buffer clear in MMX
  • -
  • .CHT files now saves to the proper save directory
  • -
  • Implemented the 2xSaI graphics engine (MMX Only). Many thanks to Kreed for this wonderful engine and source code!
  • -
  • Implemented Kreed's Super Eagle engine. Note that for both 2xSaI and Super Eagle, you need an MMX processor, enough RAM for the new gfx 16bit engine, and also be in 640x480x65536 video mode.
  • -
  • Implemented an option to auto-load a .cht file whenever a game is loaded. You can find this option at the bottom of the Cheat Window in the GUI.
  • -
  • Optimised Non-MMX Interpolation
  • -
  • Fixed a bug that caused save states to not save correctly after attempting to load a non-existing .cht file
  • -
  • Added a Quick SnapShot Key. You can set this key in the Misc -> GameKeys menu in the GUI. This key allows you to take a snapshot with just a press of a key.
  • -
  • C: Implemented .ZIP support. Thanks to Jean-loup Gailly, Mark Adler, and Gilles Vollant for the ZIP routines!
  • -
  • Fixed a bug where pressing PageUp/PageDown in the cheat window went over by 3 entries.
  • -
  • Implemented longer cheat descriptions. The cheat window and the .cht file format had to change a bit, however, ZSNES automatically converts any old formats to the new formats when it detects it.
  • -
  • Allowed the IRQ to be executed more than once on the same line through HIRQ. Fixes the flickering problems of Doom/Offroad Baja.
  • -
  • NMI now executes at line 225 instead of 224.
  • -
  • Saving/Loading the state causing the control to stop or skip has been fixed again.
  • -
  • C: .ZIP files can now be run from the commandline
  • -
  • Implemented an option for ZSNES to automatically save the save data approx. 5 seconds after it detects writes to it. This will not work for SuperFX or SA-1 special chip games, however. This option is disabled by default and can be enabled through the option window.
  • -
  • Implemented an option in the sound window to re-initialize the sound card after every 25-30 seconds. Hopefully fixes the problems where the sound gets staticy after a certain amount of time.
  • -
  • Newest Save Slot will now appear as orange in the Save State Select (F3) window
  • -
  • Fixed a spc700 <-> 65816 sync bug during movie (.ZMV) playback
  • -
  • Implemented an option to enable Old Gfx Engine Mode 2 (Accessible through the options window in the GUI). This mode fixes many transparency problems in 16bit modes, but can also create some and is also at times slower than the original engine.
  • -
  • Implemented 640x480x65536 VESA 1.2 support. Currently supports Full Scanlines and Smallscreen modes. However, it is strongly recommended that you only use VESA 1.2 support if your card cannot support VESA 2.0 (w/ linear framebuffer) since VESA 1.2 runs slower.
  • -
  • Implemented an option to disable Pitch Modulation
  • -
  • Sound card is now not re-initialized whenever a state is saved/loaded since some sound cards seems to have problems with it.
  • -
  • Implemented Single Windowing in the New Gfx 8bit engine, 8x8 and 16x16 tile modes only
  • -
  • Fixed 64k SRAM support when loaded from the GUI
  • -
  • Optimised high resolution new gfx modes in 640x480x256
  • -
  • Fixed the graphic glitches in x488 snes vertical resolution modes in 640x480x256 new gfx mode
  • -
  • Optimised 640x480x256 Eagle Engine
  • -
  • Fixed the GUI background display bug in the new gfx engine
  • -
  • Fixed .SPC capture in the new gfx engine
  • -
  • Added an option to start with the newest save state when the game is loaded. It can be enabled in Config->Options window in the GUI
  • -
  • Slightly optimised new gfx 8bit engine
  • -
  • Fixed several Mode 7 problems in the New Gfx 8bit engine
  • -
  • Changed DSP1 variables to use double instead of floats for a small speed increase. Thanks to Gary Henderson for this tip!
  • -
  • Fixed up the Mode 7 slowdown bug when the scale ratio becomes small in most graphics modes
  • -
  • Optimised some Mode 7 transparency modes
  • -
  • Implemented EXTBG mode 7 into the newgfx 8bit engine
  • -
  • Fixed the 'FIX' feature in the cheat menu. Seems like it wasn't writing any value to memory when it was clicked.
  • -
  • Game Genie codes are now defaulted to the 'FIX'ed mode. Seems like most of the codes needs this.
  • -
  • Implemented windowing to Mode 7, New Gfx Engine 8bit
  • -
  • Added support for .SPC v0.2 format
  • -
  • Added an option in zsnes.cfg to disable configuration saving for those who want to store zsnes.exe in a read-only storage area
  • -
  • Fixed GameKeys display in the GUI for certain keys (such as the snes parallel adapter keys)
  • -
  • Implemented hi-res mode 7 (vertical expand only). Currently only works in 640x480x256 newgfx engine (w/ Eagle and Scanlines disabled).
  • -
  • Fixed an offset per tile mode bug in the new gfx 8bit engine
  • -
  • Implemented dual windowing modes into the new gfx 8bit engine
  • -
  • New Gfx 8bit engine is now the default graphics engine in 256 color modes. It still lacks sprite windowing and also has some sprite flicker issues, but it's overall more stable, faster, and has more features. You can still switch back to the old gfx engine by pressing '8'.
  • -
  • Looks like Pitch Modulation was causing more sound problems than what it's worth. It's now disabled by default, but you can reenable it through the GUI.
  • -
  • Added auto save/load state feature where ZSNES will automatically loads back the previous state when you last properly exited ZSNES. This feature is disabled by default.
  • -
  • Compressed the executable using UPX
  • -
-
- -
-

v0.800a - December 25, 1998

- -
    -
  • Assembly only version.
  • -
  • Doesn't support DSP1 chip or IPX.
  • -
  • May fix problems that some people are having with sound.
  • -
  • NOTE : Only use this if have problems with 0.800c.
  • -
-
- -
-

v0.800c - December 24, 1998

- -
    -
  • Fixed up sound speeds. Timers were computed incorrectly.
  • -
  • Fixed a sprite priority bug
  • -
  • Fixed up a bug that prevented the gui to be disabled
  • -
  • Fixed up SPC capture
  • -
  • Fixed a bug when VIRQ is set on the same scanline as NMI
  • -
  • Implemented an automatic .IPS patcher. Just rename your .IPS file to the rom filename with the .IPS extension and ZSNES will patch the rom realtime without modifying the rom file's contents. Thanks to Neill Corlett for most of the .IPS info!
  • -
  • Snapshot capture/skip 2 frames option now returns back to the proper menu item
  • -
  • Fixed a calibration bug with 6/8button joysticks
  • -
  • Fixed up display in 640x480x8 new gfx engine
  • -
  • Fixed up hi resolution displays in all 640x480x8b modes
  • -
  • Fixed up a bug where Mode 7 becomes corrupt after selecting Save CFG from the GUI
  • -
  • Fixed a memory map bug in lorom DSP1 games
  • -
  • Fixed a potential DSP1 crashing bug where a negative value is being square rooted
  • -
  • Hopefully fixed the modem bug when using an IRQ that is bigger than 7
  • -
  • Fixed up an ADSR bug for games that changes ADSR mid-sample
  • -
  • Fixed up echo emulation (possibly slowed down emulation)
  • -
  • Fixed up a sprite caching bug
  • -
  • Fixed up a DSP1 byte check stall bug
  • -
  • Implemented a commandline to disable spc700 speed hacks (-7). Might help with some compatibility
  • -
  • Implemented SA-1 support (most functions emulated)! Unfortunately, it's still buggy. Thanks to the snes9x team for providing info!
  • -
  • Fixed a bug when selecting drive A/B while a disk is not in the drive caused a long check sequence
  • -
  • Implemented Keyboard support to most of Option, Sound, and GUI Option configurations in the GUI
  • -
  • Changed sound init code a bit. Hopefully improves sound card compatibility, but might also ruin it.
  • -
  • Implemented off by 1 line fix (-9). This may help compatibility and fix some minor graphic glitches, but may also ruin some too.
  • -
-
- -
-

v0.715 - October 29, 1998

- -
    -
  • Fixed a crashing bug when 16bit back window clipping was using an undefined windowing clip buffer
  • -
  • Added spc program counter check to the spc stall detection to reduce false alarms
  • -
  • Tweaked IRQ processing a bit
  • -
  • ZSNES.CFG and ZGUICFG.DAT are now fixed so that they will use the current directory when the SET CMDLINE detection fails
  • -
  • Fixed several mode 7 bugs in the new graphic engines
  • -
  • Implemented an option to save the configuration files in the MISC menu
  • -
  • Added a shadow to the in-game text displays
  • -
  • Fixed a bug created in v0.700 where pressing F3 while sound is disabled crashes zsnes
  • -
  • Fixed up player 4 and player 5 so they now work again
  • -
  • Fixed up color a bit in the old graphics 16bit engine
  • -
  • Added gamma control to 16bit old graphics engine
  • -
  • Fixed a cheat code bug where pressing the down key in the browser overflows by 3 rows
  • -
  • Fixed up a bug where any memory allocation below 48mbit support crashes
  • -
  • Added out of memory error when loading a file from the gui
  • -
  • Fixed a minor off by 1 pixel windowing bug
  • -
  • Fixed up memory requirements in the readme.txt. It seems like compiling with C takes up 3.0 more megs. It shouldn't though. An asm only version will be release later without dsp1/ipx support unless the reason is figured out.
  • -
-

NOTE : It seems like IPX mode randomly loses packets in certain configurations so IPX isn't recommended to use yet.

-
- -
-

v0.700 - October 26, 1998

- -
    -
  • Fixed another offset per tile mode bug
  • -
  • Fixed up joystick button update rate
  • -
  • Fixed a bug that caused sound buffer dump option to crash
  • -
  • Fixed a minor sound initialization bug
  • -
  • ZSNES now compiles with C code!
  • -
  • Fully rewritten commandline parser routines
  • -
  • Partially rewritten SET BLASTER/SET CMDLINE detection
  • -
  • Implemented partial DSP1 support. Seems to have some precision problems. Thanks to the snes9x team for the info!
  • -
  • Fixed a mode 7 nonrepeat mode off by 1 tile bug
  • -
  • Implemented snapshot/increment by 2 frame feature in the F1 menu for those interested in producing animations
  • -
  • Added variable sound buffer size to reduce static in higher sampling rates
  • -
  • Changed method of reading the mouse cursor position in the GUI. Hopefully, this fixes those mouse crash problems when zsnes is run in pure dos and sometimes win95.
  • -
  • Added a commandline to disable palette 0 (back color) modification in 256 color modes
  • -
  • Implemented Turbo Buttons for buttons A,B,X, and Y. Use the GUI to define those keys
  • -
  • Added the ability to toggle Turbo Change speed to 30hz instead of 60hz in the Options menu.
  • -
  • Started C4 chip emulation. Nothing is playable yet.
  • -
  • Fixed up SET CMDLINE detection. Hopefully, zsnes.cfg and zguicfg.dat will now end up in the correct directory.
  • -
  • Started Modem Support (direct modem to modem). DOS-Compatible modem required! Thanks to Dark Force for helping out on getting a bug that kept USR's and other modems from working! Also thanks to The Minder for a lot of help testing! Note : Modem mode isn't free of bugs.
  • -
  • Added in-game chat key to the GUI keys for modem/net support. Currently defaulted to 't'
  • -
  • Forgot to add EMMS after any MMX routines that seems to cause any FPU instructions to crash
  • -
  • Fixed an interrupt re-enable bug in the Gamepad Pro code which seems to have eliminated the locking bugs when it's not set on GrIP mode
  • -
  • Implemented keys to adjust Frame Rate up or down during gameplay. You can define them through the GUI under Gamekeys.
  • -
  • Implemented keys to slide the volume level up or down during gameplay
  • -
  • Fixed a small HDMA screw up bug when using Save/Load states which caused the screen to flicker once in many games
  • -
  • Finally fix up 48mbit mapper support! Many thanks to Dark Force, Mike Gilroy, and Frank Hughes for a lot of help on this!
  • -
  • Several fixes to register 4211h
  • -
  • Rewrote IRQ timing handler (not perfect, but better)
  • -
  • Implemented Fossil Driver support to the modem support.
  • -
  • Fixed an IRQ reenable bug
  • -
  • Increased default cycles a bit
  • -
  • Fixed some major mode 7 rotation bugs
  • -
  • Added support for uninterleaved 48mbit roms
  • -
  • Added a FIX option to the cheat code to correct incorrectly converted codes
  • -
  • Implemented Mode 7 horizontal flip
  • -
  • Implemented primitive IPX support. It is very primitive at the moment and may not work since it isn't really tested much.
  • -
  • Optimised some 65816 direct page addressing modes
  • -
-

NOTE : .ZMV (Movie) files recorded under v0.635 has good potential on becoming obsolete in this version because of the timing changes

-

NOTE : IPX support and Modem support may be buggy since it hasn't been tested on multiple types of connections yet.

-
- -
-

v0.635 - September 24, 1998

- -
    -
  • Sidewinder fix options are now swapped since the majority seems to work better with the other sidewinder routine.
  • -
  • Implemented EXTBG mode7 in 256 color old graphics engine.
  • -
  • Fixed a DSP Sound bug where some sound effects weren't played in certain games
  • -
  • Tweaked joystick routines again
  • -
  • Fixed up a bug where sometimes loading a game after playing another game screws up emulation
  • -
  • Optimised 640x480x8, 512x384x8, and 512x384x16 video modes
  • -
  • Implemented EXTBG mode7 in 65536 color old graphics engine.
  • -
  • Fixed an offset per tile mode range clipping bug
  • -
  • Fixed up offset per tile mode in new gfx 8bit engine
  • -
  • Fixed a bug which caused a crash when a state is loaded while playing/recording a movie file
  • -
  • Optimised new gfx 16bit non-transparency mode
  • -
  • Implemented SPC700 stall detection/recovery attempt
  • -
  • Fixed up a new header detection bug in v0.625
  • -
  • Modified memory allocation routines. Hope this fixes those random crash problems that some people seem to have
  • -
  • Fixed a sound bug where the song leaks after it ends, sometimes producing an unwanted beep
  • -
  • Optimised new gfx 16bit transparency modes
  • -
  • Multiple DSP sound bug fixes
  • -
  • Implemented transparencies in high res 16x8 tiles
  • -
  • Implemented a command line to disable the sound DSP (-dd). Use -s and -dd if you want spc700 emulation to be enabled without sound to improve compatibility
  • -
  • Fixed a bug where joystick support makes the emulation slow
  • -
  • Had to remove some memory allocated variables and convert them to arrays since they were causing random crashes on specific computers.
  • -
  • Fixed up pressing save state/load state in game so that it doesn't clear any key presses
  • -
-
- -
-

v0.625 - September 18, 1998

- -
    -
  • Fixed up a major speed drop bug by just adding some empty space. Most likely a cache/alignment problem.
  • -
  • Used an older version of wdosx because the new version sometimes crashes during compiling
  • -
  • Executable is now uncompressed. It's 3 megs, but it provides a much faster start up time.
  • -
  • Seems like EPACK can only support a maximum of 6 commandlines. Fixed after executable is decompressed
  • -
  • Fixed a bug where buttons 7 and 8 of 8 button joystick support sticks once pressed
  • -
  • Swapped button 5/6 and 7/8 in the default joystick configuration for 8 button joysticks
  • -
  • It seems like 16bit HDMA > 5 was causing problems with some sound cards. It now reroutes back to 8bit DMA like how v0.400 did it.
  • -
  • Implemented a new offset per tile mode engine into the old graphics engine (mostly transferred from 8bit newgfx engine)
  • -
  • Implemented Horizontal offset per tile mode in both 8bit and 16 bit old graphics engine (Mode2/8x8 only)
  • -
  • Implemented Horizontal offset per tile mode in 8bit new graphics engine (Mode2/8x8 only)
  • -
  • Tweaked sidewinder routines. Hopefully, this will help those who have troubles using sidewinder support
  • -
  • For those with sidewinder pads who has troubles with the tweaked routines, a 'Sidewinder Fix' option in the GUI is added in the Config/Options menu
  • -
  • Commandline -i now uninterleaves an incorrectly interleaved rom
  • -
  • Tweaked GamePad Pro routines. Not exactly sure if this will help those with 2 GPP joysticks though
  • -
  • Fixed up sticky buttons in the GUI cheat menu when no cheat codes are present
  • -
  • Fixed a bug where using -1 and -2 in the commandlines didn't activate the joystick movement/buttons
  • -
  • Fixed an offset per tile mode wrapping bug
  • -
  • ZSNES will now not crash when zsnes.cfg and zguicfg.dat are write protected files
  • -
  • Fixed up the GUI when 239 y resolution is used in the game
  • -
  • Optimised some minor mode 7 routines
  • -
  • SNES Header display in the GUI now displays the filename for blank headers. This will fail for headers with garbled header names
  • -
  • Inserted an extra reminder in the cheat menu
  • -
  • Implemented 239 y-resolution support for .PCX snapshots
  • -
  • Implemented 239 y-resolution support for .BMP snapshots
  • -
  • Added multiple .SPC saves (Up to 10 saves only)
  • -
  • Save State Selection Menu (default F3) now highlights used state boxes in red
  • -
  • Tweaked 2player/6button/8button joystick routines a bit
  • -
  • Fixed a cheat code bug where pressing TAB adds an extra character at the end of the address
  • -
  • Removed the blank line from the .PCX and .BMP snapshots
  • -
  • Implemented Joystick Calibration for non digital joysticks
  • -
  • Fixed a bug where parallel port LPT2 player 2 wasn't selectable in v0.605
  • -
  • Stabilized the joystick code a bit
  • -
  • Fixed up a cheat code bug where using a PAR code that accesses RAM doesn't freeze when the .cht file is loaded
  • -
  • Added a small delay to play a note when a key on is issued from the sound DSP. Not sure if this fixes anything though
  • -
  • Fixed some sound compatibility problems when RESET is used
  • -
  • Implemented Movie Record/Playback support. Read GUINotes.txt for details.
  • -
  • Added a small detection for long filenames and prevented users from selecting it when it isn't detected
  • -
  • Fixed a bug where max frame skip didn't save
  • -
  • Fix a timing bug where running a game off the gui ran 1 less line in the 65816 than running off the commandline
  • -
  • Implemented FPS at start option in the Config/Options menu
  • -
  • Fixed a bug in the newgfx16bit engine where 8bpp tiles displayed incorrectly
  • -
  • Reduced the filesize by 1200k through many changes in the code (filesize is now 2.0 megs)
  • -
  • Fixed some VIRQ bugs that caused certain games to crash
  • -
  • Added DMA area execution for IRET
  • -
  • Added a 'Bugs Section' in the readme.txt
  • -
  • Show all extensions is now disabled when snes header view is selected in the GUI
  • -
  • Implemented partial Direct Color mode in Mode 7 (no transparencies yet, only works in 16bit old gfx engine)
  • -
  • Improved header detection a bit
  • -
  • Fixed up a sprite bug in games which changes the address in the middle of the screen
  • -
-
- -
-

v0.605 - September 10, 1998

- -
    -
  • Fixed up a FPS display bug when switching between auto frame rate and manual frame rate in the GUI
  • -
  • Cheat Codes can now be toggled ON/OFF by double clicking on them
  • -
  • Tab key now switches from the Cheat Code enter box to the Description box
  • -
  • Fixed a Save State/Load State bug in the menu where it saved in the load directory instead of the save directory
  • -
  • Implemented 8button joystick support (Not tested)
  • -
  • Implemented an option in the .cfg file to enable reversed stereo sound (ReverseStereo)
  • -
  • Implemented an option in the .cfg file to share Player 1 and Player 2 controls with Player 3 and Player 4's controls. This option allows you to use 2 devices (Joystick and Keyboard) for both player 1 and player 2, but this also disables MultiTap support. (Pl34to12Share)
  • -
  • Added Reverse Stereo to the GUI under config/sound
  • -
  • Added Player 3, Player 4 to use as Player 1, Player 2 in the GUI under config/options
  • -
  • Compiled under a new version of wdosx. Hope this doesn't cause any problems
  • -
-
- -
-

v0.601 - September 9, 1998

- -
    -
  • Fixed up a sound card deinit bug that sometimes caused ZSNES to crash in certain sound cards
  • -
  • Disabled Autoinit mode when a low sampling rate is used in 8bit sound. Probabily was also causing problems in some cards
  • -
-

Note : The offset per tile mode in the 16bit oldgfx engine seems to randomly crash sometimes for an unknown reason. If 16bit mode crashes for you and 8bit doesn't, press the '0' key in 16bit mode to disable that mode.

-
- -
-

v0.600 - September 9, 1998

- -

*** ADDED A NEW MEMBER TO THE ZSNES TEAM! ***

-

Welcome Pharos to the team, his role is currently a coding assitant. So far, he helped us objectize the zsnes source code which greatly helped in the compile time, provided assembly help, and helped us prepare on linking C code to zsnes (not completely there yet).

-

Note : It is strongly recommended to not use the 16-bit new graphics engine yet because of bugs and speed concerns. It is enabled only in 320x240x65536 for those who are interested.

-
    -
  • Added partial 65816 execution in the DMA registers (doesn't seem to fix mucht due to some other problem) Thanks to Alucard for this info! This also slowed down emulation a bit.
  • -
  • Implemented sprite priority correction into the new graphics engine
  • -
  • Implemented mosaic into the new graphics engine
  • -
  • Implemented true 512 horizontal resolution into new graphics engine (both 16x8 and 16x16 tile modes)
  • -
  • Implemented interlaced 448 vertical resolution into new graphics engine
  • -
  • Implemented offset per tile mode into the new graphics engine (Mode 2/Vertical only). More accurate compared to the old graphics engine. (seems to be a bug where the game gets very slow sometimes though)
  • -
  • Started 16-bit new graphics engine
  • -
  • Implemented sprite priority correction in 16bit new gfx engine
  • -
  • Implemented palette raster effects in 16bit new gfx engine
  • -
  • Fixed a minor bg enable/disable bug in the new gfx engine
  • -
  • Multiple SPC700 bug fixes. More games run now!
  • -
  • Implemented SPCPlay sound engine into zsnes : -
      -
    • Echo & FIR Filter Support (Slowed down emulation, but gives better sound) Thanks to feenix65 for info on FIR Filter!
    • -
    • Volume fixes
    • -
    • Rewrote ADSR/GAIN engine
    • -
    • Added Adjustable Volume through the commandline and zsnes.cfg
    • -
    • 16000 and 32000 extra sampling rates
    • -
    • Many other bug fixes
    • -
    -
  • -
  • Fixed a minor HDMA bug
  • -
  • Fixed an old style joystick read bug that prevented the joypad from functioning in certain games
  • -
  • Several optimisations on Echo & FIR Filter
  • -
  • Several Sound DSP Fixes
  • -
  • Temporarily fixed a V-latch bug in some games that don't update the display at every frame
  • -
  • Add/Removed some game hacks for compatibility
  • -
  • Modified Song Start Search in .spc capture. Should be much better now.
  • -
  • Fixed a sprite window clipping bug where it was used when it's not supposed to be.
  • -
  • Modified memory allocation technique in zsnes. This should now eliminate some random crash errors. Thanks to Y0SHi for this info!
  • -
  • -c now does full screen instead of small screen in 640x480 modes. For small screen, use -cc
  • -
  • Fixed a back area 1/2 addition bug which caused the background to be sometimes darker than usual
  • -
  • Fixed a mode 7 transparency bug
  • -
  • Added 8-bit stereo sound and 8-bit sound high speed mode support (high speed mode support is just the implementation of 8bit 44100khz or 22050khz stereo) Thanks to Crono for a lot of help on this!
  • -
  • Fixed up sound blaster deinit code. Thanks again to Crono!
  • -
  • Wrote an entirely new GUI : -
      -
    • Mouse driven GUI/Menu Based
    • -
    • Full Keyboard Support in all the Quick (Arrow Menu), Load, and Cheat menu items
    • -
    • Ability to display load names under 8.3 filename format, snes header name, and win95 long filenames
    • -
    • Support for Save State, Load State, and Select State through menu items
    • -
    • Quick Load Menu (Arrow menu) which allows you to quickly load the last 10 games loaded
    • -
    • Ability to Freeze or Clear the Quick Load Menu
    • -
    • An Options menu which allows you to configure settings such as video mode, sound settings, frame skip, etc.
    • -
    • Added the ability to customize the game keys such as the save state key, misc toggles, etc.
    • -
    • Ability to use those keys as joystick buttons
    • -
    • Customizeable background palette displacement
    • -
    • Several minor GUI customization features
    • -
    • Ability to quickly exit/enter the GUI with the right mouse button (Disabled by default)
    • -
    • Ability to Enter Game Genie, Pro Action Replay, or Game Finger Cheat Codes
    • -
    • Ability to browse the cheat codes and Toggle or Remove the codes
    • -
    • Ability to Save/Load Cheat Codes (saves them as .CHT files in the same directory as the .SRM/.ZST files)
    • -
    • Ability to Select Input Devices for each joypad
    • -
    • Ability to Define Keys/Button configuration for each joypad
    • -
    • Joypad can now move in the GUI (disabled by default)
    • -
    • Added some future reserve menus (Netplay, Cheat Search Engine). But they are NOT implemented in zsnes yet.
    • -
    -
  • -
  • Fixed a bug when clearing the screen in 640x480x65536
  • -
  • Implemented full add, half add, full subtract, and half subtract into the new 16bit graphics engine. Not sure why, but some transparency modes are actually slower than the old engine. Most likely flushing the cache a lot somewhere.
  • -
  • Implemented background transparencies into new 16bit graphics engine (implemented incorrectly at the moment. Some transparency modes also is slower than the old graphics engine, but that will change in the future)
  • -
  • Implemented fixed color transparencies (very incorrect because of lack of windowing)
  • -
  • Fixed a minor bug in the fast forward routines
  • -
  • Rewrote most of the 65816 speed hack. It should now be a lot more friendly with games (reduced graphic glitches/increased compatibility).
  • -
  • Fixed a bug in Mode7 with Windowing and Transparency enabled
  • -
  • Allowed 16bit HDMA sound blaster values less than 5 to be used. Not exactly sure if this works though.
  • -
  • Implemented Mouse Disable Command Line (-j)
  • -
  • Rewrote Input Device Routines (Keyboard, Joystick, SNES Mouse, and Super Scope Handlers)
  • -
  • Added GamePad Pro Support (Don't know if it works on a standard GrIP system though). Thanks to Marius Fodor for the code!
  • -
  • Added Snes Parallel Port Support for both LPT1 and LPT2. Thanks to Karl for the code!
  • -
  • Added MultiTap (Multiplayer 5) Support! (Only up to 4 players at the moment though)
  • -
  • Joystick Port 209h support
  • -
  • Fixed an overflow caching bug in the new gfx engine where a few games run very slow
  • -
  • Added some C -> ASM converted DSP1 functions. Some functions were unable to convert properly so no DSP1 games are playable until the actual C code is in
  • -
  • Executable is now compressed using epack
  • -
  • Implemented sprite transparency into the 16-bit new graphics engine
  • -
  • Implemented mode7 transparency into the 16-bit new graphics engine
  • -
  • Higher memory requirements (Sorry, but this is unavoidable as long as ZSNES keeps expanding)
  • -
  • Implemented Echo Disable in the zsnes.cfg for those who want some extra speed in return for lost sound quality
  • -
  • A bunch of other fixes that we forgot to list
  • -
-
- -
-

v0.400 - May 19, 1998

- -
    -
  • Fixed a dual windowing bug in mode 7 in 65536 color mode
  • -
  • Re-added FPU Copy due to a demand
  • -
  • Implemented MMX Copy. Use -om to enable. Thanks to Angels Holocaust for this info!
  • -
  • Fixed a bug when writing to .bmp files
  • -
  • Added (buggy) SuperFX support (9.5MB memory required). Special thanks to the snes9x team for all the info and help!
  • -
  • Fixed up sprite windowing. Should hopefully be correct now
  • -
  • Added a commandline to show all file extensions through the GUI. Use -sa to enable.
  • -
  • Added Noise to the Sound DSP
  • -
  • Added a Fast Forward key. Use the Tilde Key (~) located at the top-left of your keyboard.
  • -
  • Added Sprite Priority Correction
  • -
  • Fixed a tile caching bug that caused some tile corruption
  • -
  • Fixed a 65816 bug in XCE on the x flag. Thanks to ]SiMKiN[ for this!
  • -
  • Implemented Interleaved format and a simple auto detection. In case autodetect fails, use -i. Thanks to feenix65 for this info!
  • -
  • Improved header detection. Should now work better with demos and games with weird filesizes
  • -
  • Added a new graphics engine in 256 color mode. It should be much faster in areas that don't use mode 7, but lacks a lot of features such as windowing, mosaic, and sprite priorities so it is disabled by default. It can be enabled by pressing 8 during gameplay. (~40-100% faster)
  • -
  • Optimised Mode 7 in 256 color mode
  • -
  • Implemented dual windowing to color window clipping
  • -
  • Fixed several color window clipping bugs
  • -
  • Added full resolution screenshot capture in 640x480x65536 mode. To activate while in that mode, hold backspace and press F1
  • -
  • Fixed several transparency bugs
  • -
  • Added NewGfx to zsnes.cfg which determines if the new graphics engine is enabled at start
  • -
  • Added CopyMethod to zsnes.cfg which can default the copy method as either fpu copy or mmx copy
  • -
  • Allowed systems with 5.5MB of RAM free to load 2mbit roms
  • -
  • Fixed sidewinder support when sound is set at a high sampling rate. Thanks to Marius Fodor for the source!
  • -
-
- -
-

v0.393 - April 15, 1998

- -
    -
  • Whoops! Forgot to remove the debug variables in v0.391
  • -
  • Fixed another sprite clipping bug
  • -
  • Fixed clipping in Mode7 16-bit mode
  • -
  • Removed FPU Copy since it didn't seem to speed up emulation
  • -
  • Added .USA and .JAP rom extension into the GUI
  • -
  • Added Save SPC Data which saves the contents of the SPC700/DSP of the beginning of the next song (Future Reserved)
  • -
  • Add Sound Buffer Dump which dumps the decompressed sound buffer as raw pcm. This can become quite inaccurate due to the way how zsnes stores its decompressed sounds.
  • -
  • Added MenuItem Sound Buffer Dump into the F1 Menu
  • -
  • Added MenuItem Save SPC Data into the F1 Menu
  • -
  • Added a key to disable offset mode. Press 0 key to activate/deactivate
  • -
  • Added small screen support in 640x480VESA2 modes. This mode should be much faster for those who use 640x480. Use the -c commandline to enable this when in 640x480.
  • -
  • Added an option for centered small screen. Use the -cc commandline.
  • -
  • Fixed up 320x240x65536 support for ARGB cards again. It now should be working. (No, seriously!)
  • -
  • Removed some static from the sound.
  • -
-
- -
-

v0.391 - April 13, 1998

- -
    -
  • Fixed a bug in DMA from v0.390
  • -
  • Fixed some sprite windowing clipping bugs
  • -
  • Fixed an OAM overflow bug. Thanks to DJRob for some help on this!
  • -
  • Fixed a save state bug where running a game off the commandline and having a save directory specified prevented more than 1 save state
  • -
  • Fixed a transparency bug from v0.390
  • -
-
- -
-

v0.390 - April 11, 1998

- -
    -
  • Fixed a bug which caused 320x240x65536 to display incorrectly on video cards with an 16-bit ARGB setting
  • -
  • Fixed a minor screen add/sub bug
  • -
  • Fixed a minor sprite priority bug
  • -
  • Fixed a BG3 priority bug in BG Mode 0
  • -
  • Fixed a color window addition bug
  • -
  • Fixed a minor VIRQ enable bug
  • -
  • Swapped The Cursor Button and Autofire Switch in Super Scope
  • -
  • Fixed a joystick read timing bug
  • -
  • Sound volume register returned an invalid value. Now fixed.
  • -
  • Added some dword alignment to some variables. Thanks to Marius Fodor for this info!
  • -
  • Implemented 64k sram files
  • -
  • Implemented Sprite VRAM address changing in the middle of the screen. Should fix some games such as Lufia 2
  • -
  • Added some hacks to get some games working better
  • -
  • DSP : Fixed a divide by 0 bug when key on is set without any sound variables initialized
  • -
  • Increased default cycles executed in FastROM.
  • -
  • Added ZSNES.FAQ . Read this if you have troubles!
  • -
  • Added a key to disable/enable Windowing. Press 9 to activate this.
  • -
  • Implemented EAGLE algorithm in 640x480x256 video mode. Use -y to enable. Thanks to A CoolMan for the algorithm! Later on, we'll implement his code which has MMX acceleration!
  • -
  • Implemented FPU copy. Use -o to enable. Used only when copying buffer to video in 320x240 vesa2 modes.
  • -
  • Re-wrote Windowing routines for speed and expandability
  • -
  • Added Dual Windowing on BGs in all logic modes
  • -
  • Added Dual Windowing on Sprites
  • -
  • Added some minor stuff to the header displayer
  • -
  • Added partial offset per tile mode. (Mode 2/Vertical/8x8). Thanks to the feenix65 for some help on this! Implementation still a bit buggy.
  • -
  • Sorry, but memory requirements had to increase by a bit.
  • -
  • Fixed a tile graphics wrapping bug
  • -
  • Clean up and optimised 16-bit graphics code
  • -
  • Fixed up a display bug when switching from 239 to 224 y resolution
  • -
  • Optimised some video processing code. Thanks to Crash_Man for the help!
  • -
  • Minor optimisations to the 65816
  • -
  • Improved color intensity in the back area
  • -
  • Fixed a sram directory bug where the save state didn't save in the save directory when the game is specified from the command line
  • -
  • Fixed a keyboard bug when left-shift is selected as a key. Thanks to Pharos for help on this!
  • -
  • Some DMA speedups
  • -
  • Some optimisations to OAM/VRAM write
  • -
  • Sorry, but SuperFX emulation is disabled for this public version.
  • -
-
- -
-

v0.305 - February 12, 1998

- -
    -
  • Fixed a snes ppu multiplication bug. Thanks to Lord Esnes!
  • -
  • Hopefully fixed 6-button joystick support.
  • -
  • Fixed a little memory overflow bug which caused some games to not work
  • -
  • Forgot to clear NMI wait substitute variables when another game is loaded from the GUI
  • -
  • Changed sound processing engine back to v0.297. If for any reason you want to go back to v0.300 sound engine, use -x as a command line
  • -
  • Added Cursor Mode Button to the Super Scope. Never thought it was necessary until recently. Use the =/+ key.
  • -
-
- -
-

v0.300b - February 10, 1998

- -
    -
  • Fixed a bug that causes sidewinder support to crash.
  • -
-
- -
-

v0.300 - February 9, 1998

- -
    -
  • Fixed a 65816 wrapping bug
  • -
  • Added Super Scope Emulation! (Press 7 beyond mouse)
  • -
  • Some minor touches to the GUI
  • -
  • Manually calculated RGB bit lengths when using 16-bit modes
  • -
  • Fixed another bug when loading 48mbit images from the GUI
  • -
  • Sped up the execution loop when sound is enabled
  • -
  • Implemented NMI wait substitute for speed
  • -
  • Added some extra vesa2 routines to help some video cards with ARGB format of 1:5:5:5, however interpolation won't work for those at the moment. Thanks to Dark Force for helping out on this one!
  • -
  • Implemented 512x384 VESA2 resolution for both 8 and 16 bit
  • -
  • Implemented Sound Mute and Reset
  • -
  • Implemented Joystick Remapping. Edit ZSNES.CFG to access this.
  • -
  • Fixed and sped up 6 button joystick support
  • -
  • Fixed 2 2-button joystick support
  • -
  • Hopefully fixed 2 sidewinder support
  • -
  • Fixed an overflow sound bug
  • -
-
- -
-

v0.297 - January 31, 1998

- -
    -
  • Fixed a bug when loading 48mbit images from the GUI
  • -
  • Fixed some crashing bugs by just adding some zero space. Very weird bug!
  • -
-
- -
-

v0.296 - Not Released?

- -
    -
  • Fixed up Cheat Menu in 16-bit color mode
  • -
  • Changed SPC700 skipper back since it was causing problems in certain games
  • -
  • Added Multiple Snapshot files
  • -
  • Fixed a minor loading bug
  • -
  • Fixed 16-bit color full add/sub conversion table when video is in BGR format
  • -
  • Fixed some fixed color screen add/sub bugs
  • -
  • Supported .SWC format in the GUI
  • -
-
- -
-

v0.295 - January 29, 1998

- -
    -
  • Compiled under a newer version of WDOSX. This should help fix some VESA 2 problems.
  • -
  • Fixed multiple SPC700 bugs
  • -
  • Added a command line to force either NTSC (-t) or PAL (-u) timing
  • -
  • Added a command line to force 8-bit sound on (-8)
  • -
  • Zsnes.cfg is now loaded from the directory where zsnes.exe is located
  • -
  • Zsnes.cfg now re-writes itself when zsnes exits
  • -
  • Reduced zsnes.exe filesize
  • -
  • The IRQ's are now more stable. This should help fix some crashing/rebooting problems under dos. Thanks to Sardu for some help on this!
  • -
  • Fixed some VRAM accessing bugs
  • -
  • Several fixes to the sound DSP
  • -
  • Optimised SPC700 a bit
  • -
  • Implemented primitive Mode 5, 512 horizontal resolution. To get full potential of this mode, use 640x480 resolutions except for interpolated/nonscanline mode.
  • -
  • Improved 65816 <-> SPC700 communication
  • -
  • Slightly improved sound skipper
  • -
  • Fixed a directory changing bug
  • -
  • Implemented Scanlines for 640x480x256 video mode
  • -
  • Added a temporary command line to enable sound compression buffering (-Q)
  • -
  • Added a extra menu which pops out when you press F1
  • -
  • Added snapshot feature. Press F1 and select Save Snapshot ZSNES saves 256 color under image.pcx and 65536 under image.bmp.
  • -
  • Added FPS feature. At the moment, it only works when auto frame rate is used.
  • -
  • 65816 bugfix : x flag is supposed be used in MVN/MVP
  • -
  • Fixed up color addition/subtraction clipping a bit
  • -
  • Added Scanlines, Interpolation, Enterskip, and Force 8-bit sound in zsnes.cfg
  • -
  • GUI now saves the loading directory
  • -
  • Added a separate save directory feature in zsnes.cfg.
  • -
  • SPC700 bugfix : fixed mem.bit addressing mode. Thanks to Phoenix for this info!
  • -
  • Fix up a bug where more memory was cleared than needed in 256 color video memory processing
  • -
  • Optimised video memory clearing in 65536 color mode
  • -
  • Minor optimisations to the 65816/SPC700
  • -
  • Implemented Mode 7 Tile #0 Repetition
  • -
  • Rewrote most of the Mode 7 routines for speed
  • -
  • Fixed a 65536 color Mode 7 bug where the background wasn't cleared properly
  • -
  • Added Pro Action Replay, Gold Finger,and Game Genie cheat code support
  • -
  • Optimised Memory/Register accessing routines
  • -
  • Used a newer version of Sidewinder driver. Should fix some problems and also support 2 sidewinder pads (not tested yet). Thanks Robert! Also, thanks to Sardu for helping to get it to work right!
  • -
  • Whoops! 256 Color palette was set when GUI is exited in 16-bit mode. Hopefully fixed now.
  • -
  • Added the ability to Clear/Disable/Enable cheat codes through the menu.
  • -
  • Optimised Graphics Decompression Routines. Thanks to Nerlaska for this info!
  • -
  • A Bunch of other Minor Bugs Fixed.
  • -
-
- -
-

v0.270 - December 25, 1997

- -
    -
  • Properly cleared memory when loaded off of the GUI
  • -
  • Implemented realtime adsr/gain switch. Special thanks to Sardu for help on this!
  • -
  • Fixed up a VESA 2 error message
  • -
  • Temporarily disabled Sound Compress buffering till we can get the bugs out.
  • -
  • Volume fixes to the sound DSP
  • -
  • Fixed up > 16mbit LoROM support
  • -
  • Added partial 48mbit ROM support (no games seems to work yet + 9MB mem required)
  • -
  • Fixed a SRAM Memory Map Bug
  • -
  • Fixed a bug in old style joystick read
  • -
  • Disabled sram save using tilde key. Instead, enter/exit the GUI since it also saves the sram.
  • -
  • Added panic key which turns back on all sound channels and backgrounds. Press 6 to activate this.
  • -
  • Added snes mouse support! Use 7 to switch between keyboard and mouse. Thanks to Y0SHi for info on this!
  • -
  • Panic key now turns off mouse when mouse is enabled
  • -
  • Fixed a minor IRQ bug
  • -
  • Fixed a HDMA bug. Thanks to Lord Esnes for help on this!
  • -
  • Fixed a timing bug. Thanks to TaNdRuM for help on this!
  • -
  • Fixed up some Fixed color add/sub bugs
  • -
  • Implemented OBJ Name Base Select. Thanks to Y0SHi for info!
  • -
  • Windowing was off by 1 pixel. Now fixed.
  • -
  • Fixed Screen Add/Sub on back area
  • -
  • Added support for 4 and 6 button joysticks
  • -
  • Added support for sidewinder joypads
  • -
  • Fixed a VESA 2.0 bug. It should be more compatible now.
  • -
  • Implemented Interpolation for 640x480x65536 mode. Use -Y to enable.
  • -
  • Modified sound mixing code a bit
  • -
  • Added GUI disable in zsnes.cfg. Add this if you want to disable the GUI GUIDisable = 1
  • -
  • Implemented Directory Changing in the GUI
  • -
  • Fixed a bug where it crashed when loading some ROMs
  • -
  • Fixed an ADSR sustain bug. Thanks to Trepalium for help on this!
  • -
-
- -
-

v0.201b - November 5, 1997

- -
    -
  • Fixed up Save State Selection bug
  • -
-
- -
-

v0.201 - November 5, 1997

- -
    -
  • Fixed up PAL/NTSC detection when GUI is used
  • -
  • GUI now doesn't enter load when no files are found. Thanks to ScanT for reporting this!
  • -
  • Sped up execution loop a bit
  • -
  • Fixed up a major save state conversion bug. Old save states should work better now.
  • -
-
- -
-

v0.200 - November 4, 1997

- -
    -
  • Reg$2137 was calculating the horizontal position incorrectly
  • -
  • Fixed up a looping bug in sound DSP. Thanks to EFX for some help on this!
  • -
  • Added Key to dump SRAM to Harddisk (tilde key, ~) during game
  • -
  • Fixed up gain sound effects
  • -
  • Fixed a couple of SPC timer bugs
  • -
  • Added Stereo Sound! (Use -Z)
  • -
  • Added some precision to the DSP (this seemed to have slowed emulation down)
  • -
  • Changed Real Time State Save Format. However, ZSNES will automatically convert from an older format. Some problems may come up because of the many changes in the dsp.
  • -
  • Fixed up a sprite ordering bug. Thanks to Y0SHi!
  • -
  • Added Scanlines (Use -N) Only available for 256x256/640x480x65536
  • -
  • Adjusted SPC timers
  • -
  • Fixed up BG Mode 0 display
  • -
  • Fixed up a bug that crashes when hirom sram is accessed
  • -
  • Fixed up a VIRQ bug
  • -
  • Added a simple, yet effective dsp timer wait substitute. Seems to make many games run much faster with sound!
  • -
  • Fixed VRAM increment bug. Special thanks to Trepalium for this info!
  • -
  • Fixed up multiple SPC bugs
  • -
  • Player 2 was still reading the joystick even though keyboard was selected. This is now fixed.
  • -
  • Added VSync (-w). Thanks to Marius Fodor for the code! Please use -f 0 when using this.
  • -
  • Added a very simple GUI. Currently, it only loads, reset, and quit. Also, load cannot change the current directory.
  • -
  • Added -m to disable the GUI
  • -
  • Added Stereo to zsnes.cfg. Add this if you want to enable stereo : Stereo = 1
  • -
-
- -
-

v0.182 - October 23, 1997

- -
    -
  • Small fix to a priority in bg4 drawing
  • -
  • Added TCALL and PCALL. Special Thanks to Gary of Snes9X!
  • -
  • Enabled the debugger (use the -d command line)
  • -
-
- -
-

v0.180 - October 22, 1997

- -
    -
  • Move the whats new stuff to readme.txt
  • -
  • Forgot to remove the end of string marker so the new vesa modes didn't show in the previous version help
  • -
  • Fixed minor SNES PPU DMA bug
  • -
  • lowered volume again
  • -
  • Fixed a vesa 2 bug issue. Nothing major
  • -
  • Removed PCALL/TCALL. If anyone knows the implementation of these instructions, please tell us. Also, we will not accept any requests to put these back on unless the info the found. Thanks.
  • -
  • Modified SPC700 cycle timing.
  • -
  • Added code that properly deinits sound blaster auto-init mode
  • -
  • Moved sound blaster interrupt code a bit
  • -
  • Added Gamma Correction (use -g # in the command line)
  • -
  • Added what the default keys are in the readme.txt (We should have done this in the first release. Oh well =) )
  • -
  • Added a new command line that can modify the % of clock cycles executed. ZSNES currently is modified so that 100% runs as many games as possible so it is strongly recommended that you do not set this. But to modify this, use -p # in the command line.
  • -
  • Hopefully fixed up sprite BG layering priorities and background priorities to the correct way. Thanks to Y0SHi for this info!
  • -
  • Fixed up key ordering in zsnes.cfg. Thanks to Michael and Aquis for reporting this! If zsnes.cfg already exists, change the button order to : B, Y, A, X, L, R
  • -
  • Fixed up set blaster detection.
  • -
  • SPC700 : Fixed up a minor flag setting bug in pop psw
  • -
-
- -
-

v0.170 - October 16, 1997

- -
    -
  • Fixed crashing bug when 8000Hz sound is selected (divide by 0 problem)
  • -
  • Forgot to add code to support Sound Blaster irqs greater than 7
  • -
  • Changed 65816 timing a bit. (should help compatibility a bit)
  • -
  • Fixed a bug in 65816 stack routines. Special Thanks to Alucard for reporting this!
  • -
  • Somewhat modified sound decompression routines
  • -
  • Somewhat sped up Mode 7
  • -
  • Fixed a minor screen add/sub bug in non-repeating mode 7
  • -
  • Added increment by 8 vram access registers
  • -
  • Video Modes should now clear the screen when init
  • -
  • ZSNES now automatically creates a default .cfg file when one is missing
  • -
  • Forgot to implement save/load state messages in 16-bit. It's there now.
  • -
  • Added a new command line : -b. This disables sound compression buffering. There is a noticeable slowdown, but this should reduce static.
  • -
  • Added sound compression buffering disable in the .cfg file. If you have an old .cfg file already, manually add this string at the end if you want to disable sound buffering : SoundBufDisable = 1
  • -
  • Added 640x480 modes for both 8 and 16 bit. VESA2 is still required and these modes are much slower too. This seems to still not work on various video cards. There's probabily a bug in VESA2 detection.
  • -
  • Fixed a sprite layering bug.
  • -
  • Reduced sound volume to prevent overflows. This seems to make the sound better, but the pitch calculations are still incorrect due to SPC bugs.
  • -
  • Fixed a screen sub bug. Thanks to Barubary!
  • -
-
- -
-

v0.150 - Initial Release - October 14, 1997

- -
-

The following are implemented :

- -
    -
  • complete 65816 instruction set (bugs still left)
  • -
  • SRAM support
  • -
  • LoROM and HiROM support
  • -
  • SlowROM and FastROM support
  • -
  • Line by line graphics engine
  • -
  • Graphic Modes 0,1,2,3,4,5,6,7
  • -
  • 8x8, 16x16, 32x32 and 64x64 sprite support (flipped in all directions)
  • -
  • Mosaic effects
  • -
  • 8x8 and 16x16 tiles
  • -
  • 32x32,64x32,32x64,64x64 tile modes
  • -
  • Full DMA support
  • -
  • Full HDMA effects for wavy backgrounds, interesting mode 7 effects, etc.
  • -
  • Mode 7 rotating and scaling effects
  • -
  • Single Windowing Routines
  • -
  • BG priorities (still needs some work)
  • -
  • Sprite Priorities (still needs some work)
  • -
  • Add/sub of back area
  • -
  • HIRQ/VIRQ/NMI Interrupts
  • -
  • Support for most snes file formats
  • -
  • Multi file format support (.1,.2,.3,A.,B.,C.)
  • -
  • 16-bit graphics support
  • -
  • PAL timing support
  • -
-
- -
-

The following are present in sound :

- -
    -
  • 16bit digital sound
  • -
  • SPC700 Sound CPU (bugs still left)
  • -
  • DSP Sound Processor -
      -
    • ADSR volume effects
    • -
    • GAIN volume effects
    • -
    -
  • -
-
- -
-

Following are present in 16-bit graphics mode :

- -
    -
  • Palette changing in the middle of a screen
  • -
  • Screen Addition (full and half)
  • -
  • Screen Subtraction (full)
  • -
  • Fixed Color Addition/Subtraction
  • -
  • Window clipping for Fixed Color (still needs work)
  • -
-
- -
-

The following are the features present in ZSNES :

- -
    -
  • Game State Save (F2=Save, F3=Select, F4=Load). Warning : A state file takes 200 kbytes of HD space!
  • -
  • Auto frame rate to give you constant Super Nintendo speed up to 12 frame skips
  • -
  • configuration file support (zsnes.cfg)
  • -
  • 2 player support w/ Joystick and Gamepad support
  • -
-
- -
-

The following features are missing :

- -
    -
  • DSP features such as noise, echo, and pitch modulation
  • -
  • Mode 7 horizontal flip and color repetition
  • -
  • Screen Subtraction (half)
  • -
  • Interleaved ROM formats
  • -
  • A few VRAM accessing modes
  • -
  • Dual Windowing support (not sure if it's worth implementing this)
  • -
-
- -
-

The following will probabily never be implemented (but who knows...) :

- -
    -
  • 512 snes horizontal resolution
  • -
  • 448/480 snes vertical Interlaced resolution
  • -
  • Raster Effects (Scrolling location change in the middle of a horizontal line. There might be a way to get through some of this)
  • -
  • EXTBG mode for mode 7 (I don't know any games that uses this)
  • -
-
- -
-

What will not run :

-
    -
  • Super FX games such as Star Fox, Yoshi's Island, etc.
  • -
  • DSP games such as Mario Kart, Pilotwings, etc.
  • -
  • Games with other special chips such as Megaman X2 and X3
  • -
  • Games that have a unique sound checking routine (if sound is disabled)
  • -
  • Games which doesn't have a valid header (use -L or -H to get it working)
  • -
  • Games that hit a severe bug in the 65816/PPU/SPC700/DSP routines
  • -
  • Games that require special timing
  • -
-
-
- - -
- - - -
- - - - diff --git a/tools/zsnes/docs/readme.htm/images/cheat.png b/tools/zsnes/docs/readme.htm/images/cheat.png deleted file mode 100644 index 6aa2ca5..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/cheat.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/images/config.png b/tools/zsnes/docs/readme.htm/images/config.png deleted file mode 100644 index 30d5784..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/config.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/images/f1_menu.png b/tools/zsnes/docs/readme.htm/images/f1_menu.png deleted file mode 100644 index 531aab9..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/f1_menu.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/images/game.png b/tools/zsnes/docs/readme.htm/images/game.png deleted file mode 100644 index 175d34b..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/game.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/images/gui.png b/tools/zsnes/docs/readme.htm/images/gui.png deleted file mode 100644 index d52fbca..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/gui.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/images/misc.png b/tools/zsnes/docs/readme.htm/images/misc.png deleted file mode 100644 index 4185393..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/misc.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/images/netplay.png b/tools/zsnes/docs/readme.htm/images/netplay.png deleted file mode 100644 index 3749db2..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/netplay.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/images/quick.png b/tools/zsnes/docs/readme.htm/images/quick.png deleted file mode 100644 index 33cb20e..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/quick.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/images/saveslot.png b/tools/zsnes/docs/readme.htm/images/saveslot.png deleted file mode 100644 index 8b3c95a..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/saveslot.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/images/zsneslogo.png b/tools/zsnes/docs/readme.htm/images/zsneslogo.png deleted file mode 100644 index 0544aad..0000000 Binary files a/tools/zsnes/docs/readme.htm/images/zsneslogo.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/index.htm b/tools/zsnes/docs/readme.htm/index.htm deleted file mode 100644 index 35b58ef..0000000 --- a/tools/zsnes/docs/readme.htm/index.htm +++ /dev/null @@ -1,181 +0,0 @@ - - - - - ZSNES Documentation Index - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/zsnes/docs/readme.htm/license.htm b/tools/zsnes/docs/readme.htm/license.htm deleted file mode 100644 index 171a678..0000000 --- a/tools/zsnes/docs/readme.htm/license.htm +++ /dev/null @@ -1,562 +0,0 @@ - - - - - GNU General Public License - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -

GNU General Public License

- - - -
-

GNU GENERAL PUBLIC LICENSE

- -

Version 2, June 1991

- -
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 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 Lesser 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. -

- -
- -
-

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: -

- -
    -
  1. a) - You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. -
  2. - -
  3. 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. -
  4. -
  5. 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.) -
  6. -
- -

- - 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: -

- -
    -
  1. 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, -
  2. -
  3. 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, -
  4. - -
  5. 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.) -
  6. -
- -

- 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  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 Lesser General -Public License instead of this License. -

- -
- -
- - - -
- - - - diff --git a/tools/zsnes/docs/readme.htm/netplay.htm b/tools/zsnes/docs/readme.htm/netplay.htm deleted file mode 100644 index fa383de..0000000 --- a/tools/zsnes/docs/readme.htm/netplay.htm +++ /dev/null @@ -1,171 +0,0 @@ - - - - - Netplay - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - -
- -
-

Netplay

- -
-

Netplay has been disabled for the indefinite future, until the core becomes more accurate and/or non-random. We recommend using ZSNES v1.36 or v1.42n until this is resolved.

-
- - - - - - - - - - - - - -
- - - -
- - - - \ No newline at end of file diff --git a/tools/zsnes/docs/readme.htm/readme.htm b/tools/zsnes/docs/readme.htm/readme.htm deleted file mode 100644 index 07c35fe..0000000 --- a/tools/zsnes/docs/readme.htm/readme.htm +++ /dev/null @@ -1,931 +0,0 @@ - - - - - Readme - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - -
- -
-

Readme

- -
-

ZSNES is an open-source Super Nintendo Entertainment System emulator written in x86 assembly, C, and C++. Bleeding with cutting edge SNES emulation, ZSNES is easily comparable to other leading SNES emulators, such as Snes9x, SNEeSe, Super Sleuth, and bsnes.

-

Special thanks to the Snes9x team for all of their help and also for the excellent SNES emulator they have developed. We wish them the very best of luck!

-
- -
-

Disclaimer

-

The ZSNES Development Team, including all developers and contributors, is in no way responsible for any damage caused by the use of this software. Please read the license for more details.

-

Due to legal issues, the ZSNES Development Team can provide you neither with ROMs nor links to them. In addition, ZSNES may not be distributed with ROM images. However, as with many cases like this, Google is your friend.

-

There are still many bugs left in ZSNES, so don't expect it to run all your favorite games. If ZSNES doesn't work for you, then don't use it. Use Snes9x, SNEeSe, Super Sleuth, or bsnes instead! In fact, even if you use ZSNES, use those emulators too!

-
- -
-

Current Progress

- -
-

The following are implemented

-
    -
  • Complete 65816 instruction set
  • -
  • SRAM support
  • -
  • LoROM and HiROM support
  • -
  • SlowROM and FastROM support
  • -
  • Full DMA support
  • -
  • HIRQ/VIRQ/NMI Interrupts
  • -
  • Support for several SNES file formats (SMC, SFC, SWC, FIG, MGD, MGH, UFO, BIN, GD3, GD7, DX2, USA, EUR, JAP, AUS, ST, BS, 048, 058, 078,), including split files (1, 2, 3; A, B, C)
  • -
  • Interleaved format support (except SuperFX games)
  • -
  • PAL/NTSC timing support
  • -
-
- -
-

Graphics engines (PPUs)

- -
-
The following are implemented in both graphics engines, all color modes:
-
    -
  • Graphic modes 0,1,2,3,4,5,6,7
  • -
  • 8x8, 16x16, 32x32, and 64x64 sprite support (flipped in all directions)
  • -
  • 8x8 and 16x16 tiles
  • -
  • 32x32,64x32,32x64,64x64 tile modes
  • -
  • Full HDMA effects for wavy backgrounds, interesting mode 7 effects, etc.
  • -
  • Mode 7 rotating and scaling effects
  • -
  • BG priorities
  • -
  • Sprite priorities
  • -
  • Add/sub of back area
  • -
  • Mosaic effects
  • -
-
- -
-
About the old graphics engine:
-
    -
  • Line engine
  • -
  • Missing lots of windowing and DMA effects
  • -
  • More accurate at drawing some things
  • -
  • 13-bit color rendering. (This is a compromise between color accuracy and speed. Not all transparencies will work correctly with this engine.)
  • -
- -
What's available in the old graphics engine when using an 8-bit color video mode:
-
    -
  • Offset per tile mode (mode 2/vertical only)
  • -
  • High-res 512 horizontal resolution (missing in 16x16)
  • -
  • Single and dual windowing routines
  • -
- -
What's available in the old graphics engine when using a 16-bit color video mode:
-
    -
  • Palette changing in the middle of a screen
  • -
  • Screen addition (full and half)
  • -
  • Screen subtraction (full)
  • -
  • Fixed color addition/subtraction
  • -
  • Window clipping for fixed color
  • -
-
- -
-
About the new graphics engine:
-
    -
  • Tile engine
  • -
  • Nearly complete engine with a few bugs
  • -
  • Can draw mostly everything on the SNES
  • -
  • 15-bit coloring
  • -
- -
What's available in the new graphics engine when using an 8-bit color video mode:
-
    -
  • Offset per tile mode (mode 2/vertical only, mode 4)
  • -
  • High res 512 resolution and 448/478 vertical resolution
  • -
  • Windowing effects
  • -
  • High resolution mode 7 (only in 640x480x256 video mode; active when all other video filters are disabled)
  • -
- -
What's available in the new graphics engine when using a 16-bit color video mode:
-
    -
  • All of old graphics engine 16-bit
  • -
  • High resolution mode 7
  • -
  • High resolution 16x16 tiles for mode 5
  • -
  • Full 15-bit color transparencies for improved picture quality (MMX compatible CPUs only)
  • -
-
-
- -
-

The following are present in sound:

-
    -
  • 16-bit digital stereo sound
  • -
  • SPC700 Sound CPU
  • -
  • DSP Sound Processor -
      -
    • Echo effects
    • -
    • FIR filter
    • -
    • ADSR volume effects
    • -
    • GAIN volume effects
    • -
    • Noise effects
    • -
    • Pitch modulation
    • -
    -
  • -
-
- -
-

The following special input devices are emulated:

- -
- -
-

The following special cartridge processors are emulated, in whole or in part:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Special ChipProgress
C4100%
Nintendo DSP-1100%
Nintendo DSP-2100%
Nintendo DSP-380%
Nintendo DSP-495%
OBC-1100%
SA-190%
S-DD1100%
Seta DSP 1099%
Seta DSP 1180%
SPC7110100% except decompression
S-RTC95%
SuperFX90%
- -
- -
-

The following add-on devices are emulated:

- - - - - - - - - - - - - - - - - -
Special Cartridge / Add-OnProgress
Broadcast Satellaview (BS-X)50%
Nintendo Super System100% except the menus
Same Game, SD Gundam G-Next100%
Sufami Turbo95%
- -
- -
-

The following features are missing:

- -
- -
-

What will not run (or not play properly):

- -

Please read our statement on game compatibility.

- -
- -
- -
-

Extra Features

- - - - -
- -
-

System Requirements

- -
-

Supported operating systems

- -
-
Official Ports
-
    -
  • Win port: Microsoft Windows 95/98/ME/2000/XP/2003/Vista
  • -
  • SDL port: Linux, BSD, Mac OS X, or Xbox running Linux
  • -
  • DOS port: Microsoft DOS (may work on other non-MS DOSes)
  • -
- -
Un-Official Ports
- -
-
- -
-

CPU requirements

- -

ZSNES absolutely requires a 100% x86-compatible processor. You probably already meet this requirement. Most consumer-grade processors sold by Intel and AMD use the x86 instruction set.

-

Because much of ZSNES' source code is written in x86 assembly, it will only run on processors that are 100% x86 compatible. "Ports" to other architectures are impossible; we recommend Snes9x as the SNES emulator of choice for portability.

-

Playing a special chip game will significantly increase CPU usage. For these games, you may require a processor faster than those listed below.

-
- -
-

Free space requirements

- -

The program files alone require about 1MB. The amount of disk space required for other files varies greatly. For example, uncompressed ROMs (not included!) require 256KB-6144KB each. Save states typically require about 270KB each; however, this can increase up to an additional 200KB for special chip games.

-
- -
-

Win Port

-
    -
  • OS: Windows 95/98/ME -
      -
    • CPU: Pentium II (or equivalent) 233MHz (500MHz recommended)
    • -
    • RAM: 32MB (64MB recommended)
    • -
    -
  • -
  • OS: Windows 2000/XP/2003/Vista -
      -
    • CPU: Pentium II (or equivalent) 266MHz (500MHz recommended)
    • -
    • RAM: 64MB of RAM (128MB recommended)
    • -
    -
  • -
  • API: DirectX v8.0a or later must be installed
  • -
  • Video: any video card that supports DirectDraw (acceleration recommended)
  • -
  • Sound: any sound card that supports DirectSound (acceleration recommended)
  • -
-
- -
-

SDL Port

-
    -
  • OS: Linux, BSD, or Mac OS X
  • -
  • CPU: 266MHz (500MHz recommended, especially if using X)
  • -
  • RAM: 32MB (64MB recommended; more if SDL is compiled to use X)
  • -
  • API: SDL v1.20 or later
  • -
  • Video: almost any video card will work (hardware OpenGL support and acceleration highly recommended)
  • -
  • Sound: any sound card supported by SDL (using ALSA or OSS)
  • -
-
- -
-

DOS Port

- -
    -
  • OS: Microsoft DOS (some non-MS DOSes may work)
  • -
  • CPU: Pentium II (or equivalent) 233MHz
  • -
  • RAM: 32MB (minimum of 17MB free, required for loading 48mbit ROMs)
  • -
  • Video: VGA card -
      -
    • For 16-bit color and therefore proper support of transparencies, an SVGA card with VESA 2 and Linear Frame Buffer support is required.
    • -
    • You may be able to use Scitech Display Doctor to enable VESA 2 support on some cards that don't already support it.
    • -
    -
  • -
  • Sound: Sound Blaster Pro or 100% compatible (SB16 or 100% compatible recommended)
  • -
- -

These system requirements assume you are running the DOS port under pure DOS. If you are using the DOS port from within Windows, the CPU and RAM requirements will be the same as for the Win port.

-
-
- -
-

Installation

- -
-

Win/DOS Port

- -
-
Installation:
-
    -
  1. Download the latest version of ZSNES from ZSNES.com. The file you download is an archive containing the ZSNES binary file and documentation.
  2. -
  3. Extract the contents of the archive into a new folder on your hard drive. Do not simply overwrite an older version of ZSNES.
  4. -
  5. You can now run ZSNES by executing the ZSNES binary, named zsnesw.exe (Windows) or zsnes.exe (DOS). ZSNES is not packaged with an installer, so there will be no entry in the Windows Start Menu.
  6. -
-

Note: In Windows, you can create a shortcut to ZSNES to make it easier to open the program. Right-click on the zsnesw.exe icon to bring up the context menu, and left-click Create Shortcut. A shortcut to the executable file will appear in the folder. You can now move the newly-created shortcut to your Desktop or Start Menu. Opening the shortcut will run ZSNES from its original location.

-
- -
-
Re-Installation / Reset to default settings:
-

If you find that you are experiencing a number of unexplained errors in ZSNES, or if you wish to reset all settings back to their defaults, simply delete the configuration files that were generated by ZSNES the first time you ran the program.

-
- -
-
Un-Installation:
-

If you wish to uninstall ZSNES, simply delete the entire folder (and thus, all files contained within) into which you installed ZSNES (as described in Step 2 of Installation, above).

-

-or-

-

If you have since put additional files (such as ROMs) into your ZSNES install folder, and do not wish to delete or move them, you will have to delete the individual ZSNES files. Please refer to the Files section for information on individual files and file types related to ZSNES. You will also need to delete the docs folder.

-

Note: ZSNES does not use the Windows registry, nor does it generate "hidden" configuration files all over your system.

-
-
- -
-

SDL Port / Compiling from source

-
    -
  • Download the latest source release of ZSNES from ZSNES.com.
  • -
  • After unpacking, navigate to the src directory and run the following commands: -
      -
    • ./configure --enable-release
    • -
    • make
    • -
    - And as root: -
      -
    • make install
    • -
    -
  • -
  • Other, more detailed instructions are provided in the docs/install.txt file.
  • -
-
- -
-
Un-Installation:
-

If you wish to uninstall ZSNES, you can run make uninstall as root if you still have your Makefile.

-

Otherwise, you will need to navigate to /usr/local/bin and delete zsnes. Then navigate to /usr/local/man/man1 and delete zsnes.1. Or just delete the man1 directory if you have nothing else in it.

-

You will need root access to perform the above actions.

-

You will also need to delete ~/.zsnes or ~/Library/Application Support/ZSNES in Mac OS X. Do note that various files are saved in here by default (such as game saves); be sure to back them up if you want to keep them.

-
-
- -
-

Basic Usage

- -
    -
  1. Install ZSNES.
  2. -
  3. Run ZSNES. -
      -
    • If you're using Windows, double-click on the executable file.
    • -
    • If you're using DOS, navigate to the ZSNES installation folder and type zsnes.exe at the command line.
    • -
    -
  4. -
  5. Configure the input settings (Config Menu -> Input) as desired, or use the default settings.
  6. -
  7. Configure the video settings (Config Menu -> Video) as desired, or use the default settings.
  8. -
  9. Configure path settings (Config Menu -> Paths) if you don't want all the automatically generated files going into the same directories as your ROMs.
  10. -
  11. Load a game (Game Menu -> Load) and start playing.
  12. -
  13. When you are ready to stop playing, you have a number of choices to save your game. -
      -
    • If your game has its own native save function, just use it.
    • -
    • If your game does not have a save function, or you are at a point in the game where you can't save, you can create a save state. Do this by pressing F2.
    • -
    -
  14. -
  15. After you save your game: -
      -
    • You can load a new game using the same steps as above, or
    • -
    • Exit the emulator by going to Game Menu -> Quit.
    • -
    -
  16. -
  17. When you are ready to return to a previously saved game, just re-load that game. -
      -
    • Load an in-game save in the normal way.
    • -
    • If you saved a state, you can load that state by pressing F4.
    • -
    -
  18. -
- -

This section only covers very basic usage. Please read the entire documentation for more information.

-
- -
-

Default Keys

- -
-

Game Keys

- -

You can change the default keys for the standard SNES controller under Config->Input.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SNES ButtonPlayer 1 KeyPlayer 2 Key
D-Pad UpArrow UpJ
D-Pad DownArrow DownM
D-Pad LeftArrow LeftN
D-Pad RightArrow Right,
StartReturn / EnterLeft Ctrl
SelectRight ShiftLeft Alt
AXHome
BZEnd
XSInsert
YADelete
L (Left Shoulder)DPage Up
R (Right Shoulder)CPage Down
- -

You can change the default keys for special input devices under Config->Devices.

-

The special input devices just use input from your mouse for movement and aiming.

- - - - - - - - - - - - - - - - - -
Super Scope ButtonComputer/Mouse Button
FireLeft mouse button
Cursor Mode ButtonRight mouse button
Toggle Auto-fire=
PauseBackspace
- -
- -
-

Emulator Keys

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyFunctionWhere to Customize
EscWhen a game is loaded, toggle the GUI (pauses emulation while GUI visible).Cannot be changed
F1Open the F1 Quick Menu.Cannot be changed
F2Save a state to current slot.Config->Saves
F3Open the save state slot chooser.Config->Saves
F4Load a save state from the current slot.Config->Saves
F5 <--> F12Toggle sound channels 1 through 8, respectivelyMisc->Misc Keys
1 2 3 4Toggle background layers 1, 2, 3, and 4, respectivelyMisc->Misc Keys
5Toggle sprite/object layerMisc->Misc Keys
6Panic Key - Reset all switches to default (enable Offset Mode, Windowing, all background layers, sprite/object layer, and sound channels; disable Add-on Devices; reset Emulation Speed Throttle)Misc->Misc Keys
8Toggle New Graphics EngineMisc->Misc Keys
9Toggle WindowingMisc->Misc Keys
0Toggle Offset ModeMisc->Misc Keys
TWhile using Netplay, press to open the Chat windowMisc->Misc Keys
~Fast ForwardConfig->Speed
PPause EmulationConfig->Speed
-

Note: Besides these default keys, there are many other keys that you can configure in the GUI.

-
-
- -
-

Save States

- -

Warning: If you care about your progress in a game, remember to use in-game saves regularly! Do not rely solely on save states!

-

When you "save a state," ZSNES creates a file that contains the values of all the variables that change while ZSNES is emulating a game. These values are specific to the exact moment that you saved the state. You can then load a save state at a later time, thus returning ZSNES to the exact point in the game when you saved the state originally. This allows you to save your progress at a point that might not normally be possible with in-game saves, or in games that don't have in-game saves at all.

-

Save states are typically not compatible between emulators, and sometimes not even between different versions of the same emulator, often due to internal core changes. In fact, it should be noted that save states created prior to v0.600 of ZSNES will not work in current versions.

-

To remedy this problem, first load the state in any version of ZSNES from v0.600 to v1.42. Then, immediately after loading, save another state. The new state you just created should (hopefully) load correctly in ZSNES v1.50 and higher.

-

Since ZSNES does not support save states created by any other SNES emulator, you can instead use the emulator-independent SRAM (.srm) data to transfer game progress from one emulator to another.

-

Each ZSNES save state is approximately 270KB in size. Special chip games may require an additional 200KB, however.

- -
-

How to Use Save States

-

You can create and load save states using the GUI.

-

It's much easier to just use the default quick keys for these features. Press F2 to save, F4 to load, and F3 to open the save state slot chooser (with graphical preview). However, if you don't like that method, many other save and load techniques are available.

-

Configure general save behavior under Config->Saves. Configure save paths under Config->Paths.

-
-
- -
-

Movies

- -

Warning: Playing back a previously recorded movie will overwrite any SRAM data for the current game with the SRAM data contained in the ZMV file. This means you should enable Do Not Save SRAM when playing around with movies!!

-

Note that re-recording, chapters, and appending will not work with movies recorded in the old ZMV format (movies made prior to ZSNES v1.50).

-

For descriptions of the Movie Options dialog, please refer to the GUI page.

- -
-

About Movies

-

The ZSNES movie format (ZMV) has been completely rewritten and is now better and more feature-rich than before, with the most capabilities yet implemented in an emulator. Three of the most notable new features are re-recording, dumping ZMVs to AVI, and movie subtitles, described below.

-

A movie file consists of a save state, SRAM data (when applicable), and the recorded controller data, as well as any chapters (states) that have been inserted. It also keeps track of a few other things which are negligible with regard to the overall filesize. Movie files should record at less than 1KB/minute (60KB/hour).

-

ZSNES should be able to record most actions you can do with a real SNES, including resetting. During playback, the game will reset just as you did during recording.

-
- -
-

Limitations

-

You cannot record games that use the Konami Justifier special input device. Lethal Enforcers is the only game known to require this device.

-

You cannot record games while using Netplay.

-

You should be able to record ZSNES movies for all game types; however, ZMVs are heavily dependant on save states, so any games that exhibit problems while using save states will also exhibit problems when recording and playing movies.

-

For best results, you should play back movies with the same version of ZSNES that was used to record them. Otherwise, keypresses may become desynchronized from the emulation playback.

-
- -
-

Re-Recording

- -

You do not have to do everything perfectly the first time you record a movie. ZSNES allows you to re-record parts of a movie, inserting the newly recorded parts seamlessly into the previously recorded parts. You can accomplish this in a number of ways:

-
    -
  • While playing back a movie, start recording again.
  • -
  • Use save states while recording movies. Loading the states will allow you to re-record.
  • -
  • You can use the rewind key to go back in movies. The rewind key can be configured under the Config->Saves menu.
  • -
- -
- -
-

Chapters

-

You can insert chapters into your movies, to which you can seek during movie playback.

-

You are limited to 65535 (216-1) chapters created during recording, in addition to 65535 (216-1) created during playback.

-
- - -
-

Subtitles

- -

Subtitles allow you to create a short message that will be visible on-screen during playback of a movie.

- -
    -
  1. Create an empty file in your save directory (or wherever your movies are saved).
  2. -
  3. The subtitle file must be named in the following manner: -
      -
    • Subtitle file name = ZMV file name = ROM file name. (Example: smw.sfc (Super Mario World ROM), smw.zmv, smw.sub).
    • -
    • If you are using movie slot 0, file extension = .sub.
    • -
    • If you are using movie slot 1 through 9, change the last letter of the extension to match the movie slot you are using. (Example: slot 1 = .su1, slot 5 = .su5, slot 9 = .su9).
    • -
    -
  4. -
  5. For each subtitle you want in the movie, add a new line to the subtitle file, with the following information: -
      -
    • Start Frame:Frame Duration:Message
    • -
    • For example: 10:100:Beating the Last Boss without the quotes. In this example, the message "Beating the Last Boss" will appear in the tenth frame and stay visible for 100 frames (thus, until the 110th frame).
    • -
    • ZSNES can display only one subtitle at a time. So make sure that the start frame for the next subtitle is not during the duration time of the previous subtitle. You must also list your subtitles sequentially for all of them to be played (they cannot be out of order).
    • -
    • ZSNES can display a maximum of 34 characters (of a subtitle message) across the width of the screen.
    • -
    -
  6. -
  7. Now save your new subtitle file. Open ZSNES, play a movie, and you should see your subtitles appear!
  8. -
-
- -
-

Movie Dumping

-

See the Movie Dumping section of the Advanced Usage page for more information.

-
-
- -
-

IPS Patching

- -

IPS patches are files that are applied to an original ROM, which change the programming of the ROM in some way. They are primarily used to translate ROMs into another language; however, they can be used for a variety of purposes. Visit Romhacking.net for more information about translations and ROM hacks.

-

ZSNES has the ability to automatically "soft-patch" a ROM. This means that after ZSNES loads a ROM into its memory, it will apply the IPS patch to the in-memory ROM data, not the ROM file on your hard disk. This eliminates the need to keep two copies of a ROM: the original, and the patched.

- -
-

Applying a single IPS file to a ROM:

-
    -
  1. Make sure Enable Auto-Patch is checked in Config->Options.
  2. -
  3. The IPS file must be either in your Saves directory or in the same directory as the ROM.
  4. -
  5. The IPS file and the ROM file must have matching filenames. For example, SD3.sfc and SD3.ips. If your ROM file is compressed, the IPS file must match the compressed filename. For example, if you have the file SD3.sfc compressed inside the file Seiken Densetsu 3 (J).zip, the IPS file must be named Seiken Densetsu 3 (J).ips.
  6. -
  7. If you meet the above three conditions, just load your ROM file as normal, and ZSNES should automatically patch the IPS file to the in-memory ROM. Remember, your original ROM file will not be changed.
  8. -
  9. If you have done everything outlined in the steps above, and your game does not appear to be working, refer to the FAQ.
  10. -
-
- -
-

Applying multiple IPS files to a ROM:

-

ZSNES has the ability to apply up to eleven separate IPS files to the same ROM file. You must give each IPS file a specific extension to tell ZSNES in what order to apply them. Aside from changing the extension of the IPS files, just follow the directions above.

- - - - - - - - - - - - - - - - -
IPS file extensionApplied When?
ipsFirst
ip0Second
ip1Third
ip2Fourth
ip3Fifth
ip4Sixth
ip5Seventh
ip6Eighth
ip7Ninth
ip8Tenth
ip9Eleventh
-

ZSNES will not apply non-sequentially extensioned IPS files. This means that if you have three IPS files, named patch.ips, patch.ip0, and patch.ip6, ZSNES will only apply the first two.

-

Please remember that the order in which you apply the IPS patches may be important. Applying the patches in the wrong order may result in strange bugs, or even an unplayable game. Please refer to the documentation that accompanied your IPS file.

-
- -
-

Alternative method of applying IPS files to compressed ROMs:

-

The simplest method of applying an IPS file to a compressed ROM is to simply place the IPS file in the same archive as the ROM. The filename of the IPS file does not have to match the compressed or uncompressed filename of the ROM. Do not add more than one IPS file of a given extension to an archive. Results can be unpredictable as to which of the same-extension IPS files will be applied to the ROM.

-

If your ROM is compressed, ZSNES will first look for IPS files inside the archive. If it finds any, it will only load IPS files from inside the archive, and will not look anywhere else. Otherwise, ZSNES looks in the Saves directory and the same directory as the ROM.

-
-
- -
-

Cheat Codes

- -

Currently, ZSNES supports Game Genie, Pro Action Replay, and GoldFinger codes.

- -
-

How to use cheat codes:

-
    -
  1. Load the ROM to which you want to apply cheats.
  2. -
  3. Press ESC to toggle the GUI. Open the Add Code dialog from the Cheat Menu. You can enter up to 255 codes for each game.
  4. -
  5. After adding your codes, press ESC until you are back to your game.
  6. -
- -

To use a multi-line cheat code, just enter each line as a separate code!

-
- -
-

How to use .cht files:

-

Place the .cht file into the same directory as the ROM, or into your Saves folder. The .cht file must be named according to the normal naming rules.

-
- -
-

Troubleshooting Cheat Codes

-
    -
  • Try using the Fix button in the Browse Cheats dialog.
  • -
  • Some codes are meant to be used with different versions of the same game. If a cheat code doesn't work and there is one for both Game Genie and Pro Action Replay, try them both.
  • -
  • Remember that Game Genie codes require the - (dashes).
  • -
  • Try resetting the game. Any code for a game that mentions a term similar to "Start with" means that the game must be reset in order to take effect.
  • -
  • If you are having a hard time with comparative searches, make sure to delete the tmpchtsr.___ file in your ZSNES directory.
  • -
-
-
- -
-

Files

- -

This section attempts to explain the various files that are created, loaded, or used by ZSNES.

- -
-

Most of the data files that are specific to individual ROMs are named in the following manner:

-
    -
  • The filename of the data file is the same as the filename of the ROM from which it was created.
  • -
  • The file extension of the data file changes, depending on the following: -
      -
    • If there are no "slots" for the data file, then it is just the normal file extension (srm, bmp, png, raw, cht, cmb, cfg, txt).
    • -
    • If you are using slot 0, then it is just the normal file extension (zst, zmv, sub, ips, spc).
    • -
    • If you are using slots 1-9, then the last letter of the file extension changes to match the slot number (zs1-zs9).
    • -
    • If you are using slots 10-99, then the last two letters of the file extension change to match the slot number (z10-z99).
    • -
    -
  • -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
File NameFile ExtensionFile Type NameDescriptionWhere Created?
Whatever you want, or have them automatically named by NSRT.smc, sfc, swc, ...ROM (Game)These are common extensions for ROMs, which are computer files of the game data on real SNES cartridges.Wherever you put them.
romnamesrmStatic RAMThis is the in-game save file. It is automatically generated by ZSNES when you use the in-game save function. Some games use Static RAM as working RAM rather than to save a game. This format should be compatible among all emulators.Saves folder
romnamezst, zs1-zs9, z10-z99, zssZSNES Save StateSee the Save States section for more information.Saves folder
romnamezmv, zm1-zm9ZSNES MovieSee the Movies section for more information.Saves folder
romnamemzt, mz1-mz9ZSNES Movie StatesDirectories which contain the various save state data for that particular movie. See the Movies section for more information.Saves folder
romnamesub, su1-su9ZSNES SubtitleSee the Subtitles section for more information.Saves folder
romnameips, ip0-ip9International Patching SystemSee the IPS Patching section for more information.Saves folder, Same folder as ROM
romname_***** / img*****bmp, pngImagesThese are snapshots of the game screen, created by ZSNES when you use the F1 Menu. The file name is appended by a number, up to 99999.Snapshots folder
romnamespc, sp1-sp9, s10-s99SPC SoundThese files are created by ZSNES when you dump the SPC data of the game you are playing by using the F1 Menu. Note: In Windows, the .spc extension is sometimes used for PKCS Certificates.SPCs folder
romnamechtCheat DataThis file contains cheat codes that you entered using the Cheat Code Editor. These files are generally compatible between different versions of the same emulator, but not necessarily between different emulators.Saves folder
romnamecmbKey Combination DataThese files contain key combination data, created when you use the Key Combination Editor.Saves folder
romnameinpZSNES Input These files contain input configuration for the specific game.Saves folder
sounddmprawSound Buffer DumpThis is a dump of sound buffer data, created when you use the appropriate F1 Menu option.SPCs folder
datacmbKey Combination DataThis file contains key combination data, created when you use the Key Combination Editor for an unspecific game.ZSNES folder (Win/DOS) / ~/.zsnes (SDL) / ~/Library/Application Support/ZSNES (SDL - Mac OS X)
zsnes / zsneswexe (Win/DOS)ZSNES executableThis is the main ZSNES executable binary file."ZSNES Folder" means the location of this executable
zsnes / zsnesw / zsneslcfgZSNES Configuration FileUser-editable configuration file where you can set almost any option in ZSNES.ZSNES folder (Win/DOS) / ~/.zsnes (SDL) / ~/Library/Application Support/ZSNES (SDL - Mac OS X)
zmoviecfgZSNES Movie Configuration FileUser-editable configuration file where you can change advanced movie dumping features.ZSNES folder (Win/DOS) / ~/.zsnes (SDL) / ~/Library/Application Support/ZSNES (SDL - Mac OS X)
zinputcfgZSNES Input Configuration FileUser-editable configuration file where you can change settings for controllers and extra SNES devices. This is the same as the files with the .inp extension, but is used globally.ZSNES folder (Win/DOS) / ~/.zsnes (SDL) / ~/Library/Application Support/ZSNES (SDL - Mac OS X)
zfonttxtZSNES Font Configuration FileThis is where the appearance of text in the ZSNES GUI is configured.ZSNES folder (Win/DOS) / ~/.zsnes (SDL) / ~/Library/Application Support/ZSNES (SDL - Mac OS X)
rominfotxtROM InformationThis contains information about the ROM you most recently ran. You can configure this behavior under Config->Options.ZSNES folder (Win/DOS) / ~/.zsnes (SDL) / ~/Library/Application Support/ZSNES (SDL - Mac OS X)
-
- -
- - - -
- - - - \ No newline at end of file diff --git a/tools/zsnes/docs/readme.htm/styles/corner.png b/tools/zsnes/docs/readme.htm/styles/corner.png deleted file mode 100644 index ffd1f86..0000000 Binary files a/tools/zsnes/docs/readme.htm/styles/corner.png and /dev/null differ diff --git a/tools/zsnes/docs/readme.htm/styles/jipcy.css b/tools/zsnes/docs/readme.htm/styles/jipcy.css deleted file mode 100644 index 15b14b9..0000000 --- a/tools/zsnes/docs/readme.htm/styles/jipcy.css +++ /dev/null @@ -1,143 +0,0 @@ -/* Jipcy's style. -This is used as the default stylesheet for the NSRT guide, and an alternative stylesheet for the docs proper. */ - -/* ALL PROPERTIES ARE ALPHABETIZED!!! KEEP THEM THAT WAY!!! */ - -@import url(shared.css); /* Loads shared.css, which contains shared styling information. */ -@import url(release.css); /* Loads release.css, which contains styling information specific to public releases of the docs. */ - -body { - background-color: white; - color: black; - font-family: Verdana, "Arial Unicode MS", Arial, sans-serif; - margin: 0em; /* Removes default ~0.5em margin between the body and the view port. */ -} - -a img { - border-width: 0px; -} - -#header { - background-color: #C8CFD8; - border-bottom: solid 1em #00CC99; - color: inherit; -} - -#header #logo { - margin: 5px 7px 0px 7px; /* Compensates for the apparent non-centering in the logo image itself. */ -} - -#header h1 { - display: inline; - margin-left: 1em; - text-align: right; -} - -#nav_column { - float: left; - margin: 1em; - width: 15em; -} - -#navigation { - border: solid 1px #00CC99; -} - -#navigation h2, #content h2, #content h3 { - background-color: #00CC99; - color: inherit; - margin: 0px 0px 1px 0px; - padding: 0.1em 0.5em 0.1em 0.5em; -} - -#navigation a:hover, #content a:hover { - background-color: #00CC99; - color: inherit; -} - -#navigation ul { - list-style-type: none; - margin: 0em; - padding-left: 0.5em; -} - -#navigation ul li { - font-weight: bold; - margin: 0.3em 0em 0.3em 0em; -} - -#navigation ul ul { - margin-top: 0.45em; - padding-left: 1.2em; -} - -#navigation ul ul li { - font-weight: normal; - margin: 0em; -} - -#navigation ul ul a { - text-decoration: none; -} - -#content_column { - margin: 1em 1em 1em 17em; - min-width: 40em; -} - -#content { - border-bottom: solid 3px black; - max-width: 60em; - margin: auto; - padding-bottom: 1em; -} - -#content h4 { - background-color: #00FFCC; - color: inherit; - margin: 0px 0px 1px 0px; - padding: 0.2em 1.5em 0.2em 1.5em; -} - -#content h5 { - margin-bottom: -1em; -} - -#content img { - margin-bottom: 0.5em; - margin-top: 0.5em; -} - -#footer { - clear: both; /* This is mainly for pages that might be shorter than the nav-list on the left. Keeps things looking correct. */ - font-size: 0.7em; - font-weight: bold; - text-align: center; -} - -#footer h2 { - display: none; -} - -/* Use
for a FAQ question. */ -dt { - font-weight: bold; - margin-left: 1.5em; - text-indent: -1.5em; -} - -/* Use
for a FAQ answer. */ -dd { - margin-bottom: 1em; - margin-left: 1.5em; - text-indent: -1.5em; -} - -dd p { - margin-top: 1em; - text-indent: 0em; -} - -dd ul { - text-indent: 0em; -} \ No newline at end of file diff --git a/tools/zsnes/docs/readme.htm/styles/plaintxt.css b/tools/zsnes/docs/readme.htm/styles/plaintxt.css deleted file mode 100644 index 8b9fe85..0000000 --- a/tools/zsnes/docs/readme.htm/styles/plaintxt.css +++ /dev/null @@ -1,18 +0,0 @@ -/* The Plain Text stylesheet. -The goal with this style is to make the docs look as much as possible like the text version of the docs. */ - -/* ALL PROPERTIES ARE ALPHABETIZED!!! KEEP THEM THAT WAY!!! */ - -body { - font-family: "Lucida Console", "Courier New", Courier, monospace; - font-size: 10pt; - width: 48em; -} - -img { - display: none; -} - -a:after { - content: " [" attr(href) "]"; -} diff --git a/tools/zsnes/docs/readme.htm/styles/print.css b/tools/zsnes/docs/readme.htm/styles/print.css deleted file mode 100644 index d4346d1..0000000 --- a/tools/zsnes/docs/readme.htm/styles/print.css +++ /dev/null @@ -1,47 +0,0 @@ -/* The stylesheet used for printing. -This stylesheet is used to render the docs nicely for printing. */ - -/* ALL PROPERTIES ARE ALPHABETIZED!!! KEEP THEM THAT WAY!!! */ - -@import url(shared.css); /* Loads styles/shared.css, which contains shared styling information. */ - -body { - background-color: white; - color: black; - font-family: Verdana, "Arial Unicode MS", Arial, sans-serif; - font-size: 10pt; - margin: 1px; -} - -img { - display: none; -} - -a { - background-color: inherit; - color: black; -} - -#content a:after { - content: " [" attr(href) "]"; -} - -#nav_column { - display: none; -} - -#content code { - background-color: inherit; - color: black; -} - -#footer { - clear: both; /* This is mainly for pages that might be shorter than the nav-list on the left. Keeps things looking correct. */ - font-size: 0.7em; - font-weight: bold; - text-align: center; -} - -#footer h2 { - display: none; -} \ No newline at end of file diff --git a/tools/zsnes/docs/readme.htm/styles/radio.css b/tools/zsnes/docs/readme.htm/styles/radio.css deleted file mode 100644 index f148b3f..0000000 --- a/tools/zsnes/docs/readme.htm/styles/radio.css +++ /dev/null @@ -1,191 +0,0 @@ -/* Radio's style. -This style is designed to mimic the ZSNES.com style, which was designed by Radio. This is the default style for the docs. */ - -/* ALL PROPERTIES ARE ALPHABETIZED!!! KEEP THEM THAT WAY!!! */ - -@import url(shared.css); /* Loads styles/shared.css, which contains shared styling information. */ -@import url(release.css); /* Loads styles/release.css, which contains styling information specific to public releases of the docs. */ - -body { - background-color: white; - color: black; - font-size: 100%; /* Even though this line seems counter-intuitive, it fixes font scaling in Internet Explorer. */ - margin: 0em; /* Removes default ~0.5em margin between the body and the view port. */ -} - -a:link, a:active, a:visited { - background-color: inherit; - color: #203040; -} - -a:hover { - background-color: #A4A9B0; - color: black; -} - -a img { - border-width: 0px; -} - -#header { - background-color: #C8CFD8; - border-bottom: solid 1em #A4A9B0; - color: inherit; -} - -#header a, #footer a /* Grouped selectors here; please take note. */ -{ - background-color: inherit; - color: inherit; -} - -#header #logo { - margin: 5px 7px 0px 7px; /* Compensates for the apparent non-centering in the logo image itself. */ -} - -#header h1 { - display: inline; - font-family: Verdana, "Arial Unicode MS", Arial, sans-serif; - margin-left: 1em; - text-align: right; -} - -/* nav_column and content_column are necessary to achive perfect margins */ -#nav_column { - display: inline; /* Thanks Roman Rudenko. This fixes the floated column in Internet Explorer. */ - float: left; - margin: 0.65em; - width: 11.2em; -} - -#navigation, #content /* Grouped selectors here; please take note. */ -{ - background-color: #C8CFD8; - border: solid 1px black; - color: inherit; - padding: 1px 1px 0.5em 1px; -} - -#navigation h2, #content h2, #content h3, #content h4 /* Grouped selectors here; please take note. */ -{ - font-family: Arial, "Arial Unicode MS", sans-serif; - font-size: 0.9em; - margin: 0px 0px 1px 0px; -} - -#navigation h2, #content h2 /* Grouped selectors here; please take note. */ -{ - background-color: #A4A9B0; - background-image: url( 'corner.png' ); - background-position: top right; - background-repeat: no-repeat; - color: inherit; - padding: 5px 0.5em 5px 0.5em; /* The top/bottom margins measured in px are required to get perfect line-up with the background image, at default font size. */ -} - -#navigation ul { - font-family: Verdana, "Arial Unicode MS", Arial, sans-serif; - font-size: 90%; - list-style-type: none; - margin: 0em; - padding-left: 0.5em; -} - -#navigation ul li { - font-weight: bold; - margin: 0.3em 0em 0.3em 0em; -} - -#navigation ul ul { - margin-top: 0.45em; - padding-left: 1.2em; -} - -#navigation ul ul li { - font-weight: normal; /* Un-bold the sub-list. */ - margin: 0em; -} - -#navigation ul ul a { - text-decoration: none; -} - -/* nav_column and content_column are necessary to achive perfect margins */ -#content_column { - margin: 0.65em 0.65em 0.65em 12.5em; - min-width: 22em; /* When text is resized really big, and the window is really small, this makes it not look like crap. */ -} - -#content /* Grouped with #navigation, above. */ -{} - -#content h2 /* Grouped with #navigation h2, above. */ -{} - -#content h3 /* Grouped with #navigation h2, above. */ -{ - background-color: #A4A9B0; - color: inherit; - padding: 0.2em 0.5em 0.2em 0.5em; -} - -#content h4 { - background-color: #B3B8BF; - color: inherit; - padding: 0.2em 1.5em 0.2em 1.5em; -} - -#content h5 /* Closes the gaps between headers and the content below them. */ -{ - margin-bottom: -1em; - margin-top: 0.5em; -} - -#content h5, #content p, #content ul, #content ol, #content dl, #content table { - font-family: Verdana, "Arial Unicode MS", Arial, sans-serif; -} - -#content h5, #content dl, #content p, #content table /* Do not change the margins on lists! Internet Explorer has some weird ideas about them! */ -{ - margin-left: 0.6em; - margin-right: 0.6em; -} - -#content img { - margin: 0.5em; -} - -#footer { - clear: both; /* This is mainly for pages that might be shorter than the nav-list on the left. Keeps things looking correct. */ - font: bold 0.7em Verdana, "Arial Unicode MS", Arial, sans-serif; - text-align: center; -} - -#footer h2 { - display: none; -} - -/* Page Specific */ - -/* Use
for a FAQ question. */ -dt { - font-weight: bold; - margin-left: 1.5em; - text-indent: -1.5em; -} - -/* Use
for a FAQ answer. */ -dd { - margin-bottom: 1em; - margin-left: 1.5em; - text-indent: -1.5em; -} - -dd p { - margin-top: 1em; - text-indent: 0em; -} - -dd ul { - text-indent: 0em; -} \ No newline at end of file diff --git a/tools/zsnes/docs/readme.htm/styles/release.css b/tools/zsnes/docs/readme.htm/styles/release.css deleted file mode 100644 index ff9d5db..0000000 --- a/tools/zsnes/docs/readme.htm/styles/release.css +++ /dev/null @@ -1,5 +0,0 @@ -/****This file has styling information that changes depending on the medium through which the docs are released.****/ - -.web_only { - display: none; -} diff --git a/tools/zsnes/docs/readme.htm/styles/shared.css b/tools/zsnes/docs/readme.htm/styles/shared.css deleted file mode 100644 index 438a752..0000000 --- a/tools/zsnes/docs/readme.htm/styles/shared.css +++ /dev/null @@ -1,70 +0,0 @@ -/* Shared styles. -This stylesheet contains styling information for some tags commonly used in the zdocs. These generally aren't page-specific. */ - -/* ALL PROPERTIES ARE ALPHABETIZED!!! KEEP THEM THAT WAY!!! */ - -#content table { - border: 1px solid black; - border-collapse: collapse; - margin-bottom: 1em; - margin-top: 1em; -} - -#content th { - border-style: solid; - border-width: 1px 1px 2px 1px; - font-weight: bold; - padding-left: 1em; - padding-right: 1em; -} - -#content td { - border: 1px dotted black; - padding-right: 0.3em; - padding-left: 0.3em; -} - -#content table.argument_list td{ - border-style: dotted none dotted none; -} - -#content .gui -{ - font-family: "Lucida Console", "Courier New", Courier, monospace; - font-weight: bold; -} - -#content strong.gui_windows { - background-color: #d4d0c8; - color: black; - font-family: Tahoma, sans-serif; - font-size: 8pt; - font-weight: normal; -} - -#content em.game /* Just a reminder that you can change the text style of a game name. */ -{} - -#content code { - background-color: inherit; - color: blue; - font-family: "Lucida Console", "Courier New", Courier, monospace; -} - -#content code.file /* Just a reminder that you can change the style of filenames. */ -{} - -#content kbd { - background-color: black; - color: white; - font-family: "Lucida Console", "Courier New", Courier, monospace; -} - -#content kbd.key -{ - background-color: white; - border: solid 2px black; - color: black; - padding-left: 1px; - padding-right: 1px; -} diff --git a/tools/zsnes/docs/readme.htm/support.htm b/tools/zsnes/docs/readme.htm/support.htm deleted file mode 100644 index e0d848b..0000000 --- a/tools/zsnes/docs/readme.htm/support.htm +++ /dev/null @@ -1,197 +0,0 @@ - - - - - Getting Support - ZSNES Documentation - - - - - - - - - - - - - - - - - - - - - - -
- -
-

Getting Support

- -
-

APIs and Utilities

- -

The following utilities are referenced throughout this documentation to help accomplish various tasks. There is a link to each utility and a short description of its purpose.

- -
-

DirectX

- -

DirectX is an API required for running ZSNES in Windows.

-
- -
-

SDL

- -

SDL (Simple DirectMedia Layer) is an API required for running ZSNES on UNIX-like operating systems.

-
- -
-

Scitech Display Doctor

-

Scitech Display Doctor is a utility that provides drivers for many VGA and SVGA video cards. It can provide support for VESA VBE 2 on some video cards that may not normally support it.

-

The link above directs you to Scitech's FTP site. regcodes.txt provides registration codes for the two different versions of SDD offered, v5.3 and v6.53. The newer version supports hardware acceleration and more cards. If you are in a DOS-only environment, you should use one of the -d.zip versions. If you are in a Windows+DOS environment, use one of the -w.exe versions. univbe67.exe is a stand-alone VESA VBE driver, and does not provide any of the other SDD utilities.

-

Note: SciTech Software no longer offers support for this software.

-
- -
-

NSRT

-

NSRT - Nach's SNES ROM Tools. NSRT, the most advanced SNES ROM tool to date, provides the ability to check, alter, retrieve info from, verify, fix, and organize SNES ROMs.

-

NSRT has several important uses in relation to ZSNES:

-
    -
  • You can use it to scan your ROMs and show detailed information about them. This information will tell you whether or not the ROM is a good dump.
  • -
  • It can deinterleave your SuperFX ROMs so that ZSNES can load them.
  • -
  • It can add special NSRT headers to your ROMs, which will allow ZSNES to automatically enable special controllers for games that need them.
  • -
  • You can use NSRT to compress your ROMs using a special, custom-built compression format called JMA. This is an archive format designed by Nach based on LZMA. When used on SNES ROMs it is faster, and creates smaller files than 7Zip.
  • -
-

NSRT is primarily a command-line program, although a graphical front-end is available. The ZSNES Documentation Team has written a supplementary guide to NSRT that covers some of the functions listed above.

-
-
- -
-

Contact Information and Links

- -

The following is a list of all official ZSNES websites and resources:

- -

In your quest to solve whatever problem you may be having with ZSNES, or to learn more about ZSNES, please first read all of this official documentation.

-

The ZSNES Message Board is the primary place to receive help about ZSNES, after you have read through this entire documentation. It is also an interesting Internet community in its own right. Asking for ROMs (or asking for games, a link to a ROM site, or where to find ROMs/games) is forbidden! Be sure to also read the RULES!

-
- -
-

Known Issues

- -
    -
  • 65816 lacks correct timing. Although ZSNES bases the timing on a variable cycle/instruction, it does not deduct correct values (such as 16-bit instructions should deduct 1 more cycle than 8-bit instructions). 100% cycles of ZSNES isn't 100% cycles of a SNES because of that. This means that a lot of games either won't run or will produce horrible displays. Sometimes, adjusting the % of execution can fix those problems. This is all due to inaccurate documentation used when the ZSNES 65816 core was written. Fortunately, there are currently ongoing efforts to rewrite the ZSNES core.
  • -
  • Some games sometimes tend to not display things properly because of graphic features that aren't implemented yet.
  • -
  • The Sound DSP chip still has its bugs (not many though). Additionally, no one knows the exact timing of the SPC700 chip.
  • -
-
- -
-

Filing a Bug Report

- -
-

Before you file a bug report:

- -
    -
  • Please verify that you have a good ROM. You should use NSRT to do this. You can find detailed instructions on how to use NSRT to verify your ROM(s) in this section of our NSRT Guide.
  • -
  • Make sure you are using the current release of ZSNES. You can download the latest version from the ZSNES home page or from the ZSNES SourceForge Project Files page. If you were using an old version of ZSNES, and the problem goes away when you use the new version, please do not report the bug.
  • -
  • If the bug still exists in the latest official release of ZSNES, please try again with the latest WIP release of ZSNES. These are unofficial versions, compiled from SVN source, and are updated somewhat frequently. They are available at ipher's WIP Page.
  • -
  • If you want to check against the latest development code, go obtain it from SVN at BountySource. You are warned, however, that frequent changes are made to the code, so ZSNES may not always be able to compile when using code obtained from there.
  • -
  • If possible, confirm whether the bug occurs on real hardware (as in, play the game on a real console).
  • -
-

Bug reports should be submitted in the Bug Reports/Feature Requests section of the ZSNES Message Board. Before reporting, please use the board's search function to see if your bug has already been reported.

-
- -
-

When making a bug report, please include the following information:

- -
    -
  • Version (i.e., v1.51) and port (i.e., Windows, DOS, or SDL) of ZSNES you are using. Make sure to specify the revision if you obtained ZSNES from SVN.
  • -
  • Detailed ROM information: -
    • You must post the NSRT information about your ROM when reporting a bug. Please see the Verifying a ROM to make a Bug Report section of our NSRT Guide for detailed instructions. Alternatively, you can use the Log Rom Info option in ZSNES to generate the file "rominfo.txt", which also provides the necessary information.
    -
  • -
  • Detailed system specifications: -
      -
    • At minimum, you must tell us what operating system you are using and what version of DirectX or SDL you are using.
    • -
    • If your issue is related to performance (as in, ZSNES is too slow), also include the specs for your processor, RAM, video card, etc.
    • -
    -
  • -
  • Detailed description of the bug: -
      -
    • A detailed description of the bug is important so that others can try to reproduce it.
    • -
    • Screenshots are highly recommended, and save states made before (or in some cases, during) the bug's occurrence are also greatly appreciated.
    • -
    • If you know of a previous version of ZSNES that ran the game properly, or if you know of another game that acts similarly, please let us know.
    • -
    • It may also be helpful to test the game in other SNES emulators and tell us the resulting behavior.
    • -
    -
  • -
-
-
- - -
- - - -
- - - - \ No newline at end of file diff --git a/tools/zsnes/docs/readme.txt/about.txt b/tools/zsnes/docs/readme.txt/about.txt deleted file mode 100644 index a8b3f57..0000000 --- a/tools/zsnes/docs/readme.txt/about.txt +++ /dev/null @@ -1,280 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - - * GUI [GUI.txt] - - * Netplay [Netplay.txt] - - * Advanced Usage [Advanced.txt] - - * Games [Games.txt] - - * FAQ [FAQ.txt] - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - - * History [History.txt] - - * About [About.txt] - 1. ZSNES - 2. Documentation - 3. Credits - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ A b o u t -================================================================================ - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1. About ZSNES -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -ZSNES is a SNES emulator that has been worked on since 1997. Originally -programmed by zsKnight and _Demo_, the project has since then attracted a number -of new developers and contributors. - -On April 2, 2001, the ZSNES project was GPL'ed and its source released to the -public. Written in a mixture of x86 assembler, C, and C++, ZSNES currently runs -on Windows, DOS, x86 versions of Linux and FreeBSD, x86 Macintosh computers, and -the Microsoft Xbox. - - -................................ - Donations -................................ - -If you enjoy using ZSNES to re-live and enhance your experiences with the Super -Nintendo, please consider making a donation to support further development. - -You have two options when making a donation. You can choose to make a donation -through the ZSNES SourceForge Project Donation Page: -[http://sourceforge.net/donate/index.php?group_id=19677] -(Donate to ZSNES through SourceForge). - -Alternatively, you can send money to the ZSNES creator's PayPal account: -[http://www.zsnes.com/?page=donate] -(Donate directly to zsKnight, creator of ZSNES). - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2. About the Documentation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The ZSNES Documentation Project was started by RichardC in an attempt to update -and reorganize all of the ZSNES documentation into an easy to read, easy to -access collection. It made its public debut upon the release of ZSNES v1.40. -It is officially available in HTML, CHM, and text formats. - -If you have any suggestions or corrections that you would like to submit, -feel free to let us know at our forum on the ZSNES Message Board -[http://board.zsnes.com]. - -RichardC would like to give a special thanks to Nach and the ZSNES community for -all the help and support that they have given to him and the project. - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3. C r e d i t s -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -........................................ - Founding Developers -........................................ -zsKnight -_Demo_ - - -........................................ - Current/Active Developers -........................................ -pagefault - primary core developer, primary Win port developer. -Nach - primary non-core developer, mostly works on significant back-end - overhauling and large new features. -grinvader - primary ASM to C porter, primary Unix build maintainer, many GUI - improvements and other, and power of no pants. -Jonas Quinn - primary bug fixer, also video code contributor. -ipher - ZSNES GUI expert, WIP distributor -Deathlike2 - minor feature adder, also an ASM to C porter. - - -........................................ - Assistant Coders -........................................ -hpsolo -Pharos -Siloh (a.k.a. Stainless, a.k.a. randilyn) -StatMan -teuf -theoddone33 - - -........................................ - Contributors (in alphabetical order) -........................................ -aaronl -Aerdan -amit -anomie -BRPXQZME -byuu -Diablo-D3 -EvilTypeGuy -hector -Khan Artist (a.k.a. Noxious Ninja) -kode54 -Kreed -MaxSt -MKendora -Neviksti -Overload -prometheus -relnev -snes6502 -TRAC -zinx - - -........................................ - Documentation Writers/Contributors -........................................ - -Contributors are listed loosely based on their dates of contribution. - -RichardC - founder of the ZSNES Documentation Project. First active - administrator. He had the dirty job of doing the initial conversion - of the docs into HTML. -Nach - programmer extraordinaire, and knows ZSNES very well. He helps a lot in - documenting the obscure things we writers don't know about. -LDAWG - updated v1.40 changelog, based on a 2 year summary by Nach, as well as - another 6 months of developer notes. -kevman - helped with the v1.40 FAQ updates. -xamenus - joined the project shortly after RichardC's initial release, and made - many grammar fixes and updated the content. Combined the 3 separate, - port-specific documentations into one. Still contributes some content from - time to time. -Noxious Ninja - manpage expert. No longer active in the emulation "scene", he - always had something useful to contribute. -Clements - maintainer of the CHM file. Also assists with coding and content. -AspiringSquire - designer and maintainer of the TXT version of the docs; - occasionally contributes content. Also an expert with grammar and - vocabulary corrections. -Jipcy - current active administrator and mark-up chief. Manages and contributes - to all parts of the docs. -Jonas Quinn - mainly helps in super-optimizing the images. -Deathlike2 - ZBoard tech help expert. Also makes many suggestions/corrections to - the docs. - -Special thanks to Radio. He designed the ZSNES.com main page layout, from which -we stole this design for the HTML docs. Also special thanks to Roman Rudenko, -for finding the elusive "display:inline" fix for floated items in IE. - -Also thanks to SnesCentral [http://snescentral.com] for providing some info! - - -........................................ - Thanks -........................................ - -All ports of ZSNES use NASM v0.98+, GNU Make, zlib, libpng, and JMAlib to -compile, link, compress, decompress, and execute. - -In addition to the above, ZSNES Win uses Visual C++ 2003 (or MinGW), DirectX 8, -UPX, and ManyMouse; ZSNES SDL uses GCC, SDL v1.20, and ManyMouse; and ZSNES DOS -uses DJGPP, CWSDPMI, and UPX. - -Thanks to those who produced these fine programs! - - Special Thanks to: - - wnelson; without him, ZSNES would have never existed! - - Y0SHi for his excellent SNES docs, his help, and his excellent support! - - Ashley, Barubary, CyberWarriorX, DCX, DooMStalK, Fanwen, GreenImp, Hucard, - Kaiden, PolestaR, Stalphos Knight, Star Creator, TeleKawaru, the people on - the ZSNES IRC channel, and the regulars of the ZSNES message board! - - All of our beta testers for being a great help! - - The MAME team; info on 256x256x256 scanlines mode is from the MAME source! - - Also Thanks to: - - The_Teach of Snes9x for some great info and the nice chats! - - Trepalium of Snes9x for some great info and help! - - Gary of Snes9x and Steve Snake of Kega for being the source of info for - sound decompression! - - Gary of Snes9x for being the source of info for TCall/PCall and also for - lots of help! - - MrGrim for his great support! - - Crono for info on Sound Blaster programming, surround sound, sound - interpolation, and other sound stuff! - - Aquis for the ZSNES logo! - - Alucard for helping us with an issue in the 65816! - - Vertigo for making a compatibility list! - - EFX for being a great supporter and also giving a lot of help and stuff! - - Zophar for being a great supporter and also maintaining the mirror site! - - Chris Hickman for redesigning the ZSNES web page! - - CSoft [http://www.csoft.net] for (previously) hosting our web page! - - Marius Fodor for the code for VSync, Sidewinder, Gamepad Pro, and some - optimization info! - - Sardu for some great info and help! - - Lord ESNES for some great help! - - Robert Grubbs for the Sidewinder info! - - Nerlaska for some useful info on optimizing and also for some help! - - Diskdude for writing SNESkart which we used for the info on cheat codes! - - DarkForce for some great help! - - Pharos for some keyboard coding help! - - Ivar and Gary of the Snes9x team for all their great help, which includes - their SuperFX info and code, DSP-1 info, info on interleave formats (HiROM - and SuperFX), offset per tile mode, FIR filter, and some insights on - SPC700 and HDMA bugs! - - WolfWings ShadowFlight for help on several issues of NASM! - - Wildfire for some help! - - A CoolMan for the algorithm for EAGLE! - - Neill Corlett for some info on the .ips format and also helping out a lot - on improving the sound engine! - - Kreed for the 2xSaI and Super Eagle source codes! - - Markus Oberhumer and Laszlo Molnar for the UPX compression utility - [http://upx.sourceforge.net]. - - Jean-loup Gailly, Mark Adler, and Gilles Vollant for the unzip routines! - - kode54 for the low pass filter routines! - - Andy Goth for some help on the design of the key combination engine! - - Yamaha of XYZZ (Scott Scriven) for his water effect code. - - ipher for compiling and releasing WIP builds! - - cdbsi for the ZSNES icons! - - The Dumper for lots of help with special chips. - - snes6502 for the Xbox port! - - hector and BRPXQZME for helping to port ZSNES to Mac OS X! - - The NSRT Team, for their excellent utility, JMA compression, NSRT headers, - and a great database! - - All those people who contributed by either updating the docs, helping us, - supporting us, or reporting bugs! - -The changelog [History.txt] contains innumerable credits to people for their -contributions or individual fixes. Many of them are not listed on this page. - -Also thanks to all those whom we forgot! - -Also, good luck to all those who are writing emulators, especially those who are -writing SNES emulators, including Snes9x [http://www.snes9x.com], -SNEeSe [http://sneese.sourceforge.net], -Super Sleuth [http://users.tpg.com.au/advlink/spx/], -and bsnes [http://www.byuu.org]! - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/readme.txt/advanced.txt b/tools/zsnes/docs/readme.txt/advanced.txt deleted file mode 100644 index d1ea178..0000000 --- a/tools/zsnes/docs/readme.txt/advanced.txt +++ /dev/null @@ -1,483 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - - * GUI [GUI.txt] - - * Netplay [Netplay.txt] - - * Advanced Usage [Advanced.txt] - 1. Movie Dumping - 2. Configuration Files - 3. Debugger - 4. KitchenSync - 5. Command-Line - - * Games [Games.txt] - - * FAQ [FAQ.txt] - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - - * History [History.txt] - - * About [About.txt] - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ A d v a n c e d U s a g e -================================================================================ - -This page documents the advanced features of ZSNES, probably not useful for most -end users. - - -............................................................ - 1. Movie Dumping -............................................................ - -Please note that ZSNES does not support real-time video encoding. ZSNES only -encodes existing ZMV (ZSNES movie) files. Refer to the GUI page [GUI.txt] for -instructions on recording movies. - -All instructions in this section assume that you are using the default settings -of the zmovie.cfg file. If you are smart enough to edit zmovie.cfg, you had -better be smart enough to dump movies with whatever new settings you've created. - -You can dump video output alone, audio output alone, both at the same time (to -separate files), or both to the same file (merged). If you choose to dump audio -output, you can choose to dump that audio output uncompressed or compressed to -MP3. Both uncompressed and compressed audio can be merged with the video. - -- - - - - - - - - - - - - About Video Encoding -- - - - - - - - - - - - - -Video encoding requires MEncoder [http://www.mplayerhq.hu]. - -- - - - - - - - - - - - - About Audio Encoding -- - - - - - - - - - - - - -Audio encoding requires LAME [http://lame.sourceforge.net]. Currently, Windows -users *must* use this fixed LAME build [http://nsrt.edgeemu.com/lame.zip] due to -a bug in the official versions. - -You have a choice of dumping audio either in uncompressed PCM format with WAV -header, or compressed as MP3. ZSNES uses LAME [http://lame.sourceforge.net] for -MP3, so you can expect high-quality audio, given the bit rate. - -When dumping audio to a separate file (not merged with video), audio compressed -to MP3 will be about 6% of the size of the same uncompressed PCM audio. - -- - - - - - - - - - Dumping a Movie -- - - - - - - - - - - 1. Place your MEncoder (mencoder.exe) and LAME (lame.exe) binaries in the same - directory as ZSNES. Alternatively, configure your PATH environment variable - to include the directories where MEncoder and LAME are installed. - 2. Start ZSNES and load a game. - 3. Open the Movie Options dialog. (Misc Menu->Movie Opt). - 4. Make sure to select the correct movie slot, depending on which movie slot - you used to record a ZMV. - 5. Select the Dumping tab, and configure the Video Options and Audio Options - to your liking [GUI.txt]. - 6. Hit the Start button. - 7. ZSNES will then exit the GUI and start playing back the previously recorded - movie. If you chose to encode the video and/or audio output, you will see a - console window appear, showing the progress of encoding. Don't worry if - ZSNES slows down while playing back the movie; it needs to do this because - the encoding process takes a lot of processor time. - 8. ZSNES will indicate when the movie has finished playback (and encoding). - You can now look in your ZSNES directory for the newly created file(s). - -Note: ZSNES does not create an uncompressed temporary file and then encode it. - Instead, the output stream is directly encoded. The only output files will be - the finished, compressed files. Because ZSNES must encode the output stream as - it is generated, ZSNES may delay the output of new frames of video/audio to - give more time to MEncoder/LAME to compress the current frame. This means that - you should *not* worry if you see the playback of your movie slow down while - ZSNES is dumping it. The dumped file(s) will play back at full speed! - - -............................................................ - 2. Configuration Files -............................................................ - -Every time you run ZSNES, it checks to see if these files are present in the -same directory as the ZSNES executable. If they are not, ZSNES will create them -with their default values. Thus, if you are having weird problems with ZSNES, -try deleting these files. - -If there are any missing or invalid lines in zsnes*.cfg, ZSNES will insert or -replace the lines with their default values. - -- - - - - - - - zsnes*.cfg -- - - - - - - - -Almost every option available in ZSNES can be configured in this file. If there -is something you don't understand in this file, please refrain from changing it, -and instead set the option from within the ZSNES GUI [GUI.txt]. - -The last letter of the filename is different for each port. -Windows: zsnesw.cfg SDL: zsnesl.cfg DOS: zsnes.cfg. - -- - - - - - - - zmovie.cfg -- - - - - - - - -This file contains movie-dumping configuration information. - -You can edit this file to make ZSNES use something other than MEncoder or LAME, -or to tweak options. Read the MEncoder and LAME manuals to see what options you -can tweak. If you choose other applications, they must support stream input via -stdin and raw video (in the case of video encoding). Refer to the appropriate -documentation for more information. - -Unfortunately, you're on your own if wish to play with this. - -- - - - - - - - zfont.txt -- - - - - - - - -This file contains the font data for the ZSNES GUI. You can edit this file to -customize the font. - - * Comments are preceded by a ; and can be up to 99 characters in length. - - In the default file, each comment precedes the character it's labeling. - * Each letter is represented by a block of five rows, each containing 8 bits. - Only the first five columns of bits are used for font data; ZSNES uses a 5x5 - font. The last three columns of bits should always be zeros. - - There are characters for English, Hiragana, and Katakana scripts. - * In case it isn't obvious, a 1 means the pixel is on in that location. A 0 - means it's off. If you view zfont.txt, you should be able to figure it out. - * The file terminates on the EOF+newline character or the last character - (whichever comes first). - -The absolute ordering of each and every line in this file is *important*. If -you're missing a single line, things might start messing up. Just so you know, -the last line of data should be on line 846, followed by the EOF character on -line 847. - -If you mess something up, just delete zfont.txt, and ZSNES will re-generate it -as normal. - - -............................................................ - 3. Debugger -............................................................ - -The debugger, now available in all ports, is enabled only when you enter ZSNES -with a -d (If you are using the DOS port, just type "zsnes -d" at the -commandline. Win port users should add a "-d" after their ZSNES shortcut -target). Loading a ROM via a command line will start ZSNES in debugger mode; -otherwise press F1 to reach it. - -Average users, however, should have no need to use the debugger. - -- - - - - - - - - - - - - - - - - . . Debugger . Keys . . -- - - - - - - - - - - - - - - - - -|Key| |Function| -- - - - - - - - - - 1 Enable/Disable SPC700 display - 2 Enable/Disable 65816 display - T Trace (in 65816 opcodes) - B 65816 break point - S SPC break point - C Clear counter - M 65816 modify - A SPC modify - D Debug dump (SPC/DSPRAM dump only) - W Break at signal (used only by the programmers) - F1 Switch between debugger input and game input - F2 Save state - F4 Load state - Esc Exit entire program - - -............................................................ - 4. KitchenSync (Win port only) -............................................................ - -This makes NTSC games (60Hz) run at 120Hz, and PAL games (50Hz) run at 100Hz. -To enable it, just start ZSNESw with the -ks switch. Alternatively, you can -create a shortcut to ZSNESw that starts with this switch enabled, every time. -First create a shortcut to ZSNESw in Windows. Next, right-click on the shortcut -and choose Properties. Then, put the cursor right after the quotation marks in -the Target box, press the space bar, and type -ks. Finally, click OK. If ZSNESw -crashes or refuses to start after enabling this, your monitor does not support -the 100/120 Hz refresh rate. - -If your monitor supports 100Hz and not 120Hz, you can instead use the -kp switch -for PAL only. This way, you will not have to disable the -ks switch every time -you wish to play an NTSC game. - - -............................................................ - 5. Command-Line Arguments -............................................................ - -ZSNES supports execution arguments via the command line. More detailed -descriptions of how to use the arguments with each port is forthcoming. - -Further detail of each argument's effect is given in [GUI.txt] for the -corresponding GUI option, if one exists. - - Usage : zsnes* [-d,-f #, ... ] filename.sfc -Example : zsnes* -s -r 2 game.sfc - -*Fill in the appropriate letter for your port when entering this into the -command line. - - -- - - - - - - - - - - - - - - - - . . Universal Switches . . -- - - - - - - - - - - - - - - - -Argument|Sub-Arg.|Description -= = = = = = = = = = = = = = = --1 #/-2 # Select Player 1/2 Input - 0 None - 1 Keyboard --d Start with debugger enabled --dd Disable sound SPC700/DSP emulation, which also disables sound - output --dh Disable ROM-specific hacks --ds Disable sound output --f # [0...9] Enable fixed frame rate --g # [0...15] Specify gamma correction value --h Force HiROM --j Disable Mouse (Automatically turns off right mouse click) --k # [0...100] Set Volume Level --l Force LoROM --m Disable GUI (Must specify ROM filename) --mc Exit ZSNES when closing a movie (use with -zm) --md # Dump video (use with -zm) - 1 Raw - 2 FFV1 - 3 x264 - 4 XviD - 5 Custom --ml # Define movie dump length in amount of frames (use with -md) --n # Enable scanlines (when available) - 0 None - 1 Full - 2 25% - 3 50% --o Disable MMX support --p # [50...150] Percentage of instructions to execute --r # Set sound sampling rate - 0 8000Hz - 1 11025Hz - 2 22050Hz - 3 44100Hz - 4 16000Hz - 5 32000Hz - 6 48000Hz --s Enable sound output and enable SPC700/DSP emulation --sa Show all extensions in GUI (*.*) --t Force NTSC timing --u Force PAL timing --v8 Grayscale mode --y Enable Interpolation graphics filter --z Disable stereo sound --zm # [0...9] Auto load specified movie slot on startup --zs # [0...99] Auto load specified save state slot on startup - - -- - - - - - - - - - - - - - - - - . . Windows-only Switches . . -- - - - - - - - - - - - - - - - -From the Windows NT command-line, you can use the following command to view the -accepted command-line input for a given ZSNES binary: "zsnesw -? | more". -Typing "zsnesw -?" does not work. - -Users of any flavor of Windows can use the following command to output to a file -the same information returned from the command above: "zsnesw -? > commands.txt" - -Argument|Sub-Arg.|Description -= = = = = = = = = = = = = = = --3 Enable triple buffering (disables VSync) --6 # [50...180] Force a user-specified refresh rate for fullscreen modes --js # [0...32767] Set joystick sensitivity --kp Enable the KitchenSync for PAL only (100Hz) --ks Enable the KitchenSync for NTSC and PAL (120Hz/100Hz) --v # Select Video Mode: - 0 256x224 R WIN - 1 256x224 R FULL - 2 512x448 R WIN - 3 512x448 DR WIN - 4 640x480 S WIN - 5 640x480 DS WIN - 6 640x480 DR FULL - 7 640x480 DS FULL - 8 640x480 S FULL - 9 768x672 R WIN - 10 768x672 DR WIN - 11 800x600 S WIN - 12 800x600 DS WIN - 13 800x600 S FULL - 14 800x600 DR FULL - 15 800x600 DS FULL - 16 1024x768 S WIN - 17 1024x768 DS WIN - 18 1024x768 S FULL - 19 1024x768 DR FULL - 20 1024x768 DS FULL - 21 1024x896 R WIN - 22 1024x896 DR WIN - 23 1280x960 S WIN - 24 1280x960 DS WIN - 25 1280x960 S FULL - 26 1280x960 DR FULL - 27 1280x960 DS FULL - 28 1280x1024 S WIN - 29 1280x1024 DS WIN - 30 1280x1024 S FULL - 31 1280x1024 DR FULL - 32 1280x1024 DS FULL - 33 1600x1200 S WIN - 34 1600x1200 DS WIN - 35 1600x1200 DR FULL - 36 1600x1200 DS FULL - 37 1600x1200 S FULL - 38 CUSTOM D WIN - 39 CUSTOM DS FULL - 40 CUSTOM WIN - 41 CUSTOM S FULL - 42 CUSTOM DR FULL --w Enable VSync (disables triple buffering) - - -- - - - - - - - - - - - - - - - - . . . SDL-only Switches . . . -- - - - - - - - - - - - - - - - -Argument|Sub-Arg.|Description -= = = = = = = = = = = = = = = --ad <> Audio Driver (note you may not have all of these): - auto Select a driver automatically - uses SDL without libao - null No sound, only available with libao - oss Open Sound System, only available with libao on UNIX systems - with OSS - alsa Advanced Linux Sound Architecture, only available with libao - on Linux systems with ALSA - alsa09 Advanced Linux Sound Architecture, only available with libao - on Linux systems with ALSA - polyp polypaudio (next generation GNOME sound server), only - available with libao and new versions of GNOME - esd ESounD or Enlightened Sound Daemon, only available with - libao and ESD installed - sun Sun Microsystem's audio system, only available with libao - and Solaris or certain BSD systems - irix IRIX audio system, only available with libao and IRIX - systems - nas Network Audio System, only available with libao and NAS - installed - arts Analog RealTime Synthesizer sound, only available with libao - on systems with aRts (KDE) - sdl Simple DirectMedia Layer sound --js # [0...32767] Set joystick sensitivity --v # Select Video Mode: - 0 256x224 R WIN - 1 256x224 R FULL - 2 512x448 DR WIN - 3 512x448 DR FULL - 4 640x480 DR FULL - 5 256x224 OR WIN - 6 512x448 ODR WIN - 7 640x480 ODS FULL - 8 640x480 ODS WIN - 9 640x560 ODR WIN - 10 768x672 ODR WIN - 11 800x600 ODS FULL - 12 800x600 ODS WIN - 13 896x784 ODR WIN - 14 1024x768 ODS FULL - 15 1024x768 ODS WIN - 16 1024x896 ODR WIN - 17 1280x960 ODS FULL - 18 1280x1024 ODS FULL - 19 1600x1200 ODS FULL - 20 VARIABLE ODR WIN - 21 VARIABLE ODS WIN - 22 CUSTOM OD FULL - - -- - - - - - - - - - - - - - - - - . . . DOS-only Switches . . . -- - - - - - - - - - - - - - - - -Argument|Sub-Arg.|Description -= = = = = = = = = = = = = = = --0 Force black background in 8-bit modes --1 #/-2 # Select Player 1/2 Input: - 2 2 Button - 3 4 Button - 4 6 Button - 5 8 Button - 6 Sidewinder #1 - 7 Sidewinder #2 - 8 Sidewinder #3 - 9 Sidewinder #4 - 10 Gamepad Pro #0 - 11 Gamepad Pro #1 - 12 LPT1 #1 - 13 LPT1 #2 - 14 LPT1 #3 - 15 LPT1 #4 - 16 LPT1 #5 --3 Enable triple buffering (disables VSync) --8 Force 8-bit sound --c Enable full/wide screen (when available) --cc Enable small screen (when available) --sp Report sound detection information --v # Select Video Mode: - 0 256x224x8B (MODEQ) - 1 256x240x8B (MODEQ) - 2 256x256x8B (MODEQ) - 3 320x224x8B (MODEX) - 4 320x240x8B (MODEX) - 5 320x256x8B (MODEX) - 6 640x480x16B (VESA1)* - 7 320x240x8B (VESA2) - 8 320x240x16B (VESA2) - 9 320x480x8B (VESA2) - 10 320x480x16B (VESA2) - 11 512x384x8B (VESA2) - 12 512x384x16B (VESA2) - 13 640x400x8B (VESA2) - 14 640x400x16B (VESA2) - 15 640x480x8B (VESA2) - 16 640x480x16B (VESA2) - 17 800x600x8B (VESA2) - 18 800x600x16B (VESA2) --w Enable VSync (disables triple buffering) - -*The 640x480x16B (VESA1) video mode is compatible with many video cards, but can - also be very slow. We recommend that you use a VESA2 mode if your video card - supports it. Please see the system requirements for more information - [Readme.txt]. - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/readme.txt/faq.txt b/tools/zsnes/docs/readme.txt/faq.txt deleted file mode 100644 index e046171..0000000 --- a/tools/zsnes/docs/readme.txt/faq.txt +++ /dev/null @@ -1,748 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - - * GUI [GUI.txt] - - * Netplay [Netplay.txt] - - * Advanced Usage [Advanced.txt] - - * Games [Games.txt] - - * FAQ [FAQ.txt] - 1. Universal - 2. Win Port - 3. SDL Port - 4. DOS Port - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - - * History [History.txt] - - * About [About.txt] - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ F. A. Q. (Frequently Asked Questions) -================================================================================ - -The FAQ page was first included in version 0.390 of ZSNES, released on -April 11, 1998. - - -~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ - Question Index -~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ - -- - - - - - - - - - - - UNIVERSAL QUESTIONS -- - - - - - - - - - - - - General - Where do I download games / ROMs? - What is the "save directory"? - Why are my games not saving? - Are the ZSNES data files compatible among the various ZSNES ports - (Win/DOS/SDL)? - Is there Toaster Support? - Games - Why don't my games work after applying IPS patches to them? - Does ZSNES support Snes9x, GoodSNES, and NSRT ROMs? Or only ZSNES ones? - Video - Why do my scanlines look awful? - Why am I missing some video filter options? - Sound - Why does ZSNES produce a lot of static? - Why am I missing some sound options? - Input - Why can't I press more than 2 keys at a time? - Why is one direction of the d-pad always held down, even when I'm not - pressing any keys? - How do I use both my keyboard and joystick for the 1st or 2nd player? - Why can't I set the keys/buttons for Player 2? - Why won't ZSNES accept input when I'm configuring the keys for my - gamepad? - This game tells me that it is not compatible with the MultiTap - (or an external device attached). What should I do? - Speed - Why is ZSNES slow? - Why does the game slow down even though I'm using auto frame rate and - the FPS is pretty high? - My games are running too quickly! How do I slow them down? - Miscellaneous - Does ZSNES support loading ROMs which are compressed? - Why doesn't ZSNES support the 7z, RAR, or ZIP deflate64 compression - formats? - Does ZSNES support multiple ROMs in a single ZIP or JMA file? - Can you make a Mac/PocketPC/PS2/whatever port? - -- - - - - - - - - - - - -WIN-SPECIFIC QUESTIONS -- - - - - - - - - - - - - - General - Why does ZSNESw crash and give me an error with dinput.dll? - I just switched from the DOS port to the Windows port of ZSNES; - why don't my savestates work? Are they incompatible? - Video - Why am I seeing double, with strange colors? - Why is the video choppy with an FPS of 60 and VSync on? - Sound - How come I don't get any sound? - -- - - - - - - - - - - - -SDL-SPECIFIC QUESTIONS -- - - - - - - - - - - - - - General - Can I run ZSNES without X? - I got ZSNES from my distro and I found a bug. To whom should I report it? - Should I use SVN? - I'm getting an error about gzdirect() missing when I try to compile - ZSNES. What's up? - -- - - - - - - - - - - - -DOS-SPECIFIC QUESTIONS -- - - - - - - - - - - - - - Video - How do you enable transparencies? - Why is there a layer of fog blocking my view? - Why am I getting error messages regarding VESA 2 drivers? - Sound - Why is there no sound? - Are there any plans to improve detection for non-SoundBlaster cards - (or supporting non-SB cards)? - I get a sound initialization error using my SB Live! (or any other - PCI card). How do I fix it? - Input - Why doesn't my Sidewinder pad work? - How do I get my daisy-chained Sidewinder to work? - Why doesn't my Gamepad Pro work? - Why doesn't my joystick work anymore? - Why does JB5/JB6 keep getting pressed whenever I try to change a key? - Freezing/Crashing Issues - Why does ZSNES freeze when I run it under pure DOS? - Why does ZSNES crash when I load a ROM? - Why does ZSNES freeze when I try to enter the GUI? - ZSNES gives me an "out of memory" error and I only have 16MB of RAM. - How do I fix this? - Miscellaneous - I'm using DJGPP 2.03 and I get an error about missing stdint.h. - What's wrong? - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1. UNIVERSAL QUESTIONS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -................................ - General -................................ - -Q: Where do I download games / ROMs? -A: Due to the questionable legality of ROM images of commercial games (see - [http://en.wikipedia.org/wiki/Rom_images#Legal_status_of_ROMs]), the ZSNES - Team *cannot* and *will not* provide you with any games / ROMs. We must do - this in order to keep ZSNES, as an emulator, legal. Please see the disclaimer - [Readme.txt]. - -Q: What is the "save directory"? -A: Please read more about the types of files ZSNES generates and where they are - created in the Files section of [Readme.txt]. - - By default, in the Win and DOS ports of ZSNES, these files will go into their - corresponding ROM directory (e.g. If your Chrono Trigger ROM is in - "C:\SNES Games\RPG", its files will go into that folder; if your Harvest Moon - ROM is in "C:\SNES Games\Simulation", its files will go into that folder). - In the SDL port of ZSNES, however, saves will go into "~/.zsnes" by default. - ZSNES SDL under Mac OS X will place them in - "~/Library/Application Support/ZSNES" instead. - - If you dislike the default settings, you can configure a single, universal - save path by either going to the Config->Paths menu in the GUI or by editing - the ZSNES configuration file [Advanced.txt]. - -Q: Why are my games not saving? -A: If your ROM images are stored on a CD-ROM, you need to define a save - directory that points to your hard drive. In order to do this, either go to - Config-->Paths and enter a directory, or edit the ZSNES configuration file by - typing in a directory after "SaveDirectory=". Make sure that this directory - is not marked read-only. - - If this still does not solve your problem, enable SRAM Check + Save under the - Config-->Saves menu. - -Q: Are the ZSNES data files compatible among the various ZSNES ports - (Win/DOS/SDL)? -A: Yes. Unlike certain PC applications and games, ZSNES's various save files - and formats are completely port-independent; you can share any of your files - with any user using any port of ZSNES (although some things may be - version-dependent). Note, however, that ZSNES's configuration file - [Advanced.txt] contains port-specific options which don't exist in other - ports, so while they can be transfered between ports, some things won't work - as expected. Note that when transfering various files, make sure they're - named properly and in the proper location (see the Files section [Readme.txt] - for details). - -Q: Is there Toaster Support? -A: While we'd love for ZSNES to lace our shoes, feed us, breathe for us, and - amass wealth for us, we can't add every crazy feature that comes up. - Even though ZSNES does have many, many features that are not necessarily - SNES related, they normally don't go beyond features that you'd expect from - an advanced gaming system. - - Regarding toaster support itself, rumor has it ZSNES does bread toasting - if you happen to be using it after midnight while paying your respects - to the master of all controls and considering monetary options. - -................................ - Games -................................ - -Q: Why don't my games work after applying IPS patches to them? -A: If your patched game crashes early or just displays a black screen, you - probably need to either add or remove the 512 byte offset from the patch. - Use the program IPSEDIT to do this, which is bundled along with NSRT. - - Alternatively, you could either add or remove a header from your ROM before - patching. Again, NSRT is capable of doing this. [http://nsrt.edgeemu.com] - -Q: Does ZSNES support Snes9x, GoodSNES, and NSRT ROMs? Or only ZSNES ones? -A: ZSNES, Snes9x, GoodSNES, and NSRT ROMs do not exist. All these programs work - with SNES ROMs. As ZSNES is an SNES emulator, it will work with all SNES ROMs - (except where ZSNES has a bug or the ROM is in an unsupported interleave - format). - -................................ - Video -................................ - -Q: Why do my scanlines look awful? -A: Scanlines can be negatively affected by the method of vertical scaling that - your video card uses, depending on the video mode you have selected for - ZSNES. This can sometimes result in scanlines that are not of uniform - darkness. The effect of this video scaling is most noticeable with Full - scanlines, with 50% and 25% scanlines being less noticeable. To display the - scanlines effect properly, you should use resolutions based on a multiple of - 256x224 in windowed modes (e.g. 512x448) and 320x240 for fullscreen modes - (e.g. 640x480). - -Q: Why am I missing some video filter options? -A: Please make sure you have MMX Support enabled in the Options dialog. Refer to - the Video Config description in [GUI.txt] to see what video options require - MMX support. - -................................ - Sound -................................ - -Q: Why does ZSNES produce a lot of static? -A: There could be many reasons why you are hearing static. If you are using the - Windows port and you have an ISA sound card, this could be your problem. If - you are using the DOS port, and you have a PCI sound card, this could also be - your problem. If your sound card is using SoundBlaster emulation, you - probably need to use 8-bit sound, but this can make sound output worse. You - can also try doing the following things to improve your sound: Reduce your - sampling rate or disable lowpass filtering and stereo sound; Win port users - can also enable the Primary Sound Buffer. - -Q: Why am I missing some sound options? -A: Please make sure you have MMX Support enabled in the Options dialog. Refer to - the Sound Config description in [GUI.txt] to see what sound options require - MMX support. - -................................ - Input -................................ - -Q: Why can't I press more than two keys at a time? -A: Many PC ("Personal Computer") keyboards limit the number of key signals that - can be transmitted simultaneously. For example, certain combinations of three - or more alphanumeric keys may not work. Conversely, there may be some - combinations of three or more keys that *do* work. You would just have to - test by trial-and-error to find out, since these combinations can vary - between keyboards. Joysticks and gamepads generally don't have this - limitation. - - If you must use a keyboard, you can set multiple game keys to a single - keyboard key. Alternatively, you could set some keys to the right and left - Ctrl and Shift keys, since most keyboards do not restrict signals from - these keys. - -Q: Why is one direction of the d-pad always held down, even when I'm not - pressing any keys? -A: ZSNES auto-calibrates any connected gamepads/joysticks when it first starts. - Thus, if one of the buttons or directions is accidentally held down while - ZSNES is starting, ZSNES will think this is "normal" or "zero" input, even - when you let go of the button. To fix the problem, simply close ZSNES, make - sure no buttons are pressed and all axis are centered on your - gamepad/joystick, and restart ZSNES. It will then auto-calibrate to the - correct "zero" settings. - -Q: How do I use both my keyboard and joystick for the 1st or 2nd player? -A: First, configure the Player 1 pad (Config-->Input--> #1) for your normal - set-up (for example, a keyboard). Next, configure the Player 3 pad - (Config-->Input--> #3) to use your alternative set-up (for example, a - joystick or gamepad). When you want to switch between your regular and - alternative set-up, go to the Config-->Options menu and check - USE PL3/4 AS PL1/2. Now the Player 3 controls act as the Player 1 pad, and - Player 4's controls act as the Player 2 pad. To return to the normal - controls, simply uncheck this option. Follow the same procedure to create a - similar set-up for Players 2 and 4. - Note: Enabling the option USE PL3/4 AS PL1/2 disables MultiTap emulation. - -Q: Why can't I set the keys/buttons for Player 2? -A: You need to set the Current Device before ZSNES will allow you to set the - individual keys for Player 2 (or Players 3, 4, or 5). If NONE is shown after - CURRENT:, the input cannot be changed (or used, for that matter). See the - Input section of the GUI page [GUI.txt] for further instructions. - -Q: Why won't ZSNES accept input when I'm configuring the keys for my gamepad? -A: Exit ZSNES and calibrate your input device. Then restart ZSNES and see if it - works. - -Q: This game tells me that it is not compatible with the MultiTap (or an - external device attached). What should I do? -A: Set the input devices of player 3, 4, and 5 to "None". You may also need to - go to Config-->Options, and enable "Use Player 3/4 as Player 1/2". - Additionally, you could add an NSRT header to your ROM if you desire. - -................................ - Speed -................................ - -Q: Why is ZSNES slow? -A: First and foremost, does your computer meet the minimum system requirements - to run ZSNES? If not, there is little you can do to improve performance. That - being said, you can still try a number of things. - - * Make sure that any major program(s) is/are closed (such as Winamp). - * Try the default settings of ZSNES before you do anything else. You can - reset ZSNES to the default settings by deleting all three of its - configuration files. - * Ensure that MMX Support is enabled in the Options dialog; this mode - should provide a noticeable speed increase for computers that can use it. - * Certain system configurations and video cards work better with certain - video modes. Try switching between different video modes until you find - one that has good/better performance. Things to remember when doing this - are that lower resolutions are faster than higher resolutions, full - screen modes are faster than windowed modes, and 'R' modes are faster - than 'S' modes (because no scaling is necessary). - * Make sure you are using Auto Frame Skipping. If you already are, try - increasing the Max Frame Skip. - * Do not use VSync; if you must use VSync, try also enabling Triple - Buffering. - * Disable all video filters. - * Compile ZSNES yourself with optimizations for your CPU's architecture. - * If you still need more speed, disable sound. If that's not enough, - disable SPC emulation (you must restart ZSNES for this option to take - effect). Some games will not work without SPC emulation. - - If you have an old computer, such as one with a 486/100 processor, you will - probably be better off using older DOS versions of ZSNES, as the minimum - system requirements have increased slightly with subsequent releases. To - achieve greater speed, you may want to avoid using VESA video modes (although - this will disable transparencies). Experiment with the different video modes - and try the recommendations above to see which configuration provides the - best speed for you. - -Q: Why does the game slow down even though I'm using auto frame rate and the FPS - is pretty high? -A: If you have ever played a real SNES, you may notice that some games slow down - even on it. To the extent that ZSNES accurately emulates an SNES, a game will - slow down in ZSNES in the same places it would slown down on a real SNES. - -Q: My games are running too quickly! How do I slow them down? -A: You may have disabled auto frame skipping. Re-enable it in the - Config-->Speed menu. - - If you don't want to use auto frame skipping, and you want to play in - windowed mode, you might want to set your monitor's refresh rate to 60hz - and enable VSync in ZSNES. - - If you want to use fullscreen mode without using auto frame skipping, - you can enable the KitchenSync by using either the -ks (for NTSC/PAL) - or -kp (for PAL) command-line parameter (Windows port only) [Advanced.txt]. - Also be sure to enable triple buffering. - -................................ - Miscellaneous -................................ - -Q: Does ZSNES support loading ROMs which are compressed? -A: Yes, but it depends on what compression format is used. ZSNES can currently - load ROMs that are compressed in the ZIP (method 0 - store and method 8 - - deflate), GZip, and JMA compression formats. - - Many tools are available to create ZIP files. If you want a fast, commandline - based ZIP program that is available on many platforms, get Info-ZIP. Info-ZIP - also has a Windows front end called WiZ available if you prefer a GUI. - - For creating GZip files, there are not too many choices. A fast, commandline - based compressor for the GZip format, available for several platforms, may be - downloaded at the GZip site [http://www.gzip.org]. If you use Windows, there - is a program with a GUI called 7-Zip [http://www.7-zip.org] that has support - for ZIP, GZip, and others. ZIP and GZip files created by 7-Zip are smaller - than those created with other programs, but 7-Zip takes a longer time - creating them. For users of Unix based operating systems who would like a GUI - front end for both ZIP and GZip, get Ark - [http://docs.kde.org/en/3.2/kdeutils/ark/], which is part of the KDE project. - - To create JMA files, a format invented by Nach and the rest of the NSRT team - which offers the best compression ratio for SNES ROMs, you must use NSRT - [http://nsrt.edgeemu.com]. NSRT is also capable of compressing SNES ROMs into - ZIP and GZip formats. - -Q: Why doesn't ZSNES support the 7z, RAR, or ZIP deflate64 compression formats? -A: ZSNES only supports formats which have an open-source, portable, and - easy-to-use library. The 7z and RAR formats do not yet have libraries that - fill those criteria. If you want the best compression ratio for your SNES - ROMs, you should use JMA. Currently, the only publicly available program that - can compress and decompress with JMA is NSRT [http://nsrt.edgeemu.com]. ZIP - deflate64 lacks a decompression library which ZSNES can use, but rumor has it - that Nach is working on one. - -Q: Does ZSNES support multiple ROMs in a single ZIP or JMA file? -A: ZSNES currently does not support more than one ROM in a ZIP or JMA file, - although such support will probably be implemented in the future. - -Q: Can you make a Mac/PocketPC/PS2/whatever port? -A: Since ZSNES is written in assembly, ports to any systems that are not 100% - x86 compatible are impossible. Try Snes9x [http://www.snes9x.com] for - portability. - - Apple Computer, Inc. recently switched the Macintosh computers to use Intel - processors [http://www.apple.com/pr/library/2005/jun/06intel.html], and - as such ZSNES has already been modified to run on said computers. Just - compile the SDL port with an up-to-date NASM and zlib and everything normally - required. - - Another third party developer recently ported ZSNES to the Microsoft Xbox as - well, and released it under the name "ZsneXbox". Unfortunately, we can not - provide a download link as this port is being illegally distributed as a - compiled XBE file. As a result, any link or support requests regarding this - port will be promptly ignored. - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2. WIN-SPECIFIC QUESTIONS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -................................ - General -................................ - -Q: Why does ZSNESw crash and give me an error with dinput.dll? -A: If you get this error, download and install the latest version of DirectX. - You might also try running the DirectX Diagnostic Tool. You can do this by - clicking the Start button, then selecting "Run...". Type "dxdiag" after - "Open:", and click "OK". There are lots of options you can play with, so - please read everything before you start messing around. Specifically, go to - the "Display" tab, and under the "DirectX Features" section, click the - "Disable" button beside each feature. After they are all disabled, re-enable - them. Exit dxdiag, and try ZSNES again. - - If none of that worked, try re-installing DirectX. - -Q: I just switched from the DOS port to the Windows port of ZSNES; why don't my - savestates work? Are they incompatible? -A: The saves and savestates will work just as well with any port of ZSNES. You - simply need to rename all files that have .srm and .zst (and .zs1, .zs2, - etc.) extensions to match the filenames of your ROMs (or the jma/zip archives - that contain them). - - For example, if you have "Super Mario World.zip" and "Super Mario RPG.zip", - both games will have saves that are labeled "SUPERM~1.SRM", "SUPERM~1.ZS2", - etc., and they will be differentiated only by the number after the "~" in the - filename. - - If you need to find out which "~" number a game uses, open a DOS prompt - (a.k.a. Command Prompt), change to the ROM directory, and enter "dir /on /p" - (On some newer systems like Win2k you need to add the "/x" switch for the DOS - filenames to be displayed). Unfortunately, this method may not be accurate if - you have moved your ROMs to a different folder or another computer; you may - need to guess and hope for the best, trying to swap filenames a few different - ways between the saves before it works for all your games. If it comes down - to guessing, we recommend that you backup your save files before renaming - them. - - Don't forget to put the files into your Save directory. A question concerning - the Save directory is under Universal Questions -> General [FAQ.txt]. - -................................ - Video -................................ - -Q: Why am I seeing double, with strange colors? -A: Any change of resolution within ZSNES should correct the problem. Fullscreen - modes are recommended because they are faster than windowed modes. - - If you still experience problems, see if these suggestions help (each should - be done/tried separately): - - The issue can be completely resolved with up-to-date video card drivers. - Keeping your device drivers fully updated will provide other benefits - unrelated to ZSNES. - - Set the resolution for ZSNES to the same one used by the Windows desktop. - - Try enabling 16-bit color depth in Windows. - -Q: Why is the video choppy with an FPS of 60 and VSync on? -A: If you have VSync on, your monitor needs to be set to a refresh rate that is - a multiple of the framerate of the game. NTSC games natively run at ~60 FPS. - PAL games natively run at 50 FPS. Thus your monitor would need to be either - 60Hz or 120Hz for NTSC games, or 50Hz/100Hz for PAL games. If you run ZSNES - with the -6 switch, with a sub-argument of '60', ZSNES will try to switch - your monitor to 60Hz refresh rate. You can use the -ks switch to make ZSNES - try to switch your monitor to 120Hz refresh rate. These two switches only - work in fullscreen modes and are for the Windows port only. - Please reference [Advanced.txt] for details on command-line switches. - - You can also try enabling Triple Buffering (using the -3 switch or the GUI - option), however this currently only works in Full Screen modes. One last - thing you can try is to turn off auto frame-skipping, and set manual frame - rate to "0". - -................................ - Sound -................................ - -Q: How come I don't get any sound? -A: Either you accidentally disabled sound, you don't have a sound card, the - sound drivers aren't properly installed in your system, or your sound card is - not compatible with DirectSound (part of Microsoft's DirectX API - [Support.txt]). Also make sure that 'Disable SPC Emulation' is NOT checked. - See [GUI.txt] for more information about sound settings in ZSNES. - - Try (re-)installing the latest version of DirectX, and make sure you have the - latest drivers for your sound card (WHQL Certified, if possible). - - Please also note that ISA sound cards tend not to work with Windows, while - they do with DOS. - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3. SDL-SPECIFIC QUESTIONS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -................................ - General -................................ - -Q: Can I run ZSNES without X? -A: Yes, but you'll need to have SDL compiled to use SVGAlib. - -Q: I got ZSNES from my distro and I found a bug. To whom should I report it? -A: Compile ZSNES yourself and see if the bug still exists. If it does, - please tell us, otherwise be happy that ZSNES works now, and give your - distro a heads-up if you feel motivated enough. - -Q: Should I use SVN? -A: SVN ("Subversion") is the best way to get the most up-to-date ZSNES source. - It is best to double-check with SVN if you have a problem, since we might - have already fixed it. If you find a new problem in SVN, please tell us, but - be warned that we won't take it too seriously if it involves something that's - currently being worked on. - - To check out and install ZSNES from SVN, refer to this thread on the ZSNES - board [http://board.zsnes.com/phpBB2/viewtopic.php?t=7371]. - -Q: I'm getting an error about gzdirect() missing when I try to compile ZSNES. - What's up? -A: Make sure you're using zlib 1.2.3 or higher. Some distributions say you have - zlib 1.2.3 but in reality give you an older version. If your distribution is - being problematic, compile zlib yourself. Grab the latest version of zlib at - the official website. [http://www.zlib.net] - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4. DOS-SPECIFIC QUESTIONS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -................................ - Video -................................ - -Q: How do you enable transparencies? -A: First, try setting the video mode to a 16-bit color mode in the GUI. (If - 320x240x16b doesn't work, then try 640x480x16b). If it gives you an error - that says that your video card isn't compatible with VESA 2.0, you might want - to get Scitech Display Doctor. It provides certain cards with VESA 2.0 - support. Running with transparencies on is definitely slower because of the - extra math equations, memory, and video space involved. - -Q: Why is there a layer of fog blocking my view? -A: You need to either enable transparencies (see above), or you can disable - certain backgrounds by pressing the 1, 2, 3, or 4 keys. If you get lost while - pressing those keys, press 6 to re-enable all of the backgrounds. - -Q: Why am I getting error messages regarding VESA 2 drivers? -A: Here is a list of the various error codes that you may be coming across, - along with descriptions of what they mean: - * VBE not detected - ZSNES failed to detect any VBE interrupts (Your video - card doesn't support VESA). - * VESA not detected - ZSNES failed to detect any VESA extensions (Your - video card doesn't support VESA). - * VESA 2.0 or greater required - Your video card supports VESA, but it has - an older version. You may want to use SciTech Display Doctor - [http://www.scitechsoft.com/sdd.html] to upgrade your VESA driver. - * VESA 2 mode does not work on your video card/driver - Meaning that the - resolution you requested does not exist in the supported resolutions of - your video card. Choose a different resolution or upgrade with SDD, - which can sometimes help increase the number of resolutions supported. - * Unable to initialize video mode - A VESA 2.0 driver is found, but the - video mode failed to start. There could possibly be an error on the - video card setting, or it may be a defective piece of hardware. - * Linear frame buffer not detected - Meaning that your video card does not - support linear frame buffering, which is required for the ZSNES VESA 2 - routines. - -................................ - Sound -................................ - -Q: Why is there no sound? -A: There could be several situations: - - - You haven't enabled sound. You can enable it through the GUI or through - zsnes.cfg. Also make sure that 'Disable SPC Emulation' is NOT checked. - - You need to make sure that the SET BLASTER variable is set properly. To do - this, type SET in DOS and look for a string starting with "BLASTER=". If - such a string exists, then this is not your problem. - - You don't have a SB2.0 compatible sound card. If this is your case, there - is nothing you can do at the moment. ZSNES uses auto-initialization mode - for sound which requires SB2.0+. - - Your SB IRQ conflicts with another device. If this is the case, you might - want to check your sound card settings through Control Panel -> System. - - ZSNES doesn't like your sound card. - - You can try using VDMSound [http://sourceforge.net/projects/vdmsound/]. - -Q: Are there any plans to improve detection for non-SoundBlaster cards (or - supporting non-SB cards)? -A: There is little effort put into major changes to the DOS code, since so few - people use that port these days. However, we will gladly accept anyone's help - in improving the DOS sound code. - -Q: I get a sound initialization error using my SB Live! (or any other PCI card). - How do I fix it? -A: Here is a solution: (Thanks CyberGodz for the post on the forums!) - - SB Live! uses what is known as a NMI, or Non Maskable Interrupt, to emulate - SB 16 sound. Don't ask us exactly what it does (it's a type of IRQ) but that - is pretty much all it is good for. - - The problem is that many sound cards either lack NMI support or don't have it - enabled (No NMI = No DOS support). - - To try and solve this problem, do the following: - - - Check your BIOS. If there is an option for RAM parity checking, enable - it; it usually turns on NMI support. If there is something that says - "NMI", turn it on. - - If you don't find anything in your BIOS, then go to your motherboard's - website and download the latest BIOS flash. Install it and try your DOS - sound (You may still have to enable the stuff in the BIOS afterwards). - - Failing the first two things, you could either get a new motherboard or - get another compatible sound card alongside the SB Live!. Just attach a - cable from the line out of the SB 16 to the line in of the SB Live!. - Enable line in on the mixer of your SB Live! and it should route the - sound through the old sound card (Don't use the SPDIF to connect the - cards if you have one; wave sound doesn't pass through SPDIF--only MIDI). - -................................ - Input -................................ - -Q: Why doesn't my Sidewinder pad work? -A: First, for non-USB Sidewinders, you should disable the Sidewinder profiler - from the Win9x icon tray, run ZSNES, set Input #1 as SidewinderPad1, then - press the mode button a few times. If that doesn't work, try the following: - - - Try checking or unchecking the Sidewinder Fix option under - Config Menu -> Options and repeat the above steps. - - Fully disable the Win9x Sidewinder drivers by going to Control Panel/Game - Controllers. Then remove the Sidewinder (Thanks Scarlet-Slider for this - info!). - - Run ZSNES under pure DOS. - - Again, try checking or unchecking the Sidewinder Fix in the options menu of - the GUI and repeat the above 2 steps. - - Make sure your Sidewinder is plugged in and is not broken. - - For USB joysticks, you can either set ZSNES as a 6-button joystick or - simulate keyboard keys through the Sidewinder profiler by setting Input #1 as - a keyboard with those defined keys. - -Q: How do I get my daisy-chained Sidewinder to work? -A: First, run ZSNES. Temporarily disconnect the second Sidewinder pad from the - first one, get the first one to work, then re-connect the second Sidewinder - pad. - -Q: Why doesn't my Gamepad Pro work? -A: For the non-USB version, be sure to have your Gamepad Pro set on 'GrIP' mode. - Then set the input device as Gamepad Pro P0. For the USB version, you can use - a keyboard emulator, which should be included with the software that came - with your joystick. - -Q: Why doesn't my joystick work anymore? -A: You might have accidentally clicked the 'Use Joystick Port 209H' check box. - Just uncheck it. - -Q: Why does JB5/JB6 keep getting pressed whenever I try to change a key? -A: Try changing your joystick type from 6-button to 4-button. - -................................ - Freezing/Crashing Issues -................................ - -Q: Why does ZSNES freeze when I run it under pure DOS? -A: Try loading your mouse driver or run ZSNES using the -j switch. For the most - compatible result, use the Microsoft Mouse driver if possible. - -Q: Why does ZSNES crash when I load a ROM? -A: It could be that ZSNES doesn't recognize your sound configuration. To fix it, - disable sound or try changing your sound configuration. Also see this - question: (Universal-->Freezing/Crashing Issues) "Why does ZSNES crash - as soon as I load a ROM?" - -Q: Why does ZSNES freeze when I try to enter the GUI? -A: Run ZSNES using the commandline -j. - -Q: ZSNES gives me an "out of memory" error and I only have 16MB of RAM. How do I - fix this? -A: If you are running the DOS port of ZSNES from within Windows, try restarting - the computer in DOS mode; more RAM should then presumably be available for - ZSNES to use. To get it running under Win9x, first create a shortcut to the - DOS prompt on the desktop (the filename 'target' can be "C:\command.com"). - Next, right-click on the icon and go to Properties. Then, select the Memory - tab and look below for Protected Mode (DPMI) settings and set a high value - (like 20000). Last, double-click on that icon and load ZSNES as usual. - -................................ - Miscellaneous -................................ - -Q: I'm using DJGPP 2.03 and I get an error about missing stdint.h. What's wrong? -A: You're probably missing this file. Download the latest version of this file - and put it in DJGPP's include directory. - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/readme.txt/games.txt b/tools/zsnes/docs/readme.txt/games.txt deleted file mode 100644 index 98df4e2..0000000 --- a/tools/zsnes/docs/readme.txt/games.txt +++ /dev/null @@ -1,600 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - - * GUI [GUI.txt] - - * Netplay [Netplay.txt] - - * Advanced Usage [Advanced.txt] - - * Games [Games.txt] - 1. ROMs - 2. Compatibility - 3. Special-Chip Games - 4. Special Cartridges - - BS-X (Satellaview) - - Super Gameboy - 5. Individual Game Issues - 6. Games Supported by ManyMouse - 7. Multiplayer List - - * FAQ [FAQ.txt] - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - - * History [History.txt] - - * About [About.txt] - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ G a m e s -================================================================================ - -............................................................ - 1. ROMS -............................................................ - -** ROMs are not included with ZSNES!!! ** You must find them on your own. - -Please read Wikipedia's article on ROM Images for a general overview. -[http://en.wikipedia.org/wiki/ROM_image] - -In relation to SNES emulation, a "ROM image" is a computer file which is an -exact copy of the data that is contained in a 'R'ead 'O'nly 'M'emory chip inside -a game cartridge. This file contains the same data that a real SNES console -reads from the game cartridge. An SNES emulator loads this ROM into its own -memory, very much like how a real SNES operates. - -A problem appears when you have a ROM image that is not an exact copy of the -data on a real SNES cartridge. Many of the ROMs available for download on the -Internet are not in fact exact copies of real SNES games. There are a variety of -reasons why a ROM that appears to be a real game is not an exact copy of the -cartridge data. For example, the ROM may have been incorrectly "dumped" from the -cartridge, which can introduce errors. Certain prolific ROM "releasers" will -"hack" a ROM to include an introduction that advertises the releaser. Regardless -of the reason for an imperfect ROM image, these "bad" ROMs can display errors -when they are played in an emulator. - -Emulator developers generally try to make their emulators work with "good" ROMs; -that is, ROMs that are perfect copies of the data on a real game cartridge. The -developers of ZSNES in particular are unable to provide any help to people who -are using "bad" ROMs. You must use a good ROM if you want any chance of playing -an error-free game. - -We recommend using NSRT to verify that your ROMs are "good" dumps. In some -cases, NSRT can actually modify a "bad" ROM in such a way that it becomes a -"good" ROM. Please read the documentation included with NSRT for additional -information. [http://nsrt.edgeemu.com] - - -............................................................ - 2. Compatibility -............................................................ - -There are many reasons why a particular ROM may not work correctly with ZSNES. -Here is a list of things you can do to improve your chances of a ROM working -with ZSNES: - - * Make sure your ROM is actually a "good dump." Often a ROM appears to be from - a particular game/cartridge, but it *is not* in fact a perfect copy of the - data on that cartridge. You can use NSRT to scan your ROM and tell you if it - is a good dump. In some cases, NSRT can actually modify a "bad" ROM in such - a way that it becomes a "good" ROM. - * Your ROM may be a game that uses the SuperFX special chip. It may also be - "interleaved." ZSNES cannot detect when a ROM is interleaved with the - SuperFX interleave method. There is more information about this below, in - the Special-Chip Games section under SuperFX. In cases where ZSNES cannot - detect a ROM's interleave method, ZSNES will incorrectly report the ROM as - -not- interleaved, and the ROM will fail to load. - * If you have turned off sound, you should re-enable it. If you wish to mute - the sound output, simply move the volume slider to 0%. Many games require - sound emulation to be active in order to work correctly, so disabling sound - can "break" a lot of games. - * If you have changed the percentage of execution in the ZSNES configuration - file, change it back to 100. However, there are a few particular games that - may work better if the percentage to execute is set to either 120% or 80%. - -The developers of ZSNES make no guarantee that any particular game will work. -While we wish to play these incompatible games as much as you do, sometimes it -is just not possible. Furthermore, ZSNES is in a constant state of development. -Compatibility with a particular game may change between releases of ZSNES. - -In the past, ZSNES developers programmed the emulator to "hack" certain games. -These "hacks" would modify in-memory certain incompatible games, to get them to -work with ZSNES. Some hacks were also used make certain games run at full speed -if they were too slow. Sometimes, however, a particular game hack will break -other parts of accurate SNES emulation. - -As the emulation accuracy of ZSNES has improved, these hacks have become less -necessary. In general, game hacks are removed whenever possible. With the -current state of emulation in ZSNES, no new game hacks will be added. - -In conclusion, if you have tried the steps above, and your game still doesn't -work, *we're sorry*; however there is nothing we can do. ZSNES is developed for -*emulation accuracy*, with game compatibility as a side effect, *not* the other -way around. The most you can do is try another emulator or hope that ZSNES will -become accurate enough to be able to run your particular game. - - -............................................................ - 3. Special-Chip Games -............................................................ - -The approximate percentage of emulation progress for these special chips is -listed under Current Progress [Readme.txt]. - -The NSRT SNES Add-on Chip information article was frequently referenced for the -information assembled on this page. [http://nsrt.edgeemu.com/INFO/chipinfo.htm] - -You may find that the section on Enhancement chips in the Super Nintendo article -at Wikipedia contains some interesting historical information, not covered in -this FAQ. [http://en.wikipedia.org/wiki/Super_Nintendo_Entertainment_System] - -A number of games developed for the Super Nintendo included additional -special-purpose processors on the game cartridge. A game would use this special -processor to accomplish something that wasn't possible using just the standard -SNES hardware. It is impossible to represent these processors with ROM data; in -order for these games to work, ZSNES must emulate these special processors, in -addition to all the standard SNES hardware (which ZSNES already emulates). - -Below is a list of all known special processors, followed by a list of the games -known to use each processor. - - - - - - - C4 - - - - - - The C4 chip is a math co-processor with limited graphical processing - capabilities. - - * Megaman X 2 (USA) / Rockman X 2 (Japan) - * Megaman X 3 (USA, Europe) / Rockman X 3 (Japan) - - - - - - - - - - - Nintendo DSP - - - - - - - - - - Each of the Nintendo DSP chips have identical hardware, but different software - (firmware). - - + DSP-1 (supported) - * Ace wo Nerae! - * Armored Trooper Votoms - * Ballz 3D / 3 Jigen Kakutou Ballz - * Battle Racers - * Drift King Shutokou Battle '94 - * Drift King Shutokou Battle 2 - * Final Stretch - * Hashiriya Kon - * Korean League - * Lock On - * Michael Andretti's Indy Car Challenge - * Pilotwings - * Super 3D Baseball - * Super Air Diver - * Super Air Diver 2 - * Super Bases Loaded II - * Super F1 Circus Gaiden - * Super Mario Kart - * Suzuka 8 Hours - + DSP-2 (supported) - * Dungeon Master - + DSP-3 (partially supported) - * SD Gundam GX - + DSP-4 (supported) - * Top Gear 3000 (USA) / Planets Champ TG 3000 (Japan) - - - - - - - OBC1 - - - - - - * Metal Combat - - - - - - - SA-1 - - - - - - “The SA-1 is a 65816 chip, although at a higher clock then the SNES's - internal one.” [Quoted from http://nsrt.edgeemu.com/INFO/chipinfo.htm] - - * Asahi Shinbun Rensai - Katou Ichi-Ni-San Kudan Shougi Shingiru - * Daisenryaku Expert WWII - * Derby Jockey 2 - * Dragon Ball Z - Hyper Dimension - * Hanyuu Meijin no Omoshiro Shougi - * Harukanaru Augusta 3 - Masters New - * Hayashi Kaihou Kudan no Igo Taidou - * Itoi Shigesato no Bass Tsuri No.1 - * J. League '96 Dream Stadium - * Jikkyou Oshaberi Parodius - * Jumpin' Derby - * Kakinoki Shougi - * Kirby Super Star (USA) / Hoshi no Kirby - Super Deluxe (Japan) - / Kirby's Fun Pak (Europe) - * Kirby's Dream Land 3 (USA) / Hoshi no Kirby 3 (Japan) - * Marvelous - * Mini Yonku Shining Scorpion - Let's & Go!! - * Pebble Beach no Hatou New - Tournament Edition - * PGA European Tour - * PGA Tour 96 - * Power Rangers Zeo - Battle Racers - * Saikousoku Shikou Shougi Mahjong - * SD F-1 Grand Prix - * SD Gundam G-NEXT cartridge ROM (G-NEXT.SFC) - * Shin Shougi Club - * Shougi no Hanamichi - * Shougi Saikyou - * Shougi Saikyou II - * Super Bomberman - Panic Bomber W - * Super Mario RPG - * Super Robot Wars Gaiden - * Super Shougi 3 - Kitaihei - * Taikyoku Igo - Idaten - * Takemiya Masaki Kudan no Igo Daishou - - - - - - - S-DD1 - - - - - - * Star Ocean - * Street Fighter Alpha 2 (USA/Europe) / Street Fighter Zero 2 (Japan) - - - - - - - - - Seta DSP - - - - - - - - Seta's DSP has 2 major firmwares. - - + Seta 10 / ST010 (supported) - * F1 ROC II (USA) / Exhaust Heat II (Japan) - + Seta 11 / ST011 (partially supported) - * Hayazashi Nidan Morita Shougi - - - - - - - - - Seta RISC - - - - - - - - The Seta RISC chip is not emulated. - - + Seta 18 / ST018 - * Hayazashi Nidan Morita Shougi 2 - - - - - - - - SPC7110 - - - - - - - * Far East of Eden Zero - * Far East of Eden Zero - Shounen Jump no Shou - * Momotarou Dentetsu Happy - * Super Power League 4 - - ZSNES does not fully support the SPC7110 chip yet. However, you may use some - third party graphics decompression packs to get the four above games to work. - - The SPC7110 graphic packs are mirrored on a number of sites on the Internet. - Here are a few: - - * ipher's WIP Pages [http://other.ipherswipsite.com/gpacks/] - * NSRT Official Site [http://nsrt.edgeemu.com] - * Caitsith2's Personal Web Page [http://www.caitsith2.com] - - After you have downloaded all of the parts, extract them all into a new - directory on your disk. Then go to the Config-->Paths menu in the GUI - and enter in the location of the folder in the appropriate field. - - - - - - - S-RTC - - - - - - * Daikaijuu Monogatari II - - - - - - - - SuperFX - - - - - - - * Dirt Racer - * Dirt Trax FX - * Doom - * Star Fox (USA / Japan) / Starwing (Europe) - * Stunt Race FX (USA / Europe) / Wild Trax (Japan) - * Super Mario World 2: Yoshi's Island - * Vortex - * Winter Gold - - ** ZSNES does not support interleaved SuperFX ROMs! ** - An interleaved ROM is one in which the data is arranged differently than in - the original, real SNES cartridge. While ZSNES has the ability to read the - most common types of interleaved ROMs, it cannot read interleaved SuperFX - ROMs, or even determine that they are interleaved. - - You can use NSRT [http://nsrt.edgeemu.com] to deinterleave your SuperFX ROMs, - or if you prefer, all your ROMs. Consequently, the creator of NSRT (Nach) has - also written a document about the technical details of interleaved SNES ROMs, - if you are interested. - "The Grand Document on the many SNES Interleave Algorithms": - [http://nsrt.edgeemu.com/forum/kb.php?mode=article&k=2] - - -............................................................ - 4. Special Cartridges -............................................................ - -The approximate percentage of emulation progress for these special cartridges is -listed under Current Progress [Readme.txt]. - - - - - - - - - - - - - - - - - - Same Game; SD Gundam G-Next - - - - - - - - - - - - - - - - - - These were special games released only in Japan. They could be played by - themselves, standing alone, but they could also be played with special - additional cartridges, which plugged into the top of the main cartridge. - These extra cartridges used the same form-factor as the BS-X memory - cartridges, and they would improve or change the main game in some small way - (similar to the Sonic and Knuckles cartridge for Sega Genesis). - - You can play the original cartridges by themselves by loading them like any - normal ROM. In order to play these games as if they had an expansion cartridge - plugged in, you must first configure the paths to the base cartridge ROMs - under Config -> Paths. After defining the path to the base ROMs, you can now - load the expansion ROM like any normal ROM. ZSNES will virtually "plug in" the - expansion ROM to the base ROM, and load both of them at the same time. - - The NSRT file names for these ROMs are "SAMEGAME.SFC" and "G-NEXT.SFC", - respectively. - - - - - - - - - - - Sufami Turbo - - - - - - - - - - - Gamers Graveyard has some pictures and information on the Sufami Turbo. - [http://www.gamersgraveyard.com/repository/snes/peripherals/sufamiturbo.html] - - The Sufami Turbo is a special add-on, manufactured by Bandai, and released - only in Japan. The games were sold on small, GameBoy-sized mini-cartridges, - two of which could simultaneously be plugged into the Sufami Turbo main - cartridge. Certain combinations of games could interact with each other. - - To emulate the Sufami Turbo, you will first need the Sufami Turbo BIOS. - You must configure the path to this BIOS under Config-->Paths. - - The NSRT file name for the Sufami Turbo BIOS is "STBIOS.BIN". - - If you use NSRT, your Sufami Turbo ROMs will have .st extensions. In order to - load two ROMs at once (to emulate two simultaneously loaded cartridges), you - must use the command line. As an example, you would type in: - zsnesw.exe "C:\Path\To\ROMs\sufami turbo rom 1.st" - "C:\Path\To\ROMs\sufami turbo rom 2.st" - Note that you must type the FULL path to both ROM images. The example is - specific to the Windows command line and ZSNES port, but you get the idea. - - You may occasionally come across a Sufami Turbo ROM that is hacked to include - the BIOS with it. Use NSRT with the -split command to separate the BIOS from - the ROM. This will give you at least two separate files: one will be the game, - and the other will be the BIOS. You may even get 3 files: Two games and one - BIOS. After you have separated the BIOS and the game(s), simply follow the - directions stated above. - - - - - - - - - - - - - - - - - - - Broadcast Satellaview (BS-X) - - - - - - - - - - - - - - - - - - - Please read the Satellaview article on Wikipedia for additional information. - [http://en.wikipedia.org/wiki/Satellaview] - - This add-on was released only in Japan. It allowed gamers to connect to a - satellite feed at certain times of the day, which would transmit games to the - Super Famicom. Downloaded games were optionally stored on a small, - eight-megabit mini-cartridge, which plugged into the top of the BS-X main - cartridge (which in turn plugged directly into the Super Famicom). Many games, - some of which had time limits, were made exclusively for the BS Satellaview. - - Currently, ZSNES can partially emulate the BS-X; some games will have graphics - glitches, some games can be coaxed into running by changing certain settings, - but some games won't run at all. - - Also note that there is a BIOS for the BS-X. You may configure the path to the - BS-X BIOS under Config -> Paths; however, it's not currently required to run - BS games. It may be required in the future. - - The NSRT file name for the BS-X BIOS is "BS Satellaview BS-X (BIOS) (J).sfc". - - - - - - - - - - - Super GameBoy - - - - - - - - - - - ** The Super GameBoy is not emulated. There are currently no plans to support - it. ** This is because the Super GameBoy cartridge contains a complete set of - GameBoy hardware (without screen and speakers, of course). Thus, to fully - support the Super GameBoy, ZSNES would have to emulate both the SNES and a - GameBoy. In addition, there are some very complex interactions between the - Super GameBoy and SNES hardware that are not yet fully understood. - - "But wait," you say, "I have a Super GameBoy BIOS! Won't this allow ZSNES to - emulate a Super GameBoy?" - - The answer is "no." The BIOS you have is only the software for the Super - GameBoy, not the hardware, and thus is no help in emulating the Super GameBoy - hardware. In the meantime, there are some GameBoy emulators, such as KiGB - [http://kigb.emuunlim.com], BGB [http://bgb.bircd.org], and VisualBoyAdvance - [http://vba.ngemu.com], that faithfully support some of the more useful - features of the Super GameBoy. - - -............................................................ - 5. Individual Game Issues -............................................................ - - - - - - - - - - - - - - - - - - - Chrono Trigger - - - - - - - - - - - - - - - - - - - How do you get past the part in Chrono Trigger where you have to press the - L, R, and A buttons? - - Assign two or all three of these SNES controller buttons to the same keyboard - key. You can do this under Config Menu -> Input. Please read the note about - keyboard limitations in the Input section [GUI.txt]. - - - - - - - - - - - - - - - - - - - Star Ocean - - - - - - - - - - - - - - - - - - - This game is difficult to emulate correctly, and there are also bugs within - the game itself. The battles in the game are emulated at an incorrect speed, - and the game will often freeze or crash randomly. You may encounter more - issues. You can find detailed information about the bugs in this game at - RPGClassics [http://www.rpgclassics.com/shrines/snes/so1/bugs.shtml]. - - For best results, we recommend that you use an emulator that runs the game - more accurately, such as Snes9x [http://www.snes9x.com]. - - -............................................................ - 6. Games Supported by ManyMouse -............................................................ - - ZSNES supports Ryan C. Gordon's ManyMouse library, which allows you to take - advantage of games that support usage of two SNES add-on devices at once. - [http://icculus.org/manymouse/] - You will need two mice plugged into your computer. - - Here is a list of known games that support two SNES add-on devices - simultaneously: - - - Arkanoid - Doh It Again - - Bishoujo Senshi Sailor Moon S - Kondo ha Puzzle de Oshiokiyo! - - Fun 'N Games - - Koutetsu no Kishi (and its two sequels) - - Lamborghini - American Challenge - - Lord Monarch - - Motoko-chan no Wonder Kitchen - - Operation Thunderbolt - - Revolution X - - Shien's Revenge - - Super Castles - - T2 - The Arcade Game - - Tin Star - - Tokimeki Memorial - - Linux users should remember to type - chmod a+r /dev/input/* - at the shell after both mice are plugged in. - - This feature is not implemented in the DOS port. - - ManyMouse currently does not support BSD either, so Windows, Linux, or - Mac OS X is required. - - -............................................................ - 7. List of Multiplayer Games -............................................................ - -Please note that this list does not include any sports games (since they are -easy to recognize and most of them are multiplayer). It also does not include -games with only 2-player alternating modes nor games that require the SNES -Mouse/Super Scope. Also, this list does not generally have sequels or other -derivatives listed; if the original is listed here, it's likely its sequels -and derivatives support multiplayer, too. - -This list is not necessarily complete. - - Aero Fighters - Art of Fighting - Battletoads in Battlemaniacs - Battletoads vs DoubleDragon - Brawl Brothers - Brutal: Paws of Fury - Captain Commando - Clay Fighter - Contra 3 - Darius Twin - Double Dragon 5 - Dragonball Z Super Butoden - Dragonball Z Hyper Dimension - Faceball - Fatal Fury - Fighter's History - Final Fight 2 & 3 - Ghoul Patrol - Goemon - Goof Troop - Gundam Wing: Endless Duel - Joe & Mac - Jurassic Park 2 - The Chaos Continues - Killer Instinct - King of Dragons - King of the Monsters - Kirby's Avalanche - Kirby's Dreamland 3 - Kirby Super Star - Legend of the Mystical Ninja - Lemmings - Megaman 7 (Secret Code - password 1415/5585/7823/6251 and press L+R+Start) - Metal Warriors - Mortal Kombat - Ms. Pac-Man - NP Mario Picross Series - Peace Keapers - Pirates of the Dark Water - Pocky & Rocky - Pop'n Twinbee - Power Instinct - Primal Rage - Puzzle Bobble - Raiden - Rampart - Ranma 1/2 - Rise of the Robots - Rival Turf - Rock N' Roll Racing - Run Saber - Sailor Moon - Samurai Shodown - Secret of Mana - Seiken Densetsu 3 - Shaq Fu - Star Fox 2 - Star Trek Starfleet Academy - Street Fighter 2 - Street Fighter 2 Turbo - Street Fighter Alpha 2 - Street Racer - Stunt Race FX - Sunset Riders - Super Bomberman - Super Mario All-Stars (SMB3 minigame) - Super Mario Kart - Super Mario World 2: Yoshi's Island (At map, press X,X,Y,B,A) - Super Offroad - Super Smash TV - Super Street Fighter 2 - Suzuka 8 Hours - Teenage Mutant Ninja Turtles 4 - Turtles in Time - Teenage Mutant Ninja Turtles 5 - Tournament Fighters - Tetris - The Great Circus Mystery - Top Gear 2 - Top Gear 3000 - Tuff E Nuff - Ultimate Mortal Kombat 3 - Uniracers - Wild Guns - World Heroes - Wrecking Crew '98 - Zombies Ate My Neighbors - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/readme.txt/gui.txt b/tools/zsnes/docs/readme.txt/gui.txt deleted file mode 100644 index 31458ed..0000000 --- a/tools/zsnes/docs/readme.txt/gui.txt +++ /dev/null @@ -1,1494 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - - * GUI [GUI.txt] - 1. Game Menu - 2. Quick Menu - 3. Config Menu - 4. Cheat Menu - 5. Netplay Menu - 6. Misc Menu - 7. F1 Menu - 8. Save Slot Chooser - - * Netplay [Netplay.txt] - - * Advanced Usage [Advanced.txt] - - * Games [Games.txt] - - * FAQ [FAQ.txt] - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - - * History [History.txt] - - * About [About.txt] - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ G. U. I. (Graphical User Interface) -================================================================================ - - -------------------------------------------------------------------------- -| Quick | Game | Config | Cheat | Netplay | Misc | -|----------------|------------|----------|----------|----------|-----------| -| 1. | Load | Input | Add Code | Internet | Misc Keys | -| 2. | Run | Devices | Browse |----------| GUI Opts | -| 3. | Reset | Chip CFG | Search | | Movie Opt | -| ... | Save State | Options |---------- | Key Comb. | -| 8. | Open State | Video | | Save CFG | -| 9. | Pick State | Sound | | About | -| 0. | Quit | Paths | ----------- -| Freeze Data: |------------| Saves | -| Clear All Data | | Speed | - ---------------- ---------- - -ZSNES uses a custom GUI, introduced in v0.600. - -You can move the ZSNES window either by clicking and dragging its title bar, or -right-clicking anywhere in the ZSNES window and dragging. You can move dialogs -within ZSNES by clicking and dragging their respective title bars. - -If any dialog is open within ZSNES, pressing ESC will close the top-most window. - -If a game is loaded and running, you can press ESC to pause emulation and show -the GUI. Pressing ESC again will hide the GUI and resume emulation. - -Certain options throughout the GUI have an associated hotkey. Notice that many -options have a letter in them that is underlined; pressing that letter on your -keyboard will toggle the option. - - -............................................................ - 1. Game Menu -............................................................ - -- - - - - - - - - - - - - - - - - - - - - . Load . -- - - - - - - - - - - - - - - - - - - - - - This opens the file loading dialog. Use this dialog to browse for a ROM to - load and begin emulation. - - Filename box - Displays files in the current directory in alphabetical order. - Double-click on a file to load it. Use the Show All Extensions option to - change what types of files are displayed in this box. - Directory box - Displays all subdirectories in the current directory. - Double-click on items in this box to navigate between folders. The first - item in this box is always two dots (..); double-click this item to move - to the parent directory of the current directory. Displayed below the - current subdirectories are all drive letters detected on your system. - Use these drive letters to change between drives. - Current directory - Below these two boxes, the current directory is displayed. - By default, the current directory will be the same directory in which the - ZSNES executable is located. - Address box - By typing letters into this box, you can go to the first - filename or directory that matches the string of letters you typed. - Current selection - Below the text box, the current / highlighted - selection is displayed. In the DOS port, this line does not display the - current selection, but instead says "Display Type:". - Display Type: - Choose what type of filename to display in the Filename box. - Long Filename (Win/SDL) or Win9x Long Filename (DOS) displays the actual - name of the files in the current directory, along with their extensions. - SNES Header Name will display the internal SNES header names of the files - in the current directory. - * ZSNES can display header names using English and Kanji - characters. Characters in other languages are not supported and - will be displayed as garbled text. Improper or invalid header - names will also be garbled text. - * The header names of compressed files will not be displayed. - * If for some reason the header of a file cannot be displayed, the - filename of that file will instead be displayed. - * Warning: Using this option can make navigating folders a slow - process, since each time you navigate to a new folder, ZSNES - must scan all files in the folder for their header names. - DOS 8.3 Format (DOS only, default for DOS) will truncate all filenames - to be compatible with DOS filename length restrictions (up to eight - letters in the filename, plus a three letter extension). - Show All Extensions (off by default) - When this option is not checked, - only files with common SNES ROM extensions (.smc, .sfc, ...) will be - displayed. When this option is checked, all files will be displayed, - regardless of extension. When used in combination with the SNES Header Name - option above, non-ROM files will be shown as ** Invalid File **. - Force - Checking these boxes will force ROMs to be loaded as if they had those - settings, rather than having ZSNES automatically detect those settings. - Don't check any of these boxes unless you know what you're doing. - * NTSC / PAL: Force one of these display types for all ROMs loaded. - * HiROM / LoROM: Force one of these memory mapping settings for all ROMs - loaded. - Load button will load the current selection and begin emulation. - - Keyboard usage with the file load dialog is as follows: - Left / Right Arrows - Switch between the file and directory boxes. - Up / Down Arrows - Move up and down in the list. - PageUp / PageDown - Move up and down the list in larger increments. - Home / End - Go to the top or bottom of the list. - Typing characters - Go to the first item in the list that matches the - typed characters. - Enter / Return - Load the currently selected file or open the - currently selected folder. - - Address box details: - * If you input a single space, ZSNES will *randomly* select a game or - folder within the current directory, depending on which box is - highlighted. Then hit Load or press Enter to open the selection. - * When you press enter with text in the box without any '\' or ':' in - the filename, ZSNES will first look for a directory matching the text - and will then change its directory if one is found. Otherwise, it will - load the current file or directory highlighted by the selection cursor. - * You can type in the full filename or directory including path (e.g. - "d:\games\mario.smc" or just "d:"). - -- - - - - - - - - - - - - - - - - - - - - . Run . -- - - - - - - - - - - - - - - - - - - - - - Hides the GUI and resumes emulation. Equivalent to pressing ESC. - -- - - - - - - - - - - - - - - - - - - - - . Reset . -- - - - - - - - - - - - - - - - - - - - - - Resets the game; asks for confirmation. - -- - - - - - - - - - - - - - - - - - - - - . Save State . -- - - - - - - - - - - - - - - - - - - - - - Creates a save state of the game in the current save state slot; asks for - confirmation. See the Save States section for more information [Readme.txt]. - -- - - - - - - - - - - - - - - - - - - - - . Load State . -- - - - - - - - - - - - - - - - - - - - - - Loads a save state from the current save state slot; asks for confirmation. - See the Save States section for more information [Readme.txt]. - -- - - - - - - - - - - - - - - - - - - - - . Pick State . -- - - - - - - - - - - - - - - - - - - - - - Opens a dialog that allows you to pick the current save state slot. It's - easier to use the F3 Menu. - - * Select Save Slot: - Click on a radio button to use that save slot. - * Slot Level: - Use the + and - buttons to choose the slot level. - -- - - - - - - - - - - - - - - - - - - - - . Quit . -- - - - - - - - - - - - - - - - - - - - - - Exit the emulator. On exit, ZSNES will save any changes to its configuration - files. It will also save any changes to the Save RAM file, although you can - also configure ZSNES to write changes to the disk whenever Save RAM changes. - - -............................................................ - 2. Quick Menu -............................................................ - -- - - - - - - - - - - - - - - - - - - - - . The list of numbers . -- - - - - - - - - - - - - - - - - - - - - - The ten most recently loaded games are displayed here. By clicking on one - of these entries, you can load that game. This is a quicker way to load - a recently played game then using the Game->Load function and navigating - to the ROM. The most recently played game is #1. - -- - - - - - - - - - - - - - - - - - - - - . Freeze Data . -- - - - - - - - - - - - - - - - - - - - - - Off - The list will change as normal, reflecting the ten most recently - loaded ROMs. - On - The list will not change anymore. You can use this feature to create - a list of your ten favorite ROMs, for easy access at all times. - -- - - - - - - - - - - - - - - - - - - - - . Clear All Data . -- - - - - - - - - - - - - - - - - - - - - - Clears the entire list. - - -............................................................ - 3. Config Menu -............................................................ - -- - - - - - - - - - - - - - - - - - - - - . Input . -- - - - - - - - - - - - - - - - - - - - - - This dialog allows you to customize the input options for all five SNES - controllers. - - Tabs #1-#5 - Choose the SNES controller to configure. You can use the Tab key - to cycle through these tabs. - Device: - Use your mouse to choose your desired device, and use the Set button - to set your choice. - None - Equivalent to unplugging the SNES controller from that port. - Keyboard/Gamepad (Win/SDL only) - Equivalent to plugging in the SNES - controller to that port. Using this device should allow input from - all attached keyboards, gamepads and joysticks. - If you are using the DOS port, you must manually choose the appropriate - device from the list. - Current: - Shows the device that is currently active. - Buttons - Set - Set your choice made in the Device: box. Using this button will - reset key assignments to their defaults. - Set Keys - ZSNES will automatically cycle through each of the standard - SNES buttons, prompting you to assign a key to each one. - Calibrate (DOS only) - This option is here for those older joysticks that - need to be calibrated in-game before they can be used properly. - Keys: - These are the standard SNES buttons, and the only ones required to - be configured. Click inside the black box beside each one of these to - configure a key for it. Press ESC to clear the current assignment. - Turbo: - You can assign keys to these buttons in the same way you assign - them to the standard SNES buttons. Holding down the key assigned to the - turbo button is the same as if you were repeatedly pressing the normal - button very, very fast. You can control the rate of key presses per second - with the "Turbo at 30Hz" option, below. - Diagonals: - It may be more convenient to assign a single key to a - diagonal direction of the D-Pad, rather than pressing two keys at the - same time. Just in case it's not obvious: DL=Down+Left, DR=Down+Right, - UL=Up+Left, UR=Up+Right. - Game Specific - This option allows for input configurations that are specific - to individual games. - Sidewinder Fix (DOS port only) - If your Sidewinder doesn't work after - disabling the Sidewinder profiler and having pressed the mode button twice, - enable this. - Allow U+D/L+R - This option allows for the simultaneous pressing of opposing - directional keys (up and down; left and right) on the SNES pad. This feature - was implemented for those who need it to exploit bugs in certain games for - recording "speed-run" ZMVs. Warning: Do not use this for normal gameplay, - as the resulting bugs disrupt the "natural" gaming experience. - Turbo at 30Hz - Default: Checked. When enabled, turbo keys will equal 30 - button presses per second in NTSC games or 25 presses per second in PAL - games. Otherwise, turbo keys will repeat 60 times per second in NTSC games - or 50 times per second in PAL games. This option is enabled by default - mainly because some games can't handle excessive key presses. - Use Pl3/4 as Pl1/2 - The key assignments for Player 3, in addition to - those for Player 1, will be used for SNES controller port #1. The key - assignments for Player 4, in addition to those for Player 2, will be - used for SNES controller port #2. As a result, MultiTap support will be - disabled (which means only two controllers will be active). The primary - use of this option is to allow you to assign two different devices for - the same SNES controller. For example, you might use a gamepad as input - for Player 1, and a keyboard as input for Player 3. Then, with this - option enabled, you may use either one of these devices (or both - simultaneously) to control Player 1. - Use Joystick Port 209H (DOS only) - Use the 209H hardware port; use this - if you have moved the port's jumper (or if your joystick does not work - when this feature is disabled). - - Note: A keyboard is a poor replacement for a proper gamepad. SNES games are - designed to be played with a gamepad, so if you find that you're having - trouble with the keyboard, use a gamepad. - - There is another important limitation with keyboards. Many keyboards have - a limit on the maximum number of simultaneous key-presses, above which they - will not detect input. This means combinations of, for example, three or - more keys may not be properly detected. One way to get around this kind - of keyboard limitation is to assign multiple SNES buttons to the same - keyboard key. There is a slightly longer explanation in the FAQ [FAQ.txt]. - -- - - - - - - - - - - - - - - - - - - - - . Devices . -- - - - - - - - - - - - - - - - - - - - - - This dialog allows you to select special input devices for Ports 1 and 2 - of the SNES. - - Port 1: - Select a device to be plugged into Port 1. The SNES Mouse is the - only special device supported on Port 1. - Gamepad - Use the key assignments for Player #1, configured in the - Input dialog. - Mouse - Use your computer's mouse just like it is a connected SNES - Mouse. - Port 2: - Select a device to be plugged into Port 2. - Gamepad - Use the key assignments for Player #2, configured in the - Input dialog. - Mouse - Use your computer's mouse just like it is a connected SNES - Mouse. - Super Scope - Use your mouse as if it were a Super Scope. Default - key assignments are in the Default Keys section [Readme.txt]. - 1 Justifier - Simulates the movements for the Konami Justifier; - required for only one game, Lethal Enforcers. - 2 Justifiers - - Cycle P1:, Cycle P2: - You can assign a key to each of these functions. - Pressing the key will cycle through the list of special controllers - available for that port. - Left Handed - Check one of these boxes to reverse the mouse buttons for the - special controllers on that port. - Super Scope Keys: - They can now be customized! - Auto-Fire - Default: =. Toggle auto-fire on or off. - SS Pause - Default: Backspace. Assign a key for the Super Scope pause - button. - - Note: ZSNES will automatically enable the appropriate add-on for special - controller games that have NSRT headers [http://nsrt.edgeemu.com] (e.g. - The SNES mouse will automatically hook up after loading Mario Paint). - Note: ZSNES supports the ManyMouse [http://icculus.org/manymouse/] library - by Ryan C. Gordon, which means that ZSNES can emulate two SNES devices - (one connected in each port) if you have two mice plugged in. For a list - of known affected games (and for other information), please see the - ManyMouse section of the Games page [Games.txt]. - -- - - - - - - - - - - - - - - - - - - - - . Chip CFG . -- - - - - - - - - - - - - - - - - - - - - - These are special settings for the Nintendo Super System. Generally, there - is no need for a user to change these settings. - - Super System: - Set which DIP switches are enabled. - DIP 1/2/3/4/5/6 - - - The Nintendo Super System was an arcade machine that used the SNES hardware. - Changing the settings in this window will only affect games - designed for the NSS. You can find information at Coin-Op Museum - [http://www.klov.com/game_detail.php?letter=N&game_id=8894] and - Wikipedia [http://en.wikipedia.org/wiki/Nintendo_Super_System]. - -- - - - - - - - - - - - - - - - - - - - - . Options . -- - - - - - - - - - - - - - - - - - - - - - You can change various options here, some of which affect gameplay, - while others merely change GUI behavior. - - System: - Enable MMX Support - Enables MMX copying routines for a slight speed - increase (MMX processors only). Certain video filters, audio - interpolation and low-pass filters require MMX support. These options - will not be visible unless the MMX Support option is checked. - (See below for the particular options requiring MMX support). - Pause Emu in Background (Win only) - If enabled, then game emulation - will automatically be paused when the ZSNES window loses focus, and it - will unpause when ZSNES regains focus. - Increase Emu Priority (Win only) - Enabling this will give ZSNES more - processor time, if needed. This may improve the performance of ZSNES on - your machine; however, it will reduce the amount of resources given to - applications running in the background. Processing priority is set to - "High" on a Win9x OS and "Above Normal" on 2k/XP/2003/Vista. - Disable Power Management (Win only) - Disables power management while - ZSNES is running, so that your gameplay will not be interrupted if - you're using a gamepad. - Gfx Engines: - Use New Gfx Eng - Default: Checked. Check to use the new graphics engine; - uncheck to use the old graphics engine. The new graphics engine should - be adequate for most games; however, the old one may be necessary for - some. You can read about the differences in Current Progress - [Readme.txt]. - Use Alt Old Gfx Eng - Only visible when the new graphics engine is - disabled, this will enable the Old Gfx Engine Mode 2, which fixes many - transparency bugs that currently plague ZSNES in the current engine. - However, it also creates some new ones. This mode can be slower at - times, so it's recommended that you only turn it on when you need it. - SShots: - Choose what image format to use for snapshots of the game screen. - This setting is also configurable via the F1 Menu. - * BMP - Snapshots will be saved as bitmap pictures (16-bit color). If you - are using an 8-bit video mode in the DOS port, the bitmap will be - saved with 8-bit color. - * PNG - Snapshots will be saved as PNG ("Portable Network Graphics") files - (32-bit ARGB color). This option is not available if you did not - compile with PNG support. - ROM: - Enable IPS Auto-Patching - When checked, ZSNES will automatically - soft patch ROMs if a corresponding .ips file is found in your Saves - directory. More information about the IPS patching feature can be found - in the Readme. - Show ROM Info on Load - Briefly displays some internal information about - the ROM when loaded. Please refer to this information when submitting - bug reports (also see [Support.txt]). - Log ROM Info - When checked, ZSNES will create a file named rominfo.txt - when you load a ROM; it contains information about the ROM. - Overlays: - Show FPS Cntr On Emu Load - When checked, the Frames per Second counter - will be enabled each time you start ZSNES, even if it has been disabled - during a session. The FPS counter can be manually enabled/disabled via - the F1 Menu or with the 'Display FPS' quick key, once it has been - assigned. This counter is only visible when using Auto Frame Rate. - Show Clock - The current system time will be displayed in the lower - right-hand corner of the game screen. - 12 Hour Mode - Used in conjunction with the option above, this will - display the system time in 12 hour mode instead of the default 24 - hour mode. - Show Clock Box - Also used in conjunction with "Enable Clock", - this option places a black box behind the clock to increase - readability. - Messages: - Use Small Message Text - On-screen messages that pop up when you save a - state, disable a background, etc. will be smaller. - Use Transparent Text - On-screen messages will be slightly transparent - rather than solid. Using the Small Message Text option overrides this - choice. - - -- - - - - - - - - - - - - - - - - - - - - . Video . -- - - - - - - - - - - - - - - - - - - - - - This dialog allows you to change the numerous video settings available in - ZSNES. - - Please note that the internal resolution of the SNES is 256x224. Certain - special high-resolution modes can produce up to 512x448 resolution. You - may notice that the internal resolution has an 8:7 aspect ratio. SNES - video output is not intended to be viewed at this aspect ratio, however. - The 8:7 video signal would normally be scaled to a more-typical 4:3 - aspect ratio when viewed on a television. - - - - - - - - - Modes tab - - - - - - - - Video Mode box - The large box on the left lists all available video modes. - You can use your mouse or the Up/Down/PgUp/PgDown/Home/End keys to scroll - through this list. - Win/SDL port: - First column: lists the resolution, in pixels, W x H. - W x H - These video modes use a fixed resolution, in pixels, - of the width and height shown. - Variable (SDL only) - Video output is scaled to the size of the - window, and the window can be resized with the mouse; however, - aspect ratio is locked, depending on which options are set. - Custom - Specify a custom, fixed resolution in the boxes - to the right. - Second column: - O (SDL only) - Indicates whether the video mode uses the - OpenGL API. - D - The video mode supports graphics-enhancing filters. - Non-'D' modes will usually be (automatically) interpolated - by your graphics card. - R - The video aspect ratio is locked to the internal SNES - ratio of 8:7. - S - Video output is stretched to fill the entire window. - Third column: indicates whether the video mode is Windowed or - Fullscreen. - DOS port: - First column: lists the resolution (in pixels) and color depth - (in bits), W x H x B. - Second column: shows the mode type - ModeQ - A tweaked VGA video mode. Supports 256x256 resolution - and 256 colors. Accesses hardware directly. - ModeX - A different tweaked VGA video mode, similar to ModeQ, - although slower. Accesses hardware directly. - Vesa1 - VESA ("Video Electronic Standards Association") VBE - ("Video BIOS Extension") 1.2. A standardized method of - accessing VGA cards. - Vesa2 - VESA VBE 2. Faster and more features than VESA1. - Read the Wikipedia article for an overview - [http://en.wikipedia.org/wiki/VESA_BIOS_Extensions]. - The first [http://www.ddj.com/184409592] and third - [http://www.faqs.org/faqs/pc-hardware-faq/supervga-programming/] - external links from that article provide some more detailed - information. - Your video card may be compatible with only some of the video modes - listed. You should try each video mode to find the right combination - of speed, compatibility, and enhancement features (listed below). - Set button - use the currently selected/highlighted video mode. ZSNES will now - attempt to change to the new video mode. If the new video mode does not - work, wait for ten seconds without pressing any keys, and ZSNES will return - to the previous mode. Pressing Enter does the same thing as the Set button. - Custom: (Win/SDL only) - use in conjunction with one of the custom - video modes at the bottom of the list to set a custom resolution. - Set button - save the current custom resolution. - Type in the custom width and height, respectively, in pixels, - in the two black boxes. - Current: - shows the current video mode. - - Note: Some video modes may work better / faster than others, depending - on your system configuration. Play around to see what's best. - - - - - - - - - - Filters tab - - - - - - - - - Video Filters: - Choose one video filter. You must use a D video mode - to use any of these filters. Furthermore, filters marked with a * - require MMX Support. - Interpolation - Enable interpolation, a simple filter that smooths the - image and makes it appear less pixellated. This is software-driven and - can be accelerated with MMX support. - Bilinear Filter [http://wiki.beyondunreal.com/wiki/Bilinear_Filtering] - (OpenGL modes only) - This produces an effect similar to Interpolation. - The option replaces Interpolation and, as long as you aren't using Mesa - [http://www.mesa3d.org], is hardware-driven. This means that as long as - you aren't using Mesa, it requires less CPU overhead. Another advantage - of the bilinear filter is that it can also be used alongside the other - filters, though this may be slow. - NTSC [http://www.slack.net/~ant/libs/ntsc.html] (Win/SDL only) - - Written by blargg. It is recommended to use a video mode with at least - 602x448 resolution. Makes the video output appear to be that of an NTSC - CRT [http://en.wikipedia.org/wiki/Cathode_ray_tube] television - [http://en.wikipedia.org/wiki/Ntsc]. This filter is not available - in the SDL port while using OpenGL modes. - 2xSaI Engine* [http://elektron.its.tudelft.nl/~dalikifa/] - Written by - Kreed. SaI stands for "Scale and Interpolation." This is a "smart" - filter that tries to make a lo-res image (like SNES video output) - appear to have a higher resolution. The image should look smoother, - less blocky, when using this filter. - Super Eagle* - Written by Kreed. Similar to the 2XSaI engine, but - does more blending. - Super 2xSaI* - Written by Kreed. This filter smoothes the graphics, - but it blends more than the Super Eagle engine. - HQ2X* [http://www.hiend3d.com/hq2x.html] (Win/SDL only) - Written by - MaxSt. Applies an advanced algorithm to smooth the appearance of a - low-resolution image. It is recommended to use a 2x scaled image with - this filter. - HQ3X* [http://www.hiend3d.com/hq3x.html] (Win only) - Written by MaxSt. - More advanced than HQ2X, and it is recommended to use a 3x scaled image - with this filter. - HQ4X* [http://www.hiend3d.com/hq4x.html] (Win only) - Written by MaxSt. - More advanced than HQ3X, and it is recommended to use a 4x scaled image - with this filter. - Note: The HQxX filters and the NTSC filter have particularly high - system requirements to run smoothly. - Scanlines: - Choose one Scanline mode. Requires a 'D' video mode. - None - This will disable scanlines. - 25% - This will enable scanline mode, except that each line is 25% darker - than the line above it. - 50% - This will enable scanline mode, except that each line is 50% darker - than the line above it. - Full - This mode adds a blank line in between every line to produce - a scanline effect similar to a TV. - Misc Filters: - Choose miscellaneous filters. - Grayscale Mode - Makes the game display in monochrome color, i.e. - black and white. This option is just there for fun and is probably not - something you want to use continuously. - Hi-Res Mode 7 - Requires a 'D' video mode and at least 512x448 resolution. - Enabling this will double the vertical resolution used when rendering - Mode 7 graphics. Thus, the resolution becomes 256*448 rather than the - normal 256*224. - Monitor Sync: - Select monitor synchronization options. - VSync (Win/DOS only) - Synchronizes frame drawing to the monitor's - refresh rate. This may reduce frame rate on your computer, but will - reduce screen tearing. - Triple Buffering (Win/DOS only) - This setting is only visible while - using a fullscreen video mode, and only applies while in fullscreen. - Whereas VSync has only two frame buffers: the frame being drawn and - the frame waiting to draw, Triple Buffering can write frame data to - a third buffer. The primary use is to reduce the impact of VSync on - slower systems. This option has precedence over VSync in Fullscreen - modes. - Display Options: - Select how you want the image to be displayed. - Use 4:3 Ratio (Win/SDL only) - This only applies when using a custom mode. - Using this option will lock the video output at 4:3 aspect ratio, - regardless of the aspect ratio of the custom resolution you've chosen. - Small Screen (DOS only) - Video output will be at 256x224 (the native - internal resolution of the SNES), instead of whatever resolution - you are using. - Full Screen / Wide Screen (DOS only) - Horizontally stretches video output - to fill the screen. - Not all of the video options above are available in every video mode - and every port of ZSNES. Also note that you will need a fast computer - for some of them if you don't want to see any slow-downs in emulation. - - - - - - - - - NTSC tab - - - - - - - - Only visible when using the NTSC filter. - - Blend Frames - Enable this for smoother transitions between frames when using - a non-60Hz refresh rate. - Refresh - If this is enabled, changes to the NTSC filter will be applied - as you are adjusting the sliders (below), rather than when you release - the mouse button. - The sliders below are used to adjust various properties of the NTSC output. - Hue - Saturation - Contrast - Brightness - Sharpness - Presets - Press the appropriate button for instant configuration of the - filter, instead of manually configuring. - Composite - S-Video - RGB - Monochrome - Reset button - Reset all settings on this tab only to their defaults. - Reset All button - Reset all settings on both NTSC tabs to their defaults. - - - - - - - - - - - Adv NTSC tab - - - - - - - - - - Only visible when using the NTSC filter. - - The sliders below are used to adjust various properties of the NTSC output. - Gamma - Resolution - Artifacts - Fringing - Bleed - Hue Warping - Reset button - Reset all settings on this tab only to their defaults. - Reset All button - Reset all settings on both NTSC tabs to their defaults. - -- - - - - - - - - - - - - - - - - - - - - . Sound . -- - - - - - - - - - - - - - - - - - - - - - Configure various sound settings here. - - The default settings are those that are most accurate to a Super Nintendo. - - Sound Switches: - Disable SPC Emulation - Disables the emulation of the SPC700 chip. - Do not disable this unless you are having severe performance issues - (i.e. ZSNES is unacceptably slow and you've tried everything else). - Disabling this will likely result in sound errors. - Enable Sound - Default: Checked. Unchecking this disables sound output. - Do not disable this unless you are having severe performance issues - (i.e. ZSNES is unacceptably slow and you've tried everything else). - If you wish to mute ZSNES, just move the volume slider down to 0%. - Enable Stereo Sound - Default: Checked. Unchecking this will disable - *stereo* sound output; thus, sound output will be mono instead. - Disabling this is a relatively safe way to improve speed, if necessary. - Reverse Stereo Channels - Reverse/swap the left and right stereo channels. - This makes no difference if stereo sound is disabled. - Simulate Surround Sound - This is a novelty feature that simulates - surround sound in games that don't have it natively. Do *not* use this - in conjunction with games that have native surround sound. This option - is only available when stereo sound is enabled. - Force 8-bit Output (DOS only) - Force ZSNES to output sound in 8-bit mode. - Using this may work around problems with certain sound cards, but will - reduce sound quality. Note that if you use stereo sound in addition to - this option, you will not be able to use sampling rates above 22050Hz. - Use Primary Buffer (Win only) - Enable this only if your sound card is - having problems designating the sound buffer with DirectSound. This will - prevent sharing the sound card with other programs. This option is - primarily useful for troubleshooting in Win9x. You must restart ZSNES - for this feature to take effect. - Sampling Rate: - Default: 32000Hz. Click inside the black box to cycle through - all available sampling rates. Note that if you use sampling rates that are - below the default, the sound will be distorted and inaccurate. Sampling - rates higher than 32000Hz can also cause problems; however, sampling rates - of 41000Hz and higher may resolve crackling issues that occur with some - onboard sound cards. - Volume Level - To change, just slide the bar. Sliding this to 0% is a better - method of muting sound output than unchecking the Enable Sound box. - Interpolation: - This feature smoothes out the wave forms of lower frequency - sounds. - None - Use no interpolation. This is *not* accurate to the SNES! - Gaussian - Default. Based on the Gaussian curve, it smoothes the - transition of the sound effects. This method of interpolation is used - by a real SNES. - Cubic Spline - This method is calculated by a cubic equation rather than - being based on a curve like the Gaussian method. This results in - better approximation than the Gaussian method. - 8-point* - Takes 8 points on the sound curve and smoothes them out. - LowPass: - Low-pass filters accentuate bass frequencies by reducing higher - frequencies. None of these filters are native to the SNES; if you want - authentic SNES sound, do not use any of these. Using a filter will probably - be most noticeable if you have a subwoofer. - None - Use no low-pass filter. - Simple - Allows lower frequencies to pass through (e.g. drums and - the like). Certain higher ranges are not heard though. - Dynamic - Allows greater range of frequencies to pass through; - the music will seem more detailed depending on the loudness or - softness of the audio. - Hi Quality* - It's better than the simple filter, and seems to work well - with lower quality speakers that have decent sound cards. - *Requires MMX Support. - -- - - - - - - - - - - - - - - - - - - - - . Paths . -- - - - - - - - - - - - - - - - - - - - - - Set and change paths used for save directories, graphics packs, and base - cartridges. - - Saves: - Configure the directory where ZSNES will save and load SRAM, save - state, and ZMV files. If you do not specify a path here, ZSNES Win and DOS - will save all files to the same directory as the currently loaded ROM. - ZSNES SDL will place them in "~/.zsnes". ZSNES SDL under Mac OS X will place - them in "~/Library/Application Support/ZSNES". - Snapshots: - Configure the directory to which in-game snapshots will be saved. - If you do not specify a path here, snapshots will be saved to your Saves - directory (above). - SPCs: - Configure the directory to which SPC700 sound dumps (.spc; SNES - music files) and sound buffer dumps will be saved. If you do not specify - a path here, these files will be saved to your Saves directory (above). - BIOS/Base Carts - Set the path to BIOS and base cartridges of various - special games. - BS-X: - Specify the full path and filename to the Broadcast Satellaview - BIOS. Currently, the BIOS is *not* required to run BS games. - Sufami Turbo - Specify the full path and filename to the Sufami Turbo - BIOS, which is required to play ST games. - Same Game: - Specify the full path and filename to the Same Game base - cartridge ROM. - SD Gundam G-Next - Specify the full path and filename to the SD Gundam - G-Next base cartridge ROM. - SPC7110 Graphic Packs - Enter the directories that contain SPC7110 graphic - packs in the appropriate fields here. More information about this chip is - in the Games page [Games.txt]. - FEOEZ: - Far East of Eden Zero - FEOEZ-SJNS: - Far East of Eden Zero - Shounen Jump no Shou - MDH: - Momotarou Dentetsu Happy - SPL4 - Super Power League 4 - - Notes: - * One limitation of ZSNES is that it only accepts one case of input. - Since most UNIX-based systems are case-sensitive, SDL port users should - edit their paths in the configuration file instead. - * Paths can be absolute (e.g. C:\ZSNES\saves) or relative - (e.g. ..\..\saves). - * If you are using the Win port, you can paste text from the clipboard - into the text boxes by using the key combination Ctrl+V. - * Remember to always press Enter or Return after typing in your path, - or it may not work! - -- - - - - - - - - - - - - - - - - - - - - . Saves . -- - - - - - - - - - - - - - - - - - - - - - Configure various options regarding save states and in-game saves. - - # of Rewind States - This sets how many times you can rewind back. - Note that you must restart your game for this feature to take effect. - 1/5 Seconds Per Rewind - This sets how many fifths of a second ZSNES will - rewind back each time. - Do Not Save SRAM - When enabled, SRAM will never be saved at any given point. - This is useful when you want to look into savestates or movies without - saving the modified data to disk. This also prevents SRAM Check+Save from - working. - SRAM Check+Save - Normally, ZSNES will write SRAM data to disk when you exit - the emulator or exit to the GUI. When this option is enabled, ZSNES will - instead write SRAM data shortly after a game modifies it. If you have - problems with in-game saves not working correctly, or if you fear something - may prevent ZSNES from exiting normally (i.e. crashing), turn this on. - The reason this is not enabled by default is because some games use SRAM as - working memory instead of for persistent saved games. Since these games - constantly modify SRAM, ZSNES would write to the disk every few seconds - (if this option is enabled). - Load Save State w/ SRAM - When enabled, the SRAM data from the save states - you load will overwrite any other SRAM data for the game that you have. - Beware, though: if you are really far in a certain game, loading an old - save state from a point earlier in the game will make you lose all of - your progress beyond that save state. However, this option may be needed - to load complete states in certain games. - Start at Latest Save - With this enabled, every time you load a ROM, the - save state slot containing the most recent save state for that game will - be set as the currently selected slot. - Auto Increment Save Slot - When enabled, the save slot will automatically - move to the next slot after you save a state. This option is very useful - in that it decreases the risk of accidentally saving over a previous - save state, if you forget to manually advance the chosen slot. - Auto State Save/Load - If this is enabled, ZSNES will automatically create a - save state when you quit a game (either by loading another game or by - exiting the emulator). When you return to the game at a later time, ZSNES - will automatically load the save state it created before. - Pause After... - Press the P key to unpause. - Loading State - Pauses emulation after you load a save state. - Pause After Rewind - Pauses emulation after you press the rewind key. - State Shortcuts: - Click in a black box to assign a key to that function. - Press ESC to clear the current assignment. - ST0 through ST9 - Choose which save state slot to use. - ST+ - Increment the selected save state slot by one. - ST- - Decrement the selected save state slot by one. - Save - Default: F2. Save a state to the current slot. - Load - Default: F4. Load a state from the current slot. - Pick - Default: F3. Open a dialog to choose the current save state slot. - This will show a graphical preview of each save state. Learn more - about how to use this dialog in the Save State Slot Chooser section - at the bottom of the GUI page [GUI.txt]. - Rewind - With each use, this key will backtrack the gameplay - incrementally, according to the options you have set for - '# of Rewind States' and '1/5 Seconds Per Rewind' (see above). - -- - - - - - - - - - - - - - - - - - - - - . Speed . -- - - - - - - - - - - - - - - - - - - - - - Change speed settings and frame skipping settings here. - - Max Frame Skip - Set the maximum number of frames that may be skipped - in direct sequence when rendering, only as needed to keep a constant - emulation speed. Applicable only when using Auto Frame Rate (below). - Frame Rate - Set a static number of frames to skip rendering between each - rendered frame, when *not* using Auto Frame Rate (below). - FastFwd Ratio - Set the number by which the default emulation speed will be - multiplied while using Fast Forward. - SlowDwn Ratio - Set the number by which the default emulation speed will be - divided while using Slow Down (e.g. "4" is 1/4 of normal speed). - Shortcuts: - Assign keys to various speed options. - Fast Forward - Default: ~ key. When used, the speed of emulation will - increase (according to the FastFwd Ratio, above). Useful for quickly - bypassing game intros or other sequences that you may not want to watch. - Slow Down - When used, the speed of emulation will decrease (according to - the SlowDwn Ratio, above). This function requires having Auto Frame Rate - (below) enabled. You might use this to watch very fast animated - sequences, or to give yourself an advantage when you need to react - quickly to something in the game. - + Emu Speed - Move the Emu Speed slider to the right by one step, - increasing emulation speed sequentially (e.g. 1x -> 2x, 2x -> 3x, etc.). - + Frame Rate - Increase the static number of frames to skip rendering. - Using this key will disable Auto Frame Rate. - Reset Speed - Sets the emulation speed back to normal (1x). - - Emu Speed - Move the Emu Speed slider to the left by one step, - decreasing emulation speed sequentially (e.g. 1x -> 1/2x, 1/2x -> 1/3x, - etc.). - - Frame Rate - Decrease the static number of frames to skip rendering. - If you decrease it enough times, Auto Frame Rate will be enabled. - Pause Game - Default: P key. Pauses emulation. - Increment Frame - Only usable when emulation is paused, this feature will - increment one frame each time the key is pressed. - Toggled FFwd/SlwDwn - When unchecked, you must hold down the Fast Forward or - Slow Down keys for as long as you want them to operate. When checked, press - and release the assigned key once to enable the desired mode, and once again - to turn it off. - Auto Frame Rate - Default: Checked. When enabled, ZSNES will attempt to - maintain emulation at full speed. If necessary to maintain full-speed - emulation, ZSNES will skip rendering frames of video. When disabled, ZSNES - will skip a static number of frames for each rendered frame. If your - priority is full-speed emulation, you should have this enabled, and increase - Max Frame Skip (above) to its maximum. If your priority is to have every - frame of video rendered, you should either have this enabled and set Max - Frame Skip to zero OR disable this and set Frame Rate (above) to zero. - Emu Speed: - Default: 1x. Only available when using Auto Frame Rate. This - slider sets the number by which normal emulation speed will be multiplied or - divided (to speed up or slow down emulation speed, respectively). - - -............................................................ - 4. Cheat Menu -............................................................ - -The Cheat dialogs are only accessible if a game is loaded. - -Read the Cheat Codes section in the Readme [Readme.txt] for general information. - -Nach, the creator of NSRT, has a complete list of all official Game Genie codes, -available at [http://nsrt.edgeemu.com/forum/kb.php?mode=article&k=3]. - -- - - - - - - - - - - - - - - - - - - - - . Cheat Browser . -- - - - - - - - - - - - - - - - - - - - - - Selecting Add Code from the Cheat menu opens this dialog with the cursor in - the Enter Code: text box. Selecting Browse from the Cheat menu starts with - the cheat list highlighted. - - Use this dialog to add, remove, and browse cheat codes. - - Cheat Browser - This lists all cheats that you have added for the currently - loaded game. You can have up to 255 codes per game. Each cheat is - represented on a single row (except in the case of multi-line cheats). - Each column gives different information about the cheat, as follows: - Address - Memory address that the cheat edits. - CV - Current value of the selected memory address. - PV - Previous value of the selected memory address. - Tgl - Shows whether the cheat is toggled (active) or not. - Description - The description for the cheat that you typed into - the Description: box when adding the cheat. - Buttons - Remove - Remove the currently highlighted cheat. - Toggle - Toggle on or off the currently highlighted cheat. This can also - be accomplished by double-clicking on a code. - Save - Save all cheats in the list to a .cht file. - Load - If a .cht file exists in your saves directory, this will load all - cheats from that file into the Cheat Browser. - Fix - If you have entered a cheat and it doesn't appear to work, you can - try using this button to change the memory address that the cheat edits, - which might fix the problem. - Enter Code: - Type in the cheat code. Game Genie, Pro Action Replay, and - GoldFinger codes are supported. Remember that Game Genie codes require - the - (dash). - Description: - Type in a description for your code. - Add button - Add the code to the Cheat Browser once you have filled in the - previous two boxes. - Auto-load .cht file at game load - When you load a ROM, ZSNES will look in - your saves directory for a matching .cht file, and load it. This prevents - you from having to hit the Load button, above. - - Notes on usage: - * To use a multi-line cheat code, just enter each line as a separate code! - * You can also quickly modify the value of the currently selected cheat code - (in the browse window) by typing a 2 digit hex number in the cheat code - enter space. - * You can allow a value of one cheat code to be mirrored from a value of - another cheat code. To do this, type an 'R' at the end of any cheat code - as the destination, then type another cheat code (Without the 'R') as the - source. For example, if you want address 7E1000 to reflect the value at - address 7F2000 (whatever value written to 7F2000 from the game will also - be written to 7E1000), enter cheat code 7E1000FFR, then cheat code - 7F2000FF (where FF can be any value). - - Keyboard usage: - * Use the Up and Down arrows to scroll through the Cheat Browser. - * Use the R, T, S, L, and F keys to duplicate the functions of the five - buttons below the Cheat Browser. - * Use Tab to move from the Enter Code: box to the Description: box. - -- - - - - - - - - - - - - - - - - - - - - . Search . -- - - - - - - - - - - - - - - - - - - - - - Selecting Seach from the Cheat menu opens the Cheat Search dialog. Use this - to search for values in memory such as life, score, etc. and change their - values as you please. - - - - - - - - - - - Setup Search - - - - - - - - - - - Select Size and Format: - Size: You can choose the data size to use in your search. If you know the - numerical values of the data you want to view, select the smallest - number range that fits the data values. (For example, if you know the - value cannot go higher than 50000, select 2 BYTES [0..65535] instead of - 3 BYTES [0..16777215]). Sometimes you don't know the numerical value (in - the case of life bars), so you have to guess the size. - 1 Byte [0..255] - Value is stored in 8 bits. - 2 Bytes [0..65535] - Value is stored in 16 bits. - 3 Bytes [0..16777215] - Value is stored in 24 bits. - 4 Bytes [0..4294967295] - Value is stored in 32 bits. - Format: In general, it's recommended that you use decimal, although there - are some cases that have the values in memory stored as binary-coded - decimal. For example, "34 lives" could be stored in a byte as 34h, and - if you were searching for it in the decimal mode, it would actually have - a value of 52. - Dec (Base 10) - The number you search for will be treated as a - decimal number. - Hex (Base 16) - The number you search for will be treated as a - hexadecimal number. - Select Search Type: - Exact Value Search - In this mode, you have to enter the exact numerical - value that you want to find. If you have 3 lives left, then search for - the value 3. The cheat search engine also looks for "value - 1" since - even if a game tells you that you have 3 lives left, it usually stores - the value as 2 in memory. - Comparative Search - In this mode, you select whether the value is less - than, greater than, equal to, or not equal to the previous value. So if - you have a life bar and the life bar suddenly decreases, go back to the - cheat search engine and select "less than" to search for any value that - has decreased. - Start button - Move to the next step of the search, entering a value. - -- - - - - - - - - - - - - - - - - - - - - . Exact Value Searches . -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Input Value - - - - - - - - - - Enter Value: - Enter the value for which you want to search and press the - Search button. - Max Value: - This is a reminder of the maximum value for which you can search. - Change this on the Setup Page (first step). - # of Results: - Displays the number of results for the current search. - Before you start a search, this will display the number of searchable - memory addresses for the currently loaded game. - Buttons - Restart - Move back to the Setup Page to change options. - View - View the results of the current search. If you have not yet run - your own search, this will display all searchable memory addresses for - the currently loaded game. - Search - Search for the value you entered in the box above. After you - press this button, this page will change to reflect the number of - results for your search. Press the View button to see those results. - - - - - - - - - - - View Results - - - - - - - - - - - This page lists all the results of your current search. If you pressed the - View button before running a search, this page will list all searchable - memory addresses for the currently loaded game. - - This list has two columns, the left column showing the memory Address, the - right column showing the Value at that address. - - * Return - Move back to the Input Page. - * Add - Use this to select the currently highlighted address for editing. - - - - - - - - - Add Cheat - - - - - - - - - On this page, you can add the previously selected memory address as a cheat. - - Enter New Value: - Enter a value to insert into the memory address. - Enter Cheat Description: - Do just what it says. - PAR Code Equivalent: - This box will display the equivalent Pro Action Replay - code for the value and memory address you are working with. - Max Value: - This is a reminder of the maximum value for which you can search. - Change this on the Setup Page (first step). - Use Only Upper Byte - Use this option to change how PAR Code Equivalent is - calculated. - Return button - Return to the Results Page. - Add button - Add the new cheat to the Cheat Browser. - -- - - - - - - - - - - - - - - - - - - - - . Comparative Searches . -- - - - - - - - - - - - - - - - - - - - - - This section isn't finished yet. Hopefully you can figure it out given the - description of Comparative searches in the Cheat Setup dialog, above. - - -............................................................ - 5. Netplay Menu (Win and SDL Only) -............................................................ - -Netplay has been disabled for the indefinite future, until the core becomes more -accurate and/or non-random. We recommend using ZSNES v1.36 or v1.42n -[http://nsrt.edgeemu.com/forum/viewtopic.php?t=448] until this is resolved. - -The Netplay dialog is only accessible if a game is loaded. - -- - - - - - - - - - - - - - - - - - - - - . Internet . -- - - - - - - - - - - - - - - - - - - - - - Port - Default: 7845. This is the port on which ZSNES will communicate. While - the number can range from 0 to 65535, it is recommended that you stay above - 5000 to avoid conflicts with other services. - Nickname - This is the name you will use, displayed in the Chat window (which - appears once you connect). - Start as Server - Use this button to be the host of the Netplay game. Your - opponent will connect to you and be the client. - Client Options: - Setup options here if you are going to be the client, not - the host. - IP: - Enter the IP ("Internet Protocol") address of the host. - Connect to Server - Use this button to attempt to connect to the - above-entered IP address. - Your IP: - Helpfully displays your current IP address. If you are going to be - the host, give your opponents this number so they can connect to you. - Use UDP instead of TCP - Decide which protocol to use for communication. - TCP ("Transmission Control Protocol") guarantees delivery of packets, - but has more overhead, and may thus be slower than UDP ("User Datagram - Protocol"). Try switching between the two to see which works best. - -- - - - - - - - - - - - - - - - - - - - -Establishing a Connection (Chat Window) -- - - - - - - - - - - - - - - - - - - - - - Window - This is quite obvious. You and your partner chat to each other - through this window. Simply type your message and press Return/Enter on your - keyboard, just like on an IRC or IM client. - Player Select - This indicates which players will be hosted locally and which - will be hosted remotely. A checked box means that your computer will have - control of that player. An 'X'ed box means the remote computer will have - control of that player. A blank box means that player is not enabled. - Latency - Default: 3. ?????????????????? - Back Buffer - Default: Enabled. ?????????????????? - Save Data - Determine whether the SRAM from your computer (local) or the other - computer (remote) should be used. You can also choose to not load any SRAM - at all. - Disconnect - Closes the connection and ends the netplay session. - - -............................................................ - 6. Misc Menu -............................................................ - -- - - - - - - - - - - - - - - - - - - - - . Misc (Miscellaneous) Keys . -- - - - - - - - - - - - - - - - - - - - - - Here you can change various function keys that are not configured elsewhere. - Clicking inside a black box will bring a box, prompting you to assign a key - to that function. Press the key you wish to assign, or press ESC to clear - the existing assignment. - - BG Disables: - BG1 through BG4 - Toggle the various graphical background layers - on or off. Normally, they should be left on. - OBJ - Toggle the sprite/background layer on or off. - Sound Keys: - Ch1 through Ch8 - Toggle the various sound channels on or off. - +Vol - Increase the volume. - -Vol - Decrease the volume. - Quick Keys: - Load - Opens the Load dialog (accessed from the Game menu). - Reset - Performs a soft reset of the game. Also available under - Game->Reset. - Exit - Exits ZSNES. - Clock - Toggle the clock, displaying system time on-screen during - gameplay. - Chat - This is available only while using Netplay. After pressing - this key, type your message, then press Enter/Return to send it to - the other user. - Snapshot - Save a snapshot of the game screen and place it in your - Snapshots directory. Also accessible through the F1 Menu. - Save SPC - Save SPC data to your SPCs directory. Also accessible through - the F1 Menu. - Misc Toggles: - Use PL12/34 - Toggles on or off the Use Pl3/4 as Pl1/2 option under - Config->Options. - Panic Key - Restores default settings for several toggles. Enables - Offset Mode, Windowing, and all Backgrounds, Sprites, and Sound - Channels; disables Add-ons; resets Emu Speed throttle. - Display FPS - Toggles on or off the Frames per Second counter. Also - accessible through the F1 Menu. You can also make this a persistent - option under Config->Options. - Battery Power (Win/SDL only) - Displays the amount of battery life - remaining and, if possible, time remaining, as reported by your - operating system. This feature is intended for laptop or notebook PCs. - GFX Toggles: - New GFX Engine - Switches between the faster, newer graphics engine - (default) and an older one. The new one is recommended, but using - the older one may fix graphics corruption in some games. - BG Window - A graphical feature that toggles windowing effects in - certain SNES games. - Offset Mode - A graphical feature that toggles using offsets for tiles - in certain SNES games. - + Gamma - Increase gamma level. This makes the video appear brighter. - - Gamma - Decrease gamma level. This makes the video appear darker. - -- - - - - - - - - - - - - - - - - - - - - . GUI Opts (Options) . -- - - - - - - - - - - - - - - - - - - - - - Configure various GUI settings not set elsewhere (like Config->Options). - - GUI Switches: - RClick Opens GUI - When enabled, clicking the right mouse button will - switch to and from the GUI when running a game (similar to pressing - ESC). However, this can slow down emulation, since ZSNES has to check - the mouse button status once in a while. If you are running in a - windowed video mode, the right-click button won't return back to - the game. - Swap L/R MButtons - Enabling this will swap the functions of buttons 0 - and 1 of your mouse. - Show Mouse Shadow - Disables/Enables the mouse shadow. - Mice Wrap GUI Win - Allows the mouse pointer to wrap (to the other side of - the screen) at the borders of the screen. You should probably only - enable this while in Fullscreen; in Windowed mode this behavior - can be annoying. - Trap Mouse Cursor (Win only) - Prevents the mouse cursor from exiting the - ZSNES GUI. You will have to move the mouse with extra speed to make the - cursor exit the GUI with this feature enabled. - Wheel Mice Scroll (Win only) - This feature allows you to use your mouse - wheel to quickly scroll through various lists in the GUI (e.g. game list - in load menu, video modes, etc.). In the SDL port, the Wheel should - always be enabled. - ESC to Game Menu - While running a game, pressing Esc will take you back - to the GUI with the Game Menu open, regardless of which menu was open - last. It will also make the Game Menu be already open when you start - ZSNES. If this is unchecked, you will have difficulty navigating the GUI - without a mouse. - Ctrl GUI w/GPad1 - When enabled, it allows you to use the device - configured for SNES Controller #1 to access the GUI. This way you can - use your gamepad or joystick instead of your mouse/keyboard. The - equivalent SNES keys to the keyboard keys are: - SNES D-Pad = Move mouse cursor - SNES A = Enter - SNES B = Esc - SNES L = PageUp - SNES R = PageDown - Filtered GUI - Any video filter settings will be applied to the GUI, in - addition to the game video output. - Use Custom Font - When checked, ZSNES will load font data from zfont.txt. - Save GUI Win Pos - When enabled, the GUI doesn't reset the locations of - the windows when you exit/enter the GUI. - BG Effects: - Only one of the following screen saver-like effects can be - enabled at a time. They are visible in the background while the GUI is open. - * None - no effect is active. - * Snow - Looks like falling snow. - * Burning - Looks like fire rising from the bottom of the window. - * Smoke - Looks like smoke rising from the bottom of the window. - * Water A - Looks like a water strider skimming across water. - * Water B - Looks like rain drops falling on water and creating ripples. - Color: - This section allows you to customize the colors used by the GUI. - Choose which part of the GUI to configure by selecting one of the - following: - * Back - Configure the color of the background of the GUI. - Defaults: R=10; G=15; B=31. - * Title - Configre color of the GUI's title bar. - Defaults: R=0; G=10; B=31. - * Win - Configure the background color of a dialog window. Dialog - title bar colors are not configurable. Defaults: R=8; G=8; B=25. - Use the sliders to change the relative quantities of Red, Green, and Blue - color for the part of the GUI you have chosen to configure. - Main Windows Options: - Emu Always on Top (Win only) - ZSNES will stay visible above other - windows, even if it loses focus. Minimize ZSNES if you need to access - other windows. - Save Main Window Position (Win only) - Saves the location of the ZSNES - window between sessions. - Allow Multiple Instances of Emu (Win only) - Allows you to open more than - one instance of ZSNES at a time. In the SDL port, multiple instances are - always allowed. - -- - - - - - - - - - - - - - - - - - - - - . Movie Opt (Options) . -- - - - - - - - - - - - - - - - - - - - - - The Movie Options dialog is only accessible if a game is loaded. - - You can record your gameplay so that you can play it back at a later date - either to amuse your friends, torture your friends, or whatever. Also be - sure to check out the Movies section of the Readme [Readme.txt], where - you can find more information on subtitles, re-recording, and more. - - Warning: Playing back a previously recorded movie will overwrite any SRAM data - for the current game with the SRAM data contained in the ZMV file. This - means you should back up your SRAM files when playing around with movies!! - - Select Movie: - Choose the movie recording slot to be used for - recording/playback. The number of the slot corresponds to the ZMV extension - (0 corresponding to .zmv, 1 to .zm1, ... 9 to .zm9). - Status: - Simply tells you if a record/playback is currently in progress. - - - - - - - - - - - Controls tab - - - - - - - - - - Record From: - Now - Begins recording the movie from the current point in the game. - Power - This will perform a hard reset (equivalent to shutting off the - SNES, then turning it back on again), then begin recording. - Reset - This will perform a soft reset (equivalent to using the Reset - button on the SNES), then begin recording. - Power+SRAM Clear - Performs a hard reset, then clears SRAM data - (in-game save data). Useful if, for example, you don't want to see - your saved games in the game menu when making your movie. - Main controls: - Play - Begins playing the movie that is recorded in the current slot. - Record - Begins recording a movie to the current slot. While in playback - mode, you can use this to start recording and redo the remainder of the - movie. - Stop - Stops playing or recording a movie. - Append - This is usable only if you already have an existing ZMV using the - new ZMV format. It allows you to continue recording a movie from the - point where it is stopped. Press this button only when the movie status - is inactive. - Chapters: - You can assign a key to each of these functions by clicking in - the black box next to each button and pressing a key. - Insert - During recording or playback, this can create a point (chapter) - to which you can seek during playback. - Previous - Only usable during playback, this "rewinds" the movie to a - previous chapter earlier in the movie. - Next - Only usable during playback, this "fast forwards" the movie to a - chapter that is found at a later point in the movie. - There is currently no method for deleting a chapter. - On Movie State Load: - Allow mode status to be changed when you are loading a - movie state. - Do Not Switch Modes - Don't change the current mode. - Switch to Record - Set the current mode to Record on load. - Switch to Playback - Set the current mode to Playback on load. - Display Frame Counter - Enable this to see the frame counter in the - bottom-left corner of the screen during playback/recording. This is useful - for determining where you can insert movie subtitles and for deciding where - you want to end a movie when dumping it with the Dump # of Frames option. - - - - - - - - - - Dumping tab - - - - - - - - - Video/Audio Dumping is recommended only for advanced users. More information - is found in the Movie Dumping section of the Advanced Usage page - [Advanced.txt]. - - Video Options: - You can only choose one of the following. - No Video Dump - Use this option when you want only audio. - Raw Video (No compression) - Dump raw 24 bit BGR video. This produces a - file that no typical media player can read. Only use this option if you - plan on manually encoding it. On UNIX systems, you can use a FIFO file - to encode this in real-time, as an alternative to ZSNES's internal use - of MEncoder. Caution: Raw movies require a tremendous amount of disk - space, so make sure you have plenty of room before you begin! - FFV1 (Some compression) - Dump in an AVI container using FFMPEG's lossless - video codec. The size of this file will be about 8% of the size of the - raw video file. - x264 Lossless (Most compression) - Dump in an AVI container using the very - advanced x264 codec in practically lossless mode (slow). The size of - this file will be about 38% of the size of an XviD file, about 6% of the - size of an FFV1 file, and about 0.5% of the size of a raw video file. - XviD Lossless (More compression) - Dump in an AVI container using the - popular XviD codec in practically lossless mode (fast). The size of this - file will be about 15% of the size of an FFV1 file, and about 1% of the - size of a raw video file. - Custom - Uses alternative, user-defined parameters from the zmovie.cfg - file. This option allows the use of multi-pass movie dumping to - massively reduce the size of the outputted video file. Caution: This - mode dumps lossy video; however, the default settings should look good - for most games. - Audio Options: - You can choose any combination of the following. - Dump Audio - Enable audio dumping. - Compress Audio - Audio output will be compressed to MP3 as it is dumped. - We recommend that you use this setting. When unchecked, audio output - will be in WAV format. - Merge With Video - Place the outputted audio in the AVI along with the - video. - Dumping Length: - Choose the length of the video/audio file(s) to be created. - ZMV Length - Simply dump the entire movie. - Dump # of Frames - This sets the exact number of frames of the movie to - dump, according to what you have typed in the black box at the right. - Until Stop - Keep recording until you stop dumping. This is primarily used - for recording a movie even after the ZMV has completed playback. You may - want to dump the ending of a game, which TAS (Tool-Assisted Speedruns) - reach but often don't capture in the ZMV. - Dumping: - Start - Start dumping the movie in the selected slot, using the current - settings. - Stop - Use this to stop dumping a movie before the process has finished. - - Saving or loading a state during recording will allow you to undo mistakes, - i.e. re-record, while making a movie. These states created during record - can also be loaded during playback, like chapters. However, unlike chapters, - you're limited to 100 of them. - - Loading another game will halt the play/record process. - - Movie dumping options can be tweaked by advanced users in the zmovie.cfg file - [Advanced.txt]. - -- - - - - - - - - - - - - - - - - - - - - Key Comb. (Key Combination Editor) . -- - - - - - - - - - - - - - - - - - - - - - Allows you to specify certain keyboard combination routines with a single - keystroke/joystick button press. - - List of combinations - Clear - Clears the current key combination field. - Add - Adds the key combination fields below as a new entry. - Replace - Copies the contents of the key combination fields below to the - current highlighted key combination above. - Delete - Deletes the highlighted key combination above. - Key - Clicking on this box will allow you to select which key/button to use. - Description - Allows you type in the description of the combination key. - P# - Selects which player # will use those keys. - > = Last - Enabling this would mean that the event symbol > will mean the - last left or right direction the user presses in the game and the symbol < - is the opposite of that direction. When disabled, > means right and < means - left. - Game Specific - Enabling this will tell ZSNES to use separate key combination - files for each individual game. - Combination Keys - This window will display the sequence of events selected by - the user. - Events: - Press+Rel - The key will be pressed and held. It will be released once - another key is pressed after any amount of frame or second delay. - Press Only - The key will be pressed and held. - Rel Only - The key will be released if it is pressed by a press only - event. - Frame Delay - Delays for the specified number of frames. - Second Delay - Delays for the specified number of seconds. - Del - Deletes the event at the end of the combination keys list if one - exists. - - Note: A 1 frame delay exists after the combination key list has finished - processing. - - Example Key Combination: (Down / Down+Right / Right / L): - Method 1: Press+Rel Down / 2 Frame Delay / Press+Rel Down / Press+Rel Right - / 2 Frame Delay / Press+Rel Right / 2 Frame Delay / Press+Rel L - Method 2: Press Only Down / 2 Frame Delay / Press Only Right / 2 Frame Delay - / Rel Only Down / 2 Frame Delay / Rel Only Right / Press Only L - -- - - - - - - - - - - - - - - - - - - - - . Save CFG . -- - - - - - - - - - - - - - - - - - - - - - Saves the configuration files. ZSNES normally writes to the configuration - files on exit. This function overrides the "cfgdontsave" option in the - .cfg file. - -- - - - - - - - - - - - - - - - - - - - - . About . -- - - - - - - - - - - - - - - - - - - - - - Just shows some information about ZSNES. - - * Version number - * Build date - * Port name - * www.ZSNES.com button (Win/SDL only) - Opens your default web browser - and loads the ZSNES.com Home Page [http://www.zsnes.com]. - * Documentation button (Win/SDL only) - Opens your default web browser - and loads the ZSNES Documentation Home Page. - [http://zsnes-docs.sourceforge.net] - * Coded By: - Main developers are listed. More information in the About - page of the documentation [About.txt]. - * Assistant Coders: - Assistant developers are listed. More information - in the About page of the documentation [About.txt]. - * Disclaimer. Please read the GNU General Public License [License.txt]. - - -............................................................ - 7. F1 Menu -............................................................ - -Use this menu to access oft-used functions. Most of these are related to dumping -data from the game you are running. - - Save Snapshot - Creates an image of the game screen in your Snapshots - directory. - Show/Hide FPS - Shows or hides the frames-per-second display which appears - on the bottom-left corner of the screen. The value shown on the right side - of the display is the rate that the SNES should be maintaining. This - counter is available only when in auto frame rate mode. You can have - this display enabled by default under Config->Options. - Save SPC Data - Using this will search for the beginning of the next song and - save the data into an SPC file. To capture a song, it is best/recommended to - initiate this feature approximately 2 seconds before the next song starts. - This does have potential to fail though, so don't expect it to work all the - time. The .spc file will be placed in your SPCs directory. - Sound Buffer Dump - This dumps ZSNES' sound buffer and also filters out any - unoccupied space. The sound buffer contains decompressed samples which are - written to when ZSNES plays/decodes a sample from sound memory. Because of - the way ZSNES buffers the sound data, this can produce inaccurate results. - The dump will be placed in your SPCs directory. - Snapshot/Incr Frame - Same as snapshot, but it returns to the F1 menu after - a couple of frames. Useful for making animations. - Incr Frame Only - Move forward one frame without taking a snapshot. - Move This Window - Moves the F1 menu to a different location. - Image Format: - Choose what image format to use for snapshots of the game - screen. This setting is also configurable under Config->Options. - * BMP - Snapshots will be saved as bitmap pictures (16-bit color). If you - are using an 8-bit video mode in the DOS port, the bitmap will be - saved with 8-bit color. - * PNG - Snapshots will be saved as PNG ("Portable Network Graphics") files - (32-bit ARGB color). This is not selectable while using an 8-bit mode - or if you did not compile with PNG support. - - -............................................................ - 8. Save State Slot Chooser -............................................................ - -Use this dialog to pick which save state slot to use. A graphical preview of the -save state will be shown above this dialog (it is not visible in the above -picture). - -How to Use: - 1. Press F3 to open this dialog. - 2. Use Up/Down arrow keys to move between save state levels. - 3. Use Left/Right arrow keys to move between save states on a certain level. - 4. Use Enter or Return or ESC to use the selected save slot. - 5. Use either F2 to save a state or F4 to load a state in the slot you just - selected. - -Color Key: - * Slots with blue backgrounds do not have a save state in them. - * Slots with red backgrounds have a save state in them. - * The slot with the orange background contains the most recent save state - within that state level. - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/readme.txt/history.txt b/tools/zsnes/docs/readme.txt/history.txt deleted file mode 100644 index 089a27d..0000000 --- a/tools/zsnes/docs/readme.txt/history.txt +++ /dev/null @@ -1,3329 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - - * GUI [GUI.txt] - - * Netplay [Netplay.txt] - - * Advanced Usage [Advanced.txt] - - * Games [Games.txt] - - * FAQ [FAQ.txt] - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - - * History [History.txt] - - * About [About.txt] - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ H i s t o r y -================================================================================ - -The following is the history of ZSNES, including the changelogs for every -official ZSNES release, and other major events. ZSNES was first released on -October 14, 1997. - -Spanning the releases between version 0.715 and version 0.990, an ASM-only -version was offered alongside the normal ASM+C version. Differences between -sister C/A releases are marked as appropriate. - -Note: All changelogs before v1.40 were copied from their original text source -inside the ZSNES official release packages. We edited the old changelogs as -little as possible in order to minimize the accidental loss of information. -Therefore, you may find spelling mistakes and formatting differences between -different versions. - -1. v1.51 - January 25, 2007 -2. v1.50 - December 22, 2006 -3. v1.42 - January 19, 2005 -4. v1.41 - January 18, 2005 -5. v1.40 - December 25, 2004 -6. v1.36 - July 15, 2002 -7. v1.35 - June 23, 2002 -8. v1.337 - September 30, 2001 -9. zsKnight Leaves - July 23, 2001 -10. v1.31b - July 3, 2001 -11. v1.31 - June 27, 2001 -12. v1.30b - June 16, 2001 -13. v1.30 - June 13, 2001 -14. v1.29, Win v1.00 - June 1, 2001 -15. v1.28b, Win v0.99 - May 28, 2001 -16. v1.28, Win v0.99 - Unknown Release Date -17. v1.26, Win v0.97 - May 17, 2001 -18. v1.25, Win v0.93 - May 15, 2001 -19. v1.20b, Win v0.88 - April 30, 2001 -20. Source Code Released - April 2, 2001 -21. v1.17b - December 27, 2000 -22. v1.17, Win v0.85 - December 25, 2000 -23. v1.14, Win v0.80 - November 27, 2000 -24. v1.12, Win v0.74 - November 14, 2000 -25. v1.11, Win v0.72 - November 12, 2000 -26. v1.10, Win v0.70 - November 7, 2000 -27. v1.01 - September 9, 2000 -28. v1.000 - September 1, 2000 - First Windows Release -29. v0.991 - May 24, 2000 -30. v0.990 - May 24, 2000 -31. v0.9891c/a - February 21, 2000 -32. v0.989c/a - February 12, 2000 -33. v0.988c/a - December 6, 1999 -34. v0.987c/a - November 26, 1999 -35. v0.986c/a - November 23, 1999 -36. v0.985c - November 15, 1999 -37. v0.963c/a - September 19, 1999 -38. v0.962c/a - September 18, 1999 -39. v0.960c - September 17, 1999 -40. v0.953c/a - August 4, 1999 -41. v0.952c - August 3, 1999 -42. v0.951c - August 3, 1999 -43. v0.950c - August 2, 1999 -44. v0.941c/a - July 18, 1999 -45. v0.940c/a - July 18, 1999 -46. v0.915c/a - July 7, 1999 -47. v0.910c/a - July 6, 1999 -48. v0.900c/a - July 4, 1999 -49. v0.800a - December 25, 1998 -50. v0.800c - December 24, 1998 -51. v0.715 - October 29, 1998 -52. v0.700 - October 26, 1998 -53. v0.635 - September 24, 1998 -54. v0.625 - September 18, 1998 -55. v0.605 - September 10, 1998 -56. v0.601 - September 9, 1998 -57. v0.600 - September 9, 1998 -58. v0.400 - May 19, 1998 -59. v0.393 - April 15, 1998 -60. v0.391 - April 13, 1998 -61. v0.390 - April 11, 1998 -62. v0.305 - February 12, 1998 -63. v0.300b - February 10, 1998 -64. v0.300 - February 9, 1998 -65. v0.297 - January 31, 1998 -66. v0.296 - Not Released? -67. v0.295 - January 29, 1998 -68. v0.270 - December 25, 1997 -69. v0.201b - November 5, 1997 -70. v0.201 - November 5, 1997 -71. v0.200 - November 4, 1997 -72. v0.182 - October 23, 1997 -73. v0.180 - October 22, 1997 -74. v0.170 - October 16, 1997 -75. v0.150 - October 14, 1997 - Initial Release - - -............................................................ -v1.51 - January 25, 2007 -............................................................ - -All Ports: ----------- - - Rejoice for finally having 224 lines and them being shown properly in all - cases. [pagefault] - - IRQ and timing fixes (fixes Chrono Trigger issues, Super Mario World, and - others). [pagefault] - - Fixed bug with certain commandline parameters permanently overwriting - config file settings. [Nach] - - Fixed bug with loading new ZMVs of a different version. [Nach] - - Loading ZMV with ROM mismatch prints a message. [Nach] - - Movie menu now has tabs and only shows proper options when available. - [Deathlike, Nach, grinvader] - - Slight improvement to the Custom Res functionality. [Deathlike, Nach] - - Keep4_3Ratio option now only shows when necessary. [Deathlike] - - PNG files now use extended height in extended height mode. [Nach] - - Pausing, rewinding, and fast fowarding are disabled during movie dumping. - [Nach, SamB] - - You can now force a movie dump length shorter or longer than the actual ZMV - length. [Nach, Deathlike] - - Fixes for MEncoder check; added LAME check. [Nach] - - Custom dumping with multiple passes implemented. [Nach] - - Fixed some bad memory reads in command-line parser. Thanks grinvader. [Nach] - - Now there's an option to switch to replay mode while recording movies when - loading a state and vice versa. [Nach, Deathlike] - - Fixed a bunch of bugs with certain save selection techniques not working - right. [Deathlike] - - Fixed gui font overwrite problem after fixing a cheat. The dots should be - gone now. [Jonas Quinn] - - You can now select the level of HQ filtering where applicable. [Deathlike] - - Many tweaks made to reduce GUI mem usage on all ports. [Deathlike] - - ZSNES now properly adheres to the command-line when Auto State Save/Load is - used. [Deathlike] - - Quick exit key now adheres to Auto State Save/Load. [Deathlike] - - Inc/Dec Gamma toggles actually DO something. Gamma level is now definable in - the config file. [Deathlike] - - Fixed bugs with playing back ZMVs of 2+ players at once. [Nach] - - Fix crash if you rewind farther than the game start in Kirby Super Star, - Secret of Mana and some other games. [Jonas Quinn] - - Fix crashing if using rewind in a movie before rewind slot is filled. Thanks - BoltR. [Nach] - - Readded the smoke effect. [Jonas Quinn] - - Fixed the Winter Gold crash (but not the freeze). [Jonas Quinn] - - Fixed crash in Super Demo World and possibly certain other large games. - [Jonas Quinn] - - Fixed loading many old ZSTs. [Jonas Quinn] - - Fixed some bugs with movies which load from power on with SRAM. [Nach] - - Fixed some issues with DSP-4 movies. [Nach] - - Added ability to have game-specific input. Main input is now stored in - zinput.cfg. [Nach, Deathlike] - - Added option in Config->Options for Screenshot format. [Deathlike] - - Fix crash on creation of ZMV if save path does not exist. Thanks Maximus. - [Nach] - - Logo support for AVI dumping. Set the logo file in zmovie.cfg; it can be - gzip'd if you want. [Nach] - - Pick state menu (default - F3) now has wraparound. Praise Pac-Man! - [Deathlike] - - Config file cleanup for more understandability. [Deathlike] - - New Don't Save SRAM option. [Deathlike] - - More GUI cleanup and tweaking, also reorganization. [Deathlike] - - Removed the horrible-sounding Mono Surround Sound code. [Deathlike] - - Source cleanup. [Deathlike, Phil^, Nach, grinvader] - - Parsegen now allows one to define inside a PSR file to have it reject arrays - from older config files. [Nach] - - Our assembly syntax shortener now is case-insensitive with new - case-insensitive string class. [Nach] - - Archopt has updated flags, added GCC 4.2's -march=native support. [Nach] - - Parsegen now has atoui() which should fix reading very large values. [Nach] - - Ported more assembly to C. [Jonas Quinn] - - Misc. bug fixes. [Deathlike, Jonas Quinn, SamB, Nach, grinvader] - -DOS Port: ----------- - - Fixed snapshots key from attempting to take a PNG when it cannot. - [Deathlike] - - Removed old DOS debugger at last. [SamB] - - Clock box option now does something in 8-bit modes. [Deathlike] - -Win Port: ----------- - - Updated and improved NTSC filter. [Blargg, pagefault, Deathlike] - - Added 1600x1200 S Full to Windows port for consistency. Fixed details of - 1600x1200 S Win. [Deathlike] - - Fixed crash with HQ4x in windowed mode with Hi-Res Mode 7 on. [Deathlike] - -SDL Port: ----------- - - Fixed broken option on Mac OS X; load menu shouldn't crash anymore. Thanks - phf. [Nach] - - Made WIP launch message berate users for not using --enable-release if it - was an official release. [Nach] - - Added option to define configuration directory. [Aerdan] - - Mac OS X config directory now defaults to Library/Application Support/ZSNES. - [Nach] - - Symlink support for matching ROM name to files. [Nach] - - Updated and improved NTSC filter. [Blargg, pagefault, Deathlike] - - More accurate NTSC ratio. [pagefault] - - You can now use libao for sound, compile with --enable-libao, also see - zsnes --help for a list of drivers to use. [Nach, Bisqwit, grinvader] - - Unit testing done; off by one errors in audio sample output fixed. Thanks - hakonrk and grinvader. [Nach] - - Now supports ~ (home directory) in various places, most notably ROM loading. - [Nach] - - Fixed some filtering and video refreshing issues. [Deathlike] - - Fixed Bilinear Filtering on startup. [Deathlike] - - -............................................................ -v1.50 - December 22, 2006 -............................................................ - -All Ports: ----------- -For this release, we spent much time rewriting, porting, and improving many -internal subsystems. ZSNES is a program with over 200,000 lines of source code, -and in this release, over 25% of that has been modified; also, around 15% of the -assembly has been ported to C. The upcoming list, while large, can't fully -describe the amount of work done and the amount of improvements made. Be sure to -see the readme to find out how to use all the new features. - - Subsystem Additions/Updates/Rewrites/Fixes/Improvements - ---------- - - Ryan C. Gordon's ManyMouse support added. [Nach, pagefault] - This allows the systems compatible with ManyMouse (Windows XP, Linux via - evdev if read permission set, Mac OS X) to handle each mouse plugged into - the system separately. So now games with two mouse-using devices can be - played with 2 players (or 1 player controlling both) on a single PC. - Left Handed Mouse Support. [Nach, Deathlike, Jonas Quinn] - So lefties can have the buttons for a particular mouse swapped if they so - desire. - - Rewrote directory handling system. [Nach, Jonas Quinn, grinvader, Deathlike] - The old system, dubbed "ZFile", only kept track of files in a limited manner - allowing for many many bugs. The new system, dubbed "ZPath", now tracks - files and paths in a clean systematic manner to eliminate all file/path - related bugs that have made previous versions annoying. All file handling - code is now done in C and has many functions to make it easier for anyone - else to jump right into this bit of development. This also allows for many - new features to be written, and we wrote quite a few. A debug system has - also been added, making it easy to track file issues regardless of the - operation system in question. - - ZMV Rewritten - Movie Support. [Nach, grinvader, ipher] - Added support for subtitles while playing a ZMV. [Nach] - Can now load movies via command line parameter. [Nach] - Added parameter to close ZSNES when movie is closed. [Nach] - Our movie subsystem - ZMV has been completely rewritten from the ground up. - Now features such as rerecording (via states and rewind), appending, mouse - recording, Super Scope recording (buggy), chapters, start types, frame - count, input compression, among other things are now all supported. Note - ZSNES can still load old ZMVs; however, it should be noted that ZMVs are - somewhat version reliant and may desync on a version it was not recorded - with. Also, most of the new features will not work when using an old ZMV. - - Can now dump ZMVs to AVI and WAV. [Nach, Bisqwit] - For years, users have requested being able to convert a ZMV to something - else; it is now possible. - - Added IPS multipatch support. Goes from IPS, IP0, IP1, IP2, ..., IP9. [Nach] - So you can have IPS autopatching apply more than one to a game loaded. - IPS files now loaded from save directory then ROM directory. [Nach] - Making it easier for a user to auto patch. - Fixed silly mistake with size adjustment of IPS patches. [Nach] - So now the very rare broken IPS should work. - - Rewind and ZST code fully merged; rewind should now work where save states - do (Fixes rewinding in Super Bomberman games). [grinvader, Nach] - Can now use 100 save states instead of 10. [Deathlike, Nach, Jonas Quinn] - SRAM is now stored in save states and can be optionally loaded from them. - [grinvader, Nach] - Can now select how many rewind states you want. [grinvader, Nach, ipher] - Can now select how much time is in between rewinds. [grinvader, Nach, ipher] - Our state saving subsystem has been completely rewritten (although another - rewrite is planned) to fix many bugs that used to be present. With the ZST - and rewind code merged, it also means no more issues where one works but not - the other. This is also now all done in C, making it easier to deal with, as - well as allowing many new features as listed above. - - Parsegen invented (thanks grinvader, gladius). [Nach] - Binary and text config files merged into one and heavily updated. [Nach, - grinvader, Deathlike] - We invented a new programming language (PSR), and a compiler for it - (parsegen), which allows one to keep track of variables in a simple manner - for both developers and end users. Developers can just declare a particular - variable to be tracked and forget about it, letting the system manage - everything else, making it easy to add as many configuration options as one - likes. For the end user, the config file is all in text, making it easy to - modify any feature they like or features for advanced users not changeable - from within the GUI. It also provides a level of future compatibility so - users should normally not have to delete config files between versions. It - also allows partial config files, so users can delete certain settings and - have them restored to their defaults. All this is possible while maintaining - a high level of flexibility. - - Netplay, Modem, IPX code removed. [grinvader, Nach. ipher] - As much as we hated to do this, we had to remove all computer-to-computer - playing options in order to fix up the other subsystems since the code was - spread throughout ZSNES. We hope to reimplement it in future versions and - also provide new features. - - Created new macros and greatly eased GUI development and cut down on size of - GUI code. [ipher] - Cleaned up GUI and reorganized it. [ipher, Nach, grinvader, Deathlike, - Jonas Quinn] - Added tab support to the GUI and made good use of it. [grinvader] - Rewrote the load game menu, it can now handle thousands upon thousands of - ROMs at a time. [Nach, grinvader] - Added a custom font system. [ipher, Deathlike] - Nach input boxes (video, path) now have a normal blink rate. [Nach] - Now using our custom GUI should be easier and more straight forward. Almost - everywhere you look, you should see a cleaner design, new features, and - fewer bugs. See below for more specifics. - - New unified ZSNES loader which is also less buggy. [Nach, grinvader, - Deathlike, Jonas Quinn] - Now command line options are handled in a more efficient manner, as well as - making it much easier for us to add more. - - Committed the ZSNES development toolkit. [Nach, grinvader] - Code is now always in executable sections, fixes NX and many other issues. - [Nach] - Added utility to auto detect best -march option to compile with; SDL port - uses it automatically. [Nach, grinvader] - For various developers, we now added many utilities to make working on ZSNES - much easier. Some of these utilities should be built into the assembler but - aren't. These new utilities have also allowed us to easily track down - several critical bugs and fix them effortlessly. We also have a utility now - to aid the person compiling to get the best optimization out of their build, - perhaps now allowing them to use HQ4x or other filters that weren't possible - before. - - Updated build setups. [grinvader, Nach] - Added file dependency utility. [Nach] - All the build setups have been updated to make it easier and more flexible - for one to compile ZSNES and encounter fewer bugs along the way. File - dependencies can now also be calculated automatically (most notably for - SDL), so one updating ZSNES doesn't run into weird issues with only half of - a fix being compiled. - - Ported much assembly to C. - [grinvader, Deathlike, Nach, Jonas Quinn, theoddone33, pagefault, byuu] - Removed dead code. [grinvader, Nach, pagefault, Jonas Quinn, Deathlike] - Lastly on our big rewrite, a lot of old junk went, and many complex and - annoying features are now in C, meaning that if you know C, now is a good - time to start helping out ZSNES development. - - Special Chips - ---------- - - Fixed all remaining bugs with the SPC7110. SPL4 and MDH are working - correctly, now. Special thanks to John Weidman and Dark Force for working on - reverse engineering. [Jonas Quinn] - - Super FX updates (Starfox 2 now 99% working). [pagefault] - - OBC-1 code ported to C and integrated properly. Metal Combat doesn't have - graphical problems anymore (thanks Nach). [Jonas Quinn] - - DSP-1 finished. [The Dumper, Andreas Naive, Nach] - - SA-1 detection updated (Fixed loading of SD F-1 Grand Prix (Sample)). [Nach] - - Partial Seta 11 emulation (thanks anonymous and Jonas Quinn). [Nach] - - DSP-3 support (opcodes RE'd by Overload and Feather). Thanks Jonas Quinn for - finding a bug in my glue code. [Nach] - - DSP-4 Support (Top Gear 3000). [Nach, pagefault] - - C4 emulation should be virtually perfect now. [Nach, Jonas Quinn] - - Now got mapping done correctly for dual Sufami Turbo (thanks byuu); now have - two sets of SRAM. [Nach, Jonas Quinn] - - As for everything else, much was done, including a multitude of emulation - updates; it is even hard to count how many emulation bugs are no longer - present. Several new features were also added. - ---------- - - Many Mode 7 fixes, also implemented anomie's Matrix formula (Fixed Energy - Breakers world map, IOG intro, Battlemanicas Battlecoptor intro). - [Jonas Quinn] - - Added some preliminary NMI and IRQ timing. Proper behavior of H-IRQ when - V-IRQ is active. Flickering fix in H-IRQ timing. [pagefault] - - Fixes for DMA, HDMA, so we can have the recent improvements without breaking - tons of other games. (SSF2, SFA2, FFMQ, TOP, CT, YI, probably others). - [pagefault] - - Init DMA values to FF (thanks Overload). [pagefault] - - Fixed windowing issues in Dragon Quest, Star Ocean, Final Fantasy V, - Gradius III, and probably other games. [Jonas Quinn, pagefault] - - Fixed transparency issues in several games, including U.N. Squadron, Final - Fantasy 3u/6j, and Star Ocean. [Jonas Quinn, pagefault] - - Fixed SRAM Mapping. Ys III, Dezaemon, Tokimeki Memorial, Dragon Knight 4, - Fire Emblem - Thracia 776, *should* all work nicely now. [Jonas Quinn, Nach] - - Fixed a special chip SRAM bug. [Nach] - - Fast ROM is now actually set. [Nach] - - Straightened out the 48Mb/64Mb ROM map. [Jonas Quinn, Nach] - - Fixed Uchuu no Kishi Tekkaman Blade. [Jonas Quinn] - - Fixed ENVxbehavior. [pagefault] - - Some fixes regarding WRAM. Some Open Bus. Thanks _Demo_ & byuu. [Nach, - pagefault] - - Fixed the source of the Super Turrican crash. It also fixes my current - Robotrek game. I pray this doesn't break anything else... [Deathlike] - - Behold true ROM mirroring. If your translation breaks now, fix it. [Nach, - grinvader] - - Evened out ROM scoring quite a bit. A bunch of beta ROMs which didn't load - before now should. Special thanks to Cowering for the Reset Vector Popular - Opcode Check code. [Nach] - - Say goodbye to speedhacks. [pagefault] - - Changed cycles for scanline 0. [pagefault] - - Removed special timing for EHi roms. [Jonas Quinn] - - Fixed game title in SPC files for EHi Roms. [Jonas Quinn] - - Workaround to fix crashing of certain games (Sim City PAL and Super Tetris 2 - + Bombliss) on resolution change. [Jonas Quinn] - - Silly DSP code removed; should fix a lot of games (including EWJ2). - [pagefault] - - Fixed program counter in RET macro. Dirt Racer now plays with some blinking, - making progress :) [pagefault] - - Implemented some RTO (fixes some FF3 issues). [pagefault] - - Many hacks removed (we now have less than a dozen, and we have the least of - all the emulators that use hacks). [pagefault, grinvader, Nach, Jonas Quinn] - - Fixed small screen extra line issues (fixes Super Metroid annoying - line issue, so now that guy who keeps on coming into the channel - annoying us about it can rest in peace). [pagefault, Nach] - - Fixed bug in hi-res mode (for example, Lufia 2 ending). [MaxSt] - - Fix some randomness in the SPC core for now. [pagefault] - - Fixed loading of small ROMs. [Nach] - - Fixed a bug when the background was cleared to a strange color. [pagefault] - - Updated the bg scroll registers; fixes a couple of games (thanks anomie, - byuu). [pagefault, grinvader, Jonas Quinn] - - Memory mapping code is now somewhat sane and can be followed. - [grinvader, Nach] - - Updated timing. [pagefault] - - Readded corrected noise frequencies. [TRAC] - - SPC RAM cleared properly on soft reset. [pagefault, Nach] - - Fixed some init glitches. [Nach] - - Pass some more tests on the test cart. [pagefault, Jonas Quinn] - - SPC700 init to ffc0. [byuu] - - Proper logic when drawing sprites while subscreen is present; fixes - SMRPG characters disappearing when entering buildings. [pagefault] - - Removed the Sound Buffering option because it isn't doing anything. - [Jonas Quinn] - - GUI/Exiting SRAM saving only saves if SRAM Check+Save is off or it's on and - SRAM has been modified recently without save. [Nach] - - Super Scope buttons are now configurable. [Deathlike] - - srand() is performed once! and always once per z execution. Water effect B - now also has a lot more effecting. [Nach] - - Cleaned up GZip reader. GZip reader now also supports transparent reading, - namely a regular file with a .gz extension for no apparent reason. [Nach] - - Added "Show Clock Box" and "Show Rom Info On Load" to the Options menu. - [Deathlike] - - Fixed some bugs that were discovered with Valgrind. [Nach] - - Changed the default keys for Player 2 to saner defaults. [Deathlike] - - Fixed some memory leaks. [Nach] - - Remove B CPU core. [pagefault] - - No more TURB! [Nach] - - FPS now displayed correctly for large numbers. [grinvader] - - Fixed crash after SuperFX savestates are loaded. [Jonas Quinn] - - No more alpha for PNGs. [Nach, grinvader] - - Removing unused and probably out of date SPCDUMP. [Nach] - - Prevented 'auto state save/load' & 'auto increment state slot' from - interacting. Former takes precedence. [grinvader] - - ZSNES will no longer jump back into the GUI randomly if you press F2 / F4 or - some other buttons repeatedly. Special thanks to Dan for the clues on how to - recreate it. [Jonas Quinn] - - Added 12 hour clock toggle. [pagefault] - - GUI special case horizon fixed (thanks Motley, Dan). [Nach] - - Crammed a "Documentation" button right below the "WWW.ZSNES.COM" button. - [ipher, Nach] - - Fixed crash after enabling Sound Interpolation mid-game. Fixed Gaussian - always selected bug when MMX Support is disabled. Some options that are only - available with MMX enabled are now hidden if MMX is disabled. [Jonas Quinn] - - Fixed Clear2xSaIBuffer to clear the first line, too. [Jonas Quinn] - - Removed off by 1 line fix. [Jonas Quinn] - - Fixed burning effect in executables compiled with GCC. [Jonas Quinn] - - Removed some DOS only code from other ports and vice versa. [Jonas Quinn] - - Added "+ Gamma" and "- Gamma" hotkeys to the Misc Keys menu. [pagefault, - ipher] - - Hacks can now be disabled via command line (-dh). [Jonas Quinn] - - Get_Date returns correct year now. [Jonas Quinn] - - SPC filenames are no longer truncated if there is a dot in the filename. - [Jonas Quinn] - - Made gui option save config override dontsave option. Fixed bug #13. [Nach] - - Fixed crash when MMX is disabled and 25% scanlines with interpolation is - enabled (bug #142). [Jonas Quinn] - - Fixed corrupted graphics when alt-tabbing. [pagefault] - - Can now display battery power status on laptops. [Nach, pagefault, ipher, - David Lee Lambert, drizztbsd] - - Stupid (and old) mistake successfully corrected after manual tracking; - fixed bug #52, and probably lots of other sound issues upon state load... - [grinvader, Jonas Quinn] - - Added new video modes. [Aerdan] - - Fixed vars in bss section that had no space reserved. Fixed bug #18 on - bug tracker. [Jonas Quinn] - - ZSNES now decodes shift-jis headers correctly... but the font is still - limited to 5x5. [grinvader] - - GCC 4.0 support. [Nach] - - Fixed a jump to not disable ENV when it shouldn't. [Jonas Quinn] - - Optimization to frame draw code, only draw frames that change. [pagefault, - Nach] - - Added error message if hard patching fails. [Nach] - - Fixed the exit procedure. [Nach, Jonas Quinn] - - Updated license. [Nach] - - Option to allow Up+Down/Left+Right for speedruns' sake. [grinvader] - - New variable slow down/speed up options. [grinvader. ipher] - - Lower memory usage. [Nach, Jonas Quinn, Deathlike] - - Panic key now resets offset mode and windowing state. [pagefault] - - Primary Buffer option shouldn't be reversed anymore. [Jonas Quinn] - - Added pause and frame increment options (buggy). [Nach, grinvader, ipher] - - Key combos for player 5. [ipher] - - Mode 4 offset change overflow fix in rendering code. [pagefault] - - Fixed crashes related to wrong MMX detection. [Jonas Quinn, Deathlike, - hector] - - Major framerate improvement when using new graphics engine. [pagefault] - - JMA: Fixed some bugs in decompression. Improved performance. Lower - memory requirements. Support for JMA v1 files. [Nach] - - Changed video change accept key to spacebar. [Nach] - - Added info on load if ROM is patched. [Nach] - - Fixed 100% CPU usage when no game is running. [pagefault] - - ZSNESW can now be compiled in MinGW without any fancy NASM patches. - [TRAC, Nach] - - Fixed bugs with SRAM Check+Save option. [grinvader, Nach, Jonas Quinn] - - Initialized many vars which were not. [Nach] - - Added comments so people have more of a clue. [pagefault, grinvader, - Nach, ipher] - - Fixed warnings. [Nach, theoddone33, grinvader, Jonas Quinn] - - Configure script fix for Gentoo users, and debug builds now use -O0, - because we can. [grinvader] - - Partial scons support [theoddone33, Aerdan, Snarius] - - Added CPU parameter for specific CPU optimizations when compiling for - an MS platform. [Nach] - - Added debug build support for MS ports. [Nach] - - Can now compile without JMA support. [Nach] - - Greatly updated, overhauled, and unified documentation. [AspiringSquire, - Deathlike, Jipcy, Nach, Noxious Ninja, Richard C., xamenus, and others] - -DOS Port: ----------- - - Fixed sample rate to not be able to select 32000 Hz or bigger rates when - they are not available under certain circumstances. [Jonas Quinn] - - 8 bit modes now save images as BMP. [Nach] - - Can now compile without a debugger. [Nach, Jonas Quinn] - - Can choose old or new debugger. [SamB] - - Fixed ROM loading from the command line for DOS when a VESA2 mode - is selected. [Jonas Quinn] - - Now runs proper clean up code on exiting. [Nach] - - Updates to input code, now supports more parallel pads. [Deathlike] - - Can now set via command line player 1 and 2 to any input. - - Rewind can now be used. [Nach] - - Quick load menu now shows full internal names, or if LFN, as much - as the other ports show. [Nach] - -Win Port: ----------- - - Fixed a really strange crash problem on Windows 2003 systems. [pagefault] - - You can now use gamepad in the background without ZSNES having focus. - [pagefault] - - Fixed bugs so ZSNES can be run in VMWare. [pagefault] - - Can pause emulation in the background. [pagefault] - - Fixed black screen after the computer was locked. [Jonas Quinn] - - Fixed inline assembler in winlink.cpp when compiled with optimizations. - [Jonas Quinn] - - Added custom video modes. [Deathlike2, Nach] - - Debugger now works in this port. [SamB, pagefault] - - Added KitchenSyncPal and fixed a lot for KitchenSync issues [Deathlike, - Poobah] - - Added ForceRefreshRate as a replacement for Force60Hz. I'm sure someone - will fail reading the cfg file for help. [Deathlike] - - Added Keep 4:3 ratio as requested a while back by gltamarin. This is - useful for laptops/LCDs that use non 4:3 resolutions. [Deathlike] - - Can now set joystick sensitivity. [Deathlike] - - Can now view ROMs by SNES internal name. [Nach, Deathlike] - - Changed default option the Windows port uses due to sanity reasons. Also, a - check was added to prevent the black screen (and maybe double vision) issue. - A message box will now pop up to tell you what options you have. [Deathlike] - - Disable Screensaver Option now disables all annoying power management stuff. - [Deathlike] - - Changed "High Priority Mode" to "Use A Higher Priority" and Above Normal - Priority is used on NT. [Deathlike] - - Nach input boxes (video, path) now allow pasting via ctrl+v. [Nach] - - Added NTSC filter. [Blargg, pagefault, ipher] - - Fixed strange sprite priority bugs after switch to window/fullscreen. - [Jonas Quinn] - -SDL Port: ----------- - - Fixed bilinear filter in GUI [grinvader] - - Fixed video change freeze problems in port. [Nach] - - Make sound processing use less CPU cycles. [Nach] - - Fixed input responsiveness for controllers 3+. [bssteph] - - Added freedesktop.org file [pagefault] - - Fixed screen refresh for SDL software modes when toggling hq2x. [grinvader] - - Fixed a key repeating bug when changing resolutions. [grinvader] - - Fixed bug where mouse buttons were conflicting, right mouse click by itself - on 3+ button mouse. [Nach] - - Updated wheel handling. [Nach] - - Added a Variable OGL mode to center ZSNES output with proper ratio. - [NBondoux] - - Added custom video modes. [Deathlike2, Nach] - - New scancode handling system, should fix problems with non US keyboard - and Mac OS X. Thanks hector. - - Debugger now works in this port. [SamB] - - Can now set joystick sensitivity. [Nach] - - Added Keep 4:3 ratio as requested a while back by gltamarin. This is - useful for laptops/LCDs that use non 4:3 resolutions. [Deathlike] - - Can now view ROMs by SNES internal name. [Nach, Deathlike] - - Hopefully fixed numlock keypad quick select in the F3 menu. [Deathlike] - - Fixed bug when trackballs are present; also cleaned up joystick code a bit. - [spoon0042] - - Make stack non executable for ELF. Thanks drizztbsd. [Nach] - - Mac OS X support. [Nach, hector, BRPXQZME] - - Removed dangerous checking of environment variable for user's home path. - [Nach] - - Fix compilation on OpenBSD. [pagefault, Nach] - - Added NTSC filter. [Blargg, pagefault, ipher] - - -............................................................ -v1.42 - January 19, 2005 -............................................................ - -All Ports: ----------- - - Corrected output of BRR decode for invalid range values (>12). [TRAC] - - Fixed sustain level 4 (5/8). [TRAC] - - More window boxes now have borders. [ipher] - - Close zip files properly when IPS is not found in zip (fixes crashing with - certain zlibs). [Nach] - - Cleaned up some code. [Nach, ipher, grinvader] - - Ported chip detection to C, improved BS detection. [Nach] - - Ported rewind to C (thanks Nach, TRAC). [grinvader] - - New reminder text. [grinvader, AspiringSquire] - - Rollback of "Improved accuracy of base rates used for ADSR, GAIN, noise, - and echo emulation". [ipher] - -DOS Port: ----------- - - Fixed label for Fullscreen/Widescreen options. [ipher] - -SDL Port: ----------- - - DESTDIR support. [theoddone33] - - -............................................................ -v1.41 - January 18, 2005 -............................................................ - -All Ports: ----------- - - Improved accuracy of base rates used for ADSR, GAIN, noise, and echo - emulation. [TRAC] - - Fixed GUI escape stack corruption if .srm file could not be written to. - [Nach] - - Stereo settings now obey config file. [Nach] - - Fixed framerate loading from config file. [ipher] - - ZSNES no longer hacks itself in order to access variables; this eliminates - a few issues we had. [Nach] - - Source code cleanup. [Nach, ipher] - - Makefile overhaul; ZSNES can now be cross compiled. [Nach, ipher, malcster, - SamB] - - Fixed some invalid memory reads. [Nach] - - Ported config file creation/loading to C. [MKendora, Nach] - - Percent of execution now takes h-blank values into consideration. - [pagefault] - - Fixed Winter Gold FX crash. [Nach] - - Filtered GUI is now enabled by default. [Nach] - - Save location can now be edited in the GUI. [Nach] - - Added option to enable/disable auto IPS patching. [Nach, ipher] - - Saving last ROM info to rominfo.txt can now be turned off. [ipher, Nach] - - Organized options menu, and split off save related options into its own - menu. [ipher] - - Moved Super System DIP switches to the chip configuration menu. [ipher] - - More boxes have borders now! [ipher] - - New one-time user reminder text. [grinvader] - - Updated about box. [Nach, ipher] - - Overhauled toaster support. [Nach] - -DOS Port: ----------- - - Fixed a number of keyboard shortcuts in the GUI. [ipher] - -Win Port: ----------- - - Get_Date() now returns the proper value (it always returned the proper value - in DOS). [Nach] - - Correct timing when compiled with MinGW (Special thanks to Jonas Quinn for - all his help in getting ZSNESw compiled with MinGW and working). [Nach] - - More informative error messages when some DirectX component fails to load. - [Nach] - - Return 0 instead of random value on exit (keeps certain frontends happy). - [Nach] - - Fixed keyboard shortcut for "Trap Mouse Cursor". [ipher] - - Changed text in netplay window to be more clear about TCP/UDP. [pagefault] - - Updated ZSNESw compilation instructions in install.txt. [Nach] - -SDL Port: ----------- - - Get_Date() now returns the proper value (it always returned the proper value - in DOS). [Nach] - - Fixed a memory leak. [Nach] - - Fixed buffer underflow in sound code when rate was changed several times. - [Nach] - - Save files can now be correctly saved in locations other than ~/.zsnes. - [Nach] - - Updated video selection menu. (Thanks, Aerdan!) [ipher, Nach] - - 256x224 R Full for is now actually 256x224, not 320x240. (Thanks, Pieter - Hulshoff!) [ipher] - - 640x480 ODS Win is now actually 640x480, not 512x448. [ipher] - - Added 1280x1024. [ipher] - - Changed text in netplay window to be more clear about TCP/UDP. [pagefault] - - Homepage button to open browser now appears in about box. [Nach] - - -............................................................ -v1.40 - December 25, 2004 -............................................................ - -All Ports: ----------- - - Added multiple timing tweaks, fixed various emulation bugs, and many other - technical updates, including (but not limited to): SPC core updates (with - improved sound decoding), safer memory allocation in certain areas, HIRQ and - VIRQ fixes, color add/sub and color bleeding fixes, HDMA improvements, - sprite priority and flickering fixes, and a slew of SRAM fixes. Many more - games work :D. [pagefault, _Demo_, Nach, TRAC, Overload, theoddone33] - - Overhauled a lot of code, such as checksum calculation and mirroring code. - Overhauled and added much better EHi/Hi/Lo ROM code, improved reset vector, - and changed much hard coding to variables. Fixed more SRAM bugs than we can - count. Made optimizations to complex loading functions, syntax, memory init - (Thanks kode54), execution, and initialization code. Also greatly improved - PAL/NTSC detection. Also now has much better chip detection and gives more - informative chip names. More games which never loaded before now load - properly, such as Dai Kaiju Monogatari 2; it now loads and plays great - without the Dejap patch. [Nach] - - Cleaned up, overhauled, removed, and ported a lot of code (asm to C). - [pagefault, MKendora, Nach] - - Overhauled IO latch behavior, added proper latching behavior and other latch - fixes (such as proper latching of bit 7 on $4201), and added proper behavior - of RDIO regs. [pagefault] - - Removed many, many hacks. [Nach, pagefault] - - There have been some modifications and reorganizations of the GUI, including - new path setup and chip configuration windows and a reorganization of the - Game Key window. [pagefault, Nach] - - Updates to the video code, with enhancements of triple buffering, better - input support in the video dialog, and other general video code updates and - bug fixes, such as a fix for the 60hz mode. [pagefault, MaxSt] - - New extra options are now available in various locations, like the "GUI - burning effect", new commandline options, a new quick key to control players - 1/2 with 3/4, and smaller message text. Some obsolete ones have been - removed. [pagefault] - - Some changes in the Input configuaration: Hitting "Set Keys" is now - prevented if controller is set to "None". Also, if no controller is - selected, the settings of the individual keys are now locked. [Nach] - - Updated default configuration, in general. For example, stereo sound is now - enabled by default at 32khz, with gaussian interpolation. [pagefault] - - Signed saturation fix for gaussian interpolation (Thanks kode54). - [pagefault] - - Fixed several Netplay issues. [_Demo_, pagefault, Nach] - - Fixed some of our .zmv movie recording problems. [Nach] - - Fixed a small bug in SPC saving. [pagefault] - - Fixed issues with config file saving. [pagefault, Nach] - - Fixed PNG snapshot filenames and PNG height. [StatMat, Nach] - - Fixed DIP switch 2 on Super System. [pagefault] - - Fixed an auto frameskip issue (Thanks MKendora). [pagefault] - - Fixed rewind when using commandline filename. [StatMat] - - Fixed some issues when loading ROMs via command line. [Nach] - - Removed ROM info that appears when loading via command line. [Nach] - - Added a command-line savestate fix. [StatMat] - - Fixed an annoying savestate bug. [pagefault] - - Super Bases Loaded 2 works better, due to a fix in DSP-1 mapping. [_Demo_] - - Horai Gakuen works better, due to a special fix. [_Demo_] - - Lufia 2 problems are now fixed. [pagefault] - - Emerald Dragon now works - again. [pagefault] - - Many updates on the SPC7110, such as normal timing, special ratio removal, - and better pack loading code. [_Demo_, pagefault, Nach] - - Removed SPC7110 logger and S-DD1 test. [grinvader] - - Removed support for interleaved SuperFX ROMs. [Nach] - - Added several improvements and memory map adjustments for more accurate BS - emulation. [Nach, pagefault] - - Added call init code for DSP-2,3, and 4. [pagefault] - - Added better support for split ROMs with headers and detecting interleaved - ROMs. [Nach] - - Added support for many more ROM extensions. [Nach] - - ROM info now dumped to rominfo.txt on game load. [Nach] - - Added more information lines on ROM load, such as CRC32, video, and bank - information. [pagefault, Nach] - - Added support for some NSRT features, such as NSRT header support and - support for ROMs using NSRT's JMA compression format. [Nach] - - Zipped ROMs no longer need a temporary directory. [Nach] - - Added better handling of bad files. [_Demo_, Nach] - - Implemented soft IPS patching functionality, with in-zip file support, - buffering, and RLE support. [Nach] - - Added a compatibility update to PPU. Passes one more electronics test - (Thanks MKendora!). [pagefault] - - Fixed variable types in many locations; ZSNES can now play games without - hacking the binary to make code segments writable. [Nach] - - Made ZSNES more HTPC friendly. [pagefault] - - Fixed many compiler warnings, added compiler optimizations, and more - compiler fixes and code cleanups. [Nach, MKendora, theoddone33, pagefault, - ipher, SamB] - - Unicode support partially supported. Will complete later. [pagefault] - - ZSNES now displays the day it was compiled in the about box. [Nach] - - Updated authors.txt, support.txt, thanks.txt, and todo.txt. [pagefault] - -DOS Port: ----------- - - Fixed cubic spline interpolation. It should actually save the option now! - [pagefault] - - Fixed other various DOS sound bugs. [Nach, pagefault] - - Fixed a frameskipping bug. [pagefault] - -Win Port: ----------- - - Updated icon with Windows XP compliancy. [cdbsi] - - Added new disable screensaver code. [pagefault] - - Added a CPU utilization fix. [kode54, pagefault] - - Added 48khz sound support, updated sound code, and fixed sound bugs. - [pagefault, Nach, ipher, StatMat] - - Fixed a couple of input bugs, such as one concerning the 5th joystick and - another that made the mouse get stuck in an endless loop. [pagefault] - - Removed alternate timer. [pagefault] - - Fixed Netplay freezing bug. [pagefault] - - Many new video features, including (but not limited to): HQ2X, HQ3X, and - HQ4X graphic filters, support for hi-res and D modes in 32bpp windowed mode - (now default), new aspect ratio code for scaling, and the KitchenSync - (usable only via the commandline). [MaxSt, pagefault, Darkfalz] - - Fixes for video code errors, such as those that occured when alt-tabbing in - fullscreen, MMX interpolation fixes, and blitter fixes. [pagefault, - zsKnight] - - Snapshots are now numbered and use the full ROM file name. [Nach] - - Renamed Windows version to Win32. [pagefault] - - Win32 port can now also be compiled with MinGW (but we won't support it till - the next release). [Nach, Jonas Quinn] - -SDL Port: ----------- - - Updated icon. [cdbsi] - - Updated Linux video code to Windows version. [pagefault] - - Fixed problems with nVidia cards. [Diablo-D3] - - Fixed audio problems with broken drivers. [Diablo-D3] - - Added 48khz sound support. [pagefault] - - Updated joystick input support. [theoddone33, Sander] - - Fixed savestate incrementor; this caused some crashes. [pagefault] - - Cleaned up the Linux Autoconfigure [Diablo-D3] - - Added a couple of things for the start of BeOS compatibility. [theoddone33] - - Fixed 16->32bpp LUT related bug. [kode54] - - Added hardcoded alt-enter fullscreen toggle. [theoddone33] - - Added dialog for why the video mode couldn't be set. [theoddone33] - - Added circle buffer patch (savestate fix). [zinx] - - Fixed problem with man page when installing (when man1 directory doesn't - exist). [hpsolo] - - Fixed cmd line sound quality. [pagefault] - - Fixed zlib and libpng issues. [theoddone33, pagefault] - - Updated libpng version checking [theoddone33] - - Added -lm to acinclude.m4 so AC_TRY_RUN doesn't return negative on some - systems looking for libpng. [theoddone33] - - Overhauled makefile. [theoddone33] - - Fixed install target; -D should not be used. [theoddone33] - - Added the name of the start address to the error message that occurs when - mprotect fails. [theoddone33] - - Update config.sub. This allows configuration on 64-bit targets, and requires - autogen.sh to be rerun. [theoddone33] - - Added HQ2X filter! [MaxSt, pagefault, zinx] - - Snapshots are now numbered and use the full ROM file name. [Nach] - - Renamed Linux version to SDL. [pagefault] - -We have also greatly improved support for special hardware in ZSNES v1.40. -These require special mention: - - * SuperFX core updates: - - pagefault - * SA-1 core updates: - - pagefault - * C4 core updates: - - Research: anomie - - Main Code: Nach - - Special thanks to The Dumper and TRAC! - * DSP-1 core updates: - - Data Retrieval: pagefault, Overload, The Dumper - - Main Code: pagefault, Overload, The Dumper, neviksti, Andreas Naive, - _Demo_ - - Integration: MKendora, Nach - - Processing Code: pagefault, Nach - * DSP-2 emulation: - - Data Retrieval: Overload - - Research: Overload, neviksti, MKendora, The Dumper, CaitSith2 - - Main Code: kentaro-k.21 - - Processing Code: pagefault, kentaro-k.21 - - Special thanks to Lord Nightmare! - * S-DD1 emulation: - - Data Retrieval: The Dumper, Dark Force, zsKnight, Gary Henderson - - Research: Andreas Naive - - Main Code: anomie - - Processing Code: _Demo_, Nach - - Special thanks to all the other developers and users who worked on this - hard project! - * ST010 emulation: - - Data Retrieval: The Dumper, MKendora - - Main Code: The Dumper, Overload, Feather, Nach - - Processing Code: The Dumper - - Code Fixes: pagefault - * Sufami Turbo support (preliminary): - - Nach - * SD Gundam G-Next and Same Game expansion pack support: - - Nach - - -............................................................ -v1.36 - July 15, 2002 -............................................................ - - - Fixed Gunforce, added invalid HDMA modes. [_Demo_] (Thanks Overload!) - - New BRR decoding method, this should resolve all the sound issues introduced - in 1.35 and fix new ones. (Noise simulation isn't used anymore) [_Demo_] - - Fixed another bug with command-line netplay. (Windows only) [pagefault] - - Fixed hang in NBA Live 95 and 96. [_Demo_] (Thanks Overload!) - - Fixed sound not working on first run. (Windows only) [pagefault] - - Fixed some more mode 4 issues in the new gfx engine. [pagefault] - - Added offset mode disable toggle to 8-bit new gfx engine. [pagefault] - - Fixed SPC hang in 90 Minutes European Prime Goal by clearing spcram. - [_Demo_] - - Updated fix for Clayfighter to fix some bugs in battle. [_Demo_] - - Fixed crash with certain games. (SDL/*nix only) [theoddone33] - - Added better OBC1 detection. [_Demo_] - - Special hack for Samurai Showdown IRQ problem. [_Demo_] - - Special hack for Kamen Rider menu, requires special latch reading. [_Demo_] - - Special hack for Super Famista 1 & 2 SPC bugs. [_Demo_] - - Fixed some more bugs in video code. (Thanks Perryman for the video table) - (Windows only) [pagefault] - - Fixed Digital Devil Story hang by modifying the spc code. - You must start a new game for the fix to work. [_Demo_] - - Modified work ram init value to 0x55. (Thanks TRAC) - - -............................................................ -v1.35 - June 23, 2002 -............................................................ - - - Fixed triple buffering corruption on some VESA 2.x video modes, a very nasty - bug which accidentally slipped into version 1.337. [stainless] (DOS only) - - Added full scanlines to 320x256x8b Mode-X. Uses the same timings - as the 256x256x8b full scanlines, so it may or may not work - correctly depending on your video card. [stainless] (DOS only) - - Linked the EAGLE engine to the filtered GUI option and fixed - guassian interpolation which has been broken since version 1.71b. - [stainless, kode54] (DOS only/all ports) - - Cleaned up the 320x480x8b and 320x240x16b blitters and added - MMX support to 320x480x8b for a nice speed increase. [stainless] (DOS only) - - Added 640x400 alternatives to 512x384 video modes for video cards which - don't have them. Added a small screen option to the 512x384 and 640x400 - video modes with MMX support. Also added a "wide screen" option to - 640x400 video modes. [stainless] (DOS only) - - Added a full screen option to the 320x480 video modes, along - with a basic interpolation to 320x240x16b and 320x480x16b - Full screen in 320x480x16b has full/25%/50% scanlines and - interpolation has full scanlines. [stainless] (DOS only) - - Added experimental 800x600 video modes. Fixed 'n' command-line - option to allow toggling of 25%/50% in addition to full, also - cleaned up the command-line options message and the config file. - Noticed some video modes were way off-centered, fixed that - too, should now be perfect. [stainless] (DOS only) - - Fixed printing of MMX enabled message on the GUI background if you checked - MMX SUPPORT under CONFIG -> OPTIONS. Also, if you check MMX SUPPORT by - using the keyboard shortcut it will now attempt to actually detect MMX - before enabling it. :) [stainless, pagefault] (DOS only) - - Command line support in windows port [StatMat] - - Fixed problem when some video modes were not being saved. (Windows only) - [pagefault] - - Lots of updates to Linux/SDL version, including sound fixes, video code - updates and other misc bugs. [theoddone33, Thorsten Glaser, Wilbern Cobb] - - Fixed gamma in PNG snapshots. [pagefault] - - Added several new goodies to the GUI, which include a force 8-bit sound - option (fixes a few cards under WinMe), a second water effect, and - an experimental smoke effect. [stainless] (DOS only/all ports) - - Fixed problem with sound getting disabled when running command-line - network games. (Windows only) [pagefault] - - Updated video code in Windows port to properly display 239 line modes. - (Windows only) [pagefault] - - Commented, unified, and cleaned up the Mode-Q and Mode-X blitters. I did a - major overhaul to the DOS video code, I cleaned up and reorganized it alot, - and there seem to be no problems as of yet. [stainless, TRAC] (DOS only) - - Fixed a bug in sprite priority rotation. (fix damage in FFMQ) [TRAC] - - Fixed long delay between battles and fixed flickering colours - on map in Front Mission. [pagefault] - - Fixed hang when picking up apples in Equinox. [pagefault] - - Fixed keyon bug in DSP code, fixes sounds in Flaskback 3 Language Edition - (Thanks neviski) [_Demo_] - - Fixed "disco colours" in NBA Hangtime when the ball drops. [pagefault] - - Fixed an NMI issue with register $4212, fixes hang in Cu-On-Pa, - Bubsy and others. [pagefault] - - Fixed a mode 4 bug in the new graphics engine that was causing - the title screen in The Lost Vikings to be scrambled. [pagefault] - - Added support for Super System arcade system, set DIP switches - in add-on's menu in GUI. Games MUST be zipped in order to load. [pagefault] - - Added special support for Earthworm Jim 2 sound effects. [_Demo_] - - Added hack for Deaetonosama Apareitiban. [_Demo_] - - Fixed super scope position reading. [_Demo_] - - Modified a few timing things. [_Demo_] - - Fixed some 65816 instructions in processor emulation mode. [_Demo_] - - Added special timing for Grand Prix 3. [_Demo_] - - Modified sound decoding another time (helps various noise sounds like DQ6). - [_Demo_] - - Modified joypad reading for VS Collection. [_Demo_] - - Special modification for Bahamut Lagoon and Clay Fighter to delay write - to the hdma register. (those games need dma delay implemented) [_Demo_] - - Lots of other minor fixes and things we forgot to mention. - - -............................................................ -v1.337 - September 30, 2001 -............................................................ - -This release is dedicated to zsKnight and his family - - All ports - --------- - - Added a customizable key to toggle display of the game clock [pagefault] - - Added support for up to 100 SPC file saves per game [pagefault] - - Added customisable keys to increment and decrement the save state slot - [pagefault] - - Added a customisable key to quickly save an SPC file [pagefault] - - Added force NTSC/PAL and force HiROM/LoROM options to GUI [pagefault] - - Added a customisable key to toggle the display of the FPS counter - [pagefault] - - Added keyboard shortcuts to video options menu [pagefault] - - Added feature to automatically increment save state slot after each save - [pagefault] - - Added new 8-point sound interpolation and two new lowpass filters - (requires a fast processor, 8pt interpolation and high quality - lowpass requires an MMX processor) [kode54] - - Fixed an annoying bug when the menu selection bar would be floating - in thin air (Thanks to EMu LoRd for pointing this out) [pagefault] - - Fixed MMX toggle option, now saved when you restart ZSNES [pagefault] - - Fixed freeze/crash when saving SPC files [pagefault] - - Fixed filtered GUI option with 2xSaI enabled not refreshing the screen - [pagefault] - - Fixed graphics when reseting a game with 2xSaI engine on and the FPS - counter and/or game clock on [pagefault] - - Fixed Vortex, Clayfighter 2, Mr. Nutz, Tenchi Wo Kurau Sangokushi - Gunyuden and others now working again [_Demo_] - - Fixed Umi Hara Kawa Se and Tin Tin in Tibet [_Demo_] - - Fixed LoROM/HiROM detection code, Star Trek: Deep Space Nine and - possibly others now working [pagefault] - - Fixed Front Mission: Gun Hazard and Pocky and Rocky, now working again - [_Demo_] - - Fixed Neugier and Battle Grand Prix freezing after a certain point - in the game. [_Demo_] - - Fixed bug in rom header information and checksum status display, - fixes Tales of Phantasia and others [pagefault] - - Fixed Marko's Magical Football copy protection [pagefault] - - Fixed problem with Filtered GUI enabled and parts of game screen - would show up in GUI menus [pagefault] - - Fixed frameskip command-line offset [pagefault] - - Fixed Sim Earth, now loads but map is still not visible [_Demo_] - - Fixed crash in Home Alone when starting a new game [_Demo_] - - Fixed sprites in Super James Pond 2 and Kirby Avalanche (Thanks - Snes9X for the info) [_Demo_] - - Fixed 256x239 SNES resolution offset in Windows and Linux ports, games that - use this resolution should now be displayed properly in these ports [_Demo_] - - Fixed freeze in Accelebrid after a few seconds of gameplay [_Demo_] - - Fixed cursor getting messed up in Windows and Linux ports when using - a 16-bit desktop [_Demo_] - - Fixed bugs when switching between fullscreen and windowed modes with - fullscreen button in Windows and Linux port [pagefault] - - Fixed Triple Buffering and vsync options so they can't be enabled at - the time (Triple buffering includes vsync automatically) [pagefault] - - Fixed sprite layer disappearing when changing screenshot formats or - moving the F1 menu [pagefault] - - Fixed a clipping offset bug in the new gfx engine [pagefault] - - Fixed BG3 issue with sub-screens in new graphics engine, fixes gfx - in Bahamut Lagoon's intro and lots of other games [pagefault] - - Fixed timing problem in Clock Tower that caused it to freeze - randomly in-game, implemented a hack for now [pagefault] - - Fixed Cu-On-Pa freezing when starting a new game (Thanks to Lordtech - for the help) [_Demo_] - - Optimised global code base, most people should see a performance increase - [pagefault, stainless] - - Moved vsync option from game options menu to video options [pagefault] - - Improved S-DD1 decompressed pack loading and execution, increases - performance in S-DD1 decompressed pack games [pagefault] - - Lots of debugger fixes and additions [byuu, bongo] - - Removed disable screensaver text from DOS and Linux ports [pagefault] - - Updated water effect code to using lighting effects [stainless, kode54] - - Improved SPC700 sample processing, fixes sounds in numerous games [_Demo_] - - Disabled H-DMA for Bahamut Lagoon and Mortal Kombat, fixes some gfx problems - [pagefault] - - Changed default keyboard layout for player 2 as some keys were overlapping - player 1 (Oops!), If you were having problems buying things in FF4 or - in other games make sure to change your keys for player 2. [pagefault] - - Cleaned up config file in Windows and Linux ports, removed DOS - related comments [pagefault] - - MMX option now checks for a MMX processor when enabling it in the GUI, - also no longer crashes on processors without a cpuid when detecting MMX - [pagefault, kode54] - - Last netplay IP address used is now saved in Windows and Linux ports - [pagefault] - - Reorganized sound menu; removed sound interpolation checkbox and made - a new list of different types of interpolation: gaussian (original - interpolation with enable interpolation option), cubic spline and 8-point - interpolation. Also made a new list of lowpass filters. [pagefault] - - Removed FPU copy from -? option on command line message, since it is - no longer supported. Also cleaned up that message in general [stainless] - - FPS at program start option no longer enables FPS display when auto - framerate is not enabled [pagefault] - - Updated video interpolation code, now looks better than before [kode54] - - Lots of misc GUI fixes and cosmetic tweaks [pagefault] - - (UPDATE) Added surround sound to Windows and Linux ports, updated filter - in DOS port (This was left out of the previous whatsnew file) [kode54] - - DOS v1.337 - ---------- - - Added grayscale mode toggle to GUI [pagefault] - - Added support for 5 SNES gamepads on LPT1 [ZDrumm] - - Added two new 256 color linear VGA video modes, 256x224 and 256x240 - [stainless] - - Added proper gamma correction, now ranges from 0 (1.0) to 15 (~2.0) - in 8bpp modes [stainless] - - Fixed Filtered GUI option, now works [pagefault] - - Fixed full scanlines disappearing in some modes [pagefault] - - Fixed a handful of bugs in the joystick code which may cause the joystick - not to work if it has a driver installed under Win9x control panel - [stainless] - - Fixed date problem in S-RTC games not reporting the proper day of the week - [stainless] - - Fixed issue with some sound blaster compatible cards not working - properly in the DOS port [kode54] - - Reordered video modes in alphabetical order [stainless] - - Improved SNES pad reading routine, any speed hit now should be - minimum when using a snespad adaptor [pagefault] - - Improved interpolation performance [stainless] - - Default keys for player 1 are now the same as Windows and Linux ports - [pagefault] - - You can now use / in command line options in addition to the - previous - character [stainless] - - Win v1.06 - --------- - - Added option to toggle the trap mouse cursor feature which prevents - the mouse cursor from leaving the window by accident [pagefault] - - Added 640x480 DS WIN; 1024x768 DR FULL; 1280x960 S/DS WIN, S FULL; - 1280x1024 DR/R/DS WIN and FULL resolutions [pagefault] - - Added a more meaningful message when changing to a resolution - isn't supported [pagefault] - - Fixed problem with SRAM not being saved when pressing ALT-F4 in game - [pagefault] - - Updated icon yet again, looks really nice. [enigMa] - - Fixed possible crash when exiting [pagefault] - - Fixed bug when scrolling in scrollboxes in the GUI would not trap - the mouse cursor inside the scrollbox like the DOS port does [pagefault] - - Either alt key can now be used when using the alt-enter combination - to switch to fullscreen [pagefault] - - Removed triple buffering option from windowed video modes (it does - not work in windowed mode) [pagefault] - - Optimised some Windows port specific code, should give a small speed - boost for most people [pagefault] - - Rewrote mouse input code, much more efficient now. [pagefault] - - Reordered video modes in alphabetical order; removed 64x52 and 128x112 - resolutions (Thanks to Terrorcide and McGuiver for helping me test this out) - [pagefault] - - Improved performance in 32bpp windowed modes [pagefault] - - Rewrote some of the audio code to be much more efficient, also added - MMX optimisations [pagefault, kode54] - - When switching to windowed mode from fullscreen, the window position - is now remembered [pagefault] - - Removed large sound buffer and exclusive mode option, they shouldn't - be needed anymore [pagefault] - - Now uses idle task priority when in GUI and window is not active, - should also smooth task swtiching on slower computers [pagefault] - - (UPDATE) Fixed server IP bug when using zbattle.net or command-line - options to connect [pagefault] - - Linux v0.37 - ----------- - - Added autoconf support for easy compiling [Diablo-D3, amit, theoddone33] - - Fixed sound buffering in linux port to improve sound on some cards - [Diablo-D3] - - Implemented S-RTC time functions, FEoEZ and other S-RTC games will - now report system time in game [pagefault] - - Now supports compiling with gcc 3.0.0 [EvilTypeGuy] - - -............................................................ -zsKnight Leaves - July 23, 2001 -............................................................ - -I'm sorry to say this, but this marks my permanent leave from the ZSNES project, -anything related to this, and emulation overall. The reason why is that my dad -just passed away today (he died in his sleep, which is strange since he was -perfectly healthy yesterday night), so I'm going to have to spend more of my -energy devoted to helping my family. My dad is also the main person who provides -the finances to the family (since my mom doesn't work), plus I still have about -2 more years to go before I graduate from university, so my immediate future -doesn't look that great because with my dad gone, that would mean that I need to -put up more responsibility towards taking care of the family instead of -studying. But I just hope that everything will go well. Thanks to all you -supporters for everything. Sorry for the lack of a proper goodbye though, so -I'll probably update once more after I get out of this shock in another day. - -- zsKnight - - -............................................................ -v1.31b - July 3, 2001 -............................................................ - - All ports - --------- - - Fixed Super Punchout, now working [zsKnight, _Demo_] - - Fixed SD Gundam GNext again [_Demo_] - - Final Fantasy Mystic Quest now works again [zsKnight] - - Win v1.04 - --------- - - Fixed grayscale toggle [pagefault] - - Updated icon again for black backgrounds [enigMa] - - Linux v0.31 - ----------- - - Now compiles and runs on QNX6 systems [TheAlien] - - -............................................................ -v1.31 - June 27, 2001 -............................................................ - - All ports - --------- - - Fixed Mode 4 offset bug (Fixes Bust-A-Move, Puzzle Bobble possibly others) - [zsKnight] - - Emerald Dragon is now working [_Demo_] - - Fixed Last Bible 3 DMA problem (Thanks to SNES9x for the info) [_Demo_] - - Fixed Super Robot Was Ex (Thanks again to SNES9x for the help on this) - [_Demo_] - - Moved disable SPC emulation option to sound menu where it should be - [pagefault] - - Fixed Wizardry 4 and Honkakuha Igo Gosei, interleaved funny [_Demo_] - - SD Gundam GNext no longer crashes ZSNES, and actually is playable now. - [_Demo_] - - Spindizzy worlds should work again [_Demo_, zsKnight] - - Dezaemon sprites working now, had to clear OAM address when first - address byte is written to [zsKnight] - - Power Rangers the Movie working, was reading from register 2144 [_Demo_] - - King of Rally now working [_Demo_] - - Emerald Dragon working, added a hack to disable ENVx for that game - [_Demo_, zsKnight] - - Full Throttle Racing working, fixed a bug with the wai 65816 instruction - [_Demo_, zsKnight] - - Renamed black and white mode to grayscale mode [pagefault] - - Got Traverse Starlight and Prairie to go further, but it - still freezes after several scenes [zsKnight] - - Mario RPG minecart Mode 2 scene working better now [zsKnight] - - Win v1.03 - --------- - - Added disable screensaver feature to disable screen saver while - ZSNES is active [pagefault] - - Fixed yet another DirectInput slowdown [pagefault] - - Added joystick POV hat support (Thanks to kode54 for testing and - fixing my code) [pagefault, kode54] - - Added error messages and directions if DirectX 8.0 is not installed [kode54] - - Fixed another Windows 2000 freeze on exit bug [pagefault] - - Fixed BSOD when loading roms on some systems [pagefault] - - Hopefully fixed a crash when multiple roms where in a single zip - file (only one rom can be loaded per zip file) [pagefault] - - Fixed a possible crash when loading/continuing a game (Thanks to - Metus for pointing this out) [pagefault] - - Linux v0.29 - ----------- - - No changes - - -............................................................ -v1.30b - June 16, 2001 -............................................................ - - All ports - --------- - - Support for Star Ocean S-DD1 decompressed pack is now enabled. [zsKnight] - - Fixed bug in H-DMA code, fixes Hook and Bugs Bunny and maybe others - (Thanks to Gary of Snes9X for help on this) [_Demo_] - - Updated documentation [Matt Kendora] - - Fixed new gfx mode checkbox in options menu [pagefault] - - Win v1.02 - --------- - - Added 800x600 DR FULL mode (scroll down to the bottom of the mode - list to see it) - - Fixed timing problem in games when 58 seconds was 1 minute in ZSNES - [kode54, pagefault] - - Fixed voices in ToP opening and Star Ocean [pagefault] - - Fixed another DirectInput slowdown [pagefault] - - Fixed joystick 5, it should be working now [pagefault] - - Optimised code some more, giving 3-5 FPS boost on most systems [pagefault] - - -............................................................ -v1.30 - June 13, 2001 -............................................................ - - All ports - --------- - - Bubsy 2 working again [zsKnight] - - Batman: the return of the joker working now [_Demo_] - - Sound Novel T-Cool and Derby Stallion 96 memory mapper added [_Demo_] - - Fixed BRR block header bug (fixes Raiden Densetsu, Chrono Trigger, - Gundam Wing: Endless Duel, and a few other games) [_Demo_] - - Updated documentation [Matt Kendora] - - New whatsnew.txt format [pagefault] - - Win v1.01 - --------- - - Updated icon [enigMa] - - Added 1280x960 DR, DR FULL modes to Windows port [pagefault] - - Fixed random crash when loading roms in Windows port [pagefault] - - Rewrote resolution switching code [pagefault] - - Window now moves much smoother and faster [pagefault] - - Readded large sound buffer option [pagefault] - - Fixed CPU usage when window was minimized [pagefault] - - Fixed multiple instances when window was minimized [pagefault] - - Linux v0.29 - ----------- - - OpenGL support [hpsolo] - - Bilinear option (w/ filtered GUI) [hpsolo] - - Fixed video mode descriptions (zsnesl.cfg) [hpsolo] - - Resizable windows [amit] - - Filter options (scanlines, 2xSaI, etc) for OpenGL modes [zinx] - - Many more video modes for OpenGL, including full screen [hpsolo] - - Joystick POV hat support [hpsolo] - - Added support for 5th Joystick [hpsolo] - - -............................................................ -v1.29, Win v1.00 - June 1, 2001 -............................................................ - - - Implemented triple buffering in full screen mode (Huge thanks to whatabubba - for his help on this and cleaning up the code) [whatabubba, pagefault] - - Fixed top 8 lines being invisible of FFMQ [zsKnight] - - Optimised DirectDraw code some more giving a 10-15% speed increase - [pagefault] - - Fixed black screen when switching windows [pagefault] - - Improved loading and shutdown time [pagefault] - - Rock 'N Roll Racing is working again [zsKnight] - - Fixed Lennus 2's sprites [zsKnight] - - Almost figured out Wizardry 4's rom format. It seems like this game - was incorrectly dumped so everything in it is out of order. [zsKnight] - - Final Fight 2 is working again [zsKnight] - - Vsync option now works in triple buffering mode [pagefault] - - Now shows minimize window animation when minimizing [pagefault] - - Fixed mouse pointer under full screen mode [kode54] - - New ZSNES icon in Windows port (Thanks for all your entries) [enigMa] - - -............................................................ -v1.28b, Win v0.99 - May 28, 2001 -............................................................ - - - Added a filtered GUI option to allow graphics engines such as 2xSaI - to be used in the GUI [zsKnight] - - Fixed SA-1 save states [zsKnight] - - Fixed Breath of Fire crashing bug when loading [theoddone33] - - -............................................................ -v1.28, Win v0.99 - Unknown Release Date -............................................................ - - - Added option to allow multiple instances of ZSNES (off by default) - [pagefault] - - Fixed Lufia 2 sprite disappearing bug [zsKnight] - - Fixed quick menu crash problem when the entries other than the - first one is selected when the load menu is opened [zsKnight] - - Modified SPC700<->65816 timing again to get Hook working [zsKnight] - - Added more keyboard shortcuts to GUI [pagefault] - - Fixed vram read to get Smash Tennis working again [zsKnight] - - Hopefully fixed lockup when exiting Windows port [pagefault] - - Added a spc700 timing hack for Super Final Match Tennis until I - re-write the timing engine later (but not anytime soon though) [zsKnight] - - Kinda got Rendering Ranger 2 to go further, but this game seems to - use some picky timing, so this will have to wait until I re-write - timing in the future. [zsKnight] - - Removed large sound buffer option since it wasn't really useful [pagefault] - - Fixed 16bit access to address $001FFF (or equivalent). Fixes Super - Tetris 2+Bombliss. [zsKnight] - - Implemented 128KB sram support. Dezaemon runs now (but it - suffers graphics glitches at the moment) [zsKnight] - - Fixed Wordtris (reading from 002100) [zsKnight] - - Fixed reset function in William's Arcade Classics [zsKnight] - - Tuff-E-Nuff works now (another timing hack *sigh* ) - - Added exclusive DirectSound mode option [pagefault] - - Fixed corrupt graphics in Rock'n Roll racing (reading from invalid memory) - [zsKnight] - - Added alternate timer for people having problems with zsnes running too fast - [bootgod,pagefault,zsKnight] - - Fixed corrupt graphics in Captain America (also reading from invalid memory) - [zsKnight] - - Implemented latest save state selection in Windows port [pagefault] - - Added v-sync to Windows port (enable in options to use it, should - fix most graphical tearing issues) [pagefault] - - Fixed mid-screen OAM updating. Uniracers works in 2 player mode. [zsKnight] - - Combined the new header detection method with the old one, producing a - much better method [zsKnight] - - Added SA-1 read/write to BWRAM bitmap mode in the lower banks [zsKnight] - - Fixed "freeze data" text [hpsolo] - - Fixed SA-1 write to BWRAM bitmap mode. It seems like this was the - main cause of the level-up screen not working in Mario RPG. [zsKnight] - - Fixed cpu usage when ZSNES is in the background doing nothing [pagefault] - - Re-wrote character conversion 1 for 2bpp, implemented cc1 for 4bpp - [zsKnight] - - Fixed vertical high resolution mode for tile priority 1 [zsKnight] - - Fixed Terranigma overworld glitch in the new graphics engine 16bit engine - [zsKnight] - - Enabled RTC in Windows port [pagefault] - - Moved the Transparent Message option from the Options to the GUI Optns - section. [pagefault] - - Added Trainered rom support [zsKnight] - - Fixed BG4 graphics in certain games (fixes Digital Devil Story) [zsKnight] - - -............................................................ -v1.26, Win v0.97 - May 17, 2001 -............................................................ - - - OBC1 support broke in a recent CVS update. Fixed now. [zsKnight] - - Added full scanlines to the Win/Linux port [zsKnight] - - Added Mouse Wheel switch [zsKnight,pagefault] - - Fixed problem with interpolation/2xSaI/scanlines being saved - in the windows port [zsKnight] - - Improved 512 byte header support. This should improve compatibility - with some games [zsKnight] - - Added 768x672 and 1024x896 DR, R windowed video modes to Windows port - [pagefault] - - Windows port now uses the primary DirectSound buffer [pagefault] - - Modified 65816<->SPC700 timing. I hope this doesn't break anything - [zsKnight] - - Fixed a vram read behavior problem (fixed Equinox dungeons) [zsKnight] - - -............................................................ -v1.25, Win v0.93 - May 15, 2001 -............................................................ - - - Fixed cheat menu text when game was not loaded [pagefault] - - Fixed unlabed checkbox in DOS port [pagefault] - - DSP1 - Fixed plane controls in Pilotwings [_Demo_] - - dosintrf.asm - Fixed header detection in the dos port [zsKnight] - - gui.asm - Video mode checking done at initialization [zsKnight] - - Enabled mouse wrap in the Windows and Linux ports [pagefault] - - Fixed full screen mode switch when the user starts ZSNESw before - selecting any full screen modes [zsKnight] - - Made default video mode 512x448 windowed in Windows port [pagefault] - - Prevented enter key from affecting gameplay on returning - from F1 and F3 menus [zsKnight] - - Added minimize button to the Windows port [pagefault] - - Added always on top option in GUI options menu [pagefault] - - Menu fix for 8bit graphics modes [zsKnight] - - ZSNESW now remembers the window position on your desktop (can be - disabled in GUI options) [pagefault] - - Fixed crashing problem with some IPS's in ZIP's [Teuf, zsKnight] - - Ported to DirectX 8.0 which fixed some problems and improved performance - (DirectX 8.0 is now required to run ZSNESW) [pagefault] - - DSP1 - Fixed map offset problem in Pilotwings [zsKnight] - - DSP1 - Fixed rings being mysteriously passed problem in Pilotwings - [zsKnight] - - Fixed DirectSound crash when a normal priority buffer could not be acquired - [pagefault] - - Fixed DirectInput compatibility on some computers [pagefault] - - Optimized DSP1 code for better performance [teuf] - - Added proper full main/sub-screen window clipping in the new gfx 16bit - engine (fixed Illusion of Gaia/DKC2 selection screens, etc) [zsKnight] - - Added checksum/header name/chip type header display upon game load - [zsKnight] - - Added PNG snapshot support which is selectable in the F1 menu [Matt Kendora] - - Stunt Race FX old graphics engine force fixed [zsKnight] - - Fixed MegamanX copy protection schemes [zsKnight, Matthew Kendora] - - Fixed TopGear 2 PAL version from detecting a PAL system [zsKnight] - - Implemented OBC1 chip (for Metal Combat) [zsKnight] - - Fixed Mode 7 bug in Super Ghouls and Ghosts [zsKnight] - - Added turbo keys for L & R keys [zsKnight] - - OBC1 emulation support. Metal Combat works! [zsKnight] - - You can now customizable the colors to the title bar and window colors. - [zsKnight] - - Optimised global code to provide up to a 50% speed increase on it on most - processors [pagefault] - - Added black and white mode to Windows and Linux ports [pagefault] - - ZSNESW is now packed with the newest version of UPX [pagefault] - - Cleaned up the cfg files for windows/linux ports [pagefault] - - Fixed command-line crash in the Windows port (Thanks Matt Kendora) - [pagefault] - - Save/Load state now displays which state is being loaded [hpsolo] - - Added double buffering support to Linux port [teuf] - - -............................................................ -v1.20b, Win v0.88 - April 30, 2001 -............................................................ - - - Final Fantasy Mystic Quest works again. - - Fixed Empire Strikes Back crashing bug in the millenium falcon - sequence (hopefully this will fix some other games too) - - Removed all self-modifying code in ZSNES. This will make ZSNES crash - a lot less on certain systems, especially during mode 7 sequences. - Thanks Ivar! - - Implemented S-RTC chip, using the system clock as the actual time - (The game will make you set the time though, but it will just be replaced - with the system time in-game). Thanks to John Weidman and Dark Force - for the info on this chip! - - Fixed crashing bug in certain mosaic scenes (eg. FF3 Phantom Forest) - in the new graphics engine - - Fixed a nasty crashing/corruption bug in the new graphics engine - (both 8bit and 16bit) - - SPC7110 emulation! This is based on the information reverse engineered by - the hard working folks at dejap translations, Dark Force and John Weidman. - - Altered HiROM/LoROM detection a bit - Fievel goes West works now - - Open source preparations [teuf] - - In-game clock working for the windows port. [kode54] - - Fixed a memory leak problem in the new graphics engine [TRAC] - - Added Cubic Spline Interpolation [Anti Resonance] - - Fixed a assign/compare size bug in the new graphics engine [TRAC] - - Fixed b flag setting in BRK instruction in 6502 emulation mode [zsKnight] - - Added SPC7110 logger file output to help in the filesize clipping of - the SPC7110 data files [zsKnight] - - Fixed a memory leak bug, fixing that nasty Win2K crash bug [Matthew Kendora] - - Fixed key combination release [Maxim] - - Fixed source code warnings/added necessary includes [Maxim] - - Added high priority mode for Windows 2000 users and slower - computers (works on Windows 9x as well) [pagefault] - - Added large sound buffer option for people having DirectSound problems. - [pagefault] - - Fixed problem with ZSNESW and Opera causing a BSOD. [pagefault] - - Fixed up error reporting for people experiencing problems. [pagefault] - - Improved performance on 3dfx cards by compiling with DirectX 8 SDK. - [pagefault] - - Fixed a sound problem with people with messed up config files. [pagefault] - - Fixed FF3 flashing line problem [zsKnight] - - Fixed mysterious sprite disappearing bug in the new graphics engine - [zsKnight] - - Reduced noise in ToP opening theme. It works fine in the DOS port, - but the windows port still seems to produce some static, probably - because of the way how sound is updated in that port. [zsKnight] - - Updated Super 2xSaI and Super Eagle code (should be much faster - now on MMX processors) [Kreed, added by pagefault] - - Added gzip support [teuf] - - Added support for ViBRA16 cards [Peter Santing] - - No longer requires zlib.dll file, now statically linked. ZSNESw won't crash - anymore if you try to load a .zip file without that dll file. [pagefault] - - Now compiled using an optimising compiler [pagefault] - - Almost a fully re-written DSP-1 emulation engine! - [zsKnight, theoddone33, pagefault, teuf]. Also thanks to CrASH_Man - for the 3x3 inverse matrix formula. - - Fixed memory leak problem in the windows port during exit [pagefault] - - And more ... - - -............................................................ -Source Code Released - April 2, 2001 -............................................................ - -The ZSNES Sources have finally been released in the CVS repository of the -sourceforge page. We also would like to welcome Teuf as a member of the ZSNES -team as an assistant coder! He's helped us with quite a lot in the past while, -including (but not limited to) setting up the Source Forge page, helping us to -write the open source documentation, fixing up the ZSNES sources to not require -a custom version of nasm, organizing the sources into directories, modifying the -make file, etc. With the sources released, we also hope to release an updated -binary soon. Click on the Sourceforge link on the left side of the screen to -access the sources. The sources will also be available in a ZIP file for those -who don't want to use CVS. - - -............................................................ -v1.17b - December 27, 2000 -............................................................ - - * A nasty bug has crept into the DOS version in the 8-bit video modes, - so a fixed version (v1.17b) is released (it has the same filename as - v1.17 so just overwrite it). - - -............................................................ -v1.17, Win v0.85 - December 25, 2000 -............................................................ - - - Added slow-down key. You can configure it in Misc -> Game Keys - - Invulnerability bug of the 3rd boss in Demon's Crest in the - good checksum roms is fixed through rom mirroring - I also noticed that this fix is the same as what the author of SNEeSe - told me before about on some MegamanX1 roms, but I never had that rom - so I never added this until now. Guess that rom is also fixed too. - - Changed memory initialization values - Lost Viking 2 works again - - 65816: Fixed WAI instruction timing with HIRQ's - Top Gear 2 - 2 player mode works now - - Improved IRQ re-execution timing precision - - Starfox 2 beta now runs with sound! - - Fixed flickering problem in Starfox 2 beta - - Added Mode 2 16x16 tile offset per tile mode - - (Win32) Improved the timestamps on UDP headers. This should (hopefully) - solve those out of sync (where both sides see different things) problems - with certain connections (ie. T1/LAN connections) in netplay. - - (Win32) Added a big notice in netplay.txt. For all of you who used - netplay and had poor experiences with a ping time of less than 300ms, - read it! Also added a more realistic system requirements description - for decent netplay in netplay.txt rather than a cpu speed estimate. - - Changed reverse stereo method to become invisible to the sound - registers in emulation - - -............................................................ -v1.14, Win v0.80 - November 27, 2000 -............................................................ - - - Fixed configuration files from removing spaces from directory names - - (DOS) Fixed 640x480 vesa2 scanline+interpolation display problem - - (Win32) Improved Windows speed in 32-bit windowed mode. - Should give around an 18% speed increase in FPS. - - (Win32) More netplay improvements. Shouldn't be as jumpy when - one side lacks input. - - (Win32) Starting netplay will now force the max frameskip to 3 - if it is less than it and also force on auto frameskip. - - (Win32) MMX optimised netplay with back buffer enabled. - - (Win32) Fixed load state in netplay to load properly instead - of sometimes stalling for no reason - - (DOS) Accidently deleted the code to initialize IPX. Fixed now. - - Fixed a configuration loading problem when loading ZSNES from - a different directory. - - (Win32) Attempted to fix those out of sync problems (although - I don't know if it's fixed now since those problems rarely happen to me) - - (Win32) Displayed the current filename in the load window - for those files with extra long names. - - (Win32) Added nickname support to NetPlay. There's a 9 character - nickname size limit. - - (Win32) Added actions to chat (similar to how mIRC works - use - /me ) - - (Win32) Nicknames can be changed in the windowed chat by typing - /nick - - Added a small buffer to the in-game chat to allow up to 5 chat - strings displayed at once. - - Local chat strings now appear in that buffer - - Thickened black borders on the 5x5 font - - Extended in-game chat length by around 30 characters - - Fixed up Interpolation - - -............................................................ -v1.12, Win v0.74 - November 14, 2000 -............................................................ - - - (Win32) Hopefully fixed up those green display bugs in - scanlines/2xSaI in 1:5:5:5 16bit modes. - - (Win32) Improved lost packet recovery time and reduced the number of - lost packet stalls in UDP netplay (should produce more fluid netplay) - - (Win32) Fixed up crashing bug in Tales of Phantasia with a 512 byte header - - Extended filename length of the Quick Menu - - (Win32) Hopefully fixed up the mouse wheel support for certain mice - - Temp .ZIP directory is now cleared if it exists prior to another - .ZIP file being loaded. - - (Win32) Improved DirectInput error handling - - -............................................................ -v1.11, Win v0.72 - November 12, 2000 -............................................................ - - - (Win32) ZSNESw won't crash anymore if you don't have a soundcard - or if DirectSound fails to initialize. - - (Win32) Fixed a nasty performance bug with certain types of - joystick/drivers installed, causing the FPS to be slower for no reason. - - (Win32) Wrote an MMX optimised blitter for 16bit non-D windowed - and full screen modes. - - (Win32) Added simple wheel mouse support. - - -............................................................ -v1.10, Win v0.70 - November 7, 2000 -............................................................ - - - Fixed games that turns on the x239 resolution (eg. Chrono Trigger - battles) when scanline mode is enabled - - (Win32) Fixed up crashing bugs on extra long filenames with underscores - - (Win32) Hopefully fixed the odd colored interpolation in 1:5:5:5 16bit - color settings - - (Win32) Hopefully won't crash anymore when the temporary directory - exists prior to unzipping a .zip file - - (Win32) Fixed loading of .zip files with more than 2 '.'s in the - filename. Thanks to DCX for helping us troubleshoot this. - - (Win32) Fixed up short filename saveram/save states loading when - the long filename has spaces in it. - - Added TCP/IP Support. It is recommended that for playable netplay, - you'd have an average ping time of less than 300ms (type - ping in dos) and that packet loss is minimal for TCP/IP - (not UDP). At the moment, you cannot have more than 2 connections - Thanks for all the testers for testing this, especially DooMStalK, - GreenImp, and TeleKawaru! Also added back buffer support. This - will sacrifice cpu power for netplay to make it much more playable. - WARNING: High cpu speed recommendations (~450mhz+). - Please see netplay.txt for details. - - Added save states to netplay (just use them like you normally do) - - Save Ram is now defaulted to load/save on the server's side - Save Ram are not supported in SA-1/SuperFX games due to their size, - but you can use save states instead in that case. - - Increased chat line length in the out-of-game chatbox by a lot - - Partly increased the chat line length in-game - - in-game chat text now stays longer on-screen by 2 seconds - - Added reset in netplay - - Fixed up movie recording feature - - (Win32) Mouse shouldn't get stuck on the left side anymore. - - (Win32) Video mode 3 (256x224FS) shouldn't crash anymore. Thanks - to kode54 for his assistance on the above 2 bugfixes. - - (Win32) Fixed the instability bug where the window can sometimes - start shaking for no reason and takes away windows resources. - - (Win32) Re-wrote keyboard character input routines - - Fixed up FF2(4)'s music in lower sampling rates - - (Win32) Coded in the UDP protocol as a replacement for TCP/IP. - Some network configurations won't work with UDP. However, it is strongly - recommended that you use UDP if you can because of the speed increase. - In order to disable UDP and use TCP/IP, both sides must de-select UDP. - - (Win32) Added a small multiplayer game list (multi.txt) - - Added an updated Windows FAQ, courtesy of TuxedoMsk of VGNetwork - who updated it. - - Added a more user friendly input selection routine (changed Direct Input - to Keyb/Joystick and it also auto-sets keyb/Joystick when you set a key) - - Hopefully fixed up the sprite priority problems (eg. FF2/4's damage points) - - (Win32) Added rewind support for up to 8 levels (in 8 second intervals) - (NOTE: Windows Port only! - Sorry DOS Port users). In order to activate - this, assign a key to the Rewind Key in the Misc -> GameKeys option. - Note: Netplay plays really nice as long as the net connection is not - unstable, both sides have a fast cpu (speed requirements depend - on the game), and at least have a 28.8 connection. - *** PLEASE READ ZSNESW.TXT IF YOU ARE STILL HAVING PROBLEMS WITH - THE WINDOWS PORT - - -............................................................ -v1.01 - September 9, 2000 -............................................................ - - - Fixed a problem with offset per tile mode with MMX2 in the new 16bit engine - - Fixed crashing problem in MMX2 (Win port) - - Removed clock option (Win port) - - Disabling the new graphics 16bit engine is now properly saved - in the configuration files - - Added the win port version number to the about box (Win port) - - Fixed the % of execution problem in IPX/Modem modes - - -............................................................ -v1.000 - September 1, 2000 - First Windows Release -............................................................ - - - Implemented C4 emulation : - - C4 Sprite structure -> OAM conversion routines - - Sprite Rotate/Scale ability - - Sprite disintegrate function - - All in-game used math co-processor functions (hopefully) - - Both wireframe modes - - There are still some problems with C4 emulation, but I'd - consider them to be quite minor to just leave them there. - Thanks to StarCreator for recording a bunch of movies off - of the real snes for me to compare! - - Tweaked ADSR a bit - - Decreased envelope when key on is issued while sound is still playing. - This fixed static/popping sound bugs that affected many games. - - Added the ability to select the Add-on device (Snes Mouse/Super Scope) - from the GUI through the Add-on option in the Config Menu - - Added a hack to allow the mouse to control the cursor in Lethal Enforcers - (Press '7' 4 times to activate or select it from the Add-on option in the - Config Menu). Unfortunately, this method has problems (ie. mouse moves - things that it shouldn't) but it should be good enough, especially for - those who asked for this. I doubt this works in LE2, however. - - Added a manual load entry box so that you can type in the - filenames/directories manually or type in part of the filename and the GUI - will seek to whichever filename contains or closely contains that part - - Pharos coded a water effect, getting help from Scott Scriven's - water effect code. - - You can enable/disable the Water Effect and Snow Effect from the - GUI Options (MISC Menu in the GUI) - - Implemented Sprite Windowing to the new gfx 8bit engine. This - completes all the features that I have planned for that engine. - - Fixed a really nasty stereo bug that caused volume levels/pans - to sound completely off on one of the speakers - - Added player 5 as a normal player instead of just being available - in modem/ipx play - - Implemented an option to turn in-game messages/fps display to be transparent - - Added a Set Keys feature to the Input Routines in the GUI that - allows you to set all of the standard SNES keys all at once - instead of clicking on the inputs separately to set them - - Ported the new graphics 8bit engine to 16bit: - - All the standard snes features from the 8bit engine - - Works with all 16bit resolution modes/effects - - Ported high resolution Mode 7 - - Added proper main/sub screen support and windowing support - - Added all transparencies modes - - Added Direct Color Mode7 - - 2xSaI and 50/75% scanlines can now co-exist with high resolution modes - - This is now the default engine for 16bit. Some games won't - work well with this engine such as some SuperFX games (eg. Stunt - Race FX in the menus). You can switch back to the old graphics - engine by pressing the '8' key. - - Implemented a dual cache system in the tile modes. I don't know - how much of a speed increase this gives since my system can already - run the old graphics engine at full speed and framerate. - - Full 15bit transparencies for MMX cpus only. - - High Resolution Mode7 can be toggled on/off in the Video Options. - It is disabled by default since this feature requires a fast CPU. - - Added 48khz sound sampling rate - - Tweaked VBlank timing a bit - - Tweaked 65816 CPU cycle execution a bit - - Added Kreed's Super 2xSaI engine. It's written in C, - so it requires a really fast cpu to run it. - - Added picture preview to the save states in the F3 window. - Newly created save states will contain a small picture in them. - Pictures will not appear in old save states, however. - - -............................................................ -v0.991 - May 24, 2000 -............................................................ - - - Disabled 2xSaI/Super Eagle when in the GUI - - Fixed up cheat code search (Got broken in v0.990 during port preparation) - - -............................................................ -v0.990 - May 24, 2000 -............................................................ - - - Added speed hack for Kirby Super Star (US) - - SPC700 (Sound cpu emulation) is now enabled by default whether - sound is enabled or not. Emulation will now be slower than normal - if you usually run with sound off, but the compatibility is higher. - However, you can disable this through the options window in the GUI - if speed is of your concern. Also, a few games only run with it - disabled so this option may be useful in those cases. - - Decreased cheat code description length by 1 since the last - letter was causing some corruption to the next cheat code - - Added an option to raise the pitch level to the pre-v0.989 - pitch levels, mainly for non-Creative brand sound cards. - - You can now change the sound settings (Enable Sound, Stereo, - Sound Frequency) with immediate effects without re-starting ZSNES. - However, there seems to be some problems with stereo switching - on SB Live!'s. - - Configuration is now saved whenever you exit the GUI instead - of just exiting the program - - Lots of port preparation done on the source. - + Memory/Commandline fix on the C version. A version should - not be needed anymore (hopefully) - - The GUI is now using the standard in-game video blitter rather than it own. - - Fixed up SnapShot key in 8bit mode - - Implemented 4-point gaussian interpolation. This is the interpolation used - by the actual snes! Many thanks goes to Neill Corlett for his work on - finding this info! Of course, this routine takes up an extra cpu load so - emulation will slow down a bit if your computer isn't fast enough, but - you can always disable interpolation through the sound options. - - Fixed up Pitch Modulation method. Thanks again, Neill! - - Pitch modulation was modulating from the wrong channel. Fixed. - - Tweaked SuperFX timing. - - Added a move window feature to the F1 menu - - Expanded filename length in the GUI display for long filenames - by 3, but had to decrease the directory name by 2. - - Added support for % codes in long filenames - - -............................................................ -v0.9891c/a - February 21, 2000 -............................................................ - - - Slightly changed SB16 initialization - - Forgot to remove DSP1 debug code - - Fixed a pitch modulation bug when Voice 0 modulates Voice 1. - Thanks to kode54 for this fix! - - -............................................................ -v0.989c/a - February 12, 2000 -............................................................ - - - Fixed some SA-1 sudden slowdowns. This does slow down the overall - emulation speed in SA-1 games though. - - All sounds were being played at the wrong pitch (slightly higher - than normal. It's now fixed so Zsnes should sound better now. - Thanks to kode54 for helping out here! - - -............................................................ -v0.988c/a - December 6, 1999 -............................................................ - - - Added some SA-1 speed hacks (Kirby DX/Parodius 3) - - Implemented SDD-1 MMC. But none of the SDD-1 games run properly yet - because of the compression chip. - - Fixed up some slowdown problems in SA-1 games - - Fixed up dirty CPUID fix for Cyrix CPUs so that you don't have to - re-run Zsnes twice every time. - - -............................................................ -v0.987c/a - November 26, 1999 -............................................................ - - - Forgot to re-enable pitch modulation after disabling it for debugging - purposes. - - -............................................................ -v0.986c/a - November 23, 1999 -............................................................ - - - Re-added Sound Buffering. I was hoping to re-write it, but - later found out that it wasn't worth the trouble. - - Fixed some Triple Buffering bugs, but I can't figure out that - flicker glitch on NVidia cards - - Added Simulated Triple Buffering for cards without VESA 3.0 Hardware - triple buffering. This method does some lose frames, but should be - faster than v-sync. This only works on VESA 2.0 modes. - - Fixed up directory sorting to always put ./.. at the top. - - -............................................................ -v0.985c - November 15, 1999 -............................................................ - - - Added some more speedups to the SA-1 - - SA-1: Fixed a branch problem with the BRL instruction - - Implemented Save Ram support into netplay. - Thanks to The Minder for help testing this! - - Added a hack to get Mario Paint trainered rom with the trainer - removed to work with the snes mouse instead of the keyboard/joystick - - Prevented Joystick Keys/Buttons to be selected as the diagonal - keys in the GUI - - Fixed some crashing problems with the Modem Mode - - Implemented a key combination editor in the GUI - - Sped up V-Sync - - Fixed an SA-1 memory map bug! Fixes DBZ:HD. - - Added an small speed hack for DBZ:HD - - Implemented SA-1 Super MMC - - Finally, after many, many hours of hacking. Figured out - what caused the odd noise sounds! So far, simulated noise - is implemented since the true nature of how this noise - is produced is unknown so it will sound somewhat off compared - to the original sounds. There is also a slight chance that - some sounds will become noise incorrectly and vice versa. - - Fixed up Pitch Modulation - - Fixed SNES Mouse/Super Scope support when Pl3/4 as Pl1/2 option is enabled - - ADSR/GAIN overhaul (Sound DSP) : - - Fixed several GAIN bugs - - Implemented Increase Bentline/Decrease Exp GAIN modes properly - - Rewrote Decay/Sustain modes in ADSR - - Fixed a restarting ADSR bug - - Removed Sound Buffering. I don't think it's worth losing the - quality of the sound for a small amount of speed boost. - - Implemented an option to disable the Noise Simulation for those - games that aren't working properly because of it - - Implemented Triple Buffering. You can enable this through the - Video Options in the GUI. Unfortunately, Triple Buffering - won't work with 2xSaI/Super Eagle engine at the moment since they - rely on the previous screen for updating nor will it work - properly with high resolution games in the old gfx engine. - Thanks to GreenImp for patiently helping through testing! - - Implemented Full Screen Interpolation. Only works on - MMX CPU's at the moment. - - Implemented Cheat Code Reflector (See Guinotes.txt for details) - - Any proper VESA 2 error messages now doesn't exit the program - when in the GUI but instead display the error message in a - box and allows the user to continue. - Thanks to Daniel for lending me his copier which helped me hack the - SNES Sound Noise/ADSR stuff! - - -............................................................ -v0.963c/a - September 19, 1999 -............................................................ - - NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files in the - assembly only version. Use v0.963c for those features. The only time - when you should use this version is if v0.963c doesn't work for you. - - Fixed DMA position reader to fix the high sample rate problem - in SB-Live! cards. Thanks to ShihTzu for helping us with this! - - Removed SB16 only message under stereo option in commandline help. - Shouldn't really be there since v0.600. - - Low Pass Filter is now disabled by default. But you can still - enable it through the GUI. - - Implemented an option in the GUI to not allow Zsnes to change - the current start-up game path in the configuration. You can - access this in Config->Options. - - Joystick calibration values have been reset since there seems - to be some problems with it. You may have to re-calibrate your - joystick if it doesn't respond correctly. - - -............................................................ -v0.962c/a - September 18, 1999 -............................................................ - - - Exit text now only displays when text mode is 80x25 - - Used hardware DMA counter to determine which sound block to write to rather - than assuming it always starts at the first one for the sound routines. - This should hopefully fix all those nasty sound static problems many people - seems to have. Many thanks to Crono for the code and for his help! - - Removed Re-Init Every 30 Second option. Shouldn't be needed anymore - - Added the ability to disable the Low Pass Filter - - Implemented Diagonal Keys - - Implemented some SA-1 speedups - -A Only: - NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files in the - assembly only version. Use v0.962c for those features. The only time - when you should use this version is if v0.962c doesn't work for you. - - All changes from v0.960c - - -............................................................ -v0.960c - September 17, 1999 -............................................................ - - - Modified header reader a bit - - DSP/SPC700: Modified EndX register usage to fix some compatibility - - DSP/SPC700: Fixed up timing registers - - DSP/SPC700: Fixed a sample looping bug causing many sounds to not - sound correctly - - SPC700: Fixed a small bug in TCALL. Not sure if it fixes anything - - Added small optimisations to the MMX video copy routines - - Fixed an adsr -> gain switching bug - - Extended maximum number of cheat codes from 75 to 255 - - Altered .spc format again, this time to suit the ID666 format - - Worked a bit on SDD-1 emulation. Don't think we can go any further since - we can't seem to figure out the compression algorithm used in that chip. - - DSP/SPC700: Added low-pass filter by kode54. Thanks kode54 for the code! - This enhances bass in some games. - - SA-1: Fixed memory map access problems with several stack - instructions and d-page instructions - - SA-1: Minor fix to the timing - - SA-1: Fixed a load state problem which causes Zsnes to crash sometimes - - SA-1: Fixed a small problem with the cpu communication register - - SA-1: Added a small speed hack for Kirby 3 - - Added some transparency hacks (Kirby3, FF3) - - Added an sram fix hack for Donkey Kong Country 2 trainer version - - GUI now displays a message when SAVE CFG is selected - - Added on-screen messages to the Background/Sound channel toggle keys - - Added the missing video mode descriptions in the .cfg and commandline help - - -............................................................ -v0.953c/a - August 4, 1999 -............................................................ - - - Echo should sound better now - - Restored the old Sound Blaster routines since the new ones seems - to create some static in certain computer configurations - - Increased volume intensity of more quiet samples - -C Only: - - Fixed up crashing bug in pure dos when vesa 2 initialization failed - - Included cwsdpmi.exe with the zsnes archive. - -A Only: - NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files - in the assembly only version - - Fixed a small H+V IRQ timing problem - - Fixed some vertical off by 1 line bugs - - Attempting to save over read-only files shouldn't mess up anymore - - Start with newest save option now works with the save directory defined - - Fixed up a crashing bug when a read only file is loaded - - The volume level didn't modify the echo volume. Now fixed. - - Fixed up a display problem in the F1 menu in 256 color mode - - Fixed an echo delay bug - - Hopefully fixed the random beep encounter bug that - occurs in some games with sound enabled - - Several sound volume fixes - - Fixed Save Snapshot + Increment frame enter key affecting the game bug - - Added Increment Frame Only option to the F1 menu - - Made some minor changes to the Sound Blaster routines - - Fixed some more sync bugs in .ZMV recording - - Fixed a speed hack bug that occurred from v0.800 to v0.900. - Hopefully the speed is better now. - - Slightly improved the sound skipper when sound is disabled - - You can now quickly modify the currently selected cheat code's - value by typing a 2 digit hex number in the cheat code enter space - - Added a hack to Chrono Trigger to prevent the screen from flashing - before battles - - Fixed a 16-bit mode 7 windowing distortion/crashing bug - - Fixed a read memory leak bug in the 16-bit old gfx engine. - Interesting that this bug plagued ZSNES all this time, but its - effects didn't show until the recent versions. - - -............................................................ -v0.952c - August 3, 1999 -............................................................ - - - Fixed a small H+V IRQ timing problem - - Fixed the bug which caused HiROM games from not loading properly - through the commandline - - Fixed some vertical off by 1 line bugs - - Attempting to save over read-only files shouldn't mess up anymore - - -............................................................ -v0.951c - August 3, 1999 -............................................................ - - - Fixed up the directory changing bugs that plagued v0.950 - - Start with newest save option now works with the save directory defined - - Fixed up a crashing bug when a read only file is loaded - - The volume level didn't modify the echo volume. Now fixed. - - -............................................................ -v0.950c - August 2, 1999 -............................................................ - - - Fixed up a pretty nasty .ZIP support bug where .ZIP files from - the root directory weren't loaded up properly - - Fixed up a display problem in the F1 menu in 256 color mode - - Fixed an echo delay bug - - Hopefully fixed the random beep encounter bug that - occurs in some games with sound enabled - - Several sound volume fixes - - Sorry about those new problems in v0.941c. We traced some of the - problems to the dos extender zsnes was using (thanks Maxim- for - some help on this!) so we spent some time rewritng the file system - so that it would be compatible with other extenders in pure dos. - - Fixed Save Snapshot + Increment frame enter key affecting the game bug - - Added Increment Frame Only option to the F1 menu - - Made some minor changes to the Sound Blaster routines - - Fixed some more sync bugs in .ZMV recording - - Fixed a speed hack bug that occurred from v0.800 to v0.900. - Hopefully the speed is better now. - - Slightly improved the sound skipper when sound is disabled - - You can now quickly modify the currently selected cheat code's - value by typing a 2 digit hex number in the cheat code enter space - - Added a hack to Chrono Trigger to prevent the screen from flashing - before battles - - Fixed a 16-bit mode 7 windowing distortion/crashing bug - - Fixed a read memory leak bug in the 16-bit old gfx engine. - Interesting that this bug plagued ZSNES all this time, but its - effects didn't show until the recent versions. - - -............................................................ -v0.941c/a - July 18, 1999 -............................................................ - - - Fixed a small newly created timing bug - - Fixed flicker bug in 320x480x65536 video mode during high - snes resolution mode - - -............................................................ -v0.940c/a - July 18, 1999 -............................................................ - - - Fixed a major SuperFX bug! Starfox and other SuperFX games - now show polygons! Note that the SuperFX still has bugs. - - Fixed an offset per tile mode bug - - Optimised SuperFX plot instruction. - - Implemented a hack to get Winter Gold working. - Thanks to Gary Henderson for this fix! - - Fixed a flag setting bug in the XCE instruction (65816). - - Fixed another HIRQ bug - - Seems like a sprite cache bug that was fixed in v0.800 re-appeared - in v0.900. Fixed now. - - Fixed an SA-1 arithmetic calculation result timing bug - - Forced the old gfx engine on when running Stunt Race FX since - the new gfx engine was having lots of problems in 256 color mode - - Fixed a new gfx 8bit engine mosaic crashing bug with certain games - - Fixed a sprite cache bug in the new gfx engine - - Fixed a DSP envelope bug which was causing some games to not work - - WRAM data is now cleared by 0xFF - - Fixed 320x480x16bit mode when switching from a 256 color mode - - -............................................................ -v0.915c/a - July 7, 1999 -............................................................ - - NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files - in the assembly only version - - Skipped scanline length check/set in VESA 1.2 routines - - Fixed a 256 color mode 7 slowdown bug that occurred in v0.910c - - Added hi-res mode 7 hack to 320x480x256 video mode - - Implemented 2xSaI engine for ARGB cards. Thanks to Kreed for - the updated source! - - 2xSaI was missing a couple lines at the bottom. Now fixed - + A: 320x480 modes can now be selected in the GUI - - properly cleared 320x480x256 video mode - - F3 menu should now be correct during hi-res mode 7 - - -............................................................ -v0.910c/a - July 6, 1999 -............................................................ - - NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files - in the assembly only version - - The bug where enabling auto-cheat load, having an Sram directory, - and loading a rom without a .cht file which results in Zsnes changing - the loading directory to the sram directory is fixed. - + A: Fixed cheat search engine - - Tweaked HIRQ timing to fix some flickering in some games - - Fixed screen shot capture in ARGB cards in 640x480x65536 mode - with scanlines enabled - - Implemented adjustable time interval for the sound reinitialization - feature so that it can be set to values other than 30 seconds. It - can be modified in zsnes.cfg (ReInitTime) - - Cheat Search 'Add' button now works properly - - Corrected Register 4212h to adjust to the new NMI timing - - Implemented ARGB video mode support to VESA 1.2 - - Implemented 320x480x256 and 320x480x65536 video modes - - Fixed a x448 resolution bug when scanlines are enabled - - Prevented those with ARGB videocards from checking 2xSaI or - Super Eagle engine for now - - -............................................................ -v0.900c/a - July 4, 1999 -............................................................ - - NOTE : You cannot run DSP1 games, use IPX support, or use .ZIP files - in the assembly only version - - Fixed another sprite priority bug - + A: Fixed an IRQ problem that was caused during the C -> ASM conversion - - HBlank is supposed to be noticed during VBlank - - Fixed an IRQ bug that occured between v0.715 and v0.800 - - Fixed a 65816 DPage usage bug that occured between v0.715 and v0.800 - - Rewrote 65816 flag handling system. - - Optimised SA-1 emulation - - Optimised the 65816 main loop. - - Implemented Surround Sound. It is defaulted off since it seems - to create some bad static in some games. Thanks to Crono for info! - - Wrote Interpolation in MMX. MMX cpu is required. - - Implemented MMX auto-detection for MMX Interpolation and MMX Copy. - - Fixed an 224HDMA line bug, thanks to Gary Henderson! - - Optimised 320x240x16b and 640x480x16b for ARGB cards. - - Removed Snow - - Clock option is now visible to anyone. You can enable the in-game clock - through the GUI in Config->Options. - - Altered method of writing to file in Movie Recording mode, hoping that - it will fix some problems after recording movies for a long period of time. - - Altered data alignment size in source - - Fixed a VESA2 divide by 0 bug in Banshee cards by checking - the scanline length instead of setting it immediately. - Thanks to Crono for some help! - - Altered sound echo volume - - Added sound interpolation based on Crono's code. - Thanks to Crono for his help! - - Added an option to turn off sound interpolation for speed - - Implemented Pitch Modulation, thanks goes to Gary Henderson for - clarification info! - - Implemented an option in the GUI (Config->Options) to allow the - Fast Forward key to act as a toggle (disabled by default) - - Fixed a bug that prevented high resolution to sometimes not display - in a 16bit video mode - - Fixed a game stalling bug when pressing F3 during games that are - sensitive to changes in the ENVX DSP register (Bomberman Series) - - Added a hack for the graphic glitches in Dragon Quest 6 - - Fixed up in-game clock in the new gfx 16bit engine - - Fixed a nasty bug in the ADSR engine. It was sometimes using - an incorrect decay value, causing the sound to stick instead of fading out - - Slightly fixed ADSR by completely skipping the attack stage when - the attack duration is 0 - - Fixed a GAIN decrease->increase bug - - Implemented a safe recovery feature for those computers that - don't support the CPUID instruction (used for MMX detection). - If ZSNES crashes at the very start, just re-run it. - - Fixed a fixed color dual windowing bug in the subscreen which caused - transparency to sometimes shift unexpectedly when the background scrolls - - Implemented 50% Scanlines (Lance McKay's idea) and 25% Scanlines (Similar - to Snes9x TV-Mode's scanline intensity) in 640x480x65536 video mode. - These modes don't work on videocards with an ARGB setting yet. - - Added MMX Support to 50% and 25% Scanlines modes - - Implemented back buffer clear in MMX - - .CHT files now saves to the proper save directory - - Implemented the 2xSaI graphics engine (MMX Only). Many thanks - to Kreed for this wonderful engine and source code! - - Implemented Kreed's Super Eagle engine. Note that for both - 2xSaI and Super Eagle, you need an MMX processor, enough RAM for - the new gfx 16bit engine, and also be in 640x480x65536 video mode. - - Implemented an option to auto-load a .cht file whenever a game is loaded. - You can find this option at the bottom of the Cheat Window in the GUI. - - Optimised Non-MMX Interpolation - - Fixed a bug that caused save states to not save correctly after - attempting to load a non-existing .cht file - - Added a Quick SnapShot Key. You can set this key in the - Misc -> GameKeys menu in the GUI. This key allows you to take - a snapshot with just a press of a key. - + C: Implemented .ZIP support. Thanks to Jean-loup Gailly, Mark Adler, - and Gilles Vollant for the ZIP routines! - - Fixed a bug where pressing PageUp/PageDown in the cheat window - went over by 3 entries. - - Implemented longer cheat descriptions. The cheat window and the - .cht file format had to change a bit, however, ZSNES automatically - converts any old formats to the new formats when it detects it. - - Allowed the IRQ to be executed more than once on the same line - through HIRQ. Fixes the flickering problems of Doom/Offroad Baja. - - NMI now executes at line 225 instead of 224. - - Saving/Loading the state causing the control to stop or skip has - been fixed again. - + C: .ZIP files can now be run from the commandline - - Implemented an option for ZSNES to automatically save the save data - approx. 5 seconds after it detects writes to it. This will not - work for SuperFX or SA-1 special chip games, however. This option - is disabled by default and can be enabled through the option window. - - Implemented an option in the sound window to re-initialize the sound - card after every 25-30 seconds. Hopefully fixes the problems where - the sound gets staticy after a certain amount of time. - - Newest Save Slot will now appear as orange in the Save State - Select (F3) window - - Fixed a spc700 <-> 65816 sync bug during movie (.ZMV) playback - - Implemented an option to enable Old Gfx Engine Mode 2 (Accessible - through the options window in the GUI). This mode fixes many - transparency problems in 16bit modes, but can also create some - and is also at times slower than the original engine. - - Implemented 640x480x65536 VESA 1.2 support. Currently supports - Full Scanlines and Smallscreen modes. However, it is strongly - recommended that you only use VESA 1.2 support if your card cannot - support VESA 2.0 (w/ linear framebuffer) since VESA 1.2 runs slower. - - Implemented an option to disable Pitch Modulation - - Sound card is now not re-initialized whenever a state is saved/loaded - since some sound cards seems to have problems with it. - - Implemented Single Windowing in the New Gfx 8bit engine, 8x8 - and 16x16 tile modes only - - Fixed 64k SRAM support when loaded from the GUI - - Optimised high resolution new gfx modes in 640x480x256 - - Fixed the graphic glitches in x488 snes vertical resolution modes - in 640x480x256 new gfx mode - - Optimised 640x480x256 Eagle Engine - - Fixed the GUI background display bug in the new gfx engine - - Fixed .SPC capture in the new gfx engine - - Added an option to start with the newest save state when the game - is loaded. It can be enabled in Config->Options window in the GUI - - Slightly optimised new gfx 8bit engine - - Fixed several Mode 7 problems in the New Gfx 8bit engine - - Changed DSP1 variables to use double instead of floats for a small - speed increase. Thanks to Gary Henderson for this tip! - - Fixed up the Mode 7 slowdown bug when the scale ratio becomes small - in most graphics modes - - Optimised some Mode 7 transparency modes - - Implemented EXTBG mode 7 into the newgfx 8bit engine - - Fixed the 'FIX' feature in the cheat menu. Seems like it wasn't - writing any value to memory when it was clicked. - - Game Genie codes are now defaulted to the 'FIX'ed mode. Seems like - most of the codes needs this. - - Implemented windowing to Mode 7, New Gfx Engine 8bit - - Added support for .SPC v0.2 format - - Added an option in zsnes.cfg to disable configuration saving for - those who want to store zsnes.exe in a read-only storage area - - Fixed GameKeys display in the GUI for certain keys (such as the - snes parallel adapter keys) - - Implemented hi-res mode 7 (vertical expand only). Currently only - works in 640x480x256 newgfx engine (w/ Eagle and Scanlines disabled). - - Fixed an offset per tile mode bug in the new gfx 8bit engine - - Implemented dual windowing modes into the new gfx 8bit engine - - New Gfx 8bit engine is now the default graphics engine in 256 color modes. - It still lacks sprite windowing and also has some sprite flicker issues, - but it's overall more stable, faster, and has more features. - You can still switch back to the old gfx engine by pressing '8'. - - Looks like Pitch Modulation was causing more sound problems than - what it's worth. It's now disabled by default, but you can reenable - it through the GUI. - - Added auto save/load state feature where ZSNES will automatically - loads back the previous state when you last properly exited ZSNES. - This feature is disabled by default. - - Compressed the executable using UPX - - -............................................................ -v0.800a - December 25, 1998 -............................................................ - - - Assembly only version. - - Doesn't support DSP1 chip or IPX. - - May fix problems that some people are having with sound. - - NOTE : Only use this if have problems with 0.800c. - - -............................................................ -v0.800c - December 24, 1998 -............................................................ - - - Fixed up sound speeds. Timers were computed incorrectly. - - Fixed a sprite priority bug - - Fixed up a bug that prevented the gui to be disabled - - Fixed up SPC capture - - Fixed a bug when VIRQ is set on the same scanline as NMI - - Implemented an automatic .IPS patcher. Just rename your .IPS - file to the rom filename with the .IPS extension and ZSNES will - patch the rom realtime without modifying the rom file's contents. - Thanks to Neill Corlett for most of the .IPS info! - - Snapshot capture/skip 2 frames option now returns back to - the proper menu item - - Fixed a calibration bug with 6/8button joysticks - - Fixed up display in 640x480x8 new gfx engine - - Fixed up hi resolution displays in all 640x480x8b modes - - Fixed up a bug where Mode 7 becomes corrupt after selecting - Save CFG from the GUI - - Fixed a memory map bug in lorom DSP1 games - - Fixed a potential DSP1 crashing bug where a negative value is - being square rooted - - Hopefully fixed the modem bug when using an IRQ that is bigger than 7 - - Fixed up an ADSR bug for games that changes ADSR mid-sample - - Fixed up echo emulation (possibly slowed down emulation) - - Fixed up a sprite caching bug - - Fixed up a DSP1 byte check stall bug - - Implemented a commandline to disable spc700 speed hacks (-7) - Might help with some compatibility - - Implemented SA-1 support (most functions emulated)! Unfortunately, - it's still buggy. Thanks to the snes9x team for providing info! - - Fixed a bug when selecting drive A/B while a disk is not - in the drive caused a long check sequence - - Implemented Keyboard support to most of Option, Sound, and GUI Option - configurations in the GUI - - Changed sound init code a bit. Hopefully improves sound card - compatibility, but might also ruin it. - - Implemented off by 1 line fix (-9). This may help compatibility and - fix some minor graphic glitches, but may also ruin some too. - - -............................................................ -v0.715 - October 29, 1998 -............................................................ - - - Fixed a crashing bug when 16bit back window clipping was using - an undefined windowing clip buffer - - Added spc program counter check to the spc stall detection to - reduce false alarms - - Tweaked IRQ processing a bit - - ZSNES.CFG and ZGUICFG.DAT are now fixed so that they will use - the current directory when the SET CMDLINE detection fails - - Fixed several mode 7 bugs in the new graphic engines - - Implemented an option to save the configuration files in the MISC menu - - Added a shadow to the in-game text displays - - Fixed a bug created in v0.700 where pressing F3 while sound - is disabled crashes zsnes - - Fixed up player 4 and player 5 so they now work again - - Fixed up color a bit in the old graphics 16bit engine - - Added gamma control to 16bit old graphics engine - - Fixed a cheat code bug where pressing the down key in the browser - overflows by 3 rows - - Fixed up a bug where any memory allocation below 48mbit support crashes - - Added out of memory error when loading a file from the gui - - Fixed a minor off by 1 pixel windowing bug - + Fixed up memory requirements in the readme.txt. It seems like - compiling with C takes up 3.0 more megs. It shouldn't though. - An asm only version will be release later without dsp1/ipx support - unless the reason is figured out. - NOTE : It seems like IPX mode randomly loses packets in certain - configurations so IPX isn't recommended to use yet. - - -............................................................ -v0.700 - October 26, 1998 -............................................................ - - - Fixed another offset per tile mode bug - - Fixed up joystick button update rate - - Fixed a bug that caused sound buffer dump option to crash - - Fixed a minor sound initialization bug - - ZSNES now compiles with C code! - - Fully rewritten commandline parser routines - - Partially rewritten SET BLASTER/SET CMDLINE detection - - Implemented partial DSP1 support. Seems to have some precision problems. - Thanks to the snes9x team for the info! - - Fixed a mode 7 nonrepeat mode off by 1 tile bug - - Implemented snapshot/increment by 2 frame feature in the F1 menu - for those interested in producing animations - - Added variable sound buffer size to reduce static in higher sampling rates - - Changed method of reading the mouse cursor position in the GUI. - Hopefully, this fixes those mouse crash problems when zsnes is - run in pure dos and sometimes win95. - - Added a commandline to disable palette 0 (back color) modification - in 256 color modes - - Implemented Turbo Buttons for buttons A,B,X, and Y. Use the GUI to - define those keys - - Added the ability to toggle Turbo Change speed to 30hz instead of 60hz - in the Options menu - - Started C4 chip emulation. Nothing is playable yet. - - Fixed up SET CMDLINE detection. Hopefully, zsnes.cfg and - zguicfg.dat will now end up in the correct directory. - - Started Modem Support (direct modem to modem). - DOS-Compatible modem required! Thanks to Dark Force for helping - out on getting a bug that kept USR's and other modems from working! - Also thanks to The Minder for a lot of help testing! - Note : Modem mode isn't free of bugs - - Added in-game chat key to the GUI keys for modem/net support. - Currently defaulted to 't' - - Forgot to add EMMS after any MMX routines that seems to cause - any FPU instructions to crash - - Fixed an interrupt re-enable bug in the Gamepad Pro code which - seems to have eliminated the locking bugs when it's not set on GrIP mode - - Implemented keys to adjust Frame Rate up or down during gameplay. - You can define them through the GUI under Gamekeys - - Implemented keys to slide the volume level up or down during gameplay - - Fixed a small HDMA screw up bug when using Save/Load states - which caused the screen to flicker once in many games - - Finally fix up 48mbit mapper support! Many thanks to Dark Force, - Mike Gilroy, and Frank Hughes for a lot of help on this! - - Several fixes to register 4211h - - Rewrote IRQ timing handler (not perfect, but better) - - Implemented Fossil Driver support to the modem support. - - Fixed an IRQ reenable bug - - Increased default cycles a bit - - Fixed some major mode 7 rotation bugs - - Added support for uninterleaved 48mbit roms - - Added a FIX option to the cheat code to correct incorrectly converted codes - - Implemented Mode 7 horizontal flip - - Implemented primitive IPX support. It is very primitive at - the moment and may not work since it isn't really tested much. - - Optimised some 65816 direct page addressing modes - NOTE : .ZMV (Movie) files recorded under v0.635 has good potential - on becoming obsolete in this version because of the timing changes - NOTE : IPX support and Modem support may be buggy since it hasn't - been tested on multiple types of connections yet. - - -............................................................ -v0.635 - September 24, 1998 -............................................................ - - - Sidewinder fix options are now swapped since the majority seems - to work better with the other sidewinder routine. - - Implemented EXTBG mode7 in 256 color old graphics engine. - - Fixed a DSP Sound bug where some sound effects weren't played - in certain games - - Tweaked joystick routines again - - Fixed up a bug where sometimes loading a game after playing - another game screws up emulation - - Optimised 640x480x8, 512x384x8, and 512x384x16 video modes - - Implemented EXTBG mode7 in 65536 color old graphics engine. - - Fixed an offset per tile mode range clipping bug - - Fixed up offset per tile mode in new gfx 8bit engine - - Fixed a bug which caused a crash when a state is loaded while - playing/recording a movie file - - Optimised new gfx 16bit non-transparency mode - - Implemented SPC700 stall detection/recovery attempt - - Fixed up a new header detection bug in v0.625 - - Modified memory allocation routines. Hope this fixes those - random crash problems that some people seem to have - - Fixed a sound bug where the song leaks after it ends, - sometimes producing an unwanted beep - - Optimised new gfx 16bit transparency modes - - Multiple DSP sound bug fixes - - Implemented transparencies in high res 16x8 tiles - - Implemented a command line to disable the sound DSP (-dd). Use - -s and -dd if you want spc700 emulation to be enabled without sound - to improve compatibility - - Fixed a bug where joystick support makes the emulation slow - - Had to remove some memory allocated variables and convert them to arrays - since they were causing random crashes on specific computers. - - Fixed up pressing save state/load state in game so that it doesn't - clear any key presses - - -............................................................ -v0.625 - September 18, 1998 -............................................................ - - - Fixed up a major speed drop bug by just adding some empty space. - Most likely a cache/alignment problem. - - Used an older version of wdosx because the new version sometimes - crashes during compiling - - Executable is now uncompressed. It's 3 megs, but it provides a - much faster start up time. - - Seems like EPACK can only support a maximum of 6 commandlines. - Fixed after executable is decompressed - - Fixed a bug where buttons 7 and 8 of 8 button joystick support - sticks once pressed - - Swapped button 5/6 and 7/8 in the default joystick configuration - for 8 button joysticks - - It seems like 16bit HDMA < 5 was causing problems with some sound cards. - It now reroutes back to 8bit DMA like how v0.400 did it. - - Implemented a new offset per tile mode engine into the old - graphics engine (mostly transferred from 8bit newgfx engine) - - Implemented Horizontal offset per tile mode in both 8bit and - 16 bit old graphics engine (Mode2/8x8 only) - - Implemented Horizontal offset per tile mode in 8bit new graphics - engine (Mode2/8x8 only) - - Tweaked sidewinder routines. Hopefully, this will help those who - have troubles using sidewinder support - - For those with sidewinder pads who has troubles with the tweaked routines, - a 'Sidewinder Fix' option in the GUI is added in the Config/Options menu - - Commandline -i now uninterleaves an incorrectly interleaved rom - - Tweaked GamePad Pro routines. Not exactly sure if this will help - those with 2 GPP joysticks though - - Fixed up sticky buttons in the GUI cheat menu when - no cheat codes are present - - Fixed a bug where using -1 and -2 in the commandlines didn't - activate the joystick movement/buttons - - Fixed an offset per tile mode wrapping bug - - ZSNES will now not crash when zsnes.cfg and zguicfg.dat are - write protected files - - Fixed up the GUI when 239 y resolution is used in the game - - Optimised some minor mode 7 routines - - SNES Header display in the GUI now displays the filename for blank headers. - This will fail for headers with garbled header names - - Inserted an extra reminder in the cheat menu - - Implemented 239 y-resolution support for .PCX snapshots - - Implemented 239 y-resolution support for .BMP snapshots - - Added multiple .SPC saves (Up to 10 saves only) - - Save State Selection Menu (default F3) now highlights used - state boxes in red - - Tweaked 2player/6button/8button joystick routines a bit - - Fixed a cheat code bug where pressing TAB adds an extra character - at the end of the address - - Removed the blank line from the .PCX and .BMP snapshots - - Implemented Joystick Calibration for non digital joysticks - - Fixed a bug where parallel port LPT2 player 2 wasn't selectable in v0.605 - - Stabilized the joystick code a bit - - Fixed up a cheat code bug where using a PAR code that accesses - RAM doesn't freeze when the .cht file is loaded - - Added a small delay to play a note when a key on is issued from - the sound DSP. Not sure if this fixes anything though - - Fixed some sound compatibility problems when RESET is used - - Implemented Movie Record/Playback support. Read GUINotes.txt for details. - - Added a small detection for long filenames and prevented users from - selecting it when it isn't detected - - Fixed a bug where max frame skip didn't save - - Fix a timing bug where running a game off the gui ran 1 less - line in the 65816 than running off the commandline - - Implemented FPS at start option in the Config/Options menu - - Fixed a bug in the newgfx16bit engine where 8bpp tiles displayed incorrectly - - Reduced the filesize by 1200k through many changes in the code - (filesize is now 2.0 megs) - - Fixed some VIRQ bugs that caused certain games to crash - - Added DMA area execution for IRET - - Added a 'Bugs Section' in the readme.txt - - Show all extensions is now disabled when snes header view is - selected in the GUI - - Implemented partial Direct Color mode in Mode 7 (no transparencies - yet, only works in 16bit old gfx engine) - - Improved header detection a bit - - Fixed up a sprite bug in games which changes the address in - the middle of the screen - - -............................................................ -v0.605 - September 10, 1998 -............................................................ - - - Fixed up a FPS display bug when switching between auto frame rate - and manual frame rate in the GUI - - Cheat Codes can now be toggled ON/OFF by double clicking on them - - Tab key now switches from the Cheat Code enter box to the Description box - - Fixed a Save State/Load State bug in the menu where it saved - in the load directory instead of the save directory - - Implemented 8button joystick support (Not tested) - - Implemented an option in the .cfg file to enable reversed - stereo sound (ReverseStereo) - - Implemented an option in the .cfg file to share Player 1 and Player 2 - controls with Player 3 and Player 4's controls. This option allows you to - use 2 devices (Joystick and Keyboard) for both player 1 and player 2, but - this also disables MultiTap support. (Pl34to12Share) - - Added Reverse Stereo to the GUI under config/sound - - Added Player 3, Player 4 to use as Player 1, Player 2 in the - GUI under config/options - - Compiled under a new version of wdosx. Hope this doesn't cause any problems - - -............................................................ -v0.601 - September 9, 1998 -............................................................ - - - Fixed up a sound card deinit bug that sometimes caused ZSNES to - crash in certain sound cards - - Disabled Autoinit mode when a low sampling rate is used in 8bit - sound. Probabily was also causing problems in some cards - - Note : The offset per tile mode in the 16bit oldgfx engine seems to randomly - crash sometimes for an unknown reason. If 16bit mode crashes for you and - 8bit doesn't, press the '0' key in 16bit mode to disable that mode. - - -............................................................ -v0.600 - September 9, 1998 -............................................................ - - *** ADDED A NEW MEMBER TO THE ZSNES TEAM! *** - Welcome Pharos to the team, his role is currently a coding assitant. - So far, he helped us objectize the zsnes source code which greatly - helped in the compile time, provided assembly help, and helped us - prepare on linking C code to zsnes (not completely there yet). - - Note : It is strongly recommended to not use the 16-bit new - graphics engine yet because of bugs and speed concerns. It - is enabled only in 320x240x65536 for those who are interested. - - - Added partial 65816 execution in the DMA registers (doesn't seem to - fix mucht due to some other problem) Thanks to Alucard for this info! - This also slowed down emulation a bit. - - Implemented sprite priority correction into the new graphics engine - - Implemented mosaic into the new graphics engine - - Implemented true 512 horizontal resolution into new graphics engine - (both 16x8 and 16x16 tile modes) - - Implemented interlaced 448 vertical resolution into new graphics engine - - Implemented offset per tile mode into the new graphics engine - (Mode 2/Vertical only). More accurate compared to the old graphics engine. - (seems to be a bug where the game gets very slow sometimes though) - - Started 16-bit new graphics engine - - Implemented sprite priority correction in 16bit new gfx engine - - Implemented palette raster effects in 16bit new gfx engine - - Fixed a minor bg enable/disable bug in the new gfx engine - - Multiple SPC700 bug fixes. More games run now! - - Implemented SPCPlay sound engine into zsnes : - - Echo & FIR Filter Support (Slowed down emulation, but gives - better sound) Thanks to feenix65 for info on FIR Filter! - - Volume fixes - - Rewrote ADSR/GAIN engine - - Added Adjustable Volume through the commandline and zsnes.cfg - - 16000 and 32000 extra sampling rates - - Many other bug fixes - - Fixed a minor HDMA bug - - Fixed an old style joystick read bug that prevented the joypad - from functioning in certain games - - Several optimisations on Echo & FIR Filter - - Several Sound DSP Fixes - - Temporarily fixed a V-latch bug in some games that don't update the - display at every frame - - Add/Removed some game hacks for compatibility - - Modified Song Start Search in .spc capture. Should be much better now. - - Fixed a sprite window clipping bug where it was used when it's not - supposed to be. - - Modified memory allocation technique in zsnes. This should now - eliminate some random crash errors. Thanks to Y0SHi for this info! - - -c now does full screen instead of small screen in 640x480 modes. - For small screen, use -cc - - Fixed a back area 1/2 addition bug which caused the background - to be sometimes darker than usual - - Fixed a mode 7 transparency bug - - Added 8-bit stereo sound and 8-bit sound high speed mode support - (high speed mode support is just the implementation of 8bit 44100khz - or 22050khz stereo) Thanks to Crono for a lot of help on this! - - Fixed up sound blaster deinit code - Thanks again to Crono! - - Wrote an entirely new GUI : - - Mouse driven GUI/Menu Based - - Full Keyboard Support in all the Quick (Arrow Menu), Load, - and Cheat menu items - - Ability to display load names under 8.3 filename format, snes - header name, and win95 long filenames - - Support for Save State, Load State, and Select State through menu items - - Quick Load Menu (Arrow menu) which allows you to quickly load - the last 10 games loaded - - Ability to Freeze or Clear the Quick Load Menu - - An Options menu which allows you to configure settings such - as video mode, sound settings, frame skip, etc. - - Added the ability to customize the game keys such as - the save state key, misc toggles, etc. - - Ability to use those keys as joystick buttons - - Customizeable background palette displacement - - Several minor GUI customization features - - Ability to quickly exit/enter the GUI with the right - mouse button (Disabled by default) - - Ability to Enter Game Genie, Pro Action Replay, or Game - Finger Cheat Codes - - Ability to browse the cheat codes and Toggle or Remove the codes - - Ability to Save/Load Cheat Codes (saves them as .CHT files - in the same directory as the .SRM/.ZST files) - - Ability to Select Input Devices for each joypad - - Ability to Define Keys/Button configuration for each joypad - - Joypad can now move in the GUI (disabled by default) - - Added some future reserve menus (Netplay, Cheat Search Engine) - But they are NOT implemented in zsnes yet. - - Fixed a bug when clearing the screen in 640x480x65536 - - Implemented full add, half add, full subtract, and - half subtract into the new 16bit graphics engine - Not sure why, but some transparency modes are actually slower - than the old engine. Most likely flushing the cache a lot somewhere. - - Implemented background transparencies into new 16bit graphics engine - (implemented incorrectly at the moment. Some transparency modes also is - slower than the old graphics engine, but that will change in the future) - - Implemented fixed color transparencies (very incorrect because of - lack of windowing) - - Fixed a minor bug in the fast forward routines - - Rewrote most of the 65816 speed hack. It should now be a lot more - friendly with games (reduced graphic glitches/increased compatibility). - - Fixed a bug in Mode7 with Windowing and Transparency enabled - - Allowed 16bit HDMA sound blaster values less than 5 to be used. - Not exactly sure if this works though. - - Implemented Mouse Disable Command Line (-j) - - Rewrote Input Device Routines (Keyboard, Joystick, SNES Mouse, - and Super Scope Handlers) - - Added GamePad Pro Support (Don't know if it works on a standard - GrIP system though). Thanks to Marius Fodor for the code! - - Added Snes Parallel Port Support for both LPT1 and LPT2. - Thanks to Karl for the code! - - Added MultiTap (Multiplayer 5) Support! (Only up to 4 players - at the moment though) - - Joystick Port 209h support - - Fixed an overflow caching bug in the new gfx engine where a few games - run very slow - - Added some C -> ASM converted DSP1 functions. Some functions - were unable to convert properly so no DSP1 games are playable - until the actual C code is in - - Executable is now compressed using epack - - Implemented sprite transparency into the 16-bit new graphics engine - - Implemented mode7 transparency into the 16-bit new graphics engine - - Higher memory requirements (Sorry, but this is unavoidable as long - as ZSNES keeps expanding) - - Implemented Echo Disable in the zsnes.cfg for those who want some - extra speed in return for lost sound quality - - A bunch of other fixes that we forgot to list - - -............................................................ -v0.400 - May 19, 1998 -............................................................ - - - Fixed a dual windowing bug in mode 7 in 65536 color mode - - Re-added FPU Copy due to a demand - - Implemented MMX Copy. Use -om to enable. Thanks to Angels Holocaust - for this info! - - Fixed a bug when writing to .bmp files - - Added (buggy) SuperFX support (9.5MB memory required) - Special thanks to the snes9x team for all the info and help! - - Fixed up sprite windowing. Should hopefully be correct now - - Added a commandline to show all file extensions through the GUI - Use -sa to enable - - Added Noise to the Sound DSP - - Added a Fast Forward key. Use the Tilde Key (~) located at the - top-left of your keyboard. - - Added Sprite Priority Correction - - Fixed a tile caching bug that caused some tile corruption - - Fixed a 65816 bug in XCE on the x flag. Thanks to ]SiMKiN[ for this! - - Implemented Interleaved format and a simple auto detection. - In case autodetect fails, use -i. Thanks to feenix65 for this info! - - Improved header detection. Should now work better with demos - and games with weird filesizes - - Added a new graphics engine in 256 color mode. It should be much faster - in areas that don't use mode 7, but lacks a lot of features such as - windowing, mosaic, and sprite priorities so it is disabled by default. - It can be enabled by pressing 8 during gameplay. (~40-100% faster) - - Optimised Mode 7 in 256 color mode - - Implemented dual windowing to color window clipping - - Fixed several color window clipping bugs - - Added full resolution screenshot capture in 640x480x65536 mode - To activate while in that mode, hold backspace and press F1 - - Fixed several transparency bugs - - Added NewGfx to zsnes.cfg which determines if the new graphics engine - is enabled at start - - Added CopyMethod to zsnes.cfg which can default the copy method - as either fpu copy or mmx copy - - Allowed systems with 5.5MB of RAM free to load 2mbit roms - - Fixed sidewinder support when sound is set at a high sampling rate. - Thanks to Marius Fodor for the source! - - -............................................................ -v0.393 - April 15, 1998 -............................................................ - - - Whoops! Forgot to remove the debug variables in v0.391 - - Fixed another sprite clipping bug - - Fixed clipping in Mode7 16-bit mode - - Removed FPU Copy since it didn't seem to speed up emulation - - Added .USA and .JAP rom extension into the GUI - - Added Save SPC Data which saves the contents of the SPC700/DSP - of the beginning of the next song (Future Reserved) - - Add Sound Buffer Dump which dumps the decompressed sound buffer as raw pcm. - This can become quite inaccurate due to the way how zsnes stores its - decompressed sounds. - - Added MenuItem Sound Buffer Dump into the F1 Menu - - Added MenuItem Save SPC Data into the F1 Menu - - Added a key to disable offset mode. Press 0 key to activate/deactivate - - Added small screen support in 640x480VESA2 modes. This mode should be much - faster for those who use 640x480. Use the -c commandline to enable this - when in 640x480. - - Added an option for centered small screen. Use the -cc commandline. - - Fixed up 320x240x65536 support for ARGB cards again. - It now should be working. (No, seriously!) - - Removed some static from the sound. - - -............................................................ -v0.391 - April 13, 1998 -............................................................ - - - Fixed a bug in DMA from v0.390 - - Fixed some sprite windowing clipping bugs - - Fixed an OAM overflow bug. Thanks to DJRob for some help on this! - - Fixed a save state bug where running a game off the commandline and having - a save directory specified prevented more than 1 save state - - Fixed a transparency bug from v0.390 - - -............................................................ -v0.390 - April 11, 1998 -............................................................ - - - Fixed a bug which caused 320x240x65536 to display incorrectly - on video cards with an 16-bit ARGB setting - - Fixed a minor screen add/sub bug - - Fixed a minor sprite priority bug - - Fixed a BG3 priority bug in BG Mode 0 - - Fixed a color window addition bug - - Fixed a minor VIRQ enable bug - - Swapped The Cursor Button and Autofire Switch in Super Scope - - Fixed a joystick read timing bug - - Sound volume register returned an invalid value. Now fixed. - - Added some dword alignment to some variables. - Thanks to Marius Fodor for this info! - - Implemented 64k sram files - - Implemented Sprite VRAM address changing in the middle of the screen. - Should fix some games such as Lufia 2 - - Added some hacks to get some games working better - - DSP : Fixed a divide by 0 bug when key on is set without any - sound variables initialized - - Increased default cycles executed in FastROM. - - Added ZSNES.FAQ . Read this if you have troubles! - - Added a key to disable/enable Windowing. Press 9 to activate this. - - Implemented EAGLE algorithm in 640x480x256 video mode. - Use -y to enable. Thanks to A CoolMan for the algorithm! - Later on, we'll implement his code which has MMX acceleration! - - Implemented FPU copy. Use -o to enable. Used only when copying - buffer to video in 320x240 vesa2 modes. - - Re-wrote Windowing routines for speed and expandability - - Added Dual Windowing on BGs in all logic modes - - Added Dual Windowing on Sprites - - Added some minor stuff to the header displayer - - Added partial offset per tile mode. (Mode 2/Vertical/8x8) - Thanks to the feenix65 for some help on this! - Implementation still a bit buggy. - - Sorry, but memory requirements had to increase by a bit. - - Fixed a tile graphics wrapping bug - - Clean up and optimised 16-bit graphics code - - Fixed up a display bug when switching from 239 to 224 y resolution - - Optimised some video processing code. Thanks to Crash_Man for the help! - - Minor optimisations to the 65816 - - Improved color intensity in the back area - - Fixed a sram directory bug where the save state didn't save in the - save directory when the game is specified from the command line - - Fixed a keyboard bug when left-shift is selected as a key. - Thanks to Pharos for help on this! - - Some DMA speedups - - Some optimisations to OAM/VRAM write - - Sorry, but SuperFX emulation is disabled for this public version. - - -............................................................ -v0.305 - February 12, 1998 -............................................................ - - - Fixed a snes ppu multiplication bug. Thanks to Lord Esnes! - - Hopefully fixed 6-button joystick support. - - Fixed a little memory overflow bug which caused some games to not work - - Forgot to clear NMI wait substitute variables when another game - is loaded from the GUI - - Changed sound processing engine back to v0.297. If for any reason - you want to go back to v0.300 sound engine, use -x as a command line - - Added Cursor Mode Button to the Super Scope. Never thought it was - necessary until recently. Use the =/+ key. - - -............................................................ -v0.300b - February 10, 1998 -............................................................ - - - Fixed a bug that causes sidewinder support to crash. - - -............................................................ -v0.300 - February 9, 1998 -............................................................ - - - Fixed a 65816 wrapping bug - - Added Super Scope Emulation! (Press 7 beyond mouse) - - Some minor touches to the GUI - - Manually calculated RGB bit lengths when using 16-bit modes - - Fixed another bug when loading 48mbit images from the GUI - - Sped up the execution loop when sound is enabled - - Implemented NMI wait substitute for speed - - Added some extra vesa2 routines to help some video cards with ARGB format - of 1:5:5:5, however interpolation won't work for those at the moment. - Thanks to Dark Force for helping out on this one! - - Implemented 512x384 VESA2 resolution for both 8 and 16 bit - - Implemented Sound Mute and Reset - - Implemented Joystick Remapping. Edit ZSNES.CFG to access this. - - Fixed and sped up 6 button joystick support - - Fixed 2 2-button joystick support - - Hopefully fixed 2 sidewinder support - - Fixed an overflow sound bug - - -............................................................ -v0.297 - January 31, 1998 -............................................................ - - - Fixed a bug when loading 48mbit images from the GUI - - Fixed some crashing bugs by just adding some zero space - Very weird bug! - - -............................................................ -v0.296 - Not released? -............................................................ - - - Fixed up Cheat Menu in 16-bit color mode - - Changed SPC700 skipper back since it was causing problems in certain games - - Added Multiple Snapshot files - - Fixed a minor loading bug - - Fixed 16-bit color full add/sub conversion table when video is in BGR format - - Fixed some fixed color screen add/sub bugs - - Supported .SWC format in the GUI - - -............................................................ -v0.295 - January 29, 1998 -............................................................ - - - Compiled under a newer version of WDOSX. This should help fix some - VESA 2 problems. - - Fixed multiple SPC700 bugs - - Added a command line to force either NTSC (-t) or PAL (-u) timing - - Added a command line to force 8-bit sound on (-8) - - Zsnes.cfg is now loaded from the directory where zsnes.exe is located - - Zsnes.cfg now re-writes itself when zsnes exits - - Reduced zsnes.exe filesize - - The IRQ's are now more stable. This should help fix some crashing/rebooting - problems under dos. Thanks to Sardu for some help on this! - - Fixed some VRAM accessing bugs - - Several fixes to the sound DSP - - Optimised SPC700 a bit - - Implemented primitive Mode 5, 512 horizontal resolution. To get - full potential of this mode, use 640x480 resolutions except for - interpolated/nonscanline mode. - - Improved 65816 <-> SPC700 communication - - Slightly improved sound skipper - - Fixed a directory changing bug - - Implemented Scanlines for 640x480x256 video mode - - Added a temporary command line to enable sound compression buffering (-Q) - - Added a extra menu which pops out when you press F1 - - Added snapshot feature. Press F1 and select Save Snapshot - ZSNES saves 256 color under image.pcx and 65536 under image.bmp. - - Added FPS feature. At the moment, it only works when - auto frame rate is used. - - 65816 bugfix : x flag is supposed be used in MVN/MVP - - Fixed up color addition/subtraction clipping a bit - - Added Scanlines, Interpolation, Enterskip, and Force 8-bit sound - in zsnes.cfg - - GUI now saves the loading directory - - Added a separate save directory feature in zsnes.cfg. - - SPC700 bugfix : fixed mem.bit addressing mode. - Thanks to Phoenix for this info! - - Fix up a bug where more memory was cleared than needed in 256 color - video memory processing - - Optimised video memory clearing in 65536 color mode - - Minor optimisations to the 65816/SPC700 - - Implemented Mode 7 Tile #0 Repetition - - Rewrote most of the Mode 7 routines for speed - - Fixed a 65536 color Mode 7 bug where the background wasn't cleared properly - - Added Pro Action Replay, Gold Finger,and Game Genie cheat code support - - Optimised Memory/Register accessing routines - - Used a newer version of Sidewinder driver. Should fix some problems - and also support 2 sidewinder pads (not tested yet). Thanks Robert! - Also, thanks to Sardu for helping to get it to work right! - - Whoops! 256 Color palette was set when GUI is exited in 16-bit mode. - Hopefully fixed now. - - Added the ability to Clear/Disable/Enable cheat codes through the menu. - - Optimised Graphics Decompression Routines. - Thanks to Nerlaska for this info! - - A Bunch of other Minor Bugs Fixed. - - -............................................................ -v0.270 - December 25, 1997 -............................................................ - - - Properly cleared memory when loaded off of the GUI - - Implemented realtime adsr/gain switch. Special thanks to Sardu for - help on this! - - Fixed up a VESA 2 error message - - Temporarily disabled Sound Compress buffering till we can get the bugs out. - - Volume fixes to the sound DSP - - Fixed up > 16mbit LoROM support - - Added partial 48mbit ROM support (no games seems to work yet - + 9MB mem required) - - Fixed a SRAM Memory Map Bug - - Fixed a bug in old style joystick read - - Disabled sram save using tilde key. Instead, enter/exit the GUI since - it also saves the sram. - - Added panic key which turns back on all sound channels and backgrounds. - Press 6 to activate this. - - Added snes mouse support! Use 7 to switch between keyboard and mouse. - Thanks to Y0SHi for info on this! - - Panic key now turns off mouse when mouse is enabled - - Fixed a minor IRQ bug - - Fixed a HDMA bug. Thanks to Lord Esnes for help on this! - - Fixed a timing bug. Thanks to TaNdRuM for help on this! - - Fixed up some Fixed color add/sub bugs - - Implemented OBJ Name Base Select. Thanks to Y0SHi for info! - - Windowing was off by 1 pixel. Now fixed. - - Fixed Screen Add/Sub on back area - - Added support for 4 and 6 button joysticks - - Added support for sidewinder joypads - - Fixed a VESA 2.0 bug. It should be more compatible now. - - Implemented Interpolation for 640x480x65536 mode. Use -Y to enable. - - Modified sound mixing code a bit - - Added GUI disable in zsnes.cfg. Add this if you want to disable the GUI - GUIDisable = 1 - - Implemented Directory Changing in the GUI - - Fixed a bug where it crashed when loading some ROMs - - Fixed an ADSR sustain bug. Thanks to Trepalium for help on this! - - -............................................................ -v0.201b - November 5, 1997 -............................................................ - - - Fixed up Save State Selection bug - - -............................................................ -v0.201 - November 5, 1997 -............................................................ - - - Fixed up PAL/NTSC detection when GUI is used - - GUI now doesn't enter load when no files are found. - Thanks to ScanT for reporting this! - - Sped up execution loop a bit - - Fixed up a major save state conversion bug. Old save states - should work better now. - - -............................................................ -v0.200 - November 4, 1997 -............................................................ - - - Reg$2137 was calculating the horizontal position incorrectly - - Fixed up a looping bug in sound DSP. Thanks to EFX for some help on this! - - Added Key to dump SRAM to Harddisk (tilde key, ~) during game - - Fixed up gain sound effects - - Fixed a couple of SPC timer bugs - - Added Stereo Sound! (Use -Z) - - Added some precision to the DSP (this seemed to have slowed emulation down) - - Changed Real Time State Save Format. However, ZSNES will automatically - convert from an older format. Some problems may come up because of the - many changes in the dsp. - - Fixed up a sprite ordering bug. Thanks to Y0SHi! - - Added Scanlines (Use -N) Only available for 256x256/640x480x65536 - - Adjusted SPC timers - - Fixed up BG Mode 0 display - - Fixed up a bug that crashes when hirom sram is accessed - - Fixed up a VIRQ bug - - Added a simple, yet effective dsp timer wait substitute. Seems to make many - games run much faster with sound! - - Fixed VRAM increment bug. Special thanks to Trepalium for this info! - - Fixed up multiple SPC bugs - - Player 2 was still reading the joystick even though keyboard was selected. - This is now fixed. - - Added VSync (-w). Thanks to Marius Fodor for the code! - Please use -f 0 when using this. - - Added a very simple GUI. Currently, it only loads, reset, and quit. - Also, load cannot change the current directory. - - Added -m to disable the GUI - - Added Stereo to zsnes.cfg. Add this if you want to enable stereo : - Stereo = 1 - - -............................................................ -v0.182 - October 23, 1997 -............................................................ - - - Small fix to a priority in bg4 drawing - - Added TCALL and PCALL - Special Thanks to Gary of Snes9X! - - Enabled the debugger (use the -d command line) - - -............................................................ -v0.180 - October 22, 1997 -............................................................ - - - Move the whats new stuff to readme.txt - - Forgot to remove the end of string marker so the new vesa modes didn't show - in the previous version help - - Fixed minor SNES PPU DMA bug - - lowered volume again - - Fixed a vesa 2 bug issue. Nothing major - - Removed PCALL/TCALL. If anyone knows the implementation of these - instructions, please tell us. Also, we will not accept any requests to put - these back on unless the info the found. Thanks. - - Modified SPC700 cycle timing. - - Added code that properly deinits sound blaster auto-init mode - - Moved sound blaster interrupt code a bit - - Added Gamma Correction (use -g # in the command line) - - Added what the default keys are in the readme.txt (We should have done this - in the first release. Oh well =) ) - - Added a new command line that can modify the % of clock cycles executed. - ZSNES currently is modified so that 100% runs as many games as possible so - it is strongly recommended that you do not set this. But to modify this, - use -p # in the command line. - - Hopefully fixed up sprite BG layering priorities and background priorities - to the correct way. Thanks to Y0SHi for this info! - - Fixed up key ordering in zsnes.cfg. Thanks to Michael and Aquis for - reporting this! If zsnes.cfg already exists, change the button order to : - B, Y, A, X, L, R - - Fixed up set blaster detection. - - SPC700 : Fixed up a minor flag setting bug in pop psw - - -............................................................ -v0.170 - October 16, 1997 -............................................................ - - - Fixed crashing bug when 8000Hz sound is selected (divide by 0 problem) - - Forgot to add code to support Sound Blaster irqs greater than 7 - - Changed 65816 timing a bit. (should help compatibility a bit) - - Fixed a bug in 65816 stack routines. - Special Thanks to Alucard for reporting this! - - Somewhat modified sound decompression routines - - Somewhat sped up Mode 7 - - Fixed a minor screen add/sub bug in non-repeating mode 7 - - Added increment by 8 vram access registers - - Video Modes should now clear the screen when init - - ZSNES now automatically creates a default .cfg file when one is missing - - Forgot to implement save/load state messages in 16-bit. It's there now. - - Added a new command line : -b. This disables sound compression buffering. - There is a noticeable slowdown, but this should reduce static. - - Added sound compression buffering disable in the .cfg file - If you have an old .cfg file already, manually add this string at - the end if you want to disable sound buffering : SoundBufDisable = 1 - - Added 640x480 modes for both 8 and 16 bit. VESA2 is still required and - these modes are much slower too. This seems to still not work on various - video cards. There's probabily a bug in VESA2 detection. - - Fixed a sprite layering bug. - - Reduced sound volume to prevent overflows. This seems to make the sound - better, but the pitch calculations are still incorrect due to SPC bugs. - - Fixed a screen sub bug. Thanks to Barubary! - - -............................................................ -v0.150 - Initial Release - October 14, 1997 -............................................................ - - The following are implemented : - - complete 65816 instruction set (bugs still left) - - SRAM support - - LoROM and HiROM support - - SlowROM and FastROM support - - Line by line graphics engine - - Graphic Modes 0,1,2,3,4,5,6,7 - - 8x8, 16x16, 32x32 and 64x64 sprite support (flipped in all directions) - - Mosaic effects - - 8x8 and 16x16 tiles - - 32x32,64x32,32x64,64x64 tile modes - - Full DMA support - - Full HDMA effects for wavy backgrounds, interesting mode 7 effects, etc. - - Mode 7 rotating and scaling effects - - Single Windowing Routines - - BG priorities (still needs some work) - - Sprite Priorities (still needs some work) - - Add/sub of back area - - HIRQ/VIRQ/NMI Interrupts - - Support for most snes file formats - - Multi file format support (.1,.2,.3,A.,B.,C.) - - 16-bit graphics support - - PAL timing support - - The following are present in sound : - - - 16bit digital sound - - SPC700 Sound CPU (bugs still left) - - DSP Sound Processor - - ADSR volume effects - - GAIN volume effects - - Following are present in 16-bit graphics mode : - - - Palette changing in the middle of a screen - - Screen Addition (full and half) - - Screen Subtraction (full) - - Fixed Color Addition/Subtraction - - Window clipping for Fixed Color (still needs work) - - The following are the features present in ZSNES : - - - Game State Save (F2=Save, F3=Select, F4=Load). - Warning : A state file takes 200 kbytes of HD space! - - Auto frame rate to give you constant Super Nintendo speed up to 12 - frame skips - - configuration file support (zsnes.cfg) - - 2 player support w/ Joystick and Gamepad support - - The following features are missing : - - - DSP features such as noise, echo, and pitch modulation - - Mode 7 horizontal flip and color repetition - - Screen Subtraction (half) - - Interleaved ROM formats - - A few VRAM accessing modes - - Dual Windowing support (not sure if it's worth implementing this) - - The following will probabily never be implemented (but who knows...) : - - - 512 snes horizontal resolution - - 448/480 snes vertical Interlaced resolution - - Raster Effects (Scrolling location change in the middle of a - horizontal line. There might be a way to get through some of this) - - EXTBG mode for mode 7 (I don't know any games that uses this) - - What will not run : - ------------------- - - Super FX games such as Star Fox, Yoshi's Island, etc. - - DSP games such as Mario Kart, Pilotwings, etc. - - Games with other special chips such as Megaman X2 and X3 - - Games that have a unique sound checking routine (if sound is disabled) - - Games which doesn't have a valid header (use -L or -H to get it working) - - Games that hit a severe bug in the 65816/PPU/SPC700/DSP routines - - Games that require special timing - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/readme.txt/index.txt b/tools/zsnes/docs/readme.txt/index.txt deleted file mode 100644 index 4f63c0e..0000000 --- a/tools/zsnes/docs/readme.txt/index.txt +++ /dev/null @@ -1,122 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - - * GUI [GUI.txt] - - * Netplay [Netplay.txt] - - * Advanced Usage [Advanced.txt] - - * Games [Games.txt] - - * FAQ [FAQ.txt] - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - - * History [History.txt] - - * About [About.txt] - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ I n d e x -================================================================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - 1. Disclaimer - 2. Current Progress - 3. Extra Features - 4. System Requirements - 5. Installation - 6. Basic Usage - 7. Default Keys - 8. Save States - 9. Movies - 10. IPS Patching - 11. Cheat Codes - 12. Files - - * GUI [GUI.txt] - 1. Game Menu - 2. Quick Menu - 3. Config Menu - 4. Cheat Menu - 5. Netplay Menu - 6. Misc Menu - 7. F1 Menu - 8. Save Slot Chooser - - * Netplay [Netplay.txt] - 1. Things To Know - 2. Recommendations - 3. Simple Instructions - 4. Loading a Game - 5. Configuring - 6. Troubleshooting - 7. Links and Utilities - - * Advanced Usage [Advanced.txt] - 1. Movie Dumping - 2. Configuration Files - 3. Debugger - 4. KitchenSync - 5. Command-Line - - * Games [Games.txt] - 1. ROMs - 2. Compatibility - 3. Special-Chip Games - 4. Special Cartridges - - BS-X (Satellaview) - - Super Gameboy - 5. Individual Game Issues - 6. Games Supported by ManyMouse - 7. Multiplayer List - - * FAQ [FAQ.txt] - 1. Universal - 2. Win Port - 3. SDL Port - 4. DOS Port - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - 1. APIs and Utilities - 2. Contact Information - 3. Known Issues - 4. Filing a Bug Report - - * History [History.txt] - - * About [About.txt] - 1. ZSNES - 2. Documentation - 3. Credits - - * License [License.txt] - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/readme.txt/license.txt b/tools/zsnes/docs/readme.txt/license.txt deleted file mode 100644 index 298a937..0000000 --- a/tools/zsnes/docs/readme.txt/license.txt +++ /dev/null @@ -1,341 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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. - - - Copyright (C) - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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. - - , 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 Lesser General -Public License instead of this License. - diff --git a/tools/zsnes/docs/readme.txt/netplay.txt b/tools/zsnes/docs/readme.txt/netplay.txt deleted file mode 100644 index 4d6e43f..0000000 --- a/tools/zsnes/docs/readme.txt/netplay.txt +++ /dev/null @@ -1,230 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - - * GUI [GUI.txt] - - * Netplay [Netplay.txt] - 1. Things To Know - 2. Recommendations - 3. Simple Instructions - 4. Loading a Game - 5. Configuring - 6. Troubleshooting - 7. Links and Utilities - - * Advanced Usage [Advanced.txt] - - * Games [Games.txt] - - * FAQ [FAQ.txt] - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - - * History [History.txt] - - * About [About.txt] - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ N e t p l a y -================================================================================ - -Netplay has been disabled for the indefinite future, until the core becomes more -accurate and/or non-random. We recommend using ZSNES v1.36 or v1.42n -[http://nsrt.edgeemu.com/forum/viewtopic.php?t=448] until this is resolved. - -The Netplay dialog is only accessible if a game is loaded. - - -............................................................ - 1. Things To Know -............................................................ - - - ZSNES currently limits Netplay to two computers. Up to five players can - still play, however (by having more than one player at either of the two - computers). - - A game must be on each computer in order to have it available for Netplay. - - You cannot use cheat codes, key combinations, or turbo keys in Netplay. - - -............................................................ - 2. System Recommendations for Smooth Netplay -............................................................ - - - Both users must use the *same version* of ZSNES (e.g. Both users should be - using v1.36). - - Both users should be using reasonably fast computers (about 800mhz). If - one user has a slow computer (e.g. 200mhz) while the other has a fast one, - the slow computer's low framerate will bog down the fast computer, causing - poor framerates on the fast computer. - - Both users should be using the same setting for sound (either enabled or - disabled; see the Config-->Sound menu in the GUI or the ZSNES - configuration file). - - Back Buffer must be enabled and the latency value must be 3 or 2 (reduce - it to 2 for fast-paced platform games). - - The games have to run at least 50 FPS on BOTH computers without Netplay. - This can completely depend on factors such as CPU, video card, video mode, - and the game you are running. (See System Requirements [Readme.txt]). - - Both users must use the same protocol setting (either UDP or TCP). If both - players are on the same LAN, you should use UDP (it has lower overhead). - Otherwise, use TCP (no packet loss). - - You will also need an Internet connection with ping times of less than - 400ms between both connections. The higher than ping time, the worse the - Netplay experience, since ping times measure the time it takes for data to - get to the other side and back. You can expect a not-so-great performance - if you have a ping time of 400 or greater. - - -............................................................ - 3. Simple Instructions -............................................................ - - 1. Go to Netplay -> Internet. - 2. Decide who will be the server and who will be the client. - (Neither has the gameplay advantage since ZSNES treats both the same - after a connection is established). - 3. If you are the server, send the IP that is shown on the connection window - to your friend (e.g. through any chat program (ICQ, AIM, IRC, etc.)). - Then click on 'Start Server'. - 4. If you are the client, type in the IP address that your friend has given - you and then click on 'Connect to Server'. - 5. Chat with your friend on what game to play. - 6. Once decided, make sure that the filename on both sides are the same and - that the load window points to the directory where the filename is. - 7. Load the game. - 8. Have fun! (If it worked) - 9. If it said 'Checksum Mismatch', try uncompressing the file if it is - compressed. If not, then both sides have a different version of that ROM - (e.g. One side has the Japanese version while the other has the English, - or both versions are English, but are different version releases of the - same game). - 10. If you want to chat in-game, press 'T' and type in your line. You can - change this key in the Misc -> Misc Keys options from the GUI. - - -............................................................ - 4. Loading a Game -............................................................ - -Once successfully connected, the chat window should open up. - -From there, you can load a game as you normally would. But in order to load a -game, both sides must have their load window pointing to the directory where -the game is located and also have identical filenames for the game. Only one -side has to load the game; after that, the other side will automatically load -the game without the user's interaction. - -If an error pops up saying 'ROM data mismatch', then it means that either side -has a different version of the ROM. This sometimes happens with compressed files -even when both files are the same, so it is recommended that you uncompress the -games and try again if this error occurs. - - -............................................................ - 5. Configuring Options -............................................................ - -The default settings are recommended. - -However, if your computer is slower than 266 MHz, then it is recommended that -both sides play with back buffer disabled. Note that disabling this will degrade -controller response. - -You can increase the latency value if the average ping time between both -connections is high (you can tell if the gameplay runs too jerky). - -Reducing the latency value when back buffer is enabled will improve controller -response time. However, this will cause the remote player to jump around more -in order to keep both sides in sync. - -For controller options (PL1, PL2, PL3,..), the first checkmarked player would be -using Input #1 of the local side. The second checkmarked player would be using -Input #2 and so on. Players marked with an 'X' are checkmarked on the remote -side. - - -............................................................ - 6. Troubleshooting -............................................................ - - - If you are the client, and it failed to connect, check to make sure that - the IP you entered is correct and that you are properly connected to the - Internet. - - If you are the server, and the IP provided in the connection window - doesn't seem to be the correct one, you can visit - [http://www.whatismyipaddress.com] to determine the correct one. Then tell - your client what it is so he or she can connect. Alternatively, if you're - using mIRC, just type /dns . - - If the client says 'Found Client' and nothing else happens, chances are - that your net connection does not support UDP. If this is the case, both - sides will need to deselect 'Use UDP Instead of TCP'. However, it is - strongly recommended that you use UDP if possible since it is much faster - than TCP. - - If you have Windows 95 and you are getting a init failed error, you should - download and install the Winsock 2.0 update for Windows 95: - [http://www.microsoft.com/Windows95/downloads/contents/WUAdminTools - /S_WUNetworkingTools/W95Sockets2/Default.asp]. - Warning: Do not install this if you do not have Windows 95. - - You may need to disable your firewall (or just disable it for UDP port - 7845) in order to get the UDP protocol that ZSNES's Netplay uses to work. - - Internet Connection Sharing users (Win9x systems) may need to download an - ICS Configuration utility to get the connection to work and map UDP port - 7845. You can use "ICS Configuration", found here: - [http://www.practicallynetworked.com/sharing/ics/icsconfiguration.htm]. - - If you need help forwarding your router port, you may refer to AntoineWG's - Router Port Forwarding Guide. You should be able to find this guide at the - ZSNES board [http://board.zsnes.com]. - - Tips for reducing general slowdown can be found under "Why is ZSNES slow?" - in the Speed section of the FAQ page [FAQ.txt]. - - -............................................................ - 7. Links and Utilities -............................................................ - -The following websites provide a way to find and connect to other players in -order to use Netplay. Some of the sites provide a program, while one provides an -IRC script. - -Please note that these websites are in no way officially affiliated with ZSNES. -We make no warranty as to their usefulness or safety. If you have problems with -these utilities, please seek help from their respective web sites, NOT from the -ZSNES web site. - -ZSNES Online [http://www.zsnesonline.com] - This is an excellent program with - several features, including a centralized chat server, that allows you to - setup a Netplay session easily. - -zbattle.net [http://www.zbattle.net] - A service that allows ZSNES users to - easily find others who want to take advantage of the emulator's built-in - Netplay support. zbattle.net currently runs on Windows 9x/ME/NT/2k/XP and - Linux. - -Z-Net [http://www.z-net.tk] - This is an active IRC channel with a custom script - for ZSNES Netplay. - -zConnector [http://420666.net/z/] - A utility with a nice GUI that allows you to - find players and play SNES games using ZSNES Netplay. - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/readme.txt/readme.txt b/tools/zsnes/docs/readme.txt/readme.txt deleted file mode 100644 index 36d489e..0000000 --- a/tools/zsnes/docs/readme.txt/readme.txt +++ /dev/null @@ -1,976 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - 1. Disclaimer - 2. Current Progress - 3. Extra Features - 4. System Requirements - 5. Installation - 6. Basic Usage - 7. Default Keys - 8. Save States - 9. Movies - 10. IPS Patching - 11. Cheat Codes - 12. Files - - * GUI [GUI.txt] - - * Netplay [Netplay.txt] - - * Advanced Usage [Advanced.txt] - - * Games [Games.txt] - - * FAQ [FAQ.txt] - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - - * History [History.txt] - - * About [About.txt] - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ R e a d m e -================================================================================ - -ZSNES is an open-source Super Nintendo Entertainment System emulator written in -x86 assembly, C, and C++. Bleeding with cutting edge SNES emulation, ZSNES is -easily comparable to other leading SNES emulators, such as Snes9x -[http://www.snes9x.com], SNEeSe [http://sneese.sourceforge.net], Super Sleuth -[http://users.tpg.com.au/advlink/spx/], and bsnes [http://byuu.org]. - -Special thanks to the Snes9x team for all of their help and also for the -excellent SNES emulator they have developed. We wish them the very best of luck! - - -............................................................ - 1. Disclaimer -............................................................ - -The ZSNES Development Team, including all developers and contributors, is in no -way responsible for any damage caused by the use of this software. Please read -the license [License.txt] for more details. - -Due to legal issues, the ZSNES Development Team can provide you neither with -ROMs nor links to them. In addition, ZSNES may not be distributed with ROM -images. However, as with many cases like this, Google [http://www.google.com] -is your friend. - -There are still many bugs left in ZSNES, so don't expect it to run all your -favorite games. If ZSNES doesn't work for you, then don't use it. Use Snes9x, -SNEeSe, Super Sleuth, or bsnes instead! In fact, even if you use ZSNES, use -those emulators too! - - -............................................................ - 2. Current Progress -............................................................ - - - - - - - - - - - - - - - - - - - - The following are implemented: - - - - - - - - - - - - - - - - - - - - Complete 65816 instruction set - - SRAM support - - LoROM and HiROM support - - SlowROM and FastROM support - - Full DMA support - - HIRQ/VIRQ/NMI Interrupts - - Support for several SNES file formats (SMC, SFC, SWC, FIG, MGD, MGH, UFO, - BIN, GD3, GD7, DX2, USA, EUR, JAP, AUS, ST, BS, 048, 058, 078,), including - split files (1, 2, 3; A, B, C) - - Interleaved format support (except SuperFX games) - - PAL/NTSC timing support - - - - - - - - - - - - - - - - Graphics engines (PPUs) - - - - - - - - - - - - - - - - The following are implemented in both graphics engines, all color modes: - - Graphic modes 0,1,2,3,4,5,6,7 - - 8x8, 16x16, 32x32, and 64x64 sprite support (flipped in all directions) - - 8x8 and 16x16 tiles - - 32x32,64x32,32x64,64x64 tile modes - - Full HDMA effects for wavy backgrounds, interesting mode 7 effects, etc. - - Mode 7 rotating and scaling effects - - BG priorities - - Sprite priorities - - Add/sub of back area - - Mosaic effects - - About the old graphics engine: - - Line engine - - Missing lots of windowing and DMA effects - - More accurate at drawing some things - - 13-bit color rendering. (This is a compromise between color accuracy and - speed. Not all transparencies will work correctly with this engine.) - - What's available in the old graphics engine when using an 8-bit color video - mode: - - Offset per tile mode (mode 2/vertical only) - - High-res 512 horizontal resolution (missing in 16x16) - - Single and dual windowing routines - - What's available in the old graphics engine when using a 16-bit color video - mode: - - Palette changing in the middle of a screen - - Screen addition (full and half) - - Screen subtraction (full) - - Fixed color addition/subtraction - - Window clipping for fixed color - - About the new graphics engine: - - Tile engine - - Nearly complete engine with a few bugs - - Can draw mostly everything on the SNES - - 15-bit coloring - - What's available in the new graphics engine when using an 8-bit color video - mode: - - Offset per tile mode (mode 2/vertical only, mode 4) - - High res 512 resolution and 448/478 vertical resolution - - Windowing effects - - High resolution mode 7 (only in 640x480x256 video mode; active when all - other video filters are disabled) - - What's available in the new graphics engine when using a 16-bit color video - mode: - - All of old graphics engine 16-bit - - High resolution mode 7 - - High resolution 16x16 tiles for mode 5 - - Full 15-bit color transparencies for improved picture quality (MMX - compatible CPUs only) - - - - - - - - - - - - - - - - - - - - - - The following are present in sound: - - - - - - - - - - - - - - - - - - - - - - 16-bit digital stereo sound - - SPC700 Sound CPU - - DSP Sound Processor - - Echo effects - - FIR filter - - ADSR volume effects - - GAIN volume effects - - Noise effects - - Pitch modulation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The following special input devices are emulated: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MultiTap (5-player support) - - Super NES Mouse (missing some features, such as speed settings) - - Super NES Super Scope - - Konami Lethal Enforcer Gun - - Automatic configuration via NSRT headers - (See APIs and Utilities section [Readme.txt]) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The following special cartridge processors are emulated, in whole or in part: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | Special Chip | Progress | - ----------------|----------- - C4 | 100% - Nintendo DSP-1 | 100% - Nintendo DSP-2 | 100% - Nintendo DSP-3 | 80% - Nintendo DSP-4 | 95% - OBC-1 | 100% - SA-1 | 90% - S-DD1 | 100% - Seta DSP 10 | 99% - Seta DSP 11 | 80% - SPC7110 | 100% except decompression - S-RTC | 95% - SuperFX | 90% - - - - - - - - - - - - - - - - - - - - - - - - - - The following add-on devices are emulated: - - - - - - - - - - - - - - - - - - - - - - - - - | Special Cartridge / Add-On | Progress | - ------------------------------|----------- - Broadcast Satellaview (BS-X) | 50% - Nintendo Super System | 100% except the menus - Same Game, SD Gundam G-Next | 100% - Sufami Turbo | 95% - - - - - - - - - - - - - - - - - - - - - - The following features are missing: - - - - - - - - - - - - - - - - - - - - - - Pseudo 512 SNES horizontal resolution (no games are known to use this) - - Some modes in offset per tile mode - - Some direct color modes (no games are known to use this) - - Seta RISC chip - - True SPC7110 decompression - - Super GameBoy emulation - - - - - - - - - - - - - - - - - - - - - - - - - What will not run (or not play properly): - - - - - - - - - - - - - - - - - - - - - - - - Please read our statement on game compatibility [Games.txt]. - - - Some SuperFX games (regardless of interleave status) - - Interleaved SuperFX games (deinterleave them with NSRT - [http://nsrt.edgeemu.com]) - - Some Broadcast Satellaview (BS-X) games - - Games with unknown co-processors - - Games that don't have a valid header - - Games that hit a severe bug in the 65816/PPU/SPC700/DSP routines - - Games that require special timing - - -............................................................ - 3. Extra Features -............................................................ - - - Support for save states, including rewinding - - Extensive movie recording and dumping features - - Many emulation speed options, including automatic frame skipping to - compensate for slower machines - - Full cheat code support (including Game Genie, Pro Action Replay, and - GoldFinger) - - Automatic IPS soft-patching (including up to 11 sequential patches) - - - Custom-built GUI with many time-saving features - - Support for loading Zip, gZip, and JMA-compressed ROMs - - Randomized ROM loading - - Support for input from keyboards, joysticks, and gamepads, - as well as a key combination editor - - Many video output options, including graphics-enhancing filters - - Highly configurable sound output options - - - Netplay (currently disabled) - - - User-editable configuration files - - Debugger - - Accepts command-line arguments - - -............................................................ - 4. System Requirements -............................................................ - - - - - - - - - - - - - - - - - - Supported operating systems - - - - - - - - - - - - - - - - - - Official Ports - - Win port: Microsoft Windows 95/98/ME/2000/XP/2003/Vista - - SDL port: Linux, BSD, Mac OS X, or Xbox running Linux - - DOS port: Microsoft DOS (may work on other non-MS DOSes) - - Un-Official Ports - - ZsnexBox: Microsoft Xbox (native) - - ZSNES Board thread about the Xbox port: - [http://board.zsnes.com/phpBB2/viewtopic.php?t=6933] - - - - - - - - - - - - - CPU requirements - - - - - - - - - - - - - ZSNES absolutely requires a 100% x86-compatible processor. You probably - already meet this requirement. Most consumer-grade processors sold by Intel - and AMD use the x86 instruction set. - - Because much of ZSNES' source code is written in x86 assembly, it will only - run on processors that are 100% x86 compatible. "Ports" to other architectures - are impossible; we recommend Snes9x [http://www.snes9x.com] as the SNES - emulator of choice for portability. - - Playing a special chip game will significantly increase CPU usage. For these - games, you may require a processor faster than those listed below. - - - - - - - - - - - - - - - - Free space requirements - - - - - - - - - - - - - - - - The program files alone require about 1MB. The amount of disk space required - for other files varies greatly. For example, uncompressed ROMs (not included!) - require 256KB-6144KB each. Save states typically require about 270KB each; - however, this can increase up to an additional 200KB for special chip games. - - - - - - - - - Win Port - - - - - - - - - OS: Windows 95/98/ME - - CPU: Pentium II (or equivalent) 233MHz (500MHz recommended) - - RAM: 32MB (64MB recommended) - OS: Windows 2000/XP/2003/Vista - - CPU: Pentium II (or equivalent) 266MHz (500MHz recommended) - - RAM: 64MB of RAM (128MB recommended) - API: DirectX v8.0a or later must be installed - Video: any video card that supports DirectDraw (acceleration recommended) - Sound: any sound card that supports DirectSound (acceleration recommended) - - System Requirements for Microsoft Windows Operating Systems: - [http://support.microsoft.com/kb/304297/] - - System Requirements for Windows XP Operating Systems: - [http://support.microsoft.com/kb/314865/] - - - - - - - - - SDL Port - - - - - - - - - OS: Linux, BSD, or Mac OS X - CPU: 266MHz (500MHz recommended, especially if using X) - RAM: 32MB (64MB recommended; more if SDL is compiled to use X) - API: SDL v1.20 or later - Video: almost any video card will work (hardware OpenGL support and - acceleration highly recommended) - Sound: any sound card supported by SDL (using ALSA or OSS) - - - - - - - - - DOS Port - - - - - - - - - OS: Microsoft DOS (some non-MS DOSes may work) - CPU: Pentium II (or equivalent) 233MHz - RAM: 32MB (minimum of 17MB free, required for loading 48mbit ROMs) - Video: VGA card - - For 16-bit color and therefore proper support of transparencies, an SVGA - card with VESA 2 and Linear Frame Buffer support is required. - - You may be able to use Scitech Display Doctor to enable VESA 2 support on - some cards that don't already support it. - Sound: Sound Blaster Pro or 100% compatible (SB16 or 100% compatible - recommended) - - These system requirements assume you are running the DOS port under pure DOS. - If you are using the DOS port from within Windows, the CPU and RAM - requirements will be the same as for the Win port. - - -............................................................ - 5. Installation -............................................................ - -- - - - - - - - - - - Win / DOS Ports -- - - - - - - - - - - -Installation: - - 1. Download the latest version of ZSNES from [ZSNES.com]. - The file you download is an archive containing the ZSNES binary file and - documentation. - 2. Extract the contents of the archive into a new folder on your hard drive. - Do not simply overwrite an older version of ZSNES. - 3. You can now run ZSNES by executing the ZSNES binary, named zsnesw.exe - (Windows) or zsnes.exe (DOS). ZSNES is not packaged with an installer, so - there will be no entry in the Windows Start Menu. - -Note: In Windows, you can create a shortcut to ZSNES to make it easier to open - the program. Right-click on the zsnesw.exe icon to bring up the context menu, - and left-click "Create Shortcut". A shortcut to the executable file will - appear in the folder. You can now move the newly-created shortcut to your - Desktop or Start Menu. Opening the shortcut will run ZSNES from its original - location. - - -Re-Installation / Reset to default settings: - -If you find that you are experiencing a number of unexplained errors in ZSNES, -or if you wish to reset all settings back to their defaults, simply delete the -configuration files that were generated by ZSNES the first time you ran the -program. See the Configuration Files section [Advanced.txt] for details. - - -Un-Installation: - -If you wish to uninstall ZSNES, simply delete the entire folder (and thus, all -files contained within) into which you installed ZSNES (as described in Step 2 -of Installation, above). - --or- - -If you have since put additional files (such as ROMs) into your ZSNES install -folder, and do not wish to delete or move them, you will have to delete the -individual ZSNES files. Please refer to the Files section [Readme.txt] for -information on individual files and file types related to ZSNES. You will also -need to delete the docs folder. - -Note: ZSNES does not use the Windows registry*, nor does it generate "hidden" - configuration files all over your system. - *Description of the Windows registry: [http://support.microsoft.com/kb/256986] - - -- - - - - - - - - - - - - - - - - - - SDL Port / Compiling from source -- - - - - - - - - - - - - - - - - - - - * Download the latest source release of ZSNES from [ZSNES.com]. - * After unpacking, navigate to the src directory and run the following - commands: - ./configure --enable-release - make - And as root: - make install - * Other, more detailed instructions are provided in the docs/install.txt - file. - - -Un-Installation: - -If you wish to uninstall ZSNES, you can run "make uninstall" as root if you -still have your Makefile. - -Otherwise, you will need to navigate to /usr/local/bin and delete zsnes. Then -navigate to /usr/local/man/man1 and delete zsnes.1. Or just delete the man1 -directory if you have nothing else in it. - -You will need root access to perform the above actions. - -You will also need to delete "~/.zsnes" or "~/Library/Application Support/ZSNES" -in Mac OS X. Do note that various files are saved in here by default (such as -game saves); be sure to back them up if you want to keep them. - - -............................................................ - 6. Basic Usage -............................................................ - - 1. Install ZSNES (see above). - 2. Run ZSNES. - * If you're using Windows, double-click on the executable file. - * If you're using DOS, navigate to the ZSNES installation folder and type - zsnes.exe at the command line. - 3. Configure the input settings (Config Menu -> Input) as desired, or use the - default settings. - 4. Configure the video settings (Config Menu -> Video) as desired, or use the - default settings. - 5. Configure path settings (Config Menu -> Paths) if you don't want all the - automatically generated files going into the same directories as your ROMs. - 6. Load a game (Game Menu -> Load) and start playing. - 7. When you are ready to stop playing, you have a number of choices to save - your game. - * If your game has its own native save function, just use it. - * If your game does not have a save function, or you are at a point in - the game where you can't save, you can create a save state. Do this by - pressing F2. - 8. After you save your game: - * You can load a new game using the same steps as above, or - * Exit the emulator by going to Game Menu -> Quit. - 9. When you are ready to return to a previously saved game, just re-load that - game. - * Load an in-game save in the normal way. - * If you saved a state, you can load that state by pressing F4. - -This section only covers very basic usage. Please read the entire documentation -for more information. - - -............................................................ - 7. Default Keys -............................................................ - -- - - - - - - - - - - - - - - - - . . . . Game . . Keys . . . . -- - - - - - - - - - - - - - - - - -You can change the default keys for the standard SNES controller under -Config->Input [GUI.txt]. - -|SNES Button| |Player 1 Key| |Player 2 Key| -- - - - - - - - - - - - - - - - - - - - - - - - - - D-Pad Up Arrow Up J - D-Pad Down Arrow Down M - D-Pad Left Arrow Left N - D-Pad Right Arrow Right , - Start Return/Enter Left Ctrl - Select Right Shift Left Alt - A X Home - B Z End - X S Insert - Y A Delete - L (Left Shoulder) D Page Up - R (Right Shoulder) C Page Down - - -You can change the default keys for special input devices under -Config->Devices. [GUI.txt]. - -The special input devices just use input from your mouse for movement and -aiming. - -|Super Scope Button | Computer/Mouse Button| -- - - - - - - - - - -|- - - - - - - - - - - - - Fire | Left mouse button - Cursor Mode Button | Right mouse button - Toggle Auto-fire | = - Pause | Backspace - - -- - - - - - - - - - - - - - - - - - . . . Emulator . . Keys . . . . -- - - - - - - - - - - - - - - - - - -[Where to Customize] -|Key| |Function| -= = = = = = = = = = -[Cannot be changed] - Esc When a game is loaded, toggle the GUI - (pauses emulation while GUI visible). - F1 Open the F1 Quick Menu. -- - - - - - - - - - -[Config->Saves] - F2 Save a state to current slot. - F3 Open the save state slot chooser. - F4 Load a save state from the current slot. -- - - - - - - - - - -[Misc->Misc Keys] - F5 <--> F12 Toggle sound channels 1 through 8, respectively - 1, 2, 3, 4 Toggle background layers 1, 2, 3, and 4, respectively - 5 Toggle sprite/object layer - 6 Panic Key: Reset all switches to default (enable Offset Mode, - Windowing, all background layers, sprite/object layer, and sound - channels; disable Add-on Devices; reset Emulation Speed Throttle) - 8 Toggle New Graphics Engine - 9 Toggle Windowing - 0 Toggle Offset Mode - T While using Netplay, press to open the Chat window -- - - - - - - - - - -[Config->Speed] - ~ Fast Forward - P Pause Emulation - -Note: Besides these default keys, there are many other keys that you can - configure in the GUI. - - -............................................................ - 8. Save States -............................................................ - -** Warning: If you care about your progress in a game, remember to use - in-game saves regularly! Do not rely solely on save states! ** - -When you "save a state," ZSNES creates a file that contains the values of all -the variables that change while ZSNES is emulating a game. These values are -specific to the exact moment that you saved the state. You can then load a save -state at a later time, thus returning ZSNES to the exact point in the game when -you saved the state originally. This allows you to save your progress at a point -that might not normally be possible with in-game saves, or in games that don't -have in-game saves at all. - -Save states are typically not compatible between emulators, and sometimes not -even between different versions of the same emulator, often due to internal core -changes. In fact, it should be noted that save states created prior to v0.600 of -ZSNES will not work in current versions. - -To remedy this problem, first load the state in any version of ZSNES from v0.600 -to v1.42. Then, immediately after loading, save another state. The new state you -just created should (hopefully) load correctly in ZSNES v1.50 and higher. - -Since ZSNES does not support save states created by any other SNES emulator, -you can instead use the emulator-independent SRAM (.srm) data to transfer game -progress from one emulator to another. - -Each ZSNES save state is approximately 270KB in size. Special chip games may -require an additional 200KB, however. - -- - - - - - - - - - - - - - How to Use Save States -- - - - - - - - - - - - - - -You can create and load save states using the GUI [GUI.txt]. - -It's much easier to just use the default quick keys for these features. Press F2 -to save, F4 to load, and F3 to open the save state slot chooser (with graphical -preview). However, if you don't like that method, many other save and load -techniques are available. - -Configure general save behavior under Config->Saves. Configure save paths under -Config->Paths. - - -............................................................ - 9. Movies -............................................................ - -Warning: Playing back a previously recorded movie will overwrite any SRAM data - for the current game with the SRAM data contained in the ZMV file. This means - you should enable Do Not Save SRAM [GUI.txt] when playing around with movies!! - -Note that these new features will not work with movies recorded in the old ZMV -format (movies made prior to ZSNES v1.50). - -For descriptions of the Movie Options dialog, please refer to the GUI page -[GUI.txt]. - -- - - - - - - - - About Movies -- - - - - - - - - -The ZSNES movie format (ZMV) has been completely rewritten and is now better and -more feature-rich than before, with the most capabilities yet implemented in an -emulator. Three of the most notable new features are re-recording, dumping ZMVs -to AVI, and movie subtitles, described below. - -A movie file consists of a save state, SRAM data (when applicable), and the -recorded controller data, as well as any chapters (states) that have been -inserted. It also keeps track of a few other things which are negligible with -regard to the overall filesize. Movie files should record at less than -1KB/minute (60KB/hour). - -ZSNES should be able to record most actions you can do with a real SNES, -including resetting. During playback, the game will reset just as you did during -recording. - -- - - - - - - - Limitations -- - - - - - - - -You cannot record games that use the Konami Justifier special input device. -Lethal Enforcers is the only game known to require this device. - -You cannot record games while using Netplay. - -You should be able to record ZSNES movies for all game types; however, ZMVs are -heavily dependant on save states, so any games that exhibit problems while using -save states will also exhibit problems when recording and playing movies. - -For best results, you should play back movies with the same version of ZSNES -that was used to record them. Otherwise, keypresses may become desynchronized -from the emulation playback. - -- - - - - - - - - Re-recording -- - - - - - - - - -You do not have to do everything perfectly the first time you record a movie. -ZSNES allows you to re-record parts of a movie, inserting the newly recorded -parts seamlessly into the previously recorded parts. You can accomplish this -in a number of ways: - - * While playing back a movie, start recording again. - * Use save states while recording movies. Loading the states will allow you to - re-record. - * You can use the rewind key to go back in movies. The rewind key can be - configured under the Config->Saves menu. - -- - - - - - - Chapters -- - - - - - - -You can insert chapters into your movies, to which you can seek during movie -playback. - -You are limited to 65535 (2^16 - 1) chapters created during recording, in -addition to 65535 (2^16 - 1) created during playback. - -- - - - - - - Subtitles -- - - - - - - -Subtitles allow you to create a short message that will be visible on-screen -during playback of a movie. - - 1. Create an empty file in your save directory (or wherever your movies are - saved). - 2. The subtitle file must be named in the following manner: - - Subtitle file name = ZMV file name = ROM file name. - (Example: smw.sfc (Super Mario World ROM), smw.zmv, smw.sub). - - If you are using movie slot 0, file extension = .sub. - - If you are using movie slot 1 through 9, change the last letter of the - extension to match the movie slot you are using. - (Example: slot 1 = .su1, slot 5 = .su5, slot 9 = .su9). - 3. For each subtitle you want in the movie, add a new line to the subtitle - file, with the following information: - - Start Frame:Frame Duration:Message - - For example: "10:100:Beating the Last Boss" without the quotes. In this - example, the message "Beating the Last Boss" will appear in the tenth - frame and stay visible for 100 frames (thus, until the 110th frame). - - ZSNES can display only one subtitle at a time. So make sure that the - start frame for the next subtitle is not during the duration time of - the previous subtitle. You must also list your subtitles sequentially - for all of them to be played (they cannot be out of order). - - ZSNES can display a maximum of 34 characters (of a subtitle message) - across the width of the screen. - 4. Now save your new subtitle file. Open ZSNES, play a movie, and you should - see your subtitles appear! - -- - - - - - - - - Movie Dumping -- - - - - - - - - -See the Movie Dumping section of the Advanced Usage page [Advanced.txt] for more -information. - - -............................................................ - 10. IPS Patching -............................................................ - -IPS ("International Patching System") patches are files that are applied to an -original ROM, which change the programming of the ROM in some way. They are -primarily used to translate ROMs into another language; however, they can be -used for a variety of purposes. Visit [Romhacking.net] for more information -about translations and ROM hacks. - -ZSNES has the ability to automatically "soft-patch" a ROM. This means that after -ZSNES loads a ROM into its memory, it will apply the IPS patch to the in-memory -ROM data, *not* the ROM file on your hard disk. This eliminates the need to keep -two copies of a ROM: the original, and the patched. - -- - - - - - - - - - - - - - - - - - - - - Applying a single IPS file to a ROM: -- - - - - - - - - - - - - - - - - - - - - - 1. Make sure Enable Auto-Patch is checked in Config->Options. - 2. The IPS file must be either in your Saves directory or in the same - directory as the ROM. - 3. The IPS file and the ROM file must have matching filenames. For example, - SD3.sfc and SD3.ips. If your ROM file is compressed, the IPS file must - match the *compressed* filename. For example, if you have the file - SD3.sfc compressed inside the file Seiken Densetsu 3 (J).zip, the IPS - file must be named Seiken Densetsu 3 (J).ips. - 4. If you meet the above three conditions, just load your ROM file as - normal, and ZSNES should automatically patch the IPS file to the - in-memory ROM. Remember, your original ROM file will *not* be changed. - 5. If you have done everything outlined in the steps above, and your game - does not appear to be working, refer to the related FAQ [FAQ.txt]. - -- - - - - - - - - - - - - - - - - - - - - Applying multiple IPS files to a ROM: -- - - - - - - - - - - - - - - - - - - - - -ZSNES has the ability to apply up to eleven separate IPS files to the same ROM -file. You must give each IPS file a specific extension to tell ZSNES in what -order to apply them. Aside from changing the extension of the IPS files, just -follow the directions above. - -| IPS file | Applied | -| extension | When? | -- - - - - - - - - - - - - - ips | First - ip0 | Second - ip1 | Third - ip2 | Fourth - ip3 | Fifth - ip4 | Sixth - ip5 | Seventh - ip6 | Eighth - ip7 | Ninth - ip8 | Tenth - ip9 | Eleventh - -ZSNES will *not* apply non-sequentially extensioned IPS files. This means that -if you have three IPS files, named patch.ips, patch.ip0, and patch.ip6, ZSNES -will only apply the first two. - -Please remember that the *order* in which you apply the IPS patches may be -important. Applying the patches in the wrong order may result in strange bugs, -or even an unplayable game. Please refer to the documentation that accompanied -your IPS file. - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Alternative method of applying IPS files to Compressed ROMs: -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The simplest method of applying an IPS file to a compressed ROM is to simply -place the IPS file in the same archive as the ROM. The filename of the IPS file -does not have to match the compressed or uncompressed filename of the ROM. -Do *not* add more than one IPS file of a given extension to an archive. Results -can be unpredictable as to which of the same-extension IPS files will be applied -to the ROM. - -If your ROM is compressed, ZSNES will first look for IPS files inside the -archive. If it finds any, it will only load IPS files from inside the archive, -and will not look anywhere else. Otherwise, ZSNES looks in the Saves directory -and the same directory as the ROM. - - -............................................................ - 11. Cheat Codes -............................................................ - -Currently, ZSNES supports Game Genie, Pro Action Replay, and GoldFinger codes. - -- - - - - - - - - - - - - - How to use cheat codes: -- - - - - - - - - - - - - - - 1. Load the ROM to which you want to apply cheats. - 2. Press ESC to toggle the GUI. Open the Add Code dialog from the Cheat - Menu. You can enter up to 255 codes for each game. - 3. After adding your codes, press ESC until you are back to your game. - -** To use a multi-line cheat code, just enter each line as a separate code! ** - -- - - - - - - - - - - - - - How to use .cht files: -- - - - - - - - - - - - - - -Place the .cht file into the same directory as the ROM, or into your Saves -folder. The .cht file must be named according to the normal naming rules (see -the Files section [Readme.txt] for details). - -- - - - - - - - - - - - - - - - Troubleshooting Cheat Codes -- - - - - - - - - - - - - - - - - * Try using the Fix button in the Browse Cheats dialog [GUI.txt]. - * Some cheat codes are meant to be used with different versions of the same - game. If a cheat code doesn't work and there is one for both Game Genie and - Pro Action Replay, try them both. - * Remember that Game Genie codes require the - (dashes). - * Try resetting the game. Any code for a game that mentions a term similar to - "Start with" means that the game must be reset in order to take effect. - * If you are having a hard time with comparative searches, make sure to delete - the tmpchtsr.___ file in your ZSNES directory. - - -............................................................ - 12. Files -............................................................ - -This section attempts to explain the various files that are created, loaded, or -used by ZSNES. - -Most of the data files that are specific to individual ROMs are named in the -following manner: - - The filename of the data file is the same as the filename of the ROM from - which it was created. - - The file extension of the data file changes, depending on the following: - * If there are no "slots" for the data file, then it is just the - normal file extension (srm, bmp, png, raw, cht, cmb, cfg, txt). - * If you are using slot 0, then it is just the normal file extension - (zst, zmv, sub, ips, spc). - * If you are using slots 1-9, then the last letter of the file - extension changes to match the slot number (zs1-zs9). - * If you are using slots 10-99, then the last two letters of the file - extension change to match the slot number (z10-z99). - -[Where Created?] -|File Name| |File Extension| |File Type Name| - |Description| -= = = = = = = = = = = = = = = = = = = = = = = -[Wherever you put them.] - - Whatever you want, or have them smc, sfc, swc, ... ROM (Game) - automatically named by NSRT. - These are common extensions for ROMs, which are computer files of the game - data on real SNES cartridges. Read the full list of supported ROM file - extensions in the Current Progress section [Readme.txt]. - -- - - - - - - - - - - - - - - - - - - - - - - -[Saves folder] - - romname srm Static RAM - This is the *in-game* save file. It is automatically generated by ZSNES - when you use the in-game save function. Some games use Static RAM as - working RAM rather than to save a game. This format *should* be compatible - among all emulators. - - romname zst, zs1-zs9, ZSNES Save State - z10-z99, zss - See the Save States section for more information [Readme.txt]. - - romname zmv, zm1-zm9 ZSNES Movie - See the Movies section for more information [Readme.txt]. - - romname mzt, mz1-mz9 ZSNES Movie States - Directories which contain the various save state data for that particular - movie. See the Movies section for more information [Readme.txt]. - - romname sub, su1-su9 ZSNES Subtitle - See the Subtitles sub-section of the Movies section for more information - [Readme.txt]. - - romname cht Cheat Data - This file contains cheat codes that you entered using the Cheat Code - Editor [GUI.txt]. These files are generally compatible between different - versions of the same emulator, but not necessarily between different - emulators. - - romname cmb Key Combination Data - These files contain key combination data, created when you use the Key - Combination Editor [GUI.txt]. - - romname inp ZSNES Input - These files contain input configuration for the specific game. - -- - - - - - - - - - - - - - - - - - - - - - - -[Saves folder, Same folder as ROM] - - romname ips, ip0-ip9 International Patching System - See the IPS Patching section for more information [Readme.txt]. - -- - - - - - - - - - - - - - - - - - - - - - - -[Snapshots folder] - - romname_***** bmp, png Images - /img***** - These are snapshots of the game screen, created by ZSNES when you use the - F1 Menu [GUI.txt]. The file name is appended by a number, up to 99999. - -- - - - - - - - - - - - - - - - - - - - - - - -[SPCs folder] - - romname spc, sp1-sp9, SPC Sound - s10-s99 - These files are created by ZSNES when you dump the SPC data of the game - you are playing by using the F1 Menu [GUI.txt]. Note: In Windows, the .spc - extension is sometimes used for PKCS Certificates. - - sounddmp raw Sound Buffer Dump - This is a dump of sound buffer data, created when you use the appropriate - F1 Menu option [GUI.txt]. - -- - - - - - - - - - - - - - - - - - - - - - - -[ZSNES folder (Win/DOS) / "~/.zsnes" (SDL) / - "~/Library/Application Support/ZSNES" (SDL - Mac OS X)] - - zsnes/zsnesw exe (Win/DOS) ZSNES executable - This is the main ZSNES executable binary file. "ZSNES Folder" means the - location of this executable. - - zsnes/zsnesw cfg ZSNES Configuration File - /zsnesl - User-editable configuration file where you can set almost any option in - ZSNES [Advanced.txt]. - - zmovie cfg ZSNES Movie Configuration File - User-editable configuration file where you can change advanced movie - dumping features [Advanced.txt]. - - zinput cfg ZSNES Input Configuration File - User-editable configuration file where you can change settings for - controllers and extra SNES devices. This is the same as the files with the - .inp extension, but is used globally. - - zfont txt ZSNES Font Configuration File - This is where the appearance of text in the ZSNES GUI is configured - [Advanced.txt]. - - rominfo txt ROM Information - This contains information about the ROM you most recently ran. You can - configure this behavior under Config->Options. - - data cmb Key Combination Data - This file contains key combination data, created when you use the Key - Combination Editor for an unspecific game. - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/readme.txt/support.txt b/tools/zsnes/docs/readme.txt/support.txt deleted file mode 100644 index ae2b875..0000000 --- a/tools/zsnes/docs/readme.txt/support.txt +++ /dev/null @@ -1,231 +0,0 @@ -ZSNES v1.51 Documentation - -================================ - N a v i g a t i o n -================================ - - * Index [Index.txt] - - * Readme [Readme.txt] - - * GUI [GUI.txt] - - * Netplay [Netplay.txt] - - * Advanced Usage [Advanced.txt] - - * Games [Games.txt] - - * FAQ [FAQ.txt] - - - - - - - - - - - - - - - - - - - - - - * Getting Support [Support.txt] - 1. APIs and Utilities - 2. Contact Information - 3. Known Issues - 4. Filing a Bug Report - - * History [History.txt] - - * About [About.txt] - - * License [License.txt] - - - - - - - - - - - - - - - - - - - - - - * NSRT Guide: [http://zsnes-docs.sf.net/nsrt] - - * ZSNES Home Page: [ZSNES.com] - - -================================================================================ -~ G e t t i n g S u p p o r t -================================================================================ - -............................................................ - 1. APIs and Utilities -............................................................ - -The following utilities are referenced throughout this documentation to help -accomplish various tasks. There is a link to each utility and a short -description of its purpose. - -- - - - - - - - - - - - - - - - - . . . DirectX . . . -- - - - - - - - - - - - - - - - - - [http://www.microsoft.com/directx] - - DirectX is an API ("Application Programming Interface") required for running - ZSNES in Windows. - -- - - - - - - - - - - - - - - - - . . . .SDL. . . . -- - - - - - - - - - - - - - - - - - [http://www.libsdl.org] - - SDL (Simple DirectMedia Layer) is an API required for running ZSNES on - UNIX-like operating systems. - -- - - - - - - - - - - - - - - - - . Scitech . Display . Doctor. -- - - - - - - - - - - - - - - - - - [http://www.scitechsoft.com/ftp/sdd] - - Scitech Display Doctor (SDD) is a utility that provides drivers for many VGA - and SVGA video cards. It can provide support for VESA VBE 2 on some video - cards that may not normally support it. - - The link above directs you to Scitech's FTP site. "regcodes.txt" provides - registration codes for the two different versions of SDD offered, v5.3 and - v6.53. The newer version supports hardware acceleration and more cards. If you - are in a DOS-only environment, you should use one of the "-d.zip" versions. - If you are in a Windows+DOS environment, use one of the "-w.exe" versions. - "univbe67.exe" is a stand-alone VESA VBE driver, and does not provide any of - the other SDD utilities. - - Note: SciTech Software no longer offers support for this software. - -- - - - - - - - - - - - - - - - - . . . NSRT. . . . -- - - - - - - - - - - - - - - - - - [http://nsrt.edgeemu.com] - - NSRT - Nach's SNES ROM Tools. “NSRT, the most advanced SNES ROM tool to date, - provides the ability to check, alter, retrieve info from, verify, fix, and - organize SNES ROMs.” - - NSRT has several important uses in relation to ZSNES: - - * You can use it to scan your ROMs and show detailed information about them. - This information will tell you whether or not the ROM is a good dump. - * It can deinterleave your SuperFX ROMs so that ZSNES can load them. - * It can add special NSRT headers to your ROMs, which will allow ZSNES to - automatically enable special controllers for games that need them. - * You can use NSRT to compress your ROMs using a special, custom-built - compression format called JMA. “This is an archive format designed by Nach - based on LZMA. When used on SNES ROMs it is faster, and creates smaller - files than 7Zip.” - - NSRT is primarily a command-line program, although a graphical front-end is - available. The ZSNES Documentation Team has written a supplementary guide to - NSRT [http://zsnes-docs.sourceforge.net/nsrt] that covers some of the - functions listed above. - - -............................................................ - 2. Contact Information and Links -............................................................ - -The following is a list of all official ZSNES websites and resources: - - ZSNES Home Page [http://www.zsnes.com] - ZSNES Project Page hosted by BountySource. [http://zsnes.bountysource.com] - ZSNES Documentation on the Web [http://zsnes-docs.sourceforge.net] - ZSNES Documentation Project Page hosted by SourceForge.net. - [http://sourceforge.net/projects/zsnes-docs/] - ZSNES Documentation Wiki [http://zsnes.game-host.org/wiki/] - ZSNES Bug Tracker [http://zsnes.game-host.org/bugzilla/] - ZSNES Message Board [http://board.zsnes.com] - -In your quest to solve whatever problem you may be having with ZSNES, or to -learn more about ZSNES, please first read all of this official documentation. - -The ZSNES Message Board is the primary place to receive help about ZSNES, after -you have read through this entire documentation. It is also an interesting -Internet community in its own right. Asking for ROMs (or asking for games, a -link to a ROM site, or where to find ROMs/games) is forbidden! Be sure to also -read the RULES! - - -............................................................ - 3. Known Issues -............................................................ - - * 65816 lacks correct timing. Although ZSNES bases the timing on a variable - cycle/instruction, it does not deduct correct values (such as 16-bit - instructions should deduct 1 more cycle than 8-bit instructions). 100% - cycles of ZSNES isn't 100% cycles of a SNES because of that. This means - that a lot of games either won't run or will produce horrible displays. - Sometimes, adjusting the % of execution can fix those problems. This is all - due to inaccurate documentation used when the ZSNES 65816 core was written. - Fortunately, there are currently ongoing efforts to rewrite the ZSNES core. - * Some games sometimes tend to not display things properly because of - graphic features that aren't implemented yet. - * The Sound DSP chip still has its bugs (not many though). Additionally, - no one knows the exact timing of the SPC700 chip. - - -............................................................ - 4. Filing a Bug Report -............................................................ - -- - - - - - - - - - - - - - - - - Before you file a bug report: -- - - - - - - - - - - - - - - - - - * Please verify that you have a good ROM. You should use NSRT - [http://nsrt.edgeemu.com] to do this. You can find detailed instructions on - how to use NSRT to verify your ROM(s) in this section - [http://zsnes-docs.sourceforge.net/nsrt#verifying] of our NSRT Guide - [http://zsnes-docs.sourceforge.net/nsrt]. - * Make sure you are using the -current- release of ZSNES. - You can download the latest version from the ZSNES home page - [http://www.zsnes.com/index.php?page=files] - or from the ZSNES SourceForge Project Files page - [http://sourceforge.net/project/showfiles.php?group_id=19677]. - If you *were* using an old version of ZSNES, and the problem goes away when - you use the new version, please do not report the bug. - * If the bug still exists in the latest official release of ZSNES, please try - again with the latest WIP release of ZSNES. These are unofficial versions, - compiled from SVN source, and are updated somewhat frequently. They are - available at ipher's WIP Page [http://zsnes.ipherswipsite.com]. - * If you want to check against the latest development code, go obtain it from - SVN at BountySource [https://svn.bountysource.com/zsnes/trunk/]. You are - warned, however, that frequent changes are made to the code, so ZSNES may - not always be able to compile when using code obtained from there. - * If possible, confirm whether the bug occurs on real hardware (as in, play - the game on a real console). - -Bug reports should be submitted in the Bug Reports/Feature Requests section of -the ZSNES Message Board [http://board.zsnes.com]. Before reporting, please use -the board's search function to see if your bug has already been reported. - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - When making a bug report, please include the following information: -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Version (i.e., v1.51) and port (i.e., Windows, DOS, or SDL) of ZSNES you are - using. Make sure to specify the revision if you obtained ZSNES from SVN. - * Detailed ROM information: - - You *must* post the NSRT information about your ROM when reporting a - bug. Please see the "Verifying a ROM to make a Bug Report" section of - our NSRT Guide for detailed instructions. - [http://zsnes-docs.sourceforge.net/nsrt#verifying_bug_reports] - Alternatively, you can use the "Log Rom Info" option in ZSNES [GUI.txt] - to generate the file "rominfo.txt", which also provides the necessary - information. - * Detailed system specifications: - - At minimum, you must tell us what operating system you are using and - what version of DirectX or SDL you are using. - - If your issue is related to performance (as in, ZSNES is too slow), - also include the specs for your processor, RAM, video card, etc. - * Detailed description of the bug: - - A detailed description of the bug is important so that others can try to - reproduce it. - - Screenshots are highly recommended, and save states made before (or in - some cases, during) the bug's occurrence are also greatly appreciated. - - If you know of a previous version of ZSNES that ran the game properly, - or if you know of another game that acts similarly, please let us know. - - It may also be helpful to test the game in other SNES emulators and tell - us the resulting behavior. - - -. . . . . . . . . . . . . . . . -This documentation is best viewed in a fixed-width font such as "Courier New". - -Copyright (C) ZSNES Team & ZSNES Documentation Team [License.txt] diff --git a/tools/zsnes/docs/srcinfo.txt b/tools/zsnes/docs/srcinfo.txt deleted file mode 100644 index 8ce32cc..0000000 --- a/tools/zsnes/docs/srcinfo.txt +++ /dev/null @@ -1,170 +0,0 @@ - -(this part was written by zsKnight) - -File List/Information ---------------------- - -; Porting Routine Files - --DOS- -ZLOADER.C ; Start-up C routines for DOS (Commandline parser, etc.) -DOSINTRF.ASM ; DOS Interface routines (File,video,timers,etc.) - --WINDOWS- -ZLOADERW.C ; Start-up C routines for Windows (Commandline parser, etc.) -Winintrf.asm ; Windows Interface routines (File,video,timers,etc.) -winlink.cpp ; Win32 routines (DirectX, Win32 functions) -ztcp.c ; TCP/IP & UDP driver -copyvwin.asm ; Video Blitter for D modes - --LINUX- -copyvwin.asm ; Video Blitter for D modes -gl_draw.c ; OpenGL routines for drawing the video buffer -gl_draw.h ; -protect.c ; -sdllink.c ; SDL routines (video, input, sound init) -sdlintrf.asm ; Interface routines -sw_draw.c ; Software (via SDL) drawing routines -sw_draw.h ; -zfilew.c ; -zipxw.c ; -zloaderw.c ; -zsnes.1 ; man page for zsnes -ztcp.c ; TCP/IP (Netplay) - -; ---------------------------------------------------------------- -; The following are generally compiled for both ports, but they -; are not necessarily used by both -; ---------------------------------------------------------------- - -; General Stuff -MACROS.MAC ; Global Macro file (NEWSYM/EXTSYM global var control macros) -UI.ASM ; Start-up/initialization routines (env variables, cfg - ; loader, memory allocation, etc.) -INIT.ASM ; Emulation initialization routines (eg. memory map, emu - ; variables, etc.) -CFGLOAD.ASM ; ZSNES.CFG/ZSNESW.CFG file loading/parsing routines -PROCVID.ASM ; In-game video initialization/text displays/mouse routines/ - ; 8-bit palette/F3 menu routines -TABLE.ASM ; Generates the SNES CPU tables (but in an inefficient way) -TABLEB.ASM -TABLEC.ASM -STABLE.ASM -VCACHE.ASM ; Performs tile caching and also vframe initialization stuff -MENU.ASM ; F1 Menu routines -ENDMEM.ASM ; Where those large arrays go -ZFILE.C ; File Access Routines -GBLHDR.H ; Global Header Stuff - -; ZSNES GUI Stuff -GUI.ASM ; Main GUI file -GUITOOLS.INC ; Simple tools for the GUI -GUIWINDP.INC ; GUI Window Display Routines -GUINETPL INC ; GUI Netplay Routines -GUILOAD INC ; GUI File Load Routines -GUIKEYS INC ; GUI Keyboard Input Routines -GUIMOUSE INC ; GUI Mouse Input Routines -GUICHEAT INC ; GUI Cheat Code Routines (search + regular codes) -GUICOMBO INC ; GUI Key Combo Routines -GUIMISC INC ; Misc GUI Stuff (Movie, Joystick setting (display) routines, - ; SNES Reset Function - -; DOS Specific stuff -VESA2.ASM ; VESA2 DOS Routines -VESA12.ASM ; VESA1.2 DOS Routines -ZSIPX.ASM ; IPX routines (DOS) -JOY.ASM ; DOS Joystick Drivers -COPYVID.INC ; Graphics blitter routines for DOS (copys screen to display) -INITVID.ASM ; Video Initialization routines (DOS) -DEBUG.ASM ; SNES Debugger routines -SW.ASM ; Sidewinder routines -SW32.ASM ; More Sidewinder routines (not sure which file is the real - ; one) -GPPRO.ASM ; Gamepad Pro routines (non-USB) -MODEMRTN.ASM ; DOS Modem routines - -; Graphics Enhancers -2XSAIMMX.INC ; Kreed's 2xSaI routines -2xSaI.cpp ; Kreed's Super 2xSaI routines -2xsaiw.asm ; 2xSaI for windows (without selector usage) -water.c ; Water Effect - -; SNES CPU Emulation routines -execute.asm ; Main emulation execution loop routines (includes save - ; states and in-game netplay routines) -SPC700.ASM ; SNES SPC700 Sound CPU emulation routine files -SPCADDR.INC -SPCDEF.INC -DSPPROC.ASM ; SNES Digital Sound Processor main emulation routines -DSP.ASM ; SNES Digital Sound Processor register routines -DMA.ASM ; SNES PPU DMA/HDMA routines -IRQ.ASM ; SNES 65816 IRQ routines (VIRQ/NMI) -MEMORY.ASM ; SNES Memory access routines + C4 routines (Sorry that I - ; didn't have these in a separate file since a small memory - ; hack of the C4 originated on this file and just grew and - ; grew) -E65816.INC ; 65816 emulation routines (w/o SPC700) -65816D.INC -E65816B.INC ; 65816 emulation routines (Debugger I think) -65816DB.INC -E65816C.INC ; 65816 emulation routines (w/ SPC700) - Sorry about these - ; 3 files. They used to be just 1 until I removed the - ; self-modifying code routines -65816DC.INC -SE65816.INC ; 65816 emulation routines (SA-1) -S65816D.INC -ADDRNI.ASM ; 65816 Non-incrementing addressing modes -ADDRNI.INC -SADDRNI.INC -ADDRESS.INC ; 65816 Incrementing addressing modes -ADDRESS2.INC -SADDRESS.INC -REGS.INC ; SNES I/O register emulation -REGS.MAC -REGSW.INC -REGSW.MAC - -; SNES PPU Emulation Routines -MAKEVID.ASM ; 8-bit old graphics engine -MAKEV16B.ASM ; 16-bit old graphics engine -MAKEV16T.ASM ; 16-bit old graphics engine (transparencies) -MV16TMS.ASM ; 16-bit old graphics engine (transp w/ Main+Sub enabled) -MODE7.ASM ; 8-bit mode 7 routines -MODE7.MAC -MODE7EXT.ASM ; 8-bit mode 7 EXTBG routines -MODE716B.ASM ; 16-bit mode 7 routines -MODE716T.ASM ; 16-bit mode 7 routines (transparencies) -MODE716E.ASM ; 16-bit mode 7 EXTBG routines -M716TEXT.ASM ; 16-bit mode 7 EXTBG routines (transparencies) -MODE716D.ASM ; 16-bit mode 7 Direct routines -mode716.asm ; Mode 7 16-bit new graphics engine routines -mode716.mac -NEWGFX.ASM ; 8-bit new graphics engine files -NEWGFX.MAC -NEWGFX2.ASM -NEWGFX2.MAC -NEWGFXB.MAC -NEWGFXWN.MAC -newgfx16.asm ; 16-bit new graphics engine files -newgfx16.mac -NEWG162.ASM -newg162.mac -NEWG163.MAC -NEWG16WN.MAC -VIDMACRO.MAC ; Generic Video Macros File -VIDMACRB.MAC - -; Special Chip Emulation Routines -FXEMU2.ASM ; Super FX emulation files -FXEMU2.MAC -FXEMU2B.ASM -FXEMU2B.MAC -FXEMU2C.ASM -FXEMU2C.MAC -FXTABLE.ASM -SFXPROC.ASM -DSP1PROC.ASM ; DSP1 communication routines -DSP1EMU.C ; DSP1 C routines (also includes some C4 C routines) -SA1PROC.ASM ; SA-1 processing routines -SA1REGS.ASM ; SA-1 registers, also includes S-DD1 and SPC7110 routines - diff --git a/tools/zsnes/docs/stdards.txt b/tools/zsnes/docs/stdards.txt deleted file mode 100644 index 213fbd5..0000000 --- a/tools/zsnes/docs/stdards.txt +++ /dev/null @@ -1,3 +0,0 @@ -Guidelines for hacking ZSNES: - -* Always run minwhite on your file before committing diff --git a/tools/zsnes/docs/support.txt b/tools/zsnes/docs/support.txt deleted file mode 100644 index 3a47639..0000000 --- a/tools/zsnes/docs/support.txt +++ /dev/null @@ -1,32 +0,0 @@ - - ** NOTE ** If you are looking to submit a bug report to the ZSNES - development team, this is the wrong document to be reading. - - Please read the 'BUGINFO.TXT' that came with your distribution. - - ========================= - Getting help with ZSNES - ========================= - - To get help with ZSNES you can visit the ZSNES message boards. - Please, read the rules thoroughly before posting anything. - - http://board.zsnes.com/phpBB2/ - - There are also several mailing lists devoted to ZSNES which are - kindly hosted by SourceForge. They are usually low-traffic. - - http://sourceforge.net/mail/?group_id=19677 - - And last, but not least, there are several IRC channels which - have been created for the sole purpose of worshiping ZSNES. :) - - ================= - #ZSNES on irc.freenode.net - ================= - - This is where all of the old developers of ZSNES used to hangout - (and probably where they met). Some of the developers such as - _Demo_, pagefault, and stainless, and tons of ZSNES fans hangout - here. Be warned that this channel is usually plagued with adult - humor, links and requests for warez and ROMs, and always off-topic. diff --git a/tools/zsnes/docs/thanks.txt b/tools/zsnes/docs/thanks.txt deleted file mode 100644 index 8a62619..0000000 --- a/tools/zsnes/docs/thanks.txt +++ /dev/null @@ -1 +0,0 @@ -Someone needs to edit this file. \ No newline at end of file diff --git a/tools/zsnes/docs/todo.txt b/tools/zsnes/docs/todo.txt deleted file mode 100644 index a033541..0000000 --- a/tools/zsnes/docs/todo.txt +++ /dev/null @@ -1,37 +0,0 @@ -Some Issues : - -All Ports: -- Recode netplay feature, once core is not random anymore. - -SDL Port: -- Low performance due to differences in surface sizes (internal and - SDL), make both the same size. -- OpenGL code is awful, uncomprehensible, stupid and awful again. - We must fix it. -- Support overscan in games like DQ5. - -Windows Port: -- OpenGL, or Direct3D support would be nice (we have the source for - OpenGL but it needs to be integrated into the main tree, any takers?) -- Windows port should be converted to Direct3D from DirectDraw 7.0. -- Windows sound code needs to be rewritten to reflect the SDL port. - -Compatibility -- Game not working - Guikuden 1, Cu-On-Pa (and loads more) -- Graphics Glitches - Killer Instinct (black background), FF3 (Range Time Over - and other sprite trouble), Tactic Ogre (Menus), - Super Aleste (incorrect opt in stage 5), - Top Gear 3000 (DSP-4), lots of others... -- Special Chips - DSP1 (95% done), DSP3 (50% done), DSP4 (95% done) - SA-1 (95% done), SPC7110 (Needs some core fixes and decompression) - SFX1/2 (done?), Seta 11 (0% done), - Seta 18 (0% done), BS-X (50% done). - -Timing engine -- Convert counter to 32-bit. (assigned to pagefault). -- Fix 65816 timing and take into consideration cycle differences in - 8/16-bit mode, branches etc. - -Graphics Engine -- Fix some windowing/subscreen sprite problems that are still present in - the new graphics engine. Probably pagefault will have to do this. diff --git a/tools/zsnes/src/Makefile.check b/tools/zsnes/src/Makefile.check deleted file mode 100644 index f6c46d5..0000000 --- a/tools/zsnes/src/Makefile.check +++ /dev/null @@ -1,33 +0,0 @@ -############################################################################## -# Makes sure that a system is capable of running ZSNES, errors out with -# an informative message if it is not. -############################################################################## - -############################################################################## -# VARIABLES -############################################################################## -NASMMINVER=0.98.36 - -############################################################################## -# CHECKS -############################################################################## - -# NASM version check -NASMVER=$(word 3, $(shell nasm -v)) -ifeq ($(strip $(NASMVER)),) - $(error Could not find NASM executable. Please install NASM) -endif -ifneq ($(word 1, $(sort $(NASMMINVER) $(NASMVER))),$(NASMMINVER)) - $(error ZSNES needs at least NASM version $(NASMMINVER) to compile. You have version $(NASMVER) installed) -endif - -# OpenGL check -USE_OPENGL=true -ifeq ($(strip $(wildcard /usr/lib/libGL.so* /usr/local/lib/libGL.so*)),) - $(warning Could not find OpenGL libraries. Continuing without OpenGL support) - USE_OPENGL=false -endif -ifeq ($(strip $(wildcard /usr/include/GL/gl.h /usr/local/include/GL/gl.h)),) - $(warning Could not find OpenGL headers. Continuing without OpenGL support) - USE_OPENGL=false -endif diff --git a/tools/zsnes/src/Makefile.in b/tools/zsnes/src/Makefile.in deleted file mode 100644 index 4c49a79..0000000 --- a/tools/zsnes/src/Makefile.in +++ /dev/null @@ -1,158 +0,0 @@ -#Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -# -#http://www.zsnes.com -#http://sourceforge.net/projects/zsnes -#https://zsnes.bountysource.com -# -#This program is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public License -#version 2 as published by the Free Software Foundation. -# -#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. - -CHIP_D=chips -CPU_D=cpu -DOS_D=dos -EFF_D=effects -GUI_D=gui -JMA_D=jma -MMLIB_D=mmlib -NET_D=net -PORT_D=linux -TOOL_D=tools -VID_D=video -ZIP_D=zip - -PSR=parsegen -PSR_H=cfg.h md.h input.h - -CHIP_O=$(CHIP_D)/c4emu.o $(CHIP_D)/c4proc.o $(CHIP_D)/dsp1emu.o\ - $(CHIP_D)/dsp1proc.o $(CHIP_D)/dsp2proc.o $(CHIP_D)/dsp3emu.o\ - $(CHIP_D)/dsp3proc.o $(CHIP_D)/dsp4emu.o $(CHIP_D)/dsp4proc.o\ - $(CHIP_D)/fxemu2.o $(CHIP_D)/fxemu2b.o $(CHIP_D)/fxemu2c.o\ - $(CHIP_D)/fxtable.o $(CHIP_D)/obc1emu.o $(CHIP_D)/obc1proc.o\ - $(CHIP_D)/sa1proc.o $(CHIP_D)/sa1regs.o $(CHIP_D)/sdd1emu.o\ - $(CHIP_D)/seta10.o $(CHIP_D)/sfxproc.o $(CHIP_D)/st10proc.o\ - $(CHIP_D)/7110proc.o $(CHIP_D)/seta11.o $(CHIP_D)/st11proc.o - -CPU_O=$(CPU_D)/dma.o $(CPU_D)/dsp.o $(CPU_D)/dspproc.o $(CPU_D)/execute.o\ - $(CPU_D)/executec.o $(CPU_D)/irq.o $(CPU_D)/memory.o $(CPU_D)/memtable.o\ - $(CPU_D)/spc700.o $(CPU_D)/stable.o $(CPU_D)/table.o $(CPU_D)/tablec.o - -DEBUG_O=@DEBUGGER_FILES@ - -EFF_O=$(EFF_D)/burn.o $(EFF_D)/smoke.o $(EFF_D)/water.o - -GUI_O=$(GUI_D)/gui.o $(GUI_D)/guifuncs.o $(GUI_D)/menu.o - -JMA_O=@JMA_FILES@ - -MAIN_O=cfg.o endmem.o init.o initc.o input.o md.o patch.o ui.o vcache.o\ - version.o zloader.o zmovie.o zpath.o zstate.o ztime.o ztimec.o - -MMLIB_O=@MMLIB_FILES@ - -NET_O= -#$(NET_D)/ztcp.o - -PORT_O=$(PORT_D)/audio.o $(PORT_D)/battery.o\ - $(PORT_D)/sdlintrf.o $(PORT_D)/sdllink.o @GL_DRAW@ $(PORT_D)/sw_draw.o\ - $(PORT_D)/safelib.o - -TOOL_O=$(TOOL_D)/fileutil.o $(TOOL_D)/strutil.o - -VID_O=$(VID_D)/makev16b.o $(VID_D)/makev16t.o $(VID_D)/makevid.o\ - $(VID_D)/mode716.o $(VID_D)/mode716b.o $(VID_D)/mode716d.o\ - $(VID_D)/mode716e.o $(VID_D)/mode716t.o $(VID_D)/mode7.o\ - $(VID_D)/mode7ext.o $(VID_D)/mv16tms.o $(VID_D)/m716text.o\ - $(VID_D)/newg162.o $(VID_D)/newgfx.o $(VID_D)/newgfx16.o\ - $(VID_D)/newgfx2.o $(VID_D)/procvid.o $(VID_D)/procvidc.o\ - $(VID_D)/sw_draw.o $(VID_D)/2xsaiw.o $(VID_D)/hq2x16.o $(VID_D)/hq2x32.o\ - $(VID_D)/hq3x16.o $(VID_D)/hq3x32.o $(VID_D)/hq4x16.o $(VID_D)/hq4x32.o\ - $(VID_D)/ntsc.o $(VID_D)/copyvwin.o - -ZIP_O=$(ZIP_D)/unzip.o $(ZIP_D)/zpng.o - -Z_OBJS=$(MAIN_O) $(CHIP_O) $(CPU_O) $(DEBUG_O) $(GUI_O) $(EFF_O) $(JMA_O)\ - $(MMLIB_O) $(NET_O) $(VID_O) $(PORT_O) $(ZIP_O) - -.PHONY: default main tools all install clean tclean distclean -.SUFFIXES: .asm .c .cpp .psr - -%: %.cpp - @CXX@ @CXXFLAGS@ -o $@ $< -%.o: %.asm - @NASMPATH@ @NFLAGS@ -o $@ $< -%.o: %.c - @CC@ @CFLAGS@ -o $@ -c $< -%.o: %.cpp - @CXX@ @CXXFLAGS@ -o $@ -c $< -%.o %.h: %.psr $(PSR) - ./$(PSR) @PSRFLAGS@ -gcc @CC@ -compile -flags "@CFLAGS@ -O1" -cheader $*.h -fname $* $*.o $< - -default: main -all: main tools -main: makefile.dep $(Z_OBJS) - @ZC@ -o @ZSNESEXE@ $(Z_OBJS) @ZCFLAGS@ @LDFLAGS@ - rm -f version.o - -$(PSR): parsegen.cpp - @CXX@ @CXXFLAGS@ -o $@ $< -lz - -TOOLSEXE=$(TOOL_D)/archopt $(TOOL_D)/cutrtype $(TOOL_D)/extraext\ - $(TOOL_D)/macroll $(TOOL_D)/minwhite $(TOOL_D)/nreplace\ - $(TOOL_D)/sec-test $(TOOL_D)/srccount $(TOOL_D)/varrep -tools: $(TOOLSEXE) $(TOOL_D)/depbuild -$(TOOL_D)/archopt: $(TOOL_D)/archopt.c - @CC@ @CFLAGS@ -m32 -o $@ $@.c -$(TOOL_D)/cutrtype: $(TOOL_D)/cutrtype.cpp $(TOOL_O) - @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O) -$(TOOL_D)/depbuild: $(TOOL_D)/depbuild.cpp $(TOOL_O) - @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O) -$(TOOL_D)/extraext: $(TOOL_D)/extraext.cpp $(TOOL_O) - @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O) -$(TOOL_D)/macroll: $(TOOL_D)/macroll.cpp $(TOOL_O) - @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O) -$(TOOL_D)/minwhite: $(TOOL_D)/minwhite.cpp $(TOOL_O) - @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_D)/fileutil.o -$(TOOL_D)/nreplace: $(TOOL_D)/nreplace.cpp $(TOOL_O) - @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_D)/fileutil.o -$(TOOL_D)/sec-test: $(TOOL_D)/sec-test.cpp $(TOOL_O) - @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O) -$(TOOL_D)/srccount: $(TOOL_D)/srccount.cpp $(TOOL_O) - @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_D)/fileutil.o -$(TOOL_D)/varrep: $(TOOL_D)/varrep.cpp $(TOOL_O) - @CXX@ @CXXFLAGS@ -o $@ $@.cpp $(TOOL_O) - -include makefile.dep -makefile.dep: $(TOOL_D)/depbuild Makefile - $(TOOL_D)/depbuild @CC@ "@CFLAGS@" @NASMPATH@ "@NFLAGS@" $(Z_OBJS) > makefile.dep - -Makefile: Makefile.in config.status - ./config.status - -config.status: configure.in - ./autogen.sh --recheck - -install: - @INSTALL@ -d -m 0755 $(DESTDIR)/@prefix@/bin - @INSTALL@ -m 0755 @ZSNESEXE@ $(DESTDIR)/@prefix@/bin - @INSTALL@ -d -m 0755 $(DESTDIR)/@prefix@/man/man1 - @INSTALL@ -m 0644 linux/zsnes.1 $(DESTDIR)/@prefix@/man/man1 -uninstall: - rm -f @prefix@/bin/$(notdir @ZSNESEXE@) @prefix@/man/man1/zsnes.1 - -clean: - rm -f $(Z_OBJS) $(PSR) $(PSR_H) @ZSNESEXE@ -tclean: - rm -f $(TOOL_O) $(TOOLSEXE) -distclean: clean tclean - rm -f Makefile makefile.dep aclocal.m4 configure config.log \ - config.status config.h $(TOOL_D)/depbuild diff --git a/tools/zsnes/src/SConstruct b/tools/zsnes/src/SConstruct deleted file mode 100644 index 11230fa..0000000 --- a/tools/zsnes/src/SConstruct +++ /dev/null @@ -1,310 +0,0 @@ -# SConstruct file for ZSNES -# Run 'scons' in this directory to build. -# Run 'scons -c' in this directory to cleanup. - -import os -env = Environment () -platform = env['PLATFORM'] - -parsegen_tool = env.Program(target= 'parsegen', source = 'parsegen.cpp') - -def parsegen_emitter(target,source,env): - env.Depends(target,parsegen_tool) - return (target,source) - -if platform == 'posix': - os.system('rm cfgparse.c version.o') - print 'cfgparse.c and version.o removed' - psrbld = Builder(action ='./parsegen -D__UNIXSDL__ $TARGET $SOURCE', - emitter = parsegen_emitter, - suffix = '.c', src_suffix = '.psr') - -env['BUILDERS']['PARSEGEN'] = psrbld -env.PARSEGEN('cfgparse.c', 'cfgparse.psr') - -objfix_tool = env.Program(target= 'objfix.exe', source= 'objfix.c') - -def objfix_emitter(target,source,env): - env.Depends(target,objfix_tool) - return (target,source) - -objbld = Builder(action = 'objfix $TARGET', - emitter = objfix_emitter, - suffix = '.obj', src_suffix = '.obj') - -env['BUILDERS']['OBJFIX'] = objbld - -chipssrc = Split(''' - chips/c4emu.c - chips/dsp1emu.c - chips/dsp1proc.asm - chips/dsp2proc.asm - chips/dsp4emu.c - chips/dsp4proc.asm - chips/fxemu2.asm - chips/fxemu2b.asm - chips/fxemu2c.asm - chips/fxtable.asm - chips/sa1proc.asm - chips/sa1regs.asm - chips/sdd1emu.c - chips/seta10.c - chips/sfxproc.asm - chips/st10proc.asm -''') -#ztcp is no longer used -netsrc = Split(''' - net/ztcp.c -''') -cpusrc = Split(''' - cpu/dma.asm - cpu/dsp.asm - cpu/dspproc.asm - cpu/execute.asm - cpu/executec.c - cpu/irq.asm - cpu/memory.asm - cpu/memtable.c - cpu/spc700.asm - cpu/stable.asm - cpu/table.asm - cpu/tableb.asm - cpu/tablec.asm -''') -dossrc = Split(''' - dos/debug.asm - dos/joy.asm - dos/vesa2.asm -''') -effectssrc = Split(''' - effects/burn.c - effects/water.c - effects/smoke.c -''') -guisrc = Split(''' - gui/gui.asm - gui/guifuncs.c - gui/menu.asm -''') -videosrc = Split(''' - video/makev16b.asm - video/makev16t.asm - video/makevid.asm - video/mode716.asm - video/mode716b.asm - video/mode716d.asm - video/mode716e.asm - video/mode716t.asm - video/mode7.asm - video/mode7ext.asm - video/mv16tms.asm - video/newg162.asm - video/newgfx16.asm - video/newgfx2.asm - video/newgfx.asm - video/m716text.asm - video/2xsaiw.asm - video/procvid.asm - video/procvidc.c - video/sw_draw.asm - video/hq2x16.asm - video/hq2x32.asm - video/hq3x16.asm - video/hq3x32.asm - video/hq4x16.asm - video/hq4x32.asm -''') -zipsrc = Split(''' - zip/unzip.c - zip/zpng.c -''') -jmasrc = Split(''' - jma/7zlzma.cpp - jma/crc32.cpp - jma/iiostrm.cpp - jma/inbyte.cpp - jma/zsnesjma.cpp - jma/jma.cpp - jma/lzma.cpp - jma/lzmadec.cpp - jma/winout.cpp -''') -basesrc = Split(''' - cfgparse.c - cfgload.c - endmem.asm - init.asm - initc.c - uic.c - patch.c - ui.asm - vcache.asm - version.c - zmovie.c - zstate.c - zloader.c -''') - -linuxsrc = Split(''' - linux/copyvwin.asm - linux/sdlintrf.asm - linux/sdllink.c - linux/sw_draw.c - linux/zfilew.c -''') -winsrc = Split(''' - win/copyvwin.asm - win/winintrf.asm - win/winlink.cpp - win/zfilew.c - win/zipxw.c -''') - -platform = env['PLATFORM'] - -# Setup environment for nasm -env.Replace (AS = 'nasm') -env.Replace (ASFLAGS = '-f elf ') - -#sdl_config = Builder (action = 'sdl-config --include') - -# Run config tests. -conf = Configure (env) - -# Must have SDL to compile -if not conf.CheckLib ('SDL', 'SDL_Init'): - print 'SDL not found! Please install SDL and try again.' - Exit (1) - -if not conf.CheckLib ('png'): - print 'libpng not found! Please install libpng and try again.' - Exit (1) - -if not conf.CheckLib ('z'): - print 'zlib not found! Please install zlib and try again.' - Exit (1) - -# Check for nasm's existence -if not conf.TryCompile ('db __NASM_VER__', '.asm'): - print 'NASM not found! Please install NASM and try again.' - Exit (1) - -env = conf.Finish () - -# Perform any platform-specific initialization -if platform == 'posix': - src = chipssrc + cpusrc + dossrc + effectssrc + guisrc + videosrc + zipsrc + jmasrc + linuxsrc + basesrc - env.Append (CCFLAGS = '-D__UNIXSDL__') - env.Append (ASFLAGS = '-DELF -D__UNIXSDL__') - env.Append (CCFLAGS = '-I.') - env.Append (CCFLAGS = '-I/usr/include/SDL') - - #Build ZSNES - env.Program('zsnes',src) - -if platform == 'win32': - if env['CC'] == 'cl': - def freeMSVCHack(env, vclibs): - # SCons automatically finds full versions of msvc via the registry, so - # if it can't find 'cl', it may be because we're trying to use the - # free version - def isMicrosoftSDKDir(dir): - return os.path.exists(dir+os.sep+'Include'+os.sep+'Windows.h') and os.path.exists(dir+os.sep+'Lib'+os.sep+'WinMM.lib') - - def findMicrosoftSDK(): - import SCons.Platform.win32 - import SCons.Util - import re - if not SCons.Util.can_read_reg: - return None - HLM = SCons.Util.HKEY_LOCAL_MACHINE - K = r'Software\Microsoft\.NETFramework\AssemblyFolders\PSDK Assemblies' - try: - k = SCons.Util.RegOpenKeyEx(HLM, K) - p = SCons.Util.RegQueryValueEx(k,'')[0] - # this should have \include at the end, so chop that off - p = re.sub(r'(?i)\\+Include\\*$','',p) - if isMicrosoftSDKDir(p): return p - except SCons.Util.RegError: - pass - - K = r'SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs' - try: - k = SCons.Util.RegOpenKeyEx(HLM, K) - i=0 - while 1: - p = SCons.Util.RegEnumKey(k,i) - i+=1 - subk = SCons.Util.RegOpenKeyEx(k, p) - try: - p = SCons.Util.RegQueryValueEx(subk,'Install Dir')[0] - # trim trailing backslashes - p = re.sub(r'\\*$','',p) - if isMicrosoftSDKDir(p): return p - except SCons.Util.RegError: - pass - except SCons.Util.RegError: - pass - - return None - - # End of local defs. Actual freeMSVCHack begins here - if not env['MSVS'].get('VCINSTALLDIR'): - if os.environ.get('VCToolkitInstallDir'): - vcdir=os.environ['VCToolkitInstallDir'] - env.PrependENVPath('INCLUDE', vcdir+os.sep+'Include') - env.PrependENVPath('LIB', vcdir+os.sep+'Lib') - env.PrependENVPath('PATH', vcdir+os.sep+'Bin') - env['MSVS']['VERSION'] = '7.1' - env['MSVS']['VERSIONS'] = ['7.1'] - if not env['MSVS'].get('PLATFORMSDKDIR'): - sdkdir = findMicrosoftSDK() - if sdkdir: - env.PrependENVPath('INCLUDE', sdkdir+os.sep+'Include') - env.PrependENVPath('LIB', sdkdir+os.sep+'Lib') - env.PrependENVPath('PATH', sdkdir+os.sep+'Bin') - env['MSVS']['PLATFORMSDKDIR']=sdkdir - # FREE MSVC7 only allows - # /ML(libc) /MT(libcmt) or /MLd(libcd) - # Full IDE versions also have - # /MD(msvcrtd) /MTd(libcmtd) and /MDd(msvcrtd) - # So if you want to debug with the freever, the only option is - # the single-threaded lib, /MLd - vclibs['Debug']='/MLd' - vclibs['Release']='/MT' - - # MSVC SETUP - # MDd is for multithreaded debug dll CRT (msvcrtd) - # MD is for multithreaded dll CRT (msvcrt) - # These are just my preferences - vclibs = {'Debug':'/MDd','Release':'/MD'} - freeMSVCHack(env, vclibs) - - env.Append(CCFLAGS=[vclibs[variant]]) - if debug: - env.Append(CCFLAGS=Split('/Zi /Fd${TARGET}.pdb')) - env.Append(LINKFLAGS = ['/DEBUG']) - # env.Clean('.', '${TARGET}.pdb') - # Need to clean .pdbs somehow! The above line doesn't work! - else: - env.Append(CCFLAGS=Split('/Og /Ot /Ob1 /Op /G6')) - - env.Append(CCFLAGS=Split('/EHsc /J /W3 /Gd')) - env.Append(CPPDEFINES=Split('WIN32 _WINDOWS')) - src = chipssrc + cpusrc + dossrc + effectssrc + guisrc + videosrc + zipsrc + jmasrc + winsrc - env.Append (CCFLAGS = '-D__WIN32__') - env.Append (ASFLAGS = '-f win32') - - #Build ZSNESW - env.Program('zsnesw.exe',src) - else: - if debug: - env.Append (CCFLAGS = '-g -D__WIN32__') - env.Append (CCFLAGS = '-D__WIN32__') - env.Append (ASFLAGS = '-f win32 -O0') - else: - env.Append (CCFLAGS = '-D__WIN32__') - env.Append (CCFLAGS = '-f win32') - - #Build ZSNESW - env.Program('zsnesw.exe',src) \ No newline at end of file diff --git a/tools/zsnes/src/acinclude.m4 b/tools/zsnes/src/acinclude.m4 deleted file mode 100644 index ced9c42..0000000 --- a/tools/zsnes/src/acinclude.m4 +++ /dev/null @@ -1,314 +0,0 @@ -#Copyright (C) 1997-2007 ZSNES Team ( theoddone33, grinvader, Nach ) -# -#http://www.zsnes.com -#http://sourceforge.net/projects/zsnes -#https://zsnes.bountysource.com -# -#This program is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public License -#version 2 as published by the Free Software Foundation. -# -#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. - -dnl -- Begin zlib autoconf macro -dnl When copying, include from Begin to End zlib autoconf macro, including -dnl those tags, so others can easily copy it too. (Maybe someday this will -dnl become zlib.m4?) -dnl -dnl AM_PATH_ZLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Tests for zlib, outputs ZLIB_VERSION, ZLIB_LIBS, and ZLIB_CFLAGS -AC_DEFUN([AM_PATH_ZLIB], -[dnl -dnl -dnl -AC_ARG_WITH(zlib-prefix, - [ --with-zlib-prefix=PFX Prefix where zlib is installed (optional)], - zlib_prefix="$withval", - zlib_prefix="") -min_zlib_version=ifelse([$1],,1.1.0,$1) -AC_MSG_CHECKING(for zlib - version >= $min_zlib_version) - -tempLIBS="$LIBS" -tempCFLAGS="$CFLAGS" -if test x$zlib_prefix != x ; then - ZLIB_LIBS="-L$zlib_prefix" - ZLIB_CFLAGS="-I$zlib_prefix" -fi -ZLIB_LIBS="$ZLIB_LIBS -lz" -LIBS="$LIBS $ZLIB_LIBS" -CFLAGS="$CFLAGS $ZLIB_CFLAGS" - -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include -#include -#include - -char* my_strdup (char *str) -{ - char *new_str; - - if (str) - { - new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); - } - else new_str = NULL; - - return new_str; -} - -int main (int argc, char *argv[]) -{ - int major, minor, micro, zlib_major_version, zlib_minor_version, zlib_micro_version; - - char *zlibver, *tmp_version; - - zlibver = ZLIB_VERSION; - - FILE *fp = fopen("conf.zlibtest", "a"); - if ( fp ) { - fprintf(fp, "%s", zlibver); - fclose(fp); - } - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup("$min_zlib_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string for\n\tmin_zlib_version... ", "$min_zlib_version"); - exit(1); - } - if (sscanf(zlibver, "%d.%d.%d", &zlib_major_version, &zlib_minor_version, &zlib_micro_version) != 3) { - printf("%s, bad version string given\n", zlibver); - puts("\tby zlib, sometimes due to very old zlibs that didnt correctly"); - printf("\tdefine their version. Please upgrade if you are running an\n\told zlib... "); - exit(1); - } - - if ((zlib_major_version > major) || - ((zlib_major_version == major) && (zlib_minor_version > minor)) || - ((zlib_major_version == major) && (zlib_minor_version == minor) && (zlib_micro_version >= micro))) - { - return 0; - } - else - { - return 1; - } -} -]])], - with_zlib=yes, - with_zlib=no, - [AC_MSG_RESULT(cross-compiling) - with_zlib="" - AC_MSG_WARN(Assuming zlib is available)]) - -if test x$with_zlib != x; then - AC_MSG_RESULT($with_zlib) -fi -if test x$with_zlib = xyes; then - ZLIB_VERSION=$(= 1.0.0 is required) for the -dnl ACTION-IF-NOT-FOUND if you plan on disabling user choice. - -dnl <--- disable for no user choice part #1 -AC_ARG_ENABLE(libpng, - [ --disable-libpng Build without libpng support ], - , - enable_libpng=yes) -dnl ---> - -AC_ARG_WITH(libpng-prefix, - [ --with-libpng-prefix=PFX Prefix where libpng is installed (optional)], - libpng_prefix="$withval", - libpng_prefix="") - -min_libpng_version=ifelse([$1], ,1.2.0,$1) -tempLIBS="$LIBS" -tempCFLAGS="$CFLAGS" -if test x$libpng_prefix != x ; then - LIBPNG_LIBS="-L$libpng_prefix" - LIBPNG_CFLAGS="-I$libpng_prefix" -fi -LIBPNG_LIBS="$LIBPNG_LIBS -lpng -lm" -LIBS="$LIBS $LIBPNG_LIBS" -CFLAGS="$CFLAGS $LIBPNG_CFLAGS" - -AC_MSG_CHECKING(for libpng - version >= $min_libpng_version) - -dnl <--- disable for no user choice part #2 -if test x$enable_libpng != xno; then -dnl ---> - - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include -#include -#include - -char* my_strdup (char *str) -{ - char *new_str; - - if (str) - { - new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); - } - else new_str = NULL; - - return new_str; -} - -int main (int argc, char *argv[]) -{ - int major, minor, micro, libpng_major_version, libpng_minor_version, libpng_micro_version; - char *libpngver, *tmp_version; - - libpngver = PNG_LIBPNG_VER_STRING; - - FILE *fp = fopen("conf.libpngtest", "a"); - if ( fp ) { - fprintf(fp, "%s", libpngver); - fclose(fp); - } - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup("$min_libpng_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string for\n\tmin_libpng_version... ", "$min_libpng_version"); - exit(1); - } - if (sscanf(libpngver, "%d.%d.%d", &libpng_major_version, &libpng_minor_version, &libpng_micro_version) != 3) { - printf("%s, bad version string given\n", libpngver); - puts("\tby libpng, sometimes due to very old libpngs that didnt correctly"); - printf("\tdefine their version. Please upgrade if you are running an\n\told libpng... "); - exit(1); - } - if ((libpng_major_version > major) || - ((libpng_major_version == major) && (libpng_minor_version > minor)) || - ((libpng_major_version == major) && (libpng_minor_version == minor) && (libpng_micro_version >= micro))) - { - return 0; - } - else - { - return 1; - } -} - ]])], - with_libpng=yes, - with_libpng=no, - [AC_MSG_RESULT(cross-compiling) - with_libpng="" - AC_MSG_WARN(Assuming libpng is available)]) - - if test x$with_libpng != x; then - AC_MSG_RESULT($with_libpng) - fi - if test x$with_libpng = xyes; then - LIBPNG_VERSION=$( -]) -dnl -- End libpng autoconf macro - -dnl ---- - -dnl -- Begin custom tools use -dnl -AC_DEFUN([AM_ARCH_DETECT], -[ -AC_MSG_CHECKING(for cpu info) -AC_ARG_ENABLE(cpucheck, - [ --disable-cpucheck Do not try to autodetect cpu architecture ], - , - enable_cpucheck=yes) - -if test x$enable_cpucheck != xno; then - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include - -int main() -{ - int check; - system("$CC -O3 -o tools/archopt tools/archopt.c"); - check = system("tools/archopt > conf.archchk"); - return((check) ? 1:0); -} - ]])], - cpu_test=found, - cpu_test=failed, - [AC_MSG_RESULT(cross-compiling) - cpu_test="" - AC_MSG_WARN(You should use --target)]) - - if test x$cpu_test != x; then - AC_MSG_RESULT($cpu_test) - fi - if test x$cpu_test = xfound; then - ARCH_INFO=$( 1) && ((*str == '\"') || (*str == '\'')) && (str[str_len-1] == *str)) - { - memmove(str, str+1, str_len-2); - str[str_len-2] = 0; - } - - while (*str) - { - if (*str == '\\') - { - str++; - } - dest[i++] = *str++; - } - dest[i] = 0; - return(dest); -} - -static char *find_next_match(char *str, char match_char) -{ - char *pos = 0; - - while (*str) - { - if (*str == match_char) - { - pos = str; - break; - } - if (*str == '\\') - { - if (str[1]) - { - str++; - } - else - { - break; - } - } - str++; - } - return(pos); -} - -static char *get_param(char *str) -{ - static char *pos = 0; - char *token = 0; - - if (str) //Start a new string? - { - pos = str; - } - - if (pos) - { - //Skip delimiters - while (*pos == ' ') { pos++; } - if (*pos) - { - token = pos; - - //Skip non-delimiters - while (*pos && (*pos != ' ')) - { - //Skip quoted characters - if ((*pos == '\"') || (*pos == '\'')) - { - char *match_pos = 0; - if ((match_pos = find_next_match(pos+1, *pos))) - { - pos = match_pos; - } - } - //Skip escaped spaces - if (*pos == '\\') { pos++; } - pos++; - } - if (*pos) { *pos++ = '\0'; } - } - } - return(token); -} - -static size_t count_param(char *str) -{ - size_t i = 0; - - while (*str) - { - //Skip delimiters - while (*str == ' ') { str++; } - //Skip non-delimiters - while (*str && (*str != ' ')) - { - //Skip quoted characters - if ((*str == '\"') || (*str == '\'')) - { - char *match_str = 0; - if ((match_str = find_next_match(str+1, *str))) - { - str = match_str; - } - } - //Skip escaped spaces - if (*str == '\\') { str++; } - str++; - } - i++; - } - return(i); -} - -static char **build_argv(char *str) -{ - size_t argc = count_param(str); - char **argv = (char **)malloc(sizeof(char *)*(argc+1)); - - if (argv) - { - char *p, **argp = argv; - for (p = get_param(str); p; p = get_param(0), argp++) - { - *argp = decode_string(p); - } - *argp = 0; - return(argv); - } - return(0); -} - -/* -static void argv_print(char **argv) -{ - char **argp = argv; - while (*argp) - { - printf("argv[%u]: %s\n", argp-argv, *argp); - argp++; - } - printf("argv[%u]: NULL\n", argp-argv); -} -*/ - -#endif diff --git a/tools/zsnes/src/asm_call.h b/tools/zsnes/src/asm_call.h deleted file mode 100644 index 09890bf..0000000 --- a/tools/zsnes/src/asm_call.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - -/* -Introducing 'the "DJGPP/MinGW/MSVC/GCC on *nix compatible" call asm function -safely from C/C++' macro function! - -Usage: - asm_call( func_name ); - -That's all there is to it!!! - - -Note: Make sure this is used on a line by itself if the file will ever be -compiled with MSVC, since it's preproccessor won't parse the inline -assembly correctly if other stuff are on the line - -Note: This will not work with GCC when using the parameter -MASM=intel -I'd fix that if anyone knows if that parameter defines something I can check - --Nach -*/ - -#ifndef ASM_CALL_H -#define ASM_CALL_H -//////////////////////////////////////////////////////// - -#ifdef __GNUC__ - -#define ASM_COMMAND(line) #line"\n\t" - -#ifdef __x86_64__ -#define PUSHAD ASM_COMMAND(pushq %rax) \ - ASM_COMMAND(pushq %rcx) \ - ASM_COMMAND(pushq %rdx) \ - ASM_COMMAND(pushq %rbx) \ - ASM_COMMAND(pushq %rsp) \ - ASM_COMMAND(pushq %rbp) \ - ASM_COMMAND(pushq %rsi) \ - ASM_COMMAND(pushq %rdi) - -#define POPAD ASM_COMMAND(popq %rdi) \ - ASM_COMMAND(popq %rsi) \ - ASM_COMMAND(popq %rbp) \ - ASM_COMMAND(popq %rsp) \ - ASM_COMMAND(popq %rbx) \ - ASM_COMMAND(popq %rdx) \ - ASM_COMMAND(popq %rcx) \ - ASM_COMMAND(popq %rax) -#else -#define PUSHAD ASM_COMMAND(pushal) -#define POPAD ASM_COMMAND(popal) -#endif - -#ifdef __ELF__ -#define ASM_CALL(func) ASM_COMMAND(call func) -#else -#define ASM_CALL(func) ASM_COMMAND(call _ ## func) -#endif - -#define asm_call(func) __asm__ __volatile__ ( \ -PUSHAD \ -ASM_CALL(func) \ -POPAD \ -); - -#else //MSVC - -#define asm_call(func) { _asm pushad \ -_asm call func \ -_asm popad }; - -#endif - -//////////////////////////////////////////////////////// -#endif diff --git a/tools/zsnes/src/autogen.sh b/tools/zsnes/src/autogen.sh deleted file mode 100755 index dc83828..0000000 --- a/tools/zsnes/src/autogen.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -echo "Generating build information using aclocal and autoconf..." - -# Regenerate configuration files -aclocal --acdir=`sdl-config --prefix`/share/aclocal # thanks asfand -autoconf - -# Run configure for this platform, or simply update Makefile -case $1 in - --noconf ) - break ;; - --recheck ) - ./config.status --recheck; break ;; - * ) - ./configure $*; break ;; -esac diff --git a/tools/zsnes/src/cfg.psr b/tools/zsnes/src/cfg.psr deleted file mode 100644 index 10c9f58..0000000 --- a/tools/zsnes/src/cfg.psr +++ /dev/null @@ -1,1011 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -@ PSR-produced config file (stock default in CAPS) -@ -@ Note, if you're worried you messed up a setting, removing the line will have -@ ZSNES use the default settings for that option. -@ The next time ZSNES is run, the line will reappear with the default settings. - -@ -@ ---- -@ -- Input -- -@ ---- - -@ -@ For other input settings see zinput.cfg - -@ -@ Enable Game-Specific Key Combos (0 = NO, 1 = Yes) -GUIComboGameSpec db 0 - -@ -@ Enable Game-Specific Key Input (0 = NO, 1 = Yes) -GameSpecificInput db 0 - -@ -@ ---- -@ -- Options -- -@ ---- - -@ -@ Allow MMX Support (0 = No, 1 = YES) -@ Disable this only if you actually do NOT have a processor that supports MMX. -@ Disabling this option will prevent you from using some of the more advanced -@ video/sound filters. -AllowMMX db 1 - -%ifdef __WIN32__ -@ -@ Pause Emulation when ZSNES is Out of Focus (0 = NO, 1 = Yes) -PauseFocusChange db 0 - -@ -@ Increase Priority of ZSNES (0 = NO, 1 = Yes) -@ Enable this if it improves performance. This option is not for everyone. -@ This may cause other background apps to be sluggish. -@ The priority in Win9x will be High, Win2k will be Above Normal. -HighPriority db 0 - -@ -@ Disable Power Management while ZSNES Runs (0 = No, 1 = YES) -@ This is very necessary for gamepad users. -DisableScreenSaver db 1 -%endif - -@ -@ Enable New Graphics Engine (0 = No, 1 = YES) -@ Toggle off when there are graphical problems in the new graphics engine -newengen db 1 - -@ -@ Enable Older Graphics Engine Tweak for Mode 2 (0 = NO, 1 = Yes) -@ Enable this to see if it helps with rendering problems -@ Only works with old graphic engine -bgfixer db 0 - -@ -%ifndef NO_PNG -@ Snapshot Format (0 = BMP, 1 = PNG) -%ifdef __MSDOS__ -@ Note: in 8 bit video modes PNG is not selectable -%endif -%else -@ Snapshot Format (0 = BMP) -%endif -ScreenShotFormat db 0 - -@ -@ Auto-Patch ROM with IPS (0 = No, 1 = YES) -AutoPatch db 1 - -@ -@ Display ROM Info on Load (0 = No, 1 = YES) -DisplayInfo db 1 - -@ -@ Log Info About the Last ROM Loaded to rominfo.txt (0 = No, 1 = YES) -RomInfo db 1 - -@ -@ Enable FPS Counter when ZSNES is Started (0 = NO, 1 = Yes) -@ This option is disabled when manual frameskip is in use. -FPSAtStart db 0 - -@ -@ Display Clock (0 = NO, 1 = Yes) -TimerEnable db 0 - -@ -@ Change Clock Mode (0 = 24 HOUR, 1 = 12 Hour) -TwelveHourClock db 0 - -@ -@ Display Black Box Around Clock (0 = No, 1 = YES) -ClockBox db 1 - -@ -@ Use Small Font for Messages (0 = NO, 1 = Yes) -SmallMsgText db 0 - -@ -@ Transparent Messages - doesn't work with small font (0 = NO, 1 = Yes) -GUIEnableTransp db 0 - -@ -@ ---- -@ -- Video -- -@ ---- - -%ifdef __MSDOS__ -@ -@ Force Black Background (0 = NO, 1 = Yes) -@ This is necessary to get a black background. -@ This can cause rendering problems in certain games. -@ Only applicable for 8-bit modes. -Palette0 db 0 -%endif - -@ -#ifdef __WIN32__ -@ Video Mode [0..42] -@ 0 = 256x224 R WIN 1 = 256x224 R FULL -@ 2 = 512x448 R WIN 3 = 512x448 DR WIN -@ 4 = 640x480 S WIN 5 = 640x480 DS WIN -@ 6 = 640x480 DR FULL 7 = 640x480 DS FULL -@ 8 = 640x480 S FULL 9 = 768x672 R WIN -@ 10 = 768x672 DR WIN 11 = 800x600 S WIN -@ 12 = 800x600 DS WIN 13 = 800x600 S FULL -@ 14 = 800x600 DR FULL 15 = 800x600 DS FULL -@ 16 = 1024x768 S WIN 17 = 1024x768 DS WIN -@ 18 = 1024x768 S FULL 19 = 1024x768 DR FULL -@ 20 = 1024x768 DS FULL 21 = 1024x896 R WIN -@ 22 = 1024x896 DR WIN 23 = 1280x960 S WIN -@ 24 = 1280x960 DS WIN 25 = 1280x960 S FULL -@ 26 = 1280x960 DR FULL 27 = 1280x960 DS FULL -@ 28 = 1280x1024 S WIN 29 = 1280x1024 DS WIN -@ 30 = 1280x1024 S FULL 31 = 1280x1024 DR FULL -@ 32 = 1280x1024 DS FULL 33 = 1600x1200 S WIN -@ 34 = 1600x1200 DS WIN 35 = 1600x1200 DR FULL -@ 36 = 1600x1200 DS FULL 37 = 1600x1200 S FULL -@ 38 = CUSTOM D WIN 39 = CUSTOM DS FULL -@ 40 = CUSTOM WIN 41 = CUSTOM S FULL -@ 42 = CUSTOM DR FULL -@ You need to select one of the custom video modes and modify CustomResX/Y to -@ properly use custom res support. -@ WARNING: Custom resolutions are only valid if they are supported by your system! -@ ZSNES will hang if an invalid fullscreen resolution is used. -cvidmode db 2 -@ Last windowed & fullscreen modes (used when alt-tabbing) -PrevWinMode db 2 -PrevFSMode db 6 - -#elifdef __UNIXSDL__ - -%ifndef __OPENGL__ -@ Video Mode [0..4] -%else -@ Video Mode [0..22] -%endif -@ 0 = 256x224 R WIN 1 = 256x224 R FULL -@ 2 = 512x448 DR WIN 3 = 512x448 DR FULL -@ 4 = 640x480 DR FULL -%ifdef __OPENGL__ -@ 5 = 256x224 O R WIN 6 = 512x448 ODR WIN -@ 7 = 640x480 ODS FULL 8 = 640x480 ODS WIN -@ 9 = 640x560 ODR WIN 10 = 768x672 ODR WIN -@ 11 = 800x600 ODS FULL 12 = 800x600 ODS WIN -@ 13 = 896x784 ODR WIN 14 = 1024x768 ODS FULL -@ 15 = 1024x768 ODS WIN 16 = 1024x896 ODR WIN -@ 17 = 1280x960 ODS FULL 18 = 1280x1024 ODS FULL -@ 19 = 1600x1200 ODS FULL 20 = VARIABLE ODR WIN -@ 21 = VARIABLE ODS WIN 22 = CUSTOM OD FULL -@ You need to select the custom video mode and modify CustomResX/Y to properly -@ use custom res support. -%endif -cvidmode db 2 -@ Last windowed & fullscreen modes (used when alt-tabbing) -PrevWinMode db 2 -PrevFSMode db 3 - -#elifdef __MSDOS__ -@ Video Mode [0..18] -@ 0 = 256x224x8B MODEQ 1 = 256x240x8B MODEQ -@ 2 = 256x256x8B MODEQ 3 = 320x224x8B MODEX -@ 4 = 320x240x8B MODEX 5 = 320x256x8B MODEX -@ 6 = 640x480x16B VESA1 7 = 320x240x8B VESA2 -@ 8 = 320x240x16B VESA2 9 = 320x480x8B VESA2 -@ 10 = 320x480x16B VESA2 11 = 512x384x8B VESA2 -@ 12 = 512x384x16B VESA2 13 = 640x400x8B VESA2 -@ 14 = 640x400x16B VESA2 15 = 640x480x8B VESA2 -@ 16 = 640x480x16B VESA2 17 = 800x600x8B VESA2 -@ 18 = 800x600x16B VESA2 -cvidmode db 4 -#endif - -%ifndef __MSDOS__ -@ -@ Custom Resolution X and Y for Custom Video Modes [256x224..2048x1536] -CustomResX dd 640 -CustomResY dd 480 -%endif - -@ -%ifdef __OPENGL__ -@ Enable Video Interpolation, Bilinear Filtering (0 = NO, 1 = Yes) -@ Bilinear Filtering is compatible with all filters except NTSC. -@ Bilinear Filtering replaces Interpolation and is OpenGL only. -%else -@ Enable Video Interpolation (0 = NO, 1 = Yes) -%endif -@ Video Interpolation is compatible with scanlines. -@ Blends the neighboring pixels on the screen to eliminate pixelation. -%ifdef __MSDOS__ -@ Available in most VESA2 16-bit modes -@ Note: This option enables the Eagle filter in the VESA2 640x480 8-bit mode. -%endif -antienab db 0 -%ifdef __OPENGL__ -BilinearFilter db 0 -%endif - -@ -%ifndef __MSDOS__ -@ Enable NTSC Filter (0 = NO, 1 = Yes) -@ Enable Blargg's wonderful NTSC filter which simulates the artifacts of an -@ NTSC TV set - it is probably not a good idea to use with TV-out -@ Recommended to use a minimum res of 602x448 -%else -@ The NTSC filter is not available for DOS at the moment, sorry. -%endif -NTSCFilter db 0 -%ifndef __MSDOS__ -@ Blend Frames, Refresh Screen (0 = OFF, 1 = On) -@ Blend Frames allows smoother transitions between frames for non-60Hz refresh rates. -@ Refresh Screen allows the screen to be updated while changing the filter's parameters. -%endif -NTSCBlend db 0 -NTSCRef db 0 -%ifndef __MSDOS__ -@ NTSC TV Attributes [-100..100] -%endif -NTSCHue sb 0 -NTSCSat sb 0 -NTSCCont sb 0 -NTSCBright sb 0 -NTSCSharp sb 0 -NTSCGamma sb 0 -NTSCRes sb 0 -NTSCArt sb 0 -NTSCFringe sb 0 -NTSCBleed sb 0 -NTSCWarp sb 0 - -@ -@ Enable Kreed's 2x Filters (0 = NONE, 1 = 2xSaI, 2 = Super Eagle, 3 = Super 2xSaI) -@ These are Kreed's various 2x filters. They do not exhibit the same level of -@ blurring than interpolation/bilinear. MMX support is required. -@ This is disabled when other filters are used. -En2xSaI db 0 - -@ -%ifndef __MSDOS__ -@ Use HQ*x Filter (0 = NO, 1 = Yes) -@ This is a filter MaxSt has created. These are very CPU intensive filters that -@ do very awesome blending to remove the pixelation. -@ This is disabled when other filters are used. MMX support is required. -%else -@ The HQ*x filter is not available for DOS at the moment, sorry. -%endif -hqFilter db 0 -%ifndef __MSDOS__ -@ Set HQ*x level [2..4] -@ Recommended min resolutions -@ HQ2x = 512x448 -@ HQ3x = 768x672 -@ HQ4x = 1024x896 -%ifdef __OPENGL_ -@ HQ2x is only available for OpenGL. -%endif -hqFilterlevel db 2 -%endif - -@ -@ Enable Scanlines (0 = NONE, 1 = Full, 2 = 25%, 3 = 50%) - simulate TV scanlines -@ This is compatible with interpolation. -#ifdef __MSDOS__ -@ 256x256 or 640x480 8bit modes only (25% and 50% in 640x480 16bit mode only) -#endif -scanlines db 0 - -@ -@ Enable Grayscale Mode (0 = NO, 1 = Yes) - don't enable this for other than nostalgia -@ The whole screen is displayed in monochrome color. -GrayscaleMode db 0 - -@ -@ Enable High-Res Mode 7 (0 = NO, 1 = Yes) -@ Doubles the internal resolution of the image when Mode 7 is in use -@ However this disables most filters, except for interpolation. -@ This is only useful in certain games and is not useful in general. -@ Requires a minimum res of 512x448 -Mode7HiRes16b dd 0 - -#ifndef __UNIXSDL__ -@ -@ Sync Frames to Monitor Refresh Rate (0 = NO, 1 = Yes) -@ Do not enable if you cannot normally sustain 60fps -vsyncon db 0 - -@ -@ Use Triple Buffering (0 = NO, 1 = Yes) - replaces vsync -@ This is usually more beneficial than VSync. -#endif -#ifdef __WIN32__ -@ This is not available in Windowed modes. -TripleBufferWin db 0 -#elifdef __MSDOS__ -Triplebufen db 0 -#endif - -%ifdef __WIN32__ -@ -@ Force Refresh Rate (0 = NO, 1 = Yes) -@ Enable this if you are experiencing visual tearing -@ WARNING: Setting a refresh rate that your monitor cannot handle will have -@ consequences! The DX Refresh Rate Override in dxdiag must be set to default -@ in order for this to work! The refresh rate is only valid if it is supported -@ by your system! This option is only useful in fullscreen modes. -ForceRefreshRate db 0 -SetRefreshRate db 60 - -@ -@ Enable KitchenSync/KitchenSyncPAL (0 = NO, 1 = Yes) -@ When enabled, ZSNES will use double the refresh rate of the game and use -@ half of it to sync with the game to reduce/prevent visual tearing. -@ You can enable this if your video card/monitor AND current ZSNES resolution -@ supports 100Hz (for PAL games) and 120Hz (for NTSC games) -@ KitchenSyncPAL applies to PAL games only, use KitchenSync for PAL+NTSC games. -@ WARNING: The DX Refresh Rate Override in dxdiag must be set to default in -@ order for this to work! -@ This option is completely useless in a non-fullscreen mode. -KitchenSync db 0 -KitchenSyncPAL db 0 -%endif - -%ifndef __MSDOS__ -@ -@ Keep 4:3 Ratio (0 = No, 1 = YES) -@ This is particularly handy for those that use laptops/LCDs+non 4:3 resolutions. -%ifdef __WIN32__ -@ This can be used for any S/DS mode and any Custom Windowed mode. -%elifdef __UNIXSDL__ -@ This can be used for Variable ODS Windowed and Custom Res OD Fullscreen. -%endif -@ It is not recommended to enable this while under 298x224. -@ Disable this if you want to use the non-standard ratio instead. -Keep4_3Ratio db 1 - -%else -@ -@ Small Screen, Stretch Screen (0 = NO, 1 = Yes) -@ Enabling small screen will render in 256x224 res (probably not a good idea). -@ Enabling stretch screen will stretch the image to fill the screen. -smallscreenon dd 0 -ScreenScale db 0 -%endif - -@ -@ Set Gamma Level [0..15] -gammalevel db 0 - -@ -@ ---- -@ -- Sound -- -@ ---- - -%ifdef __UNIXSDL__ -@ -@ libAO driver to use. Use zsnes --help to see valid list. -@ However "auto" (to automatically pick best one), and "sdl" should -@ always be available. -libAoDriver times 10 db "auto" -%endif - -@ -@ Disable SPC Emulation (0 = NO, 1 = Yes) -@ Disabling SPC emulation can improve performance, but at the expense of -@ emulation accuracy. There will be no sound output and games might crash. -SPCDisable db 0 - -@ -@ Enable Sound Emulation (0 = Off, 1 = ON) - disable if you need the performance -@ If SPC emulation is disabled, there will be no sound output. -soundon db 1 - -@ -@ Enable Stereo Sound (0 = Off, 1 = ON) - disable if you need the performance -StereoSound db 1 - -@ -@ Swap Left Audio Channel w/Right (0 = NO, 1 = Yes) -RevStereo db 0 - -@ -@ Simulate Surround Sound (0 = NO, 1 = Yes) -@ Enable a simulated 2 speaker surround sound effect. -@ Do not enable if playing a game that has its own surround sound effects. -@ Stereo Sound must be enabled for this to work. -Surround db 0 - -%ifdef __WIN32__ -@ -@ Use Primary Sound Buffer (0 = NO, 1 = Yes) -@ Enable this if you are experiencing sound playback/static problems. -PrimaryBuffer db 0 -%endif - -#ifdef __MSDOS__ -@ -@ Force 8-bit Sound (0 = NO, 1 = Yes) -@ Enable this option if your sound card is producing nothing or static. -@ This will limit the max frequency while using Stereo sound to 22KHz -Force8b db 0 -#endif - -@ -@ Sampling Rate: (0 = 8000Hz, 1 = 11025Hz, 2 = 22050Hz, 3 = 44100Hz, -@ 4 = 16000Hz, 5 = 32000Hz, 6 = 48000Hz) -@ Using any other sound frequencies other than the default 32000Hz -@ is COMPLETELY UNACCEPTABLE in use for sound bug reports. -#ifdef __MSDOS__ -@ Forcing 8-bit sound will limit the max sampling rate while using Stereo sound -@ to 22KHz -#endif -SoundQuality dd 5 - -@ -@ Sound Volume Level [0..100] -MusicRelVol db 100 - -@ -@ Enable Sound Interpolation (0 = None, 1 = GAUSSIAN, 2 = Cubic, 3 = 8-point) -@ Sound interpolation smooths out the waveform of lower frequency sounds. -@ Using any other setting other than the default Gaussian interpolation is -@ COMPLETELY UNACCEPTABLE in sound bug reports. -SoundInterpType db 1 - -@ -@ Enable Low-Pass Filter (0 = NONE, 1 = Simple, 2 = Dynamic, 3 = Hi-quality) -@ A low-pass filter improves the bass in the sounds. -@ This is useful if you have a Subwoofer. -LowPassFilterType db 0 - -#ifdef __MSDOS__ -@ -@ Display ZSNES Sound Detection Info (0 = NO, 1 = Yes) -DisplayS db 0 -#endif - -@ -@ Disable Echo (0 = NO, 1 = Yes) -@ Disables the echo effect in the sound. -EchoDis db 0 - -@ -@ ---- -@ -- Saves -- -@ ---- - -@ -@ Number of Rewind States [0..99] -RewindStates db 8 -@ Delay between rewinds [1..99] - (1 = 200ms, 5 = 1s, 10 = 2s) -RewindFrames db 15 - -@ -@ Don't Save SRAM (0 = NO, 1 = Yes) -@ Only enable this if you don't want to Save SRAM at any given time. -@ This option will make Update SRAM in Real-Time useless. -nosaveSRAM db 0 - -@ -@ Update SRAM in Real-Time (0 = NO, 1 = Yes) -@ This is useful if you fear something will prevent ZSNES from exiting normally. -@ It is required to play games that store important values directly to SRAM. -@ ZSNES normally updates SRAM on exit. -@ If Don't Save SRAM is enabled, this option is useless. -SRAMSave5Sec db 0 - -@ -@ Load SRAM w/Savestates (0 = No, 1 = YES) -@ Enable this when you want to use the SRM that is stored within the savestate. -@ Warning: You will overwrite the existing SRM that you are currently using. -@ It is required to properly use states with games storing important values -@ directly in SRM. -SRAMState db 1 - -@ -@ Select Latest Save State Slot on Game Load (0 = NO, 1 = Yes) -@ Enable this if you want to load the last saved savestate quickly -@ (via the load savestate button/GUI option) after loading the game. -LatestSave db 0 - -@ -@ Auto Increment State Slot First, then Save State (0 = NO, 1 = Yes) -@ Enable this if you have a tendency in saving accidentally to an existing -@ savestate. -AutoIncSaveSlot db 0 - -@ -@ Save in 10 save block (0 = NO, 1 = Yes) -@ This may be handy if you want to save within a block (0-9, 10-19, etc.) -AutoIncSaveSlotBlock db 0 - -@ -@ Auto State Save/Load (0 = NO, 1 = Yes) - uses a special state -@ Enable this if you wish a special state to be saved on a visit to the GUI. -@ This state will automatically be loaded when you load a game. -AutoState db 0 - -@ -@ Pause Emulation After Loading a Save State (0 = NO, 1 = Yes) -PauseLoad db 0 -@ Pause Emulation After Using Rewind (0 = NO, 1 = Yes) -PauseRewind db 0 - -@ -@ ---- -@ -- Emulation -- -@ ---- - -@ -@ Percent to Execute [50..150] - only modify if you know what you are doing -@ Changing this value may help certain games run. -per2exec dd 100 - -@ -@ Disable Hacks (0 = NO, 1 = Yes) -@ Set this to 1 if you want to disable game specific hacks -HacksDisable db 0 - -@ -@ Frameskip: [0..10] (0 = AUTO, 1-10 = Manual 0-9) -frameskip db 0 - -@ -@ Max Frameskip Allowed for Auto Frameskip [0..9] -maxskip db 9 - -@ -@ Fastforward/Slowdown Keys Behaviour (0 = HELD, 1 = Toggle) -FastFwdToggle db 0 -@ Fastforward/Slowdown Factors [0..28] (0 = factor 2, 28 = factor 30) -FFRatio db 8 -SDRatio db 0 - -@ -@ Emulation Speed Throttle [0..58] (0 = speed/30, 29 = 1x, 58 = 30x) -@ Fast-forward multiplicator is currently inaccurate -EmuSpeed db 29 - -@ -@ ---- -@ -- Paths -- -@ ---- - -@ It is suggested to go to GUI->Paths and modify the paths from there. -%ifndef __UNIXSDL__ -@ ROMs drive + directory -@ -@ Note, when entering a path, make sure every backslash is doubled -@ "C:\Games\SNES" for example is incorrect. -@ "C:\\Games\\SNES" is correct. -@ -%else -@ ROMs directory -%endif -%ifdef __MSDOS__ -ROMPath times 256 db "" -@ Save states & SRAMs, snapshots, SPCs -SRAMPath times 256 db "" -SnapPath times 256 db "" -SPCPath times 256 db "" -@ BIOS/base carts (BS-X, Sufami Turbo, Same Game & SD Gundam G-Next) -BSXPath times 256 db "" -STPath times 256 db "" -SGPath times 256 db "" -GNextPath times 256 db "" -@ SPC7110 graphic packs -FEOEZPath times 256 db "" -SJNSPath times 256 db "" -MDHPath times 256 db "" -SPL4Path times 256 db "" -%else -ROMPath times 1024 db "" -@ Save states & SRAMs, snapshots, SPCs -SRAMPath times 1024 db "" -SnapPath times 1024 db "" -SPCPath times 1024 db "" -@ BIOS/base carts (BS-X, Sufami Turbo, Same Game & SD Gundam G-Next) -BSXPath times 1024 db "" -STPath times 1024 db "" -SGPath times 1024 db "" -GNextPath times 1024 db "" -@ SPC7110 graphic packs -FEOEZPath times 1024 db "" -SJNSPath times 1024 db "" -MDHPath times 1024 db "" -SPL4Path times 1024 db "" -%endif - -@ -@ ---- -@ -- GUI -- -@ ---- - -@ -@ Disable GUI (0 = NO, 1 = Yes) -guioff db 0 - -@ -@ Show All Files in 'Load Game' Menu (0 = NO, 1 = Yes) -showallext db 0 - -@ -%ifdef __MSDOS__ -@ Filename Display Mode (0 = Win9x Long filename, 1 = Internal header name, 2 = DOS 8.3) -GUIloadfntype db 2 -%else -@ Filename Display Mode (0 = LONG FILENAME, 1 = Internal header name) -GUIloadfntype db 0 -%endif - -@ -@ Recent games played, you shouldn't edit this manually (8.3 / Paths / LFN) -prevloadiname packed 280 db 0 -prevloaddnamel packed 5120 db 0 -prevloadfnamel packed 5120 db 0 - -@ -@ Freeze Recent Games List (0 = NO, 1 = Yes) -prevlfreeze db 0 - -@ -@ Right Mouse Click Enters/Exits GUI (0 = NO, 1 = Yes) -GUIRClick db 0 - -@ -@ Left Handed Mouse Behavior for GUI (0 = NO SWAP, 1 = Swap) -@ (swap left and right buttons) -lhguimouse db 0 - -@ -@ Show Mouse Cursor Shadow (0 = No, 1 = YES) -@ Displays a shadow under the mouse cursor. -mouseshad db 1 - -@ -@ Wrap Mouse Cursor (0 = NO, 1 = Yes) -@ If enabled, the cursor will wrap around to the other side. -%ifndef __MSDOS__ -@ Only useful for Fullscreen modes. -%endif -mousewrap db 0 - -%ifdef __WIN32__ -@ -@ Trap Mouse Cursor in Window (0 = NO, 1 = Yes) -@ Only useful in Windowed modes. -TrapMouseCursor db 0 - -@ -@ Use Mouse Wheel to Scroll (0 = No, 1 = YES) -MouseWheel db 1 -%endif - -@ -@ ESC to Game Menu (0 = No, 1 = YES) -@ If yes, visiting the GUI will have the Game Menu automatically selected. -@ It will also enable the main menu keyboard shortcuts. -esctomenu db 1 - -@ -@ Control the GUI Using Gamepad 1 (0 = NO, 1 = Yes) -JoyPad1Move db 0 - -@ -@ Filter GUI Display (0 = No, 1 = YES) -@ If enabled, the current filter you are using will also filter the GUI. -FilteredGUI db 1 - -@ -@ Use Custom Font (0 = NO, 1 = Yes) -@ The font currently reads off a format as defined by zfile.txt -newfont db 0 - -@ -@ Save GUI Window Positions (0 = NO, 1 = Yes) -savewinpos db 0 - -@ -@ GUI windows X/Y coordinates - GUI setup showing windows # -@ -@ Game Config Cheat Netplay Misc -@ ------------------------------------------------------------------- -@ 1:Load 3:Input 7:Add Code [Internet] 9:Misc Keys -@ Run ------- 7:Browse 10:GUI Opts -@ 12:Reset 17:Devices 13:Search 15:Movie Opt -@ ------- 18:Chip Cfg 16:Key Comb. -@ 14:Save State ------- Save Cfg -@ 2:Open State 4:Options ------- -@ 14:Pick State 5:Video 11:About -@ ------- 6:Sound -@ Quit 19:Paths -@ 20:Saves -@ 21:Speed -@ -@ X positions [-233..254] (windows #0 to #22) -GUIwinposx sd 0, 6,65,33,42, 2,34, 6,64, 8, 8,33,56,64,56, 5, 3,28,48, 6,28,53,0 -@ Y positions [8..221] (windows #0 to #22) -GUIwinposy sd 0,20,70,30,20,20,20,20,30,30,20,20,60,30,60,20,20,60,60,20,30,20,0 - -@ -@ GUI Background Effect -@ (0 = NONE, 1 = Snow, 2 = Water A, 3 = Water B, 4 = Burn, 5 = Smoke) -GUIEffect db 1 - -@ -@ GUI Palette Mods: -@ Background RGB Tint [0..31] -GUIRAdd db 15 -GUIGAdd db 10 -GUIBAdd db 31 -@ Titlebar RGB Tint [0..31] -GUITRAdd db 0 -GUITGAdd db 10 -GUITBAdd db 31 -@ Windows RGB Tint [0..31] -GUIWRAdd db 8 -GUIWGAdd db 8 -GUIWBAdd db 25 - -%ifdef __WIN32__ -@ -@ Main Window Always on Top (0 = NO, 1 = Yes) -AlwaysOnTop db 0 - -@ -@ Save Main Window Position (0 = No, 1 = YES) and X/Y coordinates -SaveMainWindowPos db 1 -MainWindowX sw -1 -MainWindowY sw -1 - -@ -@ Allow Multiple ZSNES Instances at Once (0 = No, 1 = YES) -AllowMultipleInst db 1 -%endif - -@ -@ ---- -@ -- Cheats -- -@ ---- - -@ -@ Autoload .CHT files (0 = NO, 1 = Yes) -@ Enable the use of stored cheat files on load. -AutoLoadCht db 0 - -@ -@ Selected Size Search (0 = 1 BYTE, 1 = 2B, 2 = 3B, 3 = 4B) -CheatSrcByteSize db 0 - -@ -@ Selected Numerical Base (0 = DECIMAL, 1 = Hexadecimal) -CheatSrcByteBase db 0 - -@ -@ Search Type (0 = EXACT VALUE, 1 = Comparative) -CheatSrcSearchType db 0 - -@ -@ Add Code for Most Significant Byte Only (0 = NO, 1 = Yes) -CheatUpperByteOnly db 0 - -@ -@ ---- -@ -- Movies -- -@ ---- - -@ -@ For other input settings see zmovie.cfg - -@ -@ Display Movie Frame # During Record/Replay (0 = NO, 1 = Yes) -MovieDisplayFrame db 0 - -@ -@ Movie Default Start Method (0 = NOW, 1 = Power-On, -@ 2 = Reset, 3 = Power-On without SRAM) -MovieStartMethod db 0 - -@ -@ Switch Modes when Loading a Movie State (0 = NO, 1 = Switch to Record, 2 = Switch to Playback) -MZTForceRTR db 0 - -@ -@ ZMV -> AVI Conversion Mode: (0 = No Video, 1 = Raw Video, 2 = Ffv1, 3 = x264, -@ 4 = XVID, 5 = Custom) -@ The compression codecs can only be used if you provide them yourself. -@ See zmovie.cfg for details. -MovieVideoMode db 4 - -@ -@ Dump Audio Along w/Video (0 = No, 1 = YES) -MovieAudio db 1 - -@ -@ Compress Audio Stream On-The-Fly (0 = No, 1 = YES) -@ The compression codecs can only be used if you provide them yourself. -@ See zmovie.cfg for details. -MovieAudioCompress db 1 - -@ -@ Merge Audio and Video Streams Upon Conversion End (0 = No, 1 = YES) -MovieVideoAudio db 1 - -@ -@ ---- -@ -- Keyboard Hotkeys -- -@ ---- -@ (you shouldn't edit these directly unless you know what you're doing) - -@ -@ Super Scope Keys: -@ Extra Device in Port 1/2 Cycle -KeyExtraEnab1 dd 0 -KeyExtraEnab2 dd 0 - -@ -@ State Keys: -@ Save State / Select Slot Menu / Load State -KeySaveState dd 60 -KeyStateSelct dd 61 -KeyLoadState dd 62 -@ Increase / Decrease Slot # / Direct Slot # Select -KeyIncStateSlot dd 0 -KeyDecStateSlot dd 0 -KeyStateSlc0 dd 0 -KeyStateSlc1 dd 0 -KeyStateSlc2 dd 0 -KeyStateSlc3 dd 0 -KeyStateSlc4 dd 0 -KeyStateSlc5 dd 0 -KeyStateSlc6 dd 0 -KeyStateSlc7 dd 0 -KeyStateSlc8 dd 0 -KeyStateSlc9 dd 0 -@ Rewind -KeyRewind dd 0 - -@ -@ Speed Keys: -@ Fast-Forward, Slow-Motion -KeyFastFrwrd dd 41 -KeySlowDown dd 0 -@ Frame Rate Up/Down (Manual Frameskip) -KeyFRateUp dd 0 -KeyFRateDown dd 0 -@ Speed Throttle Up/Down/Reset to Normal (Auto Frameskip) -KeyEmuSpeedUp dd 0 -KeyEmuSpeedDown dd 0 -KeyResetSpeed dd 0 - -@ -@ Pause Emulation, Frame Advance Keys -EMUPauseKey dd 25 -INCRFrameKey dd 0 - -@ -@ Shortcuts: -@ BG 0-3, Sprite Layer Display Toggles -KeyBGDisble0 dd 2 -KeyBGDisble1 dd 3 -KeyBGDisble2 dd 4 -KeyBGDisble3 dd 5 -KeySprDisble dd 6 - -@ -@ Sound Channel 0-7 Output Toggles -KeyDisableSC0 dd 63 -KeyDisableSC1 dd 64 -KeyDisableSC2 dd 65 -KeyDisableSC3 dd 66 -KeyDisableSC4 dd 67 -KeyDisableSC5 dd 68 -KeyDisableSC6 dd 87 -KeyDisableSC7 dd 88 - -@ -@ Sound Volume Up/Down -KeyVolUp dd 0 -KeyVolDown dd 0 - -@ -@ Quit ZSNES / Load Menu / Reset Game / Panic Key -KeyQuickExit dd 0 -KeyQuickLoad dd 0 -KeyQuickRst dd 0 -KeyResetAll dd 7 - -@ -@ Clock Display Toggle -KeyQuickClock dd 0 - -@ -@ Netplay In-Game Chat -KeyQuickChat dd 20 - -@ -@ Screenshot Hotkey -KeyQuickSnapShot dd 0 - -@ -@ Capture SPC Hotkey -KeyQuickSaveSPC dd 0 - -@ -@ Use Player 3/4 Input as Player 1/2's Toggle -KeyUsePlayer1234 dd 0 - -@ -@ FPS Display Toggle -KeyDisplayFPS dd 0 - -@ -@ Laptop Battery Display Toggle -KeyDisplayBatt dd 0 - -@ -@ Video Engine: Old/New Graphic Engine | Windowing | Offset Effects Toggles -KeyNewGfxSwt dd 9 -KeyWinDisble dd 10 -KeyOffsetMSw dd 11 - -@ -@ Gamma Correction Up/Down -KeyIncreaseGamma dd 0 -KeyDecreaseGamma dd 0 - -@ -@ Movie Chapters: Insert / Go to Previous / Go to Next -KeyInsrtChap dd 0 -KeyPrevChap dd 0 -KeyNextChap dd 0 - -@ -@ Movie state load mode cycle -KeyRTRCycle dd 0 - -@ -@ ---- -@ -- Misc -- -@ ---- - -@ -@ Calculated Checksum & Hash: Don't Edit by Hand ! -TimeChecker db 0 -PrevBuildNum dd 0 - -@ -@ Display First-Time Use Reminder (0 = YES, 1 = No) -FirstTimeData db 0 - -%ifndef NO_DEBUGGER -@ -@ Enable Debugger (0 = NO, 1 = Yes) -debuggeron db 0 -%endif - -@ -@ Prevent ZSNES from Saving the Configuration on Exit (0 = NO, 1 = Yes) -cfgdontsave db 0 - -@ -@ - EOF - diff --git a/tools/zsnes/src/chips/7110proc.asm b/tools/zsnes/src/chips/7110proc.asm deleted file mode 100644 index a7b4c03..0000000 --- a/tools/zsnes/src/chips/7110proc.asm +++ /dev/null @@ -1,1375 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 memaccessbankr8,memaccessbankr16,memaccessbankw8,memaccessbankw16 -EXTSYM regaccessbankr8,regaccessbankr16,regaccessbankw8,regaccessbankw16 -EXTSYM sramaccessbankr8b,sramaccessbankr16b,sramaccessbankw8b,sramaccessbankw16b -EXTSYM SPC7110PackPtr,SPC7110IndexPtr,SPC7110IndexSize,SPC7_Data_Load -EXTSYM SPC7110Entries,SPC7110filep,Get_Time,Get_TimeDate,snesmmap,snesmap2 -EXTSYM curromsize,regptw,regptr,romdata - -%include "cpu/regs.mac" -%include "cpu/regsw.mac" - -%ifndef NO_DEBUGGER -EXTSYM debuggeron -%endif - -; SPC7110 emulation. Information fully reverse engineered -; by Dark Force and John Weidman, ZSNES code by zsKnight - -SECTION .data -NEWSYM SPCMultA, dd 0 -NEWSYM SPCMultB, dd 0 -NEWSYM SPCDivEnd, dd 0 -NEWSYM SPCMulRes, dd 0 -NEWSYM SPCDivRes, dd 0 -NEWSYM SPC7110BankA, dd 020100h -NEWSYM SPC7110RTCStat, dd 0 -NEWSYM SPC7110RTC, db 00,00,00,00,00,00,01,00,01,00,00,00,00,00,0Fh,00 -NEWSYM SPC7110RTCB, db 00,00,00,00,00,00,01,00,01,00,00,00,00,01,0Fh,06 -NEWSYM SPCROMPtr, dd 0 -NEWSYM SPCROMtoI, dd SPCROMPtr -NEWSYM SPCROMAdj, dd 0 -NEWSYM SPCROMInc, dd 0 -NEWSYM SPCROMCom, dd 0 -NEWSYM SPCCompPtr, dd 0 -NEWSYM SPCDecmPtr, dd 0 -NEWSYM SPCCompCounter, dd 0 -NEWSYM SPCCompCommand, dd 0 -NEWSYM SPCCheckFix, dd 0 -NEWSYM SPCSignedVal, dd 0 -num2writespc7110reg equ $-SPCMultA -NEWSYM PHnum2writespc7110reg, dd num2writespc7110reg -NEWSYM SPC7110TempPosition, dd 0 -NEWSYM SPC7110TempLength, dd 0 -NEWSYM SPCPrevCompPtr, dd 0 - -SECTION .bss -NEWSYM SPCDecompFin, resd 1 - -SECTION .text - -NEWSYM SPC7110init - mov dword[SPCMultA],0 - mov dword[SPCMultB],0 - mov dword[SPCDivEnd],0 - mov dword[SPCMulRes],0 - mov dword[SPCDivRes],0 - mov dword[SPC7110BankA],020100h - mov dword[SPC7110RTCStat],0 - mov dword[SPC7110RTCStat],0 - mov dword[SPCROMPtr],0 - mov dword[SPCROMtoI],SPCROMPtr - mov dword[SPCROMAdj],0 - mov dword[SPCROMInc],0 - mov dword[SPCROMCom],0 - mov dword[SPCDecompFin],0 - mov dword[SPCCompPtr],0 - mov dword[SPCDecmPtr],0 - mov dword[SPCCompCounter],0 - mov dword[SPCCompCommand],0 - mov dword[SPCCheckFix],0 - mov dword[SPCPrevCompPtr],0 - ret - -NEWSYM SPC7110Reset - setregw 4801h*4,SPC4801w - setregw 4802h*4,SPC4802w - setregw 4803h*4,SPC4803w - setregw 4804h*4,SPC4804w - setregw 4805h*4,SPC4805w - setregw 4806h*4,SPC4806w - setregw 4807h*4,SPC4807w - setregw 4808h*4,SPC4808w - setregw 4809h*4,SPC4809w - setregw 480Ah*4,SPC480Aw - setregw 480Bh*4,SPC480Bw - - setregw 4811h*4,SPC4811w - setregw 4812h*4,SPC4812w - setregw 4813h*4,SPC4813w - setregw 4814h*4,SPC4814w - setregw 4815h*4,SPC4815w - setregw 4816h*4,SPC4816w - setregw 4817h*4,SPC4817w - setregw 4818h*4,SPC4818w - - setregw 4820h*4,SPC4820w - setregw 4821h*4,SPC4821w - setregw 4822h*4,SPC4822w - setregw 4823h*4,SPC4823w - setregw 4824h*4,SPC4824w - setregw 4825h*4,SPC4825w - setregw 4826h*4,SPC4826w - setregw 4827h*4,SPC4827w - setregw 482Eh*4,SPC482Ew - - setregw 4831h*4,SPC4831w - setregw 4832h*4,SPC4832w - setregw 4833h*4,SPC4833w - - setregw 4840h*4,SPC4840w - setregw 4841h*4,SPC4841w - setregw 4842h*4,SPC4842w - ret - -NEWSYM initSPC7110regs - setreg 4800h*4,SPC4800 - setreg 4801h*4,SPC4801 - setreg 4802h*4,SPC4802 - setreg 4803h*4,SPC4803 - setreg 4804h*4,SPC4804 - setreg 4805h*4,SPC4805 - setreg 4806h*4,SPC4806 - setreg 4807h*4,SPC4807 - setreg 4808h*4,SPC4808 - setreg 4809h*4,SPC4809 - setreg 480Ah*4,SPC480A - setreg 480Bh*4,SPC480B - setreg 480Ch*4,SPC480C - - setreg 4810h*4,SPC4810 - setreg 4811h*4,SPC4811 - setreg 4812h*4,SPC4812 - setreg 4813h*4,SPC4813 - setreg 4814h*4,SPC4814 - setreg 4815h*4,SPC4815 - setreg 4816h*4,SPC4816 - setreg 4817h*4,SPC4817 - setreg 4818h*4,SPC4818 - setreg 481Ah*4,SPC481A - - setreg 4820h*4,SPC4820 - setreg 4821h*4,SPC4821 - setreg 4822h*4,SPC4822 - setreg 4823h*4,SPC4823 - setreg 4824h*4,SPC4824 - setreg 4825h*4,SPC4825 - setreg 4826h*4,SPC4826 - setreg 4827h*4,SPC4827 - setreg 4828h*4,SPC4828 - setreg 4829h*4,SPC4829 - setreg 482Ah*4,SPC482A - setreg 482Bh*4,SPC482B - setreg 482Ch*4,SPC482C - setreg 482Dh*4,SPC482D - setreg 482Eh*4,SPC482E - setreg 482Fh*4,SPC482F - - setreg 4831h*4,SPC4831 - setreg 4832h*4,SPC4832 - setreg 4833h*4,SPC4833 - setreg 4834h*4,SPC4834 - - setreg 4840h*4,SPC4840 - setreg 4841h*4,SPC4841 - setreg 4842h*4,SPC4842 - - - setreg 4850h*4,SPC4850 - setreg 4851h*4,SPC4851 - setreg 4852h*4,SPC4852 - setreg 4853h*4,SPC4853 - setreg 4854h*4,SPC4854 - setreg 4855h*4,SPC4855 - setreg 4856h*4,SPC4856 - setreg 4857h*4,SPC4857 - setreg 4858h*4,SPC4858 - setreg 4859h*4,SPC4859 - setreg 485Ah*4,SPC485A - setreg 485Bh*4,SPC485B - setreg 485Ch*4,SPC485C - setreg 485Dh*4,SPC485D - setreg 485Eh*4,SPC485E - setreg 485Fh*4,SPC485F - ret - -%macro BankSwitchSPC7110 2 - push ecx - push edx - push eax - mov [SPC7110BankA+%1],al - inc al - cmp byte[curromsize],13 - jne .mbit24 -.mbit40 - cmp al,5 - jb .okaymbit - sub al,4 - jmp .mbit40 -.mbit24 - cmp al,3 - jb .okaymbit - sub al,2 - jmp .mbit24 -.okaymbit - and eax,07h - shl eax,20 - add eax,[romdata] - mov ecx,10h - mov ebx,snesmap2+%2*4 - mov edx,snesmmap+%2*4 -.mmaploop2 - mov [ebx],eax - mov [edx],eax - add eax,10000h - add ebx,4 - add edx,4 - dec ecx - jnz .mmaploop2 - pop eax - pop edx - pop ecx - ret -%endmacro - -%ifndef NO_DEBUGGER -NEWSYM LastLog - pushad - cmp byte[CurValUsed],0 - je near .novalue - xor ebx,ebx - mov edx,DecompArray - mov eax,[CurPtrVal] - cmp dword[DecompAPtr],0 - je .noptr -.loop - mov ecx,[edx] - cmp ecx,eax - je .match - add edx,8 - inc ebx - cmp ebx,[DecompAPtr] - jne .loop -.noptr - cmp dword[DecompAPtr],8192 - je .novalue - mov [edx],eax - xor eax,eax - mov ax,[CurDecompSize] - mov [edx+4],ax - mov ax,[CurPtrLen] - mov [edx+6],ax - mov al,[CurPtrLen+2] - mov [edx+3],al - inc dword[DecompAPtr] - jmp .novalue -.match - add edx,4 - mov bx,[CurDecompSize] - xor ebx,ebx - cmp [edx],bx - jae .novalue - mov [edx],bx -.novalue - mov [lastentry],edx - mov byte[CurValUsed],1 - mov eax,[SPCCompPtr] - and eax,0FFFFFFh - mov [CurPtrVal],eax - popad - ret -%endif - -SPC4800: -; mov byte[debstop3],1 -; cmp word[SPCCompCounter],0FFFFh -; jne .notzero -; xor al,al -; ret -;.notzero - cmp byte[SPCCompCommand],0 - je .manual - xor al,al - dec word[SPCCompCounter] - push ebx - xor ebx,ebx -; mov ebx,[SPCCompPtr] -; and ebx,0FFFFFFh -; add ebx,[romdata] -; add ebx,100000h - mov bx,[SPCDecmPtr] - add ebx,[SPC7110PackPtr] - mov al,[ebx] - pop ebx -; xor al,al -; inc dword[SPCCompPtr] - - push eax - inc word[SPCDecmPtr] - mov ax,[SPCDecmPtr] - mov [CurDecompPtr],ax - sub ax,[PrevDecompPtr] - mov [CurDecompSize],ax - pop eax -; cmp word[SPCCompCounter],0FFFFh -; jne .exit -; mov byte[SPCDecompFin],80h -;.exit - ret -.manual - xor al,al - push ebx - xor ebx,ebx - mov bx,[SPCDecmPtr] - add ebx,[SPC7110PackPtr] - mov al,[ebx] - pop ebx - - dec word[SPCCompCounter] -; inc dword[SPCCompPtr] - inc word[SPCDecmPtr] - inc word[CurDecompSize] -; cmp word[SPCCompCounter],0FFFFh -; jne .exit2 -; mov byte[SPCDecompFin],80h -;.exit2 - ret -SPC4801: - mov al,[SPCCompPtr] - ret -SPC4802: - mov al,[SPCCompPtr+1] - ret -SPC4803: - mov al,[SPCCompPtr+2] - ret -SPC4804: - mov al,[SPCCompPtr+3] - ret -SPC4805: - mov al,[SPCDecmPtr] - ret -SPC4806: - mov al,[SPCDecmPtr+1] - ret -SPC4807: - xor al,al - ret -SPC4808: - xor al,al - ret -SPC4809: - mov al,[SPCCompCounter] - ret -SPC480A: - mov al,[SPCCompCounter+1] - ret -SPC480B: - mov al,[SPCCompCommand] - mov dword[SPCDecmPtr],0 - ret -SPC480C: ; decompression finished status - mov al,[SPCDecompFin] - mov byte[SPCDecompFin],0 - ret - -SECTION .bss -NEWSYM CurPtrVal, resd 1 -NEWSYM CurPtrLen, resd 1 -NEWSYM CurValUsed, resb 1 -NEWSYM PrevDecompPtr, resw 1 -NEWSYM CurDecompPtr, resw 1 -NEWSYM CurDecompSize, resw 1 -NEWSYM DecompArray, resb 65536 -NEWSYM DecompAPtr, resd 1 -lastentry resd 1 - -SECTION .text -SPC4801w: - mov [SPCCompPtr],al - ret -SPC4802w: - mov [SPCCompPtr+1],al - ret -SPC4803w: - mov [SPCCompPtr+2],al - ret -SPC4804w: - mov [SPCCompPtr+3],al - ret -SPC4805w: - mov [SPCDecmPtr],al - ret -SPC4806w: - mov [SPCDecmPtr+1],al -; cmp dword[SPCCompPtr],0124AD48h -; jne .nodata -; mov byte[debstop3],1 -;.nodata - - push ebx - mov ebx,[SPCCompPtr] - and ebx,0ffffffh - push ecx - movzx ecx,byte[SPCCompPtr+3] - shl ecx,2 - add ebx,ecx - pop ecx - add ebx,100000h - add ebx,[romdata] - cmp byte[ebx],3 - jne .try2 - shl word[SPCDecmPtr],3 -.try2 - cmp byte[ebx],2 - jne .try1 - shl word[SPCDecmPtr],2 -.try1 - cmp byte[ebx],1 - jne .skip - shl word[SPCDecmPtr],1 -.skip - pop ebx - - - pushad - cmp byte[CurValUsed],0 - je near .novalue - xor ebx,ebx - mov edx,DecompArray - mov eax,[CurPtrVal] -; and eax,0FFFFFFh - - cmp dword[DecompAPtr],0 - je .noptr -.loop - mov ecx,[edx] -; and ecx,0FFFFFFh - cmp ecx,eax - je .match - add edx,8 - inc ebx - cmp ebx,[DecompAPtr] - jne .loop -.noptr - cmp dword[DecompAPtr],8192 - je .novalue - mov [edx],eax - xor eax,eax - mov ax,[CurDecompSize] - mov [edx+4],ax - mov ax,[CurPtrLen] - mov [edx+6],ax - mov al,[CurPtrLen+2] - mov [edx+3],al - inc dword[DecompAPtr] - jmp .novalue -.match - add edx,4 - xor ebx,ebx - mov bx,[CurDecompSize] - cmp [edx],bx - jae .novalue - mov [edx],bx -.novalue - mov [lastentry],edx - mov byte[CurValUsed],1 - mov eax,[SPCCompPtr] - and eax,0FFFFFFh - mov [CurPtrVal],eax - popad - mov word[CurDecompSize],0 - - push eax - mov al,[SPCCompPtr+3] - mov [CurPtrLen+2],al - mov ax,[SPCDecmPtr] - mov [CurPtrLen],ax - mov eax,[SPCCompPtr] - mov [CurPtrVal],eax - - mov ax,[SPCDecmPtr] - mov [PrevDecompPtr],ax - mov [CurDecompPtr],ax - mov word[CurDecompSize],0 - pop eax - - mov byte[SPCDecompFin],0h - ; Start Decompression - - pushad - mov eax,[SPCCompPtr] - cmp [SPCPrevCompPtr],eax - je near .previousequal - mov [SPCPrevCompPtr],eax - - mov ecx,[SPC7110Entries] - mov ebx,[SPCCompPtr] - and ebx,0FFFFFFh - mov eax,[SPC7110IndexPtr] - or ecx,ecx - jz .noentries -.loopc - mov edx,[eax] - cmp dl,[SPCCompPtr+3] - jne .notfound - shr edx,8 - cmp ebx,edx - je .found -.notfound - add eax,12 - dec ecx - jnz .loopc - jmp .noentries -.found - xor word[CurPtrLen],0FFFFh - mov ecx,[eax+8] - mov ebx,[eax+4] - xor edx,edx - mov dx,[SPCDecmPtr] - add edx,[SPC7110PackPtr] - push eax -.loopb - mov al,[ebx] - mov [edx],al - inc ebx - inc edx - dec ecx - jnz .loopb - pop eax - mov ebx,[eax+4] - mov edx,[lastentry] -; mov [edx+4],ebx - mov ebx,[eax] -; mov [edx],ebx - jmp .foundentry -.noentries - - mov ecx,[SPC7110IndexSize] - ; Address/index, pointer, length, SPC7110nfname - mov edx,[SPC7110IndexPtr] -.sploop - mov eax,[SPCCompPtr] - shl eax,8 - mov al,[SPCCompPtr+3] - cmp [edx],eax - je .foundsp - add edx,12 - sub ecx,12 - jc .overflow - jnz .sploop -.overflow - jmp .notfoundentry -.foundsp - mov eax,[edx+4] - mov [SPC7110TempPosition],eax - mov eax,[edx+8] - mov [SPC7110TempLength],eax - - mov edx,[SPC7110filep] - mov eax,[SPCCompPtr] - and eax,0FFFFFFh - mov ecx,6 -.sploop2 - mov ebx,eax - shr ebx,20 - and ebx,0Fh - cmp bl,9 - jbe .below9 - add bl,55-48 -.below9 - add bl,48 - mov [edx],bl - inc edx - shl eax,4 - dec ecx - jnz .sploop2 - - pushad - call SPC7_Data_Load - popad -.notfoundentry -.foundentry -.previousequal - popad -.fin -.blah - ; Finished -; mov word[SPCCompCounter],0FFFFh - mov byte[SPCDecompFin],80h - ret -SPC4807w: - ret -SPC4808w: - ret -SPC4809w: - mov [SPCCompCounter],al - ret -SPC480Aw: - mov [SPCCompCounter+1],al - ret -SPC480Bw: - mov [SPCCompCommand],al - ret - -; 01, -;$4810 DATA ROM CONTINUOUS READ PORT: returns a byte from data rom at data -; rom pointer location, defval:00 -;$4811 DATA ROM POINTER: ($0000FF) r/w low offset, defval:00 -;$4812 DATA ROM POINTER: ($00FF00) r/w high offset, defval:00 -;$4813 DATA ROM POINTER: ($FF0000) r/w bank offset, defval:00 -; bank offset is zero based from start of data rom: banks $00-$3f -; data rom -> $10-$4f full rom -;$4814 DATA ROM POINTER ADJUST: ($00FF) low byte, defval:00 -;$4815 DATA ROM POINTER ADJUST: ($FF00) high byte, defval:00 -;$4816 DATA ROM POINTER INCREMENT: ($00FF) low byte, defval:00 -;$4817 DATA ROM POINTER INCREMENT: ($FF00) high byte, defval:00 -;$4818 DATA ROM COMMAND MODE: bit field control of data rom pointer (see -; data rom command mode byte), defval:00 -; write: set command mode, -; read: performs action instead of returning value, unknown purpose, -; command mode is loaded to $4818 but only set after writing to both -; $4814 and $4815 in any order -;$481A DATA ROM READ AFTER ADJUST PORT: returns a byte from data rom at -; data rom pointer location + adjust value ($4814/5), defval:00 - - -SPC4810: - cmp dword[SPCCheckFix],0 - jne .okay - xor al,al - ret -.okay - push ebx - mov ebx,[SPCROMPtr] - add ebx,[romdata] - add ebx,100000h - test byte[SPCROMCom],2 - jz .no2 - add ebx,[SPCROMAdj] - inc word[SPCROMAdj] - mov al,[ebx] - pop ebx - ret -.no2 - mov al,[ebx] - cmp byte[SPCROMCom+1],0 - jne .noincr1 - mov ebx,[SPCROMtoI] - inc dword[ebx] -.noincr1 - cmp byte[SPCROMCom+1],1 ; add 4816 after 4810 read - jne .noincr1b - mov ebx,[SPCROMtoI] - push ecx - mov ecx,[SPCROMInc] - add dword[ebx],ecx - pop ecx -.noincr1b - pop ebx - ret -SPC4811: - mov al,[SPCROMPtr] - ret -SPC4812: - mov al,[SPCROMPtr+1] - ret -SPC4813: - mov al,[SPCROMPtr+2] - ret -SPC4814: - mov al,[SPCROMAdj] - ret -SPC4815: - mov al,[SPCROMAdj+1] - ret -SPC4816: - mov al,[SPCROMInc] - ret -SPC4817: - mov al,[SPCROMInc+1] - ret -SPC4818: - mov al,[SPCROMCom] - ret -SPC481A: - cmp dword[SPCCheckFix],0 - jne .okay - xor al,al - ret -.okay - push ebx - xor ebx,ebx - mov bx,[SPCROMAdj] - add ebx,[SPCROMPtr] - add ebx,[romdata] - add ebx,100000h - mov al,[ebx] - - cmp byte[SPCROMCom+1],4 ; 16bit 4814 - jne .notincr - mov ebx,[SPCROMAdj] - push ecx - mov ecx,[SPCROMtoI] - add [ecx],ebx - pop ecx -.notincr - pop ebx - ret - -SPC4811w: - mov [SPCROMPtr],al - mov byte[SPCCheckFix],1 - ret -SPC4812w: - mov [SPCROMPtr+1],al - ret -SPC4813w: - mov [SPCROMPtr+2],al - ret -SPC4814w: - mov [SPCROMAdj],al - cmp byte[SPCROMCom+1],2 ; 8 bit 4814 - jne .notincr - mov ebx,[SPCROMtoI] - xor ecx,ecx - mov cl,[SPCROMAdj] - test byte[SPCROMCom],08h - jz .noneg - movsx ecx,byte[SPCROMAdj] -.noneg - add dword[ebx],ecx -.notincr - ret -SPC4815w: - mov [SPCROMAdj+1],al - mov word[SPCROMAdj+2],0 - test byte[SPCROMCom],08h - jz .noneg - test byte[SPCROMAdj+1],80h - jz .noneg - mov word[SPCROMAdj+2],0FFFFh -.noneg - cmp byte[SPCROMCom+1],3 ; 16bit 4814 - jne .notincr - push ebx - push ecx - mov ecx,[SPCROMtoI] - mov ebx,[SPCROMAdj] - add [ecx],ebx - pop ecx - pop ebx -.notincr - ret -SPC4816w: - mov [SPCROMInc],al - ret -SPC4817w: - mov [SPCROMInc+1],al - mov word[SPCROMInc+2],0 - test byte[SPCROMCom],04h - jz .noneg - test byte[SPCROMInc+1],40h - jz .noneg - mov word[SPCROMInc+2],0FFFFh -.noneg - ret -SPC4818w: - mov [SPCROMCom],al - mov word[SPCROMAdj+2],0 - test byte[SPCROMCom],08h - jz .noneg - test byte[SPCROMAdj+1],80h - jz .noneg - mov word[SPCROMAdj+2],0FFFFh -.noneg - mov word[SPCROMInc+2],0 - test byte[SPCROMCom],04h - jz .noneg2 - test byte[SPCROMInc+1],40h - jz .noneg2 - mov word[SPCROMInc+2],0FFFFh -.noneg2 - mov dword[SPCROMtoI],SPCROMPtr - test byte[SPCROMCom],10h - jz .nouseadjust - mov dword[SPCROMtoI],SPCROMAdj -.nouseadjust - test al,02h - jz .no4814 - test al,40h - jz .no16b - test al,20h - jz .not481A - mov byte[SPCROMCom+1],4 ; 16bit 4814 after 481A - jmp .fin -.not481A - mov byte[SPCROMCom+1],3 ; 16bit 4814 - jmp .fin -.no16b - test al,20h - jz .nooffsetadd - mov byte[SPCROMCom+1],2 ; 8 bit 4814 - jmp .fin -.nooffsetadd - mov byte[SPCROMCom+1],0FFh - jmp .fin -.no4814 - test al,01h - jz .incrval0 - mov byte[SPCROMCom+1],1 ; add 4816 after 4810 read - jmp .fin -.incrval0 - mov byte[SPCROMCom+1],0 ; add 1 after 4810 read -.fin - ret - -;Data Rom Command Mode Byte: -;X6543210 -;|||||||| -;|||||| \__ : 00 - use 1 as the offset increment value, add immediately after reading $4810 -;|||||| : 01 - use $4816 as offset increment, add immediately after reading $4810 -;|||||| : 10 - use $4814 as offset increment, see below for when to add -;|||||| : 11 - unused -;||||||____ : 0 - unsigned calculation for $4816 -;||||| 1 - signed calculation for $4816 -;|||||_____ : 0 - unsigned calculation for $4814 -;|||| 1 - signed calculation for $4814 -;||||______ : 0 - offset increment gets added to $4811/2/3 -;||| 1 - offset increment gets added to $4814/5 -;| \_______ : 00 - disable offset addition -;| : 01 - 8 bit offset addition using $4814, immediately after writing to $4814/5 -;| : 10 - 16 bit offset addition using $4814/5, immediately after writing to $4814/5 -;| : 11 - 16 bit offset addition using $4814/5, only after reading $481A -;|_________ : unused - -SPC4820: - mov al,[SPCMultA] -; mov byte[debstop3],1 - ret -SPC4821: - mov al,[SPCMultA+1] - ret -SPC4822: - mov al,[SPCMultA+2] - ret -SPC4823: - mov al,[SPCMultA+3] - ret -SPC4824: - mov al,[SPCMultB] - ret -SPC4825: - mov al,[SPCMultB+1] - ret -SPC4826: - mov al,[SPCDivEnd] - ret -SPC4827: - mov al,[SPCDivEnd+1] - ret - -SPC4820w: - mov [SPCMultA],al - ret -SPC4821w: - mov [SPCMultA+1],al - ret -SPC4822w: - mov [SPCMultA+2],al - ret -SPC4823w: - mov [SPCMultA+3],al - ret -SPC4824w: - mov [SPCMultB],al - ret -SPC4825w: - mov [SPCMultB+1],al - ; Calculate SPCMultA*SPCMultB -> SPCMulRes - test byte[SPCSignedVal],1 - jnz .signed - push edx - push eax - push ebx - xor eax,eax - xor ebx,ebx - mov ax,[SPCMultA] - mov bx,[SPCMultB] - mul ebx - mov [SPCMulRes],eax - pop ebx - pop eax - pop edx - ret -.signed - push edx - push eax - push ebx - movsx eax,word[SPCMultA] - movsx ebx,word[SPCMultB] - imul ebx - mov [SPCMulRes],eax - pop ebx - pop eax - pop edx - ret -SPC4826w: - mov [SPCDivEnd],al - ret -SPC4827w: - mov [SPCDivEnd+1],al - ; Calculte SPCMultA/SPCDivEnd -> SPCMulRes, rem SPCDivRes - cmp word[SPCDivEnd],0 - je near .nodivide - test byte[SPCSignedVal],1 - jnz .signed - push edx - push eax - push ebx - xor edx,edx - xor ebx,ebx - mov eax,[SPCMultA] - mov bx,[SPCDivEnd] - div ebx - mov [SPCMulRes],eax - mov [SPCDivRes],dx - pop ebx - pop eax - pop edx - ret -.signed - push edx - push eax - push ebx - xor edx,edx - mov eax,[SPCMultA] - test eax,80000000h - jz .nd - mov edx,0FFFFFFFFh -.nd - movsx ebx,word[SPCDivEnd] - idiv ebx - mov [SPCMulRes],eax - mov [SPCDivRes],dx - pop ebx - pop eax - pop edx - ret -.nodivide - mov dword[SPCMulRes],0FFFFFFFFh - mov dword[SPCDivRes],0FFFFh - ret -SPC4828: - mov al,[SPCMulRes] - ret -SPC4829: - mov al,[SPCMulRes+1] - ret -SPC482A: - mov al,[SPCMulRes+2] - ret -SPC482B: - mov al,[SPCMulRes+3] - ret -SPC482C: - mov al,[SPCDivRes] - ret -SPC482D: - mov al,[SPCDivRes+1] - ret -SPC482E: - xor al,al - ret -SPC482Ew: - mov [SPCSignedVal],al - mov dword[SPCMultA],0 - mov dword[SPCMultB],0 - mov dword[SPCDivEnd],0 - mov dword[SPCMulRes],0 - mov dword[SPCDivRes],0 - ret -SPC482F: - xor al,al - ret - -SPC4831w: - BankSwitchSPC7110 0,0D0h - ret -SPC4832w: - BankSwitchSPC7110 1,0E0h - ret -SPC4833w: -; mov byte[debstop3],1 - BankSwitchSPC7110 2,0F0h - ret -SPC4831: - mov al,[SPC7110BankA] - ret -SPC4832: - mov al,[SPC7110BankA+1] - ret -SPC4833: - mov al,[SPC7110BankA+2] - ret - -SPC4834: - xor al,al - ret - -;$4840 RTC CHIP ENABLE/DISABLE: bit 0: on = enable, off = disable, defval:00 -;$4841 RTC INDEX/DATA PORT: -; first write after rtc enable: rtc command mode byte (see rtc command modes) -; subsequent writes: index of rtc register to read/write (00-0f) -; read: returns value of indexed rtc register -; auto-increment of register index occurs after each subsequent read/write -;$4842 RTC READY STATUS: bit 7: on = ready, off = still processing, tested before reading rtc data -; high bit cleared after successful read - -SPC4840w: - test al,1 - jz .notreset - mov [SPC7110RTCStat],al - mov byte[SPC7110RTCStat+1],0FEh -.notreset - ret -SPC4841w: - cmp byte[SPC7110RTCStat+1],0FEh - je .commandbyte - cmp byte[SPC7110RTCStat+1],0FFh - je .commandindex - push ebx - xor ebx,ebx - mov bl,[SPC7110RTCStat+1] - mov [SPC7110RTC+ebx],al - cmp ebx,0Fh - jne .notlast - test al,01h - jz .notlast - mov dword[SPC7110RTC],0 - mov dword[SPC7110RTC+4],010000h - mov dword[SPC7110RTC+8],01h - mov byte[SPC7110RTC+12],0 -.notlast - pop ebx - inc byte[SPC7110RTCStat+1] - and byte[SPC7110RTCStat+1],0Fh - ret -.commandbyte - inc byte[SPC7110RTCStat+1] - mov [SPC7110RTCStat+2],al - ret -.commandindex - push eax - and al,0Fh - mov [SPC7110RTCStat+1],al - pop eax - ret -SPC4842w: - ret -SPC4840: - mov al,[SPC7110RTCStat] - ret -SPC4841: - cmp byte[SPC7110RTCStat+1],0FEh - je near .commandbyte - cmp byte[SPC7110RTCStat+1],0FFh - je near .commandbyte - push ebx - xor ebx,ebx - mov bl,[SPC7110RTCStat+1] - or ebx,ebx - jnz near .dontupdate - test byte[SPC7110RTC+0Fh],03h - jnz near .dontupdate - test byte[SPC7110RTC+0Dh],01h - jnz near .dontupdate -;00 - seconds 1's digit 00 -;01 - seconds 10's digit 00 -;02 - minutes 1's digit 00 -;03 - minutes 10's digit 00 -;04 - hours 1's digit 00 -;05 - hours 10's digit 00 -;06 - day of month 1's digit 01 -;07 - day of month 10's digit 00 -;08 - month 1's digit 01 -;09 - month 10's digit 00 -;0a - year 1's digit 00 -;0b - year 10's digit 00 -;0c - day of week 00 - -%ifndef NO_DEBUGGER - cmp byte[debuggeron],1 - je near .dontupdate -%endif - ; fill time/date - push ebx - push eax - call Get_Time - mov bl,al - and bl,0Fh - mov [SPC7110RTC],bl ; seconds - shr eax,4 - mov bl,al - and bl,0Fh - mov [SPC7110RTC+1],bl - shr eax,4 - mov bl,al - and bl,0Fh - mov [SPC7110RTC+2],bl ; minutes - shr eax,4 - mov bl,al - and bl,0Fh - mov [SPC7110RTC+3],bl - test byte[SPC7110RTC+0Fh],4 -; jz .not24hrs -; jmp .not24hrs - shr eax,4 - mov bl,al - and bl,0Fh - mov [SPC7110RTC+4],bl ; hours - shr eax,4 - mov bl,al - and bl,0Fh - mov [SPC7110RTC+5],bl - jmp .24hrs -.not24hrs - shr eax,4 - xor ebx,ebx - mov bl,al - mov al,[SPCTimerVal+ebx] - mov bl,al - and bl,0Fh - mov [SPC7110RTC+4],bl ; hours - shr eax,4 - mov bl,al - and bl,0Fh - mov [SPC7110RTC+5],bl -.24hrs - call Get_TimeDate - mov bl,al - and bl,0Fh - mov [SPC7110RTC+6],bl ; day - shr eax,4 - mov bl,al - and bl,0Fh - mov [SPC7110RTC+7],bl - shr eax,4 - mov bl,al - and bl,0Fh - xor bh,bh - cmp bl,9 - jbe .less - sub bl,10 - mov bh,1 -.less - mov [SPC7110RTC+8],bl ; month - mov [SPC7110RTC+9],bh ; month - shr eax,8 - mov bl,al - and bl,0Fh - mov [SPC7110RTC+10],bl ; year - shr eax,4 - mov bl,al - and bl,01Fh - xor bh,bh -.notokay - cmp bl,9 - jbe .okay - inc bh - sub bl,10 - jmp .notokay -.okay - mov [SPC7110RTC+11],bl - shr eax,8 - and al,0Fh - mov [SPC7110RTC+12],al ; day of week -.done - pop eax - pop ebx - -.dontupdate -; test byte[SPC7110RTC+0Fh],1 -; jz .realtime -; cmp ebx,0Dh -; jae .realtime -; mov al,[SPC7110RTCB+ebx] -; jmp .next -;.realtime - mov al,[SPC7110RTC+ebx] -;.next - pop ebx - inc byte[SPC7110RTCStat+1] - and byte[SPC7110RTCStat+1],0Fh - ret -.commandbyte - inc byte[SPC7110RTCStat+1] - mov al,[SPC7110RTCStat+2] - ret - -SECTION .data -SPCTimerVal: - db 12h,01h,02h,03h,04h,05h,06h,07h,08h,09h,0,0,0,0,0,0 - db 10h,11h,32h,21h,22h,23h,24h,25h,26h,27h,0,0,0,0,0,0 - db 28h,29h - -SECTION .text - -SPC4842: - mov al,80h - ret - -SPC4850: - mov al,[SPC7110RTC] - ret -SPC4851: - mov al,[SPC7110RTC+01h] - ret -SPC4852: - mov al,[SPC7110RTC+02h] - ret -SPC4853: - mov al,[SPC7110RTC+03h] - ret -SPC4854: - mov al,[SPC7110RTC+04h] - ret -SPC4855: - mov al,[SPC7110RTC+05h] - ret -SPC4856: - mov al,[SPC7110RTC+06h] - ret -SPC4857: - mov al,[SPC7110RTC+07h] - ret -SPC4858: - mov al,[SPC7110RTC+08h] - ret -SPC4859: - mov al,[SPC7110RTC+09h] - ret -SPC485A: - mov al,[SPC7110RTC+0Ah] - ret -SPC485B: - mov al,[SPC7110RTC+0Bh] - ret -SPC485C: - mov al,[SPC7110RTC+0Ch] - ret -SPC485D: - mov al,[SPC7110RTC+0Dh] - ret -SPC485E: - mov al,[SPC7110RTC+0Eh] - ret -SPC485F: - mov al,[SPC7110RTC+0Fh] - ret - -;$4820 16 BIT MULTIPLICAND: ($00FF) low byte, defval:00 -; 32 BIT DIVI: ($000000FF) low byte of low word, defval:00 -;$4821 16 BIT MULTIPLICAND: ($FF00) high byte, defval:00 -; 32 BIT DIVI: ($0000FF00) high byte of low word, defval:00 -;$4822 32 BIT DIVI: ($00FF0000) low byte of high word, defval:00 -;$4823 32 BIT DIVI: ($FF000000) high byte of high word, defval:00 -;$4824 16 BIT MULTIPLIER: ($00FF) low byte, defval:00 -;$4825 16 BIT MULTIPLIER: ($FF00) high byte, defval:00 -;$4826 16 BIT DIVISOR: ($00FF), defval:00 -;$4827 16 BIT DIVISOR: ($FF00), defval:00 -;$4828 32 BIT PRODUCT: ($000000FF) low byte of low word, defval:00 -; 32 BIT QUOTIENT:($000000FF) low byte of low word, defval:00 -;$4829 32 BIT PRODUCT: ($0000FF00) high byte of low word, defval:00 -; 32 BIT QUOTIENT:($0000FF00) high byte of low word, defval:00 -;$482A 32 BIT PRODUCT: ($00FF0000) low byte of high word, defval:00 -; 32 BIT QUOTIENT:($00FF0000) low byte of high word, defval:00 -;$482B 32 BIT PRODUCT: ($FF000000) high byte of high word, defval:00 -; 32 BIT QUOTIENT:($FF000000) high byte of high word, defval:00 -;$482C 16 BIT REMAINDER: ($00FF) low byte, defval:00 -;$482D 16 BIT REMAINDER: ($FF00) high byte, defval:00 -;$482E MUL/DIV RESET, write = reset $4820 to $482D, defval:00 -;$482F MUL/DIV FINISHED STATUS: bit 7: on = processing, off = finished, -; high bit is set after a write to multiplier or divisor regs $4825/$4827, defval:00 - -;SPC7110 Sram Map -;$006000 - $007FFF sram 8k (slow rom?) -;$306000 - $307FFF mirrored sram from $006000 - $007FFF (fast rom?) -%macro SRAMAccessSPC7110 1 - test ecx,8000h - jnz memaccessbank%1 - cmp ecx,6000h - jb regaccessbank%1 - push ecx - sub ecx,6000h - shl ebx,13 - add ecx,ebx - and ecx,0FFFFh - call sramaccessbank%1b - pop ecx -%endmacro - -NEWSYM SPC7110ReadSRAM8b - SRAMAccessSPC7110 r8 - ret - -NEWSYM SPC7110ReadSRAM16b - SRAMAccessSPC7110 r16 - ret - -NEWSYM SPC7110WriteSRAM8b - SRAMAccessSPC7110 w8 - ret - -NEWSYM SPC7110WriteSRAM16b - SRAMAccessSPC7110 w16 - ret - -;data decompressed from data rom by spc7110 mapped to $50:0000-$50:FFFF -NEWSYM memaccessspc7110r8 - push ebx - movzx ebx,word[SPCDecmPtr] - add ebx,[SPC7110PackPtr] - mov al,[ebx] - pop ebx - - dec word[SPCCompCounter] - inc word[SPCDecmPtr] - inc word[CurDecompSize] - ret - -NEWSYM memaccessspc7110r16 - mov ebx,[SPC7110PackPtr] - mov ax,[ebx+ecx] - cmp cx,[CurDecompPtr] - jb .noptr - mov [CurDecompPtr],cx - mov bx,cx - sub bx,[PrevDecompPtr] - add bx,2 - mov [CurDecompSize],bx -.noptr - xor ebx,ebx - ret - -NEWSYM memaccessspc7110w8 - mov ebx,[SPC7110PackPtr] - mov [ebx+ecx],al - xor ebx,ebx - ret - -NEWSYM memaccessspc7110w16 - mov ebx,[SPC7110PackPtr] - mov [ebx+ecx],ax - xor ebx,ebx - ret diff --git a/tools/zsnes/src/chips/c4emu.c b/tools/zsnes/src/chips/c4emu.c deleted file mode 100644 index be543a6..0000000 --- a/tools/zsnes/src/chips/c4emu.c +++ /dev/null @@ -1,345 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifdef __UNIXSDL__ -#include "../gblhdr.h" -#else -#include -#include -#endif - -#ifdef PI -#undef PI -#endif -#define PI 3.1415926535897932384626433832795 -#define Cos(a) ((double) CosTable[a]) -#define Sin(a) ((double) SinTable[a]) -#define Tan(a) (CosTable[a]?((((int)SinTable[a])<<16)/CosTable[a]):(int)0x80000000) - -short SinTable[512] = { - 0, 402, 804, 1206, 1607, 2009, 2410, 2811, - 3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997, - 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, - 9512, 9896, 10278, 10659, 11039, 11416, 11793, 12167, - 12539, 12910, 13278, 13645, 14010, 14372, 14732, 15090, - 15446, 15800, 16151, 16499, 16846, 17189, 17530, 17869, - 18204, 18537, 18868, 19195, 19519, 19841, 20159, 20475, - 20787, 21097, 21403, 21706, 22005, 22301, 22594, 22884, - 23170, 23453, 23732, 24007, 24279, 24547, 24812, 25073, - 25330, 25583, 25832, 26077, 26319, 26557, 26790, 27020, - 27245, 27466, 27684, 27897, 28106, 28310, 28511, 28707, - 28898, 29086, 29269, 29447, 29621, 29791, 29956, 30117, - 30273, 30425, 30572, 30714, 30852, 30985, 31114, 31237, - 31357, 31471, 31581, 31685, 31785, 31881, 31971, 32057, - 32138, 32214, 32285, 32351, 32413, 32469, 32521, 32568, - 32610, 32647, 32679, 32706, 32728, 32745, 32758, 32765, - 32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647, - 32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214, - 32138, 32057, 31971, 31881, 31785, 31685, 31581, 31471, - 31357, 31237, 31114, 30985, 30852, 30714, 30572, 30425, - 30273, 30117, 29956, 29791, 29621, 29447, 29269, 29086, - 28898, 28707, 28511, 28310, 28106, 27897, 27684, 27466, - 27245, 27020, 26790, 26557, 26319, 26077, 25832, 25583, - 25330, 25073, 24812, 24547, 24279, 24007, 23732, 23453, - 23170, 22884, 22594, 22301, 22005, 21706, 21403, 21097, - 20787, 20475, 20159, 19841, 19519, 19195, 18868, 18537, - 18204, 17869, 17530, 17189, 16846, 16499, 16151, 15800, - 15446, 15090, 14732, 14372, 14010, 13645, 13278, 12910, - 12539, 12167, 11793, 11416, 11039, 10659, 10278, 9896, - 9512, 9126, 8739, 8351, 7961, 7571, 7179, 6786, - 6392, 5997, 5602, 5205, 4808, 4409, 4011, 3611, - 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, - 0, -402, -804, -1206, -1607, -2009, -2410, -2811, - -3211, -3611, -4011, -4409, -4808, -5205, -5602, -5997, - -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, - -9512, -9896, -10278, -10659, -11039, -11416, -11793, -12167, - -12539, -12910, -13278, -13645, -14010, -14372, -14732, -15090, - -15446, -15800, -16151, -16499, -16846, -17189, -17530, -17869, - -18204, -18537, -18868, -19195, -19519, -19841, -20159, -20475, - -20787, -21097, -21403, -21706, -22005, -22301, -22594, -22884, - -23170, -23453, -23732, -24007, -24279, -24547, -24812, -25073, - -25330, -25583, -25832, -26077, -26319, -26557, -26790, -27020, - -27245, -27466, -27684, -27897, -28106, -28310, -28511, -28707, - -28898, -29086, -29269, -29447, -29621, -29791, -29956, -30117, - -30273, -30425, -30572, -30714, -30852, -30985, -31114, -31237, - -31357, -31471, -31581, -31685, -31785, -31881, -31971, -32057, - -32138, -32214, -32285, -32351, -32413, -32469, -32521, -32568, - -32610, -32647, -32679, -32706, -32728, -32745, -32758, -32765, - -32767, -32765, -32758, -32745, -32728, -32706, -32679, -32647, - -32610, -32568, -32521, -32469, -32413, -32351, -32285, -32214, - -32138, -32057, -31971, -31881, -31785, -31685, -31581, -31471, - -31357, -31237, -31114, -30985, -30852, -30714, -30572, -30425, - -30273, -30117, -29956, -29791, -29621, -29447, -29269, -29086, - -28898, -28707, -28511, -28310, -28106, -27897, -27684, -27466, - -27245, -27020, -26790, -26557, -26319, -26077, -25832, -25583, - -25330, -25073, -24812, -24547, -24279, -24007, -23732, -23453, - -23170, -22884, -22594, -22301, -22005, -21706, -21403, -21097, - -20787, -20475, -20159, -19841, -19519, -19195, -18868, -18537, - -18204, -17869, -17530, -17189, -16846, -16499, -16151, -15800, - -15446, -15090, -14732, -14372, -14010, -13645, -13278, -12910, - -12539, -12167, -11793, -11416, -11039, -10659, -10278, -9896, - -9512, -9126, -8739, -8351, -7961, -7571, -7179, -6786, - -6392, -5997, -5602, -5205, -4808, -4409, -4011, -3611, - -3211, -2811, -2410, -2009, -1607, -1206, -804, -402 -}; - -short CosTable[512] = { - 32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647, - 32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214, - 32138, 32057, 31971, 31881, 31785, 31685, 31581, 31471, - 31357, 31237, 31114, 30985, 30852, 30714, 30572, 30425, - 30273, 30117, 29956, 29791, 29621, 29447, 29269, 29086, - 28898, 28707, 28511, 28310, 28106, 27897, 27684, 27466, - 27245, 27020, 26790, 26557, 26319, 26077, 25832, 25583, - 25330, 25073, 24812, 24547, 24279, 24007, 23732, 23453, - 23170, 22884, 22594, 22301, 22005, 21706, 21403, 21097, - 20787, 20475, 20159, 19841, 19519, 19195, 18868, 18537, - 18204, 17869, 17530, 17189, 16846, 16499, 16151, 15800, - 15446, 15090, 14732, 14372, 14010, 13645, 13278, 12910, - 12539, 12167, 11793, 11416, 11039, 10659, 10278, 9896, - 9512, 9126, 8739, 8351, 7961, 7571, 7179, 6786, - 6392, 5997, 5602, 5205, 4808, 4409, 4011, 3611, - 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, - 0, -402, -804, -1206, -1607, -2009, -2410, -2811, - -3211, -3611, -4011, -4409, -4808, -5205, -5602, -5997, - -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, - -9512, -9896, -10278, -10659, -11039, -11416, -11793, -12167, - -12539, -12910, -13278, -13645, -14010, -14372, -14732, -15090, - -15446, -15800, -16151, -16499, -16846, -17189, -17530, -17869, - -18204, -18537, -18868, -19195, -19519, -19841, -20159, -20475, - -20787, -21097, -21403, -21706, -22005, -22301, -22594, -22884, - -23170, -23453, -23732, -24007, -24279, -24547, -24812, -25073, - -25330, -25583, -25832, -26077, -26319, -26557, -26790, -27020, - -27245, -27466, -27684, -27897, -28106, -28310, -28511, -28707, - -28898, -29086, -29269, -29447, -29621, -29791, -29956, -30117, - -30273, -30425, -30572, -30714, -30852, -30985, -31114, -31237, - -31357, -31471, -31581, -31685, -31785, -31881, -31971, -32057, - -32138, -32214, -32285, -32351, -32413, -32469, -32521, -32568, - -32610, -32647, -32679, -32706, -32728, -32745, -32758, -32765, - -32767, -32765, -32758, -32745, -32728, -32706, -32679, -32647, - -32610, -32568, -32521, -32469, -32413, -32351, -32285, -32214, - -32138, -32057, -31971, -31881, -31785, -31685, -31581, -31471, - -31357, -31237, -31114, -30985, -30852, -30714, -30572, -30425, - -30273, -30117, -29956, -29791, -29621, -29447, -29269, -29086, - -28898, -28707, -28511, -28310, -28106, -27897, -27684, -27466, - -27245, -27020, -26790, -26557, -26319, -26077, -25832, -25583, - -25330, -25073, -24812, -24547, -24279, -24007, -23732, -23453, - -23170, -22884, -22594, -22301, -22005, -21706, -21403, -21097, - -20787, -20475, -20159, -19841, -19519, -19195, -18868, -18537, - -18204, -17869, -17530, -17189, -16846, -16499, -16151, -15800, - -15446, -15090, -14732, -14372, -14010, -13645, -13278, -12910, - -12539, -12167, -11793, -11416, -11039, -10659, -10278, -9896, - -9512, -9126, -8739, -8351, -7961, -7571, -7179, -6786, - -6392, -5997, -5602, -5205, -4808, -4409, -4011, -3611, - -3211, -2811, -2410, -2009, -1607, -1206, -804, -402, - 0, 402, 804, 1206, 1607, 2009, 2410, 2811, - 3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997, - 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, - 9512, 9896, 10278, 10659, 11039, 11416, 11793, 12167, - 12539, 12910, 13278, 13645, 14010, 14372, 14732, 15090, - 15446, 15800, 16151, 16499, 16846, 17189, 17530, 17869, - 18204, 18537, 18868, 19195, 19519, 19841, 20159, 20475, - 20787, 21097, 21403, 21706, 22005, 22301, 22594, 22884, - 23170, 23453, 23732, 24007, 24279, 24547, 24812, 25073, - 25330, 25583, 25832, 26077, 26319, 26557, 26790, 27020, - 27245, 27466, 27684, 27897, 28106, 28310, 28511, 28707, - 28898, 29086, 29269, 29447, 29621, 29791, 29956, 30117, - 30273, 30425, 30572, 30714, 30852, 30985, 31114, 31237, - 31357, 31471, 31581, 31685, 31785, 31881, 31971, 32057, - 32138, 32214, 32285, 32351, 32413, 32469, 32521, 32568, - 32610, 32647, 32679, 32706, 32728, 32745, 32758, 32765 -}; - -short C4WFXVal; -short C4WFYVal; -short C4WFZVal; -short C4WFX2Val; -short C4WFY2Val; -short C4WFDist; -short C4WFScale; -double tanval; -double c4x,c4y,c4z; -double c4x2,c4y2,c4z2; - -void C4TransfWireFrame() -{ - c4x=(double)C4WFXVal; - c4y=(double)C4WFYVal; - c4z=(double)C4WFZVal-0x95; - - // Rotate X - tanval=-(double)C4WFX2Val*PI*2/128; - c4y2=c4y*cos(tanval)-c4z*sin(tanval); - c4z2=c4y*sin(tanval)+c4z*cos(tanval); - - // Rotate Y - tanval=-(double)C4WFY2Val*PI*2/128; - c4x2=c4x*cos(tanval)+c4z2*sin(tanval); - c4z=c4x*-sin(tanval)+c4z2*cos(tanval); - - // Rotate Z - tanval=-(double)C4WFDist*PI*2/128; - c4x=c4x2*cos(tanval)-c4y2*sin(tanval); - c4y=c4x2*sin(tanval)+c4y2*cos(tanval); - - // Scale - C4WFXVal=(short)(c4x*C4WFScale/(0x90*(c4z+0x95))*0x95); - C4WFYVal=(short)(c4y*C4WFScale/(0x90*(c4z+0x95))*0x95); -} - -void C4TransfWireFrame2() -{ - c4x=(double)C4WFXVal; - c4y=(double)C4WFYVal; - c4z=(double)C4WFZVal; - - // Rotate X - tanval=-(double)C4WFX2Val*PI*2/128; - c4y2=c4y*cos(tanval)-c4z*sin(tanval); - c4z2=c4y*sin(tanval)+c4z*cos(tanval); - - // Rotate Y - tanval=-(double)C4WFY2Val*PI*2/128; - c4x2=c4x*cos(tanval)+c4z2*sin(tanval); - c4z=c4x*-sin(tanval)+c4z2*cos(tanval); - - // Rotate Z - tanval=-(double)C4WFDist*PI*2/128; - c4x=c4x2*cos(tanval)-c4y2*sin(tanval); - c4y=c4x2*sin(tanval)+c4y2*cos(tanval); - - // Scale - C4WFXVal=(short)(c4x*C4WFScale/0x100); - C4WFYVal=(short)(c4y*C4WFScale/0x100); -} - -void C4CalcWireFrame() -{ - C4WFXVal=C4WFX2Val-C4WFXVal; - C4WFYVal=C4WFY2Val-C4WFYVal; - if (abs(C4WFXVal)>abs(C4WFYVal)){ - C4WFDist=abs(C4WFXVal)+1; - C4WFYVal=(short)((256*(long)C4WFYVal)/abs(C4WFXVal)); - if (C4WFXVal<0) C4WFXVal=-256; - else C4WFXVal=256; - } - else - if (C4WFYVal!=0) { - C4WFDist=abs(C4WFYVal)+1; - C4WFXVal=(short)((256*(long)C4WFXVal)/abs(C4WFYVal)); - if (C4WFYVal<0) C4WFYVal=-256; - else C4WFYVal=256; - } - else C4WFDist=0; -} - -short C41FXVal; -short C41FYVal; -short C41FAngleRes; -short C41FDist; -short C41FDistVal; - -void C4Op1F() -{ - if (C41FXVal == 0) { - if (C41FYVal>0) C41FAngleRes=0x80; - else C41FAngleRes=0x180; - } - else { - tanval = ((double)C41FYVal)/((double)C41FXVal); - C41FAngleRes=(short)(atan(tanval)/(PI*2)*512); - C41FAngleRes=C41FAngleRes; - if (C41FXVal<0) C41FAngleRes+=0x100; - C41FAngleRes&=0x1FF; - } -} - -void C4Op15() -{ - tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)* - ((double)C41FXVal)); - C41FDist=(short)tanval; -} - -void C4Op0D() -{ - tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)* - ((double)C41FXVal)); - tanval=(double)C41FDistVal/tanval; - C41FYVal=(short)(((double)C41FYVal*tanval)*0.99); - C41FXVal=(short)(((double)C41FXVal*tanval)*0.98); -} - -#define READ_WORD(s) (*(unsigned short *) (s)) -void C4Op22() -{ - extern unsigned char *C4Ram; - short angle1 = READ_WORD(C4Ram+0x1f8c) & 0x1ff; - short angle2 = READ_WORD(C4Ram+0x1f8f) & 0x1ff; - int tan1 = Tan(angle1); - int tan2 = Tan(angle2); - short y = READ_WORD(C4Ram+0x1f83) - READ_WORD(C4Ram+0x1f89); - short left, right; - - int j; - for (j = 0; j < 225; j++, y++) - { - if (y >= 0) - { - left = (((int)tan1*y) >> 16) - READ_WORD(C4Ram+0x1f80) + READ_WORD(C4Ram+0x1f86); - right = (((int)tan2*y) >> 16) - READ_WORD(C4Ram+0x1f80) + READ_WORD(C4Ram+0x1f86) + READ_WORD(C4Ram+0x1f93); - - if(left<0 && right<0) - { - left = 1; - right = 0; - } - else if (left < 0) - { - left = 0; - } - else if (right < 0) - { - right = 0; - } - if (left > 255 && right > 255) - { - left = 255; - right = 254; - } - else if (left > 255) - { - left = 255; - } - else if (right > 255) - { - right = 255; - } - } - else - { - left = 1; - right = 0; - } - C4Ram[j+0x800] = (unsigned char)left; - C4Ram[j+0x900] = (unsigned char)right; - } -} diff --git a/tools/zsnes/src/chips/c4proc.asm b/tools/zsnes/src/chips/c4proc.asm deleted file mode 100644 index 9e8672f..0000000 --- a/tools/zsnes/src/chips/c4proc.asm +++ /dev/null @@ -1,2205 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 C4TransfWireFrame2,snesmmap,pressed,romdata,vidbuffer -EXTSYM C4WFXVal,C4WFYVal,C4WFX2Val,C4WFY2Val,C4CalcWireFrame -EXTSYM C4WFDist,C4WFScale,C4TransfWireFrame,C4WFZVal -EXTSYM C41FXVal,C41FYVal,C41FAngleRes,C41FDist,C4Op1F,C4Op15 -EXTSYM C41FDistVal,C4Op0D,C4Op22,SinTable,CosTable -EXTSYM regaccessbankr8,regaccessbankr16,regaccessbankw8,regaccessbankw16 -EXTSYM memaccessbankr16,memaccessbankr8,memaccessbankw16,memaccessbankw8 - -; ****************************************************** -; C4 Emulation, reverse engineered & written by zsKnight -; ****************************************************** - -SECTION .text - -%macro RouteAccess 1 - test ecx,8000h - jnz memaccessbank%1 - cmp ecx,6000h - jb regaccessbank%1 -%endmacro - -NEWSYM C4Read8b - RouteAccess r8 - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[C4RamR] - call dword near [ebx+ecx*4] - xor ebx,ebx - pop ecx - ret - -NEWSYM C4Read16b - RouteAccess r16 - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[C4RamR] - inc ecx - call dword near [ebx+ecx*4] - dec ecx - mov ah,al - call dword near [ebx+ecx*4] - xor ebx,ebx - pop ecx - ret - -NEWSYM C4Write8b - RouteAccess w8 - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[C4RamW] - call dword near [ebx+ecx*4] - xor ebx,ebx - pop ecx - ret - -NEWSYM C4Write16b - RouteAccess w16 - push ecx - sub ecx,6000h - and ecx,1fffh -; mov ebx,[C4Ram] -; mov [ebx+ecx],ax - mov ebx,[C4RamW] - push eax - call dword near [ebx+ecx*4] - inc ecx - mov al,ah - call dword near [ebx+ecx*4] - pop eax - xor ebx,ebx - pop ecx - ret - -C4ProcessVectors: - mov esi,[C4Ram] - mov edi,esi - add edi,1F8Ch - movzx edx,word[esi+1F8Ah] - cmp dx,128 - ja .ret - cmp dx,0 - jne .nozero -.ret - ret -.nozero - cmp dx,10h - jb .less - mov dx,10h -.less - mov esi,[C4Ram] - add esi,800h -.loop - mov ecx,100h - xor ebx,ebx - xor eax,eax - movsx bx,byte[edi] -.spotloop - add ah,80h - mov [esi],ah - sub ah,80h - add ax,bx - inc esi - dec ecx - jnz .spotloop - add edi,3 - dec dx - jnz .loop - ret - -section .data -C4ColRot db 1 - -SECTION .bss -NEWSYM C4RamR, resd 1 -NEWSYM C4RamW, resd 1 -NEWSYM C4Ram, resd 1 -C4ObjDisp resd 1 -NEWSYM C4ObjSelec, resb 1 -NEWSYM C4SObjSelec, resb 1 -NEWSYM C4Pause, resb 1 -C4DataCopy resb 64 -CObjNum resw 1 -C4Temp resd 1 -section .text - -C4Edit: - ; C4 editing routines - ; Register keyboard presses - ; [ = prev object, ] = next object - ; p = pause/unpause - cmp byte[pressed+1Ah],0 - je .notpressed - mov byte[pressed+1Ah],0 - inc byte[C4ObjSelec] - inc byte[C4Temp] -.notpressed - cmp byte[pressed+1Bh],0 - je .notpressed2 - mov byte[pressed+1Bh],0 - dec byte[C4ObjSelec] - dec byte[C4Temp] -.notpressed2 - cmp byte[pressed+19h],0 - je .notpressed3 - mov byte[pressed+19h],0 - xor byte[C4Pause],1 -.notpressed3 - - ; Setup variables - mov esi,[C4Ram] - add byte[C4ColRot],16 - mov al,[esi+620h] - cmp byte[C4ObjSelec],0FFh - jne .notneg - dec al - mov [C4ObjSelec],al - jmp .notof -.notneg - cmp byte[C4ObjSelec],al - jb .notof - xor al,al - mov [C4ObjSelec],al -.notof - - ; Draw the dots on-screen - movzx eax,byte[C4ObjSelec] - shl eax,4 - add eax,[C4Ram] - add eax,220h - mov byte[.flipped],0 - test byte[eax+6],40h - jz .notflip - mov byte[.flipped],1 -.notflip - -; 00/01 - x position relative to BG scroll value -; 02/03 - y position relative to BG scroll value -; 04 - palette/priority settings -; 05 - OAM pointer value -; 06 - flip settings : b6 = flipx, b7 = flipy -; 07 - looks like some sprite displacement values -; 08/09 - ??? -; 0A-0F - unused - movzx ebx,word[eax+8] - mov [CObjNum],bx - cmp bx,4096 - jae near .skipall - shl ebx,6 - add ebx,[C4Data] - - ; t,f,g,h = move current object - ; q = copy current object structure, w = paste current object structure - cmp byte[pressed+14h],0 - je .notmove - mov byte[pressed+14h],0 - pushad - mov ecx,15 -.next - add ebx,4 - dec byte[ebx+1] - dec ecx - jnz .next - popad -.notmove - cmp byte[pressed+21h],0 - je .notmove2 - mov byte[pressed+21h],0 - pushad - mov ecx,15 -.next2 - add ebx,4 - cmp byte[.flipped],0 - je .noflipx - add byte[ebx],2 -.noflipx - dec byte[ebx] - dec ecx - jnz .next2 - popad -.notmove2 - cmp byte[pressed+22h],0 - je .notmove3 - mov byte[pressed+22h],0 - pushad - mov ecx,15 -.next3 - add ebx,4 - inc byte[ebx+1] - dec ecx - jnz .next3 - popad -.notmove3 - cmp byte[pressed+23h],0 - je .notmove4 - mov byte[pressed+23h],0 - pushad - mov ecx,15 -.next4 - add ebx,4 - cmp byte[.flipped],0 - je .noflipx2 - sub byte[ebx],2 -.noflipx2 - inc byte[ebx] - dec ecx - jnz .next4 - popad -.notmove4 - cmp byte[pressed+10h],0 - je .notcopy - mov byte[pressed+10h],0 - pushad - mov edx,C4DataCopy - mov ecx,64 -.copylp - mov al,[ebx] - mov [edx],al - inc ebx - inc edx - dec ecx - jnz .copylp - popad -.notcopy - cmp byte[pressed+11h],0 - je .notpaste - mov byte[pressed+11h],0 - pushad - mov edx,C4DataCopy - mov ecx,64 -.pastelp - mov al,[edx] - mov [ebx],al - inc ebx - inc edx - dec ecx - jnz .pastelp - popad -.notpaste - - ; - = remove sub-object, + = add sub-object - ; ; = previous sub-object, ' = next sub-object - cmp byte[pressed+0Ch],0 - je .notpressed4 - mov byte[pressed+0Ch],0 - cmp byte[ebx],0 - je .notpressed4 - dec byte[ebx] -.notpressed4 - cmp byte[pressed+0Dh],0 - je .notpressed5 - mov byte[pressed+0Dh],0 - cmp byte[ebx],15 - je .notpressed5 - inc byte[ebx] -.notpressed5 - cmp byte[pressed+27h],0 - je .notpressed6 - mov byte[pressed+27h],0 - dec byte[C4SObjSelec] -.notpressed6 - cmp byte[pressed+28h],0 - je .notpressed7 - mov byte[pressed+28h],0 - inc byte[C4SObjSelec] -.notpressed7 - - ; get current sub-object displacement (0 if no sub-objects) - xor ecx,ecx - cmp byte[ebx],0 - je near .nosubobjs - - mov cl,[ebx] - cmp byte[C4ObjSelec],0FFh - jne .sobjokay2 - dec cl - mov [C4SObjSelec],cl - jmp .sobjokay -.sobjokay2 - cmp byte[C4SObjSelec],cl - jb .sobjokay - mov byte[C4SObjSelec],0 -.sobjokay - - movzx ecx,byte[C4SObjSelec] - shl ecx,2 - add ebx,ecx - add ebx,4 - - ; i,j,k,l = move current sub-object (17,24,25,26) - ; u = toggle between 8x8 and 16x16 tiles - ; o = toggle between high/low oam value - ; . = decrease oam value, / = increase oam value of sub-object - cmp byte[pressed+17h],0 - je .notpressed8 - mov byte[pressed+17h],0 - dec byte[ebx+1] -.notpressed8 - cmp byte[pressed+24h],0 - je .notpressed9 - mov byte[pressed+24h],0 - dec byte[ebx] - cmp byte[.flipped],0 - je .notpressed9 - add byte[ebx],2 -.notpressed9 - cmp byte[pressed+26h],0 - je .notpressed11 - mov byte[pressed+26h],0 - inc byte[ebx] - cmp byte[.flipped],0 - je .notpressed11 - sub byte[ebx],2 -.notpressed11 - cmp byte[pressed+25h],0 - je .notpressed10 - mov byte[pressed+25h],0 - inc byte[ebx+1] -.notpressed10 - cmp byte[pressed+16h],0 - je .notpressed12 - mov byte[pressed+16h],0 - xor byte[ebx+3],2 -.notpressed12 - cmp byte[pressed+18h],0 - je .notpressed13 - mov byte[pressed+18h],0 - xor byte[ebx+3],1 -.notpressed13 - cmp byte[pressed+34h],0 - je .notpressed14 - mov byte[pressed+34h],0 - dec byte[ebx+2] -.notpressed14 - cmp byte[pressed+35h],0 - je .notpressed15 - mov byte[pressed+35h],0 - inc byte[ebx+2] -.notpressed15 - - mov cl,[ebx] - mov ch,[ebx+1] -.nosubobjs - mov edx,ecx - movzx ebx,byte[eax] - sub bl,[esi+621h] - add bl,dl - movzx ecx,byte[eax+2] - sub cl,[esi+623h] - add cl,dh - mov esi,[vidbuffer] - add esi,16*2+256*2+32*2 - add esi,ebx - add esi,ebx - mov ebx,ecx - shl ebx,9 - shl ecx,6 - add esi,ebx - add esi,ecx - mov al,[C4ColRot] - mov ah,al - xor ah,0FFh - mov [esi],ax - mov [esi+16],ax - mov [esi+288*8*2],ax - mov [esi+16+288*8*2],ax -.skipall - ret -SECTION .bss -.flipped resb 1 -SECTION .text - -C4AddSprite: - cmp dword[C4count],0 - je near .nosprite - mov [edi],ax - mov [edi+2],bx - mov ebx,[C4usprptr] - and [ebx],dl - mov al,dl - xor al,0FFh - and dh,al - or [ebx],dh - add edi,4 - rol dl,2 - rol dh,2 - dec dword[C4count] - cmp dl,0FCh - jne .nosprite - inc dword[C4usprptr] -.nosprite - ret - -C4ConvOAM: - mov esi,[C4Ram] - mov edi,esi - movzx ecx,byte[esi+620h] - mov bx,[esi+621h] - mov [.addx],bx - mov bx,[esi+623h] - mov [.addy],bx - mov [C4usprptr],esi - add dword[C4usprptr],200h - mov eax,[C4ObjDisp] - add edi,eax - shr eax,4 - add dword[C4usprptr],eax - add esi,220h - ; Convert from esi to edi - mov dl,0FCh - push ecx - mov cl,[C4sprites] - and cl,3 - add cl,cl - rol dl,cl - pop ecx - cmp cl,0 - je near .none - mov dword[C4count],128 - mov eax,[C4sprites] - sub dword[C4count],eax - -.loop - push ecx - push esi -; 00/01 - x position relative to BG scroll value -; 02/03 - y position relative to BG scroll value -; 04 - palette/priority settings -; 05 - OAM pointer value -; 06 - flip settings : b6 = flipx, b7 = flipy -; 07 - ??? -; 08/09 - Pointer to Sprite Structure -; 0A-0F - unused -;bit 1-3 = palette number bit 4,5 = playfield priority -;bit 6 = horizontal flip bit 7 = horizonal flip - mov ax,[esi] - sub ax,[.addx] - mov [C4SprX],ax - mov ax,[esi+2] - sub ax,[.addy] - mov [C4SprY],ax - mov al,[esi+5] - mov [C4SprOAM],al - mov al,[esi+4] - mov ah,al - and ah,0Eh - mov [C4SprAttr],al - mov al,[esi+6] - or [C4SprAttr],al -; mov [C4SprFlip],al - - movzx ecx,byte[esi+9] - shl ecx,16 - mov cx,[esi+7] - add cx,cx - shr ecx,1 - add ecx,[romdata] - - mov al,[ecx] - or al,al - jz near .singlespr - mov [C4SprCnt],al - inc ecx -.nextspr - xor ebx,ebx - movsx bx,byte[ecx+1] - test byte[C4SprAttr],40h - jz .notflipx - neg bx - sub bx,8 -.notflipx - add bx,[C4SprX] - xor dh,dh - test byte[ecx],20h - jz .no16x16 - or dh,10101010b - test byte[C4SprAttr],40h - jz .no16x16 - sub bx,8 -.no16x16 - cmp bx,-16 - jl near .nosprite - cmp bx,272 - jg near .nosprite - mov al,bl - test bx,100h - jz .not512b - or dh,01010101b -.not512b - xor ebx,ebx - movsx bx,byte[ecx+2] - test byte[C4SprAttr],80h - jz .notflipy - neg bx - sub bx,8 -.notflipy - add bx,[C4SprY] - test byte[ecx],20h - jz .no16x16b - test byte[C4SprAttr],80h - jz .no16x16b - sub bx,8 -.no16x16b - cmp bx,-16 - jl near .nosprite - cmp bx,224 - jg near .nosprite - mov ah,bl - mov bh,[C4SprAttr] - mov bl,[ecx] - and bl,0C0h - xor bh,bl - mov bl,[C4SprOAM] - add bl,[ecx+3] - call C4AddSprite -.nosprite - add ecx,4 - dec byte[C4SprCnt] - jnz near .nextspr - jmp .donemultispr -.singlespr - mov dh,10101010b - test byte[C4SprX+1],1 - jz .not512 - or dh,01010101b -.not512 - mov al,[C4SprX] - mov ah,[C4SprY] - mov bl,[C4SprOAM] - mov bh,[C4SprAttr] - call C4AddSprite -.donemultispr - pop esi - pop ecx - add esi,16 - dec cl - jnz near .loop -.none - ret - -section .bss -.addx resw 1 -.addy resw 1 - -C4count resd 1 -C4usprptr resd 1 -C4SprX resw 1 -C4SprY resw 1 -C4SprCnt resb 1 -C4SprAttr resb 1 -C4SprOAM resb 1 -C4SprFlip resb 1 - -section .text - -NEWSYM C4VBlank - ret -NEWSYM C4ProcessSprites - push ecx - push esi - push edi - push ebx - push edx -; call C4ProcessVectors - -; call C4Edit - - mov esi,[C4Ram] - mov dword[C4count],8 - mov cl,[esi+626h] - mov [C4sprites],cl - mov ecx,[C4sprites] - shl ecx,2 - mov [C4ObjDisp],ecx - mov ecx,128 -; cmp byte[esi+65],50h -; jne .noincdisp - mov dword[C4count],32 - sub ecx,[C4sprites] -.noincdisp - add esi,[C4ObjDisp] - ; Clear OAM to-be ram -.next - mov byte[esi+1],0E0h - add esi,4 - dec ecx - jnz .next - - call C4ConvOAM - - pop edx - pop ebx - pop edi - pop esi - pop ecx - ret - -section .bss -C4Data resd 1 -C4sprites resd 1 - -SECTION .text - -NEWSYM InitC4 - pushad - mov esi,[romdata] - add esi,4096*1024 - mov [C4Data],esi - add dword[C4Data],128*1024 - mov [C4RamR],esi - mov [C4RamW],esi - mov [C4Ram],esi - add dword[C4RamW],8192*4 - add dword[C4Ram],8192*8 - mov ecx,8192 -.c4loop - mov dword[esi],C4ReadReg - mov dword[esi+8192*4],C4WriteReg - mov dword[esi+8192*8],0 - add esi,4 - dec ecx - jnz .c4loop - mov esi,[C4RamW] - mov dword[esi+1F4Fh*4],C4RegFunction - mov esi,[C4Data] - mov ecx,16*4096 -.c4loopb - mov dword[esi],0 - add esi,4 - dec ecx - jnz .c4loopb - popad - ret - -C4ClearSpr: - mov esi,ebx - mov edi,eax - shl ch,3 -.scloop2 - mov cl,[C4SprPos] - shl cl,2 -.scloop - mov byte[edi],0 - mov byte[edi+2000h],0 - inc edi - dec cl - jnz .scloop - dec ch - jnz .scloop2 - ret - -C4SprBitPlane: - mov edi,eax - shl ebx,2 -.scloop3 - mov ch,[C4SprPos] - push esi -.scloop4 - push esi - mov cl,8 -.loop - mov dh,8 - mov dl,80h - mov eax,[esi] -.nextd - test al,1 - jz .not0 - or byte[edi],dl -.not0 - test al,2 - jz .not1 - or byte[edi+1],dl -.not1 - test al,4 - jz .not2 - or byte[edi+16],dl -.not2 - test al,8 - jz .not3 - or byte[edi+17],dl -.not3 - shr eax,4 - shr dl,1 - dec dh - jnz .nextd - add esi,ebx - add edi,2 - dec cl - jnz .loop - add edi,16 - pop esi - add esi,4 - dec ch - jnz .scloop4 - pop esi - shl ebx,3 - add esi,ebx - add edi,dword[C4SprPtrInc] - shr ebx,3 - dec byte[C4SprPos+1] - jnz .scloop3 -.end - ret - -SECTION .bss -C4XXScale resw 1 -C4XYScale resw 1 -C4YXScale resw 1 -C4YYScale resw 1 -C4CXPos resw 1 -C4CYPos resw 1 -C4CXMPos resd 1 -C4CYMPos resd 1 -C4PCXMPos resd 1 -C4PCYMPos resd 1 -SECTION .text - -DoScaleRotate: - pushad - mov esi,eax - ; Calculate X scaler - mov ax,[esi+1F80h] - and eax,01FFh - mov ax,[CosTable+eax*2] - mov bx,[esi+1F8Fh] - test bx,8000h - jz .notover - mov bx,7FFFh -.notover - imul bx - add ax,ax - adc dx,dx - mov [C4XXScale],dx - mov ax,[esi+1F80h] - and eax,01FFh - mov ax,[SinTable+eax*2] - imul bx - add ax,ax - adc dx,dx - mov [C4XYScale],dx - ; Calculate Y scaler - mov ax,[esi+1F80h] - and eax,01FFh - mov ax,[CosTable+eax*2] - mov bx,[esi+1F92h] - test bx,8000h - jz .notoverb - mov bx,7FFFh -.notoverb - imul bx - add ax,ax - add dx,dx - mov [C4YYScale],dx - mov ax,[esi+1F80h] - and eax,01FFh - mov ax,[SinTable+eax*2] - imul bx - add ax,ax - adc dx,dx - neg dx - mov [C4YXScale],dx - cmp word[esi+1F80h],0 - jne .effect - cmp word[esi+1F92h],1000h - jne .effect - mov word[C4YYScale],1000h - mov word[C4YXScale],0 -.effect - ; Calculate Pixel Resolution - mov cl,[C4SprPos] - shl cl,3 - mov [C4SprPos+2],cl - mov cl,[C4SprPos+1] - shl cl,3 - mov [C4SprPos+3],cl - ; Calculate Positions - ; (1-scale)*(pos/2) - movzx eax,byte[C4SprPos+2] - shl eax,11 - mov [C4PCXMPos],eax - movzx eax,byte[C4SprPos+3] - shl eax,11 - mov [C4PCYMPos],eax - - mov bx,[C4XXScale] - movzx eax,byte[C4SprPos+2] - shr ax,1 - imul bx - shl edx,16 - mov dx,ax - sub [C4PCXMPos],edx - mov bx,[C4YXScale] - movzx eax,byte[C4SprPos+3] - shr ax,1 - imul bx - shl edx,16 - mov dx,ax - sub [C4PCXMPos],edx - - mov bx,[C4XYScale] - movzx eax,byte[C4SprPos+2] - shr ax,1 - imul bx - shl edx,16 - mov dx,ax - sub [C4PCYMPos],edx - mov bx,[C4YYScale] - movzx eax,byte[C4SprPos+3] - shr ax,1 - imul bx - shl edx,16 - mov dx,ax - sub [C4PCYMPos],edx - - ; Start loop - mov word[C4CYPos],0 - xor edi,edi -.loop - mov ecx,[C4PCXMPos] - mov [C4CXMPos],ecx - mov ecx,[C4PCYMPos] - mov [C4CYMPos],ecx - mov al,[C4SprPos+2] - mov [C4CXPos],al -.loop2 - movzx eax,byte[C4SprPos+2] - mov ebx,[C4CXMPos] - sar ebx,12 - cmp ebx,eax - jae near .blank - movzx eax,byte[C4SprPos+3] - mov ebx,[C4CYMPos] - sar ebx,12 - cmp ebx,eax - jae near .blank - ; Get pixel value - mov ebx,[C4CYMPos] - shr ebx,12 - movzx eax,byte[C4SprPos+2] - mul ebx - mov ebx,[C4CXMPos] - shr ebx,12 - add eax,ebx - mov ebx,[C4SprPtr] - test al,1 - jnz .upperb - shr eax,1 - add ebx,eax - mov al,[ebx] - jmp .lowerb -.upperb - shr eax,1 - add ebx,eax - mov al,[ebx] - shr al,4 -.lowerb - mov ebx,edi - shr ebx,1 - add ebx,esi - test edi,1 - jnz .upperb2 - and al,0Fh - and byte[ebx+2000h],0F0h - or byte[ebx+2000h],al - jmp .done -.upperb2 - shl al,4 - and byte[ebx+2000h],0Fh - or byte[ebx+2000h],al - jmp .done -.blank - mov eax,edi - shr eax,1 - add eax,esi - test edi,1 - jnz .upper - and byte[eax+2000h],0F0h - jmp .done -.upper - and byte[eax+2000h],0Fh -.done - movsx eax,word[C4XXScale] - add [C4CXMPos],eax - movsx eax,word[C4XYScale] - add [C4CYMPos],eax - inc edi - dec byte[C4CXPos] - jne near .loop2 - movsx eax,word[C4YXScale] - add [C4PCXMPos],eax - movsx eax,word[C4YYScale] - add [C4PCYMPos],eax - inc word[C4CYPos] - mov al,[C4SprPos+3] - cmp byte[C4CYPos],al - jne near .loop -.noimage - popad - ret - -DoScaleRotate2: - pushad - movzx ebx,word[eax+1F8Fh] - cmp bx,1000h - ja .scaled - mov bx,1000h -.scaled - mov [C4SprScale],ebx - movzx ebx,word[eax+1F92h] - cmp bx,1000h - ja .scaledb - mov bx,1000h -.scaledb - mov [C4SprScaleY],ebx - mov cl,[C4SprPos] - shl cl,3 - mov ch,cl - xor ebx,ebx -.leftovercheck - dec ch - add ebx,[C4SprScale] -.leftovercheckb - cmp ebx,1000h - jb .leftovercheck - sub ebx,1000h - dec cl - jz .donecheck - jmp .leftovercheckb -.donecheck - shr ch,1 - mov cl,ch - and ecx,0FFh - mov esi,ecx - - mov cl,[C4SprPos+1] - shl cl,3 - mov ch,cl - xor ebx,ebx -.leftovercheckc - dec ch - add ebx,[C4SprScaleY] -.leftovercheckd - cmp ebx,1000h - jb .leftovercheckc - sub ebx,1000h - dec cl - jz .donecheckc - jmp .leftovercheckd -.donecheckc - shr ch,1 - mov cl,ch - and ecx,0FFh - push eax - movzx eax,byte[C4SprPos] - shl al,3 - mul ecx - add esi,eax - pop eax - - mov dword[C4SprScalerY],0 - xor edi,edi - mov cl,[C4SprPos+1] - shl cl,3 - mov [C4SprPos+3],cl -.next - push esi - push edi - movzx ecx,byte[C4SprPos] - shl cl,3 - mov ch,cl - mov dword[C4SprScaler],0 - xor edx,edx -.loop - mov edx,edi - shr edx,1 - add edx,[C4SprPtr] - mov bl,[edx] - test esi,1 - jz .notupper - shr bl,4 -.notupper - and bl,0Fh - mov edx,esi - shr edx,1 - test esi,1 - jz .notupperb - shl bl,4 - or byte[eax+edx+2000h],bl - jmp .notlowerb -.notupperb - or byte[eax+edx+2000h],bl -.notlowerb - inc esi - mov ebx,[C4SprScale] - add dword[C4SprScaler],ebx - dec ch -.nextcheck - cmp dword[C4SprScaler],1000h - jb near .loop - sub dword[C4SprScaler],1000h - inc edi - dec cl - jz .done - jmp .nextcheck -.done - pop edi - pop esi - movzx edx,byte[C4SprPos] - shl dl,3 - add esi,edx - - mov ebx,[C4SprScaleY] - add dword[C4SprScalerY],ebx -.nextcheckb - cmp dword[C4SprScalerY],1000h - jb near .next - sub dword[C4SprScalerY],1000h - add edi,edx - dec byte[C4SprPos+3] - jz .doneb - jmp .nextcheckb -.doneb - - popad - ret - -C4SprScaleR: - push ecx - push ebx - push edx - push esi - push edi - mov dword[C4SprPtrInc],0 - movzx ebx,byte[eax+1F42h] - shl ebx,16 - mov bx,[eax+1F40h] - add bx,bx - shr ebx,1 - add ebx,[romdata] - mov ch,[eax+1F8Ch] - shr ch,3 - mov cl,[eax+1F89h] - shr cl,3 - mov [C4SprPos],cx - mov [C4SprPtr],ebx - - call C4ClearSpr - - call DoScaleRotate - - mov esi,eax - add esi,2000h - movzx ebx,byte[C4SprPos] - call C4SprBitPlane - pop edi - pop esi - pop edx - pop ebx - pop ecx - ret - -C4SprRotateR: - push ecx - push ebx - push edx - push esi - push edi - xor ebx,ebx - mov ebx,600h - add ebx,[C4Ram] - mov [C4SprPtr],esi - mov ch,[eax+1F8Ch] - shr ch,3 - mov cl,[eax+1F89h] - shr cl,3 - add ch,2 - mov [C4SprPos],cx - mov dword[C4SprPtrInc],64 - mov [C4SprPtr],ebx - sub byte[C4SprPos+1],2 - call C4ClearSpr - - call DoScaleRotate - mov esi,eax - add esi,2000h - movzx ebx,byte[C4SprPos] - add byte[C4SprPos+1],2 - call C4SprBitPlane - pop edi - pop esi - pop edx - pop ebx - pop ecx - ret - -C4SprDisintegrate: - pushad - mov dword[C4SprPtrInc],0 - movzx ebx,byte[eax+1F42h] - shl ebx,16 - mov bx,[eax+1F40h] - add bx,bx - shr ebx,1 - add ebx,[romdata] - mov ch,[eax+1F8Ch] - shr ch,3 - mov cl,[eax+1F89h] - shr cl,3 - mov [C4SprPos],cx - mov [C4SprPtr],ebx - - call C4ClearSpr - - mov esi,[C4Ram] - movzx ebx,word[esi+1F86h] - movzx eax,byte[esi+1F89h] - shr al,1 - mul ebx - neg eax - movzx ebx,byte[esi+1F89h] - shr bl,1 - shl ebx,8 - add eax,ebx - push eax - movzx ebx,word[esi+1F8Fh] - movzx eax,byte[esi+1F8Ch] - shr al,1 - mul ebx - neg eax - movzx ebx,byte[esi+1F8Ch] - shr bl,1 - shl ebx,8 - add ebx,eax - mov edx,ebx - pop ebx - mov esi,[C4Ram] - mov cl,[esi+1F89h] - mov ch,[esi+1F8Ch] - mov [C4SprPos+2],cx - movsx eax,word[esi+1F86h] - mov [.scalex],eax - movsx eax,word[esi+1F8Fh] - mov [.scaley],eax - mov esi,[C4SprPtr] - mov edi,[C4Ram] - add edi,2000h - - ; convert to 8-bit bitmap - mov cx,[C4SprPos+2] - shr cl,1 -.loop2 - mov al,[esi] - mov [edi],al - mov al,[esi] - shr al,4 - mov [edi+1],al - inc esi - add edi,2 - dec cl - jnz .loop2 - dec ch - jnz .loop2 - - mov edi,[C4Ram] - add edi,4000h - mov ecx,2000h -.lp - mov byte[edi],0 - inc edi - dec ecx - jnz .lp - - mov esi,[C4Ram] - add esi,2000h - mov edi,[C4Ram] - add edi,4000h - - mov cx,[C4SprPos+2] -.next2 - push ebx -.next - xor eax,eax - mov ah,[C4SprPos+2] - cmp ebx,eax - jae .fail - xor eax,eax - mov ah,[C4SprPos+3] - cmp edx,eax - jae .fail - push ecx - push edx - movzx eax,byte[C4SprPos+2] - movzx ecx,dh - mul ecx - mov ecx,ebx - shr ecx,8 - add eax,ecx - mov dl,[esi] - cmp eax,2000h - jae .skipdisi - mov [edi+eax],dl -.skipdisi - pop edx - pop ecx -.fail - inc esi - add ebx,[.scalex] - dec cl - jnz near .next - pop ebx - add edx,[.scaley] - mov cl,[C4SprPos+2] - dec ch - jnz near .next2 - -.skipall - ; convert to 4-bit bitmap - mov esi,[C4Ram] - add esi,4000h - mov edi,[C4Ram] - add edi,6000h - mov cx,[C4SprPos+2] - shr cl,1 -.loop - mov al,[esi] - mov [edi],al - mov al,[esi+1] - shl al,4 - or [edi],al - inc edi - add esi,2 - dec cl - jnz .loop - dec ch - jnz .loop - - mov esi,[C4Ram] - add esi,6000h - mov eax,[C4Ram] - movzx ebx,byte[C4SprPos] - call C4SprBitPlane - - popad - ret - -SECTION .bss -.scalex resd 1 -.scaley resd 1 - -SECTION .text - -C4BitPlaneWave: - pushad - mov esi,[C4Ram] - mov dword[.temp],10h - movzx eax,byte[esi+1F83h] - mov [.waveptr],eax - mov word[.temp+4],0C0C0h - mov word[.temp+6],03F3Fh -.bmloopb - mov edi,[C4Ram] - add edi,[.waveptr] - xor eax,eax - movsx ax,byte[edi+$0B00] - neg ax - sub ax,16 - mov edi,[C4Ram] - add edi,0A00h - xor ecx,ecx -.bmloopa - mov ebx,[.bmptr+ecx*4] - mov dx,[.temp+6] - and [esi+ebx],dx - xor dx,dx - cmp ax,0 - jl .less - mov dx,0FF00h - cmp ax,8 - jae .less - mov dx,[edi+eax*2] -.less - and dx,[.temp+4] - or [esi+ebx],dx - inc ax - inc ecx - cmp ecx,28h - jne .bmloopa - add dword[.waveptr],1 - and dword[.waveptr],07Fh - ror word[.temp+4],2 - ror word[.temp+6],2 - cmp word[.temp+4],0C0C0h - jne near .bmloopb - add esi,16 -.bmloopa2b - mov edi,[C4Ram] - add edi,[.waveptr] - xor eax,eax - movsx ax,byte[edi+$0B00] - neg ax - sub ax,16 - mov edi,[C4Ram] - add edi,0A00h - xor ecx,ecx -.bmloopa2 - mov ebx,[.bmptr+ecx*4] - mov dx,[.temp+6] - and [esi+ebx],dx - xor dx,dx - cmp ax,0 - jl .less2 - mov dx,0FF00h - cmp ax,8 - jae .less2 - mov dx,[edi+eax*2+16] -.less2 - and dx,[.temp+4] - or [esi+ebx],dx - inc ax - inc ecx - cmp ecx,28h - jne .bmloopa2 - add dword[.waveptr],1 - and dword[.waveptr],07Fh - ror word[.temp+4],2 - ror word[.temp+6],2 - cmp word[.temp+4],0C0C0h - jne near .bmloopa2b - add esi,16 - dec dword[.temp] - jnz near .bmloopb - mov esi,[C4Ram] -; mov cx,[esi+1F80h] -; mov [C4values],cx -; mov cx,[esi+1F83h] -; mov [C4values+2],cx - popad - ret -SECTION .data -.bmptr dd 0000h,0002h,0004h,0006h,0008h,000Ah,000Ch,000Eh - dd 0200h,0202h,0204h,0206h,0208h,020Ah,020Ch,020Eh - dd 0400h,0402h,0404h,0406h,0408h,040Ah,040Ch,040Eh - dd 0600h,0602h,0604h,0606h,0608h,060Ah,060Ch,060Eh - dd 0800h,0802h,0804h,0806h,0808h,080Ah,080Ch,080Eh -SECTION .bss -.temp resd 2 -.waveptr resd 1 - -SECTION .text - -C4DrawLine: - pushad - - ; transform both coordinates - push esi - mov ax,[C4X1] - mov [C4WFXVal],ax - mov ax,[C4Y1] - mov [C4WFYVal],ax - mov ax,[C4Z1] - mov [C4WFZVal],ax - mov al,[esi+1F90h] - mov [C4WFScale],al - mov al,[esi+1F86h] - mov [C4WFX2Val],al - mov al,[esi+1F87h] - mov [C4WFY2Val],al - mov al,[esi+1F88h] - mov [C4WFDist],al - call C4TransfWireFrame2 - mov ax,[C4WFXVal] - mov [C4X1],ax - mov ax,[C4WFYVal] - mov [C4Y1],ax - - mov ax,[C4X2] - mov [C4WFXVal],ax - mov ax,[C4Y2] - mov [C4WFYVal],ax - mov ax,[C4Z2] - mov [C4WFZVal],ax - call C4TransfWireFrame2 - mov ax,[C4WFXVal] - mov [C4X2],ax - mov ax,[C4WFYVal] - mov [C4Y2],ax - - add word[C4X1],48 - add word[C4Y1],48 - add word[C4X2],48 - add word[C4Y2],48 - shl dword[C4X1],8 - shl dword[C4X2],8 - shl dword[C4Y1],8 - shl dword[C4Y2],8 - ; get line info - mov ax,[C4X1+1] - mov [C4WFXVal],ax - mov ax,[C4Y1+1] - mov [C4WFYVal],ax - mov ax,[C4X2+1] - mov [C4WFX2Val],ax - mov ax,[C4Y2+1] - mov [C4WFY2Val],ax - call C4CalcWireFrame - movzx ecx,word[C4WFDist] - or ecx,ecx - jnz .not0 - mov ecx,1 -.not0 - movsx eax,word[C4WFXVal] - mov [C4X2],eax - movsx eax,word[C4WFYVal] - mov [C4Y2],eax - pop esi - ; render line -.loop - ; plot pixel - cmp word[C4X1+1],0 - jl near .noplot - cmp word[C4Y1+1],0 - jl near .noplot - cmp word[C4X1+1],95 - jg near .noplot - cmp word[C4Y1+1],95 - jg near .noplot - mov dx,[C4Y1+1] - shr dx,3 - movzx eax,dx - shl ax,6 - shl dx,8 - sub dx,ax - mov ax,[C4X1+1] - shr ax,3 - shl ax,4 - add ax,dx - mov dx,[C4Y1+1] - and dx,07h - add dx,dx - add ax,dx - mov dl,07Fh - push ecx - mov cl,[C4X1+1] - and cl,07h - ror dl,cl - pop ecx - and byte[esi+eax+300h],dl - and byte[esi+eax+301h],dl - xor dl,0FFh - test byte[C4Col],1 - jz .nocolor0 - or byte[esi+eax+300h],dl -.nocolor0 - test byte[C4Col],2 - jz .nocolor1 - or byte[esi+eax+301h],dl -.nocolor1 -.noplot - mov eax,[C4X2] - add [C4X1],eax - mov eax,[C4Y2] - add [C4Y1],eax - dec ecx - jnz near .loop - popad - ret - -DrawWireFrame: - mov esi,[C4Ram] - mov edi,esi - movzx ebx,byte[esi+1F82h] - shl ebx,16 - mov bx,[esi+1F80h] - add bx,bx - shr ebx,1 - add ebx,[romdata] - mov edi,ebx - movzx ecx,byte[esi+295h] -.loop - movzx eax,byte[esi+1F82h] - shl eax,16 - mov al,[edi+1] - mov ah,[edi+0] - mov edx,edi -.nextprev - cmp ax,0FFFFh - jne .notprev - sub edx,5 - mov al,[edx+3] - mov ah,[edx+2] - jmp .nextprev -.notprev - add ax,ax - shr eax,1 - add eax,[romdata] - movzx edx,byte[esi+1F82h] - shl edx,16 - mov dl,[edi+3] - mov dh,[edi+2] -; mov [C4values+6],dx - add dx,dx - shr edx,1 - add edx,[romdata] - movzx ebx,byte[eax+1] - mov bh,[eax] - mov [C4X1],ebx - mov bh,[eax+2] - mov bl,[eax+3] - mov [C4Y1],ebx - mov bh,[eax+4] - mov bl,[eax+5] - mov [C4Z1],ebx - mov bh,[edx] - mov bl,[edx+1] - mov [C4X2],ebx - mov bh,[edx+2] - mov bl,[edx+3] - mov [C4Y2],ebx - mov bh,[edx+4] - mov bl,[edx+5] - mov [C4Z2],ebx - mov al,[edi+4] - mov [C4Col],al - add edi,5 - call C4DrawLine - dec ecx - jnz near .loop - ret - -SECTION .bss -C4X1 resd 1 -C4Y1 resd 1 -C4Z1 resd 1 -C4X2 resd 1 -C4Y2 resd 1 -C4Z2 resd 1 -C4Col resd 1 -SECTION .text - -WireFrameB: - pushad - ; 28EECA - ; 7F80 (3bytes) = pointer to data - ; 7F86-7F88 = rotation, 7F90 = scale (/7A?) - ; 6295 = # of lines, 7FA5 = ??? - mov esi,[C4Ram] - add esi,300h - mov ecx,16*12*3 -.loop - mov dword[esi],0 - add esi,4 - dec ecx - jnz .loop - call DrawWireFrame - - mov esi,[C4Ram] - mov cx,[esi+1FA5h] -; mov [C4values],cx -; mov cx,[esi+1F86h] -; mov [C4values],cx -; mov cx,[esi+1F88h] -; mov [C4values+2],cx -; mov cx,[esi+1F90h] -; mov [C4values+4],cx - popad - ret - -WireFrameB2: - pushad - call DrawWireFrame - popad - ret - -C4WireFrame: - pushad - mov esi,[C4Ram] - mov ax,[esi+1F83h] - and ax,0FFh - mov [C4WFX2Val],ax -; mov [C4values],ax - mov ax,[esi+1F86h] - and ax,0FFh - mov [C4WFY2Val],ax -; mov [C4values+2],ax - mov ax,[esi+1F89h] - and ax,0FFh - mov [C4WFDist],ax -; mov [C4values+4],ax - mov ax,[esi+1F8Ch] - and ax,0FFh - mov [C4WFScale],ax -; mov [C4values+6],ax - - ; transform vertices (MMX2 - 36 vertices, 54 lines) - movzx ecx,word[esi+1F80h] -.loop - mov ax,[esi+1] - mov [C4WFXVal],ax - mov ax,[esi+5] - mov [C4WFYVal],ax - mov ax,[esi+9] - mov [C4WFZVal],ax - push esi - push ecx - call C4TransfWireFrame - pop ecx - pop esi - ; Displace - mov ax,[C4WFXVal] - add ax,80h - mov [esi+1],ax - mov ax,[C4WFYVal] - add ax,50h - mov [esi+5],ax - add esi,10h - dec ecx - jnz .loop - ; Uses 6001,6005,6600,6602,6605 - - mov esi,[C4Ram] - mov word[esi+$600],23 - mov word[esi+$602],60h - mov word[esi+$605],40h - mov word[esi+$600+8],23 - mov word[esi+$602+8],60h - mov word[esi+$605+8],40h - - movzx ecx,word[esi+0B00h] - mov edi,esi - add edi,0B02h -.lineloop - movzx eax,byte[edi] - shl eax,4 - add eax,[C4Ram] - mov bx,[eax+1] - mov [C4WFXVal],bx - mov bx,[eax+5] - mov [C4WFYVal],bx - movzx eax,byte[edi+1] - shl eax,4 - add eax,[C4Ram] - mov bx,[eax+1] - mov [C4WFX2Val],bx - mov bx,[eax+5] - mov [C4WFY2Val],bx - push esi - push edi - push ecx - call C4CalcWireFrame - pop ecx - pop edi - pop esi - mov ax,[C4WFDist] - or ax,ax - jnz .yeswire - mov ax,1 -.yeswire - mov [esi+$600],ax - mov ax,[C4WFXVal] - mov [esi+$602],ax - mov ax,[C4WFYVal] - mov [esi+$605],ax - add edi,2 - add esi,8 - dec ecx - jnz near .lineloop -.done - popad - ret - -C4Transform: - ; 7F81,4,7,9,A,B,0,1,D - pushad - mov esi,[C4Ram] - mov ax,[esi+1F81h] - mov [C4WFXVal],ax - mov ax,[esi+1F84h] - mov [C4WFYVal],ax - mov ax,[esi+1F87h] - mov [C4WFZVal],ax - mov al,[esi+1F90h] - mov [C4WFScale],al - mov al,[esi+1F89h] - mov [C4WFX2Val],al - mov al,[esi+1F8Ah] - mov [C4WFY2Val],al - mov al,[esi+1F8Bh] - mov [C4WFDist],al - call C4TransfWireFrame2 - mov ax,[C4WFXVal] - mov [esi+1F80h],ax - mov ax,[C4WFYVal] - mov [esi+1F83h],ax - popad - ret - -SECTION .bss -C4SprPos resd 1 -C4SprScale resd 1 -C4SprScaleY resd 1 -C4SprScaler resd 1 -C4SprScalerY resd 1 -C4SprPtr resd 1 -C4SprPtrInc resd 1 -NEWSYM C4values, resd 3 - -section .text - -C4activate: - cmp ecx,1F4Fh - jne .noc4test - push esi - mov esi,[C4Ram] - cmp byte[esi+1F4Dh],0Eh - jne .befnoc4test - test al,0C3h - jnz .befnoc4test - shr al,2 - mov [esi+1F80h],al - pop esi - ret -.befnoc4test - pop esi -.noc4test - cmp al,00h - je near .dosprites - cmp al,01h - je near .dowireframe - cmp al,05h ; ? - je near .propulsion - cmp al,0Dh ; ? - je near .equatevelocity - cmp al,10h ; supply angle+distance, return x/y displacement - je near .direction - cmp al,13h ; Convert polar coordinates to rectangular 2 (similar to 10) - je near .polarcord2 - cmp al,15h ; ? - je near .calcdistance - cmp al,1Fh ; supply x/y displacement, return angle (+distance?) - je near .calcangle - cmp al,22h ; supply x/y displacement, return angle (+distance?) - je near .linearray - cmp al,25h - je near .multiply - cmp al,2Dh ; ??? - je near .transform - cmp al,40h - je near .sum - cmp al,54h - je near .square - cmp al,5Ch - je near .immediatereg - cmp al,89h - je near .immediaterom - ret -.dowireframe - call WireFrameB - ret - -.linearray - pushad - call C4Op22 - popad - ret - -.propulsion - pushad - ; 81 = 5B, 83 = 0x300 - ; 0x300 = /1, 0x280 = /4 - mov esi,[C4Ram] - - mov cx,[esi+1F83h] - mov [C4values+2],cx - mov cx,[esi+1F81h] - mov [C4values],cx - xor bx,bx - -; mov ax,256*256 - xor ax,ax - mov dx,1 - mov bx,[esi+1F83h] - or dx,dx - jz .done - idiv bx - mov [C4values+6],ax - mov bx,[esi+1F81h] - imul bx - shl edx,16 - mov dx,ax - sar edx,8 -.done - mov [esi+1F80h],dx - mov [C4values+4],dx - -; and eax,1FFh -; mov bx,[SinTable+eax*2] -; mov ax,[esi+1F81h] ; distance? -; imul bx -; mov ax,dx -; shl ax,1 -; shl dx,3 -; add dx,ax - - popad - ret -.polarcord2 - pushad - mov esi,[C4Ram] - mov cx,[esi+1F80h] - and ecx,1FFh - movsx eax,word[esi+1F83h] - add eax,eax - movsx ebx,word[CosTable+ecx*2] - imul ebx,eax - sar ebx,8 - adc ebx,0 - mov [esi+1F86h],ebx - movsx ebx,word[SinTable+ecx*2] - imul ebx,eax - sar ebx,8 - adc ebx,0 - mov [esi+1F89h],bx - sar ebx,16 - mov [esi+1F8Bh],bl - popad - ret -.dosprites - push eax - mov eax,[C4Ram] - cmp byte[eax+1F4Dh],0 - je near .sprites - cmp byte[eax+1F4Dh],3 - je near .scaler - cmp byte[eax+1F4Dh],5 - je near .lines - cmp byte[eax+1F4Dh],7 - je near .rotater - cmp byte[eax+1F4Dh],8 - je near .wireframeb - cmp byte[eax+1F4Dh],0Bh - je near .disintegrate - cmp byte[eax+1F4Dh],0Ch - je near .bitmap - pop eax - ret -.wireframeb - pop eax - call WireFrameB2 - ret -.sprites - pop eax - call C4ProcessSprites - ret -.disintegrate - call C4SprDisintegrate - pop eax - ret -.dolines - ret -.bitmap - call C4BitPlaneWave - pop eax - ret -.calcdistance - pushad - mov esi,[C4Ram] - mov bx,[esi+1F80h] - mov [C41FXVal],bx - mov bx,[esi+1F83h] - mov [C41FYVal],bx -; mov eax,[C4Ram] -; mov cx,[eax+1F80h] -; mov [C4values+0],cx -; mov cx,[eax+1F83h] -; mov [C4values+2],cx - call C4Op15 - mov eax,[C4Ram] - mov bx,[C41FDist] - mov [eax+1F80h],bx -; mov word[eax+1F80h],50 -; mov cx,[eax+1F80h] -; mov [C4values+4],cx - popad - ret -.calcangle - pushad - mov esi,[C4Ram] - mov bx,[esi+1F80h] - mov [C41FXVal],bx - mov bx,[esi+1F83h] - mov [C41FYVal],bx - call C4Op1F - mov eax,[C4Ram] - mov bx,[C41FAngleRes] - mov [eax+1F86h],bx -; mov esi,[C4Ram] -; mov cx,[esi+1F86h] -; mov [C4values],cx -; mov cx,[esi+1F80h] -; mov [C4values+2],cx -; mov cx,[esi+1F83h] -; mov [C4values+4],cx - popad - ret -.transform - ; 7F81,4,7,9,A,B,0,1,D - pushad -; mov eax,[C4Ram] - call C4Transform -; mov word[eax+1F80h],0 -; mov word[eax+1F83h],0 - popad - ret -.multiply - pushad - mov esi,[C4Ram] - mov eax,[esi+1F80h] - and eax,0FFFFFFh - mov ebx,[esi+1F83h] - and ebx,0FFFFFFh - imul eax,ebx - mov [esi+1F80h],eax - popad - ret -.sum - pushad - xor eax,eax - xor ebx,ebx - mov esi,[C4Ram] - mov ecx,800h -.sumloop - mov bl,[esi] - inc esi - add ax,bx - dec ecx - jnz .sumloop - mov [esi+1F80h-0800h],ax - popad - ret -.square - pushad - xor edx,edx - mov esi,[C4Ram] - mov eax,[esi+1F80h] - shl eax,8 - sar eax,8 - imul eax - mov [esi+1F83h],eax - mov [esi+1F87h],dx - popad - ret -.equatevelocity - pushad - mov esi,[C4Ram] - mov bx,[esi+1F80h] - mov [C41FXVal],bx - mov bx,[esi+1F83h] - mov [C41FYVal],bx - mov bx,[esi+1F86h] - mov [C41FDistVal],bx - call C4Op0D - mov bx,[C41FXVal] - mov [esi+1F89h],bx - mov bx,[C41FYVal] - mov [esi+1F8Ch],bx - popad - ret - - - pushad - mov esi,[C4Ram] - mov cx,[esi+$1F86] - cmp cx,40h - jb .nomult - shr cx,7 -.nomult - mov ax,[esi+$1F80] -; imul cx - shl ax,4 - mov [esi+$1F89],ax - mov ax,[esi+$1F83] -; imul cx - shl ax,4 - mov [esi+$1F8C],ax -; mov cx,[esi+$1F80] -; mov [C4values],cx -; mov cx,[esi+$1F83] -; mov [C4values+2],cx -; mov cx,[esi+$1F86] -; mov [C4values+4],cx - popad - ret -.lines - call C4WireFrame - pop eax - ret -.scaler - push esi - push ecx - mov esi,[C4Ram] -; mov cx,[esi+1F8Fh] -; mov [C4values],cx -; mov cx,[esi+1F92h] -; mov [C4values+2],cx -; mov cx,[esi+1F80h] -; mov [C4values+4],cx - pop ecx - pop esi - call C4SprScaleR - pop eax - ret -.rotater - push esi - push ecx - mov esi,[C4Ram] -; mov cx,[esi+1F8Fh] -; mov [C4values],cx -; mov cx,[esi+1F92h] -; mov [C4values+2],cx -; mov cx,[esi+1F80h] -; mov [C4values+4],cx - pop ecx - pop esi - call C4SprRotateR - pop eax - ret -.direction - push eax - push ebx - push esi - push edx - push ecx - mov esi,[C4Ram] - mov ax,[esi+1F80h] - and eax,1FFh - mov bx,[CosTable+eax*2] - mov ax,[esi+1F83h] - imul bx - add ax,ax - adc dx,dx - mov ax,dx - movsx edx,dx - mov [esi+1F86h],edx - mov ax,[esi+1F80h] - and eax,1FFh - mov bx,[SinTable+eax*2] - mov ax,[esi+1F83h] - imul bx - add ax,ax - adc dx,dx - mov ax,dx - movsx edx,dx - mov eax,edx - sar eax,6 - sub edx,eax - mov al,[esi+198Ch] - mov [esi+1F89h],edx - mov [esi+198Ch],al -; mov cx,[esi+1F80h] -; mov [C4values],cx -; mov cx,[esi+1F83h] -; mov [C4values+2],cx -; mov cx,[esi+1F86h] -; mov [C4values+4],cx - pop ecx - pop edx - pop esi - pop ebx - pop eax - ret -.immediaterom - push eax - mov eax,[C4Ram] - mov byte[eax+1F80h],36h - mov byte[eax+1F81h],43h - mov byte[eax+1F82h],05h - pop eax - ret -.immediatereg - push eax - mov eax,[C4Ram] - mov dword[eax+0*4],0FF000000h - mov dword[eax+1*4],0FF00FFFFh - mov dword[eax+2*4],0FF000000h - mov dword[eax+3*4],00000FFFFh - mov dword[eax+4*4],00000FFFFh - mov dword[eax+5*4],07FFFFF80h - mov dword[eax+6*4],0FF008000h - mov dword[eax+7*4],07FFF007Fh - mov dword[eax+8*4],0FFFF7FFFh - mov dword[eax+9*4],0FF010000h - mov dword[eax+10*4],00100FEFFh - mov dword[eax+11*4],000FEFF00h - pop eax - ret - -C4RegFunction: - add ecx,[C4Ram] - mov [ecx],al - sub ecx,[C4Ram] - cmp ecx,1F4Fh - je near C4activate - ret - - ;well, when 7f47 is written, copy the number of bytes specified in - ;$7f43-4 from the address at $7f40-2 to the address at $7f45-6 - ;(which is presumably in the $6000-$7fff range) - -NEWSYM C4ReadReg - add ecx,[C4Ram] - mov al,[ecx] - sub ecx,[C4Ram] - ret - -NEWSYM C4WriteReg - add ecx,[C4Ram] - mov [ecx],al - sub ecx,[C4Ram] - cmp ecx,1F47h - je .C4Memcpy - ret -.C4Memcpy - pushad - mov esi,[C4Ram] - movzx ecx,word[esi+1F43h] ;Num of bytes to copy - movzx eax,byte[esi+1F42h] ;Source bank - mov eax,[snesmmap+eax*4] - movzx edx,word[esi+1F40h] - add eax,edx - movzx edx,word[esi+1F45h] ;Destination - mov ebx,[C4Ram] - and edx,01FFFh - add ebx,edx -.c4movloop - mov dl,[eax] - mov [ebx],dl - inc eax - inc ebx - dec ecx - jnz .c4movloop - popad - ret diff --git a/tools/zsnes/src/chips/dsp1emu.c b/tools/zsnes/src/chips/dsp1emu.c deleted file mode 100644 index 9ee3905..0000000 --- a/tools/zsnes/src/chips/dsp1emu.c +++ /dev/null @@ -1,1216 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 __ZSNES__ - -#if (defined __ZSNES__ && __UNIXSDL__) -#include "../gblhdr.h" -#else - -#include -#include -#include -#endif -//#define DebugDSP1 - -#ifdef DebugDSP1 - -FILE * LogFile = NULL; - -void Log_Message (char *Message, ...) -{ - char Msg[400]; - va_list ap; - - va_start(ap,Message); - vsprintf(Msg,Message,ap ); - va_end(ap); - - strcat(Msg,"\r\n\0"); - fwrite(Msg,strlen(Msg),1,LogFile); - fflush (LogFile); -} - -void Start_Log (void) -{ - char LogFileName[255]; -// [4/15/2001] char *p; - - strcpy(LogFileName,"dsp1emu.log\0"); - - LogFile = fopen(LogFileName,"wb"); -} - -void Stop_Log (void) -{ - if (LogFile) - { - fclose(LogFile); - LogFile = NULL; - } -} - -#endif - -const unsigned short DSP1ROM[1024] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, - 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, - 0x4000, 0x7fff, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, - 0x0100, 0x0080, 0x0040, 0x0020, 0x0001, 0x0008, 0x0004, 0x0002, - 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x8000, 0xffe5, 0x0100, 0x7fff, 0x7f02, 0x7e08, - 0x7d12, 0x7c1f, 0x7b30, 0x7a45, 0x795d, 0x7878, 0x7797, 0x76ba, - 0x75df, 0x7507, 0x7433, 0x7361, 0x7293, 0x71c7, 0x70fe, 0x7038, - 0x6f75, 0x6eb4, 0x6df6, 0x6d3a, 0x6c81, 0x6bca, 0x6b16, 0x6a64, - 0x69b4, 0x6907, 0x685b, 0x67b2, 0x670b, 0x6666, 0x65c4, 0x6523, - 0x6484, 0x63e7, 0x634c, 0x62b3, 0x621c, 0x6186, 0x60f2, 0x6060, - 0x5fd0, 0x5f41, 0x5eb5, 0x5e29, 0x5d9f, 0x5d17, 0x5c91, 0x5c0c, - 0x5b88, 0x5b06, 0x5a85, 0x5a06, 0x5988, 0x590b, 0x5890, 0x5816, - 0x579d, 0x5726, 0x56b0, 0x563b, 0x55c8, 0x5555, 0x54e4, 0x5474, - 0x5405, 0x5398, 0x532b, 0x52bf, 0x5255, 0x51ec, 0x5183, 0x511c, - 0x50b6, 0x5050, 0x4fec, 0x4f89, 0x4f26, 0x4ec5, 0x4e64, 0x4e05, - 0x4da6, 0x4d48, 0x4cec, 0x4c90, 0x4c34, 0x4bda, 0x4b81, 0x4b28, - 0x4ad0, 0x4a79, 0x4a23, 0x49cd, 0x4979, 0x4925, 0x48d1, 0x487f, - 0x482d, 0x47dc, 0x478c, 0x473c, 0x46ed, 0x469f, 0x4651, 0x4604, - 0x45b8, 0x456c, 0x4521, 0x44d7, 0x448d, 0x4444, 0x43fc, 0x43b4, - 0x436d, 0x4326, 0x42e0, 0x429a, 0x4255, 0x4211, 0x41cd, 0x4189, - 0x4146, 0x4104, 0x40c2, 0x4081, 0x4040, 0x3fff, 0x41f7, 0x43e1, - 0x45bd, 0x478d, 0x4951, 0x4b0b, 0x4cbb, 0x4e61, 0x4fff, 0x5194, - 0x5322, 0x54a9, 0x5628, 0x57a2, 0x5914, 0x5a81, 0x5be9, 0x5d4a, - 0x5ea7, 0x5fff, 0x6152, 0x62a0, 0x63ea, 0x6530, 0x6672, 0x67b0, - 0x68ea, 0x6a20, 0x6b53, 0x6c83, 0x6daf, 0x6ed9, 0x6fff, 0x7122, - 0x7242, 0x735f, 0x747a, 0x7592, 0x76a7, 0x77ba, 0x78cb, 0x79d9, - 0x7ae5, 0x7bee, 0x7cf5, 0x7dfa, 0x7efe, 0x7fff, 0x0000, 0x0324, - 0x0647, 0x096a, 0x0c8b, 0x0fab, 0x12c8, 0x15e2, 0x18f8, 0x1c0b, - 0x1f19, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11, 0x30fb, 0x33de, - 0x36ba, 0x398c, 0x3c56, 0x3f17, 0x41ce, 0x447a, 0x471c, 0x49b4, - 0x4c3f, 0x4ebf, 0x5133, 0x539b, 0x55f5, 0x5842, 0x5a82, 0x5cb4, - 0x5ed7, 0x60ec, 0x62f2, 0x64e8, 0x66cf, 0x68a6, 0x6a6d, 0x6c24, - 0x6dca, 0x6f5f, 0x70e2, 0x7255, 0x73b5, 0x7504, 0x7641, 0x776c, - 0x7884, 0x798a, 0x7a7d, 0x7b5d, 0x7c29, 0x7ce3, 0x7d8a, 0x7e1d, - 0x7e9d, 0x7f09, 0x7f62, 0x7fa7, 0x7fd8, 0x7ff6, 0x7fff, 0x7ff6, - 0x7fd8, 0x7fa7, 0x7f62, 0x7f09, 0x7e9d, 0x7e1d, 0x7d8a, 0x7ce3, - 0x7c29, 0x7b5d, 0x7a7d, 0x798a, 0x7884, 0x776c, 0x7641, 0x7504, - 0x73b5, 0x7255, 0x70e2, 0x6f5f, 0x6dca, 0x6c24, 0x6a6d, 0x68a6, - 0x66cf, 0x64e8, 0x62f2, 0x60ec, 0x5ed7, 0x5cb4, 0x5a82, 0x5842, - 0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, 0x471c, 0x447a, - 0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33de, 0x30fb, 0x2e11, - 0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f19, 0x1c0b, 0x18f8, 0x15e2, - 0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324, 0x7fff, 0x7ff6, - 0x7fd8, 0x7fa7, 0x7f62, 0x7f09, 0x7e9d, 0x7e1d, 0x7d8a, 0x7ce3, - 0x7c29, 0x7b5d, 0x7a7d, 0x798a, 0x7884, 0x776c, 0x7641, 0x7504, - 0x73b5, 0x7255, 0x70e2, 0x6f5f, 0x6dca, 0x6c24, 0x6a6d, 0x68a6, - 0x66cf, 0x64e8, 0x62f2, 0x60ec, 0x5ed7, 0x5cb4, 0x5a82, 0x5842, - 0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, 0x471c, 0x447a, - 0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33de, 0x30fb, 0x2e11, - 0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f19, 0x1c0b, 0x18f8, 0x15e2, - 0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324, 0x0000, 0xfcdc, - 0xf9b9, 0xf696, 0xf375, 0xf055, 0xed38, 0xea1e, 0xe708, 0xe3f5, - 0xe0e7, 0xdddd, 0xdad8, 0xd7da, 0xd4e1, 0xd1ef, 0xcf05, 0xcc22, - 0xc946, 0xc674, 0xc3aa, 0xc0e9, 0xbe32, 0xbb86, 0xb8e4, 0xb64c, - 0xb3c1, 0xb141, 0xaecd, 0xac65, 0xaa0b, 0xa7be, 0xa57e, 0xa34c, - 0xa129, 0x9f14, 0x9d0e, 0x9b18, 0x9931, 0x975a, 0x9593, 0x93dc, - 0x9236, 0x90a1, 0x8f1e, 0x8dab, 0x8c4b, 0x8afc, 0x89bf, 0x8894, - 0x877c, 0x8676, 0x8583, 0x84a3, 0x83d7, 0x831d, 0x8276, 0x81e3, - 0x8163, 0x80f7, 0x809e, 0x8059, 0x8028, 0x800a, 0x6488, 0x0080, - 0x03ff, 0x0116, 0x0002, 0x0080, 0x4000, 0x3fd7, 0x3faf, 0x3f86, - 0x3f5d, 0x3f34, 0x3f0c, 0x3ee3, 0x3eba, 0x3e91, 0x3e68, 0x3e40, - 0x3e17, 0x3dee, 0x3dc5, 0x3d9c, 0x3d74, 0x3d4b, 0x3d22, 0x3cf9, - 0x3cd0, 0x3ca7, 0x3c7f, 0x3c56, 0x3c2d, 0x3c04, 0x3bdb, 0x3bb2, - 0x3b89, 0x3b60, 0x3b37, 0x3b0e, 0x3ae5, 0x3abc, 0x3a93, 0x3a69, - 0x3a40, 0x3a17, 0x39ee, 0x39c5, 0x399c, 0x3972, 0x3949, 0x3920, - 0x38f6, 0x38cd, 0x38a4, 0x387a, 0x3851, 0x3827, 0x37fe, 0x37d4, - 0x37aa, 0x3781, 0x3757, 0x372d, 0x3704, 0x36da, 0x36b0, 0x3686, - 0x365c, 0x3632, 0x3609, 0x35df, 0x35b4, 0x358a, 0x3560, 0x3536, - 0x350c, 0x34e1, 0x34b7, 0x348d, 0x3462, 0x3438, 0x340d, 0x33e3, - 0x33b8, 0x338d, 0x3363, 0x3338, 0x330d, 0x32e2, 0x32b7, 0x328c, - 0x3261, 0x3236, 0x320b, 0x31df, 0x31b4, 0x3188, 0x315d, 0x3131, - 0x3106, 0x30da, 0x30ae, 0x3083, 0x3057, 0x302b, 0x2fff, 0x2fd2, - 0x2fa6, 0x2f7a, 0x2f4d, 0x2f21, 0x2ef4, 0x2ec8, 0x2e9b, 0x2e6e, - 0x2e41, 0x2e14, 0x2de7, 0x2dba, 0x2d8d, 0x2d60, 0x2d32, 0x2d05, - 0x2cd7, 0x2ca9, 0x2c7b, 0x2c4d, 0x2c1f, 0x2bf1, 0x2bc3, 0x2b94, - 0x2b66, 0x2b37, 0x2b09, 0x2ada, 0x2aab, 0x2a7c, 0x2a4c, 0x2a1d, - 0x29ed, 0x29be, 0x298e, 0x295e, 0x292e, 0x28fe, 0x28ce, 0x289d, - 0x286d, 0x283c, 0x280b, 0x27da, 0x27a9, 0x2777, 0x2746, 0x2714, - 0x26e2, 0x26b0, 0x267e, 0x264c, 0x2619, 0x25e7, 0x25b4, 0x2581, - 0x254d, 0x251a, 0x24e6, 0x24b2, 0x247e, 0x244a, 0x2415, 0x23e1, - 0x23ac, 0x2376, 0x2341, 0x230b, 0x22d6, 0x229f, 0x2269, 0x2232, - 0x21fc, 0x21c4, 0x218d, 0x2155, 0x211d, 0x20e5, 0x20ad, 0x2074, - 0x203b, 0x2001, 0x1fc7, 0x1f8d, 0x1f53, 0x1f18, 0x1edd, 0x1ea1, - 0x1e66, 0x1e29, 0x1ded, 0x1db0, 0x1d72, 0x1d35, 0x1cf6, 0x1cb8, - 0x1c79, 0x1c39, 0x1bf9, 0x1bb8, 0x1b77, 0x1b36, 0x1af4, 0x1ab1, - 0x1a6e, 0x1a2a, 0x19e6, 0x19a1, 0x195c, 0x1915, 0x18ce, 0x1887, - 0x183f, 0x17f5, 0x17ac, 0x1761, 0x1715, 0x16c9, 0x167c, 0x162e, - 0x15df, 0x158e, 0x153d, 0x14eb, 0x1497, 0x1442, 0x13ec, 0x1395, - 0x133c, 0x12e2, 0x1286, 0x1228, 0x11c9, 0x1167, 0x1104, 0x109e, - 0x1036, 0x0fcc, 0x0f5f, 0x0eef, 0x0e7b, 0x0e04, 0x0d89, 0x0d0a, - 0x0c86, 0x0bfd, 0x0b6d, 0x0ad6, 0x0a36, 0x098d, 0x08d7, 0x0811, - 0x0736, 0x063e, 0x0519, 0x039a, 0x0000, 0x7fff, 0x0100, 0x0080, - 0x021d, 0x00c8, 0x00ce, 0x0048, 0x0a26, 0x277a, 0x00ce, 0x6488, - 0x14ac, 0x0001, 0x00f9, 0x00fc, 0x00ff, 0x00fc, 0x00f9, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}; - -/***************************************************************************\ -* DSP1 code * -\***************************************************************************/ - -void InitDSP(void) -{ -#ifdef DebugDSP1 - Start_Log(); -#endif -} - -short Op00Multiplicand; -short Op00Multiplier; -short Op00Result; - -void DSPOp00() -{ - Op00Result= Op00Multiplicand * Op00Multiplier >> 15; - - #ifdef DebugDSP1 - Log_Message("OP00 MULT %d*%d/32768=%d",Op00Multiplicand,Op00Multiplier,Op00Result); - #endif -} - -short Op20Multiplicand; -short Op20Multiplier; -short Op20Result; - -void DSPOp20() -{ - Op20Result= Op20Multiplicand * Op20Multiplier >> 15; - Op20Result++; - - #ifdef DebugDSP1 - Log_Message("OP20 MULT %d*%d/32768=%d",Op20Multiplicand,Op20Multiplier,Op20Result); - #endif -} - -signed short Op10Coefficient; -signed short Op10Exponent; -signed short Op10CoefficientR; -signed short Op10ExponentR; - -void DSP1_Inverse(short Coefficient, short Exponent, short *iCoefficient, short *iExponent) -{ - // Step One: Division by Zero - if (Coefficient == 0x0000) - { - *iCoefficient = 0x7fff; - *iExponent = 0x002f; - } - else - { - short Sign = 1; - - // Step Two: Remove Sign - if (Coefficient < 0) - { - if (Coefficient < -32767) Coefficient = -32767; - Coefficient = -Coefficient; - Sign = -1; - } - - // Step Three: Normalize - while (Coefficient < 0x4000) - { - Coefficient <<= 1; - Exponent--; - } - - // Step Four: Special Case - if (Coefficient == 0x4000) - if (Sign == 1) *iCoefficient = 0x7fff; - else { - *iCoefficient = -0x4000; - Exponent--; - } - else { - // Step Five: Initial Guess - short i = DSP1ROM[((Coefficient - 0x4000) >> 7) + 0x0065]; - - // Step Six: Iterate "estimated" Newton's Method - i = (i + (-i * (Coefficient * i >> 15) >> 15)) << 1; - i = (i + (-i * (Coefficient * i >> 15) >> 15)) << 1; - - *iCoefficient = i * Sign; - } - - *iExponent = 1 - Exponent; - } -} - -void DSPOp10() -{ - DSP1_Inverse(Op10Coefficient, Op10Exponent, &Op10CoefficientR, &Op10ExponentR); - #ifdef DebugDSP1 - Log_Message("OP10 INV %d*2^%d = %d*2^%d", Op10Coefficient, Op10Exponent, Op10CoefficientR, Op10ExponentR); - #endif -} - -short Op04Angle; -short Op04Radius; -short Op04Sin; -short Op04Cos; - -const short DSP1_MulTable[256] = { - 0x0000, 0x0003, 0x0006, 0x0009, 0x000c, 0x000f, 0x0012, 0x0015, - 0x0019, 0x001c, 0x001f, 0x0022, 0x0025, 0x0028, 0x002b, 0x002f, - 0x0032, 0x0035, 0x0038, 0x003b, 0x003e, 0x0041, 0x0045, 0x0048, - 0x004b, 0x004e, 0x0051, 0x0054, 0x0057, 0x005b, 0x005e, 0x0061, - 0x0064, 0x0067, 0x006a, 0x006d, 0x0071, 0x0074, 0x0077, 0x007a, - 0x007d, 0x0080, 0x0083, 0x0087, 0x008a, 0x008d, 0x0090, 0x0093, - 0x0096, 0x0099, 0x009d, 0x00a0, 0x00a3, 0x00a6, 0x00a9, 0x00ac, - 0x00af, 0x00b3, 0x00b6, 0x00b9, 0x00bc, 0x00bf, 0x00c2, 0x00c5, - 0x00c9, 0x00cc, 0x00cf, 0x00d2, 0x00d5, 0x00d8, 0x00db, 0x00df, - 0x00e2, 0x00e5, 0x00e8, 0x00eb, 0x00ee, 0x00f1, 0x00f5, 0x00f8, - 0x00fb, 0x00fe, 0x0101, 0x0104, 0x0107, 0x010b, 0x010e, 0x0111, - 0x0114, 0x0117, 0x011a, 0x011d, 0x0121, 0x0124, 0x0127, 0x012a, - 0x012d, 0x0130, 0x0133, 0x0137, 0x013a, 0x013d, 0x0140, 0x0143, - 0x0146, 0x0149, 0x014d, 0x0150, 0x0153, 0x0156, 0x0159, 0x015c, - 0x015f, 0x0163, 0x0166, 0x0169, 0x016c, 0x016f, 0x0172, 0x0175, - 0x0178, 0x017c, 0x017f, 0x0182, 0x0185, 0x0188, 0x018b, 0x018e, - 0x0192, 0x0195, 0x0198, 0x019b, 0x019e, 0x01a1, 0x01a4, 0x01a8, - 0x01ab, 0x01ae, 0x01b1, 0x01b4, 0x01b7, 0x01ba, 0x01be, 0x01c1, - 0x01c4, 0x01c7, 0x01ca, 0x01cd, 0x01d0, 0x01d4, 0x01d7, 0x01da, - 0x01dd, 0x01e0, 0x01e3, 0x01e6, 0x01ea, 0x01ed, 0x01f0, 0x01f3, - 0x01f6, 0x01f9, 0x01fc, 0x0200, 0x0203, 0x0206, 0x0209, 0x020c, - 0x020f, 0x0212, 0x0216, 0x0219, 0x021c, 0x021f, 0x0222, 0x0225, - 0x0228, 0x022c, 0x022f, 0x0232, 0x0235, 0x0238, 0x023b, 0x023e, - 0x0242, 0x0245, 0x0248, 0x024b, 0x024e, 0x0251, 0x0254, 0x0258, - 0x025b, 0x025e, 0x0261, 0x0264, 0x0267, 0x026a, 0x026e, 0x0271, - 0x0274, 0x0277, 0x027a, 0x027d, 0x0280, 0x0284, 0x0287, 0x028a, - 0x028d, 0x0290, 0x0293, 0x0296, 0x029a, 0x029d, 0x02a0, 0x02a3, - 0x02a6, 0x02a9, 0x02ac, 0x02b0, 0x02b3, 0x02b6, 0x02b9, 0x02bc, - 0x02bf, 0x02c2, 0x02c6, 0x02c9, 0x02cc, 0x02cf, 0x02d2, 0x02d5, - 0x02d8, 0x02db, 0x02df, 0x02e2, 0x02e5, 0x02e8, 0x02eb, 0x02ee, - 0x02f1, 0x02f5, 0x02f8, 0x02fb, 0x02fe, 0x0301, 0x0304, 0x0307, - 0x030b, 0x030e, 0x0311, 0x0314, 0x0317, 0x031a, 0x031d, 0x0321}; - -const short DSP1_SinTable[256] = { - 0x0000, 0x0324, 0x0647, 0x096a, 0x0c8b, 0x0fab, 0x12c8, 0x15e2, - 0x18f8, 0x1c0b, 0x1f19, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11, - 0x30fb, 0x33de, 0x36ba, 0x398c, 0x3c56, 0x3f17, 0x41ce, 0x447a, - 0x471c, 0x49b4, 0x4c3f, 0x4ebf, 0x5133, 0x539b, 0x55f5, 0x5842, - 0x5a82, 0x5cb4, 0x5ed7, 0x60ec, 0x62f2, 0x64e8, 0x66cf, 0x68a6, - 0x6a6d, 0x6c24, 0x6dca, 0x6f5f, 0x70e2, 0x7255, 0x73b5, 0x7504, - 0x7641, 0x776c, 0x7884, 0x798a, 0x7a7d, 0x7b5d, 0x7c29, 0x7ce3, - 0x7d8a, 0x7e1d, 0x7e9d, 0x7f09, 0x7f62, 0x7fa7, 0x7fd8, 0x7ff6, - 0x7fff, 0x7ff6, 0x7fd8, 0x7fa7, 0x7f62, 0x7f09, 0x7e9d, 0x7e1d, - 0x7d8a, 0x7ce3, 0x7c29, 0x7b5d, 0x7a7d, 0x798a, 0x7884, 0x776c, - 0x7641, 0x7504, 0x73b5, 0x7255, 0x70e2, 0x6f5f, 0x6dca, 0x6c24, - 0x6a6d, 0x68a6, 0x66cf, 0x64e8, 0x62f2, 0x60ec, 0x5ed7, 0x5cb4, - 0x5a82, 0x5842, 0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, - 0x471c, 0x447a, 0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33de, - 0x30fb, 0x2e11, 0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f19, 0x1c0b, - 0x18f8, 0x15e2, 0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324, - -0x0000, -0x0324, -0x0647, -0x096a, -0x0c8b, -0x0fab, -0x12c8, -0x15e2, - -0x18f8, -0x1c0b, -0x1f19, -0x2223, -0x2528, -0x2826, -0x2b1f, -0x2e11, - -0x30fb, -0x33de, -0x36ba, -0x398c, -0x3c56, -0x3f17, -0x41ce, -0x447a, - -0x471c, -0x49b4, -0x4c3f, -0x4ebf, -0x5133, -0x539b, -0x55f5, -0x5842, - -0x5a82, -0x5cb4, -0x5ed7, -0x60ec, -0x62f2, -0x64e8, -0x66cf, -0x68a6, - -0x6a6d, -0x6c24, -0x6dca, -0x6f5f, -0x70e2, -0x7255, -0x73b5, -0x7504, - -0x7641, -0x776c, -0x7884, -0x798a, -0x7a7d, -0x7b5d, -0x7c29, -0x7ce3, - -0x7d8a, -0x7e1d, -0x7e9d, -0x7f09, -0x7f62, -0x7fa7, -0x7fd8, -0x7ff6, - -0x7fff, -0x7ff6, -0x7fd8, -0x7fa7, -0x7f62, -0x7f09, -0x7e9d, -0x7e1d, - -0x7d8a, -0x7ce3, -0x7c29, -0x7b5d, -0x7a7d, -0x798a, -0x7884, -0x776c, - -0x7641, -0x7504, -0x73b5, -0x7255, -0x70e2, -0x6f5f, -0x6dca, -0x6c24, - -0x6a6d, -0x68a6, -0x66cf, -0x64e8, -0x62f2, -0x60ec, -0x5ed7, -0x5cb4, - -0x5a82, -0x5842, -0x55f5, -0x539b, -0x5133, -0x4ebf, -0x4c3f, -0x49b4, - -0x471c, -0x447a, -0x41ce, -0x3f17, -0x3c56, -0x398c, -0x36ba, -0x33de, - -0x30fb, -0x2e11, -0x2b1f, -0x2826, -0x2528, -0x2223, -0x1f19, -0x1c0b, - -0x18f8, -0x15e2, -0x12c8, -0x0fab, -0x0c8b, -0x096a, -0x0647, -0x0324}; - -short DSP1_Sin(short Angle) -{ - int S; - if (Angle < 0) { - if (Angle == -32768) return 0; - return -DSP1_Sin(-Angle); - } - S = DSP1_SinTable[Angle >> 8] + (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[0x40 + (Angle >> 8)] >> 15); - if (S > 32767) S = 32767; - return (short) S; -} - -short DSP1_Cos(short Angle) -{ - int S; - if (Angle < 0) { - if (Angle == -32768) return -32768; - Angle = -Angle; - } - S = DSP1_SinTable[0x40 + (Angle >> 8)] - (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[Angle >> 8] >> 15); - if (S < -32768) S = -32767; - return (short) S; -} - -void DSP1_Normalize(short m, short *Coefficient, short *Exponent) -{ - short i = 0x4000; - short e = 0; - - if (m < 0) - while ((m & i) && i) { - i >>= 1; - e++; - } - else - while (!(m & i) && i) { - i >>= 1; - e++; - } - - if (e > 0) - *Coefficient = m * DSP1ROM[0x21 + e] << 1; - else - *Coefficient = m; - - *Exponent -= e; -} - -void DSP1_NormalizeDouble(int Product, short *Coefficient, short *Exponent) -{ - short n = Product & 0x7fff; - short m = Product >> 15; - short i = 0x4000; - short e = 0; - - if (m < 0) - while ((m & i) && i) { - i >>= 1; - e++; - } - else - while (!(m & i) && i) { - i >>= 1; - e++; - } - - if (e > 0) - { - *Coefficient = m * DSP1ROM[0x0021 + e] << 1; - - if (e < 15) - *Coefficient += n * DSP1ROM[0x0040 - e] >> 15; - else - { - i = 0x4000; - - if (m < 0) - while ((n & i) && i) { - i >>= 1; - e++; - } - else - while (!(n & i) && i) { - i >>= 1; - e++; - } - - if (e > 15) - *Coefficient = n * DSP1ROM[0x0012 + e] << 1; - else - *Coefficient += n; - } - } - else - *Coefficient = m; - - *Exponent = e; -} - -short DSP1_Truncate(short C, short E) -{ - if (E > 0) { - if (C > 0) return 32767; else if (C < 0) return -32767; - } else { - if (E < 0) return C * DSP1ROM[0x0031 + E] >> 15; - } - return C; -} - -void DSPOp04() -{ - Op04Sin = DSP1_Sin(Op04Angle) * Op04Radius >> 15; - Op04Cos = DSP1_Cos(Op04Angle) * Op04Radius >> 15; -} - -short Op0CA; -short Op0CX1; -short Op0CY1; -short Op0CX2; -short Op0CY2; - -void DSPOp0C() -{ - Op0CX2 = (Op0CY1 * DSP1_Sin(Op0CA) >> 15) + (Op0CX1 * DSP1_Cos(Op0CA) >> 15); - Op0CY2 = (Op0CY1 * DSP1_Cos(Op0CA) >> 15) - (Op0CX1 * DSP1_Sin(Op0CA) >> 15); -} - -short CentreX; -short CentreY; -short VOffset; - -short VPlane_C; -short VPlane_E; - -// Azimuth and Zenith angles -short SinAas; -short CosAas; -short SinAzs; -short CosAzs; - -// Clipped Zenith angle -short SinAZS; -short CosAZS; -short SecAZS_C1; -short SecAZS_E1; -short SecAZS_C2; -short SecAZS_E2; - -short Nx, Ny, Nz; -short Gx, Gy, Gz; -short C_Les, E_Les, G_Les; - -const short MaxAZS_Exp[16] = { - 0x38b4, 0x38b7, 0x38ba, 0x38be, 0x38c0, 0x38c4, 0x38c7, 0x38ca, - 0x38ce, 0x38d0, 0x38d4, 0x38d7, 0x38da, 0x38dd, 0x38e0, 0x38e4 -}; - -void DSP1_Parameter(short Fx, short Fy, short Fz, short Lfe, short Les, short Aas, short Azs, short *Vof, short *Vva, short *Cx, short *Cy) -{ - short CSec, C, E, MaxAZS, Aux; - short LfeNx, LfeNy, LfeNz; - short LesNx, LesNy, LesNz; - short CentreZ; - - // Copy Zenith angle for clipping - short AZS = Azs; - - // Store Sine and Cosine of Azimuth and Zenith angle - SinAas = DSP1_Sin(Aas); - CosAas = DSP1_Cos(Aas); - SinAzs = DSP1_Sin(Azs); - CosAzs = DSP1_Cos(Azs); - - Nx = SinAzs * -SinAas >> 15; - Ny = SinAzs * CosAas >> 15; - Nz = CosAzs * 0x7fff >> 15; - - LfeNx = Lfe*Nx>>15; - LfeNy = Lfe*Ny>>15; - LfeNz = Lfe*Nz>>15; - - // Center of Projection - CentreX = Fx+LfeNx; - CentreY = Fy+LfeNy; - CentreZ = Fz+LfeNz; - - LesNx = Les*Nx>>15; - LesNy = Les*Ny>>15; - LesNz = Les*Nz>>15; - - Gx=CentreX-LesNx; - Gy=CentreY-LesNy; - Gz=CentreZ-LesNz; - - E_Les=0; - DSP1_Normalize(Les, &C_Les, &E_Les); - G_Les = Les; - - E = 0; - DSP1_Normalize(CentreZ, &C, &E); - - VPlane_C = C; - VPlane_E = E; - - // Determine clip boundary and clip Zenith angle if necessary - MaxAZS = MaxAZS_Exp[-E]; - - if (AZS < 0) { - MaxAZS = -MaxAZS; - if (AZS < MaxAZS + 1) AZS = MaxAZS + 1; - } else { - if (AZS > MaxAZS) AZS = MaxAZS; - } - - // Store Sine and Cosine of clipped Zenith angle - SinAZS = DSP1_Sin(AZS); - CosAZS = DSP1_Cos(AZS); - - DSP1_Inverse(CosAZS, 0, &SecAZS_C1, &SecAZS_E1); - DSP1_Normalize(C * SecAZS_C1 >> 15, &C, &E); - E += SecAZS_E1; - - C = DSP1_Truncate(C, E) * SinAZS >> 15; - - CentreX += C * SinAas >> 15; - CentreY -= C * CosAas >> 15; - - *Cx = CentreX; - *Cy = CentreY; - - // Raster number of imaginary center and horizontal line - *Vof = 0; - - if ((Azs != AZS) || (Azs == MaxAZS)) - { - if (Azs == -32768) Azs = -32767; - - C = Azs - MaxAZS; - if (C >= 0) C--; - Aux = ~(C << 2); - - C = Aux * DSP1ROM[0x0328] >> 15; - C = (C * Aux >> 15) + DSP1ROM[0x0327]; - *Vof -= (C * Aux >> 15) * Les >> 15; - - C = Aux * Aux >> 15; - Aux = (C * DSP1ROM[0x0324] >> 15) + DSP1ROM[0x0325]; - CosAZS += (C * Aux >> 15) * CosAZS >> 15; - } - - VOffset = Les * CosAZS >> 15; - - DSP1_Inverse(SinAZS, 0, &CSec, &E); - DSP1_Normalize(VOffset, &C, &E); - DSP1_Normalize(C * CSec >> 15, &C, &E); - - if (C == -32768) { C >>= 1; E++; } - - *Vva = DSP1_Truncate(-C, E); - - // Store Secant of clipped Zenith angle - DSP1_Inverse(CosAZS, 0, &SecAZS_C2, &SecAZS_E2); -} - -void DSP1_Raster(short Vs, short *An, short *Bn, short *Cn, short *Dn) -{ - short C, E, C1, E1; - - DSP1_Inverse((Vs * SinAzs >> 15) + VOffset, 7, &C, &E); - E += VPlane_E; - - C1 = C * VPlane_C >> 15; - E1 = E + SecAZS_E2; - - DSP1_Normalize(C1, &C, &E); - - C = DSP1_Truncate(C, E); - - *An = C * CosAas >> 15; - *Cn = C * SinAas >> 15; - - DSP1_Normalize(C1 * SecAZS_C2 >> 15, &C, &E1); - - C = DSP1_Truncate(C, E1); - - *Bn = C * -SinAas >> 15; - *Dn = C * CosAas >> 15; -} - -short Op02FX; -short Op02FY; -short Op02FZ; -short Op02LFE; -short Op02LES; -short Op02AAS; -short Op02AZS; -short Op02VOF; -short Op02VVA; -short Op02CX; -short Op02CY; - -void DSPOp02() -{ - DSP1_Parameter(Op02FX, Op02FY, Op02FZ, Op02LFE, Op02LES, Op02AAS, Op02AZS, &Op02VOF, &Op02VVA, &Op02CX, &Op02CY); -} - -short Op0AVS; -short Op0AA; -short Op0AB; -short Op0AC; -short Op0AD; - -void DSPOp0A() -{ - DSP1_Raster(Op0AVS, &Op0AA, &Op0AB, &Op0AC, &Op0AD); - Op0AVS++; -} - - -short DSP1_ShiftR(short C, short E) -{ - return (C * DSP1ROM[0x0031 + E] >> 15); -} - -void DSP1_Project(short X, short Y, short Z, short *H, short *V, short *M) -{ - int aux, aux4; - short E, E2, E3, E4, E5, refE, E6, E7; - short C2, C4, C6, C8, C9, C10, C11, C12, C16, C17, C18, C19, C20, C21, C22, C23, C24, C25, C26; - short Px, Py, Pz; - - E4=E3=E2=E=E5=0; - - DSP1_NormalizeDouble((int)X-Gx, &Px, &E4); - DSP1_NormalizeDouble((int)Y-Gy, &Py, &E); - DSP1_NormalizeDouble((int)Z-Gz, &Pz, &E3); - Px>>=1; E4--; // to avoid overflows when calculating the scalar products - Py>>=1; E--; - Pz>>=1; E3--; - - refE = (E>15); - C8=- (Py*Ny>>15); - C9=- (Pz*Nz>>15); - C12=C11+C8+C9; // this cannot overflow! - - aux4=C12; // de-normalization with 32-bits arithmetic - refE = 16-refE; // refE can be up to 3 - if (refE>=0) - aux4 <<=(refE); - else - aux4 >>=-(refE); - if (aux4==-1) aux4 = 0; // why? - aux4>>=1; - - aux = ((unsigned short)G_Les) + aux4; // Les - the scalar product of P with the normal vector of the screen - DSP1_NormalizeDouble(aux, &C10, &E2); - E2 = 15-E2; - - DSP1_Inverse(C10, 0, &C4, &E4); - C2=C4*C_Les>>15; // scale factor - - - // H - E7=0; - C16= (Px*(CosAas*0x7fff>>15)>>15); - C20= (Py*(SinAas*0x7fff>>15)>>15); - C17=C16+C20; // scalar product of P with the normalized horizontal vector of the screen... - - C18=C17*C2>>15; // ... multiplied by the scale factor - DSP1_Normalize(C18, &C19, &E7); - *H=DSP1_Truncate(C19, E_Les-E2+refE+E7); - - // V - E6=0; - C21 = Px*(CosAzs*-SinAas>>15)>>15; - C22 = Py*(CosAzs*CosAas>>15)>>15; - C23 = Pz*(-SinAzs*0x7fff>>15)>>15; - C24=C21+C22+C23; // scalar product of P with the normalized vertical vector of the screen... - - C26=C24*C2>>15; // ... multiplied by the scale factor - DSP1_Normalize(C26, &C25, &E6); - *V=DSP1_Truncate(C25, E_Les-E2+refE+E6); - - // M - DSP1_Normalize(C2, &C6, &E4); - *M=DSP1_Truncate(C6, E4+E_Les-E2-7); // M is the scale factor divided by 2^7 -} - -short Op06X; -short Op06Y; -short Op06Z; -short Op06H; -short Op06V; -short Op06M; - -void DSPOp06() -{ - DSP1_Project(Op06X, Op06Y, Op06Z, &Op06H, &Op06V, &Op06M); -} - - -short matrixC[3][3]; -short matrixB[3][3]; -short matrixA[3][3]; - -short Op01m; -short Op01Zr; -short Op01Xr; -short Op01Yr; -short Op11m; -short Op11Zr; -short Op11Xr; -short Op11Yr; -short Op21m; -short Op21Zr; -short Op21Xr; -short Op21Yr; - -void DSPOp01() -{ - short SinAz = DSP1_Sin(Op01Zr); - short CosAz = DSP1_Cos(Op01Zr); - short SinAy = DSP1_Sin(Op01Yr); - short CosAy = DSP1_Cos(Op01Yr); - short SinAx = DSP1_Sin(Op01Xr); - short CosAx = DSP1_Cos(Op01Xr); - - Op01m >>= 1; - - matrixA[0][0] = (Op01m * CosAz >> 15) * CosAy >> 15; - matrixA[0][1] = -((Op01m * SinAz >> 15) * CosAy >> 15); - matrixA[0][2] = Op01m * SinAy >> 15; - - matrixA[1][0] = ((Op01m * SinAz >> 15) * CosAx >> 15) + (((Op01m * CosAz >> 15) * SinAx >> 15) * SinAy >> 15); - matrixA[1][1] = ((Op01m * CosAz >> 15) * CosAx >> 15) - (((Op01m * SinAz >> 15) * SinAx >> 15) * SinAy >> 15); - matrixA[1][2] = -((Op01m * SinAx >> 15) * CosAy >> 15); - - matrixA[2][0] = ((Op01m * SinAz >> 15) * SinAx >> 15) - (((Op01m * CosAz >> 15) * CosAx >> 15) * SinAy >> 15); - matrixA[2][1] = ((Op01m * CosAz >> 15) * SinAx >> 15) + (((Op01m * SinAz >> 15) * CosAx >> 15) * SinAy >> 15); - matrixA[2][2] = (Op01m * CosAx >> 15) * CosAy >> 15; -} - -void DSPOp11() -{ - short SinAz = DSP1_Sin(Op11Zr); - short CosAz = DSP1_Cos(Op11Zr); - short SinAy = DSP1_Sin(Op11Yr); - short CosAy = DSP1_Cos(Op11Yr); - short SinAx = DSP1_Sin(Op11Xr); - short CosAx = DSP1_Cos(Op11Xr); - - Op11m >>= 1; - - matrixB[0][0] = (Op11m * CosAz >> 15) * CosAy >> 15; - matrixB[0][1] = -((Op11m * SinAz >> 15) * CosAy >> 15); - matrixB[0][2] = Op11m * SinAy >> 15; - - matrixB[1][0] = ((Op11m * SinAz >> 15) * CosAx >> 15) + (((Op11m * CosAz >> 15) * SinAx >> 15) * SinAy >> 15); - matrixB[1][1] = ((Op11m * CosAz >> 15) * CosAx >> 15) - (((Op11m * SinAz >> 15) * SinAx >> 15) * SinAy >> 15); - matrixB[1][2] = -((Op11m * SinAx >> 15) * CosAy >> 15); - - matrixB[2][0] = ((Op11m * SinAz >> 15) * SinAx >> 15) - (((Op11m * CosAz >> 15) * CosAx >> 15) * SinAy >> 15); - matrixB[2][1] = ((Op11m * CosAz >> 15) * SinAx >> 15) + (((Op11m * SinAz >> 15) * CosAx >> 15) * SinAy >> 15); - matrixB[2][2] = (Op11m * CosAx >> 15) * CosAy >> 15; -} - -void DSPOp21() -{ - short SinAz = DSP1_Sin(Op21Zr); - short CosAz = DSP1_Cos(Op21Zr); - short SinAy = DSP1_Sin(Op21Yr); - short CosAy = DSP1_Cos(Op21Yr); - short SinAx = DSP1_Sin(Op21Xr); - short CosAx = DSP1_Cos(Op21Xr); - - Op21m >>= 1; - - matrixC[0][0] = (Op21m * CosAz >> 15) * CosAy >> 15; - matrixC[0][1] = -((Op21m * SinAz >> 15) * CosAy >> 15); - matrixC[0][2] = Op21m * SinAy >> 15; - - matrixC[1][0] = ((Op21m * SinAz >> 15) * CosAx >> 15) + (((Op21m * CosAz >> 15) * SinAx >> 15) * SinAy >> 15); - matrixC[1][1] = ((Op21m * CosAz >> 15) * CosAx >> 15) - (((Op21m * SinAz >> 15) * SinAx >> 15) * SinAy >> 15); - matrixC[1][2] = -((Op21m * SinAx >> 15) * CosAy >> 15); - - matrixC[2][0] = ((Op21m * SinAz >> 15) * SinAx >> 15) - (((Op21m * CosAz >> 15) * CosAx >> 15) * SinAy >> 15); - matrixC[2][1] = ((Op21m * CosAz >> 15) * SinAx >> 15) + (((Op21m * SinAz >> 15) * CosAx >> 15) * SinAy >> 15); - matrixC[2][2] = (Op21m * CosAx >> 15) * CosAy >> 15; -} - -short Op0DX; -short Op0DY; -short Op0DZ; -short Op0DF; -short Op0DL; -short Op0DU; -short Op1DX; -short Op1DY; -short Op1DZ; -short Op1DF; -short Op1DL; -short Op1DU; -short Op2DX; -short Op2DY; -short Op2DZ; -short Op2DF; -short Op2DL; -short Op2DU; - -void DSPOp0D() -{ - Op0DF = (Op0DX * matrixA[0][0] >> 15) + (Op0DY * matrixA[0][1] >> 15) + (Op0DZ * matrixA[0][2] >> 15); - Op0DL = (Op0DX * matrixA[1][0] >> 15) + (Op0DY * matrixA[1][1] >> 15) + (Op0DZ * matrixA[1][2] >> 15); - Op0DU = (Op0DX * matrixA[2][0] >> 15) + (Op0DY * matrixA[2][1] >> 15) + (Op0DZ * matrixA[2][2] >> 15); - - #ifdef DebugDSP1 - Log_Message("OP0D X: %d Y: %d Z: %d / F: %d L: %d U: %d",Op0DX,Op0DY,Op0DZ,Op0DF,Op0DL,Op0DU); - #endif -} - -void DSPOp1D() -{ - Op1DF = (Op1DX * matrixB[0][0] >> 15) + (Op1DY * matrixB[0][1] >> 15) + (Op1DZ * matrixB[0][2] >> 15); - Op1DL = (Op1DX * matrixB[1][0] >> 15) + (Op1DY * matrixB[1][1] >> 15) + (Op1DZ * matrixB[1][2] >> 15); - Op1DU = (Op1DX * matrixB[2][0] >> 15) + (Op1DY * matrixB[2][1] >> 15) + (Op1DZ * matrixB[2][2] >> 15); - - #ifdef DebugDSP1 - Log_Message("OP1D X: %d Y: %d Z: %d / F: %d L: %d U: %d",Op1DX,Op1DY,Op1DZ,Op1DF,Op1DL,Op1DU); - #endif -} - -void DSPOp2D() -{ - Op2DF = (Op2DX * matrixC[0][0] >> 15) + (Op2DY * matrixC[0][1] >> 15) + (Op2DZ * matrixC[0][2] >> 15); - Op2DL = (Op2DX * matrixC[1][0] >> 15) + (Op2DY * matrixC[1][1] >> 15) + (Op2DZ * matrixC[1][2] >> 15); - Op2DU = (Op2DX * matrixC[2][0] >> 15) + (Op2DY * matrixC[2][1] >> 15) + (Op2DZ * matrixC[2][2] >> 15); - - #ifdef DebugDSP1 - Log_Message("OP2D X: %d Y: %d Z: %d / F: %d L: %d U: %d",Op2DX,Op2DY,Op2DZ,Op2DF,Op2DL,Op2DU); - #endif -} - -short Op03F; -short Op03L; -short Op03U; -short Op03X; -short Op03Y; -short Op03Z; -short Op13F; -short Op13L; -short Op13U; -short Op13X; -short Op13Y; -short Op13Z; -short Op23F; -short Op23L; -short Op23U; -short Op23X; -short Op23Y; -short Op23Z; - -void DSPOp03() -{ - Op03X = (Op03F * matrixA[0][0] >> 15) + (Op03L * matrixA[1][0] >> 15) + (Op03U * matrixA[2][0] >> 15); - Op03Y = (Op03F * matrixA[0][1] >> 15) + (Op03L * matrixA[1][1] >> 15) + (Op03U * matrixA[2][1] >> 15); - Op03Z = (Op03F * matrixA[0][2] >> 15) + (Op03L * matrixA[1][2] >> 15) + (Op03U * matrixA[2][2] >> 15); - - #ifdef DebugDSP1 - Log_Message("OP03 F: %d L: %d U: %d / X: %d Y: %d Z: %d",Op03F,Op03L,Op03U,Op03X,Op03Y,Op03Z); - #endif -} - -void DSPOp13() -{ - Op13X = (Op13F * matrixB[0][0] >> 15) + (Op13L * matrixB[1][0] >> 15) + (Op13U * matrixB[2][0] >> 15); - Op13Y = (Op13F * matrixB[0][1] >> 15) + (Op13L * matrixB[1][1] >> 15) + (Op13U * matrixB[2][1] >> 15); - Op13Z = (Op13F * matrixB[0][2] >> 15) + (Op13L * matrixB[1][2] >> 15) + (Op13U * matrixB[2][2] >> 15); - - #ifdef DebugDSP1 - Log_Message("OP13 F: %d L: %d U: %d / X: %d Y: %d Z: %d",Op13F,Op13L,Op13U,Op13X,Op13Y,Op13Z); - #endif -} - -void DSPOp23() -{ - Op23X = (Op23F * matrixC[0][0] >> 15) + (Op23L * matrixC[1][0] >> 15) + (Op23U * matrixC[2][0] >> 15); - Op23Y = (Op23F * matrixC[0][1] >> 15) + (Op23L * matrixC[1][1] >> 15) + (Op23U * matrixC[2][1] >> 15); - Op23Z = (Op23F * matrixC[0][2] >> 15) + (Op23L * matrixC[1][2] >> 15) + (Op23U * matrixC[2][2] >> 15); - - #ifdef DebugDSP1 - Log_Message("OP23 F: %d L: %d U: %d / X: %d Y: %d Z: %d",Op23F,Op23L,Op23U,Op23X,Op23Y,Op23Z); - #endif -} - -short Op14Zr; -short Op14Xr; -short Op14Yr; -short Op14U; -short Op14F; -short Op14L; -short Op14Zrr; -short Op14Xrr; -short Op14Yrr; - -void DSPOp14() -{ - short CSec, ESec, CTan, CSin, C, E; - - DSP1_Inverse(DSP1_Cos(Op14Xr), 0, &CSec, &ESec); - - // Rotation Around Z - DSP1_NormalizeDouble(Op14U * DSP1_Cos(Op14Yr) - Op14F * DSP1_Sin(Op14Yr), &C, &E); - - E = ESec - E; - - DSP1_Normalize(C * CSec >> 15, &C, &E); - - Op14Zrr = Op14Zr + DSP1_Truncate(C, E); - - // Rotation Around X - Op14Xrr = Op14Xr + (Op14U * DSP1_Sin(Op14Yr) >> 15) + (Op14F * DSP1_Cos(Op14Yr) >> 15); - - // Rotation Around Y - DSP1_NormalizeDouble(Op14U * DSP1_Cos(Op14Yr) + Op14F * DSP1_Sin(Op14Yr), &C, &E); - - E = ESec - E; - - DSP1_Normalize(DSP1_Sin(Op14Xr), &CSin, &E); - - CTan = CSec * CSin >> 15; - - DSP1_Normalize(-(C * CTan >> 15), &C, &E); - - Op14Yrr = Op14Yr + DSP1_Truncate(C, E) + Op14L; -} - -void DSP1_Target(short H, short V, short *X, short *Y) -{ - short C, E, C1, E1; - - DSP1_Inverse((V * SinAzs >> 15) + VOffset, 8, &C, &E); - E += VPlane_E; - - C1 = C * VPlane_C >> 15; - E1 = E + SecAZS_E1; - - H <<= 8; - - DSP1_Normalize(C1, &C, &E); - - C = DSP1_Truncate(C, E) * H >> 15; - - *X = CentreX + (C * CosAas >> 15); - *Y = CentreY - (C * SinAas >> 15); - - V <<= 8; - - DSP1_Normalize(C1 * SecAZS_C1 >> 15, &C, &E1); - - C = DSP1_Truncate(C, E1) * V >> 15; - - *X += C * -SinAas >> 15; - *Y += C * CosAas >> 15; -} - -short Op0EH; -short Op0EV; -short Op0EX; -short Op0EY; - -void DSPOp0E() -{ - DSP1_Target(Op0EH, Op0EV, &Op0EX, &Op0EY); -} - -short Op0BX; -short Op0BY; -short Op0BZ; -short Op0BS; -short Op1BX; -short Op1BY; -short Op1BZ; -short Op1BS; -short Op2BX; -short Op2BY; -short Op2BZ; -short Op2BS; - -void DSPOp0B() -{ - Op0BS = (Op0BX * matrixA[0][0] + Op0BY * matrixA[0][1] + Op0BZ * matrixA[0][2]) >> 15; - - #ifdef DebugDSP1 - Log_Message("OP0B"); - #endif -} - -void DSPOp1B() -{ - Op1BS = (Op1BX * matrixB[0][0] + Op1BY * matrixB[0][1] + Op1BZ * matrixB[0][2]) >> 15; - - #ifdef DebugDSP1 - Log_Message("OP1B X: %d Y: %d Z: %d S: %d",Op1BX,Op1BY,Op1BZ,Op1BS); - Log_Message(" MX: %d MY: %d MZ: %d Scale: %d",(short)(matrixB[0][0]*100),(short)(matrixB[0][1]*100),(short)(matrixB[0][2]*100),(short)(sc2*100)); - #endif -} - -void DSPOp2B() -{ - Op2BS = (Op2BX * matrixC[0][0] + Op2BY * matrixC[0][1] + Op2BZ * matrixC[0][2]) >> 15; - - #ifdef DebugDSP1 - Log_Message("OP2B"); - #endif -} - -short Op08X,Op08Y,Op08Z,Op08Ll,Op08Lh; - -void DSPOp08() -{ - int Op08Size = (Op08X * Op08X + Op08Y * Op08Y + Op08Z * Op08Z) << 1; - Op08Ll = Op08Size & 0xffff; - Op08Lh = (Op08Size >> 16) & 0xffff; - - #ifdef DebugDSP1 - Log_Message("OP08 %d,%d,%d",Op08X,Op08Y,Op08Z); - Log_Message("OP08 ((Op08X^2)+(Op08Y^2)+(Op08X^2))=%x",Op08Size ); - #endif -} - -short Op18X,Op18Y,Op18Z,Op18R,Op18D; - -void DSPOp18() -{ - Op18D = (Op18X * Op18X + Op18Y * Op18Y + Op18Z * Op18Z - Op18R * Op18R) >> 15; - - #ifdef DebugDSP1 - Log_Message("Op18 X: %d Y: %d Z: %d R: %D DIFF %d",Op18X,Op18Y,Op38Z,Op18D); - #endif -} - -short Op38X,Op38Y,Op38Z,Op38R,Op38D; - -void DSPOp38() -{ - Op38D = (Op38X * Op38X + Op38Y * Op38Y + Op38Z * Op38Z - Op38R * Op38R) >> 15; - Op38D++; - - #ifdef DebugDSP1 - Log_Message("OP38 X: %d Y: %d Z: %d R: %D DIFF %d",Op38X,Op38Y,Op38Z,Op38D); - #endif -} - -short Op28X; -short Op28Y; -short Op28Z; -short Op28R; - -void DSPOp28() -{ - int Radius = Op28X * Op28X + Op28Y * Op28Y + Op28Z * Op28Z; - - if (Radius == 0) Op28R = 0; - else - { - short C, E, Pos, Node1, Node2; - DSP1_NormalizeDouble(Radius, &C, &E); - if (E & 1) C = C * 0x4000 >> 15; - - Pos = C * 0x0040 >> 15; - - Node1 = DSP1ROM[0x00d5 + Pos]; - Node2 = DSP1ROM[0x00d6 + Pos]; - - Op28R = ((Node2 - Node1) * (C & 0x1ff) >> 9) + Node1; - Op28R >>= (E >> 1); - } - - #ifdef DebugDSP1 - Log_Message("OP28 X:%d Y:%d Z:%d",Op28X,Op28Y,Op28Z); - Log_Message("OP28 Vector Length %d",Op28R); - #endif -} - -short Op1CX,Op1CY,Op1CZ; -short Op1CXBR,Op1CYBR,Op1CZBR,Op1CXAR,Op1CYAR,Op1CZAR; -short Op1CX1; -short Op1CY1; -short Op1CZ1; -short Op1CX2; -short Op1CY2; -short Op1CZ2; - -void DSPOp1C() -{ - // Rotate Around Op1CZ1 - Op1CX1 = (Op1CYBR * DSP1_Sin(Op1CZ) >> 15) + (Op1CXBR * DSP1_Cos(Op1CZ) >> 15); - Op1CY1 = (Op1CYBR * DSP1_Cos(Op1CZ) >> 15) - (Op1CXBR * DSP1_Sin(Op1CZ) >> 15); - Op1CXBR = Op1CX1; Op1CYBR = Op1CY1; - - // Rotate Around Op1CY1 - Op1CZ1 = (Op1CXBR * DSP1_Sin(Op1CY) >> 15) + (Op1CZBR * DSP1_Cos(Op1CY) >> 15); - Op1CX1 = (Op1CXBR * DSP1_Cos(Op1CY) >> 15) - (Op1CZBR * DSP1_Sin(Op1CY) >> 15); - Op1CXAR = Op1CX1; Op1CZBR = Op1CZ1; - - // Rotate Around Op1CX1 - Op1CY1 = (Op1CZBR * DSP1_Sin(Op1CX) >> 15) + (Op1CYBR * DSP1_Cos(Op1CX) >> 15); - Op1CZ1 = (Op1CZBR * DSP1_Cos(Op1CX) >> 15) - (Op1CYBR * DSP1_Sin(Op1CX) >> 15); - Op1CYAR = Op1CY1; Op1CZAR = Op1CZ1; - - #ifdef DebugDSP1 - Log_Message("OP1C Apply Matrix CX:%d CY:%d CZ",Op1CXAR,Op1CYAR,Op1CZAR); - #endif -} - -unsigned short Op0FRamsize; -unsigned short Op0FPass; - -void DSPOp0F() -{ - Op0FPass = 0x0000; - - #ifdef DebugDSP1 - Log_Message("OP0F RAM Test Pass:%d", Op0FPass); - #endif -} - -short Op2FUnknown; -short Op2FSize; - -void DSPOp2F() -{ - Op2FSize=0x100; -} diff --git a/tools/zsnes/src/chips/dsp1proc.asm b/tools/zsnes/src/chips/dsp1proc.asm deleted file mode 100644 index a9a9fc1..0000000 --- a/tools/zsnes/src/chips/dsp1proc.asm +++ /dev/null @@ -1,879 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%include "macros.mac" - -EXTSYM regaccessbankr8,regaccessbankr16,regaccessbankw8,regaccessbankw16 -EXTSYM DSPOp0A,Op0AA,Op0AB,Op0AC,Op0AD,Op0AVS,DSPOp10,DSPOp00,Op00Multiplicand -EXTSYM Op00Multiplier,Op00Result,DSPOp0F,Op0FPass -EXTSYM DSPOp04,Op04Angle,Op04Cos,Op04Radius,Op04Sin -EXTSYM DSPOp28,Op28R,Op28X,Op28Y,Op28Z -EXTSYM DSPOp0C,Op0CA,Op0CX1,Op0CX2,Op0CY1,Op0CY2 -EXTSYM DSPOp02,Op02AAS,Op02AZS,Op02CX,Op02CY,Op02FX,Op02FY -EXTSYM Op02FZ,Op02LES,Op02LFE,Op02VOF,Op02VVA -EXTSYM DSPOp06,Op06X,Op06Y,Op06Z,Op06H,Op06V,Op06M -EXTSYM DSPOp0E,Op0EH,Op0EV,Op0EX,Op0EY -EXTSYM Op01m,Op01Zr,Op01Xr,Op01Yr,DSPOp01 -EXTSYM Op11m,Op11Zr,Op11Xr,Op11Yr,DSPOp11 -EXTSYM Op21m,Op21Zr,Op21Xr,Op21Yr,DSPOp21 -EXTSYM Op0DX,Op0DY,Op0DZ,Op0DF,Op0DL,Op0DU,DSPOp0D -EXTSYM Op1DX,Op1DY,Op1DZ,Op1DF,Op1DL,Op1DU,DSPOp1D -EXTSYM Op2DX,Op2DY,Op2DZ,Op2DF,Op2DL,Op2DU,DSPOp2D -EXTSYM Op03X,Op03Y,Op03Z,Op03F,Op03L,Op03U,DSPOp03 -EXTSYM Op13X,Op13Y,Op13Z,Op13F,Op13L,Op13U,DSPOp13 -EXTSYM Op23X,Op23Y,Op23Z,Op23F,Op23L,Op23U,DSPOp23 -EXTSYM Op14Zr,Op14Xr,Op14Yr,Op14U,Op14F,Op14L -EXTSYM Op14Zrr,Op14Xrr,Op14Yrr,DSPOp14 -EXTSYM Op0BX,Op0BY,Op0BZ,Op0BS,DSPOp0B -EXTSYM Op1BX,Op1BY,Op1BZ,Op1BS,DSPOp1B -EXTSYM Op2BX,Op2BY,Op2BZ,Op2BS,DSPOp2B -EXTSYM Op08X,Op08Y,Op08Z,Op08Ll,Op08Lh,DSPOp08 -EXTSYM Op18X,Op18Y,Op18Z,Op18R,Op18D,DSPOp18 -EXTSYM Op1CX,Op1CY,Op1CZ,Op1CXBR,Op1CYBR,Op1CZBR,Op1CXAR,Op1CYAR,Op1CZAR,DSPOp1C -EXTSYM Op10Exponent,Op10ExponentR,Op10Coefficient,Op10CoefficientR - -SECTION .bss -NEWSYM dsp1ptr, resd 1 -NEWSYM dsp1array, resb 4096 - -SECTION .text - -;******************************************************* -; DSP1 Read Functions -;******************************************************* - -NEWSYM DSP1Read8b3F - test ecx,8000h - jnz .dsp1area - cmp bl,0E0h - je .dsp1area - jmp regaccessbankr8 -.dsp1area - mov al,80h - ret - -NEWSYM DSP1Read16b3F - test ecx,8000h - jnz .dsp1area - cmp bl,0E0h - je .dsp1area - jmp regaccessbankr16 -.dsp1area - or ecx,08000h - cmp ecx,0C000h - jae .doC000 - cmp byte[DSP1RLeft],0 - jne .movestuff - xor ax,ax - ret -.doC000 - mov ax,08000h - cmp byte[DSP1WLeft],0 - je .notwleft - mov ax,0C000h -.notwleft - ret -.movestuff - push ebx - xor ebx,ebx - mov bl,[DSP1CPtrR] - mov ax,[DSP1RET+ebx*2] - pop ebx - inc byte[DSP1CPtrR] - dec byte[DSP1RLeft] - jz .nomore -.goback - ret -.nomore - cmp byte[DSP1COp],0Ah - jne .goback - push eax - pushad - call DSPOp0A - popad - mov ax,[Op0AA] - mov [DSP1RET],ax - mov ax,[Op0AB] - mov [DSP1RET+2],ax - mov ax,[Op0AC] - mov [DSP1RET+4],ax - mov ax,[Op0AD] - mov [DSP1RET+6],ax - mov byte[DSP1RLeft],4 - mov byte[DSP1CPtrR],0 - pop eax - ret - -NEWSYM DSP1Read8b -; mov byte[debstop],1 - cmp ecx,7000h - jae .do7000 - xor al,al - ret -.do7000 - mov al,80h - test ecx,1 - jz .no1 - mov al,80h -.no1 - ret - -NEWSYM DSP1Read16b -; mov byte[debstop],1 - cmp ecx,7000h - jae .do7000 - cmp byte[DSP1RLeft],0 - jne .movestuff - xor ax,ax - ret -.do7000 - mov ax,8000h - cmp byte[DSP1WLeft],0 - je .notwleft - mov ax,0C000h -.notwleft -; test ecx,01h -; jz .norev -; mov ax,0080h -;.norev - ret -.movestuff - push ebx - xor ebx,ebx - mov bl,[DSP1CPtrR] - mov ax,[DSP1RET+ebx*2] - pop ebx - inc byte[DSP1CPtrR] - dec byte[DSP1RLeft] - jz .nomore -.goback - ret -.nomore - cmp byte[DSP1COp],0Ah - jne .goback - push eax - pushad - call DSPOp0A - popad - mov ax,[Op0AA] - mov [DSP1RET],ax - mov ax,[Op0AB] - mov [DSP1RET+2],ax - mov ax,[Op0AC] - mov [DSP1RET+4],ax - mov ax,[Op0AD] - mov [DSP1RET+6],ax - mov byte[DSP1RLeft],4 - mov byte[DSP1CPtrR],0 - pop eax - ret - -%macro DSP1WriteInit 2 - cmp al,%1 - jne %%no - mov byte[DSP1WLeft],%2 -%%no -%endmacro - -NEWSYM DSP1Write8b3F - test ecx,8000h - jnz .dsp1area - cmp bl,0E0h - je .dsp1area - jmp regaccessbankw8 -.dsp1area - call DSP1Write8b - ret - -NEWSYM DSP1Write16b3F - test ecx,8000h - jnz .dsp1area - cmp bl,0E0h - je .dsp1area - jmp regaccessbankw16 -.dsp1area - call DSP1Write16b - ret - -NEWSYM DSP1Write8b - push ebx - xor ebx,ebx - mov bl,al - mov byte[DSPFuncUsed+ebx],1 - pop ebx - mov [DSP1COp],al - mov byte[DSP1CPtrW],0 - DSP1WriteInit 00h, 2 ; 16-bit multiply - DSP1WriteInit 10h, 2 ; Inverse - DSP1WriteInit 04h, 2 ; Trigonometric - DSP1WriteInit 08h, 3 ; Vector Size - DSP1WriteInit 18h, 4 ; Vector Size Comparison - DSP1WriteInit 28h, 3 ; Vector Absolute Value - DSP1WriteInit 0Ch, 3 ; Coordinate Rotation - DSP1WriteInit 1Ch, 6 ; 3D Coordinate Rotation - DSP1WriteInit 02h, 7 ; Vector Size - DSP1WriteInit 0Ah, 1 ; Raster Data Calculation via DMA - DSP1WriteInit 1Ah, 1 ; Raster Data Calculation w/o DMA - DSP1WriteInit 06h, 3 ; Object Projection Calculation - DSP1WriteInit 0Eh, 2 ; Coordinate Calculation of a point onscreen - DSP1WriteInit 01h, 4 ; Set Attitude Matrix A - DSP1WriteInit 11h, 4 ; Set Attitude Matrix B - DSP1WriteInit 21h, 4 ; Set Attitude Matrix C - DSP1WriteInit 0Dh, 3 ; Convert from global to object coords Matrix A - DSP1WriteInit 1Dh, 3 ; Convert from global to object coords Matrix B - DSP1WriteInit 2Dh, 3 ; Convert from global to object coords Matrix C - DSP1WriteInit 03h, 3 ; Convert from object to global coords Matrix A - DSP1WriteInit 13h, 3 ; Convert from object to global coords Matrix B - DSP1WriteInit 23h, 3 ; Convert from object to global coords Matrix C - DSP1WriteInit 0Bh, 3 ; Calculation of inner product Matrix A - DSP1WriteInit 1Bh, 3 ; Calculation of inner product Matrix B - DSP1WriteInit 2Bh, 3 ; Calculation of inner product Matrix C - DSP1WriteInit 14h, 6 ; 3D angle rotation - DSP1WriteInit 0Fh, 1 ; DSP RAM Check - ret - -%macro DSP1WriteProc 2 - cmp byte[DSP1COp],%1 - jne %%no - pushad - call %2 - popad -%%no -%endmacro - -NEWSYM DSP1Write16b -; mov byte[debstop],1 - cmp byte[DSP1WLeft],0 - jne .yesleft - ret -.yesleft - push ebx - xor ebx,ebx - mov bl,[DSP1CPtrW] - mov [DSP1VARS+ebx*2],ax - pop ebx - inc byte[DSP1CPtrW] - dec byte[DSP1WLeft] - jz .ProcessDSP1 - ret -.ProcessDSP1 - mov byte[DSP1CPtrR],0 - mov byte[DSP1RLeft],0 - DSP1WriteProc 00h, DSP1_00 ; 16-bit multiply - DSP1WriteProc 10h, DSP1_10 ; Inverse - DSP1WriteProc 04h, DSP1_04 ; Trigonometric - DSP1WriteProc 08h, DSP1_08 ; Vector Size - DSP1WriteProc 18h, DSP1_18 ; Vector Size Comparison - DSP1WriteProc 28h, DSP1_28 ; Vector Absolute Value - DSP1WriteProc 0Ch, DSP1_0C ; Coordinate Rotation - DSP1WriteProc 1Ch, DSP1_1C ; 3D Coordinate Rotation - DSP1WriteProc 02h, DSP1_02 ; Vector Size - DSP1WriteProc 0Ah, DSP1_0A ; Raster Data Calculation via DMA - DSP1WriteProc 1Ah, DSP1_0A ; Raster Data Calculation w/o DMA - DSP1WriteProc 06h, DSP1_06 ; Object Projection Calculation - DSP1WriteProc 0Eh, DSP1_0E ; Coordinate Calculation of a point onscreen - DSP1WriteProc 01h, DSP1_01 ; Set Attitude Matrix A - DSP1WriteProc 11h, DSP1_11 ; Set Attitude Matrix B - DSP1WriteProc 21h, DSP1_21 ; Set Attitude Matrix C - DSP1WriteProc 0Dh, DSP1_0D ; Convert from global to object coords Matrix A - DSP1WriteProc 1Dh, DSP1_1D ; Convert from global to object coords Matrix B - DSP1WriteProc 2Dh, DSP1_2D ; Convert from global to object coords Matrix C - DSP1WriteProc 03h, DSP1_03 ; Convert from object to global coords Matrix A - DSP1WriteProc 13h, DSP1_13 ; Convert from object to global coords Matrix B - DSP1WriteProc 23h, DSP1_23 ; Convert from object to global coords Matrix C - DSP1WriteProc 0Bh, DSP1_0B ; Calculation of inner product Matrix A - DSP1WriteProc 1Bh, DSP1_1B ; Calculation of inner product Matrix B - DSP1WriteProc 2Bh, DSP1_2B ; Calculation of inner product Matrix C - DSP1WriteProc 14h, DSP1_14 ; 3D angle rotation - DSP1WriteProc 0Fh, DSP1_0F ; DSP RAM Check - ret - -SECTION .bss -NEWSYM DSP1COp, resb 1 -NEWSYM DSP1RLeft, resb 1 -NEWSYM DSP1WLeft, resb 1 -NEWSYM DSP1CPtrW, resb 1 -NEWSYM DSP1CPtrR, resb 1 -NEWSYM DSP1VARS, resw 16 -NEWSYM DSP1RET, resw 16 -NEWSYM DSPDet, resb 1 - -NEWSYM DSPFuncUsed, resb 256 - -SECTION .text - -;******************************************************* -; DSP1 Conversion Functions -;******************************************************* -DSP1_00: ; 16-bit multiply - or byte[DSPDet],01h - push eax - mov ax,[DSP1VARS] - mov [Op00Multiplicand],ax - mov ax,[DSP1VARS+2] - mov [Op00Multiplier],ax - pushad - call DSPOp00 - popad - mov ax,[Op00Result] - mov [DSP1RET],ax - mov byte[DSP1RLeft],1 - pop eax - ret - -DSP1_10: ; Inverse - push eax - mov ax,[DSP1VARS] - mov [Op10Coefficient],ax - mov ax,[DSP1VARS+2] - mov [Op10Exponent],ax - pushad - call DSPOp10 - popad - mov ax,[Op10CoefficientR] - mov [DSP1RET],ax - mov ax,[Op10ExponentR] - mov [DSP1RET+2],ax - mov byte[DSP1RLeft],2 - pop eax - ret - -DSP1_04: ; Trigonometric - or byte[DSPDet],02h - push eax - mov ax,[DSP1VARS] - mov [Op04Angle],ax - mov ax,[DSP1VARS+2] - mov [Op04Radius],ax - pushad - call DSPOp04 - popad - mov ax,[Op04Sin] - mov [DSP1RET],ax - mov ax,[Op04Cos] - mov [DSP1RET+2],ax - mov byte[DSP1RLeft],2 - pop eax - ret - -DSP1_08: ; Vector Size - push eax - mov ax,[DSP1VARS] - mov [Op08X],ax - mov ax,[DSP1VARS+2] - mov [Op08Y],ax - mov ax,[DSP1VARS+4] - mov [Op08Z],ax - pushad - call DSPOp08 - popad - mov ax,[Op08Ll] - mov [DSP1RET],ax - mov ax,[Op08Lh] - mov [DSP1RET+2],ax - mov byte[DSP1RLeft],2 - pop eax - ret - -DSP1_18: ; Vector Size Comparison - push eax - mov ax,[DSP1VARS] - mov [Op18X],ax - mov ax,[DSP1VARS+2] - mov [Op18Y],ax - mov ax,[DSP1VARS+4] - mov [Op18Z],ax - mov ax,[DSP1VARS+6] - mov [Op18R],ax - pushad - call DSPOp18 - popad - mov ax,[Op18D] - mov [DSP1RET],ax - mov byte[DSP1RLeft],1 - pop eax - ret - -DSP1_28: ; Vector Absolute Value - or byte[DSPDet],04h - push eax - mov ax,[DSP1VARS] - mov [Op28X],ax - mov ax,[DSP1VARS+2] - mov [Op28Y],ax - mov ax,[DSP1VARS+4] - mov [Op28Z],ax - pushad - call DSPOp28 - popad - mov ax,[Op28R] - mov [DSP1RET],ax - mov byte[DSP1RLeft],1 - pop eax - ret - -DSP1_0C: ; Coordinate Rotation - or byte[DSPDet],08h - push eax - mov ax,[DSP1VARS] - mov [Op0CA],ax - mov ax,[DSP1VARS+2] - mov [Op0CX1],ax - mov ax,[DSP1VARS+4] - mov [Op0CY1],ax - pushad - call DSPOp0C - popad - mov ax,[Op0CX2] - mov [DSP1RET],ax - mov ax,[Op0CY2] - mov [DSP1RET+2],ax - mov byte[DSP1RLeft],2 - pop eax - ret - -DSP1_1C: ; 3D Coordinate Rotation - push eax - mov ax,[DSP1VARS] - mov [Op1CZ],ax - mov ax,[DSP1VARS+2] - mov [Op1CY],ax - mov ax,[DSP1VARS+4] - mov [Op1CX],ax - mov ax,[DSP1VARS+6] - mov [Op1CXBR],ax - mov ax,[DSP1VARS+8] - mov [Op1CYBR],ax - mov ax,[DSP1VARS+10] - mov [Op1CZBR],ax - pushad - call DSPOp1C - popad - mov ax,[Op1CXAR] - mov [DSP1RET],ax - mov ax,[Op1CYAR] - mov [DSP1RET+2],ax - mov ax,[Op1CZAR] - mov [DSP1RET+4],ax - mov byte[DSP1RLeft],3 - pop eax - ret - -DSP1_02: ; Vector Size - or byte[DSPDet],10h - push eax - mov ax,[DSP1VARS] - mov [Op02FX],ax - mov ax,[DSP1VARS+2] - mov [Op02FY],ax - mov ax,[DSP1VARS+4] - mov [Op02FZ],ax - mov ax,[DSP1VARS+6] - mov [Op02LFE],ax - mov ax,[DSP1VARS+8] - mov [Op02LES],ax - mov ax,[DSP1VARS+10] - mov [Op02AAS],ax - mov ax,[DSP1VARS+12] - mov [Op02AZS],ax - pushad - call DSPOp02 - popad - mov ax,[Op02VOF] - mov [DSP1RET],ax - mov ax,[Op02VVA] - mov [DSP1RET+2],ax - mov ax,[Op02CX] - mov [DSP1RET+4],ax - mov ax,[Op02CY] - mov [DSP1RET+6],ax - mov byte[DSP1RLeft],4 - pop eax - ret - mov eax,dsp1array - add eax,[dsp1ptr] - push ebx - mov byte[eax],02h - mov bx,[Op02FX] - mov [eax+1],bx - mov bx,[Op02FY] - mov [eax+3],bx - mov bx,[Op02FZ] - mov [eax+5],bx - mov bx,[Op02LFE] - mov [eax+7],bx - mov bx,[Op02LES] - mov [eax+9],bx - mov bx,[Op02AAS] - mov [eax+11],bx - mov bx,[Op02AZS] - mov [eax+13],bx - mov bx,[Op02VOF] - mov [eax+15],bx - mov bx,[Op02VVA] - mov [eax+17],bx - mov bx,[Op02CX] - mov [eax+19],bx - mov bx,[Op02CY] - mov [eax+21],bx - pop ebx - add dword[dsp1ptr],23 -DSP1_0A: ; Raster Data Calculation via DMA - mov byte[DSP1COp],0Ah - or byte[DSPDet],20h - push eax - mov ax,[DSP1VARS] - mov [Op0AVS],ax - pushad - call DSPOp0A - popad - mov ax,[Op0AA] - mov [DSP1RET],ax - mov ax,[Op0AB] - mov [DSP1RET+2],ax - mov ax,[Op0AC] - mov [DSP1RET+4],ax - mov ax,[Op0AD] - mov [DSP1RET+6],ax - mov byte[DSP1RLeft],4 - pop eax - ret - -DSP1_06: ; Object Projection Calculation - or byte[DSPDet],40h - push eax - mov ax,[DSP1VARS] - mov [Op06X],ax - mov ax,[DSP1VARS+2] - mov [Op06Y],ax - mov ax,[DSP1VARS+4] - mov [Op06Z],ax - pushad - call DSPOp06 - popad - mov ax,[Op06H] - mov [DSP1RET],ax - mov ax,[Op06V] - mov [DSP1RET+2],ax - mov ax,[Op06M] - mov [DSP1RET+4],ax - mov byte[DSP1RLeft],3 - pop eax - ret - mov eax,dsp1array - add eax,[dsp1ptr] - push ebx - mov byte[eax],06h - mov bx,[Op06X] - mov [eax+1],bx - mov bx,[Op06Y] - mov [eax+3],bx - mov bx,[Op06Z] - mov [eax+5],bx - mov bx,[Op06H] - mov [eax+7],bx - mov bx,[Op06V] - mov [eax+9],bx - mov bx,[Op06M] - mov [eax+11],bx - pop ebx - add dword[dsp1ptr],13 - -DSP1_0E: ; Coordinate Calculation of a point onscreen - push eax - mov ax,[DSP1VARS] - mov [Op0EH],ax - mov ax,[DSP1VARS+2] - mov [Op0EV],ax - pushad - call DSPOp0E - popad - mov ax,[Op0EX] - mov [DSP1RET],ax - mov ax,[Op0EY] - mov [DSP1RET+2],ax - mov byte[DSP1RLeft],2 - pop eax - ret - -DSP1_01: ; Set Attitude Matrix A - push eax - mov ax,[DSP1VARS] - mov [Op01m],ax - mov ax,[DSP1VARS+2] - mov [Op01Zr],ax - mov ax,[DSP1VARS+4] - mov [Op01Yr],ax - mov ax,[DSP1VARS+6] - mov [Op01Xr],ax - pushad - call DSPOp01 - popad - pop eax - ret - -DSP1_11: ; Set Attitude Matrix B - push eax - mov ax,[DSP1VARS] - mov [Op11m],ax - mov ax,[DSP1VARS+2] - mov [Op11Zr],ax - mov ax,[DSP1VARS+4] - mov [Op11Yr],ax - mov ax,[DSP1VARS+6] - mov [Op11Xr],ax - pushad - call DSPOp11 - popad - pop eax - ret - -DSP1_21: ; Set Attitude Matrix C - push eax - mov ax,[DSP1VARS] - mov [Op21m],ax - mov ax,[DSP1VARS+2] - mov [Op21Zr],ax - mov ax,[DSP1VARS+4] - mov [Op21Yr],ax - mov ax,[DSP1VARS+6] - mov [Op21Xr],ax - pushad - call DSPOp21 - popad - pop eax - ret - -DSP1_0D: ; Convert from global to object coords Matrix A - push eax - mov ax,[DSP1VARS] - mov [Op0DX],ax - mov ax,[DSP1VARS+2] - mov [Op0DY],ax - mov ax,[DSP1VARS+4] - mov [Op0DZ],ax - pushad - call DSPOp0D - popad - mov ax,[Op0DF] - mov [DSP1RET],ax - mov ax,[Op0DL] - mov [DSP1RET+2],ax - mov ax,[Op0DU] - mov [DSP1RET+4],ax - mov byte[DSP1RLeft],3 - pop eax - ret - -DSP1_0F: ; DSP RAM Test - push eax - mov ax,[DSP1VARS] - pushad - call DSPOp0F - popad - mov ax,[Op0FPass] - mov [DSP1RET],ax - mov byte[DSP1RLeft],1 - pop eax - ret - -DSP1_1D: ; Convert from global to object coords Matrix B - push eax - mov ax,[DSP1VARS] - mov [Op1DX],ax - mov ax,[DSP1VARS+2] - mov [Op1DY],ax - mov ax,[DSP1VARS+4] - mov [Op1DZ],ax - pushad - call DSPOp1D - popad - mov ax,[Op1DF] - mov [DSP1RET],ax - mov ax,[Op1DL] - mov [DSP1RET+2],ax - mov ax,[Op1DU] - mov [DSP1RET+4],ax - mov byte[DSP1RLeft],3 - pop eax - ret - -DSP1_2D: ; Convert from global to object coords Matrix C - push eax - mov ax,[DSP1VARS] - mov [Op2DX],ax - mov ax,[DSP1VARS+2] - mov [Op2DY],ax - mov ax,[DSP1VARS+4] - mov [Op2DZ],ax - pushad - call DSPOp2D - popad - mov ax,[Op2DF] - mov [DSP1RET],ax - mov ax,[Op2DL] - mov [DSP1RET+2],ax - mov ax,[Op2DU] - mov [DSP1RET+4],ax - mov byte[DSP1RLeft],3 - pop eax - ret - -DSP1_03: ; Convert from object to global coords Matrix A - push eax - mov ax,[DSP1VARS] - mov [Op03F],ax - mov ax,[DSP1VARS+2] - mov [Op03L],ax - mov ax,[DSP1VARS+4] - mov [Op03U],ax - pushad - call DSPOp03 - popad - mov ax,[Op03X] - mov [DSP1RET],ax - mov ax,[Op03Y] - mov [DSP1RET+2],ax - mov ax,[Op03Z] - mov [DSP1RET+4],ax - mov byte[DSP1RLeft],3 - pop eax - ret - -DSP1_13: ; Convert from object to global coords Matrix B - push eax - mov ax,[DSP1VARS] - mov [Op13F],ax - mov ax,[DSP1VARS+2] - mov [Op13L],ax - mov ax,[DSP1VARS+4] - mov [Op13U],ax - pushad - call DSPOp13 - popad - mov ax,[Op13X] - mov [DSP1RET],ax - mov ax,[Op13Y] - mov [DSP1RET+2],ax - mov ax,[Op13Z] - mov [DSP1RET+4],ax - mov byte[DSP1RLeft],3 - pop eax - ret - -DSP1_23: ; Convert from object to global coords Matrix C - push eax - mov ax,[DSP1VARS] - mov [Op23F],ax - mov ax,[DSP1VARS+2] - mov [Op23L],ax - mov ax,[DSP1VARS+4] - mov [Op23U],ax - pushad - call DSPOp23 - popad - mov ax,[Op23X] - mov [DSP1RET],ax - mov ax,[Op23Y] - mov [DSP1RET+2],ax - mov ax,[Op23Z] - mov [DSP1RET+4],ax - mov byte[DSP1RLeft],3 - pop eax - ret - -DSP1_0B: ; Calculation of inner product Matrix A - push eax - mov ax,[DSP1VARS] - mov [Op0BX],ax - mov ax,[DSP1VARS+2] - mov [Op0BY],ax - mov ax,[DSP1VARS+4] - mov [Op0BZ],ax - pushad - call DSPOp0B - popad - mov ax,[Op0BS] - mov [DSP1RET],ax - mov byte[DSP1RLeft],1 - pop eax - ret - -DSP1_1B: ; Calculation of inner product Matrix B - push eax - mov ax,[DSP1VARS] - mov [Op1BX],ax - mov ax,[DSP1VARS+2] - mov [Op1BY],ax - mov ax,[DSP1VARS+4] - mov [Op1BZ],ax - pushad - call DSPOp1B - popad - mov ax,[Op1BS] - mov [DSP1RET],ax - mov byte[DSP1RLeft],1 - pop eax - ret - -DSP1_2B: ; Calculation of inner product Matrix C - push eax - mov ax,[DSP1VARS] - mov [Op2BX],ax - mov ax,[DSP1VARS+2] - mov [Op2BY],ax - mov ax,[DSP1VARS+4] - mov [Op2BZ],ax - pushad - call DSPOp2B - popad - mov ax,[Op2BS] - mov [DSP1RET],ax - mov byte[DSP1RLeft],1 - pop eax - ret - -DSP1_14: ; 3D angle rotation - push eax - mov ax,[DSP1VARS] - mov [Op14Zr],ax - mov ax,[DSP1VARS+2] - mov [Op14Xr],ax - mov ax,[DSP1VARS+4] - mov [Op14Yr],ax - mov ax,[DSP1VARS+6] - mov [Op14U],ax - mov ax,[DSP1VARS+8] - mov [Op14F],ax - mov ax,[DSP1VARS+10] - mov [Op14L],ax - pushad - call DSPOp14 - popad - mov ax,[Op14Zrr] - mov [DSP1RET],ax - mov ax,[Op14Xrr] - mov [DSP1RET+2],ax - mov ax,[Op14Yrr] - mov [DSP1RET+4],ax - mov byte[DSP1RLeft],3 - pop eax - ret diff --git a/tools/zsnes/src/chips/dsp2proc.asm b/tools/zsnes/src/chips/dsp2proc.asm deleted file mode 100644 index 077aeb3..0000000 --- a/tools/zsnes/src/chips/dsp2proc.asm +++ /dev/null @@ -1,608 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -; Apr 29, 2004 -; DSP2 support code written by kentaro-k.21 -; coding hints are based on DSP2 function overview at http://users.tpg.com.au/trauma/dsp/dsp2.html maintained by Overload. -; i have stolen the useful technical info there to implement DSP2 codes without any permission from its author. -; i do NOT know and peep the s9x source codes for either DSP2 or any purpose. -; May 02, 2004 -; bug fix for Dungeon Master. -; Command 05h fixed. -; when you got the magic missile damage such as fireball, DSP2 support in prior version entered halt state. - -%include "macros.mac" - -DSP2F_HALT equ 1 -DSP2F_AUTO_BUFFER_SHIFT equ 2 -DSP2F_NO_ADDR_CHK equ 4 - -;******************************************************* -; .bss section -;******************************************************* -SECTION .bss -NEWSYM dsp2buffer, resb 256 -NEWSYM dsp2enforcerQueue, resb 8*512 -NEWSYM dsp2enforcer, resb 8 - -;******************************************************* -; .data section -;******************************************************* -SECTION .data -NEWSYM dsp2f03KeyLo, db 0 ; Current transparent-color in lower-byte -NEWSYM dsp2f03KeyHi, db 0 ; Current transparent-color in higher-byte - -NEWSYM dsp2enforcerReaderCursor, dd 0 ; T/O -NEWSYM dsp2enforcerWriterCursor, dd 1 ; T/O -NEWSYM dsp2state, dd 1 ; Flags: 1=HALT, 2=AUTO_BUFFER_SHIFT, 4=NO_ADDR_CHK -NEWSYM dsp2input, dd 0 ; Saving input 8-bit data -NEWSYM dsp2inputTemp, dd 0 ; Temporary variable -NEWSYM dsp2f0dSizeOrg, dd 0 ; Command 0D, Original BMP width -NEWSYM dsp2f0dSizeNew, dd 0 ; Command 0D, New BMP width - -NEWSYM dsp2f01TblByte ; Conversion table for Command 01 -db 0, 1,16,17, 0, 1,16,17 -db 0, 1,16,17, 0, 1,16,17 -db 0, 1,16,17, 0, 1,16,17 -db 0, 1,16,17, 0, 1,16,17 -db 2, 3,18,19, 2, 3,18,19 -db 2, 3,18,19, 2, 3,18,19 -db 2, 3,18,19, 2, 3,18,19 -db 2, 3,18,19, 2, 3,18,19 -db 4, 5,20,21, 4, 5,20,21 -db 4, 5,20,21, 4, 5,20,21 -db 4, 5,20,21, 4, 5,20,21 -db 4, 5,20,21, 4, 5,20,21 -db 6, 7,22,23, 6, 7,22,23 -db 6, 7,22,23, 6, 7,22,23 -db 6, 7,22,23, 6, 7,22,23 -db 6, 7,22,23, 6, 7,22,23 -db 8, 9,24,25, 8, 9,24,25 -db 8, 9,24,25, 8, 9,24,25 -db 8, 9,24,25, 8, 9,24,25 -db 8, 9,24,25, 8, 9,24,25 -db 10,11,26,27,10,11,26,27 -db 10,11,26,27,10,11,26,27 -db 10,11,26,27,10,11,26,27 -db 10,11,26,27,10,11,26,27 -db 12,13,28,29,12,13,28,29 -db 12,13,28,29,12,13,28,29 -db 12,13,28,29,12,13,28,29 -db 12,13,28,29,12,13,28,29 -db 14,15,30,31,14,15,30,31 -db 14,15,30,31,14,15,30,31 -db 14,15,30,31,14,15,30,31 -db 14,15,30,31,14,15,30,31 - -NEWSYM dsp2f01TblBitMask ; Conversion table for Command 01 -db 64, 64, 64, 64,128,128,128,128 -db 16, 16, 16, 16, 32, 32, 32, 32 -db 4, 4, 4, 4, 8, 8, 8, 8 -db 1, 1, 1, 1, 2, 2, 2, 2 -db 64, 64, 64, 64,128,128,128,128 -db 16, 16, 16, 16, 32, 32, 32, 32 -db 4, 4, 4, 4, 8, 8, 8, 8 -db 1, 1, 1, 1, 2, 2, 2, 2 -db 64, 64, 64, 64,128,128,128,128 -db 16, 16, 16, 16, 32, 32, 32, 32 -db 4, 4, 4, 4, 8, 8, 8, 8 -db 1, 1, 1, 1, 2, 2, 2, 2 -db 64, 64, 64, 64,128,128,128,128 -db 16, 16, 16, 16, 32, 32, 32, 32 -db 4, 4, 4, 4, 8, 8, 8, 8 -db 1, 1, 1, 1, 2, 2, 2, 2 -db 64, 64, 64, 64,128,128,128,128 -db 16, 16, 16, 16, 32, 32, 32, 32 -db 4, 4, 4, 4, 8, 8, 8, 8 -db 1, 1, 1, 1, 2, 2, 2, 2 -db 64, 64, 64, 64,128,128,128,128 -db 16, 16, 16, 16, 32, 32, 32, 32 -db 4, 4, 4, 4, 8, 8, 8, 8 -db 1, 1, 1, 1, 2, 2, 2, 2 -db 64, 64, 64, 64,128,128,128,128 -db 16, 16, 16, 16, 32, 32, 32, 32 -db 4, 4, 4, 4, 8, 8, 8, 8 -db 1, 1, 1, 1, 2, 2, 2, 2 -db 64, 64, 64, 64,128,128,128,128 -db 16, 16, 16, 16, 32, 32, 32, 32 -db 4, 4, 4, 4, 8, 8, 8, 8 -db 1, 1, 1, 1, 2, 2, 2, 2 - -;******************************************************* -; .text section -;******************************************************* -SECTION .text - -;******************************************************* -; -;******************************************************* -%macro CommandJmp 2 - cmp al,%1 - je near %2 -%endmacro - -%macro DevWriteX 1 - %ifdef _USE_DEV - pushad - mov dword[_DSP2Dev_arg],%1 - call _DevWriteX - popad - %endif -%endmacro - -%macro EnterInsideCommand 1 - DevWriteX %1 -%endmacro - -%macro QueueInsideCommand 1 - DevWriteX %1+0ffff0000h -%endmacro - -%macro LeaveInsideCommand 0 - %ifdef _USE_DEV - pushad - call _Leave - popad - %endif -%endmacro - -;******************************************************* -; -;******************************************************* - -NEWSYM InitDSP2 -.enter - mov dword[dsp2state],0 - mov dword[dsp2enforcerQueue+8*0+0],0 - mov dword[dsp2enforcerQueue+8*0+4],8000h - mov dword[dsp2enforcerReaderCursor],0 - mov dword[dsp2enforcerWriterCursor],1 -.leave - ret - -;******************************************************* -; -;******************************************************* - -NEWSYM DSP2Read8b -.enter - test byte[dsp2state],DSP2F_HALT - jnz .halt - - test cx,8000h - jz .undef - test cx,7000h - jnz .undef - - and ecx,255 - mov al,[dsp2buffer+ecx] - xor ecx,ecx - - test byte[dsp2state],DSP2F_AUTO_BUFFER_SHIFT - jnz .shiftbuffer - jmp .leave - -.shiftbuffer - sar dword[dsp2buffer],8 - jmp .leave - -.halt -.undef - xor eax,eax -.leave - ret - -NEWSYM DSP2Read16b -.enter - xor eax,eax -.leave - ret - -;******************************************************* -; -;******************************************************* - -NEWSYM _DSP2Add2Queue -.enter - push eax - push ebx - ; *** Locates the write cursor - mov eax,[dsp2enforcerWriterCursor] - lea ebx,[dsp2enforcerQueue+eax*8] - inc eax - and eax,511 - mov [dsp2enforcerWriterCursor],eax - ; *** Copies the local inside command into his queue - mov eax,[dsp2enforcer] - mov [ebx],eax - mov eax,[dsp2enforcer+4] - mov [ebx+4],eax - pop ebx - pop eax -.leave - ret - -NEWSYM DSP2Write8b -.enter - ; Tests halt flag - test byte[dsp2state],DSP2F_HALT - jnz near .halt - - ; *** Locates current predicator store - mov [dsp2input],al - mov eax,[dsp2enforcerReaderCursor] - lea ebx,[dsp2enforcerQueue+8*eax] - ; *** Copies inside command box into box in order to spare indirection cost - mov eax,[ebx] - mov [dsp2enforcer],eax - mov eax,[ebx+4] - mov [dsp2enforcer+4],eax - xor ebx,ebx - ; *** About some commands need to be relaxed the write address check - test byte[dsp2state],DSP2F_NO_ADDR_CHK - jnz .noaddrchk - ; *** Tests whether cx points expected address - cmp [dsp2enforcer+4],cx - jne near .gohalt -.noaddrchk - ; *** Reads next inside command should be proceeded - mov al,[dsp2enforcer] - ; *** Branches to inside commands respectively - CommandJmp 00h,.w00 - CommandJmp 01h,.w01 - CommandJmp 02h,.w02 - CommandJmp 03h,.w03 - CommandJmp 04h,.w04 - CommandJmp 05h,.w05 - CommandJmp 06h,.w06 - CommandJmp 07h,.w07 - CommandJmp 08h,.w08 - CommandJmp 09h,.w09 - CommandJmp 0Ah,.w0A - CommandJmp 0Bh,.w0B - jmp .gohalt - -.w0B ; --- - EnterInsideCommand 0Bh - - mov al,[dsp2input] - xor ecx,ecx - mov cl,[dsp2enforcer+1] - mov [dsp2buffer+ecx],al - - jmp .done - -.w0A ; --- - EnterInsideCommand 0Ah - - mov al,[dsp2input] - sar al,1 - mov [dsp2f0dSizeNew],al - - test al,al - jz near .gohalt - - xor ecx,ecx - xor eax,eax - mov bl,[dsp2f0dSizeNew] - mov bh,[dsp2f0dSizeOrg] -.w0Aploop - mov al,cl - mul bl - div bh - - mov dword[dsp2enforcer+0],0Bh - mov dword[dsp2enforcer+4],8000h - mov [dsp2enforcer+1],al - mov [dsp2enforcer+4],cl - call _DSP2Add2Queue - - inc cl - cmp cl,[dsp2f0dSizeOrg] - jne .w0Aploop - - xor ebx,ebx - jmp .queueincoming - -.w09 ; --- - EnterInsideCommand 9 - - mov al,[dsp2input] - sar al,1 - mov [dsp2f0dSizeOrg],al - - test al,al - jz near .gohalt - - mov dword[dsp2enforcer+0],0Ah - mov dword[dsp2enforcer+4],8000h - call _DSP2Add2Queue - jmp .done - -.w08 ; --- - EnterInsideCommand 8 - - xor eax,eax - mov al,[dsp2enforcer+1] - mov cl,[dsp2input] - mov [dsp2buffer+eax],cl - - cmp al,3 - jne .w08done - - mov al,[dsp2buffer] - mul byte[dsp2buffer+2] - - mov [dsp2buffer],eax - or byte[dsp2state],DSP2F_AUTO_BUFFER_SHIFT - -.w08done - jmp .done - -.w07 ; --- - EnterInsideCommand 7 - - mov cl,[dsp2input] - rol cl,4 - xor eax,eax - mov al,[dsp2enforcer+1] - mov [dsp2buffer+eax],cl - - jmp .done - -.w06 ; --- - EnterInsideCommand 6 - - cmp byte[dsp2input],0 - je near .gohalt - - xor eax,eax - xor ecx,ecx - mov cl,[dsp2input] -.w06ploop - dec cl - mov dword[dsp2enforcer+0],7 - mov dword[dsp2enforcer+4],8000h - mov [dsp2enforcer+1],cl - mov [dsp2enforcer+4],al - call _DSP2Add2Queue - - inc al - test cl,cl - jnz .w06ploop - - jmp .queueincoming - -.w05 ; --- - EnterInsideCommand 5 - - xor eax,eax - mov al,[dsp2enforcer+4] - mov cl,[dsp2buffer+eax] - - mov ch,[dsp2input] - and ch,0f0h - cmp ch,[dsp2f03KeyHi] - je .w05pnohi - and cl,0fh - or cl,ch -.w05pnohi - - mov ch,[dsp2input] - and ch,0fh - cmp ch,[dsp2f03KeyLo] - je .w05pnolo - and cl,0f0h - or cl,ch -.w05pnolo - - mov [dsp2buffer+eax],cl - - jmp .done - -.w04 ; --- - EnterInsideCommand 4 - - xor eax,eax - mov al,[dsp2enforcer+4] - mov cl,[dsp2input] - mov [dsp2buffer+eax],cl - - xor ecx,ecx - jmp .done - -.w03 ; --- - EnterInsideCommand 3 - - cmp byte[dsp2input],0 - je near .gohalt - - xor eax,eax -.w03aloop - mov dword[dsp2enforcer+0],4 - mov dword[dsp2enforcer+4],8000h - mov [dsp2enforcer+4],al - call _DSP2Add2Queue - - inc al - cmp al,[dsp2input] - jne .w03aloop - - xor eax,eax -.w03bloop - mov dword[dsp2enforcer+0],5 - mov dword[dsp2enforcer+4],8000h - mov [dsp2enforcer+4],al - call _DSP2Add2Queue - - inc al - cmp al,[dsp2input] - jne .w03bloop - - xor ecx,ecx - jmp .queueincoming - -.w02 ; --- - EnterInsideCommand 2 - - mov al,[dsp2input] - and al,0fh - mov [dsp2f03KeyLo],al - sal al,4 - mov [dsp2f03KeyHi],al - jmp .done - -.w01 ; --- - EnterInsideCommand 1 - - xor ecx,ecx - mov cl,[dsp2enforcer+4] - sal ecx,3 - mov al,[dsp2input] - mov [dsp2inputTemp],al - xor ebx,ebx -.w01ploop - mov bl,[dsp2f01TblByte+ecx] - mov al,[dsp2f01TblBitMask+ecx] - test byte[dsp2inputTemp],1h - jz .w01pclear - or [dsp2buffer+ebx],al - jmp .w01pok -.w01pclear - not al - and [dsp2buffer+ebx],al -.w01pok - sar byte[dsp2inputTemp],1 - inc ecx - test cl,7 - jnz .w01ploop - - xor ebx,ebx - xor ecx,ecx - jmp .done - -.w00 ; --- - EnterInsideCommand 0 - - and byte[dsp2state],~(DSP2F_AUTO_BUFFER_SHIFT|DSP2F_NO_ADDR_CHK) - - mov al,[dsp2input] - CommandJmp 01h,.w00p01 - CommandJmp 03h,.w00p03 - CommandJmp 05h,.w00p05 - CommandJmp 06h,.w00p06 - CommandJmp 09h,.w00p09 - CommandJmp 0Dh,.w00p0D - CommandJmp 0Fh,.w00p0F - jmp .gohalt - -.w00p0D ; ---- - QueueInsideCommand 0Dh - mov dword[dsp2enforcer+0],9 - mov dword[dsp2enforcer+4],8000h - call _DSP2Add2Queue - jmp .done - -.w00p09 ; ---- - QueueInsideCommand 09h - xor eax,eax - mov al,4 -.w00p09loop - mov dword[dsp2enforcer+0],8 - mov dword[dsp2enforcer+4],8000h - mov [dsp2enforcer+1],ah - call _DSP2Add2Queue - - inc ah - dec al - jnz .w00p09loop - - jmp .queueincoming - -.w00p06 ; ---- - QueueInsideCommand 06h - mov dword[dsp2enforcer+0],6 - mov dword[dsp2enforcer+4],8000h - call _DSP2Add2Queue - jmp .done - -.w00p05 ; ---- - or byte[dsp2state],DSP2F_NO_ADDR_CHK - - QueueInsideCommand 05h - mov dword[dsp2enforcer+0],3 - mov dword[dsp2enforcer+4],8000h - call _DSP2Add2Queue - jmp .done - -.w00p03 ; ---- - QueueInsideCommand 03h - mov dword[dsp2enforcer+0],2 - mov dword[dsp2enforcer+4],8000h - call _DSP2Add2Queue - jmp .queueincoming - -.w00p01 ; ---- - QueueInsideCommand 01h - - xor eax,eax -.w00p01loop - mov dword[dsp2enforcer+0],1 - mov dword[dsp2enforcer+4],8000h - mov [dsp2enforcer+4],al - call _DSP2Add2Queue - - inc al - cmp al,32 - jne .w00p01loop - - xor ecx,ecx - jmp .queueincoming - -.w00p0F ; ---- - QueueInsideCommand 0Fh - -.queueincoming - mov dword[dsp2enforcer+0],0 - mov dword[dsp2enforcer+4],8000h - call _DSP2Add2Queue - jmp .done - -.done - LeaveInsideCommand - mov eax,[dsp2enforcerReaderCursor] - inc eax - and eax,511 - mov [dsp2enforcerReaderCursor],eax - - xor eax,eax - jmp .leave -.gohalt - QueueInsideCommand 0ffh - or byte[dsp2state],DSP2F_HALT -.halt - xor eax,eax -.leave - ret - -NEWSYM DSP2Write16b -.enter - xor eax,eax -.leave - ret diff --git a/tools/zsnes/src/chips/dsp3emu.c b/tools/zsnes/src/chips/dsp3emu.c deleted file mode 100644 index 0241f67..0000000 --- a/tools/zsnes/src/chips/dsp3emu.c +++ /dev/null @@ -1,1174 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -typedef unsigned char bool8; -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef char int8; -typedef short int16; -typedef long int32; - -//C++ in C -typedef unsigned char bool; -#define true 1 -#define false 0 - -uint16 DSP3_DataROM[1024] = { - 0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100, - 0x0080, 0x0040, 0x0020, 0x0010, 0x0008, 0x0004, 0x0002, 0x0001, - 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, - 0x0000, 0x000f, 0x0400, 0x0200, 0x0140, 0x0400, 0x0200, 0x0040, - 0x007d, 0x007e, 0x007e, 0x007b, 0x007c, 0x007d, 0x007b, 0x007c, - 0x0002, 0x0020, 0x0030, 0x0000, 0x000d, 0x0019, 0x0026, 0x0032, - 0x003e, 0x004a, 0x0056, 0x0062, 0x006d, 0x0079, 0x0084, 0x008e, - 0x0098, 0x00a2, 0x00ac, 0x00b5, 0x00be, 0x00c6, 0x00ce, 0x00d5, - 0x00dc, 0x00e2, 0x00e7, 0x00ec, 0x00f1, 0x00f5, 0x00f8, 0x00fb, - 0x00fd, 0x00ff, 0x0100, 0x0100, 0x0100, 0x00ff, 0x00fd, 0x00fb, - 0x00f8, 0x00f5, 0x00f1, 0x00ed, 0x00e7, 0x00e2, 0x00dc, 0x00d5, - 0x00ce, 0x00c6, 0x00be, 0x00b5, 0x00ac, 0x00a2, 0x0099, 0x008e, - 0x0084, 0x0079, 0x006e, 0x0062, 0x0056, 0x004a, 0x003e, 0x0032, - 0x0026, 0x0019, 0x000d, 0x0000, 0xfff3, 0xffe7, 0xffdb, 0xffce, - 0xffc2, 0xffb6, 0xffaa, 0xff9e, 0xff93, 0xff87, 0xff7d, 0xff72, - 0xff68, 0xff5e, 0xff54, 0xff4b, 0xff42, 0xff3a, 0xff32, 0xff2b, - 0xff25, 0xff1e, 0xff19, 0xff14, 0xff0f, 0xff0b, 0xff08, 0xff05, - 0xff03, 0xff01, 0xff00, 0xff00, 0xff00, 0xff01, 0xff03, 0xff05, - 0xff08, 0xff0b, 0xff0f, 0xff13, 0xff18, 0xff1e, 0xff24, 0xff2b, - 0xff32, 0xff3a, 0xff42, 0xff4b, 0xff54, 0xff5d, 0xff67, 0xff72, - 0xff7c, 0xff87, 0xff92, 0xff9e, 0xffa9, 0xffb5, 0xffc2, 0xffce, - 0xffda, 0xffe7, 0xfff3, 0x002b, 0x007f, 0x0020, 0x00ff, 0xff00, - 0xffbe, 0x0000, 0x0044, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffc1, 0x0001, 0x0002, 0x0045, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffc5, 0x0003, 0x0004, 0x0005, 0x0047, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffca, 0x0006, 0x0007, 0x0008, - 0x0009, 0x004a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffd0, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x004e, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffd7, 0x000f, 0x0010, 0x0011, - 0x0012, 0x0013, 0x0014, 0x0053, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffdf, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, - 0x0059, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffe8, 0x001c, 0x001d, 0x001e, - 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 0x0060, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xfff2, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, - 0x002b, 0x002c, 0x0068, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xfffd, 0x002d, 0x002e, 0x002f, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0071, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffc7, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, - 0x003e, 0x003f, 0x0040, 0x0041, 0x007b, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffd4, 0x0000, 0x0001, 0x0002, - 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, - 0x000b, 0x0044, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffe2, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, - 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0050, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xfff1, 0x0019, 0x001a, 0x001b, - 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, - 0x0024, 0x0025, 0x0026, 0x005d, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffcb, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, - 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, - 0x006b, 0x0000, 0x0000, 0x0000, 0xffdc, 0x0000, 0x0001, 0x0002, - 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, - 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0044, 0x0000, 0x0000, - 0xffee, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, - 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, - 0x001f, 0x0020, 0x0054, 0x0000, 0xffee, 0x0021, 0x0022, 0x0023, - 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, - 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0065, - 0xffbe, 0x0000, 0xfeac, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffc1, 0x0001, 0x0002, 0xfead, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffc5, 0x0003, 0x0004, 0x0005, 0xfeaf, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffca, 0x0006, 0x0007, 0x0008, - 0x0009, 0xfeb2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffd0, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0xfeb6, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffd7, 0x000f, 0x0010, 0x0011, - 0x0012, 0x0013, 0x0014, 0xfebb, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffdf, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, - 0xfec1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffe8, 0x001c, 0x001d, 0x001e, - 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 0xfec8, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xfff2, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, - 0x002b, 0x002c, 0xfed0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xfffd, 0x002d, 0x002e, 0x002f, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0xfed9, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffc7, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, - 0x003e, 0x003f, 0x0040, 0x0041, 0xfee3, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffd4, 0x0000, 0x0001, 0x0002, - 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, - 0x000b, 0xfeac, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffe2, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, - 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0xfeb8, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xfff1, 0x0019, 0x001a, 0x001b, - 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, - 0x0024, 0x0025, 0x0026, 0xfec5, 0x0000, 0x0000, 0x0000, 0x0000, - 0xffcb, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, - 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, - 0xfed3, 0x0000, 0x0000, 0x0000, 0xffdc, 0x0000, 0x0001, 0x0002, - 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, - 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0xfeac, 0x0000, 0x0000, - 0xffee, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, - 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, - 0x001f, 0x0020, 0xfebc, 0x0000, 0xffee, 0x0021, 0x0022, 0x0023, - 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, - 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0xfecd, - 0x0154, 0x0218, 0x0110, 0x00b0, 0x00cc, 0x00b0, 0x0088, 0x00b0, - 0x0044, 0x00b0, 0x0000, 0x00b0, 0x00fe, 0xff07, 0x0002, 0x00ff, - 0x00f8, 0x0007, 0x00fe, 0x00ee, 0x07ff, 0x0200, 0x00ef, 0xf800, - 0x0700, 0x00ee, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, - 0xffff, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, - 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0x0001, 0x0000, 0x0001, - 0x0001, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, - 0xffff, 0x0001, 0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0xffff, - 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0044, 0x0088, 0x00cc, - 0x0110, 0x0154, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff -}; - -void (*SetDSP3)(); -void DSP3_Command(); - -uint16 DSP3_DR; -uint16 DSP3_SR; -uint16 DSP3_MemoryIndex; - -void DSP3_Reset() -{ - DSP3_DR = 0x0080; - DSP3_SR = 0x0084; - SetDSP3 = &DSP3_Command; -} - -void DSP3_MemorySize() -{ - DSP3_DR = 0x0300; - SetDSP3 = &DSP3_Reset; -} - -void DSP3_TestMemory() -{ - DSP3_DR = 0x0000; - SetDSP3 = &DSP3_Reset; -} - -void DSP3_DumpDataROM() -{ - DSP3_DR = DSP3_DataROM[DSP3_MemoryIndex++]; - if (DSP3_MemoryIndex == 1024) - SetDSP3 = &DSP3_Reset; -} - -void DSP3_MemoryDump() -{ - DSP3_MemoryIndex = 0; - SetDSP3 = &DSP3_DumpDataROM; - DSP3_DumpDataROM(); -} - -int16 DSP3_WinLo; -int16 DSP3_WinHi; - -void DSP3_OP06() -{ - DSP3_WinLo = (uint8)(DSP3_DR); - DSP3_WinHi = (uint8)(DSP3_DR >> 8); - DSP3_Reset(); -} - -void DSP3_OP03() -{ - int16 Lo = (uint8)(DSP3_DR); - int16 Hi = (uint8)(DSP3_DR >> 8); - int16 Ofs = (DSP3_WinLo * Hi << 1) + (Lo << 1); - DSP3_DR = Ofs >> 1; - SetDSP3 = &DSP3_Reset; -} - -int16 DSP3_AddLo; -int16 DSP3_AddHi; - -void DSP3_OP07_B() -{ - int16 Ofs = (DSP3_WinLo * DSP3_AddHi << 1) + (DSP3_AddLo << 1); - DSP3_DR = Ofs >> 1; - SetDSP3 = &DSP3_Reset; -} - -void DSP3_OP07_A() -{ - int16 Lo = (uint8)(DSP3_DR); - int16 Hi = (uint8)(DSP3_DR >> 8); - - if (Lo & 1) Hi += (DSP3_AddLo & 1); - - DSP3_AddLo += Lo; - DSP3_AddHi += Hi; - - if (DSP3_AddLo < 0) - DSP3_AddLo += DSP3_WinLo; - else - if (DSP3_AddLo >= DSP3_WinLo) - DSP3_AddLo -= DSP3_WinLo; - - if (DSP3_AddHi < 0) - DSP3_AddHi += DSP3_WinHi; - else - if (DSP3_AddHi >= DSP3_WinHi) - DSP3_AddHi -= DSP3_WinHi; - - DSP3_DR = DSP3_AddLo | (DSP3_AddHi << 8) | ((DSP3_AddHi >> 8) & 0xff); - SetDSP3 = &DSP3_OP07_B; -} - -void DSP3_OP07() -{ - uint32 dataOfs = ((DSP3_DR << 1) + 0x03b2) & 0x03ff; - - DSP3_AddHi = DSP3_DataROM[dataOfs]; - DSP3_AddLo = DSP3_DataROM[dataOfs + 1]; - - SetDSP3 = &DSP3_OP07_A; - DSP3_SR = 0x0080; -} - -uint16 DSP3_Codewords; -uint16 DSP3_Outwords; -uint16 DSP3_Symbol; -uint16 DSP3_BitCount; -uint16 DSP3_Index; -uint16 DSP3_Codes[512]; -uint16 DSP3_BitsLeft; -uint16 DSP3_ReqBits; -uint16 DSP3_ReqData; -uint16 DSP3_BitCommand; -uint8 DSP3_BaseLength; -uint16 DSP3_BaseCodes; -uint16 DSP3_BaseCode; -uint8 DSP3_CodeLengths[8]; -uint16 DSP3_CodeOffsets[8]; -uint16 DSP3_LZCode; -uint8 DSP3_LZLength; - -uint16 DSP3_X; -uint16 DSP3_Y; - -void DSP3_Coordinate() -{ - DSP3_Index++; - - switch (DSP3_Index) - { - case 3: - { - if (DSP3_DR == 0xffff) - DSP3_Reset(); - break; - } - case 4: - { - DSP3_X = DSP3_DR; - break; - } - case 5: - { - DSP3_Y = DSP3_DR; - DSP3_DR = 1; - break; - } - case 6: - { - DSP3_DR = DSP3_X; - break; - } - case 7: - { - DSP3_DR = DSP3_Y; - DSP3_Index = 0; - break; - } - } -} - -uint8 DSP3_Bitmap[8]; -uint8 DSP3_Bitplane[8]; -uint16 DSP3_BMIndex; -uint16 DSP3_BPIndex; -uint16 DSP3_Count; - -void DSP3_Convert_A() -{ - if (DSP3_BMIndex < 8) - { - DSP3_Bitmap[DSP3_BMIndex++] = (uint8) (DSP3_DR); - DSP3_Bitmap[DSP3_BMIndex++] = (uint8) (DSP3_DR >> 8); - - if (DSP3_BMIndex == 8) - { - short i, j; - for (i=0; i < 8; i++) - for (j=0; j < 8; j++) - { - DSP3_Bitplane[j] <<= 1; - DSP3_Bitplane[j] |= (DSP3_Bitmap[i] >> j) & 1; - } - - DSP3_BPIndex = 0; - DSP3_Count--; - } - } - - if (DSP3_BMIndex == 8) - { - if (DSP3_BPIndex == 8) - { - if (!DSP3_Count) DSP3_Reset(); - DSP3_BMIndex = 0; - } - else - { - DSP3_DR = DSP3_Bitplane[DSP3_BPIndex++]; - DSP3_DR |= DSP3_Bitplane[DSP3_BPIndex++] << 8; - } - } -} - -void DSP3_Convert() -{ - DSP3_Count = DSP3_DR; - DSP3_BMIndex = 0; - SetDSP3 = &DSP3_Convert_A; -} - -bool DSP3_GetBits(uint8 Count) -{ - if (!DSP3_BitsLeft) - { - DSP3_BitsLeft = Count; - DSP3_ReqBits = 0; - } - - do { - if (!DSP3_BitCount) - { - DSP3_SR = 0xC0; - return false; - } - - DSP3_ReqBits <<= 1; - if (DSP3_ReqData & 0x8000) DSP3_ReqBits++; - DSP3_ReqData <<= 1; - - DSP3_BitCount--; - DSP3_BitsLeft--; - - } while (DSP3_BitsLeft); - - return true; -} - -void DSP3_Decode_Data() -{ - if (!DSP3_BitCount) - { - if (DSP3_SR & 0x40) - { - DSP3_ReqData = DSP3_DR; - DSP3_BitCount += 16; - } - else - { - DSP3_SR = 0xC0; - return; - } - } - - if (DSP3_LZCode == 1) - { - if (!DSP3_GetBits(1)) - return; - - if (DSP3_ReqBits) - DSP3_LZLength = 12; - else - DSP3_LZLength = 8; - - DSP3_LZCode++; - } - - if (DSP3_LZCode == 2) - { - if (!DSP3_GetBits(DSP3_LZLength)) - return; - - DSP3_LZCode = 0; - DSP3_Outwords--; - if (!DSP3_Outwords) SetDSP3 = &DSP3_Reset; - - DSP3_SR = 0x80; - DSP3_DR = DSP3_ReqBits; - return; - } - - if (DSP3_BaseCode == 0xffff) - { - if (!DSP3_GetBits(DSP3_BaseLength)) - return; - - DSP3_BaseCode = DSP3_ReqBits; - } - - if (!DSP3_GetBits(DSP3_CodeLengths[DSP3_BaseCode])) - return; - - DSP3_Symbol = DSP3_Codes[DSP3_CodeOffsets[DSP3_BaseCode] + DSP3_ReqBits]; - DSP3_BaseCode = 0xffff; - - if (DSP3_Symbol & 0xff00) - { - DSP3_Symbol += 0x7f02; - DSP3_LZCode++; - } - else - { - DSP3_Outwords--; - if (!DSP3_Outwords) - SetDSP3 = &DSP3_Reset; - } - - DSP3_SR = 0x80; - DSP3_DR = DSP3_Symbol; -} - -void DSP3_Decode_Tree() -{ - if (!DSP3_BitCount) - { - DSP3_ReqData = DSP3_DR; - DSP3_BitCount += 16; - } - - if (!DSP3_BaseCodes) - { - DSP3_GetBits(1); - if (DSP3_ReqBits) - { - DSP3_BaseLength = 3; - DSP3_BaseCodes = 8; - } - else - { - DSP3_BaseLength = 2; - DSP3_BaseCodes = 4; - } - } - - while (DSP3_BaseCodes) - { - if (!DSP3_GetBits(3)) - return; - - DSP3_ReqBits++; - - DSP3_CodeLengths[DSP3_Index] = (uint8) DSP3_ReqBits; - DSP3_CodeOffsets[DSP3_Index] = DSP3_Symbol; - DSP3_Index++; - - DSP3_Symbol += 1 << DSP3_ReqBits; - DSP3_BaseCodes--; - } - - DSP3_BaseCode = 0xffff; - DSP3_LZCode = 0; - - SetDSP3 = &DSP3_Decode_Data; - if (DSP3_BitCount) DSP3_Decode_Data(); -} - -void DSP3_Decode_Symbols() -{ - DSP3_ReqData = DSP3_DR; - DSP3_BitCount += 16; - - do { - - if (DSP3_BitCommand == 0xffff) - { - if (!DSP3_GetBits(2)) return; - DSP3_BitCommand = DSP3_ReqBits; - } - - switch (DSP3_BitCommand) - { - case 0: - { - if (!DSP3_GetBits(9)) return; - DSP3_Symbol = DSP3_ReqBits; - break; - } - case 1: - { - DSP3_Symbol++; - break; - } - case 2: - { - if (!DSP3_GetBits(1)) return; - DSP3_Symbol += 2 + DSP3_ReqBits; - break; - } - case 3: - { - if (!DSP3_GetBits(4)) return; - DSP3_Symbol += 4 + DSP3_ReqBits; - break; - } - } - - DSP3_BitCommand = 0xffff; - - DSP3_Codes[DSP3_Index++] = DSP3_Symbol; - DSP3_Codewords--; - - } while (DSP3_Codewords); - - DSP3_Index = 0; - DSP3_Symbol = 0; - DSP3_BaseCodes = 0; - - SetDSP3 = &DSP3_Decode_Tree; - if (DSP3_BitCount) DSP3_Decode_Tree(); -} - -void DSP3_Decode_A() -{ - DSP3_Outwords = DSP3_DR; - SetDSP3 = &DSP3_Decode_Symbols; - DSP3_BitCount = 0; - DSP3_BitsLeft = 0; - DSP3_Symbol = 0; - DSP3_Index = 0; - DSP3_BitCommand = 0xffff; - DSP3_SR = 0xC0; -} - -void DSP3_Decode() -{ - DSP3_Codewords = DSP3_DR; - SetDSP3 = &DSP3_Decode_A; -} - - -// Opcodes 1E/3E bit-perfect to 'dsp3-intro' log -// src: adapted from SD Gundam X/G-Next - -int16 op3e_x; -int16 op3e_y; - -int16 op1e_terrain[0x2000]; -int16 op1e_cost[0x2000]; -int16 op1e_weight[0x2000]; - -int16 op1e_cell; -int16 op1e_turn; -int16 op1e_search; - -int16 op1e_x; -int16 op1e_y; - -int16 op1e_min_radius; -int16 op1e_max_radius; - -int16 op1e_max_search_radius; -int16 op1e_max_path_radius; - -int16 op1e_lcv_radius; -int16 op1e_lcv_steps; -int16 op1e_lcv_turns; - -void DSP3_OP3E() -{ - op3e_x = (uint8)(DSP3_DR & 0x00ff); - op3e_y = (uint8)((DSP3_DR & 0xff00)>>8); - - DSP3_OP03(); - - op1e_terrain[ DSP3_DR ] = 0x00; - op1e_cost[ DSP3_DR ] = 0xff; - op1e_weight[ DSP3_DR ] = 0; - - op1e_max_search_radius = 0; - op1e_max_path_radius = 0; -} - -void DSP3_OP1E_A(); -void DSP3_OP1E_A1(); -void DSP3_OP1E_A2(); -void DSP3_OP1E_A3(); - -void DSP3_OP1E_B(); -void DSP3_OP1E_B1(); -void DSP3_OP1E_B2(); - -void DSP3_OP1E_C(); -void DSP3_OP1E_C1(); -void DSP3_OP1E_C2(); - -void DSP3_OP1E_D( int16, int16 *, int16 * ); -void DSP3_OP1E_D1( int16 move, int16 *lo, int16 *hi ); - -void DSP3_OP1E() -{ - int lcv; - - op1e_min_radius = (uint8)(DSP3_DR & 0x00ff); - op1e_max_radius = (uint8)((DSP3_DR & 0xff00)>>8); - - if( op1e_min_radius == 0 ) - op1e_min_radius++; - - if( op1e_max_search_radius >= op1e_min_radius ) - op1e_min_radius = op1e_max_search_radius+1; - - if( op1e_max_radius > op1e_max_search_radius ) - op1e_max_search_radius = op1e_max_radius; - - op1e_lcv_radius = op1e_min_radius; - op1e_lcv_steps = op1e_min_radius; - - op1e_lcv_turns = 6; - op1e_turn = 0; - - op1e_x = op3e_x; - op1e_y = op3e_y; - - for( lcv = 0; lcv < op1e_min_radius; lcv++ ) - DSP3_OP1E_D( op1e_turn, &op1e_x, &op1e_y ); - - DSP3_OP1E_A(); -} - -void DSP3_OP1E_A() -{ - int lcv; - - if( op1e_lcv_steps == 0 ) { - op1e_lcv_radius++; - - op1e_lcv_steps = op1e_lcv_radius; - - op1e_x = op3e_x; - op1e_y = op3e_y; - - for( lcv = 0; lcv < op1e_lcv_radius; lcv++ ) - DSP3_OP1E_D( op1e_turn, &op1e_x, &op1e_y ); - } - - if( op1e_lcv_radius > op1e_max_radius ) { - op1e_turn++; - op1e_lcv_turns--; - - op1e_lcv_radius = op1e_min_radius; - op1e_lcv_steps = op1e_min_radius; - - op1e_x = op3e_x; - op1e_y = op3e_y; - - for( lcv = 0; lcv < op1e_min_radius; lcv++ ) - DSP3_OP1E_D( op1e_turn, &op1e_x, &op1e_y ); - } - - if( op1e_lcv_turns == 0 ) { - DSP3_DR = 0xffff; - DSP3_SR = 0x0080; - SetDSP3 = &DSP3_OP1E_B; - return; - } - - DSP3_DR = (uint8)(op1e_x) | ((uint8)(op1e_y)<<8); - DSP3_OP03(); - - op1e_cell = DSP3_DR; - - DSP3_SR = 0x0080; - SetDSP3 = &DSP3_OP1E_A1; -} - -void DSP3_OP1E_A1() -{ - DSP3_SR = 0x0084; - SetDSP3 = &DSP3_OP1E_A2; -} - -void DSP3_OP1E_A2() -{ - op1e_terrain[ op1e_cell ] = (uint8)(DSP3_DR & 0x00ff); - - DSP3_SR = 0x0084; - SetDSP3 = &DSP3_OP1E_A3; -} - -void DSP3_OP1E_A3() -{ - op1e_cost[ op1e_cell ] = (uint8)(DSP3_DR & 0x00ff); - - if( op1e_lcv_radius == 1 ) { - if( op1e_terrain[ op1e_cell ] & 1 ) { - op1e_weight[ op1e_cell ] = 0xff; - } else { - op1e_weight[ op1e_cell ] = op1e_cost[ op1e_cell ]; - } - } - else { - op1e_weight[ op1e_cell ] = 0xff; - } - - DSP3_OP1E_D( (int16)(op1e_turn+2), &op1e_x, &op1e_y ); - op1e_lcv_steps--; - - DSP3_SR = 0x0080; - DSP3_OP1E_A(); -} - - -void DSP3_OP1E_B() -{ - op1e_x = op3e_x; - op1e_y = op3e_y; - op1e_lcv_radius = 1; - - op1e_search = 0; - - DSP3_OP1E_B1(); - - SetDSP3 = &DSP3_OP1E_C; -} - - -void DSP3_OP1E_B1() -{ - while( op1e_lcv_radius < op1e_max_radius ) { - op1e_y--; - - op1e_lcv_turns = 6; - op1e_turn = 5; - - while( op1e_lcv_turns ) { - op1e_lcv_steps = op1e_lcv_radius; - - while( op1e_lcv_steps ) { - DSP3_OP1E_D1( op1e_turn, &op1e_x, &op1e_y ); - - if( 0 <= op1e_y && op1e_y < DSP3_WinHi && - 0 <= op1e_x && op1e_x < DSP3_WinLo ) { - DSP3_DR = (uint8)(op1e_x) | ((uint8)(op1e_y)<<8); - DSP3_OP03(); - - op1e_cell = DSP3_DR; - if( op1e_cost[ op1e_cell ] < 0x80 && - op1e_terrain[ op1e_cell ] < 0x40 ) { - DSP3_OP1E_B2(); - } // end cell perimeter - } - - op1e_lcv_steps--; - } // end search line - - op1e_turn--; - if( op1e_turn == 0 ) op1e_turn = 6; - - op1e_lcv_turns--; - } // end circle search - - op1e_lcv_radius++; - } // end radius search -} - - -void DSP3_OP1E_B2() -{ - int16 cell; - int16 path; - int16 x,y; - int16 lcv_turns; - - path = 0xff; - lcv_turns = 6; - - while( lcv_turns ) { - x = op1e_x; - y = op1e_y; - - DSP3_OP1E_D1( lcv_turns, &x, &y ); - - DSP3_DR = (uint8)(x) | ((uint8)(y)<<8); - DSP3_OP03(); - - cell = DSP3_DR; - - if( 0 <= y && y < DSP3_WinHi && - 0 <= x && x < DSP3_WinLo ) { - - if( op1e_terrain[ cell ] < 0x80 || op1e_weight[ cell ] == 0 ) { - if( op1e_weight[ cell ] < path ) { - path = op1e_weight[ cell ]; - } - } - } // end step travel - - lcv_turns--; - } // end while turns - - if( path != 0xff ) { - op1e_weight[ op1e_cell ] = path + op1e_cost[ op1e_cell ]; - } -} - - -void DSP3_OP1E_C() -{ - int lcv; - - op1e_min_radius = (uint8)(DSP3_DR & 0x00ff); - op1e_max_radius = (uint8)((DSP3_DR & 0xff00)>>8); - - if( op1e_min_radius == 0 ) - op1e_min_radius++; - - if( op1e_max_path_radius >= op1e_min_radius ) - op1e_min_radius = op1e_max_path_radius+1; - - if( op1e_max_radius > op1e_max_path_radius ) - op1e_max_path_radius = op1e_max_radius; - - op1e_lcv_radius = op1e_min_radius; - op1e_lcv_steps = op1e_min_radius; - - op1e_lcv_turns = 6; - op1e_turn = 0; - - op1e_x = op3e_x; - op1e_y = op3e_y; - - for( lcv = 0; lcv < op1e_min_radius; lcv++ ) - DSP3_OP1E_D( op1e_turn, &op1e_x, &op1e_y ); - - DSP3_OP1E_C1(); -} - - -void DSP3_OP1E_C1() -{ - int lcv; - - if( op1e_lcv_steps == 0 ) { - op1e_lcv_radius++; - - op1e_lcv_steps = op1e_lcv_radius; - - op1e_x = op3e_x; - op1e_y = op3e_y; - - for( lcv = 0; lcv < op1e_lcv_radius; lcv++ ) - DSP3_OP1E_D( op1e_turn, &op1e_x, &op1e_y ); - } - - if( op1e_lcv_radius > op1e_max_radius ) { - op1e_turn++; - op1e_lcv_turns--; - - op1e_lcv_radius = op1e_min_radius; - op1e_lcv_steps = op1e_min_radius; - - op1e_x = op3e_x; - op1e_y = op3e_y; - - for( lcv = 0; lcv < op1e_min_radius; lcv++ ) - DSP3_OP1E_D( op1e_turn, &op1e_x, &op1e_y ); - } - - if( op1e_lcv_turns == 0 ) { - DSP3_DR = 0xffff; - DSP3_SR = 0x0080; - SetDSP3 = &DSP3_Reset; - return; - } - - DSP3_DR = (uint8)(op1e_x) | ((uint8)(op1e_y)<<8); - DSP3_OP03(); - - op1e_cell = DSP3_DR; - - DSP3_SR = 0x0080; - SetDSP3 = &DSP3_OP1E_C2; -} - - -void DSP3_OP1E_C2() -{ - DSP3_DR = op1e_weight[ op1e_cell ]; - - DSP3_OP1E_D( (int16)(op1e_turn+2), &op1e_x, &op1e_y ); - op1e_lcv_steps--; - - DSP3_SR = 0x0084; - SetDSP3 = &DSP3_OP1E_C1; -} - - -void DSP3_OP1E_D( int16 move, int16 *lo, int16 *hi ) -{ - uint32 dataOfs = ((move << 1) + 0x03b2) & 0x03ff; - int16 Lo; - int16 Hi; - - DSP3_AddHi = DSP3_DataROM[dataOfs]; - DSP3_AddLo = DSP3_DataROM[dataOfs + 1]; - - Lo = (uint8)(*lo); - Hi = (uint8)(*hi); - - if (Lo & 1) Hi += (DSP3_AddLo & 1); - - DSP3_AddLo += Lo; - DSP3_AddHi += Hi; - - if (DSP3_AddLo < 0) - DSP3_AddLo += DSP3_WinLo; - else - if (DSP3_AddLo >= DSP3_WinLo) - DSP3_AddLo -= DSP3_WinLo; - - if (DSP3_AddHi < 0) - DSP3_AddHi += DSP3_WinHi; - else - if (DSP3_AddHi >= DSP3_WinHi) - DSP3_AddHi -= DSP3_WinHi; - - *lo = DSP3_AddLo; - *hi = DSP3_AddHi; -} - - -void DSP3_OP1E_D1( int16 move, int16 *lo, int16 *hi ) -{ - //uint32 dataOfs = ((move << 1) + 0x03b2) & 0x03ff; - int16 Lo; - int16 Hi; - - const unsigned short HiAdd[] = { - 0x00, 0xFF, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x00, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0xFF, 0x00 - }; - const unsigned short LoAdd[] = { - 0x00, 0x00, 0x01, 0x01, 0x00, 0xFF, 0xFF, 0x00 - }; - - if( (*lo) & 1 ) - DSP3_AddHi = HiAdd[ move + 8 ]; - else - DSP3_AddHi = HiAdd[ move + 0 ]; - DSP3_AddLo = LoAdd[ move ]; - - Lo = (uint8)(*lo); - Hi = (uint8)(*hi); - - if (Lo & 1) Hi += (DSP3_AddLo & 1); - - DSP3_AddLo += Lo; - DSP3_AddHi += Hi; - - *lo = DSP3_AddLo; - *hi = DSP3_AddHi; -} - - -void DSP3_OP10() -{ - if( DSP3_DR == 0xffff ) { - DSP3_Reset(); - } else { - // absorb 2 bytes - DSP3_DR = DSP3_DR; - } -} - - -void DSP3_OP0C_A() -{ - // absorb 2 bytes - - DSP3_DR = 0; - SetDSP3 = &DSP3_Reset; -} - - -void DSP3_OP0C() -{ - // absorb 2 bytes - - DSP3_DR = 0; - //SetDSP3 = &DSP3_OP0C_A; - SetDSP3 = &DSP3_Reset; -} - - -void DSP3_OP1C_C() -{ - // return 2 bytes - DSP3_DR = 0; - SetDSP3 = &DSP3_Reset; -} - - -void DSP3_OP1C_B() -{ - // absorb 2 bytes - - // return 2 bytes - DSP3_DR = 0; - SetDSP3 = &DSP3_OP1C_C; -} - - -void DSP3_OP1C_A() -{ - // absorb 2 bytes - - SetDSP3 = &DSP3_OP1C_B; -} - - -void DSP3_OP1C() -{ - // absorb 2 bytes - - SetDSP3 = &DSP3_OP1C_A; -} - - -void DSP3_Command() -{ - if (DSP3_DR < 0x40) - { - switch (DSP3_DR) - { - case 0x02: SetDSP3 = &DSP3_Coordinate; break; - case 0x03: SetDSP3 = &DSP3_OP03; break; - case 0x06: SetDSP3 = &DSP3_OP06; break; - case 0x07: SetDSP3 = &DSP3_OP07; return; - case 0x0c: SetDSP3 = &DSP3_OP0C; break; - case 0x0f: SetDSP3 = &DSP3_TestMemory; break; - case 0x10: SetDSP3 = &DSP3_OP10; break; - case 0x18: SetDSP3 = &DSP3_Convert; break; - case 0x1c: SetDSP3 = &DSP3_OP1C; break; - case 0x1e: SetDSP3 = &DSP3_OP1E; break; - case 0x1f: SetDSP3 = &DSP3_MemoryDump; break; - case 0x38: SetDSP3 = &DSP3_Decode; break; - case 0x3e: SetDSP3 = &DSP3_OP3E; break; - default: - return; - } - DSP3_SR = 0x0080; - DSP3_Index = 0; - } -} - -uint8 dsp3_byte; -uint16 dsp3_address; - -void DSP3SetByte() -{ - if (dsp3_address < 0xC000) - { - if (DSP3_SR & 0x04) - { - DSP3_DR = (DSP3_DR & 0xff00) + dsp3_byte; - (*SetDSP3)(); - } - else - { - DSP3_SR ^= 0x10; - - if (DSP3_SR & 0x10) - DSP3_DR = (DSP3_DR & 0xff00) + dsp3_byte; - else - { - DSP3_DR = (DSP3_DR & 0x00ff) + (dsp3_byte << 8); - (*SetDSP3)(); - } - } - } -} - -void DSP3GetByte() -{ - if (dsp3_address < 0xC000) - { - if (DSP3_SR & 0x04) - { - dsp3_byte = (uint8) DSP3_DR; - (*SetDSP3)(); - } - else - { - DSP3_SR ^= 0x10; - - if (DSP3_SR & 0x10) - dsp3_byte = (uint8) (DSP3_DR); - else - { - dsp3_byte = (uint8) (DSP3_DR >> 8); - (*SetDSP3)(); - } - } - - } - else - { - dsp3_byte = (uint8) DSP3_SR; - } -} - -void InitDSP3() -{ - DSP3_Reset(); -} - diff --git a/tools/zsnes/src/chips/dsp3proc.asm b/tools/zsnes/src/chips/dsp3proc.asm deleted file mode 100644 index ddacc44..0000000 --- a/tools/zsnes/src/chips/dsp3proc.asm +++ /dev/null @@ -1,79 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 dsp3_address,dsp3_byte,DSP3GetByte,DSP3SetByte -EXTSYM regaccessbankr16,regaccessbankr8,regaccessbankw16,regaccessbankw8 - -SECTION .text - -%macro RouteAccess 1 - test ecx,8000h - jz %1 -%endmacro - -NEWSYM DSP3Read8b - RouteAccess regaccessbankr8 - mov [dsp3_address],cx - pushad - call DSP3GetByte - popad - mov al,[dsp3_byte] - ret - -NEWSYM DSP3Write8b - RouteAccess regaccessbankw8 - mov [dsp3_address],cx - mov [dsp3_byte],al - pushad - call DSP3SetByte - popad - ret - -NEWSYM DSP3Read16b - RouteAccess regaccessbankr16 - mov [dsp3_address],cx - pushad - call DSP3GetByte - mov al,[dsp3_byte] - mov [dsp3temp],al - inc word[dsp3_address] - call DSP3GetByte - popad - mov al,[dsp3temp] - mov ah,[dsp3_byte] - ret - -NEWSYM DSP3Write16b - RouteAccess regaccessbankw16 - mov [dsp3_address],cx - mov [dsp3_byte],al - mov [dsp3temp],ah - pushad - call DSP3SetByte - mov ah,[dsp3temp] - mov [dsp3_byte],ah - inc word[dsp3_address] - call DSP3SetByte - popad - ret - -SECTION .bss -NEWSYM dsp3temp, resb 1 diff --git a/tools/zsnes/src/chips/dsp4emu.c b/tools/zsnes/src/chips/dsp4emu.c deleted file mode 100644 index 53f08c0..0000000 --- a/tools/zsnes/src/chips/dsp4emu.c +++ /dev/null @@ -1,2172 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 -#include "dsp4emu.h" - - -/* -Due recognition and credit are given on Overload's DSP website. -Thank those contributors for their hard work on this chip. - - -Fixed-point math reminder: - -[sign, integer, fraction] -1.15.00 * 1.15.00 = 2.30.00 -> 1.30.00 (DSP) -> 1.31.00 (LSB is '0') -1.15.00 * 1.00.15 = 2.15.15 -> 1.15.15 (DSP) -> 1.15.16 (LSB is '0') -*/ - - -#define READ_WORD(s) (*(uint16 *) (s)) -#define READ_DWORD(s) (*(uint32 *) (s)) -#define WRITE_WORD(s, d) (*(uint16 *) (s)) = (d) -#define WRITE_DWORD(s, d) (*(uint32 *) (s)) = (d) - -struct DSP4_t DSP4; -struct DSP4_vars_t DSP4_vars; - -////////////////////////////////////////////////////////////// - -// input protocol - -static int16 DSP4_READ_WORD() -{ - int16 out; - - out = READ_WORD(DSP4.parameters + DSP4.in_index); - DSP4.in_index += 2; - - return out; -} - -static int32 DSP4_READ_DWORD() -{ - int32 out; - - out = READ_DWORD(DSP4.parameters + DSP4.in_index); - DSP4.in_index += 4; - - return out; -} - - -////////////////////////////////////////////////////////////// - -// output protocol - -#define DSP4_CLEAR_OUT() \ -{ DSP4.out_count = 0; DSP4.out_index = 0; } - -#define DSP4_WRITE_BYTE( d ) \ -{ WRITE_WORD( DSP4.output + DSP4.out_count, ( d ) ); DSP4.out_count++; } - -#define DSP4_WRITE_WORD( d ) \ -{ WRITE_WORD( DSP4.output + DSP4.out_count, ( d ) ); DSP4.out_count += 2; } - -#ifndef MSB_FIRST -#define DSP4_WRITE_16_WORD( d ) \ -{ memcpy(DSP4.output + DSP4.out_count, ( d ), 32); DSP4.out_count += 32; } -#else -#define DSP4_WRITE_16_WORD( d ) \ -{ int16 *p = ( d ), *end = ( d )+16; \ - for (; p != end; p++) \ - { \ - WRITE_WORD( DSP4.output + DSP4.out_count, *p ); \ - } \ - DSP4.out_count += 32; \ -} -#endif - -#ifdef PRINT_OP -#define DSP4_WRITE_DEBUG( x, d ) \ - WRITE_WORD( nop + x, d ); -#endif - -#ifdef DEBUG_DSP -#define DSP4_WRITE_DEBUG( x, d ) \ - WRITE_WORD( nop + x, d ); -#endif - -////////////////////////////////////////////////////////////// - -// used to wait for dsp i/o - -#define DSP4_WAIT( x ) \ - DSP4.in_index = 0; DSP4_vars.DSP4_Logic = x; return; - -////////////////////////////////////////////////////////////// - -// 1.7.8 -> 1.15.16 -#define SEX78( a ) ( ( (int32) ( (int16) (a) ) ) << 8 ) - -// 1.15.0 -> 1.15.16 -#define SEX16( a ) ( ( (int32) ( (int16) (a) ) ) << 16 ) - -#ifdef PRINT_OP -#define U16( a ) ( (uint16) ( a ) ) -#endif - -#ifdef DEBUG_DSP -#define U16( a ) ( (uint16) ( a ) ) -#endif - -////////////////////////////////////////////////////////////// - -// Attention: This lookup table is not verified -static const uint16 div_lut[64] = { 0x0000, 0x8000, 0x4000, 0x2aaa, 0x2000, 0x1999, 0x1555, 0x1249, 0x1000, 0x0e38, - 0x0ccc, 0x0ba2, 0x0aaa, 0x09d8, 0x0924, 0x0888, 0x0800, 0x0787, 0x071c, 0x06bc, - 0x0666, 0x0618, 0x05d1, 0x0590, 0x0555, 0x051e, 0x04ec, 0x04bd, 0x0492, 0x0469, - 0x0444, 0x0421, 0x0400, 0x03e0, 0x03c3, 0x03a8, 0x038e, 0x0375, 0x035e, 0x0348, - 0x0333, 0x031f, 0x030c, 0x02fa, 0x02e8, 0x02d8, 0x02c8, 0x02b9, 0x02aa, 0x029c, - 0x028f, 0x0282, 0x0276, 0x026a, 0x025e, 0x0253, 0x0249, 0x023e, 0x0234, 0x022b, - 0x0222, 0x0219, 0x0210, 0x0208, }; -int16 DSP4_Inverse(int16 value) -{ - // saturate bounds - if (value < 0) - { - value = 0; - } - if (value > 63) - { - value = 63; - } - - return div_lut[value]; -} - -////////////////////////////////////////////////////////////// - -// Prototype -void DSP4_OP0B(bool8 *draw, int16 sp_x, int16 sp_y, int16 sp_attr, bool8 size, bool8 stop); - -////////////////////////////////////////////////////////////// - -// OP00 -void DSP4_Multiply(int16 Multiplicand, int16 Multiplier, int32 *Product) -{ - *Product = (Multiplicand * Multiplier << 1) >> 1; -} - -////////////////////////////////////////////////////////////// - - -void DSP4_OP01() -{ - DSP4.waiting4command = FALSE; - - // op flow control - switch (DSP4_vars.DSP4_Logic) - { - case 1: - goto resume1; break; - case 2: - goto resume2; break; - case 3: - goto resume3; break; - } - - //////////////////////////////////////////////////// - // process initial inputs - - // sort inputs - DSP4_vars.world_y = DSP4_READ_DWORD(); - DSP4_vars.poly_bottom[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_top[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_cx[1][0] = DSP4_READ_WORD(); - DSP4_vars.viewport_bottom = DSP4_READ_WORD(); - DSP4_vars.world_x = DSP4_READ_DWORD(); - DSP4_vars.poly_cx[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_ptr[0][0] = DSP4_READ_WORD(); - DSP4_vars.world_yofs = DSP4_READ_WORD(); - DSP4_vars.world_dy = DSP4_READ_DWORD(); - DSP4_vars.world_dx = DSP4_READ_DWORD(); - DSP4_vars.distance = DSP4_READ_WORD(); - DSP4_READ_WORD(); // 0x0000 - DSP4_vars.world_xenv = DSP4_READ_DWORD(); - DSP4_vars.world_ddy = DSP4_READ_WORD(); - DSP4_vars.world_ddx = DSP4_READ_WORD(); - DSP4_vars.view_yofsenv = DSP4_READ_WORD(); - - // initial (x,y,offset) at starting DSP4_vars.raster line - DSP4_vars.view_x1 = (int16)((DSP4_vars.world_x + DSP4_vars.world_xenv) >> 16); - DSP4_vars.view_y1 = (int16)(DSP4_vars.world_y >> 16); - DSP4_vars.view_xofs1 = (int16)(DSP4_vars.world_x >> 16); - DSP4_vars.view_yofs1 = DSP4_vars.world_yofs; - DSP4_vars.view_turnoff_x = 0; - DSP4_vars.view_turnoff_dx = 0; - - // first DSP4_vars.raster line - DSP4_vars.poly_raster[0][0] = DSP4_vars.poly_bottom[0][0]; - - do - { - //////////////////////////////////////////////////// - // process one iteration of projection - - // perspective projection of world (x,y,scroll) points - // based on the current projection lines - DSP4_vars.view_x2 = (int16)(( ( ( DSP4_vars.world_x + DSP4_vars.world_xenv ) >> 16 ) * DSP4_vars.distance >> 15 ) + ( DSP4_vars.view_turnoff_x * DSP4_vars.distance >> 15 )); - DSP4_vars.view_y2 = (int16)((DSP4_vars.world_y >> 16) * DSP4_vars.distance >> 15); - DSP4_vars.view_xofs2 = DSP4_vars.view_x2; - DSP4_vars.view_yofs2 = (DSP4_vars.world_yofs * DSP4_vars.distance >> 15) + DSP4_vars.poly_bottom[0][0] - DSP4_vars.view_y2; - - - // 1. World x-location before transformation - // 2. Viewer x-position at the next - // 3. World y-location before perspective projection - // 4. Viewer y-position below the horizon - // 5. Number of DSP4_vars.raster lines drawn in this iteration - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD((uint16)((DSP4_vars.world_x + DSP4_vars.world_xenv) >> 16)); - DSP4_WRITE_WORD(DSP4_vars.view_x2); - DSP4_WRITE_WORD((uint16)(DSP4_vars.world_y >> 16)); - DSP4_WRITE_WORD(DSP4_vars.view_y2); - - ////////////////////////////////////////////////////// - - // SR = 0x00 - - // determine # of DSP4_vars.raster lines used - DSP4_vars.segments = DSP4_vars.poly_raster[0][0] - DSP4_vars.view_y2; - - // prevent overdraw - if (DSP4_vars.view_y2 >= DSP4_vars.poly_raster[0][0]) - DSP4_vars.segments = 0; - else - DSP4_vars.poly_raster[0][0] = DSP4_vars.view_y2; - - // don't draw outside the window - if (DSP4_vars.view_y2 < DSP4_vars.poly_top[0][0]) - { - DSP4_vars.segments = 0; - - // flush remaining DSP4_vars.raster lines - if (DSP4_vars.view_y1 >= DSP4_vars.poly_top[0][0]) - DSP4_vars.segments = DSP4_vars.view_y1 - DSP4_vars.poly_top[0][0]; - } - - // SR = 0x80 - - DSP4_WRITE_WORD(DSP4_vars.segments); - - ////////////////////////////////////////////////////// - - // scan next command if no SR check needed - if (DSP4_vars.segments) - { - int32 px_dx, py_dy; - int32 x_scroll, y_scroll; - - // SR = 0x00 - - // linear interpolation (lerp) between projected points - px_dx = (DSP4_vars.view_xofs2 - DSP4_vars.view_xofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - py_dy = (DSP4_vars.view_yofs2 - DSP4_vars.view_yofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - - // starting step values - x_scroll = SEX16(DSP4_vars.poly_cx[0][0] + DSP4_vars.view_xofs1); - y_scroll = SEX16(-DSP4_vars.viewport_bottom + DSP4_vars.view_yofs1 + DSP4_vars.view_yofsenv + DSP4_vars.poly_cx[1][0] - DSP4_vars.world_yofs); - - // SR = 0x80 - - // rasterize line - for (DSP4_vars.lcv = 0; DSP4_vars.lcv < DSP4_vars.segments; DSP4_vars.lcv++) - { - // 1. HDMA memory pointer (bg1) - // 2. vertical scroll offset ($210E) - // 3. horizontal scroll offset ($210D) - - DSP4_WRITE_WORD(DSP4_vars.poly_ptr[0][0]); - DSP4_WRITE_WORD((uint16)((y_scroll + 0x8000) >> 16)); - DSP4_WRITE_WORD((uint16)((x_scroll + 0x8000) >> 16)); - - - // update memory address - DSP4_vars.poly_ptr[0][0] -= 4; - - // update screen values - x_scroll += px_dx; - y_scroll += py_dy; - } - } - - //////////////////////////////////////////////////// - // Post-update - - // update new viewer (x,y,scroll) to last DSP4_vars.raster line drawn - DSP4_vars.view_x1 = DSP4_vars.view_x2; - DSP4_vars.view_y1 = DSP4_vars.view_y2; - DSP4_vars.view_xofs1 = DSP4_vars.view_xofs2; - DSP4_vars.view_yofs1 = DSP4_vars.view_yofs2; - - // add deltas for projection lines - DSP4_vars.world_dx += SEX78(DSP4_vars.world_ddx); - DSP4_vars.world_dy += SEX78(DSP4_vars.world_ddy); - - // update projection lines - DSP4_vars.world_x += (DSP4_vars.world_dx + DSP4_vars.world_xenv); - DSP4_vars.world_y += DSP4_vars.world_dy; - - // update road turnoff position - DSP4_vars.view_turnoff_x += DSP4_vars.view_turnoff_dx; - - //////////////////////////////////////////////////// - // command check - - // scan next command - DSP4.in_count = 2; - DSP4_WAIT(1) resume1 : - - // check for termination - DSP4_vars.distance = DSP4_READ_WORD(); - if (DSP4_vars.distance == -0x8000) - break; - - // road turnoff - if( (uint16) DSP4_vars.distance == 0x8001 ) - { - DSP4.in_count = 6; - DSP4_WAIT(2) resume2: - - DSP4_vars.distance = DSP4_READ_WORD(); - DSP4_vars.view_turnoff_x = DSP4_READ_WORD(); - DSP4_vars.view_turnoff_dx = DSP4_READ_WORD(); - - // factor in new changes - DSP4_vars.view_x1 += ( DSP4_vars.view_turnoff_x * DSP4_vars.distance >> 15 ); - DSP4_vars.view_xofs1 += ( DSP4_vars.view_turnoff_x * DSP4_vars.distance >> 15 ); - - // update stepping values - DSP4_vars.view_turnoff_x += DSP4_vars.view_turnoff_dx; - - DSP4.in_count = 2; - DSP4_WAIT(1) - } - - // already have 2 bytes read - DSP4.in_count = 6; - DSP4_WAIT(3) resume3 : - - // inspect inputs - DSP4_vars.world_ddy = DSP4_READ_WORD(); - DSP4_vars.world_ddx = DSP4_READ_WORD(); - DSP4_vars.view_yofsenv = DSP4_READ_WORD(); - - // no envelope here - DSP4_vars.world_xenv = 0; - } - while (1); - - // terminate op - DSP4.waiting4command = TRUE; -} - -////////////////////////////////////////////////////////////// - - -void DSP4_OP03() -{ - DSP4_vars.OAM_RowMax = 33; - memset(DSP4_vars.OAM_Row, 0, 64); -} - - -////////////////////////////////////////////////////////////// - - -void DSP4_OP05() -{ - DSP4_vars.OAM_index = 0; - DSP4_vars.OAM_bits = 0; - memset(DSP4_vars.OAM_attr, 0, 32); - DSP4_vars.sprite_count = 0; -} - - -////////////////////////////////////////////////////////////// - -void DSP4_OP06() -{ - DSP4_CLEAR_OUT(); - DSP4_WRITE_16_WORD(DSP4_vars.OAM_attr); -} - -////////////////////////////////////////////////////////////// - - -void DSP4_OP07() -{ - DSP4.waiting4command = FALSE; - - // op flow control - switch (DSP4_vars.DSP4_Logic) - { - case 1: - goto resume1; break; - case 2: - goto resume2; break; - } - - //////////////////////////////////////////////////// - // sort inputs - - DSP4_vars.world_y = DSP4_READ_DWORD(); - DSP4_vars.poly_bottom[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_top[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_cx[1][0] = DSP4_READ_WORD(); - DSP4_vars.viewport_bottom = DSP4_READ_WORD(); - DSP4_vars.world_x = DSP4_READ_DWORD(); - DSP4_vars.poly_cx[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_ptr[0][0] = DSP4_READ_WORD(); - DSP4_vars.world_yofs = DSP4_READ_WORD(); - DSP4_vars.distance = DSP4_READ_WORD(); - DSP4_vars.view_y2 = DSP4_READ_WORD(); - DSP4_vars.view_dy = DSP4_READ_WORD() * DSP4_vars.distance >> 15; - DSP4_vars.view_x2 = DSP4_READ_WORD(); - DSP4_vars.view_dx = DSP4_READ_WORD() * DSP4_vars.distance >> 15; - DSP4_vars.view_yofsenv = DSP4_READ_WORD(); - - // initial (x,y,offset) at starting DSP4_vars.raster line - DSP4_vars.view_x1 = (int16)(DSP4_vars.world_x >> 16); - DSP4_vars.view_y1 = (int16)(DSP4_vars.world_y >> 16); - DSP4_vars.view_xofs1 = DSP4_vars.view_x1; - DSP4_vars.view_yofs1 = DSP4_vars.world_yofs; - - // first DSP4_vars.raster line - DSP4_vars.poly_raster[0][0] = DSP4_vars.poly_bottom[0][0]; - - - do - { - //////////////////////////////////////////////////// - // process one iteration of projection - - // add shaping - DSP4_vars.view_x2 += DSP4_vars.view_dx; - DSP4_vars.view_y2 += DSP4_vars.view_dy; - - // vertical scroll calculation - DSP4_vars.view_xofs2 = DSP4_vars.view_x2; - DSP4_vars.view_yofs2 = (DSP4_vars.world_yofs * DSP4_vars.distance >> 15) + DSP4_vars.poly_bottom[0][0] - DSP4_vars.view_y2; - - // 1. Viewer x-position at the next - // 2. Viewer y-position below the horizon - // 3. Number of DSP4_vars.raster lines drawn in this iteration - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD(DSP4_vars.view_x2); - DSP4_WRITE_WORD(DSP4_vars.view_y2); - - ////////////////////////////////////////////////////// - - // SR = 0x00 - - // determine # of DSP4_vars.raster lines used - DSP4_vars.segments = DSP4_vars.view_y1 - DSP4_vars.view_y2; - - // prevent overdraw - if (DSP4_vars.view_y2 >= DSP4_vars.poly_raster[0][0]) - DSP4_vars.segments = 0; - else - DSP4_vars.poly_raster[0][0] = DSP4_vars.view_y2; - - // don't draw outside the window - if (DSP4_vars.view_y2 < DSP4_vars.poly_top[0][0]) - { - DSP4_vars.segments = 0; - - // flush remaining DSP4_vars.raster lines - if (DSP4_vars.view_y1 >= DSP4_vars.poly_top[0][0]) - DSP4_vars.segments = DSP4_vars.view_y1 - DSP4_vars.poly_top[0][0]; - } - - // SR = 0x80 - - DSP4_WRITE_WORD(DSP4_vars.segments); - - ////////////////////////////////////////////////////// - - // scan next command if no SR check needed - if (DSP4_vars.segments) - { - int32 px_dx, py_dy; - int32 x_scroll, y_scroll; - - // SR = 0x00 - - // linear interpolation (lerp) between projected points - px_dx = (DSP4_vars.view_xofs2 - DSP4_vars.view_xofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - py_dy = (DSP4_vars.view_yofs2 - DSP4_vars.view_yofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - - // starting step values - x_scroll = SEX16(DSP4_vars.poly_cx[0][0] + DSP4_vars.view_xofs1); - y_scroll = SEX16(-DSP4_vars.viewport_bottom + DSP4_vars.view_yofs1 + DSP4_vars.view_yofsenv + DSP4_vars.poly_cx[1][0] - DSP4_vars.world_yofs); - - // SR = 0x80 - - // rasterize line - for (DSP4_vars.lcv = 0; DSP4_vars.lcv < DSP4_vars.segments; DSP4_vars.lcv++) - { - // 1. HDMA memory pointer (bg2) - // 2. vertical scroll offset ($2110) - // 3. horizontal scroll offset ($210F) - - DSP4_WRITE_WORD(DSP4_vars.poly_ptr[0][0]); - DSP4_WRITE_WORD((uint16)((y_scroll + 0x8000) >> 16)); - DSP4_WRITE_WORD((uint16)((x_scroll + 0x8000) >> 16)); - - // update memory address - DSP4_vars.poly_ptr[0][0] -= 4; - - // update screen values - x_scroll += px_dx; - y_scroll += py_dy; - } - } - - ///////////////////////////////////////////////////// - // Post-update - - // update new viewer (x,y,scroll) to last DSP4_vars.raster line drawn - DSP4_vars.view_x1 = DSP4_vars.view_x2; - DSP4_vars.view_y1 = DSP4_vars.view_y2; - DSP4_vars.view_xofs1 = DSP4_vars.view_xofs2; - DSP4_vars.view_yofs1 = DSP4_vars.view_yofs2; - - //////////////////////////////////////////////////// - // command check - - // scan next command - DSP4.in_count = 2; - DSP4_WAIT(1) resume1 : - - // check for opcode termination - DSP4_vars.distance = DSP4_READ_WORD(); - if (DSP4_vars.distance == -0x8000) - break; - - // already have 2 bytes in queue - DSP4.in_count = 10; - DSP4_WAIT(2) resume2 : - - // inspect inputs - DSP4_vars.view_y2 = DSP4_READ_WORD(); - DSP4_vars.view_dy = DSP4_READ_WORD() * DSP4_vars.distance >> 15; - DSP4_vars.view_x2 = DSP4_READ_WORD(); - DSP4_vars.view_dx = DSP4_READ_WORD() * DSP4_vars.distance >> 15; - DSP4_vars.view_yofsenv = DSP4_READ_WORD(); - } - while (1); - - DSP4.waiting4command = TRUE; -} - -////////////////////////////////////////////////////////////// - -void DSP4_OP08() -{ - int16 win_left, win_right; - int16 view_x[2], view_y[2]; - int16 envelope[2][2]; - - DSP4.waiting4command = FALSE; - - // op flow control - switch (DSP4_vars.DSP4_Logic) - { - case 1: - goto resume1; break; - case 2: - goto resume2; break; - } - - //////////////////////////////////////////////////// - // process initial inputs for two polygons - - // clip values - DSP4_vars.poly_clipRt[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_clipRt[0][1] = DSP4_READ_WORD(); - DSP4_vars.poly_clipRt[1][0] = DSP4_READ_WORD(); - DSP4_vars.poly_clipRt[1][1] = DSP4_READ_WORD(); - - DSP4_vars.poly_clipLf[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_clipLf[0][1] = DSP4_READ_WORD(); - DSP4_vars.poly_clipLf[1][0] = DSP4_READ_WORD(); - DSP4_vars.poly_clipLf[1][1] = DSP4_READ_WORD(); - - // unknown (constant) (ex. 1P/2P = $00A6, $00A6, $00A6, $00A6) - DSP4_READ_WORD(); - DSP4_READ_WORD(); - DSP4_READ_WORD(); - DSP4_READ_WORD(); - - // unknown (constant) (ex. 1P/2P = $00A5, $00A5, $00A7, $00A7) - DSP4_READ_WORD(); - DSP4_READ_WORD(); - DSP4_READ_WORD(); - DSP4_READ_WORD(); - - // polygon centering (left,right) - DSP4_vars.poly_cx[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_cx[0][1] = DSP4_READ_WORD(); - DSP4_vars.poly_cx[1][0] = DSP4_READ_WORD(); - DSP4_vars.poly_cx[1][1] = DSP4_READ_WORD(); - - // HDMA pointer locations - DSP4_vars.poly_ptr[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_ptr[0][1] = DSP4_READ_WORD(); - DSP4_vars.poly_ptr[1][0] = DSP4_READ_WORD(); - DSP4_vars.poly_ptr[1][1] = DSP4_READ_WORD(); - - // starting DSP4_vars.raster line below the horizon - DSP4_vars.poly_bottom[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_bottom[0][1] = DSP4_READ_WORD(); - DSP4_vars.poly_bottom[1][0] = DSP4_READ_WORD(); - DSP4_vars.poly_bottom[1][1] = DSP4_READ_WORD(); - - // top boundary line to clip - DSP4_vars.poly_top[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_top[0][1] = DSP4_READ_WORD(); - DSP4_vars.poly_top[1][0] = DSP4_READ_WORD(); - DSP4_vars.poly_top[1][1] = DSP4_READ_WORD(); - - // unknown - // (ex. 1P = $2FC8, $0034, $FF5C, $0035) - // - // (ex. 2P = $3178, $0034, $FFCC, $0035) - // (ex. 2P = $2FC8, $0034, $FFCC, $0035) - - DSP4_READ_WORD(); - DSP4_READ_WORD(); - DSP4_READ_WORD(); - DSP4_READ_WORD(); - - // look at guidelines for both polygon shapes - DSP4_vars.distance = DSP4_READ_WORD(); - view_x[0] = DSP4_READ_WORD(); - view_y[0] = DSP4_READ_WORD(); - view_x[1] = DSP4_READ_WORD(); - view_y[1] = DSP4_READ_WORD(); - - // envelope shaping guidelines (one frame only) - envelope[0][0] = DSP4_READ_WORD(); - envelope[0][1] = DSP4_READ_WORD(); - envelope[1][0] = DSP4_READ_WORD(); - envelope[1][1] = DSP4_READ_WORD(); - - // starting base values to project from - DSP4_vars.poly_start[0] = view_x[0]; - DSP4_vars.poly_start[1] = view_x[1]; - - // starting DSP4_vars.raster lines to begin drawing - DSP4_vars.poly_raster[0][0] = view_y[0]; - DSP4_vars.poly_raster[0][1] = view_y[0]; - DSP4_vars.poly_raster[1][0] = view_y[1]; - DSP4_vars.poly_raster[1][1] = view_y[1]; - - // starting distances - DSP4_vars.poly_plane[0] = DSP4_vars.distance; - DSP4_vars.poly_plane[1] = DSP4_vars.distance; - - // SR = 0x00 - - // re-center coordinates - win_left = DSP4_vars.poly_cx[0][0] - view_x[0] + envelope[0][0]; - win_right = DSP4_vars.poly_cx[0][1] - view_x[0] + envelope[0][1]; - - // saturate offscreen data for polygon #1 - if (win_left < DSP4_vars.poly_clipLf[0][0]) - { - win_left = DSP4_vars.poly_clipLf[0][0]; - } - if (win_left > DSP4_vars.poly_clipRt[0][0]) - { - win_left = DSP4_vars.poly_clipRt[0][0]; - } - if (win_right < DSP4_vars.poly_clipLf[0][1]) - { - win_right = DSP4_vars.poly_clipLf[0][1]; - } - if (win_right > DSP4_vars.poly_clipRt[0][1]) - { - win_right = DSP4_vars.poly_clipRt[0][1]; - } - - // SR = 0x80 - - // initial output for polygon #1 - DSP4_CLEAR_OUT(); - DSP4_WRITE_BYTE(win_left & 0xff); - DSP4_WRITE_BYTE(win_right & 0xff); - - - do - { - int16 polygon; - //////////////////////////////////////////////////// - // command check - - // scan next command - DSP4.in_count = 2; - DSP4_WAIT(1) resume1 : - - // terminate op - DSP4_vars.distance = DSP4_READ_WORD(); - if (DSP4_vars.distance == -0x8000) - break; - - // already have 2 bytes in queue - DSP4.in_count = 16; - - DSP4_WAIT(2) resume2 : - - // look at guidelines for both polygon shapes - view_x[0] = DSP4_READ_WORD(); - view_y[0] = DSP4_READ_WORD(); - view_x[1] = DSP4_READ_WORD(); - view_y[1] = DSP4_READ_WORD(); - - // envelope shaping guidelines (one frame only) - envelope[0][0] = DSP4_READ_WORD(); - envelope[0][1] = DSP4_READ_WORD(); - envelope[1][0] = DSP4_READ_WORD(); - envelope[1][1] = DSP4_READ_WORD(); - - //////////////////////////////////////////////////// - // projection begins - - // init - DSP4_CLEAR_OUT(); - - - ////////////////////////////////////////////// - // solid polygon renderer - 2 shapes - - for (polygon = 0; polygon < 2; polygon++) - { - int32 left_inc, right_inc; - int16 x1_final, x2_final; - int16 env[2][2]; - int16 poly; - - // SR = 0x00 - - // # DSP4_vars.raster lines to draw - DSP4_vars.segments = DSP4_vars.poly_raster[polygon][0] - view_y[polygon]; - - // prevent overdraw - if (DSP4_vars.segments > 0) - { - // bump drawing cursor - DSP4_vars.poly_raster[polygon][0] = view_y[polygon]; - DSP4_vars.poly_raster[polygon][1] = view_y[polygon]; - } - else - DSP4_vars.segments = 0; - - // don't draw outside the window - if (view_y[polygon] < DSP4_vars.poly_top[polygon][0]) - { - DSP4_vars.segments = 0; - - // flush remaining DSP4_vars.raster lines - if (view_y[polygon] >= DSP4_vars.poly_top[polygon][0]) - DSP4_vars.segments = view_y[polygon] - DSP4_vars.poly_top[polygon][0]; - } - - // SR = 0x80 - - // tell user how many DSP4_vars.raster structures to read in - DSP4_WRITE_WORD(DSP4_vars.segments); - - // normal parameters - poly = polygon; - - ///////////////////////////////////////////////////// - - // scan next command if no SR check needed - if (DSP4_vars.segments) - { - int32 win_left, win_right; - - // road turnoff selection - if( (uint16) envelope[ polygon ][ 0 ] == (uint16) 0xc001 ) - poly = 1; - else if( envelope[ polygon ][ 1 ] == 0x3fff ) - poly = 1; - - /////////////////////////////////////////////// - // left side of polygon - - // perspective correction on additional shaping parameters - env[0][0] = envelope[polygon][0] * DSP4_vars.poly_plane[poly] >> 15; - env[0][1] = envelope[polygon][0] * DSP4_vars.distance >> 15; - - // project new shapes (left side) - x1_final = view_x[poly] + env[0][0]; - x2_final = DSP4_vars.poly_start[poly] + env[0][1]; - - // interpolate between projected points with shaping - left_inc = (x2_final - x1_final) * DSP4_Inverse(DSP4_vars.segments) << 1; - if (DSP4_vars.segments == 1) - left_inc = -left_inc; - - /////////////////////////////////////////////// - // right side of polygon - - // perspective correction on additional shaping parameters - env[1][0] = envelope[polygon][1] * DSP4_vars.poly_plane[poly] >> 15;; - env[1][1] = envelope[polygon][1] * DSP4_vars.distance >> 15; - - // project new shapes (right side) - x1_final = view_x[poly] + env[1][0]; - x2_final = DSP4_vars.poly_start[poly] + env[1][1]; - - - // interpolate between projected points with shaping - right_inc = (x2_final - x1_final) * DSP4_Inverse(DSP4_vars.segments) << 1; - if (DSP4_vars.segments == 1) - right_inc = -right_inc; - - /////////////////////////////////////////////// - // update each point on the line - - win_left = SEX16(DSP4_vars.poly_cx[polygon][0] - DSP4_vars.poly_start[poly] + env[0][0]); - win_right = SEX16(DSP4_vars.poly_cx[polygon][1] - DSP4_vars.poly_start[poly] + env[1][0]); - - // update DSP4_vars.distance drawn into world - DSP4_vars.poly_plane[polygon] = DSP4_vars.distance; - - // rasterize line - for (DSP4_vars.lcv = 0; DSP4_vars.lcv < DSP4_vars.segments; DSP4_vars.lcv++) - { - int16 x_left, x_right; - - // project new coordinates - win_left += left_inc; - win_right += right_inc; - - // grab integer portion, drop fraction (no rounding) - x_left = (int16)(win_left >> 16); - x_right = (int16)(win_right >> 16); - - // saturate offscreen data - if (x_left < DSP4_vars.poly_clipLf[polygon][0]) - x_left = DSP4_vars.poly_clipLf[polygon][0]; - if (x_left > DSP4_vars.poly_clipRt[polygon][0]) - x_left = DSP4_vars.poly_clipRt[polygon][0]; - if (x_right < DSP4_vars.poly_clipLf[polygon][1]) - x_right = DSP4_vars.poly_clipLf[polygon][1]; - if (x_right > DSP4_vars.poly_clipRt[polygon][1]) - x_right = DSP4_vars.poly_clipRt[polygon][1]; - - // 1. HDMA memory pointer - // 2. Left window position ($2126/$2128) - // 3. Right window position ($2127/$2129) - - DSP4_WRITE_WORD(DSP4_vars.poly_ptr[polygon][0]); - DSP4_WRITE_BYTE(x_left & 0xff); - DSP4_WRITE_BYTE(x_right & 0xff); - - - // update memory pointers - DSP4_vars.poly_ptr[polygon][0] -= 4; - DSP4_vars.poly_ptr[polygon][1] -= 4; - } // end rasterize line - } - - //////////////////////////////////////////////// - // Post-update - - // new projection spot to continue rasterizing from - DSP4_vars.poly_start[polygon] = view_x[poly]; - } // end polygon rasterizer - } - while (1); - - // unknown output - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD(0); - - - DSP4.waiting4command = TRUE; -} - -////////////////////////////////////////////////////////////// - -void DSP4_OP09() -{ - DSP4.waiting4command = FALSE; - - // op flow control - switch (DSP4_vars.DSP4_Logic) - { - case 1: - goto resume1; break; - case 2: - goto resume2; break; - case 3: - goto resume3; break; - case 4: - goto resume4; break; - case 5: - goto resume5; break; - case 6: - goto resume6; break; - } - - //////////////////////////////////////////////////// - // process initial inputs - - // grab screen information - DSP4_vars.viewport_cx = DSP4_READ_WORD(); - DSP4_vars.viewport_cy = DSP4_READ_WORD(); - DSP4_READ_WORD(); // 0x0000 - DSP4_vars.viewport_left = DSP4_READ_WORD(); - DSP4_vars.viewport_right = DSP4_READ_WORD(); - DSP4_vars.viewport_top = DSP4_READ_WORD(); - DSP4_vars.viewport_bottom = DSP4_READ_WORD(); - - // starting DSP4_vars.raster line below the horizon - DSP4_vars.poly_bottom[0][0] = DSP4_vars.viewport_bottom - DSP4_vars.viewport_cy; - DSP4_vars.poly_raster[0][0] = 0x100; - - do - { - //////////////////////////////////////////////////// - // check for new sprites - - DSP4.in_count = 4; - DSP4_WAIT(1) resume1 : - - //////////////////////////////////////////////// - // DSP4_vars.raster overdraw check - - DSP4_vars.raster = DSP4_READ_WORD(); - - // continue updating the DSP4_vars.raster line where overdraw begins - if (DSP4_vars.raster < DSP4_vars.poly_raster[0][0]) - { - DSP4_vars.sprite_clipy = DSP4_vars.viewport_bottom - (DSP4_vars.poly_bottom[0][0] - DSP4_vars.raster); - DSP4_vars.poly_raster[0][0] = DSP4_vars.raster; - } - - ///////////////////////////////////////////////// - // identify sprite - - // op termination - DSP4_vars.distance = DSP4_READ_WORD(); - if (DSP4_vars.distance == -0x8000) - goto terminate; - - - // no sprite - if (DSP4_vars.distance == 0x0000) - { - continue; - } - - //////////////////////////////////////////////////// - // process projection information - - // vehicle sprite - if ((uint16) DSP4_vars.distance == 0x9000) - { - int16 car_left, car_right, car_back; - int16 impact_left, impact_back; - int16 world_spx, world_spy; - int16 view_spx, view_spy; - uint16 energy; - - // we already have 4 bytes we want - DSP4.in_count = 14; - DSP4_WAIT(2) resume2 : - - // filter inputs - energy = DSP4_READ_WORD(); - impact_back = DSP4_READ_WORD(); - car_back = DSP4_READ_WORD(); - impact_left = DSP4_READ_WORD(); - car_left = DSP4_READ_WORD(); - DSP4_vars.distance = DSP4_READ_WORD(); - car_right = DSP4_READ_WORD(); - - // calculate car's world (x,y) values - world_spx = car_right - car_left; - world_spy = car_back; - - // add in collision vector [needs bit-twiddling] - world_spx -= energy * (impact_left - car_left) >> 16; - world_spy -= energy * (car_back - impact_back) >> 16; - - // perspective correction for world (x,y) - view_spx = world_spx * DSP4_vars.distance >> 15; - view_spy = world_spy * DSP4_vars.distance >> 15; - - // convert to screen values - DSP4_vars.sprite_x = DSP4_vars.viewport_cx + view_spx; - DSP4_vars.sprite_y = DSP4_vars.viewport_bottom - (DSP4_vars.poly_bottom[0][0] - view_spy); - - // make the car's (x)-coordinate available - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD(world_spx); - - // grab a few remaining vehicle values - DSP4.in_count = 4; - DSP4_WAIT(3) resume3 : - - // add vertical lift factor - DSP4_vars.sprite_y += DSP4_READ_WORD(); - } - // terrain sprite - else - { - int16 world_spx, world_spy; - int16 view_spx, view_spy; - - // we already have 4 bytes we want - DSP4.in_count = 10; - DSP4_WAIT(4) resume4 : - - // sort loop inputs - DSP4_vars.poly_cx[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_raster[0][1] = DSP4_READ_WORD(); - world_spx = DSP4_READ_WORD(); - world_spy = DSP4_READ_WORD(); - - // compute base DSP4_vars.raster line from the bottom - DSP4_vars.segments = DSP4_vars.poly_bottom[0][0] - DSP4_vars.raster; - - // perspective correction for world (x,y) - view_spx = world_spx * DSP4_vars.distance >> 15; - view_spy = world_spy * DSP4_vars.distance >> 15; - - // convert to screen values - DSP4_vars.sprite_x = DSP4_vars.viewport_cx + view_spx - DSP4_vars.poly_cx[0][0]; - DSP4_vars.sprite_y = DSP4_vars.viewport_bottom - DSP4_vars.segments + view_spy; - } - - // default sprite size: 16x16 - DSP4_vars.sprite_size = 1; - DSP4_vars.sprite_attr = DSP4_READ_WORD(); - - //////////////////////////////////////////////////// - // convert tile data to SNES OAM format - - do - { - uint16 header; - - int16 sp_x, sp_y, sp_attr, sp_dattr; - int16 sp_dx, sp_dy; - int16 pixels; - - bool8 draw; - - DSP4.in_count = 2; - DSP4_WAIT(5) resume5 : - - draw = TRUE; - - // opcode termination - DSP4_vars.raster = DSP4_READ_WORD(); - if (DSP4_vars.raster == -0x8000) - goto terminate; - - // stop code - if (DSP4_vars.raster == 0x0000 && !DSP4_vars.sprite_size) - break; - - // toggle sprite size - if (DSP4_vars.raster == 0x0000) - { - DSP4_vars.sprite_size = !DSP4_vars.sprite_size; - continue; - } - - // check for valid sprite header - header = DSP4_vars.raster; - header >>= 8; - if (header != 0x20 && - header != 0x2e && //This is for attractor sprite - header != 0x40 && - header != 0x60 && - header != 0xa0 && - header != 0xc0 && - header != 0xe0) - break; - - // read in rest of sprite data - DSP4.in_count = 4; - DSP4_WAIT(6) resume6 : - - draw = TRUE; - - ///////////////////////////////////// - // process tile data - - // sprite deltas - sp_dattr = DSP4_vars.raster; - sp_dy = DSP4_READ_WORD(); - sp_dx = DSP4_READ_WORD(); - - // update coordinates to screen space - sp_x = DSP4_vars.sprite_x + sp_dx; - sp_y = DSP4_vars.sprite_y + sp_dy; - - // update sprite nametable/attribute information - sp_attr = DSP4_vars.sprite_attr + sp_dattr; - - // allow partially visibile tiles - pixels = DSP4_vars.sprite_size ? 15 : 7; - - DSP4_CLEAR_OUT(); - - // transparent tile to clip off parts of a sprite (overdraw) - if (DSP4_vars.sprite_clipy - pixels <= sp_y && - sp_y <= DSP4_vars.sprite_clipy && - sp_x >= DSP4_vars.viewport_left - pixels && - sp_x <= DSP4_vars.viewport_right && - DSP4_vars.sprite_clipy >= DSP4_vars.viewport_top - pixels && - DSP4_vars.sprite_clipy <= DSP4_vars.viewport_bottom) - { - DSP4_OP0B(&draw, sp_x, DSP4_vars.sprite_clipy, 0x00EE, DSP4_vars.sprite_size, 0); - } - - - // normal sprite tile - if (sp_x >= DSP4_vars.viewport_left - pixels && - sp_x <= DSP4_vars.viewport_right && - sp_y >= DSP4_vars.viewport_top - pixels && - sp_y <= DSP4_vars.viewport_bottom && - sp_y <= DSP4_vars.sprite_clipy) - { - DSP4_OP0B(&draw, sp_x, sp_y, sp_attr, DSP4_vars.sprite_size, 0); - } - - - // no following OAM data - DSP4_OP0B(&draw, 0, 0x0100, 0, 0, 1); - } - while (1); - } - while (1); - - terminate : DSP4.waiting4command = TRUE; -} - -////////////////////////////////////////////////////////////// - -const uint16 OP0A_Values[16] = { 0x0000, 0x0030, 0x0060, 0x0090, 0x00c0, 0x00f0, 0x0120, 0x0150, 0xfe80, - 0xfeb0, 0xfee0, 0xff10, 0xff40, 0xff70, 0xffa0, 0xffd0 }; - -void DSP4_OP0A(int16 n2, int16 *o1, int16 *o2, int16 *o3, int16 *o4) -{ - *o4 = OP0A_Values[(n2 & 0x000f)]; - *o3 = OP0A_Values[(n2 & 0x00f0) >> 4]; - *o2 = OP0A_Values[(n2 & 0x0f00) >> 8]; - *o1 = OP0A_Values[(n2 & 0xf000) >> 12]; -} - -////////////////////////////////////////////////////////////// - -void DSP4_OP0B(bool8 *draw, int16 sp_x, int16 sp_y, int16 sp_attr, bool8 size, bool8 stop) -{ - int16 Row1, Row2; - - // SR = 0x00 - - // align to nearest 8-pixel row - Row1 = (sp_y >> 3) & 0x1f; - Row2 = (Row1 + 1) & 0x1f; - - // check boundaries - if (!((sp_y < 0) || ((sp_y & 0x01ff) < 0x00eb))) - { - *draw = 0; - } - if (size) - { - if (DSP4_vars.OAM_Row[Row1] + 1 >= DSP4_vars.OAM_RowMax) - *draw = 0; - if (DSP4_vars.OAM_Row[Row2] + 1 >= DSP4_vars.OAM_RowMax) - *draw = 0; - } - else - { - if (DSP4_vars.OAM_Row[Row1] >= DSP4_vars.OAM_RowMax) - { - *draw = 0; - } - } - - // emulator fail-safe (unknown if this really exists) - if (DSP4_vars.sprite_count >= 128) - { - *draw = 0; - } - - // SR = 0x80 - - if (*draw) - { - // Row tiles - if (size) - { - DSP4_vars.OAM_Row[Row1] += 2; - DSP4_vars.OAM_Row[Row2] += 2; - } - else - { - DSP4_vars.OAM_Row[Row1]++; - } - - // yield OAM output - DSP4_WRITE_WORD(1); - - // pack OAM data: x,y,name,attr - DSP4_WRITE_BYTE(sp_x & 0xff); - DSP4_WRITE_BYTE(sp_y & 0xff); - DSP4_WRITE_WORD(sp_attr); - - DSP4_vars.sprite_count++; - - // OAM: size,msb data - // save post-oam table data for future retrieval - DSP4_vars.OAM_attr[DSP4_vars.OAM_index] |= ((sp_x <0 || sp_x> 255) << DSP4_vars.OAM_bits); - DSP4_vars.OAM_bits++; - - DSP4_vars.OAM_attr[DSP4_vars.OAM_index] |= (size << DSP4_vars.OAM_bits); - DSP4_vars.OAM_bits++; - - // move to next byte in buffer - if (DSP4_vars.OAM_bits == 16) - { - DSP4_vars.OAM_bits = 0; - DSP4_vars.OAM_index++; - } - } - else if (stop) - { - // yield no OAM output - DSP4_WRITE_WORD(0); - } -} - -////////////////////////////////////////////////////////////// - -void DSP4_OP0D() -{ - DSP4.waiting4command = FALSE; - - // op flow control - switch (DSP4_vars.DSP4_Logic) - { - case 1: - goto resume1; break; - case 2: - goto resume2; break; - } - - //////////////////////////////////////////////////// - // process initial inputs - - // sort inputs - DSP4_vars.world_y = DSP4_READ_DWORD(); - DSP4_vars.poly_bottom[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_top[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_cx[1][0] = DSP4_READ_WORD(); - DSP4_vars.viewport_bottom = DSP4_READ_WORD(); - DSP4_vars.world_x = DSP4_READ_DWORD(); - DSP4_vars.poly_cx[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_ptr[0][0] = DSP4_READ_WORD(); - DSP4_vars.world_yofs = DSP4_READ_WORD(); - DSP4_vars.world_dy = DSP4_READ_DWORD(); - DSP4_vars.world_dx = DSP4_READ_DWORD(); - DSP4_vars.distance = DSP4_READ_WORD(); - DSP4_READ_WORD(); // 0x0000 - DSP4_vars.world_xenv = SEX78(DSP4_READ_WORD()); - DSP4_vars.world_ddy = DSP4_READ_WORD(); - DSP4_vars.world_ddx = DSP4_READ_WORD(); - DSP4_vars.view_yofsenv = DSP4_READ_WORD(); - - // initial (x,y,offset) at starting DSP4_vars.raster line - DSP4_vars.view_x1 = (int16)((DSP4_vars.world_x + DSP4_vars.world_xenv) >> 16); - DSP4_vars.view_y1 = (int16)(DSP4_vars.world_y >> 16); - DSP4_vars.view_xofs1 = (int16)(DSP4_vars.world_x >> 16); - DSP4_vars.view_yofs1 = DSP4_vars.world_yofs; - - // first DSP4_vars.raster line - DSP4_vars.poly_raster[0][0] = DSP4_vars.poly_bottom[0][0]; - - - do - { - //////////////////////////////////////////////////// - // process one iteration of projection - - // perspective projection of world (x,y,scroll) points - // based on the current projection lines - DSP4_vars.view_x2 = (int16)(( ( ( DSP4_vars.world_x + DSP4_vars.world_xenv ) >> 16 ) * DSP4_vars.distance >> 15 ) + ( DSP4_vars.view_turnoff_x * DSP4_vars.distance >> 15 )); - DSP4_vars.view_y2 = (int16)((DSP4_vars.world_y >> 16) * DSP4_vars.distance >> 15); - DSP4_vars.view_xofs2 = DSP4_vars.view_x2; - DSP4_vars.view_yofs2 = (DSP4_vars.world_yofs * DSP4_vars.distance >> 15) + DSP4_vars.poly_bottom[0][0] - DSP4_vars.view_y2; - - // 1. World x-location before transformation - // 2. Viewer x-position at the current - // 3. World y-location before perspective projection - // 4. Viewer y-position below the horizon - // 5. Number of DSP4_vars.raster lines drawn in this iteration - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD((uint16)((DSP4_vars.world_x + DSP4_vars.world_xenv) >> 16)); - DSP4_WRITE_WORD(DSP4_vars.view_x2); - DSP4_WRITE_WORD((uint16)(DSP4_vars.world_y >> 16)); - DSP4_WRITE_WORD(DSP4_vars.view_y2); - - ////////////////////////////////////////////////////////// - - // SR = 0x00 - - // determine # of DSP4_vars.raster lines used - DSP4_vars.segments = DSP4_vars.view_y1 - DSP4_vars.view_y2; - - // prevent overdraw - if (DSP4_vars.view_y2 >= DSP4_vars.poly_raster[0][0]) - DSP4_vars.segments = 0; - else - DSP4_vars.poly_raster[0][0] = DSP4_vars.view_y2; - - // don't draw outside the window - if (DSP4_vars.view_y2 < DSP4_vars.poly_top[0][0]) - { - DSP4_vars.segments = 0; - - // flush remaining DSP4_vars.raster lines - if (DSP4_vars.view_y1 >= DSP4_vars.poly_top[0][0]) - DSP4_vars.segments = DSP4_vars.view_y1 - DSP4_vars.poly_top[0][0]; - } - - // SR = 0x80 - - DSP4_WRITE_WORD(DSP4_vars.segments); - - ////////////////////////////////////////////////////////// - - // scan next command if no SR check needed - if (DSP4_vars.segments) - { - int32 px_dx, py_dy; - int32 x_scroll, y_scroll; - - // SR = 0x00 - - // linear interpolation (lerp) between projected points - px_dx = (DSP4_vars.view_xofs2 - DSP4_vars.view_xofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - py_dy = (DSP4_vars.view_yofs2 - DSP4_vars.view_yofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - - // starting step values - x_scroll = SEX16(DSP4_vars.poly_cx[0][0] + DSP4_vars.view_xofs1); - y_scroll = SEX16(-DSP4_vars.viewport_bottom + DSP4_vars.view_yofs1 + DSP4_vars.view_yofsenv + DSP4_vars.poly_cx[1][0] - DSP4_vars.world_yofs); - - // SR = 0x80 - - // rasterize line - for (DSP4_vars.lcv = 0; DSP4_vars.lcv < DSP4_vars.segments; DSP4_vars.lcv++) - { - // 1. HDMA memory pointer (bg1) - // 2. vertical scroll offset ($210E) - // 3. horizontal scroll offset ($210D) - - DSP4_WRITE_WORD(DSP4_vars.poly_ptr[0][0]); - DSP4_WRITE_WORD((uint16)((y_scroll + 0x8000) >> 16)); - DSP4_WRITE_WORD((uint16)((x_scroll + 0x8000) >> 16)); - - - // update memory address - DSP4_vars.poly_ptr[0][0] -= 4; - - // update screen values - x_scroll += px_dx; - y_scroll += py_dy; - } - } - - ///////////////////////////////////////////////////// - // Post-update - - // update new viewer (x,y,scroll) to last DSP4_vars.raster line drawn - DSP4_vars.view_x1 = DSP4_vars.view_x2; - DSP4_vars.view_y1 = DSP4_vars.view_y2; - DSP4_vars.view_xofs1 = DSP4_vars.view_xofs2; - DSP4_vars.view_yofs1 = DSP4_vars.view_yofs2; - - // add deltas for projection lines - DSP4_vars.world_dx += SEX78(DSP4_vars.world_ddx); - DSP4_vars.world_dy += SEX78(DSP4_vars.world_ddy); - - // update projection lines - DSP4_vars.world_x += (DSP4_vars.world_dx + DSP4_vars.world_xenv); - DSP4_vars.world_y += DSP4_vars.world_dy; - - //////////////////////////////////////////////////// - // command check - - // scan next command - DSP4.in_count = 2; - DSP4_WAIT(1) resume1 : - - // inspect input - DSP4_vars.distance = DSP4_READ_WORD(); - - // terminate op - if (DSP4_vars.distance == -0x8000) - break; - - // already have 2 bytes in queue - DSP4.in_count = 6; - DSP4_WAIT(2) resume2: - - // inspect inputs - DSP4_vars.world_ddy = DSP4_READ_WORD(); - DSP4_vars.world_ddx = DSP4_READ_WORD(); - DSP4_vars.view_yofsenv = DSP4_READ_WORD(); - - // no envelope here - DSP4_vars.world_xenv = 0; - } - while (1); - - DSP4.waiting4command = TRUE; -} - -////////////////////////////////////////////////////////////// - - -void DSP4_OP0E() -{ - DSP4_vars.OAM_RowMax = 16; - memset(DSP4_vars.OAM_Row, 0, 64); -} - - -////////////////////////////////////////////////////////////// - -void DSP4_OP0F() -{ - DSP4.waiting4command = FALSE; - - // op flow control - switch (DSP4_vars.DSP4_Logic) - { - case 1: - goto resume1; break; - case 2: - goto resume2; break; - case 3: - goto resume3; break; - case 4: - goto resume4; break; - } - - //////////////////////////////////////////////////// - // process initial inputs - - // sort inputs - DSP4_READ_WORD(); // 0x0000 - DSP4_vars.world_y = DSP4_READ_DWORD(); - DSP4_vars.poly_bottom[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_top[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_cx[1][0] = DSP4_READ_WORD(); - DSP4_vars.viewport_bottom = DSP4_READ_WORD(); - DSP4_vars.world_x = DSP4_READ_DWORD(); - DSP4_vars.poly_cx[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_ptr[0][0] = DSP4_READ_WORD(); - DSP4_vars.world_yofs = DSP4_READ_WORD(); - DSP4_vars.world_dy = DSP4_READ_DWORD(); - DSP4_vars.world_dx = DSP4_READ_DWORD(); - DSP4_vars.distance = DSP4_READ_WORD(); - DSP4_READ_WORD(); // 0x0000 - DSP4_vars.world_xenv = DSP4_READ_DWORD(); - DSP4_vars.world_ddy = DSP4_READ_WORD(); - DSP4_vars.world_ddx = DSP4_READ_WORD(); - DSP4_vars.view_yofsenv = DSP4_READ_WORD(); - - // initial (x,y,offset) at starting DSP4_vars.raster line - DSP4_vars.view_x1 = (int16)((DSP4_vars.world_x + DSP4_vars.world_xenv) >> 16); - DSP4_vars.view_y1 = (int16)(DSP4_vars.world_y >> 16); - DSP4_vars.view_xofs1 = (int16)(DSP4_vars.world_x >> 16); - DSP4_vars.view_yofs1 = DSP4_vars.world_yofs; - DSP4_vars.view_turnoff_x = 0; - DSP4_vars.view_turnoff_dx = 0; - - // first DSP4_vars.raster line - DSP4_vars.poly_raster[0][0] = DSP4_vars.poly_bottom[0][0]; - - - do - { - //////////////////////////////////////////////////// - // process one iteration of projection - - // perspective projection of world (x,y,scroll) points - // based on the current projection lines - DSP4_vars.view_x2 = (int16)(((DSP4_vars.world_x + DSP4_vars.world_xenv) >> 16) * DSP4_vars.distance >> 15); - DSP4_vars.view_y2 = (int16)((DSP4_vars.world_y >> 16) * DSP4_vars.distance >> 15); - DSP4_vars.view_xofs2 = DSP4_vars.view_x2; - DSP4_vars.view_yofs2 = (DSP4_vars.world_yofs * DSP4_vars.distance >> 15) + DSP4_vars.poly_bottom[0][0] - DSP4_vars.view_y2; - - // 1. World x-location before transformation - // 2. Viewer x-position at the next - // 3. World y-location before perspective projection - // 4. Viewer y-position below the horizon - // 5. Number of DSP4_vars.raster lines drawn in this iteration - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD((uint16)((DSP4_vars.world_x + DSP4_vars.world_xenv) >> 16)); - DSP4_WRITE_WORD(DSP4_vars.view_x2); - DSP4_WRITE_WORD((uint16)(DSP4_vars.world_y >> 16)); - DSP4_WRITE_WORD(DSP4_vars.view_y2); - - ////////////////////////////////////////////////////// - - // SR = 0x00 - - // determine # of DSP4_vars.raster lines used - DSP4_vars.segments = DSP4_vars.poly_raster[0][0] - DSP4_vars.view_y2; - - // prevent overdraw - if (DSP4_vars.view_y2 >= DSP4_vars.poly_raster[0][0]) - DSP4_vars.segments = 0; - else - DSP4_vars.poly_raster[0][0] = DSP4_vars.view_y2; - - // don't draw outside the window - if (DSP4_vars.view_y2 < DSP4_vars.poly_top[0][0]) - { - DSP4_vars.segments = 0; - - // flush remaining DSP4_vars.raster lines - if (DSP4_vars.view_y1 >= DSP4_vars.poly_top[0][0]) - DSP4_vars.segments = DSP4_vars.view_y1 - DSP4_vars.poly_top[0][0]; - } - - // SR = 0x80 - - DSP4_WRITE_WORD(DSP4_vars.segments); - - ////////////////////////////////////////////////////// - - // scan next command if no SR check needed - if (DSP4_vars.segments) - { - int32 px_dx, py_dy; - int32 x_scroll, y_scroll; - - for (DSP4_vars.lcv = 0; DSP4_vars.lcv < 4; DSP4_vars.lcv++) - { - // grab inputs - DSP4.in_count = 4; - DSP4_WAIT(1); - resume1 : - for (;;) - { - int16 distance; - int16 color, red, green, blue; - - distance = DSP4_READ_WORD(); - color = DSP4_READ_WORD(); - - // U1+B5+G5+R5 - red = color & 0x1f; - green = (color >> 5) & 0x1f; - blue = (color >> 10) & 0x1f; - - // dynamic lighting - red = (red * distance >> 15) & 0x1f; - green = (green * distance >> 15) & 0x1f; - blue = (blue * distance >> 15) & 0x1f; - color = red | (green << 5) | (blue << 10); - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD(color); - break; - } - } - - ////////////////////////////////////////////////////// - - // SR = 0x00 - - // linear interpolation (lerp) between projected points - px_dx = (DSP4_vars.view_xofs2 - DSP4_vars.view_xofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - py_dy = (DSP4_vars.view_yofs2 - DSP4_vars.view_yofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - - - // starting step values - x_scroll = SEX16(DSP4_vars.poly_cx[0][0] + DSP4_vars.view_xofs1); - y_scroll = SEX16(-DSP4_vars.viewport_bottom + DSP4_vars.view_yofs1 + DSP4_vars.view_yofsenv + DSP4_vars.poly_cx[1][0] - DSP4_vars.world_yofs); - - // SR = 0x80 - - // rasterize line - for (DSP4_vars.lcv = 0; DSP4_vars.lcv < DSP4_vars.segments; DSP4_vars.lcv++) - { - // 1. HDMA memory pointer - // 2. vertical scroll offset ($210E) - // 3. horizontal scroll offset ($210D) - - DSP4_WRITE_WORD(DSP4_vars.poly_ptr[0][0]); - DSP4_WRITE_WORD((uint16)((y_scroll + 0x8000) >> 16)); - DSP4_WRITE_WORD((uint16)((x_scroll + 0x8000) >> 16)); - - // update memory address - DSP4_vars.poly_ptr[0][0] -= 4; - - // update screen values - x_scroll += px_dx; - y_scroll += py_dy; - } - } - - //////////////////////////////////////////////////// - // Post-update - - // update new viewer (x,y,scroll) to last DSP4_vars.raster line drawn - DSP4_vars.view_x1 = DSP4_vars.view_x2; - DSP4_vars.view_y1 = DSP4_vars.view_y2; - DSP4_vars.view_xofs1 = DSP4_vars.view_xofs2; - DSP4_vars.view_yofs1 = DSP4_vars.view_yofs2; - - // add deltas for projection lines - DSP4_vars.world_dx += SEX78(DSP4_vars.world_ddx); - DSP4_vars.world_dy += SEX78(DSP4_vars.world_ddy); - - // update projection lines - DSP4_vars.world_x += (DSP4_vars.world_dx + DSP4_vars.world_xenv); - DSP4_vars.world_y += DSP4_vars.world_dy; - - // update road turnoff position - DSP4_vars.view_turnoff_x += DSP4_vars.view_turnoff_dx; - - //////////////////////////////////////////////////// - // command check - - // scan next command - DSP4.in_count = 2; - DSP4_WAIT(2) resume2: - - // check for termination - DSP4_vars.distance = DSP4_READ_WORD(); - if (DSP4_vars.distance == -0x8000) - break; - - // road splice - if( (uint16) DSP4_vars.distance == 0x8001 ) - { - DSP4.in_count = 6; - DSP4_WAIT(3) resume3: - - DSP4_vars.distance = DSP4_READ_WORD(); - DSP4_vars.view_turnoff_x = DSP4_READ_WORD(); - DSP4_vars.view_turnoff_dx = DSP4_READ_WORD(); - - // factor in new changes - DSP4_vars.view_x1 += ( DSP4_vars.view_turnoff_x * DSP4_vars.distance >> 15 ); - DSP4_vars.view_xofs1 += ( DSP4_vars.view_turnoff_x * DSP4_vars.distance >> 15 ); - - // update stepping values - DSP4_vars.view_turnoff_x += DSP4_vars.view_turnoff_dx; - - DSP4.in_count = 2; - DSP4_WAIT(2) - } - - // already have 2 bytes in queue - DSP4.in_count = 6; - DSP4_WAIT(4) resume4 : - - // inspect inputs - DSP4_vars.world_ddy = DSP4_READ_WORD(); - DSP4_vars.world_ddx = DSP4_READ_WORD(); - DSP4_vars.view_yofsenv = DSP4_READ_WORD(); - - // no envelope here - DSP4_vars.world_xenv = 0; - } - while (1); - - // terminate op - DSP4.waiting4command = TRUE; -} - -////////////////////////////////////////////////////////////// - - -void DSP4_OP10() -{ - DSP4.waiting4command = FALSE; - - // op flow control - switch (DSP4_vars.DSP4_Logic) - { - case 1: - goto resume1; break; - case 2: - goto resume2; break; - case 3: - goto resume3; break; - } - - //////////////////////////////////////////////////// - // sort inputs - - DSP4_READ_WORD(); // 0x0000 - DSP4_vars.world_y = DSP4_READ_DWORD(); - DSP4_vars.poly_bottom[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_top[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_cx[1][0] = DSP4_READ_WORD(); - DSP4_vars.viewport_bottom = DSP4_READ_WORD(); - DSP4_vars.world_x = DSP4_READ_DWORD(); - DSP4_vars.poly_cx[0][0] = DSP4_READ_WORD(); - DSP4_vars.poly_ptr[0][0] = DSP4_READ_WORD(); - DSP4_vars.world_yofs = DSP4_READ_WORD(); - DSP4_vars.distance = DSP4_READ_WORD(); - DSP4_vars.view_y2 = DSP4_READ_WORD(); - DSP4_vars.view_dy = DSP4_READ_WORD() * DSP4_vars.distance >> 15; - DSP4_vars.view_x2 = DSP4_READ_WORD(); - DSP4_vars.view_dx = DSP4_READ_WORD() * DSP4_vars.distance >> 15; - DSP4_vars.view_yofsenv = DSP4_READ_WORD(); - - // initial (x,y,offset) at starting DSP4_vars.raster line - DSP4_vars.view_x1 = (int16)(DSP4_vars.world_x >> 16); - DSP4_vars.view_y1 = (int16)(DSP4_vars.world_y >> 16); - DSP4_vars.view_xofs1 = DSP4_vars.view_x1; - DSP4_vars.view_yofs1 = DSP4_vars.world_yofs; - - // first DSP4_vars.raster line - DSP4_vars.poly_raster[0][0] = DSP4_vars.poly_bottom[0][0]; - - do - { - //////////////////////////////////////////////////// - // process one iteration of projection - - // add shaping - DSP4_vars.view_x2 += DSP4_vars.view_dx; - DSP4_vars.view_y2 += DSP4_vars.view_dy; - - // vertical scroll calculation - DSP4_vars.view_xofs2 = DSP4_vars.view_x2; - DSP4_vars.view_yofs2 = (DSP4_vars.world_yofs * DSP4_vars.distance >> 15) + DSP4_vars.poly_bottom[0][0] - DSP4_vars.view_y2; - - // 1. Viewer x-position at the next - // 2. Viewer y-position below the horizon - // 3. Number of DSP4_vars.raster lines drawn in this iteration - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD(DSP4_vars.view_x2); - DSP4_WRITE_WORD(DSP4_vars.view_y2); - - ////////////////////////////////////////////////////// - - // SR = 0x00 - - // determine # of DSP4_vars.raster lines used - DSP4_vars.segments = DSP4_vars.view_y1 - DSP4_vars.view_y2; - - // prevent overdraw - if (DSP4_vars.view_y2 >= DSP4_vars.poly_raster[0][0]) - DSP4_vars.segments = 0; - else - DSP4_vars.poly_raster[0][0] = DSP4_vars.view_y2; - - // don't draw outside the window - if (DSP4_vars.view_y2 < DSP4_vars.poly_top[0][0]) - { - DSP4_vars.segments = 0; - - // flush remaining DSP4_vars.raster lines - if (DSP4_vars.view_y1 >= DSP4_vars.poly_top[0][0]) - DSP4_vars.segments = DSP4_vars.view_y1 - DSP4_vars.poly_top[0][0]; - } - - // SR = 0x80 - - DSP4_WRITE_WORD(DSP4_vars.segments); - - ////////////////////////////////////////////////////// - - // scan next command if no SR check needed - if (DSP4_vars.segments) - { - for (DSP4_vars.lcv = 0; DSP4_vars.lcv < 4; DSP4_vars.lcv++) - { - // grab inputs - DSP4.in_count = 4; - DSP4_WAIT(1); - resume1 : - for (;;) - { - int16 distance; - int16 color, red, green, blue; - - distance = DSP4_READ_WORD(); - color = DSP4_READ_WORD(); - - // U1+B5+G5+R5 - red = color & 0x1f; - green = (color >> 5) & 0x1f; - blue = (color >> 10) & 0x1f; - - // dynamic lighting - red = (red * distance >> 15) & 0x1f; - green = (green * distance >> 15) & 0x1f; - blue = (blue * distance >> 15) & 0x1f; - color = red | (green << 5) | (blue << 10); - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD(color); - break; - } - } - } - - ////////////////////////////////////////////////////// - - // scan next command if no SR check needed - if (DSP4_vars.segments) - { - int32 px_dx, py_dy; - int32 x_scroll, y_scroll; - - // SR = 0x00 - - // linear interpolation (lerp) between projected points - px_dx = (DSP4_vars.view_xofs2 - DSP4_vars.view_xofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - py_dy = (DSP4_vars.view_yofs2 - DSP4_vars.view_yofs1) * DSP4_Inverse(DSP4_vars.segments) << 1; - - // starting step values - x_scroll = SEX16(DSP4_vars.poly_cx[0][0] + DSP4_vars.view_xofs1); - y_scroll = SEX16(-DSP4_vars.viewport_bottom + DSP4_vars.view_yofs1 + DSP4_vars.view_yofsenv + DSP4_vars.poly_cx[1][0] - DSP4_vars.world_yofs); - - // SR = 0x80 - - // rasterize line - for (DSP4_vars.lcv = 0; DSP4_vars.lcv < DSP4_vars.segments; DSP4_vars.lcv++) - { - // 1. HDMA memory pointer (bg2) - // 2. vertical scroll offset ($2110) - // 3. horizontal scroll offset ($210F) - - DSP4_WRITE_WORD(DSP4_vars.poly_ptr[0][0]); - DSP4_WRITE_WORD((uint16)((y_scroll + 0x8000) >> 16)); - DSP4_WRITE_WORD((uint16)((x_scroll + 0x8000) >> 16)); - - // update memory address - DSP4_vars.poly_ptr[0][0] -= 4; - - // update screen values - x_scroll += px_dx; - y_scroll += py_dy; - } - } - - ///////////////////////////////////////////////////// - // Post-update - - // update new viewer (x,y,scroll) to last DSP4_vars.raster line drawn - DSP4_vars.view_x1 = DSP4_vars.view_x2; - DSP4_vars.view_y1 = DSP4_vars.view_y2; - DSP4_vars.view_xofs1 = DSP4_vars.view_xofs2; - DSP4_vars.view_yofs1 = DSP4_vars.view_yofs2; - - //////////////////////////////////////////////////// - // command check - - // scan next command - DSP4.in_count = 2; - DSP4_WAIT(2) resume2 : - - // check for opcode termination - DSP4_vars.distance = DSP4_READ_WORD(); - if (DSP4_vars.distance == -0x8000) - break; - - // already have 2 bytes in queue - DSP4.in_count = 10; - DSP4_WAIT(3) resume3 : - - - // inspect inputs - DSP4_vars.view_y2 = DSP4_READ_WORD(); - DSP4_vars.view_dy = DSP4_READ_WORD() * DSP4_vars.distance >> 15; - DSP4_vars.view_x2 = DSP4_READ_WORD(); - DSP4_vars.view_dx = DSP4_READ_WORD() * DSP4_vars.distance >> 15; - } - while (1); - - DSP4.waiting4command = TRUE; -} - -////////////////////////////////////////////////////////////// - -void DSP4_OP11(int16 A, int16 B, int16 C, int16 D, int16 *M) -{ - // 0x155 = 341 = Horizontal Width of the Screen - *M = ((A * 0x0155 >> 2) & 0xf000) | - ((B * 0x0155 >> 6) & 0x0f00) | - ((C * 0x0155 >> 10) & 0x00f0) | - ((D * 0x0155 >> 14) & 0x000f); -} - - - - - -///////////////////////////////////////////////////////////// -//Processing Code -///////////////////////////////////////////////////////////// -uint8 dsp4_byte; -uint16 dsp4_address; - -void InitDSP4() -{ - memset(&DSP4, 0, sizeof(DSP4)); - DSP4.waiting4command = TRUE; -} - -void DSP4SetByte() -{ - // clear pending read - if (DSP4.out_index < DSP4.out_count) - { - DSP4.out_index++; - return; - } - - if (DSP4.waiting4command) - { - if (DSP4.half_command) - { - DSP4.command |= (dsp4_byte << 8); - DSP4.in_index = 0; - DSP4.waiting4command = FALSE; - DSP4.half_command = FALSE; - DSP4.out_count = 0; - DSP4.out_index = 0; - - DSP4_vars.DSP4_Logic = 0; - - - switch (DSP4.command) - { - case 0x0000: - DSP4.in_count = 4; break; - case 0x0001: - DSP4.in_count = 44; break; - case 0x0003: - DSP4.in_count = 0; break; - case 0x0005: - DSP4.in_count = 0; break; - case 0x0006: - DSP4.in_count = 0; break; - case 0x0007: - DSP4.in_count = 34; break; - case 0x0008: - DSP4.in_count = 90; break; - case 0x0009: - DSP4.in_count = 14; break; - case 0x000a: - DSP4.in_count = 6; break; - case 0x000b: - DSP4.in_count = 6; break; - case 0x000d: - DSP4.in_count = 42; break; - case 0x000e: - DSP4.in_count = 0; break; - case 0x000f: - DSP4.in_count = 46; break; - case 0x0010: - DSP4.in_count = 36; break; - case 0x0011: - DSP4.in_count = 8; break; - default: - DSP4.waiting4command = TRUE; - break; - } - } - else - { - DSP4.command = dsp4_byte; - DSP4.half_command = TRUE; - } - } - else - { - DSP4.parameters[DSP4.in_index] = dsp4_byte; - DSP4.in_index++; - } - - if (!DSP4.waiting4command && DSP4.in_count == DSP4.in_index) - { - // Actually execute the command - DSP4.waiting4command = TRUE; - DSP4.out_index = 0; - DSP4.in_index = 0; - - switch (DSP4.command) - { - // 16-bit multiplication - case 0x0000: - { - int16 multiplier, multiplicand; - int32 product; - - multiplier = DSP4_READ_WORD(); - multiplicand = DSP4_READ_WORD(); - - DSP4_Multiply(multiplicand, multiplier, &product); - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD((uint16)(product)); - DSP4_WRITE_WORD((uint16)(product >> 16)); - } - break; - - // single-player track projection - case 0x0001: - DSP4_OP01(); break; - - // single-player selection - case 0x0003: - DSP4_OP03(); break; - - // clear OAM - case 0x0005: - DSP4_OP05(); break; - - // transfer OAM - case 0x0006: - DSP4_OP06(); break; - - // single-player track turnoff projection - case 0x0007: - DSP4_OP07(); break; - - // solid polygon projection - case 0x0008: - DSP4_OP08(); break; - - // sprite projection - case 0x0009: - DSP4_OP09(); break; - - // unknown - case 0x000A: - { - //int16 in1a = DSP4_READ_WORD(); - int16 in2a = DSP4_READ_WORD(); - //int16 in3a = DSP4_READ_WORD(); - int16 out1a, out2a, out3a, out4a; - - DSP4_OP0A(in2a, &out2a, &out1a, &out4a, &out3a); - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD(out1a); - DSP4_WRITE_WORD(out2a); - DSP4_WRITE_WORD(out3a); - DSP4_WRITE_WORD(out4a); - } - break; - - // set OAM - case 0x000B: - { - int16 sp_x = DSP4_READ_WORD(); - int16 sp_y = DSP4_READ_WORD(); - int16 sp_attr = DSP4_READ_WORD(); - bool8 draw = 1; - - DSP4_CLEAR_OUT(); - - DSP4_OP0B(&draw, sp_x, sp_y, sp_attr, 0, 1); - } - break; - - // multi-player track projection - case 0x000D: - DSP4_OP0D(); break; - - // multi-player selection - case 0x000E: - DSP4_OP0E(); break; - - // single-player track projection with lighting - case 0x000F: - DSP4_OP0F(); break; - - // single-player track turnoff projection with lighting - case 0x0010: - DSP4_OP10(); break; - - // unknown: horizontal mapping command - case 0x0011: - { - int16 a, b, c, d, m; - - - d = DSP4_READ_WORD(); - c = DSP4_READ_WORD(); - b = DSP4_READ_WORD(); - a = DSP4_READ_WORD(); - - DSP4_OP11(a, b, c, d, &m); - - DSP4_CLEAR_OUT(); - DSP4_WRITE_WORD(m); - - break; - } - - default: - break; - } - } -} - -void DSP4GetByte() -{ - if (DSP4.out_count) - { - dsp4_byte = (uint8) DSP4.output[DSP4.out_index&0x1FF]; - DSP4.out_index++; - if (DSP4.out_count == DSP4.out_index) - DSP4.out_count = 0; - } - else - { - dsp4_byte = 0xff; - } -} diff --git a/tools/zsnes/src/chips/dsp4emu.h b/tools/zsnes/src/chips/dsp4emu.h deleted file mode 100644 index 594cfb0..0000000 --- a/tools/zsnes/src/chips/dsp4emu.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef DSP4EMU_H -#define DSP4EMU_H - -typedef unsigned char bool8; -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef char int8; -typedef short int16; -typedef long int32; -#define FALSE 0 -#define TRUE 1 - - -struct DSP4_t -{ - bool8 waiting4command; - bool8 half_command; - uint16 command; - uint32 in_count; - uint32 in_index; - uint32 out_count; - uint32 out_index; - uint8 parameters[512]; - uint8 output[512]; -}; - -extern struct DSP4_t DSP4; - -struct DSP4_vars_t -{ - // op control - int8 DSP4_Logic; // controls op flow - - - // projection format - int16 lcv; // loop-control variable - int16 distance; // z-position into virtual world - int16 raster; // current raster line - int16 segments; // number of raster lines drawn - - // 1.15.16 or 1.15.0 [sign, integer, fraction] - int32 world_x; // line of x-projection in world - int32 world_y; // line of y-projection in world - int32 world_dx; // projection line x-delta - int32 world_dy; // projection line y-delta - int16 world_ddx; // x-delta increment - int16 world_ddy; // y-delta increment - int32 world_xenv; // world x-shaping factor - int16 world_yofs; // world y-vertical scroll - - int16 view_x1; // current viewer-x - int16 view_y1; // current viewer-y - int16 view_x2; // future viewer-x - int16 view_y2; // future viewer-y - int16 view_dx; // view x-delta factor - int16 view_dy; // view y-delta factor - int16 view_xofs1; // current viewer x-vertical scroll - int16 view_yofs1; // current viewer y-vertical scroll - int16 view_xofs2; // future viewer x-vertical scroll - int16 view_yofs2; // future viewer y-vertical scroll - int16 view_yofsenv; // y-scroll shaping factor - int16 view_turnoff_x; // road turnoff data - int16 view_turnoff_dx; // road turnoff delta factor - - - // drawing area - - int16 viewport_cx; // x-center of viewport window - int16 viewport_cy; // y-center of render window - int16 viewport_left; // x-left of viewport - int16 viewport_right; // x-right of viewport - int16 viewport_top; // y-top of viewport - int16 viewport_bottom; // y-bottom of viewport - - - // sprite structure - - int16 sprite_x; // projected x-pos of sprite - int16 sprite_y; // projected y-pos of sprite - int16 sprite_attr; // obj attributes - bool8 sprite_size; // sprite size: 8x8 or 16x16 - int16 sprite_clipy; // visible line to clip pixels off - int16 sprite_count; - - // generic projection variables designed for - // two solid polygons + two polygon sides - - int16 poly_clipLf[2][2]; // left clip boundary - int16 poly_clipRt[2][2]; // right clip boundary - int16 poly_ptr[2][2]; // HDMA structure pointers - int16 poly_raster[2][2]; // current raster line below horizon - int16 poly_top[2][2]; // top clip boundary - int16 poly_bottom[2][2]; // bottom clip boundary - int16 poly_cx[2][2]; // center for left/right points - int16 poly_start[2]; // current projection points - int16 poly_plane[2]; // previous z-plane distance - - - // OAM - int16 OAM_attr[16]; // OAM (size,MSB) data - int16 OAM_index; // index into OAM table - int16 OAM_bits; // offset into OAM table - - int16 OAM_RowMax; // maximum number of tiles per 8 aligned pixels (row) - int16 OAM_Row[32]; // current number of tiles per row -}; - -extern struct DSP4_vars_t DSP4_vars; - -#endif diff --git a/tools/zsnes/src/chips/dsp4proc.asm b/tools/zsnes/src/chips/dsp4proc.asm deleted file mode 100644 index e326604..0000000 --- a/tools/zsnes/src/chips/dsp4proc.asm +++ /dev/null @@ -1,83 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 dsp4_address,dsp4_byte,DSP4GetByte,DSP4SetByte -EXTSYM regaccessbankr16,regaccessbankr8,regaccessbankw16,regaccessbankw8 - -SECTION .text - -%macro RouteAccess 1 - test ecx,8000h - jz %1 - test ecx,4000h - jz .dsp4continue - ret -.dsp4continue -%endmacro - -NEWSYM DSP4Read8b - RouteAccess regaccessbankr8 - mov [dsp4_address],cx - pushad - call DSP4GetByte - popad - mov al,[dsp4_byte] - ret - -NEWSYM DSP4Write8b - RouteAccess regaccessbankw8 - mov [dsp4_address],cx - mov [dsp4_byte],al - pushad - call DSP4SetByte - popad - ret - -NEWSYM DSP4Read16b - RouteAccess regaccessbankr16 - mov [dsp4_address],cx - pushad - call DSP4GetByte - mov al,[dsp4_byte] - mov [dsp4temp],al - inc word[dsp4_address] - call DSP4GetByte - popad - mov al,[dsp4temp] - mov ah,[dsp4_byte] - ret - -NEWSYM DSP4Write16b - RouteAccess regaccessbankw16 - mov [dsp4_address],cx - mov [dsp4_byte],al - mov [dsp4temp],ah - pushad - call DSP4SetByte - mov ah,[dsp4temp] - mov [dsp4_byte],ah - inc word[dsp4_address] - call DSP4SetByte - popad - ret - -SECTION .bss -NEWSYM dsp4temp, resb 1 diff --git a/tools/zsnes/src/chips/fxemu2.asm b/tools/zsnes/src/chips/fxemu2.asm deleted file mode 100644 index c670152..0000000 --- a/tools/zsnes/src/chips/fxemu2.asm +++ /dev/null @@ -1,2686 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -%include "macros.mac" - -EXTSYM FxTable,FxTableb,FxTablec,FxTabled,SfxMemTable,flagnz,fxbit01,fxbit23 -EXTSYM fxxand,sfx128lineloc,sfx160lineloc,sfx192lineloc,sfxobjlineloc -EXTSYM sfxramdata,fxbit45,fxbit67,SFXProc,ChangeOps,PLOTJmpa,PLOTJmpb - -%include "chips/fxemu2.mac" - -; * Optimise PLOT, COLOR! -SECTION .text -NEWSYM FlushCache - ; Copy 512 bytes from pb:eax to SfxCACHERAM - ret - -SECTION .bss -NEWSYM tempsfx, resb 3 - -SECTION .data - -; FxChip emulation by _Demo_ -; Optimised by zsKnight -; based on fxemu by lestat - -NEWSYM SfxR0, dd 0 ; default source/destination register -NEWSYM SfxR1, dd 0 ; pixel plot X position register -NEWSYM SfxR2, dd 0 ; pixel plot Y position register -NEWSYM SfxR3, dd 0 ; -NEWSYM SfxR4, dd 0 ; lower 16 bit result of lmult -NEWSYM SfxR5, dd 0 ; -NEWSYM SfxR6, dd 0 ; multiplier for fmult and lmult -NEWSYM SfxR7, dd 0 ; fixed point texel X position for merge -NEWSYM SfxR8, dd 0 ; fixed point texel Y position for merge -NEWSYM SfxR9, dd 0 ; -NEWSYM SfxR10, dd 0 ; -NEWSYM SfxR11, dd 0 ; return address set by link -NEWSYM SfxR12, dd 0 ; loop counter -NEWSYM SfxR13, dd 0 ; loop point address -NEWSYM SfxR14, dd 0 ; rom address for getb, getbh, getbl, getbs -NEWSYM SfxR15, dd 0 ; program counter - -NEWSYM SfxSFR, dd 0 ; status flag register (16bit) -;SFR status flag register bits: -; 0 - -; 1 Z Zero flag -; 2 CY Carry flag -; 3 S Sign flag -; 4 OV Overflow flag -; 5 G Go flag (set to 1 when the GSU is running) -; 6 R Set to 1 when reading ROM using R14 address -; 7 - -; 8 ALT1 Mode set-up flag for the next instruction -; 9 ALT2 Mode set-up flag for the next instruction -;10 IL Immediate lower 8-bit flag -;11 IH Immediate higher 8-bit flag -;12 B Set to 1 when the WITH instruction is executed -;13 - -;14 - -;15 IRQ Set to 1 when GSU caused an interrupt -; Set to 0 when read by 658c16 - -NEWSYM SfxBRAMR, dd 0 ; backup ram read only on/off (8bit) -NEWSYM SfxPBR, dd 0 ; program bank register (8bit) -NEWSYM SfxROMBR, dd 0 ; rom bank register (8bit) -NEWSYM SfxCFGR, dd 0 ; control flags register (8bit) -NEWSYM SfxSCBR, dd 0 ; screen bank register (8bit) -NEWSYM SfxCLSR, dd 0 ; clock speed register (8bit) -NEWSYM SfxSCMR, dd 0 ; screen mode register (8bit) -NEWSYM SfxVCR, dd 0 ; version code register (8bit) -NEWSYM SfxRAMBR, dd 0 ; ram bank register (8bit) -NEWSYM SfxCBR, dd 0 ; cache base register (16bit) - -NEWSYM SfxCOLR, dd 0 ; Internal color register -NEWSYM SfxPOR, dd 0 ; Plot option register - -NEWSYM SfxCacheFlags, dd 0 ; Saying what parts of the cache was written to -NEWSYM SfxLastRamAdr, dd 0 ; Last RAM address accessed -NEWSYM SfxDREG, dd 0 ; Current destination register index -NEWSYM SfxSREG, dd 0 ; Current source register index -NEWSYM SfxRomBuffer, dd 0 ; Current byte read by R14 -NEWSYM SfxPIPE, dd 0 ; Instructionset pipe -NEWSYM SfxPipeAdr, dd 0 ; The address of where the pipe was read from - -NEWSYM SfxnRamBanks, dd 4 ; Number of 64kb-banks in FxRam (Don't confuse it with SNES-Ram!!!) -NEWSYM SfxnRomBanks, dd 0 ; Number of 32kb-banks in Cart-ROM - -NEWSYM SfxvScreenHeight, dd 0 ; 128, 160 or 192 -NEWSYM SfxvScreenSize, dd 0 - -NEWSYM SfxCacheActive, dd 0 ; Cache Active - -NEWSYM SfxCarry, dd 0 ; Carry flag -NEWSYM SfxSignZero, dd 0 ; Sign and Zero flag -NEWSYM SfxB, dd 0 ; B flag (1 when with instruction executed) -NEWSYM SfxOverflow, dd 0 ; Overflow flag - -NEWSYM SfxCACHERAM, times 512 db 0 ; 512 bytes of GSU cache memory -num2writesfxreg equ $-SfxR0 -; pharos equ hack *sigh* -NEWSYM PHnum2writesfxreg, dd num2writesfxreg - -NEWSYM SfxCPB, dd 0 -NEWSYM SfxCROM, dd 0 -NEWSYM SfxRAMMem, dd 0 -NEWSYM withr15sk, dd 0 -NEWSYM sfxclineloc, dd 0 -NEWSYM SCBRrel, dd 0 -NEWSYM fxbit01pcal, dd 0 -NEWSYM fxbit23pcal, dd 0 -NEWSYM fxbit45pcal, dd 0 -NEWSYM fxbit67pcal, dd 0 - -;SfxRAM times 256*1024 db 0 - -; If we need this later... - -SECTION .text -NEWSYM FxOp00 ; STOP stop GSU execution (and maybe generate an IRQ) ; Verified. - FETCHPIPE - mov [SfxPIPE],cl - and dword[SfxSFR],0FFFFh-32 ; Clear Go flag (set to 1 when the GSU is running) - test dword[SfxCFGR],080h ; Check if the interrupt generation is on - jnz .NoIRQ - or dword[SfxSFR],08000h ; Set IRQ Flag -.NoIRQ - CLRFLAGS - inc ebp - mov eax,[NumberOfOpcodes] - add eax,0F0000000h - add [ChangeOps],eax - mov dword[NumberOfOpcodes],1 - mov dword[SFXProc],0 - xor cl,cl - ret - -NEWSYM FxOp01 ; NOP no operation ; Verified. - FETCHPIPE - CLRFLAGS - inc ebp ; Increase program counter - ret - -NEWSYM FxOp02 ; CACHE reintialize GSU cache - mov eax,ebp - FETCHPIPE - sub eax,[SfxCPB] - and eax,0FFF0h - cmp dword[SfxCBR],eax - je .SkipUpdate - cmp byte[SfxCacheActive],1 - je .SkipUpdate - mov [SfxCBR],eax - mov dword[SfxCacheActive],1 - call FlushCache -.SkipUpdate - CLRFLAGS - inc ebp ; Increase program counter - ret - -NEWSYM FxOp03 ; LSR logic shift right ; Verified. - mov eax,[esi] ; Read Source - FETCHPIPE - mov [SfxCarry],al - and byte[SfxCarry],1 - shr ax,1 ; logic shift right - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOp04 ; ROL rotate left (RCL?) ; V - shr byte[SfxCarry],1 - mov eax,[esi] ; Read Source - FETCHPIPE - rcl ax,1 - rcl byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOp05 ; BRA branch always ; Verified. - movsx eax,byte[ebp] - mov cl,[ebp+1] - inc ebp - add ebp,eax - call [FxTable+ecx*4] - ret - -NEWSYM FxOp06 ; BGE branch on greater or equals ; Verified. - movsx eax,byte[ebp] - mov ebx,[SfxSignZero] - shr ebx,15 - inc ebp - xor bl,[SfxOverflow] - mov cl,[ebp] - test bl,01h - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp07 ; BLT branch on lesss than ; Verified. - movsx eax,byte[ebp] - mov ebx,[SfxSignZero] - shr ebx,15 - inc ebp - xor bl,[SfxOverflow] - mov cl,[ebp] - test bl,01h - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp08 ; BNE branch on not equal ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],0FFFFh - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp09 ; BEQ branch on equal (z=1) ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],0FFFFh - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp0A ; BPL branch on plus ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],088000h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp0B ; BMI branch on minus ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],088000h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp0C ; BCC branch on carry clear ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxCarry],01h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp0D ; BCS branch on carry set ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxCarry],01h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp0E ; BVC branch on overflow clear ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxOverflow],01h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp0F ; BVS branch on overflow set ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxOverflow],01h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - ret -.nojump - inc ebp - call [FxTable+ecx*4] - ret - -NEWSYM FxOp10 ; TO RN set register n as destination register - TORN 0 -NEWSYM FxOp11 ; TO RN set register n as destination register - TORN 1 -NEWSYM FxOp12 ; TO RN set register n as destination register - TORN 2 -NEWSYM FxOp13 ; TO RN set register n as destination register - TORN 3 -NEWSYM FxOp14 ; TO RN set register n as destination register - TORN 4 -NEWSYM FxOp15 ; TO RN set register n as destination register - TORN 5 -NEWSYM FxOp16 ; TO RN set register n as destination register - TORN 6 -NEWSYM FxOp17 ; TO RN set register n as destination register - TORN 7 -NEWSYM FxOp18 ; TO RN set register n as destination register - TORN 8 -NEWSYM FxOp19 ; TO RN set register n as destination register - TORN 9 -NEWSYM FxOp1A ; TO RN set register n as destination register - TORN 10 -NEWSYM FxOp1B ; TO RN set register n as destination register - TORN 11 -NEWSYM FxOp1C ; TO RN set register n as destination register - TORN 12 -NEWSYM FxOp1D ; TO RN set register n as destination register - TORN 13 -NEWSYM FxOp1E ; TO RN set register n as destination register - FETCHPIPE - mov edi,SfxR0+14*4 - inc ebp - call [FxTable+ecx*4] - mov edi,SfxR0 - UpdateR14 - ret -NEWSYM FxOp1F ; TO RN set register n as destination register - FETCHPIPE - mov edi,SfxR0+15*4 - inc ebp - call [FxTable+ecx*4] - mov ebp,[SfxCPB] - add ebp,[SfxR15] - mov edi,SfxR0 - ret - -NEWSYM FxOp20 ; WITH set register n as source and destination register - WITH 0 -NEWSYM FxOp21 ; WITH set register n as source and destination register - WITH 1 -NEWSYM FxOp22 ; WITH set register n as source and destination register - WITH 2 -NEWSYM FxOp23 ; WITH set register n as source and destination register - WITH 3 -NEWSYM FxOp24 ; WITH set register n as source and destination register - WITH 4 -NEWSYM FxOp25 ; WITH set register n as source and destination register - WITH 5 -NEWSYM FxOp26 ; WITH set register n as source and destination register - WITH 6 -NEWSYM FxOp27 ; WITH set register n as source and destination register - WITH 7 -NEWSYM FxOp28 ; WITH set register n as source and destination register - WITH 8 -NEWSYM FxOp29 ; WITH set register n as source and destination register - WITH 9 -NEWSYM FxOp2A ; WITH set register n as source and destination register - WITH 10 -NEWSYM FxOp2B ; WITH set register n as source and destination register - WITH 11 -NEWSYM FxOp2C ; WITH set register n as source and destination register - WITH 12 -NEWSYM FxOp2D ; WITH set register n as source and destination register - WITH 13 -NEWSYM FxOp2E ; WITH set register n as source and destination register - FETCHPIPE - mov esi,SfxR0+14*4 - mov edi,SfxR0+14*4 - mov dword[SfxB],1 - inc ebp - call [FxTablec+ecx*4] - mov dword[SfxB],0 ; Clear B Flag - mov esi,SfxR0 - mov edi,SfxR0 - UpdateR14 - ret -NEWSYM FxOp2F ; WITH set register n as source and destination register - FETCHPIPE - mov esi,SfxR0+15*4 - mov edi,SfxR0+15*4 - mov dword[SfxB],1 - inc ebp - mov eax,ebp - sub eax,[SfxCPB] - mov dword[withr15sk],0 - mov [SfxR15],eax - call [FxTableb+ecx*4] - cmp dword[withr15sk],1 - je .skip - mov ebp,[SfxCPB] - add ebp,[SfxR15] -.skip - mov dword[SfxB],0 ; Clear B Flag - mov esi,SfxR0 - mov edi,SfxR0 - ret - -NEWSYM FxOp30 ; STW RN store word - STWRN 0 -NEWSYM FxOp31 ; STW RN store word - STWRN 1 -NEWSYM FxOp32 ; STW RN store word - STWRN 2 -NEWSYM FxOp33 ; STW RN store word - STWRN 3 -NEWSYM FxOp34 ; STW RN store word - STWRN 4 -NEWSYM FxOp35 ; STW RN store word - STWRN 5 -NEWSYM FxOp36 ; STW RN store word - STWRN 6 -NEWSYM FxOp37 ; STW RN store word - STWRN 7 -NEWSYM FxOp38 ; STW RN store word - STWRN 8 -NEWSYM FxOp39 ; STW RN store word - STWRN 9 -NEWSYM FxOp3A ; STW RN store word - STWRN 10 -NEWSYM FxOp3B ; STW RN store word - STWRN 11 - -NEWSYM FxOp30A1 ; STB RN store byte - STBRN 0 -NEWSYM FxOp31A1 ; STB RN store byte - STBRN 1 -NEWSYM FxOp32A1 ; STB RN store byte - STBRN 2 -NEWSYM FxOp33A1 ; STB RN store byte - STBRN 3 -NEWSYM FxOp34A1 ; STB RN store byte - STBRN 4 -NEWSYM FxOp35A1 ; STB RN store byte - STBRN 5 -NEWSYM FxOp36A1 ; STB RN store byte - STBRN 6 -NEWSYM FxOp37A1 ; STB RN store byte - STBRN 7 -NEWSYM FxOp38A1 ; STB RN store byte - STBRN 8 -NEWSYM FxOp39A1 ; STB RN store byte - STBRN 9 -NEWSYM FxOp3AA1 ; STB RN store byte - STBRN 10 -NEWSYM FxOp3BA1 ; STB RN store byte - STBRN 11 - -NEWSYM FxOp3C ; LOOP decrement loop counter, and branch on not zero ; V - dec word[SfxR12] ; decrement loop counter - FETCHPIPE - mov eax,[SfxR12] - mov [SfxSignZero],eax - or eax,eax - jz .NoBranch - mov eax,[SfxR13] - mov ebp,[SfxCPB] - add ebp,eax - CLRFLAGS - ret -.NoBranch - inc ebp - CLRFLAGS - ret - -NEWSYM FxOp3D ; ALT1 set alt1 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,01h - inc ebp - call [FxTable+ecx*4] - xor ch,ch - ret - -NEWSYM FxOp3E ; ALT2 set alt1 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,02h - inc ebp - call [FxTable+ecx*4] - xor ch,ch - ret - -NEWSYM FxOp3F ; ALT3 set alt3 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,03h - inc ebp - call [FxTable+ecx*4] - xor ch,ch - ret - -NEWSYM FxOp40 ; LDW RN load word from RAM - LDWRN 0 -NEWSYM FxOp41 ; LDW RN load word from RAM - LDWRN 1 -NEWSYM FxOp42 ; LDW RN load word from RAM - LDWRN 2 -NEWSYM FxOp43 ; LDW RN load word from RAM - LDWRN 3 -NEWSYM FxOp44 ; LDW RN load word from RAM - LDWRN 4 -NEWSYM FxOp45 ; LDW RN load word from RAM - LDWRN 5 -NEWSYM FxOp46 ; LDW RN load word from RAM - LDWRN 6 -NEWSYM FxOp47 ; LDW RN load word from RAM - LDWRN 7 -NEWSYM FxOp48 ; LDW RN load word from RAM - LDWRN 8 -NEWSYM FxOp49 ; LDW RN load word from RAM - LDWRN 9 -NEWSYM FxOp4A ; LDW RN load word from RAM - LDWRN 10 -NEWSYM FxOp4B ; LDW RN load word from RAM - LDWRN 11 - -NEWSYM FxOp40A1 ; LDB RN load byte from RAM - LDBRN 0 -NEWSYM FxOp41A1 ; LDB RN load byte from RAM - LDBRN 1 -NEWSYM FxOp42A1 ; LDB RN load byte from RAM - LDBRN 2 -NEWSYM FxOp43A1 ; LDB RN load byte from RAM - LDBRN 3 -NEWSYM FxOp44A1 ; LDB RN load byte from RAM - LDBRN 4 -NEWSYM FxOp45A1 ; LDB RN load byte from RAM - LDBRN 5 -NEWSYM FxOp46A1 ; LDB RN load byte from RAM - LDBRN 6 -NEWSYM FxOp47A1 ; LDB RN load byte from RAM - LDBRN 7 -NEWSYM FxOp48A1 ; LDB RN load byte from RAM - LDBRN 8 -NEWSYM FxOp49A1 ; LDB RN load byte from RAM - LDBRN 9 -NEWSYM FxOp4AA1 ; LDB RN load byte from RAM - LDBRN 10 -NEWSYM FxOp4BA1 ; LDB RN load byte from RAM - LDBRN 11 - -NEWSYM FxOp4C1284b ; PLOT 4bit - plotlines4b plotb -NEWSYM FxOp4C1284bz ; PLOT 4bit, zero check - plotlines4b plotbz -NEWSYM FxOp4C1284bd ; PLOT 4bit, dither - plotlines4b plotbd -NEWSYM FxOp4C1284bzd ; PLOT 4bit, zero check + dither - plotlines4b plotbzd - -NEWSYM FxOp4C1282b ; PLOT 2bit - plotlines2b plotb -NEWSYM FxOp4C1282bz ; PLOT 2bit, zero check - plotlines2b plotbz -NEWSYM FxOp4C1282bd ; PLOT 2bit, dither - plotlines2b plotbd -NEWSYM FxOp4C1282bzd ; PLOT 2bit, zero check + dither - plotlines2b plotbzd - -NEWSYM FxOp4C1288b ; PLOT 8bit - plotlines8b plotb -NEWSYM FxOp4C1288bz ; PLOT 8bit, zero check - plotlines8b plotbz -NEWSYM FxOp4C1288bd ; PLOT 8bit, dither - plotlines8b plotbd -NEWSYM FxOp4C1288bzd ; PLOT 8bit, zero check + dither - plotlines8b plotbzd - -NEWSYM FxOp4C1288bl ; PLOT 8bit - plotlines8bl plotb -NEWSYM FxOp4C1288bzl ; PLOT 8bit, zero check - plotlines8bl plotbz -NEWSYM FxOp4C1288bdl ; PLOT 8bit, dither - plotlines8bl plotbd -NEWSYM FxOp4C1288bzdl ; PLOT 8bit, zero check + dither - plotlines8bl plotbzd - -NEWSYM FxOp4C ; PLOT plot pixel with R1,R2 as x,y and the color register as the color - jmp FxOp4C1284b - FETCHPIPE - inc ebp - CLRFLAGS - mov ebx,[SfxR2] - mov bh,[SfxR1] - mov eax,[sfxclineloc] - mov ebx,[eax+ebx*4] - cmp ebx,0FFFFFFFFh - je near .nodraw - xor eax,eax - ; bits 5/2 : 00 = 128 pixels, 01 = 160 pixels, 10 = 192 pixels, 11 = obj - ; bits 1/0 : 00 = 4 color, 01 = 16-color, 10 = not used, 11 = 256 color - ; 192 pixels = 24 tiles, 160 pixels = 20 tiles, 128 pixels = 16 tiles - ; 16+8(4/3) 16+4(4/2) 16(4/0) - push ecx - mov al,[SfxSCMR] - and al,00000011b ; 4 + 32 - cmp al,0 - je near .colors4 - cmp al,3 - je near .colors256 - - shl ebx,5 ; x32 (16 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - test byte[SfxPOR],01h - jnz .nozerocheck_16 - test byte[SfxCOLR],0Fh - jz .nodraw -.nozerocheck_16 - mov dl,[SfxCOLR] - test byte[SfxPOR],02h - jz .nodither4b - mov dh,[SfxR1] - xor dh,[SfxR2] - test dh,01h - jz .nodither4b - shr dh,4 -.nodither4b - and byte[eax],bh - and byte[eax+1],bh - and byte[eax+16],bh - and byte[eax+17],bh - test dl,01h - jz .nodraw_16 - or byte[eax], bl -.nodraw_16 - test dl,02h - jz .nodraw2_16 - or byte[eax+1], bl -.nodraw2_16 - test dl,04h - jz .nodraw3_16 - or byte[eax+16],bl -.nodraw3_16 - test dl,08h - jz .nodraw4_16 - or byte[eax+17],bl -.nodraw4_16 -.nodraw - inc word[SfxR1] - ret - -.colors4 - shl ebx,4 ; x16 (4 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - test byte[SfxPOR],01h - jnz .nozerocheck_4 - test byte[SfxCOLR],03h - jz .noplot_4 -.nozerocheck_4 - mov dl,[SfxCOLR] - test byte[SfxPOR],02h - jz .nodither2b - mov dh,[SfxR1] - xor dh,[SfxR2] - test dh,01h - jz .nodither2b - shr dh,4 -.nodither2b - and byte[eax],bh - and byte[eax+1],bh - test dl,01h - jz .nodraw_4 - or byte[eax], bl -.nodraw_4 - test dl,02h - jz .nodraw2_4 - or byte[eax+1], bl -.nodraw2_4 -.noplot_4 - inc word[SfxR1] - ret - -.colors256 - shl ebx,6 ; x64 (256 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - test byte[SfxPOR],01h - jnz .nozerocheck_256 - mov dl,0FFh - test byte[SfxPOR],08h - jz .nozerocheckb_256 - mov dl,0Fh -.nozerocheckb_256 - test byte[SfxCOLR],dl - jz .noplot_256 -.nozerocheck_256 - mov dl,[SfxCOLR] - and byte[eax],bh - and byte[eax+1],bh - and byte[eax+16],bh - and byte[eax+17],bh - and byte[eax+32],bh - and byte[eax+33],bh - and byte[eax+48],bh - and byte[eax+49],bh - test dl,01h - jz .nodraw_256 - or byte[eax], bl -.nodraw_256 - test dl,02h - jz .nodraw2_256 - or byte[eax+1], bl -.nodraw2_256 - test dl,04h - jz .nodraw3_256 - or byte[eax+16],bl -.nodraw3_256 - test dl,08h - jz .nodraw4_256 - or byte[eax+17],bl -.nodraw4_256 - test dl,10h - jz .nodraw5_256 - or byte[eax+32], bl -.nodraw5_256 - test dl,20h - jz .nodraw6_256 - or byte[eax+33], bl -.nodraw6_256 - test dl,40h - jz .nodraw7_256 - or byte[eax+48],bl -.nodraw7_256 - test dl,80h - jz .nodraw8_256 - or byte[eax+49],bl -.nodraw8_256 -.noplot_256 - inc word[SfxR1] - ret - -SECTION .bss -.prevx resw 1 -.prevy resw 1 - -sfxwarning resb 1 - -SECTION .text - -NEWSYM FxOp4CA1 ; RPIX read color of the pixel with R1,R2 as x,y - FETCHPIPE - mov ebx,[SfxR2] - mov bh,[SfxR1] - test byte[SfxPOR],10h - jnz .objmode - mov al,[SfxSCMR] - and al,00100100b ; 4 + 32 - cmp al,4 - je .lines160 - cmp al,32 - je .lines192 - cmp al,36 - je .objmode - mov eax,[sfx128lineloc] - jmp .donelines -.lines160 - mov eax,[sfx160lineloc] - jmp .donelines -.lines192 - mov eax,[sfx192lineloc] - jmp .donelines -.objmode - mov eax,[sfxobjlineloc] -.donelines - mov ebx,[eax+ebx*4] - cmp ebx,0FFFFFFFFh - je .nodraw - xor eax,eax - ; bits 5/2 : 00 = 128 pixels, 01 = 160 pixels, 10 = 192 pixels, 11 = obj - ; bits 1/0 : 00 = 4 color, 01 = 16-color, 10 = not used, 11 = 256 color - ; 192 pixels = 24 tiles, 160 pixels = 20 tiles, 128 pixels = 16 tiles - ; 16+8(4/3) 16+4(4/2) 16(4/0) - push ecx - mov al,[SfxSCMR] - and al,00000011b ; 4 + 32 - - cmp al,0 - je .colors4 - cmp al,3 - je near .colors256 - - shl ebx,5 ; x32 (16 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - pop ecx - xor bh,bh - test byte[eax],bl - jz .nodraw_16 - or bh,01h -.nodraw_16 - test byte[eax+1],bl - jz .nodraw2_16 - or bh,02h -.nodraw2_16 - test byte[eax+16],bl - jz .nodraw3_16 - or bh,04h -.nodraw3_16 - test byte[eax+17],bl - jz .nodraw4_16 - or bh,08h -.nodraw4_16 -.nodraw - mov bl,bh - and ebx,0FFh - inc ebp -; UpdateR14 - CLRFLAGS - mov [edi],ebx ; Write Destination - mov [flagnz],ebx - ret - -.colors4 - shl ebx,4 ; x16 (4 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - xor bh,bh - test byte[eax],bl - jz .nodraw_4 - or bh,01h -.nodraw_4 - test byte[eax+1],bl - jz .nodraw2_4 - or bh,02h -.nodraw2_4 - mov bl,bh - and ebx,0FFh - inc ebp -; UpdateR14 - CLRFLAGS - mov [edi],ebx ; Write Destination - mov [flagnz],ebx - ret - -.colors256 - shl ebx,6 ; x64 (256 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - xor bh,bh - test byte[eax],bl - jz .nodraw_256 - or bh,01h -.nodraw_256 - test byte[eax+1],bl - jz .nodraw2_256 - or bh,02h -.nodraw2_256 - test byte[eax+16],bl - jz .nodraw3_256 - or bh,04h -.nodraw3_256 - test byte[eax+17],bl - jz .nodraw4_256 - or bh,08h -.nodraw4_256 - test byte[eax+32],bl - jz .nodraw5_256 - or bh,10h -.nodraw5_256 - test byte[eax+33],bl - jz .nodraw6_256 - or bh,20h -.nodraw6_256 - test byte[eax+48],bl - jz .nodraw7_256 - or bh,40h -.nodraw7_256 - test byte[eax+49],bl - jz .nodraw8_256 - or bh,80h -.nodraw8_256 - mov bl,bh - and ebx,0FFh - inc ebp -; UpdateR14 - CLRFLAGS - mov [edi],ebx ; Write Destination - mov [flagnz],ebx - ret - -NEWSYM FxOp4D ; SWAP swap upper and lower byte of a register ; V - mov eax,[esi] ; Read Source - FETCHPIPE - ror ax,8 - inc ebp ; Increase program counter - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret - -NEWSYM FxOp4E ; COLOR copy source register to color register ; V - FETCHPIPE - mov eax,[esi] ; Read Source - ; if bit 3 of SfxPOR is set, then don't modify the upper 4 bits - test byte[SfxPOR],04h - jz .nohighnibble - mov bl,al - shr bl,4 - and al,0F0h - or al,bl -.nohighnibble - test byte[SfxPOR],08h - jnz .preserveupper - cmp [SfxCOLR],al - je .nocolchange - mov [SfxCOLR],al - and eax,0FFh - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx -.nocolchange - CLRFLAGS - inc ebp ; Increase program counter - ret -.preserveupper - mov bl,[SfxCOLR] - and al,0Fh - and bl,0F0h - or al,bl - cmp [SfxCOLR],al - je .nocolchange - mov [SfxCOLR],al - and eax,0FFh - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx - CLRFLAGS - inc ebp ; Increase program counter - ret - -NEWSYM FxOp4EA1 ; CMODE set plot option register ; V - FETCHPIPE - mov eax,[esi] ; Read Source - inc ebp ; Increase program counter - mov [SfxPOR],eax - - test byte[SfxPOR],10h - jnz .objmode - mov al,[SfxSCMR] - and al,00100100b ; 4 + 32 - cmp al,4 - je .lines160 - cmp al,32 - je .lines192 - cmp al,36 - je .objmode - mov eax,[sfx128lineloc] - jmp .donelines -.lines160 - mov eax,[sfx160lineloc] - jmp .donelines -.lines192 - mov eax,[sfx192lineloc] - jmp .donelines -.objmode - mov eax,[sfxobjlineloc] -.donelines - mov [sfxclineloc],eax - - - push ebx - mov al,[SfxSCMR] - and eax,00000011b - mov bl,[SfxPOR] - and bl,0Fh - shl bl,2 - or al,bl - mov ebx,[PLOTJmpb+eax*4] - mov eax,[PLOTJmpa+eax*4] - mov [FxTable+4Ch*4],eax - mov [FxTableb+4Ch*4],eax - mov [FxTablec+4Ch*4],eax - mov [FxTabled+4Ch*4],ebx - pop ebx - - CLRFLAGS - ret - -NEWSYM FxOp4F ; NOT perform exclusive exor with 1 on all bits ; V - mov eax,[esi] ; Read Source - FETCHPIPE - xor eax,0FFFFh - inc ebp ; Increase program counter - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret - -NEWSYM FxOp50 ; ADD RN add, register + register - ADDRN 0 -NEWSYM FxOp51 ; ADD RN add, register + register - ADDRN 1 -NEWSYM FxOp52 ; ADD RN add, register + register - ADDRN 2 -NEWSYM FxOp53 ; ADD RN add, register + register - ADDRN 3 -NEWSYM FxOp54 ; ADD RN add, register + register - ADDRN 4 -NEWSYM FxOp55 ; ADD RN add, register + register - ADDRN 5 -NEWSYM FxOp56 ; ADD RN add, register + register - ADDRN 6 -NEWSYM FxOp57 ; ADD RN add, register + register - ADDRN 7 -NEWSYM FxOp58 ; ADD RN add, register + register - ADDRN 8 -NEWSYM FxOp59 ; ADD RN add, register + register - ADDRN 9 -NEWSYM FxOp5A ; ADD RN add, register + register - ADDRN 10 -NEWSYM FxOp5B ; ADD RN add, register + register - ADDRN 11 -NEWSYM FxOp5C ; ADD RN add, register + register - ADDRN 12 -NEWSYM FxOp5D ; ADD RN add, register + register - ADDRN 13 -NEWSYM FxOp5E ; ADD RN add, register + register - ADDRN 14 -NEWSYM FxOp5F ; ADD RN add, register + register - FETCHPIPE - mov eax, [esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - add ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - ret - -NEWSYM FxOp50A1 ; ADC RN add with carry, register + register - ADCRN 0 -NEWSYM FxOp51A1 ; ADC RN add with carry, register + register - ADCRN 1 -NEWSYM FxOp52A1 ; ADC RN add with carry, register + register - ADCRN 2 -NEWSYM FxOp53A1 ; ADC RN add with carry, register + register - ADCRN 3 -NEWSYM FxOp54A1 ; ADC RN add with carry, register + register - ADCRN 4 -NEWSYM FxOp55A1 ; ADC RN add with carry, register + register - ADCRN 5 -NEWSYM FxOp56A1 ; ADC RN add with carry, register + register - ADCRN 6 -NEWSYM FxOp57A1 ; ADC RN add with carry, register + register - ADCRN 7 -NEWSYM FxOp58A1 ; ADC RN add with carry, register + register - ADCRN 8 -NEWSYM FxOp59A1 ; ADC RN add with carry, register + register - ADCRN 9 -NEWSYM FxOp5AA1 ; ADC RN add with carry, register + register - ADCRN 10 -NEWSYM FxOp5BA1 ; ADC RN add with carry, register + register - ADCRN 11 -NEWSYM FxOp5CA1 ; ADC RN add with carry, register + register - ADCRN 12 -NEWSYM FxOp5DA1 ; ADC RN add with carry, register + register - ADCRN 13 -NEWSYM FxOp5EA1 ; ADC RN add with carry, register + register - ADCRN 14 -NEWSYM FxOp5FA1 ; ADC RN add with carry, register + register - FETCHPIPE - mov eax, [esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - shr byte[SfxCarry],1 - adc ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - ret - -; Weird opcode (FxOp50A2, add 0, wow!) -NEWSYM FxOp50A2 ; ADI RN add, register + immediate - ADIRN 0 -NEWSYM FxOp51A2 ; ADI RN add, register + immediate - ADIRN 1 -NEWSYM FxOp52A2 ; ADI RN add, register + immediate - ADIRN 2 -NEWSYM FxOp53A2 ; ADI RN add, register + immediate - ADIRN 3 -NEWSYM FxOp54A2 ; ADI RN add, register + immediate - ADIRN 4 -NEWSYM FxOp55A2 ; ADI RN add, register + immediate - ADIRN 5 -NEWSYM FxOp56A2 ; ADI RN add, register + immediate - ADIRN 6 -NEWSYM FxOp57A2 ; ADI RN add, register + immediate - ADIRN 7 -NEWSYM FxOp58A2 ; ADI RN add, register + immediate - ADIRN 8 -NEWSYM FxOp59A2 ; ADI RN add, register + immediate - ADIRN 9 -NEWSYM FxOp5AA2 ; ADI RN add, register + immediate - ADIRN 10 -NEWSYM FxOp5BA2 ; ADI RN add, register + immediate - ADIRN 11 -NEWSYM FxOp5CA2 ; ADI RN add, register + immediate - ADIRN 12 -NEWSYM FxOp5DA2 ; ADI RN add, register + immediate - ADIRN 13 -NEWSYM FxOp5EA2 ; ADI RN add, register + immediate - ADIRN 14 -NEWSYM FxOp5FA2 ; ADI RN add, register + immediate - ADIRN 15 - -; Another very useful opcode -NEWSYM FxOp50A3 ; ADCIRN add with carry, register + immediate - ADCIRN 0 -NEWSYM FxOp51A3 ; ADCIRN add with carry, register + immediate - ADCIRN 1 -NEWSYM FxOp52A3 ; ADCIRN add with carry, register + immediate - ADCIRN 2 -NEWSYM FxOp53A3 ; ADCIRN add with carry, register + immediate - ADCIRN 3 -NEWSYM FxOp54A3 ; ADCIRN add with carry, register + immediate - ADCIRN 4 -NEWSYM FxOp55A3 ; ADCIRN add with carry, register + immediate - ADCIRN 5 -NEWSYM FxOp56A3 ; ADCIRN add with carry, register + immediate - ADCIRN 6 -NEWSYM FxOp57A3 ; ADCIRN add with carry, register + immediate - ADCIRN 7 -NEWSYM FxOp58A3 ; ADCIRN add with carry, register + immediate - ADCIRN 8 -NEWSYM FxOp59A3 ; ADCIRN add with carry, register + immediate - ADCIRN 9 -NEWSYM FxOp5AA3 ; ADCIRN add with carry, register + immediate - ADCIRN 10 -NEWSYM FxOp5BA3 ; ADCIRN add with carry, register + immediate - ADCIRN 11 -NEWSYM FxOp5CA3 ; ADCIRN add with carry, register + immediate - ADCIRN 12 -NEWSYM FxOp5DA3 ; ADCIRN add with carry, register + immediate - ADCIRN 13 -NEWSYM FxOp5EA3 ; ADCIRN add with carry, register + immediate - ADCIRN 14 -NEWSYM FxOp5FA3 ; ADCIRN add with carry, register + immediate - ADCIRN 15 - -NEWSYM FxOp60 ; SUBRN subtract, register - register - SUBRN 0 -NEWSYM FxOp61 ; SUBRN subtract, register - register - SUBRN 1 -NEWSYM FxOp62 ; SUBRN subtract, register - register - SUBRN 2 -NEWSYM FxOp63 ; SUBRN subtract, register - register - SUBRN 3 -NEWSYM FxOp64 ; SUBRN subtract, register - register - SUBRN 4 -NEWSYM FxOp65 ; SUBRN subtract, register - register - SUBRN 5 -NEWSYM FxOp66 ; SUBRN subtract, register - register - SUBRN 6 -NEWSYM FxOp67 ; SUBRN subtract, register - register - SUBRN 7 -NEWSYM FxOp68 ; SUBRN subtract, register - register - SUBRN 8 -NEWSYM FxOp69 ; SUBRN subtract, register - register - SUBRN 9 -NEWSYM FxOp6A ; SUBRN subtract, register - register - SUBRN 10 -NEWSYM FxOp6B ; SUBRN subtract, register - register - SUBRN 11 -NEWSYM FxOp6C ; SUBRN subtract, register - register - SUBRN 12 -NEWSYM FxOp6D ; SUBRN subtract, register - register - SUBRN 13 -NEWSYM FxOp6E ; SUBRN subtract, register - register - SUBRN 14 -NEWSYM FxOp6F ; SUBRN subtract, register - register - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - sub ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOp60A1 ; SBCRN subtract with carry, register - register - SBCRN 0 -NEWSYM FxOp61A1 ; SBCRN subtract with carry, register - register - SBCRN 1 -NEWSYM FxOp62A1 ; SBCRN subtract with carry, register - register - SBCRN 2 -NEWSYM FxOp63A1 ; SBCRN subtract with carry, register - register - SBCRN 3 -NEWSYM FxOp64A1 ; SBCRN subtract with carry, register - register - SBCRN 4 -NEWSYM FxOp65A1 ; SBCRN subtract with carry, register - register - SBCRN 5 -NEWSYM FxOp66A1 ; SBCRN subtract with carry, register - register - SBCRN 6 -NEWSYM FxOp67A1 ; SBCRN subtract with carry, register - register - SBCRN 7 -NEWSYM FxOp68A1 ; SBCRN subtract with carry, register - register - SBCRN 8 -NEWSYM FxOp69A1 ; SBCRN subtract with carry, register - register - SBCRN 9 -NEWSYM FxOp6AA1 ; SBCRN subtract with carry, register - register - SBCRN 10 -NEWSYM FxOp6BA1 ; SBCRN subtract with carry, register - register - SBCRN 11 -NEWSYM FxOp6CA1 ; SBCRN subtract with carry, register - register - SBCRN 12 -NEWSYM FxOp6DA1 ; SBCRN subtract with carry, register - register - SBCRN 13 -NEWSYM FxOp6EA1 ; SBCRN subtract with carry, register - register - SBCRN 14 -NEWSYM FxOp6FA1 ; SBCRN subtract with carry, register - register - mov eax,[esi] ; Read Source - mov ebx,ebp - FETCHPIPE - sub ebx,[SfxCPB] - cmp byte[SfxCarry],1 - sbb ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOp60A2 ; SUBIRN subtract, register - immediate - SUBIRN 0 -NEWSYM FxOp61A2 ; SUBIRN subtract, register - immediate - SUBIRN 1 -NEWSYM FxOp62A2 ; SUBIRN subtract, register - immediate - SUBIRN 2 -NEWSYM FxOp63A2 ; SUBIRN subtract, register - immediate - SUBIRN 3 -NEWSYM FxOp64A2 ; SUBIRN subtract, register - immediate - SUBIRN 4 -NEWSYM FxOp65A2 ; SUBIRN subtract, register - immediate - SUBIRN 5 -NEWSYM FxOp66A2 ; SUBIRN subtract, register - immediate - SUBIRN 6 -NEWSYM FxOp67A2 ; SUBIRN subtract, register - immediate - SUBIRN 7 -NEWSYM FxOp68A2 ; SUBIRN subtract, register - immediate - SUBIRN 8 -NEWSYM FxOp69A2 ; SUBIRN subtract, register - immediate - SUBIRN 9 -NEWSYM FxOp6AA2 ; SUBIRN subtract, register - immediate - SUBIRN 10 -NEWSYM FxOp6BA2 ; SUBIRN subtract, register - immediate - SUBIRN 11 -NEWSYM FxOp6CA2 ; SUBIRN subtract, register - immediate - SUBIRN 12 -NEWSYM FxOp6DA2 ; SUBIRN subtract, register - immediate - SUBIRN 13 -NEWSYM FxOp6EA2 ; SUBIRN subtract, register - immediate - SUBIRN 14 -NEWSYM FxOp6FA2 ; SUBIRN subtract, register - immediate - SUBIRN 15 - -NEWSYM FxOp60A3 ; CMPRN compare, register, register - CMPRN 0 -NEWSYM FxOp61A3 ; CMPRN compare, register, register - CMPRN 1 -NEWSYM FxOp62A3 ; CMPRN compare, register, register - CMPRN 2 -NEWSYM FxOp63A3 ; CMPRN compare, register, register - CMPRN 3 -NEWSYM FxOp64A3 ; CMPRN compare, register, register - CMPRN 4 -NEWSYM FxOp65A3 ; CMPRN compare, register, register - CMPRN 5 -NEWSYM FxOp66A3 ; CMPRN compare, register, register - CMPRN 6 -NEWSYM FxOp67A3 ; CMPRN compare, register, register - CMPRN 7 -NEWSYM FxOp68A3 ; CMPRN compare, register, register - CMPRN 8 -NEWSYM FxOp69A3 ; CMPRN compare, register, register - CMPRN 9 -NEWSYM FxOp6AA3 ; CMPRN compare, register, register - CMPRN 10 -NEWSYM FxOp6BA3 ; CMPRN compare, register, register - CMPRN 11 -NEWSYM FxOp6CA3 ; CMPRN compare, register, register - CMPRN 12 -NEWSYM FxOp6DA3 ; CMPRN compare, register, register - CMPRN 13 -NEWSYM FxOp6EA3 ; CMPRN compare, register, register - CMPRN 14 -NEWSYM FxOp6FA3 ; CMPRN compare, register, register - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - sub ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - mov [SfxSignZero],eax - CLRFLAGS - inc ebp ; Increase program counter - ret - -NEWSYM FxOp70 ; MERGE R7 as upper byte, R8 as lower byte (used for texture-mapping) */ - ; V - xor eax,eax - FETCHPIPE - mov ah,[SfxR7+1] - mov al,[SfxR8+1] - inc ebp - mov [edi],eax ; Write Destination - mov dword[SfxSignZero],0001h - test eax,0F0F0h - jz .nozero - mov dword[SfxSignZero],0000h -.nozero - test eax,08080h - jz .nosign - or dword[SfxSignZero],80000h -.nosign - mov dword[SfxOverflow],1 - test ax,0c0c0h - jnz .Overflow - mov dword[SfxOverflow],0 -.Overflow - mov dword[SfxCarry],1 - test ax,0e0e0h - jnz .Carry - mov dword[SfxCarry],0 -.Carry - CLRFLAGS - ret - -NEWSYM FxOp71 ; AND RN register & register - ANDRN 1 -NEWSYM FxOp72 ; AND RN register & register - ANDRN 2 -NEWSYM FxOp73 ; AND RN register & register - ANDRN 3 -NEWSYM FxOp74 ; AND RN register & register - ANDRN 4 -NEWSYM FxOp75 ; AND RN register & register - ANDRN 5 -NEWSYM FxOp76 ; AND RN register & register - ANDRN 6 -NEWSYM FxOp77 ; AND RN register & register - ANDRN 7 -NEWSYM FxOp78 ; AND RN register & register - ANDRN 8 -NEWSYM FxOp79 ; AND RN register & register - ANDRN 9 -NEWSYM FxOp7A ; AND RN register & register - ANDRN 10 -NEWSYM FxOp7B ; AND RN register & register - ANDRN 11 -NEWSYM FxOp7C ; AND RN register & register - ANDRN 12 -NEWSYM FxOp7D ; AND RN register & register - ANDRN 13 -NEWSYM FxOp7E ; AND RN register & register - ANDRN 14 -NEWSYM FxOp7F ; AND RN register & register - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - and eax,ebx - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret - -NEWSYM FxOp71A1 ; BIC RN register & ~register - BICRN 1 -NEWSYM FxOp72A1 ; BIC RN register & ~register - BICRN 2 -NEWSYM FxOp73A1 ; BIC RN register & ~register - BICRN 3 -NEWSYM FxOp74A1 ; BIC RN register & ~register - BICRN 4 -NEWSYM FxOp75A1 ; BIC RN register & ~register - BICRN 5 -NEWSYM FxOp76A1 ; BIC RN register & ~register - BICRN 6 -NEWSYM FxOp77A1 ; BIC RN register & ~register - BICRN 7 -NEWSYM FxOp78A1 ; BIC RN register & ~register - BICRN 8 -NEWSYM FxOp79A1 ; BIC RN register & ~register - BICRN 9 -NEWSYM FxOp7AA1 ; BIC RN register & ~register - BICRN 10 -NEWSYM FxOp7BA1 ; BIC RN register & ~register - BICRN 11 -NEWSYM FxOp7CA1 ; BIC RN register & ~register - BICRN 12 -NEWSYM FxOp7DA1 ; BIC RN register & ~register - BICRN 13 -NEWSYM FxOp7EA1 ; BIC RN register & ~register - BICRN 14 -NEWSYM FxOp7FA1 ; BIC RN register & ~register - FETCHPIPE - mov ebx,ebp - sub ebx,[SfxCPB] - mov eax,[esi] ; Read Source - xor ebx,0FFFFh - and eax,ebx - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret - -NEWSYM FxOp71A2 ; ANDIRN and #n - register & immediate - ANDIRN 1 -NEWSYM FxOp72A2 ; ANDIRN and #n - register & immediate - ANDIRN 2 -NEWSYM FxOp73A2 ; ANDIRN and #n - register & immediate - ANDIRN 3 -NEWSYM FxOp74A2 ; ANDIRN and #n - register & immediate - ANDIRN 4 -NEWSYM FxOp75A2 ; ANDIRN and #n - register & immediate - ANDIRN 5 -NEWSYM FxOp76A2 ; ANDIRN and #n - register & immediate - ANDIRN 6 -NEWSYM FxOp77A2 ; ANDIRN and #n - register & immediate - ANDIRN 7 -NEWSYM FxOp78A2 ; ANDIRN and #n - register & immediate - ANDIRN 8 -NEWSYM FxOp79A2 ; ANDIRN and #n - register & immediate - ANDIRN 9 -NEWSYM FxOp7AA2 ; ANDIRN and #n - register & immediate - ANDIRN 10 -NEWSYM FxOp7BA2 ; ANDIRN and #n - register & immediate - ANDIRN 11 -NEWSYM FxOp7CA2 ; ANDIRN and #n - register & immediate - ANDIRN 12 -NEWSYM FxOp7DA2 ; ANDIRN and #n - register & immediate - ANDIRN 13 -NEWSYM FxOp7EA2 ; ANDIRN and #n - register & immediate - ANDIRN 14 -NEWSYM FxOp7FA2 ; ANDIRN and #n - register & immediate - ANDIRN 15 - -NEWSYM FxOp71A3 ; BICIRN register & ~immediate - BICIRN 1 ^ 0FFFFh -NEWSYM FxOp72A3 ; BICIRN register & ~immediate - BICIRN 2 ^ 0FFFFh -NEWSYM FxOp73A3 ; BICIRN register & ~immediate - BICIRN 3 ^ 0FFFFh -NEWSYM FxOp74A3 ; BICIRN register & ~immediate - BICIRN 4 ^ 0FFFFh -NEWSYM FxOp75A3 ; BICIRN register & ~immediate - BICIRN 5 ^ 0FFFFh -NEWSYM FxOp76A3 ; BICIRN register & ~immediate - BICIRN 6 ^ 0FFFFh -NEWSYM FxOp77A3 ; BICIRN register & ~immediate - BICIRN 7 ^ 0FFFFh -NEWSYM FxOp78A3 ; BICIRN register & ~immediate - BICIRN 8 ^ 0FFFFh -NEWSYM FxOp79A3 ; BICIRN register & ~immediate - BICIRN 9 ^ 0FFFFh -NEWSYM FxOp7AA3 ; BICIRN register & ~immediate - BICIRN 10 ^ 0FFFFh -NEWSYM FxOp7BA3 ; BICIRN register & ~immediate - BICIRN 11 ^ 0FFFFh -NEWSYM FxOp7CA3 ; BICIRN register & ~immediate - BICIRN 12 ^ 0FFFFh -NEWSYM FxOp7DA3 ; BICIRN register & ~immediate - BICIRN 13 ^ 0FFFFh -NEWSYM FxOp7EA3 ; BICIRN register & ~immediate - BICIRN 14 ^ 0FFFFh -NEWSYM FxOp7FA3 ; BICIRN register & ~immediate - BICIRN 15 ^ 0FFFFh - -NEWSYM FxOp80 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 0 -NEWSYM FxOp81 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 1 -NEWSYM FxOp82 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 2 -NEWSYM FxOp83 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 3 -NEWSYM FxOp84 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 4 -NEWSYM FxOp85 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 5 -NEWSYM FxOp86 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 6 -NEWSYM FxOp87 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 7 -NEWSYM FxOp88 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 8 -NEWSYM FxOp89 ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 9 -NEWSYM FxOp8A ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 10 -NEWSYM FxOp8B ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 11 -NEWSYM FxOp8C ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 12 -NEWSYM FxOp8D ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 13 -NEWSYM FxOp8E ; MULTRN 8 bit to 16 bit signed multiply, register * register - MULTRN 14 -NEWSYM FxOp8F ; MULTRN 8 bit to 16 bit signed multiply, register * register - FETCHPIPE - mov ebx,ebp - mov al,[esi] ; Read Source - sub ebx,[SfxCPB] - imul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret - -NEWSYM FxOp80A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 0 -NEWSYM FxOp81A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 1 -NEWSYM FxOp82A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 2 -NEWSYM FxOp83A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 3 -NEWSYM FxOp84A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 4 -NEWSYM FxOp85A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 5 -NEWSYM FxOp86A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 6 -NEWSYM FxOp87A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 7 -NEWSYM FxOp88A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 8 -NEWSYM FxOp89A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 9 -NEWSYM FxOp8AA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 10 -NEWSYM FxOp8BA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 11 -NEWSYM FxOp8CA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 12 -NEWSYM FxOp8DA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 13 -NEWSYM FxOp8EA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRN 14 -NEWSYM FxOp8FA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - FETCHPIPE - mov ebx,ebp - mov al,[esi] ; Read Source - sub ebx,[SfxCPB] - mul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret - -NEWSYM FxOp80A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 0 -NEWSYM FxOp81A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 1 -NEWSYM FxOp82A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 2 -NEWSYM FxOp83A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 3 -NEWSYM FxOp84A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 4 -NEWSYM FxOp85A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 5 -NEWSYM FxOp86A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 6 -NEWSYM FxOp87A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 7 -NEWSYM FxOp88A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 8 -NEWSYM FxOp89A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 9 -NEWSYM FxOp8AA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 10 -NEWSYM FxOp8BA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 11 -NEWSYM FxOp8CA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 12 -NEWSYM FxOp8DA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 13 -NEWSYM FxOp8EA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 14 -NEWSYM FxOp8FA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRN 15 - -NEWSYM FxOp80A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 0 -NEWSYM FxOp81A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 1 -NEWSYM FxOp82A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 2 -NEWSYM FxOp83A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 3 -NEWSYM FxOp84A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 4 -NEWSYM FxOp85A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 5 -NEWSYM FxOp86A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 6 -NEWSYM FxOp87A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 7 -NEWSYM FxOp88A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 8 -NEWSYM FxOp89A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 9 -NEWSYM FxOp8AA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 10 -NEWSYM FxOp8BA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 11 -NEWSYM FxOp8CA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 12 -NEWSYM FxOp8DA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 13 -NEWSYM FxOp8EA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 14 -NEWSYM FxOp8FA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRN 15 - -NEWSYM FxOp90 ; SBK store word to last accessed RAM address ; V - mov ebx,[SfxLastRamAdr] ; Load last ram address - mov eax,[esi] ; Read Source - FETCHPIPE - mov [ebx],al ; Store Word - sub ebx,[SfxRAMMem] - xor ebx,1 - add ebx,[SfxRAMMem] - inc ebp ; Increase program counter - mov [ebx],ah ; Store Word - CLRFLAGS - ret - -NEWSYM FxOp91 ; LINK#n R11 = R15 + immediate - LINK 1 -NEWSYM FxOp92 ; LINK#n R11 = R15 + immediate - LINK 2 -NEWSYM FxOp93 ; LINK#n R11 = R15 + immediate - LINK 3 -NEWSYM FxOp94 ; LINK#n R11 = R15 + immediate - LINK 4 - -NEWSYM FxOp95 ; SEX sign extend 8 bit to 16 bit ; V - movsx eax, byte[esi] ; Read Source - FETCHPIPE - and eax,0FFFFh - inc ebp - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOp96 ; ASR aritmethic shift right by one ; V - mov eax,[esi] ; Read Source - FETCHPIPE - mov [SfxCarry],al - and byte[SfxCarry],1 - sar ax,1 ; logic shift right - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOp96A1 ; DIV2 aritmethic shift right by one ; V - mov eax,[esi] ; Read Source - FETCHPIPE - cmp ax,-1 - je .minusone - mov [SfxCarry],al - and byte[SfxCarry],1 - sar ax,1 ; logic shift right - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret -.minusone - mov byte[SfxCarry],1 - xor eax,eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOp97 ; ROR rotate right by one ; V - FETCHPIPE - mov eax,[esi] ; Read Source - shr byte[SfxCarry],1 - rcr ax,1 - setc byte[SfxCarry] - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOp98 ; JMPRN jump to address of register - JMPRN 8 -NEWSYM FxOp99 ; JMPRN jump to address of register - JMPRN 9 -NEWSYM FxOp9A ; JMPRN jump to address of register - JMPRN 10 -NEWSYM FxOp9B ; JMPRN jump to address of register - JMPRN 11 -NEWSYM FxOp9C ; JMPRN jump to address of register - JMPRN 12 -NEWSYM FxOp9D ; JMPRN jump to address of register - JMPRN 13 - -NEWSYM FxOp98A1 ; LJMPRN set program bank to source register and jump to address of register - LJMPRN 8 -NEWSYM FxOp99A1 ; LJMPRN set program bank to source register and jump to address of register - LJMPRN 9 -NEWSYM FxOp9AA1 ; LJMPRN set program bank to source register and jump to address of register - LJMPRN 10 -NEWSYM FxOp9BA1 ; LJMPRN set program bank to source register and jump to address of register - LJMPRN 11 -NEWSYM FxOp9CA1 ; LJMPRN set program bank to source register and jump to address of register - LJMPRN 12 -NEWSYM FxOp9DA1 ; LJMPRN set program bank to source register and jump to address of register - LJMPRN 13 - -NEWSYM FxOp9E ; LOB set upper byte to zero (keep low byte) ; V - mov eax,[esi] ; Read Source - FETCHPIPE - and eax,0FFh - inc ebp - mov [edi],eax ; Write Destination - shl eax,8 - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOp9F ; FMULT 16 bit to 32 bit signed multiplication, upper 16 bits only - ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR6] - FETCHPIPE - imul bx - inc ebp - and edx,0FFFFh - mov [SfxSignZero],edx - mov [edi],edx ; Write Destination - shr ax,15 - mov [SfxCarry],al - CLRFLAGS - ret - -NEWSYM FxOp9FA1 ; LMULT 16 bit to 32 bit signed multiplication ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR6] - FETCHPIPE - imul bx - and edx,0FFFFh - inc ebp - mov [edi],edx ; Write Destination - mov [SfxR4],ax - mov [SfxSignZero],edx - shr ax,15 - mov [SfxCarry],al - CLRFLAGS - ret - -NEWSYM FxOpA0 ; IBTRN,#PP immediate byte transfer - IBTRN 0 -NEWSYM FxOpA1 ; IBTRN,#PP immediate byte transfer - IBTRN 1 -NEWSYM FxOpA2 ; IBTRN,#PP immediate byte transfer - IBTRN 2 -NEWSYM FxOpA3 ; IBTRN,#PP immediate byte transfer - IBTRN 3 -NEWSYM FxOpA4 ; IBTRN,#PP immediate byte transfer - IBTRN 4 -NEWSYM FxOpA5 ; IBTRN,#PP immediate byte transfer - IBTRN 5 -NEWSYM FxOpA6 ; IBTRN,#PP immediate byte transfer - IBTRN 6 -NEWSYM FxOpA7 ; IBTRN,#PP immediate byte transfer - IBTRN 7 -NEWSYM FxOpA8 ; IBTRN,#PP immediate byte transfer - IBTRN 8 -NEWSYM FxOpA9 ; IBTRN,#PP immediate byte transfer - IBTRN 9 -NEWSYM FxOpAA ; IBTRN,#PP immediate byte transfer - IBTRN 10 -NEWSYM FxOpAB ; IBTRN,#PP immediate byte transfer - IBTRN 11 -NEWSYM FxOpAC ; IBTRN,#PP immediate byte transfer - IBTRN 12 -NEWSYM FxOpAD ; IBTRN,#PP immediate byte transfer - IBTRN 13 -NEWSYM FxOpAE ; IBTRN,#PP immediate byte transfer - movsx eax,byte[ebp] - mov cl,[ebp+1] - add ebp,2 - mov [SfxR0+14*4],ax - UpdateR14 - CLRFLAGS - ret -NEWSYM FxOpAF ; IBTRN,#PP immediate byte transfer - movsx eax,byte[ebp] - mov cl,[ebp+1] - and eax,0FFFFh - mov ebp,[SfxCPB] - add ebp,eax - CLRFLAGS - ret - -NEWSYM FxOpA0A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 0 -NEWSYM FxOpA1A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 1 -NEWSYM FxOpA2A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 2 -NEWSYM FxOpA3A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 3 -NEWSYM FxOpA4A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 4 -NEWSYM FxOpA5A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 5 -NEWSYM FxOpA6A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 6 -NEWSYM FxOpA7A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 7 -NEWSYM FxOpA8A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 8 -NEWSYM FxOpA9A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 9 -NEWSYM FxOpAAA1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 10 -NEWSYM FxOpABA1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 11 -NEWSYM FxOpACA1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 12 -NEWSYM FxOpADA1 ; LMS rn,(yy) load word from RAM (short address) - LMSRN 13 -NEWSYM FxOpAEA1 ; LMS rn,(yy) load word from RAM (short address) - xor eax,eax - mov al,[ebp] - add eax,eax - inc ebp - add eax,[SfxRAMMem] - mov cl,[ebp] - mov [SfxLastRamAdr],eax - mov ebx,[eax] ; Read word from ram - inc ebp - mov [SfxR0+14*4],bx ; Write data - UpdateR14 - CLRFLAGS - ret -NEWSYM FxOpAFA1 ; LMS rn,(yy) load word from RAM (short address) - xor eax,eax - mov al,[ebp] - add eax,eax - inc ebp - add eax,[SfxRAMMem] - mov cl,[ebp] - mov [SfxLastRamAdr],eax - mov ebx,[eax] ; Read word from ram - and ebx,0FFFFh - mov ebp,[SfxCPB] - add ebp,ebx - CLRFLAGS - ret - -NEWSYM FxOpA0A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 0 -NEWSYM FxOpA1A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 1 -NEWSYM FxOpA2A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 2 -NEWSYM FxOpA3A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 3 -NEWSYM FxOpA4A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 4 -NEWSYM FxOpA5A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 5 -NEWSYM FxOpA6A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 6 -NEWSYM FxOpA7A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 7 -NEWSYM FxOpA8A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 8 -NEWSYM FxOpA9A2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 9 -NEWSYM FxOpAAA2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 10 -NEWSYM FxOpABA2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 11 -NEWSYM FxOpACA2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 12 -NEWSYM FxOpADA2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 13 -NEWSYM FxOpAEA2 ; SMS (yy),rn store word in RAM (short address) - SMSRN 14 -NEWSYM FxOpAFA2 ; SMS (yy),rn store word in RAM (short address) - xor eax,eax - mov ebx,ebp - sub ebx,[SfxCPB] - mov al,[ebp] - inc ebp - add eax,eax - FETCHPIPE - add eax,[SfxRAMMem] - mov [SfxLastRamAdr],eax - inc ebp - mov [eax],bx ; Write word to ram - CLRFLAGS - ret - -NEWSYM FxOpB0 ; FROM rn set source register - FROMRN 0 -NEWSYM FxOpB1 ; FROM rn set source register - FROMRN 1 -NEWSYM FxOpB2 ; FROM rn set source register - FROMRN 2 -NEWSYM FxOpB3 ; FROM rn set source register - FROMRN 3 -NEWSYM FxOpB4 ; FROM rn set source register - FROMRN 4 -NEWSYM FxOpB5 ; FROM rn set source register - FROMRN 5 -NEWSYM FxOpB6 ; FROM rn set source register - FROMRN 6 -NEWSYM FxOpB7 ; FROM rn set source register - FROMRN 7 -NEWSYM FxOpB8 ; FROM rn set source register - FROMRN 8 -NEWSYM FxOpB9 ; FROM rn set source register - FROMRN 9 -NEWSYM FxOpBA ; FROM rn set source register - FROMRN 10 -NEWSYM FxOpBB ; FROM rn set source register - FROMRN 11 -NEWSYM FxOpBC ; FROM rn set source register - FROMRN 12 -NEWSYM FxOpBD ; FROM rn set source register - FROMRN 13 -NEWSYM FxOpBE ; FROM rn set source register - FROMRN 14 -NEWSYM FxOpBF ; FROM rn set source register - FETCHPIPE - mov esi,SfxR0+15*4 - inc ebp ; Increase program counter - mov eax,ebp - sub eax,[SfxCPB] - mov [SfxR15],eax - call [FxTableb+ecx*4] - mov esi,SfxR0 - ret - -NEWSYM FxOpC0 ; HIB move high-byte to low-byte ; V - mov eax,[esi] ; Read Source - FETCHPIPE - and eax,0FF00h - mov [SfxSignZero],eax - shr eax,8 - inc ebp - mov [edi],eax - CLRFLAGS - ret - -NEWSYM FxOpC1 ; OR rn or rn - ORRN 1 -NEWSYM FxOpC2 ; OR rn or rn - ORRN 2 -NEWSYM FxOpC3 ; OR rn or rn - ORRN 3 -NEWSYM FxOpC4 ; OR rn or rn - ORRN 4 -NEWSYM FxOpC5 ; OR rn or rn - ORRN 5 -NEWSYM FxOpC6 ; OR rn or rn - ORRN 6 -NEWSYM FxOpC7 ; OR rn or rn - ORRN 7 -NEWSYM FxOpC8 ; OR rn or rn - ORRN 8 -NEWSYM FxOpC9 ; OR rn or rn - ORRN 9 -NEWSYM FxOpCA ; OR rn or rn - ORRN 10 -NEWSYM FxOpCB ; OR rn or rn - ORRN 11 -NEWSYM FxOpCC ; OR rn or rn - ORRN 12 -NEWSYM FxOpCD ; OR rn or rn - ORRN 13 -NEWSYM FxOpCE ; OR rn or rn - ORRN 14 -NEWSYM FxOpCF ; OR rn or rn - mov eax,[esi] ; Read Source - mov ebx,ebp - FETCHPIPE - sub ebx,[SfxCPB] - or eax,ebx - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOpC1A1 ; XOR rn xor rn - XORRN 1 -NEWSYM FxOpC2A1 ; XOR rn xor rn - XORRN 2 -NEWSYM FxOpC3A1 ; XOR rn xor rn - XORRN 3 -NEWSYM FxOpC4A1 ; XOR rn xor rn - XORRN 4 -NEWSYM FxOpC5A1 ; XOR rn xor rn - XORRN 5 -NEWSYM FxOpC6A1 ; XOR rn xor rn - XORRN 6 -NEWSYM FxOpC7A1 ; XOR rn xor rn - XORRN 7 -NEWSYM FxOpC8A1 ; XOR rn xor rn - XORRN 8 -NEWSYM FxOpC9A1 ; XOR rn xor rn - XORRN 9 -NEWSYM FxOpCAA1 ; XOR rn xor rn - XORRN 10 -NEWSYM FxOpCBA1 ; XOR rn xor rn - XORRN 11 -NEWSYM FxOpCCA1 ; XOR rn xor rn - XORRN 12 -NEWSYM FxOpCDA1 ; XOR rn xor rn - XORRN 13 -NEWSYM FxOpCEA1 ; XOR rn xor rn - XORRN 14 -NEWSYM FxOpCFA1 ; XOR rn xor rn - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - xor eax,ebx - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - ret - -NEWSYM FxOpC1A2 ; OR #n OR #n - ORI 1 -NEWSYM FxOpC2A2 ; OR #n OR #n - ORI 2 -NEWSYM FxOpC3A2 ; OR #n OR #n - ORI 3 -NEWSYM FxOpC4A2 ; OR #n OR #n - ORI 4 -NEWSYM FxOpC5A2 ; OR #n OR #n - ORI 5 -NEWSYM FxOpC6A2 ; OR #n OR #n - ORI 6 -NEWSYM FxOpC7A2 ; OR #n OR #n - ORI 7 -NEWSYM FxOpC8A2 ; OR #n OR #n - ORI 8 -NEWSYM FxOpC9A2 ; OR #n OR #n - ORI 9 -NEWSYM FxOpCAA2 ; OR #n OR #n - ORI 10 -NEWSYM FxOpCBA2 ; OR #n OR #n - ORI 11 -NEWSYM FxOpCCA2 ; OR #n OR #n - ORI 12 -NEWSYM FxOpCDA2 ; OR #n OR #n - ORI 13 -NEWSYM FxOpCEA2 ; OR #n OR #n - ORI 14 -NEWSYM FxOpCFA2 ; OR #n OR #n - ORI 15 - -NEWSYM FxOpC1A3 ; XOR #n xor #n - XORI 1 -NEWSYM FxOpC2A3 ; XOR #n xor #n - XORI 2 -NEWSYM FxOpC3A3 ; XOR #n xor #n - XORI 3 -NEWSYM FxOpC4A3 ; XOR #n xor #n - XORI 4 -NEWSYM FxOpC5A3 ; XOR #n xor #n - XORI 5 -NEWSYM FxOpC6A3 ; XOR #n xor #n - XORI 6 -NEWSYM FxOpC7A3 ; XOR #n xor #n - XORI 7 -NEWSYM FxOpC8A3 ; XOR #n xor #n - XORI 8 -NEWSYM FxOpC9A3 ; XOR #n xor #n - XORI 9 -NEWSYM FxOpCAA3 ; XOR #n xor #n - XORI 10 -NEWSYM FxOpCBA3 ; XOR #n xor #n - XORI 11 -NEWSYM FxOpCCA3 ; XOR #n xor #n - XORI 12 -NEWSYM FxOpCDA3 ; XOR #n xor #n - XORI 13 -NEWSYM FxOpCEA3 ; XOR #n xor #n - XORI 14 -NEWSYM FxOpCFA3 ; XOR #n xor #n - XORI 15 - -NEWSYM FxOpD0 ; INC rn increase by one - INCRN 0 -NEWSYM FxOpD1 ; INC rn increase by one - INCRN 1 -NEWSYM FxOpD2 ; INC rn increase by one - INCRN 2 -NEWSYM FxOpD3 ; INC rn increase by one - INCRN 3 -NEWSYM FxOpD4 ; INC rn increase by one - INCRN 4 -NEWSYM FxOpD5 ; INC rn increase by one - INCRN 5 -NEWSYM FxOpD6 ; INC rn increase by one - INCRN 6 -NEWSYM FxOpD7 ; INC rn increase by one - INCRN 7 -NEWSYM FxOpD8 ; INC rn increase by one - INCRN 8 -NEWSYM FxOpD9 ; INC rn increase by one - INCRN 9 -NEWSYM FxOpDA ; INC rn increase by one - INCRN 10 -NEWSYM FxOpDB ; INC rn increase by one - INCRN 11 -NEWSYM FxOpDC ; INC rn increase by one - INCRN 12 -NEWSYM FxOpDD ; INC rn increase by one - INCRN 13 -NEWSYM FxOpDE ; INC rn increase by one - FETCHPIPE - mov eax,[SfxR0+14*4] ; Read Source - inc ax - mov [SfxR0+14*4],eax - mov [SfxSignZero],eax - CLRFLAGS - inc ebp - UpdateR14 - ret - -NEWSYM FxOpDF ; GETC transfer ROM buffer to color register - mov eax,[SfxRomBuffer] - FETCHPIPE - mov eax,[eax] - test byte[SfxPOR],04h - jz .nohighnibble - mov bl,al - shr bl,4 - and al,0F0h - or al,bl -.nohighnibble - test byte[SfxPOR],08h - jnz .preserveupper - cmp [SfxCOLR],al - je .nocolchange - mov [SfxCOLR],al - and eax,0FFh - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx -.nocolchange - CLRFLAGS - inc ebp ; Increase program counter - ret -.preserveupper - mov bl,[SfxCOLR] - and al,0Fh - and bl,0F0h - or al,bl - cmp [SfxCOLR],al - je .nocolchange - mov [SfxCOLR],al - and eax,0FFh - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx - CLRFLAGS - inc ebp ; Increase program counter - ret - -NEWSYM FxOpDFA2 ; RAMB set current RAM bank ; Verified - mov eax,[esi] ; Read Source - mov ebx,[SfxnRamBanks] - FETCHPIPE - dec ebx - and eax,ebx - mov [SfxRAMBR],eax - shl eax,16 - add eax,[sfxramdata] - mov [SfxRAMMem],eax - CLRFLAGS - inc ebp - ret - -NEWSYM FxOpDFA3 ; ROMB set current ROM bank ; Verified - mov eax,[esi] ; Read Source - and eax,07Fh - FETCHPIPE - mov [SfxROMBR],eax - mov eax,[SfxMemTable+eax*4] - mov [SfxCROM],eax - CLRFLAGS - inc ebp - ret - -NEWSYM FxOpE0 ; DEC rn decrement by one - DECRN 0 -NEWSYM FxOpE1 ; DEC rn decrement by one - DECRN 1 -NEWSYM FxOpE2 ; DEC rn decrement by one - DECRN 2 -NEWSYM FxOpE3 ; DEC rn decrement by one - DECRN 3 -NEWSYM FxOpE4 ; DEC rn decrement by one - DECRN 4 -NEWSYM FxOpE5 ; DEC rn decrement by one - DECRN 5 -NEWSYM FxOpE6 ; DEC rn decrement by one - DECRN 6 -NEWSYM FxOpE7 ; DEC rn decrement by one - DECRN 7 -NEWSYM FxOpE8 ; DEC rn decrement by one - DECRN 8 -NEWSYM FxOpE9 ; DEC rn decrement by one - DECRN 9 -NEWSYM FxOpEA ; DEC rn decrement by one - DECRN 10 -NEWSYM FxOpEB ; DEC rn decrement by one - DECRN 11 -NEWSYM FxOpEC ; DEC rn decrement by one - DECRN 12 -NEWSYM FxOpED ; DEC rn decrement by one - DECRN 13 -NEWSYM FxOpEE ; DEC rn decrement by one - dec word[SfxR0+14*4] - FETCHPIPE - mov eax,[SfxR0+14*4] ; Read Source - mov [SfxSignZero],eax - UpdateR14 - CLRFLAGS - inc ebp - ret - -NEWSYM FxOpEF ; getb get byte from ROM at address R14 ; V - FETCHPIPE - mov eax,[SfxRomBuffer] - inc ebp - mov eax,[eax] - and eax,0FFh -; cmp edi,SfxR15 -; je .nor15 - mov [edi],eax ; Write DREG - CLRFLAGS - ret -.nor15 -; mov eax,ebp -; sub eax,[SfxCPB] -; mov [SfxR15],al - or eax,8000h - mov [edi],eax ; Write DREG - CLRFLAGS - ret - -NEWSYM FxOpEFA1 ; getbh get high-byte from ROM at address R14 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxRomBuffer] - and eax,0FFh - FETCHPIPE - mov ah,[ebx] - inc ebp - mov [edi],eax ; Write DREG - CLRFLAGS - ret - -NEWSYM FxOpEFA2 ; getbl get low-byte from ROM at address R14 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxRomBuffer] - and eax,0FF00h - FETCHPIPE - mov al,[ebx] - inc ebp - mov [edi],eax ; Write DREG - CLRFLAGS - ret - -NEWSYM FxOpEFA3 ; getbs get sign extended byte from ROM at address R14 ; V - mov ebx,[SfxRomBuffer] - FETCHPIPE - movsx eax,byte[ebx] - inc ebp - mov [edi],ax ; Write DREG - CLRFLAGS - ret - -NEWSYM FxOpF0 ; IWT RN,#xx immediate word transfer to register - IWTRN 0 -NEWSYM FxOpF1 ; IWT RN,#xx immediate word transfer to register - IWTRN 1 -NEWSYM FxOpF2 ; IWT RN,#xx immediate word transfer to register - IWTRN 2 -NEWSYM FxOpF3 ; IWT RN,#xx immediate word transfer to register - IWTRN 3 -NEWSYM FxOpF4 ; IWT RN,#xx immediate word transfer to register - IWTRN 4 -NEWSYM FxOpF5 ; IWT RN,#xx immediate word transfer to register - IWTRN 5 -NEWSYM FxOpF6 ; IWT RN,#xx immediate word transfer to register - IWTRN 6 -NEWSYM FxOpF7 ; IWT RN,#xx immediate word transfer to register - IWTRN 7 -NEWSYM FxOpF8 ; IWT RN,#xx immediate word transfer to register - IWTRN 8 -NEWSYM FxOpF9 ; IWT RN,#xx immediate word transfer to register - IWTRN 9 -NEWSYM FxOpFA ; IWT RN,#xx immediate word transfer to register - IWTRN 10 -NEWSYM FxOpFB ; IWT RN,#xx immediate word transfer to register - IWTRN 11 -NEWSYM FxOpFC ; IWT RN,#xx immediate word transfer to register - IWTRN 12 -NEWSYM FxOpFD ; IWT RN,#xx immediate word transfer to register - IWTRN 13 -NEWSYM FxOpFE ; IWT RN,#xx immediate word transfer to register - mov eax,[ebp] - mov cl,[ebp+2] - and eax,0FFFFh - add ebp,3 - mov [SfxR0+14*4],eax - UpdateR14 - CLRFLAGS - ret -NEWSYM FxOpFF ; IWT RN,#xx immediate word transfer to register - mov eax,[ebp] - mov cl,[ebp+2] - and eax,0FFFFh - mov ebp,[SfxCPB] - add ebp,eax - CLRFLAGS - ret - -NEWSYM FxOpF0A1 ; LM RN,(XX) load word from RAM - LMRN 0 -NEWSYM FxOpF1A1 ; LM RN,(XX) load word from RAM - LMRN 1 -NEWSYM FxOpF2A1 ; LM RN,(XX) load word from RAM - LMRN 2 -NEWSYM FxOpF3A1 ; LM RN,(XX) load word from RAM - LMRN 3 -NEWSYM FxOpF4A1 ; LM RN,(XX) load word from RAM - LMRN 4 -NEWSYM FxOpF5A1 ; LM RN,(XX) load word from RAM - LMRN 5 -NEWSYM FxOpF6A1 ; LM RN,(XX) load word from RAM - LMRN 6 -NEWSYM FxOpF7A1 ; LM RN,(XX) load word from RAM - LMRN 7 -NEWSYM FxOpF8A1 ; LM RN,(XX) load word from RAM - LMRN 8 -NEWSYM FxOpF9A1 ; LM RN,(XX) load word from RAM - LMRN 9 -NEWSYM FxOpFAA1 ; LM RN,(XX) load word from RAM - LMRN 10 -NEWSYM FxOpFBA1 ; LM RN,(XX) load word from RAM - LMRN 11 -NEWSYM FxOpFCA1 ; LM RN,(XX) load word from RAM - LMRN 12 -NEWSYM FxOpFDA1 ; LM RN,(XX) load word from RAM - LMRN 13 -NEWSYM FxOpFEA1 ; LM RN,(XX) load word from RAM - xor eax,eax - mov cl,[ebp+2] - mov ax,[ebp] - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov dl,[eax+ebx] - xor eax,1 - add ebp,3 - mov dh,[eax+ebx] - mov [SfxR0+14*4],dx ; Store Word - UpdateR14 - CLRFLAGS - ret -NEWSYM FxOpFFA1 ; LM RN,(XX) load word from RAM - FETCHPIPE - mov eax,ecx - inc ebp - FETCHPIPE - inc ebp - mov ah,cl - FETCHPIPE - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov dl,[eax+ebx] - xor eax,1 - mov dh,[eax+ebx] - and edx,0FFFFh - mov ebp,[SfxCPB] - add ebp,edx - CLRFLAGS - ret - -NEWSYM FxOpF0A2 ; SM (XX),RN store word in RAM - SMRN 0 -NEWSYM FxOpF1A2 ; SM (XX),RN store word in RAM - SMRN 1 -NEWSYM FxOpF2A2 ; SM (XX),RN store word in RAM - SMRN 2 -NEWSYM FxOpF3A2 ; SM (XX),RN store word in RAM - SMRN 3 -NEWSYM FxOpF4A2 ; SM (XX),RN store word in RAM - SMRN 4 -NEWSYM FxOpF5A2 ; SM (XX),RN store word in RAM - SMRN 5 -NEWSYM FxOpF6A2 ; SM (XX),RN store word in RAM - SMRN 6 -NEWSYM FxOpF7A2 ; SM (XX),RN store word in RAM - SMRN 7 -NEWSYM FxOpF8A2 ; SM (XX),RN store word in RAM - SMRN 8 -NEWSYM FxOpF9A2 ; SM (XX),RN store word in RAM - SMRN 9 -NEWSYM FxOpFAA2 ; SM (XX),RN store word in RAM - SMRN 10 -NEWSYM FxOpFBA2 ; SM (XX),RN store word in RAM - SMRN 11 -NEWSYM FxOpFCA2 ; SM (XX),RN store word in RAM - SMRN 12 -NEWSYM FxOpFDA2 ; SM (XX),RN store word in RAM - SMRN 13 -NEWSYM FxOpFEA2 ; SM (XX),RN store word in RAM - SMRN 14 -NEWSYM FxOpFFA2 ; SM (XX),RN store word in RAM - FETCHPIPE - mov ebx,ebp - sub ebx,[SfxCPB] - mov eax,ecx - inc ebp - FETCHPIPE - inc ebp - mov ah,cl - FETCHPIPE - mov dx,bx - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov [eax+ebx],dl - xor eax,1 - inc ebp - mov [eax+ebx],dh - CLRFLAGS - ret - -SECTION .bss - -NEWSYM NumberOfOpcodes, resd 1 ; Number of opcodes to execute -NEWSYM NumberOfOpcodesBU, resd 1 ; Number of opcodes to execute backup value -NEWSYM sfxwarningb, resb 1 - -SECTION .text - -NEWSYM MainLoop - mov eax,[SfxPBR] - and eax,0FFh -; mov byte[fxtrace+eax],1 - mov ebp,[SfxCPB] - add ebp,[SfxR15] - xor ecx,ecx - mov cl,[SfxPIPE] - mov ch,[SfxSFR+1] - and ch,03h - ; pack esi/edi - PackEsiEdi - jmp [FxTabled+ecx*4] - jmp .LoopAgain -ALIGN16 -.LoopAgain - call [FxTable+ecx*4] - dec dword[NumberOfOpcodes] - jnz .LoopAgain -.EndLoop -NEWSYM FXEndLoop - sub ebp,[SfxCPB] - mov [SfxR15],ebp - mov [SfxPIPE],cl - and byte[SfxSFR+1],0FFh-03h - or [SfxSFR+1],ch - UnPackEsiEdi - ret - -SECTION .data -NEWSYM fxtrace, db 0; times 65536 db 0 - - - diff --git a/tools/zsnes/src/chips/fxemu2.mac b/tools/zsnes/src/chips/fxemu2.mac deleted file mode 100644 index 367a865..0000000 --- a/tools/zsnes/src/chips/fxemu2.mac +++ /dev/null @@ -1,827 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%macro FETCHPIPE 0 -; mov edx,[SfxPBR] -; mov edx,[SfxMemTable+edx*4] -; mov edx,[SfxCPB] -; mov edx,[SfxR15] - mov cl,[ebp] -%endmacro - -%macro UpdateR14 0 -; mov edx,[SfxROMBR] -; mov edx,[SfxMemTable+edx*4] - mov eax,[SfxCROM] -; and dword[SfxR14],0FFFFh - add eax,[SfxR14] - mov [SfxRomBuffer],eax -%endmacro - -%macro CLRFLAGS 0 - ;and dword[SfxSFR],0FFFFh-0100h-0200h-1000h ; Clear ALT1,ALT2 and B Flags -; xor ch,ch -; mov dword[SfxB],0 ; Clear B Flag -; mov esi,SfxR0 -; mov edi,SfxR0 -%endmacro - -%macro TORN 1 ; V - FETCHPIPE - mov edi, SfxR0+%1*4 - inc ebp ; Increase program counter - call [FxTable+ecx*4] - mov edi,SfxR0 - ret -%endmacro - -%macro WITH 1 ; Verified. - FETCHPIPE - mov esi,SfxR0+%1*4 - mov edi,SfxR0+%1*4 - mov dword[SfxB],1 - inc ebp ; Increase program counter - call [FxTablec+ecx*4] - mov esi,SfxR0 - mov edi,SfxR0 - mov dword[SfxB],0 ; Clear B Flag - ret -%endmacro - -%macro STWRN 1 ; V - mov eax,[SfxR0+%1*4] ; Read register - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax ; Save last ram address - add dword[SfxLastRamAdr],ebx ; Save last ram address - mov edx,[esi] ; Read Source - FETCHPIPE - mov [ebx+eax],dl ; Store Word - xor eax,1 - inc ebp ; Increase program counter - mov [ebx+eax],dh ; Store Word - CLRFLAGS - ret -%endmacro - -%macro STBRN 1 ; V - mov eax,[SfxR0+%1*4] ; Read register - FETCHPIPE - add eax,[SfxRAMMem] - mov [SfxLastRamAdr],eax ; Save last ram address - mov ebx,[esi] ; Read Source - mov [eax],bl ; Store Byte - CLRFLAGS - inc ebp ; Increase program counter - ret -%endmacro - -%macro LDWRN 1 ; V - mov eax,[SfxR0+%1*4] ; Read register - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax ; Save last ram address - FETCHPIPE - mov dl,[ebx+eax] ; Store Word - add dword[SfxLastRamAdr],ebx ; Save last ram address - xor eax,1 - and edx,0FFFFh - inc ebp ; Increase program counter - mov dh,[ebx+eax] ; Store Word - mov [edi],edx ; Read Source - CLRFLAGS - ret -%endmacro - -%macro LDBRN 1 ; V - mov eax,[SfxR0+%1*4] ; Read register - FETCHPIPE - add eax,[SfxRAMMem] - xor ebx,ebx - mov [SfxLastRamAdr],eax ; Save last ram address - mov bl,[eax] ; Read Byte - inc ebp ; Increase program counter - mov [edi],ebx ; Store Result - CLRFLAGS - ret -%endmacro - -; test byte[SfxPOR],01h -; jnz .nozerocheck -; test byte[SfxPOR],02h -; jz .nodither - -; **** Can pre-calculate [SfxSCBR] << 10 + [sfxramdata] -; Pre-calculate fxbit values from color register - -%macro drawpix4b 0 - and [eax],edx - and [eax+16],edx - xor edx,0FFFFFFFFh - mov ebx,[fxbit01pcal] - and ebx,edx - or [eax], ebx - and edx,[fxbit23pcal] - or [eax+16], edx -%endmacro - -%macro drawpix4bd 0 - and [eax],edx - and [eax+16],edx - xor edx,0FFFFFFFFh - mov ebx,[fxbit45pcal] - and ebx,edx - or [eax], ebx - and edx,[fxbit67pcal] - or [eax+16], edx -%endmacro - -%macro drawpix2b 0 - and [eax],edx - xor edx,0FFFFFFFFh - and edx,[fxbit01pcal] - or [eax], edx -%endmacro - -%macro drawpix2bd 0 - and [eax],edx - xor edx,0FFFFFFFFh - and edx,[fxbit45pcal] - or [eax], edx -%endmacro - -%macro drawpix8b 0 - and [eax],edx - and [eax+16],edx - and [eax+32],edx - and [eax+48],edx - xor edx,0FFFFFFFFh - mov ebx,[fxbit01pcal] - and ebx,edx - or [eax], ebx - mov ebx,[fxbit23pcal] - and ebx,edx - or [eax+16], ebx - mov ebx,[fxbit45pcal] - and ebx,edx - or [eax+32], ebx - and edx,[fxbit67pcal] - or [eax+48], edx -%endmacro - -%macro drawpix8bd 0 - and [eax],edx - and [eax+16],edx - and [eax+32],edx - and [eax+48],edx - xor edx,0FFFFFFFFh - mov ebx,[fxbit45pcal] - and ebx,edx - or [eax], ebx - mov ebx,[fxbit67pcal] - and ebx,edx - or [eax+16], ebx - mov ebx,[fxbit01pcal] - and ebx,edx - or [eax+32], ebx - and edx,[fxbit23pcal] - or [eax+48], edx -%endmacro - -%macro plotb 5 - shl eax,%3 - and ebx,07h - add ebx,ebx - add eax,ebx - add eax,[SCBRrel] - mov bl,[SfxR1] - mov edx,[fxxand+ebx*4] - %2 -%endmacro - -%macro plotbz 5 - shl eax,%3 - and ebx,07h - add ebx,ebx - add eax,ebx - add eax,[SCBRrel] - mov bl,[SfxR1] - mov edx,[fxxand+ebx*4] - test byte[SfxCOLR],%5 - jz .nodraw - %2 -%endmacro - -%macro plotbd 5 - shl eax,%3 - and ebx,07h - add ebx,ebx - add eax,ebx - add eax,[SCBRrel] - mov bl,[SfxR1] - mov edx,[fxxand+ebx*4] - mov bl,[SfxR1] - xor bl,[SfxR2] - test bl,01h - jz .nodither4b - %4 - inc word[SfxR1] - %1 -.nodither4b - %2 -%endmacro - -%macro plotbzd 5 - shl eax,%3 - and ebx,07h - add ebx,ebx - add eax,ebx - add eax,[SCBRrel] - mov bl,[SfxR1] - mov edx,[fxxand+ebx*4] - test byte[SfxCOLR],%5 - jz near .nodraw - mov bl,[SfxR1] - xor bl,[SfxR2] - test bl,01h - jz .nodither4b - %4 - inc word[SfxR1] - %1 -.nodither4b - %2 -%endmacro - -%macro plotlines4b 1 - mov ebx,[SfxR2] - FETCHPIPE - mov bh,[SfxR1] - mov eax,[sfxclineloc] - inc ebp - mov eax,[eax+ebx*4] - cmp eax,0FFFFFFFFh - je near .nodraw - %1 ret, drawpix4b, 5, drawpix4bd, 0Fh -.nodraw - inc word[SfxR1] - ret -%endmacro - -%macro plotlines4bb 1 - mov ebx,[SfxR2] - FETCHPIPE - mov bh,[SfxR1] - mov eax,[sfxclineloc] - inc ebp - mov eax,[eax+ebx*4] - cmp eax,0FFFFFFFFh - je near .nodraw - %1 FXReturn, drawpix4b, 5, drawpix4bd, 0Fh -.nodraw - inc word[SfxR1] - FXReturn -%endmacro - -%macro plotlines2b 1 - mov ebx,[SfxR2] - FETCHPIPE - mov bh,[SfxR1] - mov eax,[sfxclineloc] - inc ebp - mov eax,[eax+ebx*4] - cmp eax,0FFFFFFFFh - je .nodraw - %1 ret, drawpix2b, 4, drawpix2bd, 03h -.nodraw - inc word[SfxR1] - ret -%endmacro - -%macro plotlines2bb 1 - mov ebx,[SfxR2] - FETCHPIPE - mov bh,[SfxR1] - mov eax,[sfxclineloc] - inc ebp - mov eax,[eax+ebx*4] - cmp eax,0FFFFFFFFh - je near .nodraw - %1 FXReturn, drawpix2b, 4, drawpix2bd, 03h -.nodraw - inc word[SfxR1] - FXReturn -%endmacro - -%macro plotlines8b 1 - mov ebx,[SfxR2] - FETCHPIPE - mov bh,[SfxR1] - mov eax,[sfxclineloc] - inc ebp - mov eax,[eax+ebx*4] - cmp eax,0FFFFFFFFh - je near .nodraw - %1 ret, drawpix8b, 6, drawpix8bd, 0FFh -.nodraw - inc word[SfxR1] - ret -%endmacro - -%macro plotlines8bb 1 - mov ebx,[SfxR2] - FETCHPIPE - mov bh,[SfxR1] - mov eax,[sfxclineloc] - inc ebp - mov eax,[eax+ebx*4] - cmp eax,0FFFFFFFFh - je .nodraw - %1 FXReturn, drawpix8b, 6, drawpix8bd, 0FFh -.nodraw - inc word[SfxR1] - FXReturn -%endmacro - -%macro plotlines8bl 1 - mov ebx,[SfxR2] - FETCHPIPE - mov bh,[SfxR1] - mov eax,[sfxclineloc] - inc ebp - mov eax,[eax+ebx*4] - cmp eax,0FFFFFFFFh - je near .nodraw - %1 ret, drawpix8b, 6, drawpix8bd, 0Fh -.nodraw - inc word[SfxR1] - ret -%endmacro - -%macro plotlines8bbl 1 - mov ebx,[SfxR2] - FETCHPIPE - mov bh,[SfxR1] - mov eax,[sfxclineloc] - inc ebp - mov eax,[eax+ebx*4] - cmp eax,0FFFFFFFFh - je .nodraw - %1 FXReturn, drawpix8b, 6, drawpix8bd, 0Fh -.nodraw - inc word[SfxR1] - FXReturn -%endmacro - -%macro ADDRN 1 ; V - mov eax, [esi] ; Read Source - mov ebx, [SfxR0+%1*4] - FETCHPIPE - add ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro ADCRN 1 ; V - FETCHPIPE - mov eax, [esi] ; Read Source - mov ebx, [SfxR0+%1*4] - shr byte[SfxCarry],1 - adc ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro ADIRN 1 ; V - mov eax, [esi] ; Read Source - FETCHPIPE - add ax,%1 - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro ADCIRN 1 ; V - FETCHPIPE - mov eax, [esi] ; Read Source - shr byte[SfxCarry],1 - adc ax,%1 - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro SUBRN 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] - FETCHPIPE - sub ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret -%endmacro - -%macro SBCRN 1 ; V - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] - cmp byte[SfxCarry],1 - sbb ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret -%endmacro - -%macro SUBIRN 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - sub ax,%1 - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - ret -%endmacro - -%macro CMPRN 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] - FETCHPIPE - sub ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - mov [SfxSignZero],eax - CLRFLAGS - inc ebp ; Increase program counter - ret -%endmacro - -%macro ANDRN 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] ; Read RN - FETCHPIPE - and eax,ebx - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro BICRN 1 ; V - mov ebx,[SfxR0+%1*4] ; Read RN - mov eax,[esi] ; Read Source - xor ebx,0FFFFh - FETCHPIPE - and eax,ebx - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro ANDIRN 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - and eax,%1 - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro BICIRN 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - and eax,%1 - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro MULTRN 1 ; V - mov al,[esi] ; Read Source - mov bl,[SfxR0+%1*4] ; Read RN - FETCHPIPE - imul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro UMULTRN 1 ; V - mov al,[esi] ; Read Source - mov bl,[SfxR0+%1*4] ; Read RN - FETCHPIPE - mul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro MULTIRN 1 ; V - mov al,[esi] ; Read Source - mov bl,%1 ; Read RN - FETCHPIPE - imul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro UMULTIRN 1 ; V - mov al,[esi] ; Read Source - mov bl,%1 ; Read RN - FETCHPIPE - mul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - ret -%endmacro - -%macro LINK 1 ; Verified. - mov eax,ebp - sub eax,[SfxCPB] - add eax,%1 - FETCHPIPE - mov [SfxR11],ax - CLRFLAGS - inc ebp - ret -%endmacro - -%macro JMPRN 1 ; V - FETCHPIPE - mov eax,[SfxR0+%1*4] ; Read RN - mov ebp,[SfxCPB] - add ebp,eax - CLRFLAGS - ret -%endmacro - -%macro LJMPRN 1 ; V - FETCHPIPE - mov eax,[SfxR0+%1*4] - and eax,07Fh - mov [SfxPBR],al -; mov byte[fxtrace+eax],1 - mov eax,[SfxMemTable+eax*4] - mov [SfxCPB],eax - mov ebp,eax - add ebp,[esi] ; Read RN - mov dword[SfxCacheActive],0 - push ecx - call FxOp02 - pop ecx - dec ebp - ret -%endmacro - -%macro IBTRN 1 ; V - movsx eax,byte[ebp] - mov cl,[ebp+1] - add ebp,2 - mov [SfxR0+%1*4],ax - CLRFLAGS - ret -%endmacro - -%macro LMSRN 1 ; Verified. - xor eax,eax - mov al,[ebp] - add eax,eax - inc ebp - add eax,[SfxRAMMem] - mov cl,[ebp] - mov [SfxLastRamAdr],eax - mov ebx,[eax] ; Read word from ram - inc ebp - mov [SfxR0+%1*4],bx ; Write data - CLRFLAGS - ret -%endmacro - -%macro SMSRN 1 ; Verified. - xor eax,eax - mov al,[ebp] - inc ebp - add eax,eax - mov cl,[ebp] - add eax,[SfxRAMMem] - mov ebx,[SfxR0+%1*4] ; Read data - mov [SfxLastRamAdr],eax - inc ebp - mov [eax],bx ; Write word to ram - CLRFLAGS - ret -%endmacro - -%macro FROMRN 1 ; V - FETCHPIPE - mov esi,SfxR0+%1*4 - inc ebp ; Increase program counter - call [FxTable+ecx*4] - mov esi,SfxR0 - ret -%endmacro - -%macro ORRN 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] ; Read - FETCHPIPE - or eax,ebx - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - ret -%endmacro - -%macro XORRN 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] ; Read - FETCHPIPE - xor eax,ebx - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - ret -%endmacro - -%macro ORI 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - or eax,%1 - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - ret -%endmacro - -%macro XORI 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - xor eax,%1 - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - ret -%endmacro - -%macro INCRN 1 ; Verified - inc word[SfxR0+%1*4] - FETCHPIPE - mov eax,[SfxR0+%1*4] ; Read Source - mov [SfxSignZero],eax - CLRFLAGS - inc ebp - ret -%endmacro - -%macro DECRN 1 ; Verified - dec word[SfxR0+%1*4] - FETCHPIPE - mov eax,[SfxR0+%1*4] ; Read Source - mov [SfxR0+%1*4],eax - mov [SfxSignZero],eax - CLRFLAGS - inc ebp - ret -%endmacro - -%macro IWTRN 1 ; aka LEA ; Verified. - mov eax,[ebp] - mov cl,[ebp+2] - and eax,0FFFFh - add ebp,3 - mov [SfxR0+%1*4],eax - CLRFLAGS - ret -%endmacro - -%macro LMRN 1 ; Verified! - xor eax,eax - mov cl,[ebp+2] - mov ax,[ebp] - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov dl,[eax+ebx] - xor eax,1 - add ebp,3 - mov dh,[eax+ebx] - mov [SfxR0+%1*4],dx ; Store Word - CLRFLAGS - ret -%endmacro - -%macro SMRN 1 ; Verified - mov ebx,[SfxR0+%1*4] - mov eax,[ebp] - mov cl,[ebp+2] - and eax,0FFFFh - mov dx,bx - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov [eax+ebx],dl - xor eax,1 - add ebp,3 - mov [eax+ebx],dh - CLRFLAGS - ret -%endmacro - -%macro PackEsiEdi 0 - mov eax,[SfxSREG] - shl eax,2 - add eax,SfxR0 - mov esi,eax - mov eax,[SfxDREG] - shl eax,2 - add eax,SfxR0 - mov edi,eax - mov eax,[SfxRAMBR] - shl eax,16 - add eax,[sfxramdata] - mov [SfxRAMMem],eax -%endmacro - -%macro UnPackEsiEdi 0 - mov eax,esi - sub eax,SfxR0 - shr eax,2 - mov [SfxSREG],eax - mov eax,edi - sub eax,SfxR0 - shr eax,2 - mov [SfxDREG],eax -%endmacro - - diff --git a/tools/zsnes/src/chips/fxemu2b.asm b/tools/zsnes/src/chips/fxemu2b.asm deleted file mode 100644 index 0c7a9d4..0000000 --- a/tools/zsnes/src/chips/fxemu2b.asm +++ /dev/null @@ -1,615 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -%include "macros.mac" - -EXTSYM FxTable,FxTableb,FxTablec,SfxB,SfxCPB,SfxCROM,SfxCarry,SfxOverflow -EXTSYM SfxR0,SfxR14,SfxR15,SfxRomBuffer,SfxSignZero,withr15sk - -%include "chips/fxemu2.mac" -%include "chips/fxemu2b.mac" - -SECTION .text - - - - -NEWSYM FxOpb05 ; BRA branch always ; Verified. - movsx eax,byte[ebp] - mov cl,[ebp+1] - inc ebp - add ebp,eax - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb06 ; BGE branch on greater or equals ; Verified. - movsx eax,byte[ebp] - mov ebx,[SfxSignZero] - shr ebx,15 - inc ebp - xor bl,[SfxOverflow] - mov cl,[ebp] - test bl,01h - jnz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb07 ; BLT branch on lesss than ; Verified. - movsx eax,byte[ebp] - mov ebx,[SfxSignZero] - shr ebx,15 - inc ebp - xor bl,[SfxOverflow] - mov cl,[ebp] - test bl,01h - jz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb08 ; BNE branch on not equal ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],0FFFFh - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb09 ; BEQ branch on equal (z=1) ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],0FFFFh - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb0A ; BPL branch on plus ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],088000h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb0B ; BMI branch on minus ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],088000h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb0C ; BCC branch on carry clear ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxCarry],01h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb0D ; BCS branch on carry set ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxCarry],01h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb0E ; BVC branch on overflow clear ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxOverflow],01h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb0F ; BVS branch on overflow set ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxOverflow],01h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTableb+ecx*4] - ret -.nojump - inc ebp - call [FxTableb+ecx*4] - ret - -NEWSYM FxOpb10 ; TO RN set register n as destination register - TORNb 0 -NEWSYM FxOpb11 ; TO RN set register n as destination register - TORNb 1 -NEWSYM FxOpb12 ; TO RN set register n as destination register - TORNb 2 -NEWSYM FxOpb13 ; TO RN set register n as destination register - TORNb 3 -NEWSYM FxOpb14 ; TO RN set register n as destination register - TORNb 4 -NEWSYM FxOpb15 ; TO RN set register n as destination register - TORNb 5 -NEWSYM FxOpb16 ; TO RN set register n as destination register - TORNb 6 -NEWSYM FxOpb17 ; TO RN set register n as destination register - TORNb 7 -NEWSYM FxOpb18 ; TO RN set register n as destination register - TORNb 8 -NEWSYM FxOpb19 ; TO RN set register n as destination register - TORNb 9 -NEWSYM FxOpb1A ; TO RN set register n as destination register - TORNb 10 -NEWSYM FxOpb1B ; TO RN set register n as destination register - TORNb 11 -NEWSYM FxOpb1C ; TO RN set register n as destination register - TORNb 12 -NEWSYM FxOpb1D ; TO RN set register n as destination register - TORNb 13 -NEWSYM FxOpb1E ; TO RN set register n as destination register - FETCHPIPE - test dword[SfxB],1 - jnz .VersionB - mov edi,SfxR0+14*4 - inc ebp - mov eax,ebp - sub eax,[SfxCPB] - mov dword[withr15sk],1 - mov [SfxR15],eax - call [FxTableb+ecx*4] - mov edi,SfxR0 - UpdateR14 - ret -.VersionB - mov eax,[esi] ; Read Source - mov dword[withr15sk],1 - mov [SfxR0+14*4],eax ; Write - CLRFLAGS - UpdateR14 - inc ebp ; Increase program counter - ret -NEWSYM FxOpb1F ; TO RN set register n as destination register - FETCHPIPE - test dword[SfxB],1 - jnz .VersionB - mov edi,SfxR0+15*4 - inc ebp - mov eax,ebp - sub eax,[SfxCPB] - mov [SfxR15],eax - call [FxTableb+ecx*4] - mov ebp,[SfxCPB] - mov dword[withr15sk],1 - add ebp,[SfxR15] - mov edi,SfxR0 - ret -.VersionB - mov eax,[esi] ; Read Source - mov ebp,[SfxCPB] - mov dword[withr15sk],1 - add ebp,eax - CLRFLAGS - ret - -NEWSYM FxOpb3D ; ALT1 set alt1 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,01h - inc ebp - mov eax,ebp - sub eax,[SfxCPB] - mov [SfxR15],eax - call [FxTableb+ecx*4] - xor ch,ch - ret - -NEWSYM FxOpb3E ; ALT2 set alt1 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,02h - inc ebp - mov eax,ebp - sub eax,[SfxCPB] - mov [SfxR15],eax - call [FxTable+ecx*4] - xor ch,ch - ret - -NEWSYM FxOpb3F ; ALT3 set alt3 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,03h - inc ebp - mov eax,ebp - sub eax,[SfxCPB] - mov [SfxR15],eax - call [FxTable+ecx*4] - xor ch,ch - ret - -NEWSYM FxOpbB0 ; FROM rn set source register - FROMRNb 0 -NEWSYM FxOpbB1 ; FROM rn set source register - FROMRNb 1 -NEWSYM FxOpbB2 ; FROM rn set source register - FROMRNb 2 -NEWSYM FxOpbB3 ; FROM rn set source register - FROMRNb 3 -NEWSYM FxOpbB4 ; FROM rn set source register - FROMRNb 4 -NEWSYM FxOpbB5 ; FROM rn set source register - FROMRNb 5 -NEWSYM FxOpbB6 ; FROM rn set source register - FROMRNb 6 -NEWSYM FxOpbB7 ; FROM rn set source register - FROMRNb 7 -NEWSYM FxOpbB8 ; FROM rn set source register - FROMRNb 8 -NEWSYM FxOpbB9 ; FROM rn set source register - FROMRNb 9 -NEWSYM FxOpbBA ; FROM rn set source register - FROMRNb 10 -NEWSYM FxOpbBB ; FROM rn set source register - FROMRNb 11 -NEWSYM FxOpbBC ; FROM rn set source register - FROMRNb 12 -NEWSYM FxOpbBD ; FROM rn set source register - FROMRNb 13 -NEWSYM FxOpbBE ; FROM rn set source register - FROMRNb 14 -NEWSYM FxOpbBF ; FROM rn set source register - test dword[SfxB],1 - jnz .VersionB - mov esi,SfxR0+15*4 - inc ebp ; Increase program counter - mov eax,ebp - sub eax,[SfxCPB] - mov [SfxR15],eax - call [FxTableb+ecx*4] - mov esi,SfxR0 - ret -.VersionB - FETCHPIPE - mov eax,ebp - sub eax,[SfxCPB] - inc ebp - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - shr al,7 - mov [SfxOverflow],al - CLRFLAGS - ret - -NEWSYM FxOpc05 ; BRA branch always ; Verified. - movsx eax,byte[ebp] - mov cl,[ebp+1] - inc ebp - add ebp,eax - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc06 ; BGE branch on greater or equals ; Verified. - movsx eax,byte[ebp] - mov ebx,[SfxSignZero] - shr ebx,15 - inc ebp - xor bl,[SfxOverflow] - mov cl,[ebp] - test bl,01h - jnz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc07 ; BLT branch on lesss than ; Verified. - movsx eax,byte[ebp] - mov ebx,[SfxSignZero] - shr ebx,15 - inc ebp - xor bl,[SfxOverflow] - mov cl,[ebp] - test bl,01h - jz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc08 ; BNE branch on not equal ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],0FFFFh - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc09 ; BEQ branch on equal (z=1) ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],0FFFFh - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc0A ; BPL branch on plus ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],088000h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc0B ; BMI branch on minus ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],088000h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc0C ; BCC branch on carry clear ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxCarry],01h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc0D ; BCS branch on carry set ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxCarry],01h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc0E ; BVC branch on overflow clear ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxOverflow],01h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc0F ; BVS branch on overflow set ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxOverflow],01h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTablec+ecx*4] - ret -.nojump - inc ebp - call [FxTablec+ecx*4] - ret - -NEWSYM FxOpc10 ; TO RN set register n as destination register - TORNc 0 -NEWSYM FxOpc11 ; TO RN set register n as destination register - TORNc 1 -NEWSYM FxOpc12 ; TO RN set register n as destination register - TORNc 2 -NEWSYM FxOpc13 ; TO RN set register n as destination register - TORNc 3 -NEWSYM FxOpc14 ; TO RN set register n as destination register - TORNc 4 -NEWSYM FxOpc15 ; TO RN set register n as destination register - TORNc 5 -NEWSYM FxOpc16 ; TO RN set register n as destination register - TORNc 6 -NEWSYM FxOpc17 ; TO RN set register n as destination register - TORNc 7 -NEWSYM FxOpc18 ; TO RN set register n as destination register - TORNc 8 -NEWSYM FxOpc19 ; TO RN set register n as destination register - TORNc 9 -NEWSYM FxOpc1A ; TO RN set register n as destination register - TORNc 10 -NEWSYM FxOpc1B ; TO RN set register n as destination register - TORNc 11 -NEWSYM FxOpc1C ; TO RN set register n as destination register - TORNc 12 -NEWSYM FxOpc1D ; TO RN set register n as destination register - TORNc 13 -NEWSYM FxOpc1E ; TO RN set register n as destination register - FETCHPIPE - mov eax,[esi] ; Read Source - mov [SfxR0+14*4],eax ; Write - CLRFLAGS - UpdateR14 - inc ebp ; Increase program counter - ret -NEWSYM FxOpc1F ; TO RN set register n as destination register - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebp,[SfxCPB] - mov [SfxR15],eax - add ebp,eax - CLRFLAGS - ret - -NEWSYM FxOpc3D ; ALT1 set alt1 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,01h - inc ebp - call [FxTablec+ecx*4] - xor ch,ch - ret - -NEWSYM FxOpc3E ; ALT2 set alt1 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,02h - inc ebp - call [FxTablec+ecx*4] - xor ch,ch - ret - -NEWSYM FxOpc3F ; ALT3 set alt3 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,03h - inc ebp - call [FxTablec+ecx*4] - xor ch,ch - ret - -NEWSYM FxOpcB0 ; FROM rn set source register - FROMRNc 0 -NEWSYM FxOpcB1 ; FROM rn set source register - FROMRNc 1 -NEWSYM FxOpcB2 ; FROM rn set source register - FROMRNc 2 -NEWSYM FxOpcB3 ; FROM rn set source register - FROMRNc 3 -NEWSYM FxOpcB4 ; FROM rn set source register - FROMRNc 4 -NEWSYM FxOpcB5 ; FROM rn set source register - FROMRNc 5 -NEWSYM FxOpcB6 ; FROM rn set source register - FROMRNc 6 -NEWSYM FxOpcB7 ; FROM rn set source register - FROMRNc 7 -NEWSYM FxOpcB8 ; FROM rn set source register - FROMRNc 8 -NEWSYM FxOpcB9 ; FROM rn set source register - FROMRNc 9 -NEWSYM FxOpcBA ; FROM rn set source register - FROMRNc 10 -NEWSYM FxOpcBB ; FROM rn set source register - FROMRNc 11 -NEWSYM FxOpcBC ; FROM rn set source register - FROMRNc 12 -NEWSYM FxOpcBD ; FROM rn set source register - FROMRNc 13 -NEWSYM FxOpcBE ; FROM rn set source register - FROMRNc 14 -NEWSYM FxOpcBF ; FROM rn set source register - FETCHPIPE - mov eax,ebp - sub eax,[SfxCPB] - inc ebp - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - shr al,7 - mov [SfxOverflow],al - CLRFLAGS - ret diff --git a/tools/zsnes/src/chips/fxemu2b.mac b/tools/zsnes/src/chips/fxemu2b.mac deleted file mode 100644 index 9f649fc..0000000 --- a/tools/zsnes/src/chips/fxemu2b.mac +++ /dev/null @@ -1,92 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 [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 [SfxOverflow],al - CLRFLAGS - ret -%endmacro - - diff --git a/tools/zsnes/src/chips/fxemu2c.asm b/tools/zsnes/src/chips/fxemu2c.asm deleted file mode 100644 index 3031ca2..0000000 --- a/tools/zsnes/src/chips/fxemu2c.asm +++ /dev/null @@ -1,2553 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 FXEndLoop,FlushCache,FxOp02,FxTable,FxTableb,FxTablec,FxTabled -EXTSYM NumberOfOpcodes,SfxB,SfxCBR,SfxCFGR,SfxCOLR,SfxCPB,SfxCROM -EXTSYM SfxCacheActive,SfxCarry,SfxLastRamAdr,SfxMemTable,SfxOverflow -EXTSYM SfxPBR,SfxPIPE,SfxPOR,SfxR0,SfxR1,SfxR11,SfxR12,SfxR13,SfxR14 -EXTSYM SfxR15,SfxR2,SfxR4,SfxR6,SfxR7,SfxR8,SfxRAMBR,SfxRAMMem,SfxROMBR -EXTSYM SfxRomBuffer,SfxSCBR,SfxSCMR,SfxSFR,SfxSignZero,SfxnRamBanks,flagnz -EXTSYM sfx128lineloc,sfx160lineloc,sfx192lineloc,sfxobjlineloc,sfxramdata -EXTSYM withr15sk,sfxclineloc,SCBRrel,ChangeOps -EXTSYM fxbit01pcal,fxbit23pcal,fxbit45pcal,fxbit67pcal -EXTSYM fxbit01,fxbit23,fxbit45,fxbit67,fxxand,PLOTJmpa,PLOTJmpb - -%include "chips/fxemu2.mac" -%include "chips/fxemu2c.mac" - - - -SECTION .text - -ALIGN32 -NEWSYM FxOpd00 ; STOP stop GSU execution (and maybe generate an IRQ) ; Verified. - FETCHPIPE - mov [SfxPIPE],cl - and dword[SfxSFR],0FFFFh-32 ; Clear Go flag (set to 1 when the GSU is running) - test dword[SfxCFGR],080h ; Check if the interrupt generation is on - jnz .NoIRQ - ; Set IRQ Flag -.NoIRQ - CLRFLAGS - inc ebp - mov eax,[NumberOfOpcodes] - add eax,0F0000000h - add [ChangeOps],eax - mov dword[NumberOfOpcodes],1 - jmp FXEndLoop - FXReturn - -NEWSYM FxOpd01 ; NOP no operation ; Verified. - FETCHPIPE - CLRFLAGS - inc ebp ; Increase program counter - FXReturn - -NEWSYM FxOpd02 ; CACHE reintialize GSU cache - mov eax,ebp - FETCHPIPE - sub eax,[SfxCPB] - and eax,0FFF0h - cmp dword[SfxCBR],eax - je .SkipUpdate - cmp byte[SfxCacheActive],1 - je .SkipUpdate - mov [SfxCBR],eax - mov dword[SfxCacheActive],1 - call FlushCache -.SkipUpdate - CLRFLAGS - inc ebp ; Increase program counter - FXReturn - -NEWSYM FxOpd03 ; LSR logic shift right ; Verified. - mov eax,[esi] ; Read Source - FETCHPIPE - mov [SfxCarry],al - and byte[SfxCarry],1 - shr ax,1 ; logic shift right - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpd04 ; ROL rotate left (RCL?) ; V - shr byte[SfxCarry],1 - mov eax,[esi] ; Read Source - FETCHPIPE - rcl ax,1 - rcl byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpd05 ; BRA branch always ; Verified. - movsx eax,byte[ebp] - mov cl,[ebp+1] - inc ebp - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd06 ; BGE branch on greater or equals ; Verified. - movsx eax,byte[ebp] - mov ebx,[SfxSignZero] - shr ebx,15 - inc ebp - xor bl,[SfxOverflow] - mov cl,[ebp] - test bl,01h - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd07 ; BLT branch on lesss than ; Verified. - movsx eax,byte[ebp] - mov ebx,[SfxSignZero] - shr ebx,15 - inc ebp - xor bl,[SfxOverflow] - mov cl,[ebp] - test bl,01h - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd08 ; BNE branch on not equal ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],0FFFFh - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd09 ; BEQ branch on equal (z=1) ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],0FFFFh - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd0A ; BPL branch on plus ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],088000h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd0B ; BMI branch on minus ; Verified. - movsx eax,byte[ebp] - inc ebp - test dword[SfxSignZero],088000h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd0C ; BCC branch on carry clear ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxCarry],01h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd0D ; BCS branch on carry set ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxCarry],01h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd0E ; BVC branch on overflow clear ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxOverflow],01h - mov cl,[ebp] - jnz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd0F ; BVS branch on overflow set ; Verified. - movsx eax,byte[ebp] - inc ebp - test byte[SfxOverflow],01h - mov cl,[ebp] - jz .nojump - add ebp,eax - call [FxTable+ecx*4] - FXReturn2 -.nojump - inc ebp - call [FxTable+ecx*4] - FXReturn2 - -NEWSYM FxOpd10 ; TO RN set register n as destination register - TORNd 0 -NEWSYM FxOpd11 ; TO RN set register n as destination register - TORNd 1 -NEWSYM FxOpd12 ; TO RN set register n as destination register - TORNd 2 -NEWSYM FxOpd13 ; TO RN set register n as destination register - TORNd 3 -NEWSYM FxOpd14 ; TO RN set register n as destination register - TORNd 4 -NEWSYM FxOpd15 ; TO RN set register n as destination register - TORNd 5 -NEWSYM FxOpd16 ; TO RN set register n as destination register - TORNd 6 -NEWSYM FxOpd17 ; TO RN set register n as destination register - TORNd 7 -NEWSYM FxOpd18 ; TO RN set register n as destination register - TORNd 8 -NEWSYM FxOpd19 ; TO RN set register n as destination register - TORNd 9 -NEWSYM FxOpd1A ; TO RN set register n as destination register - TORNd 10 -NEWSYM FxOpd1B ; TO RN set register n as destination register - TORNd 11 -NEWSYM FxOpd1C ; TO RN set register n as destination register - TORNd 12 -NEWSYM FxOpd1D ; TO RN set register n as destination register - TORNd 13 -NEWSYM FxOpd1E ; TO RN set register n as destination register - FETCHPIPE - mov edi,SfxR0+14*4 - inc ebp - call [FxTable+ecx*4] - mov edi,SfxR0 - UpdateR14 - FXReturn -NEWSYM FxOpd1F ; TO RN set register n as destination register - FETCHPIPE - mov edi,SfxR0+15*4 - inc ebp - call [FxTable+ecx*4] - mov ebp,[SfxCPB] - add ebp,[SfxR15] - mov edi,SfxR0 - FXReturn - -NEWSYM FxOpd20 ; WITH set register n as source and destination register - WITHc 0 -NEWSYM FxOpd21 ; WITH set register n as source and destination register - WITHc 1 -NEWSYM FxOpd22 ; WITH set register n as source and destination register - WITHc 2 -NEWSYM FxOpd23 ; WITH set register n as source and destination register - WITHc 3 -NEWSYM FxOpd24 ; WITH set register n as source and destination register - WITHc 4 -NEWSYM FxOpd25 ; WITH set register n as source and destination register - WITHc 5 -NEWSYM FxOpd26 ; WITH set register n as source and destination register - WITHc 6 -NEWSYM FxOpd27 ; WITH set register n as source and destination register - WITHc 7 -NEWSYM FxOpd28 ; WITH set register n as source and destination register - WITHc 8 -NEWSYM FxOpd29 ; WITH set register n as source and destination register - WITHc 9 -NEWSYM FxOpd2A ; WITH set register n as source and destination register - WITHc 10 -NEWSYM FxOpd2B ; WITH set register n as source and destination register - WITHc 11 -NEWSYM FxOpd2C ; WITH set register n as source and destination register - WITHc 12 -NEWSYM FxOpd2D ; WITH set register n as source and destination register - WITHc 13 -NEWSYM FxOpd2E ; WITH set register n as source and destination register - FETCHPIPE - mov esi,SfxR0+14*4 - mov edi,SfxR0+14*4 - mov dword[SfxB],1 - inc ebp - call [FxTablec+ecx*4] - mov dword[SfxB],0 ; Clear B Flag - mov esi,SfxR0 - mov edi,SfxR0 - UpdateR14 - FXReturn -NEWSYM FxOpd2F ; WITH set register n as source and destination register - FETCHPIPE - mov esi,SfxR0+15*4 - mov edi,SfxR0+15*4 - mov dword[SfxB],1 - inc ebp - mov eax,ebp - sub eax,[SfxCPB] - mov dword[withr15sk],0 - mov [SfxR15],eax - call [FxTableb+ecx*4] - cmp dword[withr15sk],1 - je .skip - mov ebp,[SfxCPB] - add ebp,[SfxR15] -.skip - mov dword[SfxB],0 ; Clear B Flag - mov esi,SfxR0 - mov edi,SfxR0 - FXReturn - -NEWSYM FxOpd30 ; STW RN store word - STWRNc 0 -NEWSYM FxOpd31 ; STW RN store word - STWRNc 1 -NEWSYM FxOpd32 ; STW RN store word - STWRNc 2 -NEWSYM FxOpd33 ; STW RN store word - STWRNc 3 -NEWSYM FxOpd34 ; STW RN store word - STWRNc 4 -NEWSYM FxOpd35 ; STW RN store word - STWRNc 5 -NEWSYM FxOpd36 ; STW RN store word - STWRNc 6 -NEWSYM FxOpd37 ; STW RN store word - STWRNc 7 -NEWSYM FxOpd38 ; STW RN store word - STWRNc 8 -NEWSYM FxOpd39 ; STW RN store word - STWRNc 9 -NEWSYM FxOpd3A ; STW RN store word - STWRNc 10 -NEWSYM FxOpd3B ; STW RN store word - STWRNc 11 - -NEWSYM FxOpd30A1 ; STB RN store byte - STBRNc 0 -NEWSYM FxOpd31A1 ; STB RN store byte - STBRNc 1 -NEWSYM FxOpd32A1 ; STB RN store byte - STBRNc 2 -NEWSYM FxOpd33A1 ; STB RN store byte - STBRNc 3 -NEWSYM FxOpd34A1 ; STB RN store byte - STBRNc 4 -NEWSYM FxOpd35A1 ; STB RN store byte - STBRNc 5 -NEWSYM FxOpd36A1 ; STB RN store byte - STBRNc 6 -NEWSYM FxOpd37A1 ; STB RN store byte - STBRNc 7 -NEWSYM FxOpd38A1 ; STB RN store byte - STBRNc 8 -NEWSYM FxOpd39A1 ; STB RN store byte - STBRNc 9 -NEWSYM FxOpd3AA1 ; STB RN store byte - STBRNc 10 -NEWSYM FxOpd3BA1 ; STB RN store byte - STBRNc 11 - -NEWSYM FxOpd3C ; LOOP decrement loop counter, and branch on not zero ; V - dec word[SfxR12] ; decrement loop counter - FETCHPIPE - mov eax,[SfxR12] - mov [SfxSignZero],eax - or eax,eax - jz .NoBranch - mov eax,[SfxR13] - mov ebp,[SfxCPB] - add ebp,eax - CLRFLAGS - FXReturn -.NoBranch - inc ebp - CLRFLAGS - FXReturn - -NEWSYM FxOpd3D ; ALT1 set alt1 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,01h - inc ebp - call [FxTable+ecx*4] - xor ch,ch - FXReturn - -NEWSYM FxOpd3E ; ALT2 set alt1 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,02h - inc ebp - call [FxTable+ecx*4] - xor ch,ch - FXReturn - -NEWSYM FxOpd3F ; ALT3 set alt3 mode ; Verified. - FETCHPIPE - mov dword[SfxB],0 - or ch,03h - inc ebp - call [FxTable+ecx*4] - xor ch,ch - FXReturn - -NEWSYM FxOpd40 ; LDW RN load word from RAM - LDWRNc 0 -NEWSYM FxOpd41 ; LDW RN load word from RAM - LDWRNc 1 -NEWSYM FxOpd42 ; LDW RN load word from RAM - LDWRNc 2 -NEWSYM FxOpd43 ; LDW RN load word from RAM - LDWRNc 3 -NEWSYM FxOpd44 ; LDW RN load word from RAM - LDWRNc 4 -NEWSYM FxOpd45 ; LDW RN load word from RAM - LDWRNc 5 -NEWSYM FxOpd46 ; LDW RN load word from RAM - LDWRNc 6 -NEWSYM FxOpd47 ; LDW RN load word from RAM - LDWRNc 7 -NEWSYM FxOpd48 ; LDW RN load word from RAM - LDWRNc 8 -NEWSYM FxOpd49 ; LDW RN load word from RAM - LDWRNc 9 -NEWSYM FxOpd4A ; LDW RN load word from RAM - LDWRNc 10 -NEWSYM FxOpd4B ; LDW RN load word from RAM - LDWRNc 11 - -NEWSYM FxOpd40A1 ; LDB RN load byte from RAM - LDBRNc 0 -NEWSYM FxOpd41A1 ; LDB RN load byte from RAM - LDBRNc 1 -NEWSYM FxOpd42A1 ; LDB RN load byte from RAM - LDBRNc 2 -NEWSYM FxOpd43A1 ; LDB RN load byte from RAM - LDBRNc 3 -NEWSYM FxOpd44A1 ; LDB RN load byte from RAM - LDBRNc 4 -NEWSYM FxOpd45A1 ; LDB RN load byte from RAM - LDBRNc 5 -NEWSYM FxOpd46A1 ; LDB RN load byte from RAM - LDBRNc 6 -NEWSYM FxOpd47A1 ; LDB RN load byte from RAM - LDBRNc 7 -NEWSYM FxOpd48A1 ; LDB RN load byte from RAM - LDBRNc 8 -NEWSYM FxOpd49A1 ; LDB RN load byte from RAM - LDBRNc 9 -NEWSYM FxOpd4AA1 ; LDB RN load byte from RAM - LDBRNc 10 -NEWSYM FxOpd4BA1 ; LDB RN load byte from RAM - LDBRNc 11 - - -NEWSYM FxOpd4C1284b ; PLOT 4bit - plotlines4bb plotb -NEWSYM FxOpd4C1284bz ; PLOT 4bit, zero check - plotlines4bb plotbz -NEWSYM FxOpd4C1284bd ; PLOT 4bit, dither - plotlines4bb plotbd -NEWSYM FxOpd4C1284bzd ; PLOT 4bit, zero check + dither - plotlines4bb plotbzd - -NEWSYM FxOpd4C1282b ; PLOT 2bit - plotlines2bb plotb -NEWSYM FxOpd4C1282bz ; PLOT 2bit, zero check - plotlines2bb plotbz -NEWSYM FxOpd4C1282bd ; PLOT 2bit, dither - plotlines2bb plotbd -NEWSYM FxOpd4C1282bzd ; PLOT 2bit, zero check + dither - plotlines2bb plotbzd - -NEWSYM FxOpd4C1288b ; PLOT 8bit - plotlines8bb plotb -NEWSYM FxOpd4C1288bz ; PLOT 8bit, zero check - plotlines8bb plotbz -NEWSYM FxOpd4C1288bd ; PLOT 8bit, dither - plotlines8bb plotb -NEWSYM FxOpd4C1288bzd ; PLOT 8bit, zero check + dither - plotlines8bb plotbz - -NEWSYM FxOpd4C1288bl ; PLOT 8bit - plotlines8bbl plotb -NEWSYM FxOpd4C1288bzl ; PLOT 8bit, zero check - plotlines8bbl plotbz -NEWSYM FxOpd4C1288bdl ; PLOT 8bit, dither - plotlines8bbl plotb -NEWSYM FxOpd4C1288bzdl ; PLOT 8bit, zero check + dither - plotlines8bbl plotbz - -NEWSYM FxOpd4C ; PLOT plot pixel with R1,R2 as x,y and the color register as the color - jmp FxOpd4C1284b - - FETCHPIPE - inc ebp - CLRFLAGS - mov ebx,[SfxR2] - mov bh,[SfxR1] - mov eax,[sfxclineloc] - mov ebx,[eax+ebx*4] - cmp ebx,0FFFFFFFFh - je near .nodraw - xor eax,eax - ; bits 5/2 : 00 = 128 pixels, 01 = 160 pixels, 10 = 192 pixels, 11 = obj - ; bits 1/0 : 00 = 4 color, 01 = 16-color, 10 = not used, 11 = 256 color - ; 192 pixels = 24 tiles, 160 pixels = 20 tiles, 128 pixels = 16 tiles - ; 16+8(4/3) 16+4(4/2) 16(4/0) - push ecx - mov al,[SfxSCMR] - and al,00000011b ; 4 + 32 - cmp al,0 - je near .colors4 - cmp al,3 - je near .colors256 - - shl ebx,5 ; x32 (16 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - test byte[SfxPOR],01h - jnz .nozerocheck_16 - test byte[SfxCOLR],0Fh - jz .nodraw -.nozerocheck_16 - mov dl,[SfxCOLR] - test byte[SfxPOR],02h - jz .nodither4b - mov dh,[SfxR1] - xor dh,[SfxR2] - test dh,01h - jz .nodither4b - shr dh,4 -.nodither4b - and byte[eax],bh - and byte[eax+1],bh - and byte[eax+16],bh - and byte[eax+17],bh - test dl,01h - jz .nodraw_16 - or byte[eax], bl -.nodraw_16 - test dl,02h - jz .nodraw2_16 - or byte[eax+1], bl -.nodraw2_16 - test dl,04h - jz .nodraw3_16 - or byte[eax+16],bl -.nodraw3_16 - test dl,08h - jz .nodraw4_16 - or byte[eax+17],bl -.nodraw4_16 -.nodraw - inc word[SfxR1] - FXReturn - -.colors4 - shl ebx,4 ; x16 (4 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - test byte[SfxPOR],01h - jnz .nozerocheck_4 - test byte[SfxCOLR],03h - jz .noplot_4 -.nozerocheck_4 - mov dl,[SfxCOLR] - test byte[SfxPOR],02h - jz .nodither2b - mov dh,[SfxR1] - xor dh,[SfxR2] - test dh,01h - jz .nodither2b - shr dh,4 -.nodither2b - and byte[eax],bh - and byte[eax+1],bh - test dl,01h - jz .nodraw_4 - or byte[eax], bl -.nodraw_4 - test dl,02h - jz .nodraw2_4 - or byte[eax+1], bl -.nodraw2_4 -.noplot_4 - inc word[SfxR1] - FXReturn - -.colors256 - shl ebx,6 ; x64 (256 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - test byte[SfxPOR],01h - jnz .nozerocheck_256 - mov dl,0FFh - test byte[SfxPOR],08h - jz .nozerocheckb_256 - mov dl,0Fh -.nozerocheckb_256 - test byte[SfxCOLR],dl - jz .noplot_256 -.nozerocheck_256 - mov dl,[SfxCOLR] - and byte[eax],bh - and byte[eax+1],bh - and byte[eax+16],bh - and byte[eax+17],bh - and byte[eax+32],bh - and byte[eax+33],bh - and byte[eax+48],bh - and byte[eax+49],bh - test dl,01h - jz .nodraw_256 - or byte[eax], bl -.nodraw_256 - test dl,02h - jz .nodraw2_256 - or byte[eax+1], bl -.nodraw2_256 - test dl,04h - jz .nodraw3_256 - or byte[eax+16],bl -.nodraw3_256 - test dl,08h - jz .nodraw4_256 - or byte[eax+17],bl -.nodraw4_256 - test dl,10h - jz .nodraw5_256 - or byte[eax+32], bl -.nodraw5_256 - test dl,20h - jz .nodraw6_256 - or byte[eax+33], bl -.nodraw6_256 - test dl,40h - jz .nodraw7_256 - or byte[eax+48],bl -.nodraw7_256 - test dl,80h - jz .nodraw8_256 - or byte[eax+49],bl -.nodraw8_256 -.noplot_256 - inc word[SfxR1] - FXReturn - -SECTION .bss -.prevx resw 1 -.prevy resw 1 - -SECTION .text - -NEWSYM FxOpd4CA1 ; RPIX read color of the pixel with R1,R2 as x,y - FETCHPIPE - mov ebx,[SfxR2] - mov bh,[SfxR1] - test byte[SfxPOR],10h - jnz .objmode - mov al,[SfxSCMR] - and al,00100100b ; 4 + 32 - cmp al,4 - je .lines160 - cmp al,32 - je .lines192 - cmp al,36 - je .objmode - mov eax,[sfx128lineloc] - jmp .donelines -.lines160 - mov eax,[sfx160lineloc] - jmp .donelines -.lines192 - mov eax,[sfx192lineloc] - jmp .donelines -.objmode - mov eax,[sfxobjlineloc] -.donelines - mov ebx,[eax+ebx*4] - cmp ebx,0FFFFFFFFh - je near .nodraw - xor eax,eax - ; bits 5/2 : 00 = 128 pixels, 01 = 160 pixels, 10 = 192 pixels, 11 = obj - ; bits 1/0 : 00 = 4 color, 01 = 16-color, 10 = not used, 11 = 256 color - ; 192 pixels = 24 tiles, 160 pixels = 20 tiles, 128 pixels = 16 tiles - ; 16+8(4/3) 16+4(4/2) 16(4/0) - push ecx - mov al,[SfxSCMR] - and al,00000011b ; 4 + 32 - - cmp al,0 - je near .colors4 - cmp al,3 - je near .colors256 - - shl ebx,5 ; x32 (16 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - pop ecx - xor bh,bh - test byte[eax],bl - jz .nodraw_16 - or bh,01h -.nodraw_16 - test byte[eax+1],bl - jz .nodraw2_16 - or bh,02h -.nodraw2_16 - test byte[eax+16],bl - jz .nodraw3_16 - or bh,04h -.nodraw3_16 - test byte[eax+17],bl - jz .nodraw4_16 - or bh,08h -.nodraw4_16 -.nodraw - mov bl,bh - and ebx,0FFh - inc ebp -; UpdateR14 - CLRFLAGS - mov [edi],ebx ; Write Destination - mov [flagnz],ebx - FXReturn - -.colors4 - shl ebx,4 ; x16 (4 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - xor bh,bh - test byte[eax],bl - jz .nodraw_4 - or bh,01h -.nodraw_4 - test byte[eax+1],bl - jz .nodraw2_4 - or bh,02h -.nodraw2_4 - mov bl,bh - and ebx,0FFh - inc ebp -; UpdateR14 - CLRFLAGS - mov [edi],ebx ; Write Destination - mov [flagnz],ebx - FXReturn - -.colors256 - shl ebx,6 ; x64 (256 colors) - mov al,[SfxSCBR] - shl eax,10 ; Get SFX address - add eax,ebx - add eax,[sfxramdata] - mov ebx,[SfxR2] - and ebx,07h - shl ebx,1 - add eax,ebx - mov cl,[SfxR1] - and cl,07h - xor cl,07h - mov bl,1 - shl bl,cl - mov bh,bl - xor bh,0FFh - pop ecx - xor bh,bh - test byte[eax],bl - jz .nodraw_256 - or bh,01h -.nodraw_256 - test byte[eax+1],bl - jz .nodraw2_256 - or bh,02h -.nodraw2_256 - test byte[eax+16],bl - jz .nodraw3_256 - or bh,04h -.nodraw3_256 - test byte[eax+17],bl - jz .nodraw4_256 - or bh,08h -.nodraw4_256 - test byte[eax+32],bl - jz .nodraw5_256 - or bh,10h -.nodraw5_256 - test byte[eax+33],bl - jz .nodraw6_256 - or bh,20h -.nodraw6_256 - test byte[eax+48],bl - jz .nodraw7_256 - or bh,40h -.nodraw7_256 - test byte[eax+49],bl - jz .nodraw8_256 - or bh,80h -.nodraw8_256 - mov bl,bh - and ebx,0FFh - inc ebp -; UpdateR14 - CLRFLAGS - mov [edi],ebx ; Write Destination - mov [flagnz],ebx - FXReturn - -NEWSYM FxOpd4D ; SWAP swap upper and lower byte of a register ; V - mov eax,[esi] ; Read Source - FETCHPIPE - ror ax,8 - inc ebp ; Increase program counter - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn - -NEWSYM FxOpd4E ; COLOR copy source register to color register ; V - FETCHPIPE - mov eax,[esi] ; Read Source - ; if bit 3 of SfxPOR is set, then don't modify the upper 4 bits - test byte[SfxPOR],04h - jz .nohighnibble - mov bl,al - shr bl,4 - and al,0F0h - or al,bl -.nohighnibble - test byte[SfxPOR],08h - jnz .preserveupper - cmp [SfxCOLR],al - je .nocolchange - mov [SfxCOLR],al - and eax,0FFh - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx -.nocolchange - CLRFLAGS - inc ebp ; Increase program counter - FXReturn -.preserveupper - mov bl,[SfxCOLR] - and al,0Fh - and bl,0F0h - or al,bl - cmp [SfxCOLR],al - je .nocolchange - mov [SfxCOLR],al - and eax,0FFh - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx - CLRFLAGS - inc ebp ; Increase program counter - FXReturn - -NEWSYM FxOpd4EA1 ; CMODE set plot option register ; V - FETCHPIPE - mov eax,[esi] ; Read Source - inc ebp ; Increase program counter - mov [SfxPOR],eax - - test byte[SfxPOR],10h - jnz .objmode - mov al,[SfxSCMR] - and al,00100100b ; 4 + 32 - cmp al,4 - je .lines160 - cmp al,32 - je .lines192 - cmp al,36 - je .objmode - mov eax,[sfx128lineloc] - jmp .donelines -.lines160 - mov eax,[sfx160lineloc] - jmp .donelines -.lines192 - mov eax,[sfx192lineloc] - jmp .donelines -.objmode - mov eax,[sfxobjlineloc] -.donelines - mov [sfxclineloc],eax - - - push ebx - mov al,[SfxSCMR] - and eax,00000011b - mov bl,[SfxPOR] - and bl,0Fh - shl bl,2 - or al,bl - mov ebx,[PLOTJmpb+eax*4] - mov eax,[PLOTJmpa+eax*4] - - mov [FxTable+4Ch*4],eax - mov [FxTableb+4Ch*4],eax - mov [FxTablec+4Ch*4],eax - mov [FxTabled+4Ch*4],ebx - pop ebx - - CLRFLAGS - FXReturn - -NEWSYM FxOpd4F ; NOT perform exclusive exor with 1 on all bits ; V - mov eax,[esi] ; Read Source - FETCHPIPE - xor eax,0FFFFh - inc ebp ; Increase program counter - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn - -NEWSYM FxOpd50 ; ADD RN add, register + register - ADDRNc 0 -NEWSYM FxOpd51 ; ADD RN add, register + register - ADDRNc 1 -NEWSYM FxOpd52 ; ADD RN add, register + register - ADDRNc 2 -NEWSYM FxOpd53 ; ADD RN add, register + register - ADDRNc 3 -NEWSYM FxOpd54 ; ADD RN add, register + register - ADDRNc 4 -NEWSYM FxOpd55 ; ADD RN add, register + register - ADDRNc 5 -NEWSYM FxOpd56 ; ADD RN add, register + register - ADDRNc 6 -NEWSYM FxOpd57 ; ADD RN add, register + register - ADDRNc 7 -NEWSYM FxOpd58 ; ADD RN add, register + register - ADDRNc 8 -NEWSYM FxOpd59 ; ADD RN add, register + register - ADDRNc 9 -NEWSYM FxOpd5A ; ADD RN add, register + register - ADDRNc 10 -NEWSYM FxOpd5B ; ADD RN add, register + register - ADDRNc 11 -NEWSYM FxOpd5C ; ADD RN add, register + register - ADDRNc 12 -NEWSYM FxOpd5D ; ADD RN add, register + register - ADDRNc 13 -NEWSYM FxOpd5E ; ADD RN add, register + register - ADDRNc 14 -NEWSYM FxOpd5F ; ADD RN add, register + register - FETCHPIPE - mov eax, [esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - add ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn - -NEWSYM FxOpd50A1 ; ADC RN add with carry, register + register - ADCRNc 0 -NEWSYM FxOpd51A1 ; ADC RN add with carry, register + register - ADCRNc 1 -NEWSYM FxOpd52A1 ; ADC RN add with carry, register + register - ADCRNc 2 -NEWSYM FxOpd53A1 ; ADC RN add with carry, register + register - ADCRNc 3 -NEWSYM FxOpd54A1 ; ADC RN add with carry, register + register - ADCRNc 4 -NEWSYM FxOpd55A1 ; ADC RN add with carry, register + register - ADCRNc 5 -NEWSYM FxOpd56A1 ; ADC RN add with carry, register + register - ADCRNc 6 -NEWSYM FxOpd57A1 ; ADC RN add with carry, register + register - ADCRNc 7 -NEWSYM FxOpd58A1 ; ADC RN add with carry, register + register - ADCRNc 8 -NEWSYM FxOpd59A1 ; ADC RN add with carry, register + register - ADCRNc 9 -NEWSYM FxOpd5AA1 ; ADC RN add with carry, register + register - ADCRNc 10 -NEWSYM FxOpd5BA1 ; ADC RN add with carry, register + register - ADCRNc 11 -NEWSYM FxOpd5CA1 ; ADC RN add with carry, register + register - ADCRNc 12 -NEWSYM FxOpd5DA1 ; ADC RN add with carry, register + register - ADCRNc 13 -NEWSYM FxOpd5EA1 ; ADC RN add with carry, register + register - ADCRNc 14 -NEWSYM FxOpd5FA1 ; ADC RN add with carry, register + register - FETCHPIPE - mov eax, [esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - shr byte[SfxCarry],1 - adc ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn - -; Weird Opdode (FxOpd50A2, add 0, wow!) -NEWSYM FxOpd50A2 ; ADI RN add, register + immediate - ADIRNc 0 -NEWSYM FxOpd51A2 ; ADI RN add, register + immediate - ADIRNc 1 -NEWSYM FxOpd52A2 ; ADI RN add, register + immediate - ADIRNc 2 -NEWSYM FxOpd53A2 ; ADI RN add, register + immediate - ADIRNc 3 -NEWSYM FxOpd54A2 ; ADI RN add, register + immediate - ADIRNc 4 -NEWSYM FxOpd55A2 ; ADI RN add, register + immediate - ADIRNc 5 -NEWSYM FxOpd56A2 ; ADI RN add, register + immediate - ADIRNc 6 -NEWSYM FxOpd57A2 ; ADI RN add, register + immediate - ADIRNc 7 -NEWSYM FxOpd58A2 ; ADI RN add, register + immediate - ADIRNc 8 -NEWSYM FxOpd59A2 ; ADI RN add, register + immediate - ADIRNc 9 -NEWSYM FxOpd5AA2 ; ADI RN add, register + immediate - ADIRNc 10 -NEWSYM FxOpd5BA2 ; ADI RN add, register + immediate - ADIRNc 11 -NEWSYM FxOpd5CA2 ; ADI RN add, register + immediate - ADIRNc 12 -NEWSYM FxOpd5DA2 ; ADI RN add, register + immediate - ADIRNc 13 -NEWSYM FxOpd5EA2 ; ADI RN add, register + immediate - ADIRNc 14 -NEWSYM FxOpd5FA2 ; ADI RN add, register + immediate - ADIRNc 15 - -; Another very useful Opdode -NEWSYM FxOpd50A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 0 -NEWSYM FxOpd51A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 1 -NEWSYM FxOpd52A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 2 -NEWSYM FxOpd53A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 3 -NEWSYM FxOpd54A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 4 -NEWSYM FxOpd55A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 5 -NEWSYM FxOpd56A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 6 -NEWSYM FxOpd57A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 7 -NEWSYM FxOpd58A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 8 -NEWSYM FxOpd59A3 ; ADCIRN add with carry, register + immediate - ADCIRNc 9 -NEWSYM FxOpd5AA3 ; ADCIRN add with carry, register + immediate - ADCIRNc 10 -NEWSYM FxOpd5BA3 ; ADCIRN add with carry, register + immediate - ADCIRNc 11 -NEWSYM FxOpd5CA3 ; ADCIRN add with carry, register + immediate - ADCIRNc 12 -NEWSYM FxOpd5DA3 ; ADCIRN add with carry, register + immediate - ADCIRNc 13 -NEWSYM FxOpd5EA3 ; ADCIRN add with carry, register + immediate - ADCIRNc 14 -NEWSYM FxOpd5FA3 ; ADCIRN add with carry, register + immediate - ADCIRNc 15 - -NEWSYM FxOpd60 ; SUBRN subtract, register - register - SUBRNc 0 -NEWSYM FxOpd61 ; SUBRN subtract, register - register - SUBRNc 1 -NEWSYM FxOpd62 ; SUBRN subtract, register - register - SUBRNc 2 -NEWSYM FxOpd63 ; SUBRN subtract, register - register - SUBRNc 3 -NEWSYM FxOpd64 ; SUBRN subtract, register - register - SUBRNc 4 -NEWSYM FxOpd65 ; SUBRN subtract, register - register - SUBRNc 5 -NEWSYM FxOpd66 ; SUBRN subtract, register - register - SUBRNc 6 -NEWSYM FxOpd67 ; SUBRN subtract, register - register - SUBRNc 7 -NEWSYM FxOpd68 ; SUBRN subtract, register - register - SUBRNc 8 -NEWSYM FxOpd69 ; SUBRN subtract, register - register - SUBRNc 9 -NEWSYM FxOpd6A ; SUBRN subtract, register - register - SUBRNc 10 -NEWSYM FxOpd6B ; SUBRN subtract, register - register - SUBRNc 11 -NEWSYM FxOpd6C ; SUBRN subtract, register - register - SUBRNc 12 -NEWSYM FxOpd6D ; SUBRN subtract, register - register - SUBRNc 13 -NEWSYM FxOpd6E ; SUBRN subtract, register - register - SUBRNc 14 -NEWSYM FxOpd6F ; SUBRN subtract, register - register - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - sub ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpd60A1 ; SBCRN subtract with carry, register - register - SBCRNc 0 -NEWSYM FxOpd61A1 ; SBCRN subtract with carry, register - register - SBCRNc 1 -NEWSYM FxOpd62A1 ; SBCRN subtract with carry, register - register - SBCRNc 2 -NEWSYM FxOpd63A1 ; SBCRN subtract with carry, register - register - SBCRNc 3 -NEWSYM FxOpd64A1 ; SBCRN subtract with carry, register - register - SBCRNc 4 -NEWSYM FxOpd65A1 ; SBCRN subtract with carry, register - register - SBCRNc 5 -NEWSYM FxOpd66A1 ; SBCRN subtract with carry, register - register - SBCRNc 6 -NEWSYM FxOpd67A1 ; SBCRN subtract with carry, register - register - SBCRNc 7 -NEWSYM FxOpd68A1 ; SBCRN subtract with carry, register - register - SBCRNc 8 -NEWSYM FxOpd69A1 ; SBCRN subtract with carry, register - register - SBCRNc 9 -NEWSYM FxOpd6AA1 ; SBCRN subtract with carry, register - register - SBCRNc 10 -NEWSYM FxOpd6BA1 ; SBCRN subtract with carry, register - register - SBCRNc 11 -NEWSYM FxOpd6CA1 ; SBCRN subtract with carry, register - register - SBCRNc 12 -NEWSYM FxOpd6DA1 ; SBCRN subtract with carry, register - register - SBCRNc 13 -NEWSYM FxOpd6EA1 ; SBCRN subtract with carry, register - register - SBCRNc 14 -NEWSYM FxOpd6FA1 ; SBCRN subtract with carry, register - register - mov eax,[esi] ; Read Source - mov ebx,ebp - FETCHPIPE - sub ebx,[SfxCPB] - cmp byte[SfxCarry],1 - sbb ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpd60A2 ; SUBIRN subtract, register - immediate - SUBIRNc 0 -NEWSYM FxOpd61A2 ; SUBIRN subtract, register - immediate - SUBIRNc 1 -NEWSYM FxOpd62A2 ; SUBIRN subtract, register - immediate - SUBIRNc 2 -NEWSYM FxOpd63A2 ; SUBIRN subtract, register - immediate - SUBIRNc 3 -NEWSYM FxOpd64A2 ; SUBIRN subtract, register - immediate - SUBIRNc 4 -NEWSYM FxOpd65A2 ; SUBIRN subtract, register - immediate - SUBIRNc 5 -NEWSYM FxOpd66A2 ; SUBIRN subtract, register - immediate - SUBIRNc 6 -NEWSYM FxOpd67A2 ; SUBIRN subtract, register - immediate - SUBIRNc 7 -NEWSYM FxOpd68A2 ; SUBIRN subtract, register - immediate - SUBIRNc 8 -NEWSYM FxOpd69A2 ; SUBIRN subtract, register - immediate - SUBIRNc 9 -NEWSYM FxOpd6AA2 ; SUBIRN subtract, register - immediate - SUBIRNc 10 -NEWSYM FxOpd6BA2 ; SUBIRN subtract, register - immediate - SUBIRNc 11 -NEWSYM FxOpd6CA2 ; SUBIRN subtract, register - immediate - SUBIRNc 12 -NEWSYM FxOpd6DA2 ; SUBIRN subtract, register - immediate - SUBIRNc 13 -NEWSYM FxOpd6EA2 ; SUBIRN subtract, register - immediate - SUBIRNc 14 -NEWSYM FxOpd6FA2 ; SUBIRN subtract, register - immediate - SUBIRNc 15 - -NEWSYM FxOpd60A3 ; CMPRN compare, register, register - CMPRNc 0 -NEWSYM FxOpd61A3 ; CMPRN compare, register, register - CMPRNc 1 -NEWSYM FxOpd62A3 ; CMPRN compare, register, register - CMPRNc 2 -NEWSYM FxOpd63A3 ; CMPRN compare, register, register - CMPRNc 3 -NEWSYM FxOpd64A3 ; CMPRN compare, register, register - CMPRNc 4 -NEWSYM FxOpd65A3 ; CMPRN compare, register, register - CMPRNc 5 -NEWSYM FxOpd66A3 ; CMPRN compare, register, register - CMPRNc 6 -NEWSYM FxOpd67A3 ; CMPRN compare, register, register - CMPRNc 7 -NEWSYM FxOpd68A3 ; CMPRN compare, register, register - CMPRNc 8 -NEWSYM FxOpd69A3 ; CMPRN compare, register, register - CMPRNc 9 -NEWSYM FxOpd6AA3 ; CMPRN compare, register, register - CMPRNc 10 -NEWSYM FxOpd6BA3 ; CMPRN compare, register, register - CMPRNc 11 -NEWSYM FxOpd6CA3 ; CMPRN compare, register, register - CMPRNc 12 -NEWSYM FxOpd6DA3 ; CMPRN compare, register, register - CMPRNc 13 -NEWSYM FxOpd6EA3 ; CMPRN compare, register, register - CMPRNc 14 -NEWSYM FxOpd6FA3 ; CMPRN compare, register, register - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - sub ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - mov [SfxSignZero],eax - CLRFLAGS - inc ebp ; Increase program counter - FXReturn - -NEWSYM FxOpd70 ; MERGE R7 as upper byte, R8 as lower byte (used for texture-mapping) */ - ; V - xor eax,eax - FETCHPIPE - mov ah,[SfxR7+1] - mov al,[SfxR8+1] - inc ebp - mov [edi],eax ; Write Destination - mov dword[SfxSignZero],0001h - test eax,0F0F0h - jz .nozero - mov dword[SfxSignZero],0000h -.nozero - test eax,08080h - jz .nosign - or dword[SfxSignZero],80000h -.nosign - mov dword[SfxOverflow],1 - test ax,0c0c0h - jnz .Overflow - mov dword[SfxOverflow],0 -.Overflow - mov dword[SfxCarry],1 - test ax,0e0e0h - jnz .Carry - mov dword[SfxCarry],0 -.Carry - CLRFLAGS - FXReturn - -NEWSYM FxOpd71 ; AND RN register & register - ANDRNc 1 -NEWSYM FxOpd72 ; AND RN register & register - ANDRNc 2 -NEWSYM FxOpd73 ; AND RN register & register - ANDRNc 3 -NEWSYM FxOpd74 ; AND RN register & register - ANDRNc 4 -NEWSYM FxOpd75 ; AND RN register & register - ANDRNc 5 -NEWSYM FxOpd76 ; AND RN register & register - ANDRNc 6 -NEWSYM FxOpd77 ; AND RN register & register - ANDRNc 7 -NEWSYM FxOpd78 ; AND RN register & register - ANDRNc 8 -NEWSYM FxOpd79 ; AND RN register & register - ANDRNc 9 -NEWSYM FxOpd7A ; AND RN register & register - ANDRNc 10 -NEWSYM FxOpd7B ; AND RN register & register - ANDRNc 11 -NEWSYM FxOpd7C ; AND RN register & register - ANDRNc 12 -NEWSYM FxOpd7D ; AND RN register & register - ANDRNc 13 -NEWSYM FxOpd7E ; AND RN register & register - ANDRNc 14 -NEWSYM FxOpd7F ; AND RN register & register - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - and eax,ebx - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn - -NEWSYM FxOpd71A1 ; BIC RN register & ~register - BICRNc 1 -NEWSYM FxOpd72A1 ; BIC RN register & ~register - BICRNc 2 -NEWSYM FxOpd73A1 ; BIC RN register & ~register - BICRNc 3 -NEWSYM FxOpd74A1 ; BIC RN register & ~register - BICRNc 4 -NEWSYM FxOpd75A1 ; BIC RN register & ~register - BICRNc 5 -NEWSYM FxOpd76A1 ; BIC RN register & ~register - BICRNc 6 -NEWSYM FxOpd77A1 ; BIC RN register & ~register - BICRNc 7 -NEWSYM FxOpd78A1 ; BIC RN register & ~register - BICRNc 8 -NEWSYM FxOpd79A1 ; BIC RN register & ~register - BICRNc 9 -NEWSYM FxOpd7AA1 ; BIC RN register & ~register - BICRNc 10 -NEWSYM FxOpd7BA1 ; BIC RN register & ~register - BICRNc 11 -NEWSYM FxOpd7CA1 ; BIC RN register & ~register - BICRNc 12 -NEWSYM FxOpd7DA1 ; BIC RN register & ~register - BICRNc 13 -NEWSYM FxOpd7EA1 ; BIC RN register & ~register - BICRNc 14 -NEWSYM FxOpd7FA1 ; BIC RN register & ~register - FETCHPIPE - mov ebx,ebp - sub ebx,[SfxCPB] - mov eax,[esi] ; Read Source - xor ebx,0FFFFh - and eax,ebx - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn - -NEWSYM FxOpd71A2 ; ANDIRNc and #n - register & immediate - ANDIRNc 1 -NEWSYM FxOpd72A2 ; ANDIRNc and #n - register & immediate - ANDIRNc 2 -NEWSYM FxOpd73A2 ; ANDIRNc and #n - register & immediate - ANDIRNc 3 -NEWSYM FxOpd74A2 ; ANDIRNc and #n - register & immediate - ANDIRNc 4 -NEWSYM FxOpd75A2 ; ANDIRNc and #n - register & immediate - ANDIRNc 5 -NEWSYM FxOpd76A2 ; ANDIRNc and #n - register & immediate - ANDIRNc 6 -NEWSYM FxOpd77A2 ; ANDIRNc and #n - register & immediate - ANDIRNc 7 -NEWSYM FxOpd78A2 ; ANDIRNc and #n - register & immediate - ANDIRNc 8 -NEWSYM FxOpd79A2 ; ANDIRNc and #n - register & immediate - ANDIRNc 9 -NEWSYM FxOpd7AA2 ; ANDIRNc and #n - register & immediate - ANDIRNc 10 -NEWSYM FxOpd7BA2 ; ANDIRNc and #n - register & immediate - ANDIRNc 11 -NEWSYM FxOpd7CA2 ; ANDIRNc and #n - register & immediate - ANDIRNc 12 -NEWSYM FxOpd7DA2 ; ANDIRNc and #n - register & immediate - ANDIRNc 13 -NEWSYM FxOpd7EA2 ; ANDIRNc and #n - register & immediate - ANDIRNc 14 -NEWSYM FxOpd7FA2 ; ANDIRNc and #n - register & immediate - ANDIRNc 15 - -NEWSYM FxOpd71A3 ; BICIRNc register & ~immediate - BICIRNc 1 ^ 0FFFFh -NEWSYM FxOpd72A3 ; BICIRNc register & ~immediate - BICIRNc 2 ^ 0FFFFh -NEWSYM FxOpd73A3 ; BICIRNc register & ~immediate - BICIRNc 3 ^ 0FFFFh -NEWSYM FxOpd74A3 ; BICIRNc register & ~immediate - BICIRNc 4 ^ 0FFFFh -NEWSYM FxOpd75A3 ; BICIRNc register & ~immediate - BICIRNc 5 ^ 0FFFFh -NEWSYM FxOpd76A3 ; BICIRNc register & ~immediate - BICIRNc 6 ^ 0FFFFh -NEWSYM FxOpd77A3 ; BICIRNc register & ~immediate - BICIRNc 7 ^ 0FFFFh -NEWSYM FxOpd78A3 ; BICIRNc register & ~immediate - BICIRNc 8 ^ 0FFFFh -NEWSYM FxOpd79A3 ; BICIRNc register & ~immediate - BICIRNc 9 ^ 0FFFFh -NEWSYM FxOpd7AA3 ; BICIRNc register & ~immediate - BICIRNc 10 ^ 0FFFFh -NEWSYM FxOpd7BA3 ; BICIRNc register & ~immediate - BICIRNc 11 ^ 0FFFFh -NEWSYM FxOpd7CA3 ; BICIRNc register & ~immediate - BICIRNc 12 ^ 0FFFFh -NEWSYM FxOpd7DA3 ; BICIRNc register & ~immediate - BICIRNc 13 ^ 0FFFFh -NEWSYM FxOpd7EA3 ; BICIRNc register & ~immediate - BICIRNc 14 ^ 0FFFFh -NEWSYM FxOpd7FA3 ; BICIRNc register & ~immediate - BICIRNc 15 ^ 0FFFFh - -NEWSYM FxOpd80 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 0 -NEWSYM FxOpd81 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 1 -NEWSYM FxOpd82 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 2 -NEWSYM FxOpd83 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 3 -NEWSYM FxOpd84 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 4 -NEWSYM FxOpd85 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 5 -NEWSYM FxOpd86 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 6 -NEWSYM FxOpd87 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 7 -NEWSYM FxOpd88 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 8 -NEWSYM FxOpd89 ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 9 -NEWSYM FxOpd8A ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 10 -NEWSYM FxOpd8B ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 11 -NEWSYM FxOpd8C ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 12 -NEWSYM FxOpd8D ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 13 -NEWSYM FxOpd8E ; MULTRNc 8 bit to 16 bit signed multiply, register * register - MULTRNc 14 -NEWSYM FxOpd8F ; MULTRNc 8 bit to 16 bit signed multiply, register * register - FETCHPIPE - mov ebx,ebp - mov al,[esi] ; Read Source - sub ebx,[SfxCPB] - imul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn - -NEWSYM FxOpd80A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 0 -NEWSYM FxOpd81A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 1 -NEWSYM FxOpd82A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 2 -NEWSYM FxOpd83A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 3 -NEWSYM FxOpd84A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 4 -NEWSYM FxOpd85A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 5 -NEWSYM FxOpd86A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 6 -NEWSYM FxOpd87A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 7 -NEWSYM FxOpd88A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 8 -NEWSYM FxOpd89A1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 9 -NEWSYM FxOpd8AA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 10 -NEWSYM FxOpd8BA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 11 -NEWSYM FxOpd8CA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 12 -NEWSYM FxOpd8DA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 13 -NEWSYM FxOpd8EA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - UMULTRNc 14 -NEWSYM FxOpd8FA1 ; UMULRN 8 bit to 16 bit unsigned multiply, register * register - FETCHPIPE - mov ebx,ebp - mov al,[esi] ; Read Source - sub ebx,[SfxCPB] - mul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn - -NEWSYM FxOpd80A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 0 -NEWSYM FxOpd81A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 1 -NEWSYM FxOpd82A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 2 -NEWSYM FxOpd83A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 3 -NEWSYM FxOpd84A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 4 -NEWSYM FxOpd85A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 5 -NEWSYM FxOpd86A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 6 -NEWSYM FxOpd87A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 7 -NEWSYM FxOpd88A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 8 -NEWSYM FxOpd89A2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 9 -NEWSYM FxOpd8AA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 10 -NEWSYM FxOpd8BA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 11 -NEWSYM FxOpd8CA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 12 -NEWSYM FxOpd8DA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 13 -NEWSYM FxOpd8EA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 14 -NEWSYM FxOpd8FA2 ; MULIRN 8 bit to 16 bit signed multiply, register * immediate - MULTIRNc 15 - -NEWSYM FxOpd80A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 0 -NEWSYM FxOpd81A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 1 -NEWSYM FxOpd82A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 2 -NEWSYM FxOpd83A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 3 -NEWSYM FxOpd84A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 4 -NEWSYM FxOpd85A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 5 -NEWSYM FxOpd86A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 6 -NEWSYM FxOpd87A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 7 -NEWSYM FxOpd88A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 8 -NEWSYM FxOpd89A3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 9 -NEWSYM FxOpd8AA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 10 -NEWSYM FxOpd8BA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 11 -NEWSYM FxOpd8CA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 12 -NEWSYM FxOpd8DA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 13 -NEWSYM FxOpd8EA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 14 -NEWSYM FxOpd8FA3 ;UMULIRN 8 bit to 16 bit unsigned multiply, register * immediate - UMULTIRNc 15 - -NEWSYM FxOpd90 ; SBK store word to last accessed RAM address ; V - mov ebx,[SfxLastRamAdr] ; Load last ram address - mov eax,[esi] ; Read Source - FETCHPIPE - mov [ebx],al ; Store Word - sub ebx,[SfxRAMMem] - xor ebx,1 - add ebx,[SfxRAMMem] - inc ebp ; Increase program counter - mov [ebx],ah ; Store Word - CLRFLAGS - FXReturn - -NEWSYM FxOpd91 ; LINKc#n R11 = R15 + immediate - LINKc 1 -NEWSYM FxOpd92 ; LINKc#n R11 = R15 + immediate - LINKc 2 -NEWSYM FxOpd93 ; LINKc#n R11 = R15 + immediate - LINKc 3 -NEWSYM FxOpd94 ; LINKc#n R11 = R15 + immediate - LINKc 4 - -NEWSYM FxOpd95 ; SEX sign extend 8 bit to 16 bit ; V - movsx eax, byte[esi] ; Read Source - FETCHPIPE - and eax,0FFFFh - inc ebp - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpd96 ; ASR aritmethic shift right by one ; V - mov eax,[esi] ; Read Source - FETCHPIPE - mov [SfxCarry],al - and byte[SfxCarry],1 - sar ax,1 ; logic shift right - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpd96A1 ; DIV2 aritmethic shift right by one ; V - mov eax,[esi] ; Read Source - FETCHPIPE - cmp ax,-1 - je .minusone - mov [SfxCarry],al - and byte[SfxCarry],1 - sar ax,1 ; logic shift right - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn -.minusone - mov byte[SfxCarry],1 - xor eax,eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpd97 ; ROR rotate right by one ; V - FETCHPIPE - mov eax,[esi] ; Read Source - shr byte[SfxCarry],1 - rcr ax,1 - setc byte[SfxCarry] - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpd98 ; JMPRNc jump to address of register - JMPRNc 8 -NEWSYM FxOpd99 ; JMPRNc jump to address of register - JMPRNc 9 -NEWSYM FxOpd9A ; JMPRNc jump to address of register - JMPRNc 10 -NEWSYM FxOpd9B ; JMPRNc jump to address of register - JMPRNc 11 -NEWSYM FxOpd9C ; JMPRNc jump to address of register - JMPRNc 12 -NEWSYM FxOpd9D ; JMPRNc jump to address of register - JMPRNc 13 - -NEWSYM FxOpd98A1 ; LJMPRNc set program bank to source register and jump to address of register - LJMPRNc 8 -NEWSYM FxOpd99A1 ; LJMPRNc set program bank to source register and jump to address of register - LJMPRNc 9 -NEWSYM FxOpd9AA1 ; LJMPRNc set program bank to source register and jump to address of register - LJMPRNc 10 -NEWSYM FxOpd9BA1 ; LJMPRNc set program bank to source register and jump to address of register - LJMPRNc 11 -NEWSYM FxOpd9CA1 ; LJMPRNc set program bank to source register and jump to address of register - LJMPRNc 12 -NEWSYM FxOpd9DA1 ; LJMPRNc set program bank to source register and jump to address of register - LJMPRNc 13 - -NEWSYM FxOpd9E ; LOB set upper byte to zero (keep low byte) ; V - mov eax,[esi] ; Read Source - FETCHPIPE - and eax,0FFh - inc ebp - mov [edi],eax ; Write Destination - shl eax,8 - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpd9F ; FMULT 16 bit to 32 bit signed multiplication, upper 16 bits only - ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR6] - FETCHPIPE - imul bx - inc ebp - and edx,0FFFFh - mov [SfxSignZero],edx - mov [edi],edx ; Write Destination - shr ax,15 - mov [SfxCarry],al - CLRFLAGS - FXReturn - -NEWSYM FxOpd9FA1 ; LMULT 16 bit to 32 bit signed multiplication ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR6] - FETCHPIPE - imul bx - and edx,0FFFFh - inc ebp - mov [edi],edx ; Write Destination - mov [SfxR4],ax - mov [SfxSignZero],edx - shr ax,15 - mov [SfxCarry],al - CLRFLAGS - FXReturn - -NEWSYM FxOpdA0 ; IBTRNc,#PP immediate byte transfer - IBTRNc 0 -NEWSYM FxOpdA1 ; IBTRNc,#PP immediate byte transfer - IBTRNc 1 -NEWSYM FxOpdA2 ; IBTRNc,#PP immediate byte transfer - IBTRNc 2 -NEWSYM FxOpdA3 ; IBTRNc,#PP immediate byte transfer - IBTRNc 3 -NEWSYM FxOpdA4 ; IBTRNc,#PP immediate byte transfer - IBTRNc 4 -NEWSYM FxOpdA5 ; IBTRNc,#PP immediate byte transfer - IBTRNc 5 -NEWSYM FxOpdA6 ; IBTRNc,#PP immediate byte transfer - IBTRNc 6 -NEWSYM FxOpdA7 ; IBTRNc,#PP immediate byte transfer - IBTRNc 7 -NEWSYM FxOpdA8 ; IBTRNc,#PP immediate byte transfer - IBTRNc 8 -NEWSYM FxOpdA9 ; IBTRNc,#PP immediate byte transfer - IBTRNc 9 -NEWSYM FxOpdAA ; IBTRNc,#PP immediate byte transfer - IBTRNc 10 -NEWSYM FxOpdAB ; IBTRNc,#PP immediate byte transfer - IBTRNc 11 -NEWSYM FxOpdAC ; IBTRNc,#PP immediate byte transfer - IBTRNc 12 -NEWSYM FxOpdAD ; IBTRNc,#PP immediate byte transfer - IBTRNc 13 -NEWSYM FxOpdAE ; IBTRNc,#PP immediate byte transfer - movsx eax,byte[ebp] - mov cl,[ebp+1] - add ebp,2 - mov [SfxR0+14*4],ax - UpdateR14 - CLRFLAGS - FXReturn -NEWSYM FxOpdAF ; IBTRNc,#PP immediate byte transfer - movsx eax,byte[ebp] - mov cl,[ebp+1] - and eax,0FFFFh - mov ebp,[SfxCPB] - add ebp,eax - CLRFLAGS - FXReturn - -NEWSYM FxOpdA0A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 0 -NEWSYM FxOpdA1A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 1 -NEWSYM FxOpdA2A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 2 -NEWSYM FxOpdA3A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 3 -NEWSYM FxOpdA4A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 4 -NEWSYM FxOpdA5A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 5 -NEWSYM FxOpdA6A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 6 -NEWSYM FxOpdA7A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 7 -NEWSYM FxOpdA8A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 8 -NEWSYM FxOpdA9A1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 9 -NEWSYM FxOpdAAA1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 10 -NEWSYM FxOpdABA1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 11 -NEWSYM FxOpdACA1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 12 -NEWSYM FxOpdADA1 ; LMS rn,(yy) load word from RAM (short address) - LMSRNc 13 -NEWSYM FxOpdAEA1 ; LMS rn,(yy) load word from RAM (short address) - xor eax,eax - mov al,[ebp] - add eax,eax - inc ebp - add eax,[SfxRAMMem] - mov cl,[ebp] - mov [SfxLastRamAdr],eax - mov ebx,[eax] ; Read word from ram - inc ebp - mov [SfxR0+14*4],bx ; Write data - UpdateR14 - CLRFLAGS - FXReturn -NEWSYM FxOpdAFA1 ; LMS rn,(yy) load word from RAM (short address) - xor eax,eax - mov al,[ebp] - add eax,eax - inc ebp - add eax,[SfxRAMMem] - mov cl,[ebp] - mov [SfxLastRamAdr],eax - mov ebx,[eax] ; Read word from ram - and ebx,0FFFFh - mov ebp,[SfxCPB] - add ebp,ebx - CLRFLAGS - FXReturn - -NEWSYM FxOpdA0A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 0 -NEWSYM FxOpdA1A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 1 -NEWSYM FxOpdA2A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 2 -NEWSYM FxOpdA3A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 3 -NEWSYM FxOpdA4A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 4 -NEWSYM FxOpdA5A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 5 -NEWSYM FxOpdA6A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 6 -NEWSYM FxOpdA7A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 7 -NEWSYM FxOpdA8A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 8 -NEWSYM FxOpdA9A2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 9 -NEWSYM FxOpdAAA2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 10 -NEWSYM FxOpdABA2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 11 -NEWSYM FxOpdACA2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 12 -NEWSYM FxOpdADA2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 13 -NEWSYM FxOpdAEA2 ; SMS (yy),rn store word in RAM (short address) - SMSRNc 14 -NEWSYM FxOpdAFA2 ; SMS (yy),rn store word in RAM (short address) - xor eax,eax - mov ebx,ebp - sub ebx,[SfxCPB] - mov al,[ebp] - inc ebp - add eax,eax - FETCHPIPE - add eax,[SfxRAMMem] - mov [SfxLastRamAdr],eax - inc ebp - mov [eax],bx ; Write word to ram - CLRFLAGS - FXReturn - -NEWSYM FxOpdB0 ; FROM rn set source register - FROMRNd 0 -NEWSYM FxOpdB1 ; FROM rn set source register - FROMRNd 1 -NEWSYM FxOpdB2 ; FROM rn set source register - FROMRNd 2 -NEWSYM FxOpdB3 ; FROM rn set source register - FROMRNd 3 -NEWSYM FxOpdB4 ; FROM rn set source register - FROMRNd 4 -NEWSYM FxOpdB5 ; FROM rn set source register - FROMRNd 5 -NEWSYM FxOpdB6 ; FROM rn set source register - FROMRNd 6 -NEWSYM FxOpdB7 ; FROM rn set source register - FROMRNd 7 -NEWSYM FxOpdB8 ; FROM rn set source register - FROMRNd 8 -NEWSYM FxOpdB9 ; FROM rn set source register - FROMRNd 9 -NEWSYM FxOpdBA ; FROM rn set source register - FROMRNd 10 -NEWSYM FxOpdBB ; FROM rn set source register - FROMRNd 11 -NEWSYM FxOpdBC ; FROM rn set source register - FROMRNd 12 -NEWSYM FxOpdBD ; FROM rn set source register - FROMRNd 13 -NEWSYM FxOpdBE ; FROM rn set source register - FROMRNd 14 -NEWSYM FxOpdBF ; FROM rn set source register - FETCHPIPE - mov esi,SfxR0+15*4 - inc ebp ; Increase program counter - mov eax,ebp - sub eax,[SfxCPB] - mov [SfxR15],eax - call [FxTableb+ecx*4] - mov esi,SfxR0 - FXReturn - -NEWSYM FxOpdC0 ; HIB move high-byte to low-byte ; V - mov eax,[esi] ; Read Source - FETCHPIPE - and eax,0FF00h - mov [SfxSignZero],eax - shr eax,8 - inc ebp - mov [edi],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpdC1 ; OR rn or rn - ORRNc 1 -NEWSYM FxOpdC2 ; OR rn or rn - ORRNc 2 -NEWSYM FxOpdC3 ; OR rn or rn - ORRNc 3 -NEWSYM FxOpdC4 ; OR rn or rn - ORRNc 4 -NEWSYM FxOpdC5 ; OR rn or rn - ORRNc 5 -NEWSYM FxOpdC6 ; OR rn or rn - ORRNc 6 -NEWSYM FxOpdC7 ; OR rn or rn - ORRNc 7 -NEWSYM FxOpdC8 ; OR rn or rn - ORRNc 8 -NEWSYM FxOpdC9 ; OR rn or rn - ORRNc 9 -NEWSYM FxOpdCA ; OR rn or rn - ORRNc 10 -NEWSYM FxOpdCB ; OR rn or rn - ORRNc 11 -NEWSYM FxOpdCC ; OR rn or rn - ORRNc 12 -NEWSYM FxOpdCD ; OR rn or rn - ORRNc 13 -NEWSYM FxOpdCE ; OR rn or rn - ORRNc 14 -NEWSYM FxOpdCF ; OR rn or rn - mov eax,[esi] ; Read Source - mov ebx,ebp - FETCHPIPE - sub ebx,[SfxCPB] - or eax,ebx - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpdC1A1 ; XOR rn xor rn - XORRNc 1 -NEWSYM FxOpdC2A1 ; XOR rn xor rn - XORRNc 2 -NEWSYM FxOpdC3A1 ; XOR rn xor rn - XORRNc 3 -NEWSYM FxOpdC4A1 ; XOR rn xor rn - XORRNc 4 -NEWSYM FxOpdC5A1 ; XOR rn xor rn - XORRNc 5 -NEWSYM FxOpdC6A1 ; XOR rn xor rn - XORRNc 6 -NEWSYM FxOpdC7A1 ; XOR rn xor rn - XORRNc 7 -NEWSYM FxOpdC8A1 ; XOR rn xor rn - XORRNc 8 -NEWSYM FxOpdC9A1 ; XOR rn xor rn - XORRNc 9 -NEWSYM FxOpdCAA1 ; XOR rn xor rn - XORRNc 10 -NEWSYM FxOpdCBA1 ; XOR rn xor rn - XORRNc 11 -NEWSYM FxOpdCCA1 ; XOR rn xor rn - XORRNc 12 -NEWSYM FxOpdCDA1 ; XOR rn xor rn - XORRNc 13 -NEWSYM FxOpdCEA1 ; XOR rn xor rn - XORRNc 14 -NEWSYM FxOpdCFA1 ; XOR rn xor rn - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,ebp - sub ebx,[SfxCPB] - xor eax,ebx - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpdC1A2 ; OR #n OR #n - ORIc 1 -NEWSYM FxOpdC2A2 ; OR #n OR #n - ORIc 2 -NEWSYM FxOpdC3A2 ; OR #n OR #n - ORIc 3 -NEWSYM FxOpdC4A2 ; OR #n OR #n - ORIc 4 -NEWSYM FxOpdC5A2 ; OR #n OR #n - ORIc 5 -NEWSYM FxOpdC6A2 ; OR #n OR #n - ORIc 6 -NEWSYM FxOpdC7A2 ; OR #n OR #n - ORIc 7 -NEWSYM FxOpdC8A2 ; OR #n OR #n - ORIc 8 -NEWSYM FxOpdC9A2 ; OR #n OR #n - ORIc 9 -NEWSYM FxOpdCAA2 ; OR #n OR #n - ORIc 10 -NEWSYM FxOpdCBA2 ; OR #n OR #n - ORIc 11 -NEWSYM FxOpdCCA2 ; OR #n OR #n - ORIc 12 -NEWSYM FxOpdCDA2 ; OR #n OR #n - ORIc 13 -NEWSYM FxOpdCEA2 ; OR #n OR #n - ORIc 14 -NEWSYM FxOpdCFA2 ; OR #n OR #n - ORIc 15 - -NEWSYM FxOpdC1A3 ; XOR #n xor #n - XORIc 1 -NEWSYM FxOpdC2A3 ; XOR #n xor #n - XORIc 2 -NEWSYM FxOpdC3A3 ; XOR #n xor #n - XORIc 3 -NEWSYM FxOpdC4A3 ; XOR #n xor #n - XORIc 4 -NEWSYM FxOpdC5A3 ; XOR #n xor #n - XORIc 5 -NEWSYM FxOpdC6A3 ; XOR #n xor #n - XORIc 6 -NEWSYM FxOpdC7A3 ; XOR #n xor #n - XORIc 7 -NEWSYM FxOpdC8A3 ; XOR #n xor #n - XORIc 8 -NEWSYM FxOpdC9A3 ; XOR #n xor #n - XORIc 9 -NEWSYM FxOpdCAA3 ; XOR #n xor #n - XORIc 10 -NEWSYM FxOpdCBA3 ; XOR #n xor #n - XORIc 11 -NEWSYM FxOpdCCA3 ; XOR #n xor #n - XORIc 12 -NEWSYM FxOpdCDA3 ; XOR #n xor #n - XORIc 13 -NEWSYM FxOpdCEA3 ; XOR #n xor #n - XORIc 14 -NEWSYM FxOpdCFA3 ; XOR #n xor #n - XORIc 15 - -NEWSYM FxOpdD0 ; INC rn increase by one - INCRNc 0 -NEWSYM FxOpdD1 ; INC rn increase by one - INCRNc 1 -NEWSYM FxOpdD2 ; INC rn increase by one - INCRNc 2 -NEWSYM FxOpdD3 ; INC rn increase by one - INCRNc 3 -NEWSYM FxOpdD4 ; INC rn increase by one - INCRNc 4 -NEWSYM FxOpdD5 ; INC rn increase by one - INCRNc 5 -NEWSYM FxOpdD6 ; INC rn increase by one - INCRNc 6 -NEWSYM FxOpdD7 ; INC rn increase by one - INCRNc 7 -NEWSYM FxOpdD8 ; INC rn increase by one - INCRNc 8 -NEWSYM FxOpdD9 ; INC rn increase by one - INCRNc 9 -NEWSYM FxOpdDA ; INC rn increase by one - INCRNc 10 -NEWSYM FxOpdDB ; INC rn increase by one - INCRNc 11 -NEWSYM FxOpdDC ; INC rn increase by one - INCRNc 12 -NEWSYM FxOpdDD ; INC rn increase by one - INCRNc 13 -NEWSYM FxOpdDE ; INC rn increase by one - FETCHPIPE - mov eax,[SfxR0+14*4] ; Read Source - inc ax - mov [SfxR0+14*4],eax - mov [SfxSignZero],eax - CLRFLAGS - inc ebp - UpdateR14 - FXReturn - -NEWSYM FxOpdDF ; GETC transfer ROM buffer to color register - mov eax,[SfxRomBuffer] - FETCHPIPE - mov eax,[eax] - test byte[SfxPOR],04h - jz .nohighnibble - mov bl,al - shr bl,4 - and al,0F0h - or al,bl -.nohighnibble - test byte[SfxPOR],08h - jnz .preserveupper - cmp [SfxCOLR],al - je .nocolchange - mov [SfxCOLR],al - and eax,0FFh - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx -.nocolchange - CLRFLAGS - inc ebp ; Increase program counter - FXReturn -.preserveupper - mov bl,[SfxCOLR] - and al,0Fh - and bl,0F0h - or al,bl - cmp [SfxCOLR],al - je .nocolchange - mov [SfxCOLR],al - and eax,0FFh - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx - CLRFLAGS - inc ebp ; Increase program counter - FXReturn - -NEWSYM FxOpdDFA2 ; RAMB set current RAM bank ; Verified - mov eax,[esi] ; Read Source - mov ebx,[SfxnRamBanks] - FETCHPIPE - dec ebx - and eax,ebx - mov [SfxRAMBR],eax - shl eax,16 - add eax,[sfxramdata] - mov [SfxRAMMem],eax - CLRFLAGS - inc ebp - FXReturn - -NEWSYM FxOpdDFA3 ; ROMB set current ROM bank ; Verified - mov eax,[esi] ; Read Source - and eax,07Fh - FETCHPIPE - mov [SfxROMBR],eax - mov eax,[SfxMemTable+eax*4] - mov [SfxCROM],eax - CLRFLAGS - inc ebp - FXReturn - -NEWSYM FxOpdE0 ; DEC rn decrement by one - DECRNc 0 -NEWSYM FxOpdE1 ; DEC rn decrement by one - DECRNc 1 -NEWSYM FxOpdE2 ; DEC rn decrement by one - DECRNc 2 -NEWSYM FxOpdE3 ; DEC rn decrement by one - DECRNc 3 -NEWSYM FxOpdE4 ; DEC rn decrement by one - DECRNc 4 -NEWSYM FxOpdE5 ; DEC rn decrement by one - DECRNc 5 -NEWSYM FxOpdE6 ; DEC rn decrement by one - DECRNc 6 -NEWSYM FxOpdE7 ; DEC rn decrement by one - DECRNc 7 -NEWSYM FxOpdE8 ; DEC rn decrement by one - DECRNc 8 -NEWSYM FxOpdE9 ; DEC rn decrement by one - DECRNc 9 -NEWSYM FxOpdEA ; DEC rn decrement by one - DECRNc 10 -NEWSYM FxOpdEB ; DEC rn decrement by one - DECRNc 11 -NEWSYM FxOpdEC ; DEC rn decrement by one - DECRNc 12 -NEWSYM FxOpdED ; DEC rn decrement by one - DECRNc 13 -NEWSYM FxOpdEE ; DEC rn decrement by one - dec word[SfxR0+14*4] - FETCHPIPE - mov eax,[SfxR0+14*4] ; Read Source - mov [SfxSignZero],eax - UpdateR14 - CLRFLAGS - inc ebp - FXReturn - -NEWSYM FxOpdEF ; getb get byte from ROM at address R14 ; V - FETCHPIPE - mov eax,[SfxRomBuffer] - inc ebp - mov eax,[eax] - and eax,0FFh -; cmp edi,SfxR15 -; je .nor15 - mov [edi],eax ; Write DREG - CLRFLAGS - FXReturn -.nor15 - or eax,8000h - mov [edi],eax ; Write DREG - CLRFLAGS - FXReturn - - add eax,ebp - sub eax,[SfxCPB] - mov [SfxR15],eax - CLRFLAGS - FXReturn - -NEWSYM FxOpdEFA1 ; getbh get high-byte from ROM at address R14 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxRomBuffer] - and eax,0FFh - FETCHPIPE - mov ah,[ebx] - inc ebp - mov [edi],eax ; Write DREG - CLRFLAGS - FXReturn - -NEWSYM FxOpdEFA2 ; getbl get low-byte from ROM at address R14 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxRomBuffer] - and eax,0FF00h - FETCHPIPE - mov al,[ebx] - inc ebp - mov [edi],eax ; Write DREG - CLRFLAGS - FXReturn - -NEWSYM FxOpdEFA3 ; getbs get sign extended byte from ROM at address R14 ; V - mov ebx,[SfxRomBuffer] - FETCHPIPE - movsx eax,byte[ebx] - inc ebp - mov [edi],ax ; Write DREG - CLRFLAGS - FXReturn - -NEWSYM FxOpdF0 ; IWT RN,#xx immediate word transfer to register - IWTRNc 0 -NEWSYM FxOpdF1 ; IWT RN,#xx immediate word transfer to register - IWTRNc 1 -NEWSYM FxOpdF2 ; IWT RN,#xx immediate word transfer to register - IWTRNc 2 -NEWSYM FxOpdF3 ; IWT RN,#xx immediate word transfer to register - IWTRNc 3 -NEWSYM FxOpdF4 ; IWT RN,#xx immediate word transfer to register - IWTRNc 4 -NEWSYM FxOpdF5 ; IWT RN,#xx immediate word transfer to register - IWTRNc 5 -NEWSYM FxOpdF6 ; IWT RN,#xx immediate word transfer to register - IWTRNc 6 -NEWSYM FxOpdF7 ; IWT RN,#xx immediate word transfer to register - IWTRNc 7 -NEWSYM FxOpdF8 ; IWT RN,#xx immediate word transfer to register - IWTRNc 8 -NEWSYM FxOpdF9 ; IWT RN,#xx immediate word transfer to register - IWTRNc 9 -NEWSYM FxOpdFA ; IWT RN,#xx immediate word transfer to register - IWTRNc 10 -NEWSYM FxOpdFB ; IWT RN,#xx immediate word transfer to register - IWTRNc 11 -NEWSYM FxOpdFC ; IWT RN,#xx immediate word transfer to register - IWTRNc 12 -NEWSYM FxOpdFD ; IWT RN,#xx immediate word transfer to register - IWTRNc 13 -NEWSYM FxOpdFE ; IWT RN,#xx immediate word transfer to register - mov eax,[ebp] - mov cl,[ebp+2] - and eax,0FFFFh - add ebp,3 - mov [SfxR0+14*4],eax - UpdateR14 - CLRFLAGS - FXReturn -NEWSYM FxOpdFF ; IWT RN,#xx immediate word transfer to register - mov eax,[ebp] - mov cl,[ebp+2] - and eax,0FFFFh - mov ebp,[SfxCPB] - add ebp,eax - CLRFLAGS - FXReturn - -NEWSYM FxOpdF0A1 ; LM RN,(XX) load word from RAM - LMRNc 0 -NEWSYM FxOpdF1A1 ; LM RN,(XX) load word from RAM - LMRNc 1 -NEWSYM FxOpdF2A1 ; LM RN,(XX) load word from RAM - LMRNc 2 -NEWSYM FxOpdF3A1 ; LM RN,(XX) load word from RAM - LMRNc 3 -NEWSYM FxOpdF4A1 ; LM RN,(XX) load word from RAM - LMRNc 4 -NEWSYM FxOpdF5A1 ; LM RN,(XX) load word from RAM - LMRNc 5 -NEWSYM FxOpdF6A1 ; LM RN,(XX) load word from RAM - LMRNc 6 -NEWSYM FxOpdF7A1 ; LM RN,(XX) load word from RAM - LMRNc 7 -NEWSYM FxOpdF8A1 ; LM RN,(XX) load word from RAM - LMRNc 8 -NEWSYM FxOpdF9A1 ; LM RN,(XX) load word from RAM - LMRNc 9 -NEWSYM FxOpdFAA1 ; LM RN,(XX) load word from RAM - LMRNc 10 -NEWSYM FxOpdFBA1 ; LM RN,(XX) load word from RAM - LMRNc 11 -NEWSYM FxOpdFCA1 ; LM RN,(XX) load word from RAM - LMRNc 12 -NEWSYM FxOpdFDA1 ; LM RN,(XX) load word from RAM - LMRNc 13 -NEWSYM FxOpdFEA1 ; LM RN,(XX) load word from RAM - xor eax,eax - mov cl,[ebp+2] - mov ax,[ebp] - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov dl,[eax+ebx] - xor eax,1 - add ebp,3 - mov dh,[eax+ebx] - mov [SfxR0+14*4],dx ; Store Word - UpdateR14 - CLRFLAGS - FXReturn -NEWSYM FxOpdFFA1 ; LM RN,(XX) load word from RAM - FETCHPIPE - mov eax,ecx - inc ebp - FETCHPIPE - inc ebp - mov ah,cl - FETCHPIPE - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov dl,[eax+ebx] - xor eax,1 - mov dh,[eax+ebx] - and edx,0FFFFh - mov ebp,[SfxCPB] - add ebp,edx - CLRFLAGS - FXReturn - -NEWSYM FxOpdF0A2 ; SM (XX),RN store word in RAM - SMRNc 0 -NEWSYM FxOpdF1A2 ; SM (XX),RN store word in RAM - SMRNc 1 -NEWSYM FxOpdF2A2 ; SM (XX),RN store word in RAM - SMRNc 2 -NEWSYM FxOpdF3A2 ; SM (XX),RN store word in RAM - SMRNc 3 -NEWSYM FxOpdF4A2 ; SM (XX),RN store word in RAM - SMRNc 4 -NEWSYM FxOpdF5A2 ; SM (XX),RN store word in RAM - SMRNc 5 -NEWSYM FxOpdF6A2 ; SM (XX),RN store word in RAM - SMRNc 6 -NEWSYM FxOpdF7A2 ; SM (XX),RN store word in RAM - SMRNc 7 -NEWSYM FxOpdF8A2 ; SM (XX),RN store word in RAM - SMRNc 8 -NEWSYM FxOpdF9A2 ; SM (XX),RN store word in RAM - SMRNc 9 -NEWSYM FxOpdFAA2 ; SM (XX),RN store word in RAM - SMRNc 10 -NEWSYM FxOpdFBA2 ; SM (XX),RN store word in RAM - SMRNc 11 -NEWSYM FxOpdFCA2 ; SM (XX),RN store word in RAM - SMRNc 12 -NEWSYM FxOpdFDA2 ; SM (XX),RN store word in RAM - SMRNc 13 -NEWSYM FxOpdFEA2 ; SM (XX),RN store word in RAM - SMRNc 14 -NEWSYM FxOpdFFA2 ; SM (XX),RN store word in RAM - FETCHPIPE - mov ebx,ebp - sub ebx,[SfxCPB] - mov eax,ecx - inc ebp - FETCHPIPE - inc ebp - mov ah,cl - FETCHPIPE - mov dx,bx - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov [eax+ebx],dl - xor eax,1 - inc ebp - mov [eax+ebx],dh - CLRFLAGS - FXReturn - - diff --git a/tools/zsnes/src/chips/fxemu2c.mac b/tools/zsnes/src/chips/fxemu2c.mac deleted file mode 100644 index 73b6009..0000000 --- a/tools/zsnes/src/chips/fxemu2c.mac +++ /dev/null @@ -1,532 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%macro FXReturn 0 - dec dword[NumberOfOpcodes] -;pushad - js %%endloop -;call WriteLine -;popad -%%blah - jmp [FxTabled+ecx*4] -%%endloop - jmp FXEndLoop - ALIGN32 -%endmacro - -%macro FXReturn2 0 - dec dword[NumberOfOpcodes] - js %%endloop - jmp [FxTabled+ecx*4] -%%endloop - jmp FXEndLoop - ALIGN32 -%endmacro - -%macro TORNd 1 ; V - FETCHPIPE - mov edi, SfxR0+%1*4 - inc ebp ; Increase program counter - call [FxTable+ecx*4] - mov edi,SfxR0 - FXReturn -%endmacro - -%macro WITHc 1 ; Verified. - FETCHPIPE - mov esi,SfxR0+%1*4 - mov edi,SfxR0+%1*4 - mov dword[SfxB],1 - inc ebp ; Increase program counter - call [FxTablec+ecx*4] - mov esi,SfxR0 - mov edi,SfxR0 - mov dword[SfxB],0 ; Clear B Flag - FXReturn -%endmacro - -%macro STWRNc 1 ; V - mov eax,[SfxR0+%1*4] ; Read register - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax ; Save last ram address - add dword[SfxLastRamAdr],ebx ; Save last ram address - mov edx,[esi] ; Read Source - FETCHPIPE - mov [ebx+eax],dl ; Store Word - xor eax,1 - inc ebp ; Increase program counter - mov [ebx+eax],dh ; Store Word - CLRFLAGS - FXReturn -%endmacro - -%macro STBRNc 1 ; V - mov eax,[SfxR0+%1*4] ; Read register - FETCHPIPE - add eax,[SfxRAMMem] - mov [SfxLastRamAdr],eax ; Save last ram address - mov ebx,[esi] ; Read Source - mov [eax],bl ; Store Byte - CLRFLAGS - inc ebp ; Increase program counter - FXReturn -%endmacro - -%macro LDWRNc 1 ; V - mov eax,[SfxR0+%1*4] ; Read register - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax ; Save last ram address - FETCHPIPE - mov dl,[ebx+eax] ; Store Word - add dword[SfxLastRamAdr],ebx ; Save last ram address - xor eax,1 - and edx,0FFFFh - inc ebp ; Increase program counter - mov dh,[ebx+eax] ; Store Word - mov [edi],edx ; Read Source - CLRFLAGS - FXReturn -%endmacro - -%macro LDBRNc 1 ; V - mov eax,[SfxR0+%1*4] ; Read register - FETCHPIPE - add eax,[SfxRAMMem] - xor ebx,ebx - mov [SfxLastRamAdr],eax ; Save last ram address - mov bl,[eax] ; Read Byte - inc ebp ; Increase program counter - mov [edi],ebx ; Store Result - CLRFLAGS - FXReturn -%endmacro - -%macro ADDRNc 1 ; V - mov eax, [esi] ; Read Source - mov ebx, [SfxR0+%1*4] - FETCHPIPE - add ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro ADCRNc 1 ; V - FETCHPIPE - mov eax, [esi] ; Read Source - mov ebx, [SfxR0+%1*4] - shr byte[SfxCarry],1 - adc ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro ADIRNc 1 ; V - mov eax, [esi] ; Read Source - FETCHPIPE - add ax,%1 - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro ADCIRNc 1 ; V - FETCHPIPE - mov eax, [esi] ; Read Source - shr byte[SfxCarry],1 - adc ax,%1 - seto byte[SfxOverflow] - setc byte[SfxCarry] - mov [SfxSignZero],eax - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro SUBRNc 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] - FETCHPIPE - sub ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn -%endmacro - -%macro SBCRNc 1 ; V - FETCHPIPE - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] - cmp byte[SfxCarry],1 - sbb ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn -%endmacro - -%macro SUBIRNc 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - sub ax,%1 - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - inc ebp ; Increase program counter - mov [edi],eax ; Write Destination - mov [SfxSignZero],eax - CLRFLAGS - FXReturn -%endmacro - -%macro CMPRNc 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] - FETCHPIPE - sub ax,bx - seto byte[SfxOverflow] - setc byte[SfxCarry] - xor byte[SfxCarry],1 - mov [SfxSignZero],eax - CLRFLAGS - inc ebp ; Increase program counter - FXReturn -%endmacro - -%macro ANDRNc 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] ; Read RN - FETCHPIPE - and eax,ebx - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro BICRNc 1 ; V - mov ebx,[SfxR0+%1*4] ; Read RN - mov eax,[esi] ; Read Source - xor ebx,0FFFFh - FETCHPIPE - and eax,ebx - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro ANDIRNc 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - and eax,%1 - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro BICIRNc 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - and eax,%1 - inc ebp - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro MULTRNc 1 ; V - mov al,[esi] ; Read Source - mov bl,[SfxR0+%1*4] ; Read RN - FETCHPIPE - imul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro UMULTRNc 1 ; V - mov al,[esi] ; Read Source - mov bl,[SfxR0+%1*4] ; Read RN - FETCHPIPE - mul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro MULTIRNc 1 ; V - mov al,[esi] ; Read Source - mov bl,%1 ; Read RN - FETCHPIPE - imul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro UMULTIRNc 1 ; V - mov al,[esi] ; Read Source - mov bl,%1 ; Read RN - FETCHPIPE - mul bl - inc ebp - and eax,0FFFFh - mov [SfxSignZero],eax - mov [edi],eax ; Write Destination - CLRFLAGS - FXReturn -%endmacro - -%macro LINKc 1 ; Verified. - mov eax,ebp - sub eax,[SfxCPB] - add eax,%1 - FETCHPIPE - mov [SfxR11],ax - CLRFLAGS - inc ebp - FXReturn -%endmacro - -%macro JMPRNc 1 ; V - FETCHPIPE - mov eax,[SfxR0+%1*4] ; Read RN - mov ebp,[SfxCPB] - add ebp,eax - CLRFLAGS - FXReturn -%endmacro - -%macro LJMPRNc 1 ; V - FETCHPIPE - mov eax,[SfxR0+%1*4] - and eax,07Fh - mov [SfxPBR],al -; mov byte[fxtrace+eax],1 - mov eax,[SfxMemTable+eax*4] - mov [SfxCPB],eax - mov ebp,eax - add ebp,[esi] ; Read RN - mov dword[SfxCacheActive],0 - push ecx - call FxOp02 - pop ecx - dec ebp - FXReturn -%endmacro - -%macro IBTRNc 1 ; V - movsx eax,byte[ebp] - mov cl,[ebp+1] - add ebp,2 - mov [SfxR0+%1*4],ax - CLRFLAGS - FXReturn -%endmacro - -%macro LMSRNc 1 ; Verified. - xor eax,eax - mov al,[ebp] - add eax,eax - inc ebp - add eax,[SfxRAMMem] - mov cl,[ebp] - mov [SfxLastRamAdr],eax - mov ebx,[eax] ; Read word from ram - inc ebp - mov [SfxR0+%1*4],bx ; Write data - CLRFLAGS - FXReturn -%endmacro - -%macro SMSRNc 1 ; Verified. - xor eax,eax - mov al,[ebp] - inc ebp - add eax,eax - mov cl,[ebp] - add eax,[SfxRAMMem] - mov ebx,[SfxR0+%1*4] ; Read data - mov [SfxLastRamAdr],eax - inc ebp - mov [eax],bx ; Write word to ram - CLRFLAGS - FXReturn -%endmacro - -%macro FROMRNd 1 ; V - FETCHPIPE - mov esi,SfxR0+%1*4 - inc ebp ; Increase program counter - call [FxTable+ecx*4] - mov esi,SfxR0 - FXReturn -%endmacro - -%macro ORRNc 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] ; Read - FETCHPIPE - or eax,ebx - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - FXReturn -%endmacro - -%macro XORRNc 1 ; V - mov eax,[esi] ; Read Source - mov ebx,[SfxR0+%1*4] ; Read - FETCHPIPE - xor eax,ebx - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - FXReturn -%endmacro - -%macro ORIc 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - or eax,%1 - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - FXReturn -%endmacro - -%macro XORIc 1 ; V - mov eax,[esi] ; Read Source - FETCHPIPE - xor eax,%1 - inc ebp - mov [edi],eax ; Write DREG - mov [SfxSignZero],eax - CLRFLAGS - FXReturn -%endmacro - -%macro INCRNc 1 ; Verified - inc word[SfxR0+%1*4] - FETCHPIPE - mov eax,[SfxR0+%1*4] ; Read Source - mov [SfxSignZero],eax - CLRFLAGS - inc ebp - FXReturn -%endmacro - -%macro DECRNc 1 ; Verified - dec word[SfxR0+%1*4] - FETCHPIPE - mov eax,[SfxR0+%1*4] ; Read Source - mov [SfxR0+%1*4],eax - mov [SfxSignZero],eax - CLRFLAGS - inc ebp - FXReturn -%endmacro - -%macro IWTRNc 1 ; aka LEA ; Verified. - mov eax,[ebp] - mov cl,[ebp+2] - and eax,0FFFFh - add ebp,3 - mov [SfxR0+%1*4],eax - CLRFLAGS - FXReturn -%endmacro - -%macro LMRNc 1 ; Verified! - xor eax,eax - mov cl,[ebp+2] - mov ax,[ebp] - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov dl,[eax+ebx] - xor eax,1 - add ebp,3 - mov dh,[eax+ebx] - mov [SfxR0+%1*4],dx ; Store Word - CLRFLAGS - FXReturn -%endmacro - -%macro SMRNc 1 ; Verified - mov ebx,[SfxR0+%1*4] - mov eax,[ebp] - mov cl,[ebp+2] - and eax,0FFFFh - mov dx,bx - mov ebx,[SfxRAMMem] - mov [SfxLastRamAdr],eax - add [SfxLastRamAdr],ebx - mov [eax+ebx],dl - xor eax,1 - add ebp,3 - mov [eax+ebx],dh - CLRFLAGS - FXReturn -%endmacro - - diff --git a/tools/zsnes/src/chips/fxtable.asm b/tools/zsnes/src/chips/fxtable.asm deleted file mode 100644 index 005bdfe..0000000 --- a/tools/zsnes/src/chips/fxtable.asm +++ /dev/null @@ -1,3535 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -%include "macros.mac" - -EXTSYM FxTable,FxTableA1,FxTableA2,FxTableA3,FxTableb,FxTablebA1,FxTablebA2 -EXTSYM FxTablebA3,FxTablec,FxTablecA1,FxTablecA2,FxTablecA3,FxTabled -EXTSYM FxTabledA1,FxTabledA2,FxTabledA3,SfxMemTable,romdata,sfxramdata -EXTSYM FxOp00,FxOp01,FxOp02,FxOp03,FxOp04,FxOp05,FxOp06,FxOp07,FxOp08 -EXTSYM FxOp09,FxOp0A,FxOp0B,FxOp0C,FxOp0D,FxOp0E,FxOp0F,FxOp10,FxOp11 -EXTSYM FxOp12,FxOp13,FxOp14,FxOp15,FxOp16,FxOp17,FxOp18,FxOp19,FxOp1A -EXTSYM FxOp1B,FxOp1C,FxOp1D,FxOp1E,FxOp1F,FxOp20,FxOp21,FxOp22,FxOp23 -EXTSYM FxOp24,FxOp25,FxOp26,FxOp27,FxOp28,FxOp29,FxOp2A,FxOp2B,FxOp2C -EXTSYM FxOp2D,FxOp2E,FxOp2F,FxOp30,FxOp30A1,FxOp31,FxOp31A1,FxOp32 -EXTSYM FxOp32A1,FxOp33,FxOp33A1,FxOp34,FxOp34A1,FxOp35,FxOp35A1,FxOp36 -EXTSYM FxOp36A1,FxOp37,FxOp37A1,FxOp38,FxOp38A1,FxOp39,FxOp39A1,FxOp3A -EXTSYM FxOp3AA1,FxOp3B,FxOp3BA1,FxOp3C,FxOp3D,FxOp3E,FxOp3F,FxOp40 -EXTSYM FxOp40A1,FxOp41,FxOp41A1,FxOp42,FxOp42A1,FxOp43,FxOp43A1,FxOp44 -EXTSYM FxOp44A1,FxOp45,FxOp45A1,FxOp46,FxOp46A1,FxOp47,FxOp47A1,FxOp48 -EXTSYM FxOp48A1,FxOp49,FxOp49A1,FxOp4A,FxOp4AA1,FxOp4B,FxOp4BA1,FxOp4C -EXTSYM FxOp4CA1,FxOp4D,FxOp4E,FxOp4EA1,FxOp4F,FxOp50,FxOp50A1,FxOp50A2 -EXTSYM FxOp50A3,FxOp51,FxOp51A1,FxOp51A2,FxOp51A3,FxOp52,FxOp52A1,FxOp52A2 -EXTSYM FxOp52A3,FxOp53,FxOp53A1,FxOp53A2,FxOp53A3,FxOp54,FxOp54A1,FxOp54A2 -EXTSYM FxOp54A3,FxOp55,FxOp55A1,FxOp55A2,FxOp55A3,FxOp56,FxOp56A1,FxOp56A2 -EXTSYM FxOp56A3,FxOp57,FxOp57A1,FxOp57A2,FxOp57A3,FxOp58,FxOp58A1,FxOp58A2 -EXTSYM FxOp58A3,FxOp59,FxOp59A1,FxOp59A2,FxOp59A3,FxOp5A,FxOp5AA1,FxOp5AA2 -EXTSYM FxOp5AA3,FxOp5B,FxOp5BA1,FxOp5BA2,FxOp5BA3,FxOp5C,FxOp5CA1,FxOp5CA2 -EXTSYM FxOp5CA3,FxOp5D,FxOp5DA1,FxOp5DA2,FxOp5DA3,FxOp5E,FxOp5EA1,FxOp5EA2 -EXTSYM FxOp5EA3,FxOp5F,FxOp5FA1,FxOp5FA2,FxOp5FA3,FxOp60,FxOp60A1,FxOp60A2 -EXTSYM FxOp60A3,FxOp61,FxOp61A1,FxOp61A2,FxOp61A3,FxOp62,FxOp62A1,FxOp62A2 -EXTSYM FxOp62A3,FxOp63,FxOp63A1,FxOp63A2,FxOp63A3,FxOp64,FxOp64A1,FxOp64A2 -EXTSYM FxOp64A3,FxOp65,FxOp65A1,FxOp65A2,FxOp65A3,FxOp66,FxOp66A1,FxOp66A2 -EXTSYM FxOp66A3,FxOp67,FxOp67A1,FxOp67A2,FxOp67A3,FxOp68,FxOp68A1,FxOp68A2 -EXTSYM FxOp68A3,FxOp69,FxOp69A1,FxOp69A2,FxOp69A3,FxOp6A,FxOp6AA1,FxOp6AA2 -EXTSYM FxOp6AA3,FxOp6B,FxOp6BA1,FxOp6BA2,FxOp6BA3,FxOp6C,FxOp6CA1,FxOp6CA2 -EXTSYM FxOp6CA3,FxOp6D,FxOp6DA1,FxOp6DA2,FxOp6DA3,FxOp6E,FxOp6EA1,FxOp6EA2 -EXTSYM FxOp6EA3,FxOp6F,FxOp6FA1,FxOp6FA2,FxOp6FA3,FxOp70,FxOp71,FxOp71A1 -EXTSYM FxOp71A2,FxOp71A3,FxOp72,FxOp72A1,FxOp72A2,FxOp72A3,FxOp73,FxOp73A1 -EXTSYM FxOp73A2,FxOp73A3,FxOp74,FxOp74A1,FxOp74A2,FxOp74A3,FxOp75,FxOp75A1 -EXTSYM FxOp75A2,FxOp75A3,FxOp76,FxOp76A1,FxOp76A2,FxOp76A3,FxOp77,FxOp77A1 -EXTSYM FxOp77A2,FxOp77A3,FxOp78,FxOp78A1,FxOp78A2,FxOp78A3,FxOp79,FxOp79A1 -EXTSYM FxOp79A2,FxOp79A3,FxOp7A,FxOp7AA1,FxOp7AA2,FxOp7AA3,FxOp7B,FxOp7BA1 -EXTSYM FxOp7BA2,FxOp7BA3,FxOp7C,FxOp7CA1,FxOp7CA2,FxOp7CA3,FxOp7D,FxOp7DA1 -EXTSYM FxOp7DA2,FxOp7DA3,FxOp7E,FxOp7EA1,FxOp7EA2,FxOp7EA3,FxOp7F,FxOp7FA1 -EXTSYM FxOp7FA2,FxOp7FA3,FxOp80,FxOp80A1,FxOp80A2,FxOp80A3,FxOp81,FxOp81A1 -EXTSYM FxOp81A2,FxOp81A3,FxOp82,FxOp82A1,FxOp82A2,FxOp82A3,FxOp83,FxOp83A1 -EXTSYM FxOp83A2,FxOp83A3,FxOp84,FxOp84A1,FxOp84A2,FxOp84A3,FxOp85,FxOp85A1 -EXTSYM FxOp85A2,FxOp85A3,FxOp86,FxOp86A1,FxOp86A2,FxOp86A3,FxOp87,FxOp87A1 -EXTSYM FxOp87A2,FxOp87A3,FxOp88,FxOp88A1,FxOp88A2,FxOp88A3,FxOp89,FxOp89A1 -EXTSYM FxOp89A2,FxOp89A3,FxOp8A,FxOp8AA1,FxOp8AA2,FxOp8AA3,FxOp8B,FxOp8BA1 -EXTSYM FxOp8BA2,FxOp8BA3,FxOp8C,FxOp8CA1,FxOp8CA2,FxOp8CA3,FxOp8D,FxOp8DA1 -EXTSYM FxOp8DA2,FxOp8DA3,FxOp8E,FxOp8EA1,FxOp8EA2,FxOp8EA3,FxOp8F,FxOp8FA1 -EXTSYM FxOp8FA2,FxOp8FA3,FxOp90,FxOp91,FxOp92,FxOp93,FxOp94,FxOp95,FxOp96 -EXTSYM FxOp96A1,FxOp97,FxOp98,FxOp98A1,FxOp99,FxOp99A1,FxOp9A,FxOp9AA1,FxOp9B -EXTSYM FxOp9BA1,FxOp9C,FxOp9CA1,FxOp9D,FxOp9DA1,FxOp9E,FxOp9F,FxOp9FA1,FxOpA0 -EXTSYM FxOpA0A1,FxOpA0A2,FxOpA1,FxOpA1A1,FxOpA1A2,FxOpA2,FxOpA2A1,FxOpA2A2 -EXTSYM FxOpA3,FxOpA3A1,FxOpA3A2,FxOpA4,FxOpA4A1,FxOpA4A2,FxOpA5,FxOpA5A1 -EXTSYM FxOpA5A2,FxOpA6,FxOpA6A1,FxOpA6A2,FxOpA7,FxOpA7A1,FxOpA7A2,FxOpA8 -EXTSYM FxOpA8A1,FxOpA8A2,FxOpA9,FxOpA9A1,FxOpA9A2,FxOpAA,FxOpAAA1,FxOpAAA2 -EXTSYM FxOpAB,FxOpABA1,FxOpABA2,FxOpAC,FxOpACA1,FxOpACA2,FxOpAD,FxOpADA1 -EXTSYM FxOpADA2,FxOpAE,FxOpAEA1,FxOpAEA2,FxOpAF,FxOpAFA1,FxOpAFA2,FxOpB0 -EXTSYM FxOpB1,FxOpB2,FxOpB3,FxOpB4,FxOpB5,FxOpB6,FxOpB7,FxOpB8,FxOpB9,FxOpBA -EXTSYM FxOpBB,FxOpBC,FxOpBD,FxOpBE,FxOpBF,FxOpC0,FxOpC1,FxOpC1A1,FxOpC1A2 -EXTSYM FxOpC1A3,FxOpC2,FxOpC2A1,FxOpC2A2,FxOpC2A3,FxOpC3,FxOpC3A1,FxOpC3A2 -EXTSYM FxOpC3A3,FxOpC4,FxOpC4A1,FxOpC4A2,FxOpC4A3,FxOpC5,FxOpC5A1,FxOpC5A2 -EXTSYM FxOpC5A3,FxOpC6,FxOpC6A1,FxOpC6A2,FxOpC6A3,FxOpC7,FxOpC7A1,FxOpC7A2 -EXTSYM FxOpC7A3,FxOpC8,FxOpC8A1,FxOpC8A2,FxOpC8A3,FxOpC9,FxOpC9A1,FxOpC9A2 -EXTSYM FxOpC9A3,FxOpCA,FxOpCAA1,FxOpCAA2,FxOpCAA3,FxOpCB,FxOpCBA1,FxOpCBA2 -EXTSYM FxOpCBA3,FxOpCC,FxOpCCA1,FxOpCCA2,FxOpCCA3,FxOpCD,FxOpCDA1,FxOpCDA2 -EXTSYM FxOpCDA3,FxOpCE,FxOpCEA1,FxOpCEA2,FxOpCEA3,FxOpCF,FxOpCFA1,FxOpCFA2 -EXTSYM FxOpCFA3,FxOpD0,FxOpD1,FxOpD2,FxOpD3,FxOpD4,FxOpD5,FxOpD6,FxOpD7 -EXTSYM FxOpD8,FxOpD9,FxOpDA,FxOpDB,FxOpDC,FxOpDD,FxOpDE,FxOpDF,FxOpDFA2 -EXTSYM FxOpDFA3,FxOpE0,FxOpE1,FxOpE2,FxOpE3,FxOpE4,FxOpE5,FxOpE6,FxOpE7 -EXTSYM FxOpE8,FxOpE9,FxOpEA,FxOpEB,FxOpEC,FxOpED,FxOpEE,FxOpEF,FxOpEFA1 -EXTSYM FxOpEFA2,FxOpEFA3,FxOpF0,FxOpF0A1,FxOpF0A2,FxOpF1,FxOpF1A1,FxOpF1A2 -EXTSYM FxOpF2,FxOpF2A1,FxOpF2A2,FxOpF3,FxOpF3A1,FxOpF3A2,FxOpF4,FxOpF4A1 -EXTSYM FxOpF4A2,FxOpF5,FxOpF5A1,FxOpF5A2,FxOpF6,FxOpF6A1,FxOpF6A2,FxOpF7 -EXTSYM FxOpF7A1,FxOpF7A2,FxOpF8,FxOpF8A1,FxOpF8A2,FxOpF9,FxOpF9A1,FxOpF9A2 -EXTSYM FxOpFA,FxOpFAA1,FxOpFAA2,FxOpFB,FxOpFBA1,FxOpFBA2,FxOpFC,FxOpFCA1 -EXTSYM FxOpFCA2,FxOpFD,FxOpFDA1,FxOpFDA2,FxOpFE,FxOpFEA1,FxOpFEA2,FxOpFF -EXTSYM FxOpFFA1,FxOpFFA2,FxOpb05,FxOpb06,FxOpb07,FxOpb08,FxOpb09,FxOpb0A -EXTSYM FxOpb0B,FxOpb0C,FxOpb0D,FxOpb0E,FxOpb0F,FxOpb10,FxOpb11,FxOpb12 -EXTSYM FxOpb13,FxOpb14,FxOpb15,FxOpb16,FxOpb17,FxOpb18,FxOpb19,FxOpb1A,FxOpb1B -EXTSYM FxOpb1C,FxOpb1D,FxOpb1E,FxOpb1F,FxOpb3D,FxOpb3E,FxOpb3F,FxOpbB0,FxOpbB1 -EXTSYM FxOpbB2,FxOpbB3,FxOpbB4,FxOpbB5,FxOpbB6,FxOpbB7,FxOpbB8,FxOpbB9,FxOpbBA -EXTSYM FxOpbBB,FxOpbBC,FxOpbBD,FxOpbBE,FxOpbBF,FxOpc05,FxOpc06,FxOpc07,FxOpc08 -EXTSYM FxOpc09,FxOpc0A,FxOpc0B,FxOpc0C,FxOpc0D,FxOpc0E,FxOpc0F,FxOpc10,FxOpc11 -EXTSYM FxOpc12,FxOpc13,FxOpc14,FxOpc15,FxOpc16,FxOpc17,FxOpc18,FxOpc19,FxOpc1A -EXTSYM FxOpc1B,FxOpc1C,FxOpc1D,FxOpc1E,FxOpc1F,FxOpc3D,FxOpc3E,FxOpc3F,FxOpcB0 -EXTSYM FxOpcB1,FxOpcB2,FxOpcB3,FxOpcB4,FxOpcB5,FxOpcB6,FxOpcB7,FxOpcB8,FxOpcB9 -EXTSYM FxOpcBA,FxOpcBB,FxOpcBC,FxOpcBD,FxOpcBE,FxOpcBF,FxOpd00,FxOpd01,FxOpd02 -EXTSYM FxOpd03,FxOpd04,FxOpd05,FxOpd06,FxOpd07,FxOpd08,FxOpd09,FxOpd0A,FxOpd0B -EXTSYM FxOpd0C,FxOpd0D,FxOpd0E,FxOpd0F,FxOpd10,FxOpd11,FxOpd12,FxOpd13,FxOpd14 -EXTSYM FxOpd15,FxOpd16,FxOpd17,FxOpd18,FxOpd19,FxOpd1A,FxOpd1B,FxOpd1C,FxOpd1D -EXTSYM FxOpd1E,FxOpd1F,FxOpd20,FxOpd21,FxOpd22,FxOpd23,FxOpd24,FxOpd25,FxOpd26 -EXTSYM FxOpd27,FxOpd28,FxOpd29,FxOpd2A,FxOpd2B,FxOpd2C,FxOpd2D,FxOpd2E,FxOpd2F -EXTSYM FxOpd30,FxOpd30A1,FxOpd31,FxOpd31A1,FxOpd32,FxOpd32A1,FxOpd33,FxOpd33A1 -EXTSYM FxOpd34,FxOpd34A1,FxOpd35,FxOpd35A1,FxOpd36,FxOpd36A1,FxOpd37,FxOpd37A1 -EXTSYM FxOpd38,FxOpd38A1,FxOpd39,FxOpd39A1,FxOpd3A,FxOpd3AA1,FxOpd3B,FxOpd3BA1 -EXTSYM FxOpd3C,FxOpd3D,FxOpd3E,FxOpd3F,FxOpd40,FxOpd40A1,FxOpd41,FxOpd41A1 -EXTSYM FxOpd42,FxOpd42A1,FxOpd43,FxOpd43A1,FxOpd44,FxOpd44A1,FxOpd45,FxOpd45A1 -EXTSYM FxOpd46,FxOpd46A1,FxOpd47,FxOpd47A1,FxOpd48,FxOpd48A1,FxOpd49,FxOpd49A1 -EXTSYM FxOpd4A,FxOpd4AA1,FxOpd4B,FxOpd4BA1,FxOpd4C,FxOpd4CA1,FxOpd4D,FxOpd4E -EXTSYM FxOpd4EA1,FxOpd4F,FxOpd50,FxOpd50A1,FxOpd50A2,FxOpd50A3,FxOpd51,FxOpd51A1 -EXTSYM FxOpd51A2,FxOpd51A3,FxOpd52,FxOpd52A1,FxOpd52A2,FxOpd52A3,FxOpd53 -EXTSYM FxOpd53A1,FxOpd53A2,FxOpd53A3,FxOpd54,FxOpd54A1,FxOpd54A2,FxOpd54A3 -EXTSYM FxOpd55,FxOpd55A1,FxOpd55A2,FxOpd55A3,FxOpd56,FxOpd56A1,FxOpd56A2 -EXTSYM FxOpd56A3,FxOpd57,FxOpd57A1,FxOpd57A2,FxOpd57A3,FxOpd58,FxOpd58A1 -EXTSYM FxOpd58A2,FxOpd58A3,FxOpd59,FxOpd59A1,FxOpd59A2,FxOpd59A3,FxOpd5A -EXTSYM FxOpd5AA1,FxOpd5AA2,FxOpd5AA3,FxOpd5B,FxOpd5BA1,FxOpd5BA2,FxOpd5BA3 -EXTSYM FxOpd5C,FxOpd5CA1,FxOpd5CA2,FxOpd5CA3,FxOpd5D,FxOpd5DA1,FxOpd5DA2 -EXTSYM FxOpd5DA3,FxOpd5E,FxOpd5EA1,FxOpd5EA2,FxOpd5EA3,FxOpd5F,FxOpd5FA1 -EXTSYM FxOpd5FA2,FxOpd5FA3,FxOpd60,FxOpd60A1,FxOpd60A2,FxOpd60A3,FxOpd61 -EXTSYM FxOpd61A1,FxOpd61A2,FxOpd61A3,FxOpd62,FxOpd62A1,FxOpd62A2,FxOpd62A3 -EXTSYM FxOpd63,FxOpd63A1,FxOpd63A2,FxOpd63A3,FxOpd64,FxOpd64A1,FxOpd64A2 -EXTSYM FxOpd64A3,FxOpd65,FxOpd65A1,FxOpd65A2,FxOpd65A3,FxOpd66,FxOpd66A1 -EXTSYM FxOpd66A2,FxOpd66A3,FxOpd67,FxOpd67A1,FxOpd67A2,FxOpd67A3,FxOpd68 -EXTSYM FxOpd68A1,FxOpd68A2,FxOpd68A3,FxOpd69,FxOpd69A1,FxOpd69A2,FxOpd69A3 -EXTSYM FxOpd6A,FxOpd6AA1,FxOpd6AA2,FxOpd6AA3,FxOpd6B,FxOpd6BA1,FxOpd6BA2 -EXTSYM FxOpd6BA3,FxOpd6C,FxOpd6CA1,FxOpd6CA2,FxOpd6CA3,FxOpd6D,FxOpd6DA1 -EXTSYM FxOpd6DA2,FxOpd6DA3,FxOpd6E,FxOpd6EA1,FxOpd6EA2,FxOpd6EA3,FxOpd6F -EXTSYM FxOpd6FA1,FxOpd6FA2,FxOpd6FA3,FxOpd70,FxOpd71,FxOpd71A1,FxOpd71A2 -EXTSYM FxOpd71A3,FxOpd72,FxOpd72A1,FxOpd72A2,FxOpd72A3,FxOpd73,FxOpd73A1 -EXTSYM FxOpd73A2,FxOpd73A3,FxOpd74,FxOpd74A1,FxOpd74A2,FxOpd74A3,FxOpd75 -EXTSYM FxOpd75A1,FxOpd75A2,FxOpd75A3,FxOpd76,FxOpd76A1,FxOpd76A2,FxOpd76A3 -EXTSYM FxOpd77,FxOpd77A1,FxOpd77A2,FxOpd77A3,FxOpd78,FxOpd78A1,FxOpd78A2 -EXTSYM FxOpd78A3,FxOpd79,FxOpd79A1,FxOpd79A2,FxOpd79A3,FxOpd7A,FxOpd7AA1 -EXTSYM FxOpd7AA2,FxOpd7AA3,FxOpd7B,FxOpd7BA1,FxOpd7BA2,FxOpd7BA3,FxOpd7C -EXTSYM FxOpd7CA1,FxOpd7CA2,FxOpd7CA3,FxOpd7D,FxOpd7DA1,FxOpd7DA2,FxOpd7DA3 -EXTSYM FxOpd7E,FxOpd7EA1,FxOpd7EA2,FxOpd7EA3,FxOpd7F,FxOpd7FA1,FxOpd7FA2 -EXTSYM FxOpd7FA3,FxOpd80,FxOpd80A1,FxOpd80A2,FxOpd80A3,FxOpd81,FxOpd81A1 -EXTSYM FxOpd81A2,FxOpd81A3,FxOpd82,FxOpd82A1,FxOpd82A2,FxOpd82A3,FxOpd83 -EXTSYM FxOpd83A1,FxOpd83A2,FxOpd83A3,FxOpd84,FxOpd84A1,FxOpd84A2,FxOpd84A3 -EXTSYM FxOpd85,FxOpd85A1,FxOpd85A2,FxOpd85A3,FxOpd86,FxOpd86A1,FxOpd86A2 -EXTSYM FxOpd86A3,FxOpd87,FxOpd87A1,FxOpd87A2,FxOpd87A3,FxOpd88,FxOpd88A1 -EXTSYM FxOpd88A2,FxOpd88A3,FxOpd89,FxOpd89A1,FxOpd89A2,FxOpd89A3,FxOpd8A -EXTSYM FxOpd8AA1,FxOpd8AA2,FxOpd8AA3,FxOpd8B,FxOpd8BA1,FxOpd8BA2,FxOpd8BA3 -EXTSYM FxOpd8C,FxOpd8CA1,FxOpd8CA2,FxOpd8CA3,FxOpd8D,FxOpd8DA1,FxOpd8DA2 -EXTSYM FxOpd8DA3,FxOpd8E,FxOpd8EA1,FxOpd8EA2,FxOpd8EA3,FxOpd8F,FxOpd8FA1 -EXTSYM FxOpd8FA2,FxOpd8FA3,FxOpd90,FxOpd91,FxOpd92,FxOpd93,FxOpd94,FxOpd95 -EXTSYM FxOpd96,FxOpd96A1,FxOpd97,FxOpd98,FxOpd98A1,FxOpd99,FxOpd99A1,FxOpd9A -EXTSYM FxOpd9AA1,FxOpd9B,FxOpd9BA1,FxOpd9C,FxOpd9CA1,FxOpd9D,FxOpd9DA1,FxOpd9E -EXTSYM FxOpd9F,FxOpd9FA1,FxOpdA0,FxOpdA0A1,FxOpdA0A2,FxOpdA1,FxOpdA1A1,FxOpdA1A2 -EXTSYM FxOpdA2,FxOpdA2A1,FxOpdA2A2,FxOpdA3,FxOpdA3A1,FxOpdA3A2,FxOpdA4,FxOpdA4A1 -EXTSYM FxOpdA4A2,FxOpdA5,FxOpdA5A1,FxOpdA5A2,FxOpdA6,FxOpdA6A1,FxOpdA6A2,FxOpdA7 -EXTSYM FxOpdA7A1,FxOpdA7A2,FxOpdA8,FxOpdA8A1,FxOpdA8A2,FxOpdA9,FxOpdA9A1 -EXTSYM FxOpdA9A2,FxOpdAA,FxOpdAAA1,FxOpdAAA2,FxOpdAB,FxOpdABA1,FxOpdABA2 -EXTSYM FxOpdAC,FxOpdACA1,FxOpdACA2,FxOpdAD,FxOpdADA1,FxOpdADA2,FxOpdAE -EXTSYM FxOpdAEA1,FxOpdAEA2,FxOpdAF,FxOpdAFA1,FxOpdAFA2,FxOpdB0,FxOpdB1,FxOpdB2 -EXTSYM FxOpdB3,FxOpdB4,FxOpdB5,FxOpdB6,FxOpdB7,FxOpdB8,FxOpdB9,FxOpdBA,FxOpdBB -EXTSYM FxOpdBC,FxOpdBD,FxOpdBE,FxOpdBF,FxOpdC0,FxOpdC1,FxOpdC1A1,FxOpdC1A2 -EXTSYM FxOpdC1A3,FxOpdC2,FxOpdC2A1,FxOpdC2A2,FxOpdC2A3,FxOpdC3,FxOpdC3A1 -EXTSYM FxOpdC3A2,FxOpdC3A3,FxOpdC4,FxOpdC4A1,FxOpdC4A2,FxOpdC4A3,FxOpdC5 -EXTSYM FxOpdC5A1,FxOpdC5A2,FxOpdC5A3,FxOpdC6,FxOpdC6A1,FxOpdC6A2,FxOpdC6A3 -EXTSYM FxOpdC7,FxOpdC7A1,FxOpdC7A2,FxOpdC7A3,FxOpdC8,FxOpdC8A1,FxOpdC8A2 -EXTSYM FxOpdC8A3,FxOpdC9,FxOpdC9A1,FxOpdC9A2,FxOpdC9A3,FxOpdCA,FxOpdCAA1 -EXTSYM FxOpdCAA2,FxOpdCAA3,FxOpdCB,FxOpdCBA1,FxOpdCBA2,FxOpdCBA3,FxOpdCC -EXTSYM FxOpdCCA1,FxOpdCCA2,FxOpdCCA3,FxOpdCD,FxOpdCDA1,FxOpdCDA2,FxOpdCDA3 -EXTSYM FxOpdCE,FxOpdCEA1,FxOpdCEA2,FxOpdCEA3,FxOpdCF,FxOpdCFA1,FxOpdCFA2 -EXTSYM FxOpdCFA3,FxOpdD0,FxOpdD1,FxOpdD2,FxOpdD3,FxOpdD4,FxOpdD5,FxOpdD6 -EXTSYM FxOpdD7,FxOpdD8,FxOpdD9,FxOpdDA,FxOpdDB,FxOpdDC,FxOpdDD,FxOpdDE,FxOpdDF -EXTSYM FxOpdDFA2,FxOpdDFA3,FxOpdE0,FxOpdE1,FxOpdE2,FxOpdE3,FxOpdE4,FxOpdE5 -EXTSYM FxOpdE6,FxOpdE7,FxOpdE8,FxOpdE9,FxOpdEA,FxOpdEB,FxOpdEC,FxOpdED,FxOpdEE -EXTSYM FxOpdEF,FxOpdEFA1,FxOpdEFA2,FxOpdEFA3,FxOpdF0,FxOpdF0A1,FxOpdF0A2,FxOpdF1 -EXTSYM FxOpdF1A1,FxOpdF1A2,FxOpdF2,FxOpdF2A1,FxOpdF2A2,FxOpdF3,FxOpdF3A1,FxOpdF3A2 -EXTSYM FxOpdF4,FxOpdF4A1,FxOpdF4A2,FxOpdF5,FxOpdF5A1,FxOpdF5A2,FxOpdF6,FxOpdF6A1 -EXTSYM FxOpdF6A2,FxOpdF7,FxOpdF7A1,FxOpdF7A2,FxOpdF8,FxOpdF8A1,FxOpdF8A2,FxOpdF9 -EXTSYM FxOpdF9A1,FxOpdF9A2,FxOpdFA,FxOpdFAA1,FxOpdFAA2,FxOpdFB,FxOpdFBA1,FxOpdFBA2 -EXTSYM FxOpdFC,FxOpdFCA1,FxOpdFCA2,FxOpdFD,FxOpdFDA1,FxOpdFDA2,FxOpdFE,FxOpdFEA1 -EXTSYM FxOpdFEA2,FxOpdFF,FxOpdFFA1,FxOpdFFA2,PLOTJmpa,PLOTJmpb -EXTSYM FxOp4C1284b,FxOp4C1284bz,FxOp4C1284bd,FxOp4C1284bzd -EXTSYM FxOp4C1282b,FxOp4C1282bz,FxOp4C1282bd,FxOp4C1282bzd -EXTSYM FxOp4C1288b,FxOp4C1288bz,FxOp4C1288bd,FxOp4C1288bzd -EXTSYM FxOp4C1288bl,FxOp4C1288bzl,FxOp4C1288bdl,FxOp4C1288bzdl -EXTSYM FxOpd4C1284b,FxOpd4C1284bz,FxOpd4C1284bd,FxOpd4C1284bzd -EXTSYM FxOpd4C1282b,FxOpd4C1282bz,FxOpd4C1282bd,FxOpd4C1282bzd -EXTSYM FxOpd4C1288b,FxOpd4C1288bz,FxOpd4C1288bd,FxOpd4C1288bzd -EXTSYM FxOpd4C1288bl,FxOpd4C1288bzl,FxOpd4C1288bdl,FxOpd4C1288bzdl -EXTSYM fxxand,fxbit01 - -SECTION .bss -NEWSYM sfx128lineloc, resd 1 -NEWSYM sfx160lineloc, resd 1 -NEWSYM sfx192lineloc, resd 1 -NEWSYM sfxobjlineloc, resd 1 -SECTION .text - -NEWSYM InitFxTables - - ; Initiate PLOT jump tables - xor ebx,ebx - mov ecx,64 - mov eax,PLOTJmpa -.ploop - mov edx,ebx - push ebx - and edx,03h - test bl,04h - jz near .zerocheck - test bl,08h - jnz .dither - cmp dl,0 - je .colors4 - cmp dl,3 - je .colors256 - mov ebx,FxOp4C1284b - jmp .end -.colors4 - mov ebx,FxOp4C1282b - jmp .end -.colors256 - test bl,20h - jnz .lowercheck - mov ebx,FxOp4C1288b - jmp .end -.lowercheck - mov ebx,FxOp4C1288bl - jmp .end -.dither - cmp dl,0 - je .colors4d - cmp dl,3 - je .colors256d - mov ebx,FxOp4C1284bd - jmp .end -.colors4d - mov ebx,FxOp4C1282bd - jmp .end -.colors256d - test bl,20h - jnz .lowercheckd - mov ebx,FxOp4C1288bd - jmp .end -.lowercheckd - mov ebx,FxOp4C1288bdl - jmp .end -.zerocheck - test bl,08h - jnz .ditherz - cmp dl,0 - je .colors4z - cmp dl,3 - je .colors256z - mov ebx,FxOp4C1284bz - jmp .end -.colors4z - mov ebx,FxOp4C1282bz - jmp .end -.colors256z - test bl,20h - jnz .lowercheckz - mov ebx,FxOp4C1288bz - jmp .end -.lowercheckz - mov ebx,FxOp4C1288bzl - jmp .end -.ditherz - cmp dl,0 - je .colors4dz - cmp dl,3 - je .colors256dz - mov ebx,FxOp4C1284bzd - jmp .end -.colors4dz - mov ebx,FxOp4C1282bzd - jmp .end -.colors256dz - test bl,20h - jnz .lowercheckdz - mov ebx,FxOp4C1288bzd - jmp .end -.lowercheckdz - mov ebx,FxOp4C1288bzdl -.end - mov [eax],ebx - pop ebx - inc ebx - add eax,4 - dec ecx - jnz near .ploop - - xor ebx,ebx - mov ecx,64 - mov eax,PLOTJmpb -.ploop2 - mov edx,ebx - push ebx - and edx,03h - test bl,04h - jz near .zerocheck2 - test bl,08h - jnz .dither2 - cmp dl,0 - je .colors42 - cmp dl,3 - je .colors2562 - mov ebx,FxOpd4C1284b - jmp .end2 -.colors42 - mov ebx,FxOpd4C1282b - jmp .end2 -.colors2562 - test bl,20h - jnz .lowercheck2 - mov ebx,FxOpd4C1288b - jmp .end2 -.lowercheck2 - mov ebx,FxOpd4C1288bl - jmp .end2 -.dither2 - cmp dl,0 - je .colors4d2 - cmp dl,3 - je .colors256d2 - mov ebx,FxOpd4C1284bd - jmp .end2 -.colors4d2 - mov ebx,FxOpd4C1282bd - jmp .end2 -.colors256d2 - test bl,20h - jnz .lowercheckd2 - mov ebx,FxOpd4C1288bd - jmp .end2 -.lowercheckd2 - mov ebx,FxOpd4C1288bdl - jmp .end2 -.zerocheck2 - test bl,08h - jnz .ditherz2 - cmp dl,0 - je .colors4z2 - cmp dl,3 - je .colors256z2 - mov ebx,FxOpd4C1284bz - jmp .end2 -.colors4z2 - mov ebx,FxOpd4C1282bz - jmp .end2 -.colors256z2 - test bl,20h - jnz .lowercheckz2 - mov ebx,FxOpd4C1288bz - jmp .end2 -.lowercheckz2 - mov ebx,FxOpd4C1288bzl - jmp .end2 -.ditherz2 - cmp dl,0 - je .colors4dz2 - cmp dl,3 - je .colors256dz2 - mov ebx,FxOpd4C1284bzd - jmp .end2 -.colors4dz2 - mov ebx,FxOpd4C1282bzd - jmp .end2 -.colors256dz2 - test bl,20h - jnz .lowercheckdz2 - mov ebx,FxOpd4C1288bzd - jmp .end2 -.lowercheckdz2 - mov ebx,FxOpd4C1288bzdl -.end2 - mov [eax],ebx - pop ebx - inc ebx - add eax,4 - dec ecx - jnz near .ploop2 - - ; Initiate AND and bit tables - mov eax,fxxand - mov ecx,256 - xor ebx,ebx -.loopat - push ecx - mov ecx,ebx - and ecx,07h - xor ecx,07h - mov edx,0101h - shl edx,cl - xor edx,0FFFFFFFFh - pop ecx - mov [eax],edx - inc ebx - add eax,4 - dec ecx - jnz .loopat - ; bit tables - mov eax,fxbit01 - mov ecx,256 - xor ebx,ebx -.loopb01 - xor edx,edx - test ebx,01h - jz .nob0 - or edx,0FFh -.nob0 - test ebx,02h - jz .nob1 - or edx,0FF00h -.nob1 - mov [eax],edx - xor edx,edx - test ebx,04h - jz .nob2 - or edx,0FFh -.nob2 - test ebx,08h - jz .nob3 - or edx,0FF00h -.nob3 - mov [eax+256*4],edx - xor edx,edx - test ebx,10h - jz .nob4 - or edx,0FFh -.nob4 - test ebx,20h - jz .nob5 - or edx,0FF00h -.nob5 - mov [eax+256*8],edx - xor edx,edx - test ebx,40h - jz .nob6 - or edx,0FFh -.nob6 - test ebx,80h - jz .nob7 - or edx,0FF00h -.nob7 - mov [eax+256*12],edx - add eax,4 - inc ebx - dec ecx - jnz near .loopb01 - - ; Initialize PLOT tables - mov esi,[sfxramdata] - add esi,1024*1024 - ; Create 4 * 256k plot tables - ; 128 line mode - mov [sfx128lineloc],esi - xor eax,eax - xor ebx,ebx -.nexty -.nextx - cmp eax,128 - jae .over - push eax - push ebx - shr eax,3 - shr ebx,3 - shl ebx,4 - add ebx,eax - mov [esi],ebx - add esi,4 - pop ebx - pop eax - jmp .notover -.over - mov dword[esi],0FFFFFFFFh - add esi,4 -.notover - inc al - jnz .nextx - inc bl - jnz .nexty - ; 160 line mode - mov [sfx160lineloc],esi -.nexty2 -.nextx2 - cmp eax,160 - jae .over2 - push eax - push ebx - shr eax,3 - shr ebx,3 - mov edx,ebx - shl ebx,4 - shl edx,2 - add ebx,eax - add ebx,edx - mov [esi],ebx - add esi,4 - pop ebx - pop eax - jmp .notover2 -.over2 - mov dword[esi],0FFFFFFFFh - add esi,4 -.notover2 - inc al - jnz .nextx2 - inc bl - jnz .nexty2 - ; 192 line mode - mov [sfx192lineloc],esi -.nexty3 -.nextx3 - cmp eax,192 - jae .over3 - push eax - push ebx - shr eax,3 - shr ebx,3 - mov edx,ebx - shl ebx,4 - shl edx,3 - add ebx,eax - add ebx,edx - mov [esi],ebx - add esi,4 - pop ebx - pop eax - jmp .notover3 -.over3 - mov dword[esi],0FFFFFFFFh - add esi,4 -.notover3 - inc al - jnz .nextx3 - inc bl - jnz .nexty3 - ; obj mode - mov [sfxobjlineloc],esi -.nexty4 -.nextx4 - push eax - push ebx - and ebx,80h - and eax,80h - shl ebx,1 - shl eax,2 - add ebx,eax - mov edx,ebx - pop ebx - pop eax - push eax - push ebx - and ebx,78h - and eax,78h - shr ebx,3 - shl eax,1 - add ebx,eax - add edx,ebx - pop ebx - pop eax - mov [esi],edx - add esi,4 - inc al - jnz .nextx4 - inc bl - jnz .nexty4 - - mov eax,[romdata] - xor ebx,ebx - mov ecx,256 -.loopc - mov [SfxMemTable+ebx*4],eax - inc ebx - dec ecx - jnz .loopc - - mov eax,[romdata] -; sub eax,32768 - xor ebx,ebx - mov ecx,64 -.loop - mov [SfxMemTable+ebx*4],eax - add eax,65536 - inc ebx - dec ecx - jnz .loop - - mov eax,[romdata] - add eax,32768 - mov ecx,32 -.loop2 - mov [SfxMemTable+ebx*4],eax - add eax,65536*2 - inc ebx - dec ecx - jnz .loop2 - - mov eax,[sfxramdata] - mov [SfxMemTable+70h*4],eax - add eax,65536 - mov [SfxMemTable+71h*4],eax - add eax,65536 - mov [SfxMemTable+72h*4],eax - add eax,65536 - mov [SfxMemTable+73h*4],eax - - mov eax,[romdata] -; sub eax,32768 - xor ebx,ebx - mov ebx,80h - mov ecx,64 -.loops - mov [SfxMemTable+ebx*4],eax - add eax,65536 - inc ebx - dec ecx - jnz .loops - - mov eax,[romdata] - add eax,32768 - mov ecx,32 -.loop2s - mov [SfxMemTable+ebx*4],eax - add eax,65536*2 - inc ebx - dec ecx - jnz .loop2s - mov eax,[sfxramdata] - mov [SfxMemTable+0F0h*4],eax - add eax,65536 - mov [SfxMemTable+0F1h*4],eax - add eax,65536 - mov [SfxMemTable+0F2h*4],eax - add eax,65536 - mov [SfxMemTable+0F3h*4],eax - - mov dword[FxTable+00h*4],FxOp00 - mov dword[FxTable+01h*4],FxOp01 - mov dword[FxTable+02h*4],FxOp02 - mov dword[FxTable+03h*4],FxOp03 - mov dword[FxTable+04h*4],FxOp04 - mov dword[FxTable+05h*4],FxOp05 - mov dword[FxTable+06h*4],FxOp06 - mov dword[FxTable+07h*4],FxOp07 - mov dword[FxTable+08h*4],FxOp08 - mov dword[FxTable+09h*4],FxOp09 - mov dword[FxTable+0Ah*4],FxOp0A - mov dword[FxTable+0Bh*4],FxOp0B - mov dword[FxTable+0Ch*4],FxOp0C - mov dword[FxTable+0Dh*4],FxOp0D - mov dword[FxTable+0Eh*4],FxOp0E - mov dword[FxTable+0Fh*4],FxOp0F - - mov dword[FxTable+10h*4],FxOp10 - mov dword[FxTable+11h*4],FxOp11 - mov dword[FxTable+12h*4],FxOp12 - mov dword[FxTable+13h*4],FxOp13 - mov dword[FxTable+14h*4],FxOp14 - mov dword[FxTable+15h*4],FxOp15 - mov dword[FxTable+16h*4],FxOp16 - mov dword[FxTable+17h*4],FxOp17 - mov dword[FxTable+18h*4],FxOp18 - mov dword[FxTable+19h*4],FxOp19 - mov dword[FxTable+1Ah*4],FxOp1A - mov dword[FxTable+1Bh*4],FxOp1B - mov dword[FxTable+1Ch*4],FxOp1C - mov dword[FxTable+1Dh*4],FxOp1D - mov dword[FxTable+1Eh*4],FxOp1E - mov dword[FxTable+1Fh*4],FxOp1F - - mov dword[FxTable+20h*4],FxOp20 - mov dword[FxTable+21h*4],FxOp21 - mov dword[FxTable+22h*4],FxOp22 - mov dword[FxTable+23h*4],FxOp23 - mov dword[FxTable+24h*4],FxOp24 - mov dword[FxTable+25h*4],FxOp25 - mov dword[FxTable+26h*4],FxOp26 - mov dword[FxTable+27h*4],FxOp27 - mov dword[FxTable+28h*4],FxOp28 - mov dword[FxTable+29h*4],FxOp29 - mov dword[FxTable+2Ah*4],FxOp2A - mov dword[FxTable+2Bh*4],FxOp2B - mov dword[FxTable+2Ch*4],FxOp2C - mov dword[FxTable+2Dh*4],FxOp2D - mov dword[FxTable+2Eh*4],FxOp2E - mov dword[FxTable+2Fh*4],FxOp2F - - mov dword[FxTable+30h*4],FxOp30 - mov dword[FxTable+31h*4],FxOp31 - mov dword[FxTable+32h*4],FxOp32 - mov dword[FxTable+33h*4],FxOp33 - mov dword[FxTable+34h*4],FxOp34 - mov dword[FxTable+35h*4],FxOp35 - mov dword[FxTable+36h*4],FxOp36 - mov dword[FxTable+37h*4],FxOp37 - mov dword[FxTable+38h*4],FxOp38 - mov dword[FxTable+39h*4],FxOp39 - mov dword[FxTable+3Ah*4],FxOp3A - mov dword[FxTable+3Bh*4],FxOp3B - mov dword[FxTable+3Ch*4],FxOp3C - mov dword[FxTable+3Dh*4],FxOp3D - mov dword[FxTable+3Eh*4],FxOp3E - mov dword[FxTable+3Fh*4],FxOp3F - - mov dword[FxTable+40h*4],FxOp40 - mov dword[FxTable+41h*4],FxOp41 - mov dword[FxTable+42h*4],FxOp42 - mov dword[FxTable+43h*4],FxOp43 - mov dword[FxTable+44h*4],FxOp44 - mov dword[FxTable+45h*4],FxOp45 - mov dword[FxTable+46h*4],FxOp46 - mov dword[FxTable+47h*4],FxOp47 - mov dword[FxTable+48h*4],FxOp48 - mov dword[FxTable+49h*4],FxOp49 - mov dword[FxTable+4Ah*4],FxOp4A - mov dword[FxTable+4Bh*4],FxOp4B - mov dword[FxTable+4Ch*4],FxOp4C - mov dword[FxTable+4Dh*4],FxOp4D - mov dword[FxTable+4Eh*4],FxOp4E - mov dword[FxTable+4Fh*4],FxOp4F - - mov dword[FxTable+50h*4],FxOp50 - mov dword[FxTable+51h*4],FxOp51 - mov dword[FxTable+52h*4],FxOp52 - mov dword[FxTable+53h*4],FxOp53 - mov dword[FxTable+54h*4],FxOp54 - mov dword[FxTable+55h*4],FxOp55 - mov dword[FxTable+56h*4],FxOp56 - mov dword[FxTable+57h*4],FxOp57 - mov dword[FxTable+58h*4],FxOp58 - mov dword[FxTable+59h*4],FxOp59 - mov dword[FxTable+5Ah*4],FxOp5A - mov dword[FxTable+5Bh*4],FxOp5B - mov dword[FxTable+5Ch*4],FxOp5C - mov dword[FxTable+5Dh*4],FxOp5D - mov dword[FxTable+5Eh*4],FxOp5E - mov dword[FxTable+5Fh*4],FxOp5F - - mov dword[FxTable+60h*4],FxOp60 - mov dword[FxTable+61h*4],FxOp61 - mov dword[FxTable+62h*4],FxOp62 - mov dword[FxTable+63h*4],FxOp63 - mov dword[FxTable+64h*4],FxOp64 - mov dword[FxTable+65h*4],FxOp65 - mov dword[FxTable+66h*4],FxOp66 - mov dword[FxTable+67h*4],FxOp67 - mov dword[FxTable+68h*4],FxOp68 - mov dword[FxTable+69h*4],FxOp69 - mov dword[FxTable+6Ah*4],FxOp6A - mov dword[FxTable+6Bh*4],FxOp6B - mov dword[FxTable+6Ch*4],FxOp6C - mov dword[FxTable+6Dh*4],FxOp6D - mov dword[FxTable+6Eh*4],FxOp6E - mov dword[FxTable+6Fh*4],FxOp6F - - mov dword[FxTable+70h*4],FxOp70 - mov dword[FxTable+71h*4],FxOp71 - mov dword[FxTable+72h*4],FxOp72 - mov dword[FxTable+73h*4],FxOp73 - mov dword[FxTable+74h*4],FxOp74 - mov dword[FxTable+75h*4],FxOp75 - mov dword[FxTable+76h*4],FxOp76 - mov dword[FxTable+77h*4],FxOp77 - mov dword[FxTable+78h*4],FxOp78 - mov dword[FxTable+79h*4],FxOp79 - mov dword[FxTable+7Ah*4],FxOp7A - mov dword[FxTable+7Bh*4],FxOp7B - mov dword[FxTable+7Ch*4],FxOp7C - mov dword[FxTable+7Dh*4],FxOp7D - mov dword[FxTable+7Eh*4],FxOp7E - mov dword[FxTable+7Fh*4],FxOp7F - - mov dword[FxTable+80h*4],FxOp80 - mov dword[FxTable+81h*4],FxOp81 - mov dword[FxTable+82h*4],FxOp82 - mov dword[FxTable+83h*4],FxOp83 - mov dword[FxTable+84h*4],FxOp84 - mov dword[FxTable+85h*4],FxOp85 - mov dword[FxTable+86h*4],FxOp86 - mov dword[FxTable+87h*4],FxOp87 - mov dword[FxTable+88h*4],FxOp88 - mov dword[FxTable+89h*4],FxOp89 - mov dword[FxTable+8Ah*4],FxOp8A - mov dword[FxTable+8Bh*4],FxOp8B - mov dword[FxTable+8Ch*4],FxOp8C - mov dword[FxTable+8Dh*4],FxOp8D - mov dword[FxTable+8Eh*4],FxOp8E - mov dword[FxTable+8Fh*4],FxOp8F - - mov dword[FxTable+90h*4],FxOp90 - mov dword[FxTable+91h*4],FxOp91 - mov dword[FxTable+92h*4],FxOp92 - mov dword[FxTable+93h*4],FxOp93 - mov dword[FxTable+94h*4],FxOp94 - mov dword[FxTable+95h*4],FxOp95 - mov dword[FxTable+96h*4],FxOp96 - mov dword[FxTable+97h*4],FxOp97 - mov dword[FxTable+98h*4],FxOp98 - mov dword[FxTable+99h*4],FxOp99 - mov dword[FxTable+9Ah*4],FxOp9A - mov dword[FxTable+9Bh*4],FxOp9B - mov dword[FxTable+9Ch*4],FxOp9C - mov dword[FxTable+9Dh*4],FxOp9D - mov dword[FxTable+9Eh*4],FxOp9E - mov dword[FxTable+9Fh*4],FxOp9F - - mov dword[FxTable+0A0h*4],FxOpA0 - mov dword[FxTable+0A1h*4],FxOpA1 - mov dword[FxTable+0A2h*4],FxOpA2 - mov dword[FxTable+0A3h*4],FxOpA3 - mov dword[FxTable+0A4h*4],FxOpA4 - mov dword[FxTable+0A5h*4],FxOpA5 - mov dword[FxTable+0A6h*4],FxOpA6 - mov dword[FxTable+0A7h*4],FxOpA7 - mov dword[FxTable+0A8h*4],FxOpA8 - mov dword[FxTable+0A9h*4],FxOpA9 - mov dword[FxTable+0AAh*4],FxOpAA - mov dword[FxTable+0ABh*4],FxOpAB - mov dword[FxTable+0ACh*4],FxOpAC - mov dword[FxTable+0ADh*4],FxOpAD - mov dword[FxTable+0AEh*4],FxOpAE - mov dword[FxTable+0AFh*4],FxOpAF - - mov dword[FxTable+0B0h*4],FxOpB0 - mov dword[FxTable+0B1h*4],FxOpB1 - mov dword[FxTable+0B2h*4],FxOpB2 - mov dword[FxTable+0B3h*4],FxOpB3 - mov dword[FxTable+0B4h*4],FxOpB4 - mov dword[FxTable+0B5h*4],FxOpB5 - mov dword[FxTable+0B6h*4],FxOpB6 - mov dword[FxTable+0B7h*4],FxOpB7 - mov dword[FxTable+0B8h*4],FxOpB8 - mov dword[FxTable+0B9h*4],FxOpB9 - mov dword[FxTable+0BAh*4],FxOpBA - mov dword[FxTable+0BBh*4],FxOpBB - mov dword[FxTable+0BCh*4],FxOpBC - mov dword[FxTable+0BDh*4],FxOpBD - mov dword[FxTable+0BEh*4],FxOpBE - mov dword[FxTable+0BFh*4],FxOpBF - - mov dword[FxTable+0C0h*4],FxOpC0 - mov dword[FxTable+0C1h*4],FxOpC1 - mov dword[FxTable+0C2h*4],FxOpC2 - mov dword[FxTable+0C3h*4],FxOpC3 - mov dword[FxTable+0C4h*4],FxOpC4 - mov dword[FxTable+0C5h*4],FxOpC5 - mov dword[FxTable+0C6h*4],FxOpC6 - mov dword[FxTable+0C7h*4],FxOpC7 - mov dword[FxTable+0C8h*4],FxOpC8 - mov dword[FxTable+0C9h*4],FxOpC9 - mov dword[FxTable+0CAh*4],FxOpCA - mov dword[FxTable+0CBh*4],FxOpCB - mov dword[FxTable+0CCh*4],FxOpCC - mov dword[FxTable+0CDh*4],FxOpCD - mov dword[FxTable+0CEh*4],FxOpCE - mov dword[FxTable+0CFh*4],FxOpCF - - mov dword[FxTable+0D0h*4],FxOpD0 - mov dword[FxTable+0D1h*4],FxOpD1 - mov dword[FxTable+0D2h*4],FxOpD2 - mov dword[FxTable+0D3h*4],FxOpD3 - mov dword[FxTable+0D4h*4],FxOpD4 - mov dword[FxTable+0D5h*4],FxOpD5 - mov dword[FxTable+0D6h*4],FxOpD6 - mov dword[FxTable+0D7h*4],FxOpD7 - mov dword[FxTable+0D8h*4],FxOpD8 - mov dword[FxTable+0D9h*4],FxOpD9 - mov dword[FxTable+0DAh*4],FxOpDA - mov dword[FxTable+0DBh*4],FxOpDB - mov dword[FxTable+0DCh*4],FxOpDC - mov dword[FxTable+0DDh*4],FxOpDD - mov dword[FxTable+0DEh*4],FxOpDE - mov dword[FxTable+0DFh*4],FxOpDF - - mov dword[FxTable+0E0h*4],FxOpE0 - mov dword[FxTable+0E1h*4],FxOpE1 - mov dword[FxTable+0E2h*4],FxOpE2 - mov dword[FxTable+0E3h*4],FxOpE3 - mov dword[FxTable+0E4h*4],FxOpE4 - mov dword[FxTable+0E5h*4],FxOpE5 - mov dword[FxTable+0E6h*4],FxOpE6 - mov dword[FxTable+0E7h*4],FxOpE7 - mov dword[FxTable+0E8h*4],FxOpE8 - mov dword[FxTable+0E9h*4],FxOpE9 - mov dword[FxTable+0EAh*4],FxOpEA - mov dword[FxTable+0EBh*4],FxOpEB - mov dword[FxTable+0ECh*4],FxOpEC - mov dword[FxTable+0EDh*4],FxOpED - mov dword[FxTable+0EEh*4],FxOpEE - mov dword[FxTable+0EFh*4],FxOpEF - - mov dword[FxTable+0F0h*4],FxOpF0 - mov dword[FxTable+0F1h*4],FxOpF1 - mov dword[FxTable+0F2h*4],FxOpF2 - mov dword[FxTable+0F3h*4],FxOpF3 - mov dword[FxTable+0F4h*4],FxOpF4 - mov dword[FxTable+0F5h*4],FxOpF5 - mov dword[FxTable+0F6h*4],FxOpF6 - mov dword[FxTable+0F7h*4],FxOpF7 - mov dword[FxTable+0F8h*4],FxOpF8 - mov dword[FxTable+0F9h*4],FxOpF9 - mov dword[FxTable+0FAh*4],FxOpFA - mov dword[FxTable+0FBh*4],FxOpFB - mov dword[FxTable+0FCh*4],FxOpFC - mov dword[FxTable+0FDh*4],FxOpFD - mov dword[FxTable+0FEh*4],FxOpFE - mov dword[FxTable+0FFh*4],FxOpFF - - - mov dword[FxTableA1+00h*4],FxOp00 - mov dword[FxTableA1+01h*4],FxOp01 - mov dword[FxTableA1+02h*4],FxOp02 - mov dword[FxTableA1+03h*4],FxOp03 - mov dword[FxTableA1+04h*4],FxOp04 - mov dword[FxTableA1+05h*4],FxOp05 - mov dword[FxTableA1+06h*4],FxOp06 - mov dword[FxTableA1+07h*4],FxOp07 - mov dword[FxTableA1+08h*4],FxOp08 - mov dword[FxTableA1+09h*4],FxOp09 - mov dword[FxTableA1+0Ah*4],FxOp0A - mov dword[FxTableA1+0Bh*4],FxOp0B - mov dword[FxTableA1+0Ch*4],FxOp0C - mov dword[FxTableA1+0Dh*4],FxOp0D - mov dword[FxTableA1+0Eh*4],FxOp0E - mov dword[FxTableA1+0Fh*4],FxOp0F - - mov dword[FxTableA1+10h*4],FxOp10 - mov dword[FxTableA1+11h*4],FxOp11 - mov dword[FxTableA1+12h*4],FxOp12 - mov dword[FxTableA1+13h*4],FxOp13 - mov dword[FxTableA1+14h*4],FxOp14 - mov dword[FxTableA1+15h*4],FxOp15 - mov dword[FxTableA1+16h*4],FxOp16 - mov dword[FxTableA1+17h*4],FxOp17 - mov dword[FxTableA1+18h*4],FxOp18 - mov dword[FxTableA1+19h*4],FxOp19 - mov dword[FxTableA1+1Ah*4],FxOp1A - mov dword[FxTableA1+1Bh*4],FxOp1B - mov dword[FxTableA1+1Ch*4],FxOp1C - mov dword[FxTableA1+1Dh*4],FxOp1D - mov dword[FxTableA1+1Eh*4],FxOp1E - mov dword[FxTableA1+1Fh*4],FxOp1F - - mov dword[FxTableA1+20h*4],FxOp20 - mov dword[FxTableA1+21h*4],FxOp21 - mov dword[FxTableA1+22h*4],FxOp22 - mov dword[FxTableA1+23h*4],FxOp23 - mov dword[FxTableA1+24h*4],FxOp24 - mov dword[FxTableA1+25h*4],FxOp25 - mov dword[FxTableA1+26h*4],FxOp26 - mov dword[FxTableA1+27h*4],FxOp27 - mov dword[FxTableA1+28h*4],FxOp28 - mov dword[FxTableA1+29h*4],FxOp29 - mov dword[FxTableA1+2Ah*4],FxOp2A - mov dword[FxTableA1+2Bh*4],FxOp2B - mov dword[FxTableA1+2Ch*4],FxOp2C - mov dword[FxTableA1+2Dh*4],FxOp2D - mov dword[FxTableA1+2Eh*4],FxOp2E - mov dword[FxTableA1+2Fh*4],FxOp2F - - mov dword[FxTableA1+30h*4],FxOp30A1 - mov dword[FxTableA1+31h*4],FxOp31A1 - mov dword[FxTableA1+32h*4],FxOp32A1 - mov dword[FxTableA1+33h*4],FxOp33A1 - mov dword[FxTableA1+34h*4],FxOp34A1 - mov dword[FxTableA1+35h*4],FxOp35A1 - mov dword[FxTableA1+36h*4],FxOp36A1 - mov dword[FxTableA1+37h*4],FxOp37A1 - mov dword[FxTableA1+38h*4],FxOp38A1 - mov dword[FxTableA1+39h*4],FxOp39A1 - mov dword[FxTableA1+3Ah*4],FxOp3AA1 - mov dword[FxTableA1+3Bh*4],FxOp3BA1 - mov dword[FxTableA1+3Ch*4],FxOp3C - mov dword[FxTableA1+3Dh*4],FxOp3D - mov dword[FxTableA1+3Eh*4],FxOp3E - mov dword[FxTableA1+3Fh*4],FxOp3F - - mov dword[FxTableA1+40h*4],FxOp40A1 - mov dword[FxTableA1+41h*4],FxOp41A1 - mov dword[FxTableA1+42h*4],FxOp42A1 - mov dword[FxTableA1+43h*4],FxOp43A1 - mov dword[FxTableA1+44h*4],FxOp44A1 - mov dword[FxTableA1+45h*4],FxOp45A1 - mov dword[FxTableA1+46h*4],FxOp46A1 - mov dword[FxTableA1+47h*4],FxOp47A1 - mov dword[FxTableA1+48h*4],FxOp48A1 - mov dword[FxTableA1+49h*4],FxOp49A1 - mov dword[FxTableA1+4Ah*4],FxOp4AA1 - mov dword[FxTableA1+4Bh*4],FxOp4BA1 - mov dword[FxTableA1+4Ch*4],FxOp4CA1 - mov dword[FxTableA1+4Dh*4],FxOp4D - mov dword[FxTableA1+4Eh*4],FxOp4EA1 - mov dword[FxTableA1+4Fh*4],FxOp4F - - mov dword[FxTableA1+50h*4],FxOp50A1 - mov dword[FxTableA1+51h*4],FxOp51A1 - mov dword[FxTableA1+52h*4],FxOp52A1 - mov dword[FxTableA1+53h*4],FxOp53A1 - mov dword[FxTableA1+54h*4],FxOp54A1 - mov dword[FxTableA1+55h*4],FxOp55A1 - mov dword[FxTableA1+56h*4],FxOp56A1 - mov dword[FxTableA1+57h*4],FxOp57A1 - mov dword[FxTableA1+58h*4],FxOp58A1 - mov dword[FxTableA1+59h*4],FxOp59A1 - mov dword[FxTableA1+5Ah*4],FxOp5AA1 - mov dword[FxTableA1+5Bh*4],FxOp5BA1 - mov dword[FxTableA1+5Ch*4],FxOp5CA1 - mov dword[FxTableA1+5Dh*4],FxOp5DA1 - mov dword[FxTableA1+5Eh*4],FxOp5EA1 - mov dword[FxTableA1+5Fh*4],FxOp5FA1 - - mov dword[FxTableA1+60h*4],FxOp60A1 - mov dword[FxTableA1+61h*4],FxOp61A1 - mov dword[FxTableA1+62h*4],FxOp62A1 - mov dword[FxTableA1+63h*4],FxOp63A1 - mov dword[FxTableA1+64h*4],FxOp64A1 - mov dword[FxTableA1+65h*4],FxOp65A1 - mov dword[FxTableA1+66h*4],FxOp66A1 - mov dword[FxTableA1+67h*4],FxOp67A1 - mov dword[FxTableA1+68h*4],FxOp68A1 - mov dword[FxTableA1+69h*4],FxOp69A1 - mov dword[FxTableA1+6Ah*4],FxOp6AA1 - mov dword[FxTableA1+6Bh*4],FxOp6BA1 - mov dword[FxTableA1+6Ch*4],FxOp6CA1 - mov dword[FxTableA1+6Dh*4],FxOp6DA1 - mov dword[FxTableA1+6Eh*4],FxOp6EA1 - mov dword[FxTableA1+6Fh*4],FxOp6FA1 - - mov dword[FxTableA1+70h*4],FxOp70 - mov dword[FxTableA1+71h*4],FxOp71A1 - mov dword[FxTableA1+72h*4],FxOp72A1 - mov dword[FxTableA1+73h*4],FxOp73A1 - mov dword[FxTableA1+74h*4],FxOp74A1 - mov dword[FxTableA1+75h*4],FxOp75A1 - mov dword[FxTableA1+76h*4],FxOp76A1 - mov dword[FxTableA1+77h*4],FxOp77A1 - mov dword[FxTableA1+78h*4],FxOp78A1 - mov dword[FxTableA1+79h*4],FxOp79A1 - mov dword[FxTableA1+7Ah*4],FxOp7AA1 - mov dword[FxTableA1+7Bh*4],FxOp7BA1 - mov dword[FxTableA1+7Ch*4],FxOp7CA1 - mov dword[FxTableA1+7Dh*4],FxOp7DA1 - mov dword[FxTableA1+7Eh*4],FxOp7EA1 - mov dword[FxTableA1+7Fh*4],FxOp7FA1 - - mov dword[FxTableA1+80h*4],FxOp80A1 - mov dword[FxTableA1+81h*4],FxOp81A1 - mov dword[FxTableA1+82h*4],FxOp82A1 - mov dword[FxTableA1+83h*4],FxOp83A1 - mov dword[FxTableA1+84h*4],FxOp84A1 - mov dword[FxTableA1+85h*4],FxOp85A1 - mov dword[FxTableA1+86h*4],FxOp86A1 - mov dword[FxTableA1+87h*4],FxOp87A1 - mov dword[FxTableA1+88h*4],FxOp88A1 - mov dword[FxTableA1+89h*4],FxOp89A1 - mov dword[FxTableA1+8Ah*4],FxOp8AA1 - mov dword[FxTableA1+8Bh*4],FxOp8BA1 - mov dword[FxTableA1+8Ch*4],FxOp8CA1 - mov dword[FxTableA1+8Dh*4],FxOp8DA1 - mov dword[FxTableA1+8Eh*4],FxOp8EA1 - mov dword[FxTableA1+8Fh*4],FxOp8FA1 - - mov dword[FxTableA1+90h*4],FxOp90 - mov dword[FxTableA1+91h*4],FxOp91 - mov dword[FxTableA1+92h*4],FxOp92 - mov dword[FxTableA1+93h*4],FxOp93 - mov dword[FxTableA1+94h*4],FxOp94 - mov dword[FxTableA1+95h*4],FxOp95 - mov dword[FxTableA1+96h*4],FxOp96A1 - mov dword[FxTableA1+97h*4],FxOp97 - mov dword[FxTableA1+98h*4],FxOp98A1 - mov dword[FxTableA1+99h*4],FxOp99A1 - mov dword[FxTableA1+9Ah*4],FxOp9AA1 - mov dword[FxTableA1+9Bh*4],FxOp9BA1 - mov dword[FxTableA1+9Ch*4],FxOp9CA1 - mov dword[FxTableA1+9Dh*4],FxOp9DA1 - mov dword[FxTableA1+9Eh*4],FxOp9E - mov dword[FxTableA1+9Fh*4],FxOp9FA1 - - mov dword[FxTableA1+0A0h*4],FxOpA0A1 - mov dword[FxTableA1+0A1h*4],FxOpA1A1 - mov dword[FxTableA1+0A2h*4],FxOpA2A1 - mov dword[FxTableA1+0A3h*4],FxOpA3A1 - mov dword[FxTableA1+0A4h*4],FxOpA4A1 - mov dword[FxTableA1+0A5h*4],FxOpA5A1 - mov dword[FxTableA1+0A6h*4],FxOpA6A1 - mov dword[FxTableA1+0A7h*4],FxOpA7A1 - mov dword[FxTableA1+0A8h*4],FxOpA8A1 - mov dword[FxTableA1+0A9h*4],FxOpA9A1 - mov dword[FxTableA1+0AAh*4],FxOpAAA1 - mov dword[FxTableA1+0ABh*4],FxOpABA1 - mov dword[FxTableA1+0ACh*4],FxOpACA1 - mov dword[FxTableA1+0ADh*4],FxOpADA1 - mov dword[FxTableA1+0AEh*4],FxOpAEA1 - mov dword[FxTableA1+0AFh*4],FxOpAFA1 - - mov dword[FxTableA1+0B0h*4],FxOpB0 - mov dword[FxTableA1+0B1h*4],FxOpB1 - mov dword[FxTableA1+0B2h*4],FxOpB2 - mov dword[FxTableA1+0B3h*4],FxOpB3 - mov dword[FxTableA1+0B4h*4],FxOpB4 - mov dword[FxTableA1+0B5h*4],FxOpB5 - mov dword[FxTableA1+0B6h*4],FxOpB6 - mov dword[FxTableA1+0B7h*4],FxOpB7 - mov dword[FxTableA1+0B8h*4],FxOpB8 - mov dword[FxTableA1+0B9h*4],FxOpB9 - mov dword[FxTableA1+0BAh*4],FxOpBA - mov dword[FxTableA1+0BBh*4],FxOpBB - mov dword[FxTableA1+0BCh*4],FxOpBC - mov dword[FxTableA1+0BDh*4],FxOpBD - mov dword[FxTableA1+0BEh*4],FxOpBE - mov dword[FxTableA1+0BFh*4],FxOpBF - - mov dword[FxTableA1+0C0h*4],FxOpC0 - mov dword[FxTableA1+0C1h*4],FxOpC1A1 - mov dword[FxTableA1+0C2h*4],FxOpC2A1 - mov dword[FxTableA1+0C3h*4],FxOpC3A1 - mov dword[FxTableA1+0C4h*4],FxOpC4A1 - mov dword[FxTableA1+0C5h*4],FxOpC5A1 - mov dword[FxTableA1+0C6h*4],FxOpC6A1 - mov dword[FxTableA1+0C7h*4],FxOpC7A1 - mov dword[FxTableA1+0C8h*4],FxOpC8A1 - mov dword[FxTableA1+0C9h*4],FxOpC9A1 - mov dword[FxTableA1+0CAh*4],FxOpCAA1 - mov dword[FxTableA1+0CBh*4],FxOpCBA1 - mov dword[FxTableA1+0CCh*4],FxOpCCA1 - mov dword[FxTableA1+0CDh*4],FxOpCDA1 - mov dword[FxTableA1+0CEh*4],FxOpCEA1 - mov dword[FxTableA1+0CFh*4],FxOpCFA1 - - mov dword[FxTableA1+0D0h*4],FxOpD0 - mov dword[FxTableA1+0D1h*4],FxOpD1 - mov dword[FxTableA1+0D2h*4],FxOpD2 - mov dword[FxTableA1+0D3h*4],FxOpD3 - mov dword[FxTableA1+0D4h*4],FxOpD4 - mov dword[FxTableA1+0D5h*4],FxOpD5 - mov dword[FxTableA1+0D6h*4],FxOpD6 - mov dword[FxTableA1+0D7h*4],FxOpD7 - mov dword[FxTableA1+0D8h*4],FxOpD8 - mov dword[FxTableA1+0D9h*4],FxOpD9 - mov dword[FxTableA1+0DAh*4],FxOpDA - mov dword[FxTableA1+0DBh*4],FxOpDB - mov dword[FxTableA1+0DCh*4],FxOpDC - mov dword[FxTableA1+0DDh*4],FxOpDD - mov dword[FxTableA1+0DEh*4],FxOpDE - mov dword[FxTableA1+0DFh*4],FxOpDF - - mov dword[FxTableA1+0E0h*4],FxOpE0 - mov dword[FxTableA1+0E1h*4],FxOpE1 - mov dword[FxTableA1+0E2h*4],FxOpE2 - mov dword[FxTableA1+0E3h*4],FxOpE3 - mov dword[FxTableA1+0E4h*4],FxOpE4 - mov dword[FxTableA1+0E5h*4],FxOpE5 - mov dword[FxTableA1+0E6h*4],FxOpE6 - mov dword[FxTableA1+0E7h*4],FxOpE7 - mov dword[FxTableA1+0E8h*4],FxOpE8 - mov dword[FxTableA1+0E9h*4],FxOpE9 - mov dword[FxTableA1+0EAh*4],FxOpEA - mov dword[FxTableA1+0EBh*4],FxOpEB - mov dword[FxTableA1+0ECh*4],FxOpEC - mov dword[FxTableA1+0EDh*4],FxOpED - mov dword[FxTableA1+0EEh*4],FxOpEE - mov dword[FxTableA1+0EFh*4],FxOpEFA1 - - mov dword[FxTableA1+0F0h*4],FxOpF0A1 - mov dword[FxTableA1+0F1h*4],FxOpF1A1 - mov dword[FxTableA1+0F2h*4],FxOpF2A1 - mov dword[FxTableA1+0F3h*4],FxOpF3A1 - mov dword[FxTableA1+0F4h*4],FxOpF4A1 - mov dword[FxTableA1+0F5h*4],FxOpF5A1 - mov dword[FxTableA1+0F6h*4],FxOpF6A1 - mov dword[FxTableA1+0F7h*4],FxOpF7A1 - mov dword[FxTableA1+0F8h*4],FxOpF8A1 - mov dword[FxTableA1+0F9h*4],FxOpF9A1 - mov dword[FxTableA1+0FAh*4],FxOpFAA1 - mov dword[FxTableA1+0FBh*4],FxOpFBA1 - mov dword[FxTableA1+0FCh*4],FxOpFCA1 - mov dword[FxTableA1+0FDh*4],FxOpFDA1 - mov dword[FxTableA1+0FEh*4],FxOpFEA1 - mov dword[FxTableA1+0FFh*4],FxOpFFA1 - - - mov dword[FxTableA2+00h*4],FxOp00 - mov dword[FxTableA2+01h*4],FxOp01 - mov dword[FxTableA2+02h*4],FxOp02 - mov dword[FxTableA2+03h*4],FxOp03 - mov dword[FxTableA2+04h*4],FxOp04 - mov dword[FxTableA2+05h*4],FxOp05 - mov dword[FxTableA2+06h*4],FxOp06 - mov dword[FxTableA2+07h*4],FxOp07 - mov dword[FxTableA2+08h*4],FxOp08 - mov dword[FxTableA2+09h*4],FxOp09 - mov dword[FxTableA2+0Ah*4],FxOp0A - mov dword[FxTableA2+0Bh*4],FxOp0B - mov dword[FxTableA2+0Ch*4],FxOp0C - mov dword[FxTableA2+0Dh*4],FxOp0D - mov dword[FxTableA2+0Eh*4],FxOp0E - mov dword[FxTableA2+0Fh*4],FxOp0F - - mov dword[FxTableA2+10h*4],FxOp10 - mov dword[FxTableA2+11h*4],FxOp11 - mov dword[FxTableA2+12h*4],FxOp12 - mov dword[FxTableA2+13h*4],FxOp13 - mov dword[FxTableA2+14h*4],FxOp14 - mov dword[FxTableA2+15h*4],FxOp15 - mov dword[FxTableA2+16h*4],FxOp16 - mov dword[FxTableA2+17h*4],FxOp17 - mov dword[FxTableA2+18h*4],FxOp18 - mov dword[FxTableA2+19h*4],FxOp19 - mov dword[FxTableA2+1Ah*4],FxOp1A - mov dword[FxTableA2+1Bh*4],FxOp1B - mov dword[FxTableA2+1Ch*4],FxOp1C - mov dword[FxTableA2+1Dh*4],FxOp1D - mov dword[FxTableA2+1Eh*4],FxOp1E - mov dword[FxTableA2+1Fh*4],FxOp1F - - mov dword[FxTableA2+20h*4],FxOp20 - mov dword[FxTableA2+21h*4],FxOp21 - mov dword[FxTableA2+22h*4],FxOp22 - mov dword[FxTableA2+23h*4],FxOp23 - mov dword[FxTableA2+24h*4],FxOp24 - mov dword[FxTableA2+25h*4],FxOp25 - mov dword[FxTableA2+26h*4],FxOp26 - mov dword[FxTableA2+27h*4],FxOp27 - mov dword[FxTableA2+28h*4],FxOp28 - mov dword[FxTableA2+29h*4],FxOp29 - mov dword[FxTableA2+2Ah*4],FxOp2A - mov dword[FxTableA2+2Bh*4],FxOp2B - mov dword[FxTableA2+2Ch*4],FxOp2C - mov dword[FxTableA2+2Dh*4],FxOp2D - mov dword[FxTableA2+2Eh*4],FxOp2E - mov dword[FxTableA2+2Fh*4],FxOp2F - - mov dword[FxTableA2+30h*4],FxOp30 - mov dword[FxTableA2+31h*4],FxOp31 - mov dword[FxTableA2+32h*4],FxOp32 - mov dword[FxTableA2+33h*4],FxOp33 - mov dword[FxTableA2+34h*4],FxOp34 - mov dword[FxTableA2+35h*4],FxOp35 - mov dword[FxTableA2+36h*4],FxOp36 - mov dword[FxTableA2+37h*4],FxOp37 - mov dword[FxTableA2+38h*4],FxOp38 - mov dword[FxTableA2+39h*4],FxOp39 - mov dword[FxTableA2+3Ah*4],FxOp3A - mov dword[FxTableA2+3Bh*4],FxOp3B - mov dword[FxTableA2+3Ch*4],FxOp3C - mov dword[FxTableA2+3Dh*4],FxOp3D - mov dword[FxTableA2+3Eh*4],FxOp3E - mov dword[FxTableA2+3Fh*4],FxOp3F - - mov dword[FxTableA2+40h*4],FxOp40 - mov dword[FxTableA2+41h*4],FxOp41 - mov dword[FxTableA2+42h*4],FxOp42 - mov dword[FxTableA2+43h*4],FxOp43 - mov dword[FxTableA2+44h*4],FxOp44 - mov dword[FxTableA2+45h*4],FxOp45 - mov dword[FxTableA2+46h*4],FxOp46 - mov dword[FxTableA2+47h*4],FxOp47 - mov dword[FxTableA2+48h*4],FxOp48 - mov dword[FxTableA2+49h*4],FxOp49 - mov dword[FxTableA2+4Ah*4],FxOp4A - mov dword[FxTableA2+4Bh*4],FxOp4B - mov dword[FxTableA2+4Ch*4],FxOp4C - mov dword[FxTableA2+4Dh*4],FxOp4D - mov dword[FxTableA2+4Eh*4],FxOp4E - mov dword[FxTableA2+4Fh*4],FxOp4F - - mov dword[FxTableA2+50h*4],FxOp50A2 - mov dword[FxTableA2+51h*4],FxOp51A2 - mov dword[FxTableA2+52h*4],FxOp52A2 - mov dword[FxTableA2+53h*4],FxOp53A2 - mov dword[FxTableA2+54h*4],FxOp54A2 - mov dword[FxTableA2+55h*4],FxOp55A2 - mov dword[FxTableA2+56h*4],FxOp56A2 - mov dword[FxTableA2+57h*4],FxOp57A2 - mov dword[FxTableA2+58h*4],FxOp58A2 - mov dword[FxTableA2+59h*4],FxOp59A2 - mov dword[FxTableA2+5Ah*4],FxOp5AA2 - mov dword[FxTableA2+5Bh*4],FxOp5BA2 - mov dword[FxTableA2+5Ch*4],FxOp5CA2 - mov dword[FxTableA2+5Dh*4],FxOp5DA2 - mov dword[FxTableA2+5Eh*4],FxOp5EA2 - mov dword[FxTableA2+5Fh*4],FxOp5FA2 - - mov dword[FxTableA2+60h*4],FxOp60A2 - mov dword[FxTableA2+61h*4],FxOp61A2 - mov dword[FxTableA2+62h*4],FxOp62A2 - mov dword[FxTableA2+63h*4],FxOp63A2 - mov dword[FxTableA2+64h*4],FxOp64A2 - mov dword[FxTableA2+65h*4],FxOp65A2 - mov dword[FxTableA2+66h*4],FxOp66A2 - mov dword[FxTableA2+67h*4],FxOp67A2 - mov dword[FxTableA2+68h*4],FxOp68A2 - mov dword[FxTableA2+69h*4],FxOp69A2 - mov dword[FxTableA2+6Ah*4],FxOp6AA2 - mov dword[FxTableA2+6Bh*4],FxOp6BA2 - mov dword[FxTableA2+6Ch*4],FxOp6CA2 - mov dword[FxTableA2+6Dh*4],FxOp6DA2 - mov dword[FxTableA2+6Eh*4],FxOp6EA2 - mov dword[FxTableA2+6Fh*4],FxOp6FA2 - - mov dword[FxTableA2+70h*4],FxOp70 - mov dword[FxTableA2+71h*4],FxOp71A2 - mov dword[FxTableA2+72h*4],FxOp72A2 - mov dword[FxTableA2+73h*4],FxOp73A2 - mov dword[FxTableA2+74h*4],FxOp74A2 - mov dword[FxTableA2+75h*4],FxOp75A2 - mov dword[FxTableA2+76h*4],FxOp76A2 - mov dword[FxTableA2+77h*4],FxOp77A2 - mov dword[FxTableA2+78h*4],FxOp78A2 - mov dword[FxTableA2+79h*4],FxOp79A2 - mov dword[FxTableA2+7Ah*4],FxOp7AA2 - mov dword[FxTableA2+7Bh*4],FxOp7BA2 - mov dword[FxTableA2+7Ch*4],FxOp7CA2 - mov dword[FxTableA2+7Dh*4],FxOp7DA2 - mov dword[FxTableA2+7Eh*4],FxOp7EA2 - mov dword[FxTableA2+7Fh*4],FxOp7FA2 - - mov dword[FxTableA2+80h*4],FxOp80A2 - mov dword[FxTableA2+81h*4],FxOp81A2 - mov dword[FxTableA2+82h*4],FxOp82A2 - mov dword[FxTableA2+83h*4],FxOp83A2 - mov dword[FxTableA2+84h*4],FxOp84A2 - mov dword[FxTableA2+85h*4],FxOp85A2 - mov dword[FxTableA2+86h*4],FxOp86A2 - mov dword[FxTableA2+87h*4],FxOp87A2 - mov dword[FxTableA2+88h*4],FxOp88A2 - mov dword[FxTableA2+89h*4],FxOp89A2 - mov dword[FxTableA2+8Ah*4],FxOp8AA2 - mov dword[FxTableA2+8Bh*4],FxOp8BA2 - mov dword[FxTableA2+8Ch*4],FxOp8CA2 - mov dword[FxTableA2+8Dh*4],FxOp8DA2 - mov dword[FxTableA2+8Eh*4],FxOp8EA2 - mov dword[FxTableA2+8Fh*4],FxOp8FA2 - - mov dword[FxTableA2+90h*4],FxOp90 - mov dword[FxTableA2+91h*4],FxOp91 - mov dword[FxTableA2+92h*4],FxOp92 - mov dword[FxTableA2+93h*4],FxOp93 - mov dword[FxTableA2+94h*4],FxOp94 - mov dword[FxTableA2+95h*4],FxOp95 - mov dword[FxTableA2+96h*4],FxOp96 - mov dword[FxTableA2+97h*4],FxOp97 - mov dword[FxTableA2+98h*4],FxOp98 - mov dword[FxTableA2+99h*4],FxOp99 - mov dword[FxTableA2+9Ah*4],FxOp9A - mov dword[FxTableA2+9Bh*4],FxOp9B - mov dword[FxTableA2+9Ch*4],FxOp9C - mov dword[FxTableA2+9Dh*4],FxOp9D - mov dword[FxTableA2+9Eh*4],FxOp9E - mov dword[FxTableA2+9Fh*4],FxOp9F - - mov dword[FxTableA2+0A0h*4],FxOpA0A2 - mov dword[FxTableA2+0A1h*4],FxOpA1A2 - mov dword[FxTableA2+0A2h*4],FxOpA2A2 - mov dword[FxTableA2+0A3h*4],FxOpA3A2 - mov dword[FxTableA2+0A4h*4],FxOpA4A2 - mov dword[FxTableA2+0A5h*4],FxOpA5A2 - mov dword[FxTableA2+0A6h*4],FxOpA6A2 - mov dword[FxTableA2+0A7h*4],FxOpA7A2 - mov dword[FxTableA2+0A8h*4],FxOpA8A2 - mov dword[FxTableA2+0A9h*4],FxOpA9A2 - mov dword[FxTableA2+0AAh*4],FxOpAAA2 - mov dword[FxTableA2+0ABh*4],FxOpABA2 - mov dword[FxTableA2+0ACh*4],FxOpACA2 - mov dword[FxTableA2+0ADh*4],FxOpADA2 - mov dword[FxTableA2+0AEh*4],FxOpAEA2 - mov dword[FxTableA2+0AFh*4],FxOpAFA2 - - mov dword[FxTableA2+0B0h*4],FxOpB0 - mov dword[FxTableA2+0B1h*4],FxOpB1 - mov dword[FxTableA2+0B2h*4],FxOpB2 - mov dword[FxTableA2+0B3h*4],FxOpB3 - mov dword[FxTableA2+0B4h*4],FxOpB4 - mov dword[FxTableA2+0B5h*4],FxOpB5 - mov dword[FxTableA2+0B6h*4],FxOpB6 - mov dword[FxTableA2+0B7h*4],FxOpB7 - mov dword[FxTableA2+0B8h*4],FxOpB8 - mov dword[FxTableA2+0B9h*4],FxOpB9 - mov dword[FxTableA2+0BAh*4],FxOpBA - mov dword[FxTableA2+0BBh*4],FxOpBB - mov dword[FxTableA2+0BCh*4],FxOpBC - mov dword[FxTableA2+0BDh*4],FxOpBD - mov dword[FxTableA2+0BEh*4],FxOpBE - mov dword[FxTableA2+0BFh*4],FxOpBF - - mov dword[FxTableA2+0C0h*4],FxOpC0 - mov dword[FxTableA2+0C1h*4],FxOpC1A2 - mov dword[FxTableA2+0C2h*4],FxOpC2A2 - mov dword[FxTableA2+0C3h*4],FxOpC3A2 - mov dword[FxTableA2+0C4h*4],FxOpC4A2 - mov dword[FxTableA2+0C5h*4],FxOpC5A2 - mov dword[FxTableA2+0C6h*4],FxOpC6A2 - mov dword[FxTableA2+0C7h*4],FxOpC7A2 - mov dword[FxTableA2+0C8h*4],FxOpC8A2 - mov dword[FxTableA2+0C9h*4],FxOpC9A2 - mov dword[FxTableA2+0CAh*4],FxOpCAA2 - mov dword[FxTableA2+0CBh*4],FxOpCBA2 - mov dword[FxTableA2+0CCh*4],FxOpCCA2 - mov dword[FxTableA2+0CDh*4],FxOpCDA2 - mov dword[FxTableA2+0CEh*4],FxOpCEA2 - mov dword[FxTableA2+0CFh*4],FxOpCFA2 - - mov dword[FxTableA2+0D0h*4],FxOpD0 - mov dword[FxTableA2+0D1h*4],FxOpD1 - mov dword[FxTableA2+0D2h*4],FxOpD2 - mov dword[FxTableA2+0D3h*4],FxOpD3 - mov dword[FxTableA2+0D4h*4],FxOpD4 - mov dword[FxTableA2+0D5h*4],FxOpD5 - mov dword[FxTableA2+0D6h*4],FxOpD6 - mov dword[FxTableA2+0D7h*4],FxOpD7 - mov dword[FxTableA2+0D8h*4],FxOpD8 - mov dword[FxTableA2+0D9h*4],FxOpD9 - mov dword[FxTableA2+0DAh*4],FxOpDA - mov dword[FxTableA2+0DBh*4],FxOpDB - mov dword[FxTableA2+0DCh*4],FxOpDC - mov dword[FxTableA2+0DDh*4],FxOpDD - mov dword[FxTableA2+0DEh*4],FxOpDE - mov dword[FxTableA2+0DFh*4],FxOpDFA2 - - mov dword[FxTableA2+0E0h*4],FxOpE0 - mov dword[FxTableA2+0E1h*4],FxOpE1 - mov dword[FxTableA2+0E2h*4],FxOpE2 - mov dword[FxTableA2+0E3h*4],FxOpE3 - mov dword[FxTableA2+0E4h*4],FxOpE4 - mov dword[FxTableA2+0E5h*4],FxOpE5 - mov dword[FxTableA2+0E6h*4],FxOpE6 - mov dword[FxTableA2+0E7h*4],FxOpE7 - mov dword[FxTableA2+0E8h*4],FxOpE8 - mov dword[FxTableA2+0E9h*4],FxOpE9 - mov dword[FxTableA2+0EAh*4],FxOpEA - mov dword[FxTableA2+0EBh*4],FxOpEB - mov dword[FxTableA2+0ECh*4],FxOpEC - mov dword[FxTableA2+0EDh*4],FxOpED - mov dword[FxTableA2+0EEh*4],FxOpEE - mov dword[FxTableA2+0EFh*4],FxOpEFA2 - - mov dword[FxTableA2+0F0h*4],FxOpF0A2 - mov dword[FxTableA2+0F1h*4],FxOpF1A2 - mov dword[FxTableA2+0F2h*4],FxOpF2A2 - mov dword[FxTableA2+0F3h*4],FxOpF3A2 - mov dword[FxTableA2+0F4h*4],FxOpF4A2 - mov dword[FxTableA2+0F5h*4],FxOpF5A2 - mov dword[FxTableA2+0F6h*4],FxOpF6A2 - mov dword[FxTableA2+0F7h*4],FxOpF7A2 - mov dword[FxTableA2+0F8h*4],FxOpF8A2 - mov dword[FxTableA2+0F9h*4],FxOpF9A2 - mov dword[FxTableA2+0FAh*4],FxOpFAA2 - mov dword[FxTableA2+0FBh*4],FxOpFBA2 - mov dword[FxTableA2+0FCh*4],FxOpFCA2 - mov dword[FxTableA2+0FDh*4],FxOpFDA2 - mov dword[FxTableA2+0FEh*4],FxOpFEA2 - mov dword[FxTableA2+0FFh*4],FxOpFFA2 - - mov dword[FxTableA3+00h*4],FxOp00 - mov dword[FxTableA3+01h*4],FxOp01 - mov dword[FxTableA3+02h*4],FxOp02 - mov dword[FxTableA3+03h*4],FxOp03 - mov dword[FxTableA3+04h*4],FxOp04 - mov dword[FxTableA3+05h*4],FxOp05 - mov dword[FxTableA3+06h*4],FxOp06 - mov dword[FxTableA3+07h*4],FxOp07 - mov dword[FxTableA3+08h*4],FxOp08 - mov dword[FxTableA3+09h*4],FxOp09 - mov dword[FxTableA3+0Ah*4],FxOp0A - mov dword[FxTableA3+0Bh*4],FxOp0B - mov dword[FxTableA3+0Ch*4],FxOp0C - mov dword[FxTableA3+0Dh*4],FxOp0D - mov dword[FxTableA3+0Eh*4],FxOp0E - mov dword[FxTableA3+0Fh*4],FxOp0F - - mov dword[FxTableA3+10h*4],FxOp10 - mov dword[FxTableA3+11h*4],FxOp11 - mov dword[FxTableA3+12h*4],FxOp12 - mov dword[FxTableA3+13h*4],FxOp13 - mov dword[FxTableA3+14h*4],FxOp14 - mov dword[FxTableA3+15h*4],FxOp15 - mov dword[FxTableA3+16h*4],FxOp16 - mov dword[FxTableA3+17h*4],FxOp17 - mov dword[FxTableA3+18h*4],FxOp18 - mov dword[FxTableA3+19h*4],FxOp19 - mov dword[FxTableA3+1Ah*4],FxOp1A - mov dword[FxTableA3+1Bh*4],FxOp1B - mov dword[FxTableA3+1Ch*4],FxOp1C - mov dword[FxTableA3+1Dh*4],FxOp1D - mov dword[FxTableA3+1Eh*4],FxOp1E - mov dword[FxTableA3+1Fh*4],FxOp1F - - mov dword[FxTableA3+20h*4],FxOp20 - mov dword[FxTableA3+21h*4],FxOp21 - mov dword[FxTableA3+22h*4],FxOp22 - mov dword[FxTableA3+23h*4],FxOp23 - mov dword[FxTableA3+24h*4],FxOp24 - mov dword[FxTableA3+25h*4],FxOp25 - mov dword[FxTableA3+26h*4],FxOp26 - mov dword[FxTableA3+27h*4],FxOp27 - mov dword[FxTableA3+28h*4],FxOp28 - mov dword[FxTableA3+29h*4],FxOp29 - mov dword[FxTableA3+2Ah*4],FxOp2A - mov dword[FxTableA3+2Bh*4],FxOp2B - mov dword[FxTableA3+2Ch*4],FxOp2C - mov dword[FxTableA3+2Dh*4],FxOp2D - mov dword[FxTableA3+2Eh*4],FxOp2E - mov dword[FxTableA3+2Fh*4],FxOp2F - - mov dword[FxTableA3+30h*4],FxOp30 - mov dword[FxTableA3+31h*4],FxOp31 - mov dword[FxTableA3+32h*4],FxOp32 - mov dword[FxTableA3+33h*4],FxOp33 - mov dword[FxTableA3+34h*4],FxOp34 - mov dword[FxTableA3+35h*4],FxOp35 - mov dword[FxTableA3+36h*4],FxOp36 - mov dword[FxTableA3+37h*4],FxOp37 - mov dword[FxTableA3+38h*4],FxOp38 - mov dword[FxTableA3+39h*4],FxOp39 - mov dword[FxTableA3+3Ah*4],FxOp3A - mov dword[FxTableA3+3Bh*4],FxOp3B - mov dword[FxTableA3+3Ch*4],FxOp3C - mov dword[FxTableA3+3Dh*4],FxOp3D - mov dword[FxTableA3+3Eh*4],FxOp3E - mov dword[FxTableA3+3Fh*4],FxOp3F - - mov dword[FxTableA3+40h*4],FxOp40 - mov dword[FxTableA3+41h*4],FxOp41 - mov dword[FxTableA3+42h*4],FxOp42 - mov dword[FxTableA3+43h*4],FxOp43 - mov dword[FxTableA3+44h*4],FxOp44 - mov dword[FxTableA3+45h*4],FxOp45 - mov dword[FxTableA3+46h*4],FxOp46 - mov dword[FxTableA3+47h*4],FxOp47 - mov dword[FxTableA3+48h*4],FxOp48 - mov dword[FxTableA3+49h*4],FxOp49 - mov dword[FxTableA3+4Ah*4],FxOp4A - mov dword[FxTableA3+4Bh*4],FxOp4B - mov dword[FxTableA3+4Ch*4],FxOp4C - mov dword[FxTableA3+4Dh*4],FxOp4D - mov dword[FxTableA3+4Eh*4],FxOp4E - mov dword[FxTableA3+4Fh*4],FxOp4F - - mov dword[FxTableA3+50h*4],FxOp50A3 - mov dword[FxTableA3+51h*4],FxOp51A3 - mov dword[FxTableA3+52h*4],FxOp52A3 - mov dword[FxTableA3+53h*4],FxOp53A3 - mov dword[FxTableA3+54h*4],FxOp54A3 - mov dword[FxTableA3+55h*4],FxOp55A3 - mov dword[FxTableA3+56h*4],FxOp56A3 - mov dword[FxTableA3+57h*4],FxOp57A3 - mov dword[FxTableA3+58h*4],FxOp58A3 - mov dword[FxTableA3+59h*4],FxOp59A3 - mov dword[FxTableA3+5Ah*4],FxOp5AA3 - mov dword[FxTableA3+5Bh*4],FxOp5BA3 - mov dword[FxTableA3+5Ch*4],FxOp5CA3 - mov dword[FxTableA3+5Dh*4],FxOp5DA3 - mov dword[FxTableA3+5Eh*4],FxOp5EA3 - mov dword[FxTableA3+5Fh*4],FxOp5FA3 - - mov dword[FxTableA3+60h*4],FxOp60A3 - mov dword[FxTableA3+61h*4],FxOp61A3 - mov dword[FxTableA3+62h*4],FxOp62A3 - mov dword[FxTableA3+63h*4],FxOp63A3 - mov dword[FxTableA3+64h*4],FxOp64A3 - mov dword[FxTableA3+65h*4],FxOp65A3 - mov dword[FxTableA3+66h*4],FxOp66A3 - mov dword[FxTableA3+67h*4],FxOp67A3 - mov dword[FxTableA3+68h*4],FxOp68A3 - mov dword[FxTableA3+69h*4],FxOp69A3 - mov dword[FxTableA3+6Ah*4],FxOp6AA3 - mov dword[FxTableA3+6Bh*4],FxOp6BA3 - mov dword[FxTableA3+6Ch*4],FxOp6CA3 - mov dword[FxTableA3+6Dh*4],FxOp6DA3 - mov dword[FxTableA3+6Eh*4],FxOp6EA3 - mov dword[FxTableA3+6Fh*4],FxOp6FA3 - - mov dword[FxTableA3+70h*4],FxOp70 - mov dword[FxTableA3+71h*4],FxOp71A3 - mov dword[FxTableA3+72h*4],FxOp72A3 - mov dword[FxTableA3+73h*4],FxOp73A3 - mov dword[FxTableA3+74h*4],FxOp74A3 - mov dword[FxTableA3+75h*4],FxOp75A3 - mov dword[FxTableA3+76h*4],FxOp76A3 - mov dword[FxTableA3+77h*4],FxOp77A3 - mov dword[FxTableA3+78h*4],FxOp78A3 - mov dword[FxTableA3+79h*4],FxOp79A3 - mov dword[FxTableA3+7Ah*4],FxOp7AA3 - mov dword[FxTableA3+7Bh*4],FxOp7BA3 - mov dword[FxTableA3+7Ch*4],FxOp7CA3 - mov dword[FxTableA3+7Dh*4],FxOp7DA3 - mov dword[FxTableA3+7Eh*4],FxOp7EA3 - mov dword[FxTableA3+7Fh*4],FxOp7FA3 - - mov dword[FxTableA3+80h*4],FxOp80A3 - mov dword[FxTableA3+81h*4],FxOp81A3 - mov dword[FxTableA3+82h*4],FxOp82A3 - mov dword[FxTableA3+83h*4],FxOp83A3 - mov dword[FxTableA3+84h*4],FxOp84A3 - mov dword[FxTableA3+85h*4],FxOp85A3 - mov dword[FxTableA3+86h*4],FxOp86A3 - mov dword[FxTableA3+87h*4],FxOp87A3 - mov dword[FxTableA3+88h*4],FxOp88A3 - mov dword[FxTableA3+89h*4],FxOp89A3 - mov dword[FxTableA3+8Ah*4],FxOp8AA3 - mov dword[FxTableA3+8Bh*4],FxOp8BA3 - mov dword[FxTableA3+8Ch*4],FxOp8CA3 - mov dword[FxTableA3+8Dh*4],FxOp8DA3 - mov dword[FxTableA3+8Eh*4],FxOp8EA3 - mov dword[FxTableA3+8Fh*4],FxOp8FA3 - - mov dword[FxTableA3+90h*4],FxOp90 - mov dword[FxTableA3+91h*4],FxOp91 - mov dword[FxTableA3+92h*4],FxOp92 - mov dword[FxTableA3+93h*4],FxOp93 - mov dword[FxTableA3+94h*4],FxOp94 - mov dword[FxTableA3+95h*4],FxOp95 - mov dword[FxTableA3+96h*4],FxOp96 - mov dword[FxTableA3+97h*4],FxOp97 - mov dword[FxTableA3+98h*4],FxOp98 - mov dword[FxTableA3+99h*4],FxOp99 - mov dword[FxTableA3+9Ah*4],FxOp9A - mov dword[FxTableA3+9Bh*4],FxOp9B - mov dword[FxTableA3+9Ch*4],FxOp9C - mov dword[FxTableA3+9Dh*4],FxOp9D - mov dword[FxTableA3+9Eh*4],FxOp9E - mov dword[FxTableA3+9Fh*4],FxOp9F - - mov dword[FxTableA3+0A0h*4],FxOpA0 - mov dword[FxTableA3+0A1h*4],FxOpA1 - mov dword[FxTableA3+0A2h*4],FxOpA2 - mov dword[FxTableA3+0A3h*4],FxOpA3 - mov dword[FxTableA3+0A4h*4],FxOpA4 - mov dword[FxTableA3+0A5h*4],FxOpA5 - mov dword[FxTableA3+0A6h*4],FxOpA6 - mov dword[FxTableA3+0A7h*4],FxOpA7 - mov dword[FxTableA3+0A8h*4],FxOpA8 - mov dword[FxTableA3+0A9h*4],FxOpA9 - mov dword[FxTableA3+0AAh*4],FxOpAA - mov dword[FxTableA3+0ABh*4],FxOpAB - mov dword[FxTableA3+0ACh*4],FxOpAC - mov dword[FxTableA3+0ADh*4],FxOpAD - mov dword[FxTableA3+0AEh*4],FxOpAE - mov dword[FxTableA3+0AFh*4],FxOpAF - - mov dword[FxTableA3+0B0h*4],FxOpB0 - mov dword[FxTableA3+0B1h*4],FxOpB1 - mov dword[FxTableA3+0B2h*4],FxOpB2 - mov dword[FxTableA3+0B3h*4],FxOpB3 - mov dword[FxTableA3+0B4h*4],FxOpB4 - mov dword[FxTableA3+0B5h*4],FxOpB5 - mov dword[FxTableA3+0B6h*4],FxOpB6 - mov dword[FxTableA3+0B7h*4],FxOpB7 - mov dword[FxTableA3+0B8h*4],FxOpB8 - mov dword[FxTableA3+0B9h*4],FxOpB9 - mov dword[FxTableA3+0BAh*4],FxOpBA - mov dword[FxTableA3+0BBh*4],FxOpBB - mov dword[FxTableA3+0BCh*4],FxOpBC - mov dword[FxTableA3+0BDh*4],FxOpBD - mov dword[FxTableA3+0BEh*4],FxOpBE - mov dword[FxTableA3+0BFh*4],FxOpBF - - mov dword[FxTableA3+0C0h*4],FxOpC0 - mov dword[FxTableA3+0C1h*4],FxOpC1A3 - mov dword[FxTableA3+0C2h*4],FxOpC2A3 - mov dword[FxTableA3+0C3h*4],FxOpC3A3 - mov dword[FxTableA3+0C4h*4],FxOpC4A3 - mov dword[FxTableA3+0C5h*4],FxOpC5A3 - mov dword[FxTableA3+0C6h*4],FxOpC6A3 - mov dword[FxTableA3+0C7h*4],FxOpC7A3 - mov dword[FxTableA3+0C8h*4],FxOpC8A3 - mov dword[FxTableA3+0C9h*4],FxOpC9A3 - mov dword[FxTableA3+0CAh*4],FxOpCAA3 - mov dword[FxTableA3+0CBh*4],FxOpCBA3 - mov dword[FxTableA3+0CCh*4],FxOpCCA3 - mov dword[FxTableA3+0CDh*4],FxOpCDA3 - mov dword[FxTableA3+0CEh*4],FxOpCEA3 - mov dword[FxTableA3+0CFh*4],FxOpCFA3 - - mov dword[FxTableA3+0D0h*4],FxOpD0 - mov dword[FxTableA3+0D1h*4],FxOpD1 - mov dword[FxTableA3+0D2h*4],FxOpD2 - mov dword[FxTableA3+0D3h*4],FxOpD3 - mov dword[FxTableA3+0D4h*4],FxOpD4 - mov dword[FxTableA3+0D5h*4],FxOpD5 - mov dword[FxTableA3+0D6h*4],FxOpD6 - mov dword[FxTableA3+0D7h*4],FxOpD7 - mov dword[FxTableA3+0D8h*4],FxOpD8 - mov dword[FxTableA3+0D9h*4],FxOpD9 - mov dword[FxTableA3+0DAh*4],FxOpDA - mov dword[FxTableA3+0DBh*4],FxOpDB - mov dword[FxTableA3+0DCh*4],FxOpDC - mov dword[FxTableA3+0DDh*4],FxOpDD - mov dword[FxTableA3+0DEh*4],FxOpDE - mov dword[FxTableA3+0DFh*4],FxOpDFA3 - - mov dword[FxTableA3+0E0h*4],FxOpE0 - mov dword[FxTableA3+0E1h*4],FxOpE1 - mov dword[FxTableA3+0E2h*4],FxOpE2 - mov dword[FxTableA3+0E3h*4],FxOpE3 - mov dword[FxTableA3+0E4h*4],FxOpE4 - mov dword[FxTableA3+0E5h*4],FxOpE5 - mov dword[FxTableA3+0E6h*4],FxOpE6 - mov dword[FxTableA3+0E7h*4],FxOpE7 - mov dword[FxTableA3+0E8h*4],FxOpE8 - mov dword[FxTableA3+0E9h*4],FxOpE9 - mov dword[FxTableA3+0EAh*4],FxOpEA - mov dword[FxTableA3+0EBh*4],FxOpEB - mov dword[FxTableA3+0ECh*4],FxOpEC - mov dword[FxTableA3+0EDh*4],FxOpED - mov dword[FxTableA3+0EEh*4],FxOpEE - mov dword[FxTableA3+0EFh*4],FxOpEFA3 - - mov dword[FxTableA3+0F0h*4],FxOpF0 - mov dword[FxTableA3+0F1h*4],FxOpF1 - mov dword[FxTableA3+0F2h*4],FxOpF2 - mov dword[FxTableA3+0F3h*4],FxOpF3 - mov dword[FxTableA3+0F4h*4],FxOpF4 - mov dword[FxTableA3+0F5h*4],FxOpF5 - mov dword[FxTableA3+0F6h*4],FxOpF6 - mov dword[FxTableA3+0F7h*4],FxOpF7 - mov dword[FxTableA3+0F8h*4],FxOpF8 - mov dword[FxTableA3+0F9h*4],FxOpF9 - mov dword[FxTableA3+0FAh*4],FxOpFA - mov dword[FxTableA3+0FBh*4],FxOpFB - mov dword[FxTableA3+0FCh*4],FxOpFC - mov dword[FxTableA3+0FDh*4],FxOpFD - mov dword[FxTableA3+0FEh*4],FxOpFE - mov dword[FxTableA3+0FFh*4],FxOpFF - - ; Transfer FxTable to FxTableb and FxTablec - mov esi,FxTable - mov edi,FxTableb - mov ecx,256*4 - rep movsd - mov esi,FxTable - mov edi,FxTablec - mov ecx,256*4 - rep movsd - - mov dword[FxTableb+05h*4],FxOpb05 - mov dword[FxTableb+06h*4],FxOpb06 - mov dword[FxTableb+07h*4],FxOpb07 - mov dword[FxTableb+08h*4],FxOpb08 - mov dword[FxTableb+09h*4],FxOpb09 - mov dword[FxTableb+0Ah*4],FxOpb0A - mov dword[FxTableb+0Bh*4],FxOpb0B - mov dword[FxTableb+0Ch*4],FxOpb0C - mov dword[FxTableb+0Dh*4],FxOpb0D - mov dword[FxTableb+0Eh*4],FxOpb0E - mov dword[FxTableb+0Fh*4],FxOpb0F - mov dword[FxTableb+10h*4],FxOpb10 - mov dword[FxTableb+11h*4],FxOpb11 - mov dword[FxTableb+12h*4],FxOpb12 - mov dword[FxTableb+13h*4],FxOpb13 - mov dword[FxTableb+14h*4],FxOpb14 - mov dword[FxTableb+15h*4],FxOpb15 - mov dword[FxTableb+16h*4],FxOpb16 - mov dword[FxTableb+17h*4],FxOpb17 - mov dword[FxTableb+18h*4],FxOpb18 - mov dword[FxTableb+19h*4],FxOpb19 - mov dword[FxTableb+1Ah*4],FxOpb1A - mov dword[FxTableb+1Bh*4],FxOpb1B - mov dword[FxTableb+1Ch*4],FxOpb1C - mov dword[FxTableb+1Dh*4],FxOpb1D - mov dword[FxTableb+1Eh*4],FxOpb1E - mov dword[FxTableb+1Fh*4],FxOpb1F - mov dword[FxTableb+3Dh*4],FxOpb3D - mov dword[FxTableb+3Eh*4],FxOpb3E - mov dword[FxTableb+3Fh*4],FxOpb3F - mov dword[FxTableb+0B0h*4],FxOpbB0 - mov dword[FxTableb+0B1h*4],FxOpbB1 - mov dword[FxTableb+0B2h*4],FxOpbB2 - mov dword[FxTableb+0B3h*4],FxOpbB3 - mov dword[FxTableb+0B4h*4],FxOpbB4 - mov dword[FxTableb+0B5h*4],FxOpbB5 - mov dword[FxTableb+0B6h*4],FxOpbB6 - mov dword[FxTableb+0B7h*4],FxOpbB7 - mov dword[FxTableb+0B8h*4],FxOpbB8 - mov dword[FxTableb+0B9h*4],FxOpbB9 - mov dword[FxTableb+0BAh*4],FxOpbBA - mov dword[FxTableb+0BBh*4],FxOpbBB - mov dword[FxTableb+0BCh*4],FxOpbBC - mov dword[FxTableb+0BDh*4],FxOpbBD - mov dword[FxTableb+0BEh*4],FxOpbBE - mov dword[FxTableb+0BFh*4],FxOpbBF - - mov dword[FxTablebA1+05h*4],FxOpb05 - mov dword[FxTablebA1+06h*4],FxOpb06 - mov dword[FxTablebA1+07h*4],FxOpb07 - mov dword[FxTablebA1+08h*4],FxOpb08 - mov dword[FxTablebA1+09h*4],FxOpb09 - mov dword[FxTablebA1+0Ah*4],FxOpb0A - mov dword[FxTablebA1+0Bh*4],FxOpb0B - mov dword[FxTablebA1+0Ch*4],FxOpb0C - mov dword[FxTablebA1+0Dh*4],FxOpb0D - mov dword[FxTablebA1+0Eh*4],FxOpb0E - mov dword[FxTablebA1+0Fh*4],FxOpb0F - mov dword[FxTablebA1+10h*4],FxOpb10 - mov dword[FxTablebA1+11h*4],FxOpb11 - mov dword[FxTablebA1+12h*4],FxOpb12 - mov dword[FxTablebA1+13h*4],FxOpb13 - mov dword[FxTablebA1+14h*4],FxOpb14 - mov dword[FxTablebA1+15h*4],FxOpb15 - mov dword[FxTablebA1+16h*4],FxOpb16 - mov dword[FxTablebA1+17h*4],FxOpb17 - mov dword[FxTablebA1+18h*4],FxOpb18 - mov dword[FxTablebA1+19h*4],FxOpb19 - mov dword[FxTablebA1+1Ah*4],FxOpb1A - mov dword[FxTablebA1+1Bh*4],FxOpb1B - mov dword[FxTablebA1+1Ch*4],FxOpb1C - mov dword[FxTablebA1+1Dh*4],FxOpb1D - mov dword[FxTablebA1+1Eh*4],FxOpb1E - mov dword[FxTablebA1+1Fh*4],FxOpb1F - mov dword[FxTablebA1+3Dh*4],FxOpb3D - mov dword[FxTablebA1+3Eh*4],FxOpb3E - mov dword[FxTablebA1+3Fh*4],FxOpb3F - mov dword[FxTablebA1+0B0h*4],FxOpbB0 - mov dword[FxTablebA1+0B1h*4],FxOpbB1 - mov dword[FxTablebA1+0B2h*4],FxOpbB2 - mov dword[FxTablebA1+0B3h*4],FxOpbB3 - mov dword[FxTablebA1+0B4h*4],FxOpbB4 - mov dword[FxTablebA1+0B5h*4],FxOpbB5 - mov dword[FxTablebA1+0B6h*4],FxOpbB6 - mov dword[FxTablebA1+0B7h*4],FxOpbB7 - mov dword[FxTablebA1+0B8h*4],FxOpbB8 - mov dword[FxTablebA1+0B9h*4],FxOpbB9 - mov dword[FxTablebA1+0BAh*4],FxOpbBA - mov dword[FxTablebA1+0BBh*4],FxOpbBB - mov dword[FxTablebA1+0BCh*4],FxOpbBC - mov dword[FxTablebA1+0BDh*4],FxOpbBD - mov dword[FxTablebA1+0BEh*4],FxOpbBE - mov dword[FxTablebA1+0BFh*4],FxOpbBF - - mov dword[FxTablebA2+05h*4],FxOpb05 - mov dword[FxTablebA2+06h*4],FxOpb06 - mov dword[FxTablebA2+07h*4],FxOpb07 - mov dword[FxTablebA2+08h*4],FxOpb08 - mov dword[FxTablebA2+09h*4],FxOpb09 - mov dword[FxTablebA2+0Ah*4],FxOpb0A - mov dword[FxTablebA2+0Bh*4],FxOpb0B - mov dword[FxTablebA2+0Ch*4],FxOpb0C - mov dword[FxTablebA2+0Dh*4],FxOpb0D - mov dword[FxTablebA2+0Eh*4],FxOpb0E - mov dword[FxTablebA2+0Fh*4],FxOpb0F - mov dword[FxTablebA2+10h*4],FxOpb10 - mov dword[FxTablebA2+11h*4],FxOpb11 - mov dword[FxTablebA2+12h*4],FxOpb12 - mov dword[FxTablebA2+13h*4],FxOpb13 - mov dword[FxTablebA2+14h*4],FxOpb14 - mov dword[FxTablebA2+15h*4],FxOpb15 - mov dword[FxTablebA2+16h*4],FxOpb16 - mov dword[FxTablebA2+17h*4],FxOpb17 - mov dword[FxTablebA2+18h*4],FxOpb18 - mov dword[FxTablebA2+19h*4],FxOpb19 - mov dword[FxTablebA2+1Ah*4],FxOpb1A - mov dword[FxTablebA2+1Bh*4],FxOpb1B - mov dword[FxTablebA2+1Ch*4],FxOpb1C - mov dword[FxTablebA2+1Dh*4],FxOpb1D - mov dword[FxTablebA2+1Eh*4],FxOpb1E - mov dword[FxTablebA2+1Fh*4],FxOpb1F - mov dword[FxTablebA2+3Dh*4],FxOpb3D - mov dword[FxTablebA2+3Eh*4],FxOpb3E - mov dword[FxTablebA2+3Fh*4],FxOpb3F - mov dword[FxTablebA2+0B0h*4],FxOpbB0 - mov dword[FxTablebA2+0B1h*4],FxOpbB1 - mov dword[FxTablebA2+0B2h*4],FxOpbB2 - mov dword[FxTablebA2+0B3h*4],FxOpbB3 - mov dword[FxTablebA2+0B4h*4],FxOpbB4 - mov dword[FxTablebA2+0B5h*4],FxOpbB5 - mov dword[FxTablebA2+0B6h*4],FxOpbB6 - mov dword[FxTablebA2+0B7h*4],FxOpbB7 - mov dword[FxTablebA2+0B8h*4],FxOpbB8 - mov dword[FxTablebA2+0B9h*4],FxOpbB9 - mov dword[FxTablebA2+0BAh*4],FxOpbBA - mov dword[FxTablebA2+0BBh*4],FxOpbBB - mov dword[FxTablebA2+0BCh*4],FxOpbBC - mov dword[FxTablebA2+0BDh*4],FxOpbBD - mov dword[FxTablebA2+0BEh*4],FxOpbBE - mov dword[FxTablebA2+0BFh*4],FxOpbBF - - mov dword[FxTablebA3+05h*4],FxOpb05 - mov dword[FxTablebA3+06h*4],FxOpb06 - mov dword[FxTablebA3+07h*4],FxOpb07 - mov dword[FxTablebA3+08h*4],FxOpb08 - mov dword[FxTablebA3+09h*4],FxOpb09 - mov dword[FxTablebA3+0Ah*4],FxOpb0A - mov dword[FxTablebA3+0Bh*4],FxOpb0B - mov dword[FxTablebA3+0Ch*4],FxOpb0C - mov dword[FxTablebA3+0Dh*4],FxOpb0D - mov dword[FxTablebA3+0Eh*4],FxOpb0E - mov dword[FxTablebA3+0Fh*4],FxOpb0F - mov dword[FxTablebA3+10h*4],FxOpb10 - mov dword[FxTablebA3+11h*4],FxOpb11 - mov dword[FxTablebA3+12h*4],FxOpb12 - mov dword[FxTablebA3+13h*4],FxOpb13 - mov dword[FxTablebA3+14h*4],FxOpb14 - mov dword[FxTablebA3+15h*4],FxOpb15 - mov dword[FxTablebA3+16h*4],FxOpb16 - mov dword[FxTablebA3+17h*4],FxOpb17 - mov dword[FxTablebA3+18h*4],FxOpb18 - mov dword[FxTablebA3+19h*4],FxOpb19 - mov dword[FxTablebA3+1Ah*4],FxOpb1A - mov dword[FxTablebA3+1Bh*4],FxOpb1B - mov dword[FxTablebA3+1Ch*4],FxOpb1C - mov dword[FxTablebA3+1Dh*4],FxOpb1D - mov dword[FxTablebA3+1Eh*4],FxOpb1E - mov dword[FxTablebA3+1Fh*4],FxOpb1F - mov dword[FxTablebA3+3Dh*4],FxOpb3D - mov dword[FxTablebA3+3Eh*4],FxOpb3E - mov dword[FxTablebA3+3Fh*4],FxOpb3F - mov dword[FxTablebA3+0B0h*4],FxOpbB0 - mov dword[FxTablebA3+0B1h*4],FxOpbB1 - mov dword[FxTablebA3+0B2h*4],FxOpbB2 - mov dword[FxTablebA3+0B3h*4],FxOpbB3 - mov dword[FxTablebA3+0B4h*4],FxOpbB4 - mov dword[FxTablebA3+0B5h*4],FxOpbB5 - mov dword[FxTablebA3+0B6h*4],FxOpbB6 - mov dword[FxTablebA3+0B7h*4],FxOpbB7 - mov dword[FxTablebA3+0B8h*4],FxOpbB8 - mov dword[FxTablebA3+0B9h*4],FxOpbB9 - mov dword[FxTablebA3+0BAh*4],FxOpbBA - mov dword[FxTablebA3+0BBh*4],FxOpbBB - mov dword[FxTablebA3+0BCh*4],FxOpbBC - mov dword[FxTablebA3+0BDh*4],FxOpbBD - mov dword[FxTablebA3+0BEh*4],FxOpbBE - mov dword[FxTablebA3+0BFh*4],FxOpbBF - - mov dword[FxTablec+05h*4],FxOpc05 - mov dword[FxTablec+06h*4],FxOpc06 - mov dword[FxTablec+07h*4],FxOpc07 - mov dword[FxTablec+08h*4],FxOpc08 - mov dword[FxTablec+09h*4],FxOpc09 - mov dword[FxTablec+0Ah*4],FxOpc0A - mov dword[FxTablec+0Bh*4],FxOpc0B - mov dword[FxTablec+0Ch*4],FxOpc0C - mov dword[FxTablec+0Dh*4],FxOpc0D - mov dword[FxTablec+0Eh*4],FxOpc0E - mov dword[FxTablec+0Fh*4],FxOpc0F - mov dword[FxTablec+10h*4],FxOpc10 - mov dword[FxTablec+11h*4],FxOpc11 - mov dword[FxTablec+12h*4],FxOpc12 - mov dword[FxTablec+13h*4],FxOpc13 - mov dword[FxTablec+14h*4],FxOpc14 - mov dword[FxTablec+15h*4],FxOpc15 - mov dword[FxTablec+16h*4],FxOpc16 - mov dword[FxTablec+17h*4],FxOpc17 - mov dword[FxTablec+18h*4],FxOpc18 - mov dword[FxTablec+19h*4],FxOpc19 - mov dword[FxTablec+1Ah*4],FxOpc1A - mov dword[FxTablec+1Bh*4],FxOpc1B - mov dword[FxTablec+1Ch*4],FxOpc1C - mov dword[FxTablec+1Dh*4],FxOpc1D - mov dword[FxTablec+1Eh*4],FxOpc1E - mov dword[FxTablec+1Fh*4],FxOpc1F - mov dword[FxTablec+3Dh*4],FxOpc3D - mov dword[FxTablec+3Eh*4],FxOpc3E - mov dword[FxTablec+3Fh*4],FxOpc3F - mov dword[FxTablec+0B0h*4],FxOpcB0 - mov dword[FxTablec+0B1h*4],FxOpcB1 - mov dword[FxTablec+0B2h*4],FxOpcB2 - mov dword[FxTablec+0B3h*4],FxOpcB3 - mov dword[FxTablec+0B4h*4],FxOpcB4 - mov dword[FxTablec+0B5h*4],FxOpcB5 - mov dword[FxTablec+0B6h*4],FxOpcB6 - mov dword[FxTablec+0B7h*4],FxOpcB7 - mov dword[FxTablec+0B8h*4],FxOpcB8 - mov dword[FxTablec+0B9h*4],FxOpcB9 - mov dword[FxTablec+0BAh*4],FxOpcBA - mov dword[FxTablec+0BBh*4],FxOpcBB - mov dword[FxTablec+0BCh*4],FxOpcBC - mov dword[FxTablec+0BDh*4],FxOpcBD - mov dword[FxTablec+0BEh*4],FxOpcBE - mov dword[FxTablec+0BFh*4],FxOpcBF - - mov dword[FxTablecA1+05h*4],FxOpc05 - mov dword[FxTablecA1+06h*4],FxOpc06 - mov dword[FxTablecA1+07h*4],FxOpc07 - mov dword[FxTablecA1+08h*4],FxOpc08 - mov dword[FxTablecA1+09h*4],FxOpc09 - mov dword[FxTablecA1+0Ah*4],FxOpc0A - mov dword[FxTablecA1+0Bh*4],FxOpc0B - mov dword[FxTablecA1+0Ch*4],FxOpc0C - mov dword[FxTablecA1+0Dh*4],FxOpc0D - mov dword[FxTablecA1+0Eh*4],FxOpc0E - mov dword[FxTablecA1+0Fh*4],FxOpc0F - mov dword[FxTablecA1+10h*4],FxOpc10 - mov dword[FxTablecA1+11h*4],FxOpc11 - mov dword[FxTablecA1+12h*4],FxOpc12 - mov dword[FxTablecA1+13h*4],FxOpc13 - mov dword[FxTablecA1+14h*4],FxOpc14 - mov dword[FxTablecA1+15h*4],FxOpc15 - mov dword[FxTablecA1+16h*4],FxOpc16 - mov dword[FxTablecA1+17h*4],FxOpc17 - mov dword[FxTablecA1+18h*4],FxOpc18 - mov dword[FxTablecA1+19h*4],FxOpc19 - mov dword[FxTablecA1+1Ah*4],FxOpc1A - mov dword[FxTablecA1+1Bh*4],FxOpc1B - mov dword[FxTablecA1+1Ch*4],FxOpc1C - mov dword[FxTablecA1+1Dh*4],FxOpc1D - mov dword[FxTablecA1+1Eh*4],FxOpc1E - mov dword[FxTablecA1+1Fh*4],FxOpc1F - mov dword[FxTablecA1+3Dh*4],FxOpc3D - mov dword[FxTablecA1+3Eh*4],FxOpc3E - mov dword[FxTablecA1+3Fh*4],FxOpc3F - mov dword[FxTablecA1+0B0h*4],FxOpcB0 - mov dword[FxTablecA1+0B1h*4],FxOpcB1 - mov dword[FxTablecA1+0B2h*4],FxOpcB2 - mov dword[FxTablecA1+0B3h*4],FxOpcB3 - mov dword[FxTablecA1+0B4h*4],FxOpcB4 - mov dword[FxTablecA1+0B5h*4],FxOpcB5 - mov dword[FxTablecA1+0B6h*4],FxOpcB6 - mov dword[FxTablecA1+0B7h*4],FxOpcB7 - mov dword[FxTablecA1+0B8h*4],FxOpcB8 - mov dword[FxTablecA1+0B9h*4],FxOpcB9 - mov dword[FxTablecA1+0BAh*4],FxOpcBA - mov dword[FxTablecA1+0BBh*4],FxOpcBB - mov dword[FxTablecA1+0BCh*4],FxOpcBC - mov dword[FxTablecA1+0BDh*4],FxOpcBD - mov dword[FxTablecA1+0BEh*4],FxOpcBE - mov dword[FxTablecA1+0BFh*4],FxOpcBF - - mov dword[FxTablecA2+05h*4],FxOpc05 - mov dword[FxTablecA2+06h*4],FxOpc06 - mov dword[FxTablecA2+07h*4],FxOpc07 - mov dword[FxTablecA2+08h*4],FxOpc08 - mov dword[FxTablecA2+09h*4],FxOpc09 - mov dword[FxTablecA2+0Ah*4],FxOpc0A - mov dword[FxTablecA2+0Bh*4],FxOpc0B - mov dword[FxTablecA2+0Ch*4],FxOpc0C - mov dword[FxTablecA2+0Dh*4],FxOpc0D - mov dword[FxTablecA2+0Eh*4],FxOpc0E - mov dword[FxTablecA2+0Fh*4],FxOpc0F - mov dword[FxTablecA2+10h*4],FxOpc10 - mov dword[FxTablecA2+11h*4],FxOpc11 - mov dword[FxTablecA2+12h*4],FxOpc12 - mov dword[FxTablecA2+13h*4],FxOpc13 - mov dword[FxTablecA2+14h*4],FxOpc14 - mov dword[FxTablecA2+15h*4],FxOpc15 - mov dword[FxTablecA2+16h*4],FxOpc16 - mov dword[FxTablecA2+17h*4],FxOpc17 - mov dword[FxTablecA2+18h*4],FxOpc18 - mov dword[FxTablecA2+19h*4],FxOpc19 - mov dword[FxTablecA2+1Ah*4],FxOpc1A - mov dword[FxTablecA2+1Bh*4],FxOpc1B - mov dword[FxTablecA2+1Ch*4],FxOpc1C - mov dword[FxTablecA2+1Dh*4],FxOpc1D - mov dword[FxTablecA2+1Eh*4],FxOpc1E - mov dword[FxTablecA2+1Fh*4],FxOpc1F - mov dword[FxTablecA2+3Dh*4],FxOpc3D - mov dword[FxTablecA2+3Eh*4],FxOpc3E - mov dword[FxTablecA2+3Fh*4],FxOpc3F - mov dword[FxTablecA2+0B0h*4],FxOpcB0 - mov dword[FxTablecA2+0B1h*4],FxOpcB1 - mov dword[FxTablecA2+0B2h*4],FxOpcB2 - mov dword[FxTablecA2+0B3h*4],FxOpcB3 - mov dword[FxTablecA2+0B4h*4],FxOpcB4 - mov dword[FxTablecA2+0B5h*4],FxOpcB5 - mov dword[FxTablecA2+0B6h*4],FxOpcB6 - mov dword[FxTablecA2+0B7h*4],FxOpcB7 - mov dword[FxTablecA2+0B8h*4],FxOpcB8 - mov dword[FxTablecA2+0B9h*4],FxOpcB9 - mov dword[FxTablecA2+0BAh*4],FxOpcBA - mov dword[FxTablecA2+0BBh*4],FxOpcBB - mov dword[FxTablecA2+0BCh*4],FxOpcBC - mov dword[FxTablecA2+0BDh*4],FxOpcBD - mov dword[FxTablecA2+0BEh*4],FxOpcBE - mov dword[FxTablecA2+0BFh*4],FxOpcBF - - mov dword[FxTablecA3+05h*4],FxOpc05 - mov dword[FxTablecA3+06h*4],FxOpc06 - mov dword[FxTablecA3+07h*4],FxOpc07 - mov dword[FxTablecA3+08h*4],FxOpc08 - mov dword[FxTablecA3+09h*4],FxOpc09 - mov dword[FxTablecA3+0Ah*4],FxOpc0A - mov dword[FxTablecA3+0Bh*4],FxOpc0B - mov dword[FxTablecA3+0Ch*4],FxOpc0C - mov dword[FxTablecA3+0Dh*4],FxOpc0D - mov dword[FxTablecA3+0Eh*4],FxOpc0E - mov dword[FxTablecA3+0Fh*4],FxOpc0F - mov dword[FxTablecA3+10h*4],FxOpc10 - mov dword[FxTablecA3+11h*4],FxOpc11 - mov dword[FxTablecA3+12h*4],FxOpc12 - mov dword[FxTablecA3+13h*4],FxOpc13 - mov dword[FxTablecA3+14h*4],FxOpc14 - mov dword[FxTablecA3+15h*4],FxOpc15 - mov dword[FxTablecA3+16h*4],FxOpc16 - mov dword[FxTablecA3+17h*4],FxOpc17 - mov dword[FxTablecA3+18h*4],FxOpc18 - mov dword[FxTablecA3+19h*4],FxOpc19 - mov dword[FxTablecA3+1Ah*4],FxOpc1A - mov dword[FxTablecA3+1Bh*4],FxOpc1B - mov dword[FxTablecA3+1Ch*4],FxOpc1C - mov dword[FxTablecA3+1Dh*4],FxOpc1D - mov dword[FxTablecA3+1Eh*4],FxOpc1E - mov dword[FxTablecA3+1Fh*4],FxOpc1F - mov dword[FxTablecA3+3Dh*4],FxOpc3D - mov dword[FxTablecA3+3Eh*4],FxOpc3E - mov dword[FxTablecA3+3Fh*4],FxOpc3F - mov dword[FxTablecA3+0B0h*4],FxOpcB0 - mov dword[FxTablecA3+0B1h*4],FxOpcB1 - mov dword[FxTablecA3+0B2h*4],FxOpcB2 - mov dword[FxTablecA3+0B3h*4],FxOpcB3 - mov dword[FxTablecA3+0B4h*4],FxOpcB4 - mov dword[FxTablecA3+0B5h*4],FxOpcB5 - mov dword[FxTablecA3+0B6h*4],FxOpcB6 - mov dword[FxTablecA3+0B7h*4],FxOpcB7 - mov dword[FxTablecA3+0B8h*4],FxOpcB8 - mov dword[FxTablecA3+0B9h*4],FxOpcB9 - mov dword[FxTablecA3+0BAh*4],FxOpcBA - mov dword[FxTablecA3+0BBh*4],FxOpcBB - mov dword[FxTablecA3+0BCh*4],FxOpcBC - mov dword[FxTablecA3+0BDh*4],FxOpcBD - mov dword[FxTablecA3+0BEh*4],FxOpcBE - mov dword[FxTablecA3+0BFh*4],FxOpcBF - - mov dword[FxTabled+00h*4],FxOpd00 - mov dword[FxTabled+01h*4],FxOpd01 - mov dword[FxTabled+02h*4],FxOpd02 - mov dword[FxTabled+03h*4],FxOpd03 - mov dword[FxTabled+04h*4],FxOpd04 - mov dword[FxTabled+05h*4],FxOpd05 - mov dword[FxTabled+06h*4],FxOpd06 - mov dword[FxTabled+07h*4],FxOpd07 - mov dword[FxTabled+08h*4],FxOpd08 - mov dword[FxTabled+09h*4],FxOpd09 - mov dword[FxTabled+0Ah*4],FxOpd0A - mov dword[FxTabled+0Bh*4],FxOpd0B - mov dword[FxTabled+0Ch*4],FxOpd0C - mov dword[FxTabled+0Dh*4],FxOpd0D - mov dword[FxTabled+0Eh*4],FxOpd0E - mov dword[FxTabled+0Fh*4],FxOpd0F - - mov dword[FxTabled+10h*4],FxOpd10 - mov dword[FxTabled+11h*4],FxOpd11 - mov dword[FxTabled+12h*4],FxOpd12 - mov dword[FxTabled+13h*4],FxOpd13 - mov dword[FxTabled+14h*4],FxOpd14 - mov dword[FxTabled+15h*4],FxOpd15 - mov dword[FxTabled+16h*4],FxOpd16 - mov dword[FxTabled+17h*4],FxOpd17 - mov dword[FxTabled+18h*4],FxOpd18 - mov dword[FxTabled+19h*4],FxOpd19 - mov dword[FxTabled+1Ah*4],FxOpd1A - mov dword[FxTabled+1Bh*4],FxOpd1B - mov dword[FxTabled+1Ch*4],FxOpd1C - mov dword[FxTabled+1Dh*4],FxOpd1D - mov dword[FxTabled+1Eh*4],FxOpd1E - mov dword[FxTabled+1Fh*4],FxOpd1F - - mov dword[FxTabled+20h*4],FxOpd20 - mov dword[FxTabled+21h*4],FxOpd21 - mov dword[FxTabled+22h*4],FxOpd22 - mov dword[FxTabled+23h*4],FxOpd23 - mov dword[FxTabled+24h*4],FxOpd24 - mov dword[FxTabled+25h*4],FxOpd25 - mov dword[FxTabled+26h*4],FxOpd26 - mov dword[FxTabled+27h*4],FxOpd27 - mov dword[FxTabled+28h*4],FxOpd28 - mov dword[FxTabled+29h*4],FxOpd29 - mov dword[FxTabled+2Ah*4],FxOpd2A - mov dword[FxTabled+2Bh*4],FxOpd2B - mov dword[FxTabled+2Ch*4],FxOpd2C - mov dword[FxTabled+2Dh*4],FxOpd2D - mov dword[FxTabled+2Eh*4],FxOpd2E - mov dword[FxTabled+2Fh*4],FxOpd2F - - mov dword[FxTabled+30h*4],FxOpd30 - mov dword[FxTabled+31h*4],FxOpd31 - mov dword[FxTabled+32h*4],FxOpd32 - mov dword[FxTabled+33h*4],FxOpd33 - mov dword[FxTabled+34h*4],FxOpd34 - mov dword[FxTabled+35h*4],FxOpd35 - mov dword[FxTabled+36h*4],FxOpd36 - mov dword[FxTabled+37h*4],FxOpd37 - mov dword[FxTabled+38h*4],FxOpd38 - mov dword[FxTabled+39h*4],FxOpd39 - mov dword[FxTabled+3Ah*4],FxOpd3A - mov dword[FxTabled+3Bh*4],FxOpd3B - mov dword[FxTabled+3Ch*4],FxOpd3C - mov dword[FxTabled+3Dh*4],FxOpd3D - mov dword[FxTabled+3Eh*4],FxOpd3E - mov dword[FxTabled+3Fh*4],FxOpd3F - - mov dword[FxTabled+40h*4],FxOpd40 - mov dword[FxTabled+41h*4],FxOpd41 - mov dword[FxTabled+42h*4],FxOpd42 - mov dword[FxTabled+43h*4],FxOpd43 - mov dword[FxTabled+44h*4],FxOpd44 - mov dword[FxTabled+45h*4],FxOpd45 - mov dword[FxTabled+46h*4],FxOpd46 - mov dword[FxTabled+47h*4],FxOpd47 - mov dword[FxTabled+48h*4],FxOpd48 - mov dword[FxTabled+49h*4],FxOpd49 - mov dword[FxTabled+4Ah*4],FxOpd4A - mov dword[FxTabled+4Bh*4],FxOpd4B - mov dword[FxTabled+4Ch*4],FxOpd4C - mov dword[FxTabled+4Dh*4],FxOpd4D - mov dword[FxTabled+4Eh*4],FxOpd4E - mov dword[FxTabled+4Fh*4],FxOpd4F - - mov dword[FxTabled+50h*4],FxOpd50 - mov dword[FxTabled+51h*4],FxOpd51 - mov dword[FxTabled+52h*4],FxOpd52 - mov dword[FxTabled+53h*4],FxOpd53 - mov dword[FxTabled+54h*4],FxOpd54 - mov dword[FxTabled+55h*4],FxOpd55 - mov dword[FxTabled+56h*4],FxOpd56 - mov dword[FxTabled+57h*4],FxOpd57 - mov dword[FxTabled+58h*4],FxOpd58 - mov dword[FxTabled+59h*4],FxOpd59 - mov dword[FxTabled+5Ah*4],FxOpd5A - mov dword[FxTabled+5Bh*4],FxOpd5B - mov dword[FxTabled+5Ch*4],FxOpd5C - mov dword[FxTabled+5Dh*4],FxOpd5D - mov dword[FxTabled+5Eh*4],FxOpd5E - mov dword[FxTabled+5Fh*4],FxOpd5F - - mov dword[FxTabled+60h*4],FxOpd60 - mov dword[FxTabled+61h*4],FxOpd61 - mov dword[FxTabled+62h*4],FxOpd62 - mov dword[FxTabled+63h*4],FxOpd63 - mov dword[FxTabled+64h*4],FxOpd64 - mov dword[FxTabled+65h*4],FxOpd65 - mov dword[FxTabled+66h*4],FxOpd66 - mov dword[FxTabled+67h*4],FxOpd67 - mov dword[FxTabled+68h*4],FxOpd68 - mov dword[FxTabled+69h*4],FxOpd69 - mov dword[FxTabled+6Ah*4],FxOpd6A - mov dword[FxTabled+6Bh*4],FxOpd6B - mov dword[FxTabled+6Ch*4],FxOpd6C - mov dword[FxTabled+6Dh*4],FxOpd6D - mov dword[FxTabled+6Eh*4],FxOpd6E - mov dword[FxTabled+6Fh*4],FxOpd6F - - mov dword[FxTabled+70h*4],FxOpd70 - mov dword[FxTabled+71h*4],FxOpd71 - mov dword[FxTabled+72h*4],FxOpd72 - mov dword[FxTabled+73h*4],FxOpd73 - mov dword[FxTabled+74h*4],FxOpd74 - mov dword[FxTabled+75h*4],FxOpd75 - mov dword[FxTabled+76h*4],FxOpd76 - mov dword[FxTabled+77h*4],FxOpd77 - mov dword[FxTabled+78h*4],FxOpd78 - mov dword[FxTabled+79h*4],FxOpd79 - mov dword[FxTabled+7Ah*4],FxOpd7A - mov dword[FxTabled+7Bh*4],FxOpd7B - mov dword[FxTabled+7Ch*4],FxOpd7C - mov dword[FxTabled+7Dh*4],FxOpd7D - mov dword[FxTabled+7Eh*4],FxOpd7E - mov dword[FxTabled+7Fh*4],FxOpd7F - - mov dword[FxTabled+80h*4],FxOpd80 - mov dword[FxTabled+81h*4],FxOpd81 - mov dword[FxTabled+82h*4],FxOpd82 - mov dword[FxTabled+83h*4],FxOpd83 - mov dword[FxTabled+84h*4],FxOpd84 - mov dword[FxTabled+85h*4],FxOpd85 - mov dword[FxTabled+86h*4],FxOpd86 - mov dword[FxTabled+87h*4],FxOpd87 - mov dword[FxTabled+88h*4],FxOpd88 - mov dword[FxTabled+89h*4],FxOpd89 - mov dword[FxTabled+8Ah*4],FxOpd8A - mov dword[FxTabled+8Bh*4],FxOpd8B - mov dword[FxTabled+8Ch*4],FxOpd8C - mov dword[FxTabled+8Dh*4],FxOpd8D - mov dword[FxTabled+8Eh*4],FxOpd8E - mov dword[FxTabled+8Fh*4],FxOpd8F - - mov dword[FxTabled+90h*4],FxOpd90 - mov dword[FxTabled+91h*4],FxOpd91 - mov dword[FxTabled+92h*4],FxOpd92 - mov dword[FxTabled+93h*4],FxOpd93 - mov dword[FxTabled+94h*4],FxOpd94 - mov dword[FxTabled+95h*4],FxOpd95 - mov dword[FxTabled+96h*4],FxOpd96 - mov dword[FxTabled+97h*4],FxOpd97 - mov dword[FxTabled+98h*4],FxOpd98 - mov dword[FxTabled+99h*4],FxOpd99 - mov dword[FxTabled+9Ah*4],FxOpd9A - mov dword[FxTabled+9Bh*4],FxOpd9B - mov dword[FxTabled+9Ch*4],FxOpd9C - mov dword[FxTabled+9Dh*4],FxOpd9D - mov dword[FxTabled+9Eh*4],FxOpd9E - mov dword[FxTabled+9Fh*4],FxOpd9F - - mov dword[FxTabled+0A0h*4],FxOpdA0 - mov dword[FxTabled+0A1h*4],FxOpdA1 - mov dword[FxTabled+0A2h*4],FxOpdA2 - mov dword[FxTabled+0A3h*4],FxOpdA3 - mov dword[FxTabled+0A4h*4],FxOpdA4 - mov dword[FxTabled+0A5h*4],FxOpdA5 - mov dword[FxTabled+0A6h*4],FxOpdA6 - mov dword[FxTabled+0A7h*4],FxOpdA7 - mov dword[FxTabled+0A8h*4],FxOpdA8 - mov dword[FxTabled+0A9h*4],FxOpdA9 - mov dword[FxTabled+0AAh*4],FxOpdAA - mov dword[FxTabled+0ABh*4],FxOpdAB - mov dword[FxTabled+0ACh*4],FxOpdAC - mov dword[FxTabled+0ADh*4],FxOpdAD - mov dword[FxTabled+0AEh*4],FxOpdAE - mov dword[FxTabled+0AFh*4],FxOpdAF - - mov dword[FxTabled+0B0h*4],FxOpdB0 - mov dword[FxTabled+0B1h*4],FxOpdB1 - mov dword[FxTabled+0B2h*4],FxOpdB2 - mov dword[FxTabled+0B3h*4],FxOpdB3 - mov dword[FxTabled+0B4h*4],FxOpdB4 - mov dword[FxTabled+0B5h*4],FxOpdB5 - mov dword[FxTabled+0B6h*4],FxOpdB6 - mov dword[FxTabled+0B7h*4],FxOpdB7 - mov dword[FxTabled+0B8h*4],FxOpdB8 - mov dword[FxTabled+0B9h*4],FxOpdB9 - mov dword[FxTabled+0BAh*4],FxOpdBA - mov dword[FxTabled+0BBh*4],FxOpdBB - mov dword[FxTabled+0BCh*4],FxOpdBC - mov dword[FxTabled+0BDh*4],FxOpdBD - mov dword[FxTabled+0BEh*4],FxOpdBE - mov dword[FxTabled+0BFh*4],FxOpdBF - - mov dword[FxTabled+0C0h*4],FxOpdC0 - mov dword[FxTabled+0C1h*4],FxOpdC1 - mov dword[FxTabled+0C2h*4],FxOpdC2 - mov dword[FxTabled+0C3h*4],FxOpdC3 - mov dword[FxTabled+0C4h*4],FxOpdC4 - mov dword[FxTabled+0C5h*4],FxOpdC5 - mov dword[FxTabled+0C6h*4],FxOpdC6 - mov dword[FxTabled+0C7h*4],FxOpdC7 - mov dword[FxTabled+0C8h*4],FxOpdC8 - mov dword[FxTabled+0C9h*4],FxOpdC9 - mov dword[FxTabled+0CAh*4],FxOpdCA - mov dword[FxTabled+0CBh*4],FxOpdCB - mov dword[FxTabled+0CCh*4],FxOpdCC - mov dword[FxTabled+0CDh*4],FxOpdCD - mov dword[FxTabled+0CEh*4],FxOpdCE - mov dword[FxTabled+0CFh*4],FxOpdCF - - mov dword[FxTabled+0D0h*4],FxOpdD0 - mov dword[FxTabled+0D1h*4],FxOpdD1 - mov dword[FxTabled+0D2h*4],FxOpdD2 - mov dword[FxTabled+0D3h*4],FxOpdD3 - mov dword[FxTabled+0D4h*4],FxOpdD4 - mov dword[FxTabled+0D5h*4],FxOpdD5 - mov dword[FxTabled+0D6h*4],FxOpdD6 - mov dword[FxTabled+0D7h*4],FxOpdD7 - mov dword[FxTabled+0D8h*4],FxOpdD8 - mov dword[FxTabled+0D9h*4],FxOpdD9 - mov dword[FxTabled+0DAh*4],FxOpdDA - mov dword[FxTabled+0DBh*4],FxOpdDB - mov dword[FxTabled+0DCh*4],FxOpdDC - mov dword[FxTabled+0DDh*4],FxOpdDD - mov dword[FxTabled+0DEh*4],FxOpdDE - mov dword[FxTabled+0DFh*4],FxOpdDF - - mov dword[FxTabled+0E0h*4],FxOpdE0 - mov dword[FxTabled+0E1h*4],FxOpdE1 - mov dword[FxTabled+0E2h*4],FxOpdE2 - mov dword[FxTabled+0E3h*4],FxOpdE3 - mov dword[FxTabled+0E4h*4],FxOpdE4 - mov dword[FxTabled+0E5h*4],FxOpdE5 - mov dword[FxTabled+0E6h*4],FxOpdE6 - mov dword[FxTabled+0E7h*4],FxOpdE7 - mov dword[FxTabled+0E8h*4],FxOpdE8 - mov dword[FxTabled+0E9h*4],FxOpdE9 - mov dword[FxTabled+0EAh*4],FxOpdEA - mov dword[FxTabled+0EBh*4],FxOpdEB - mov dword[FxTabled+0ECh*4],FxOpdEC - mov dword[FxTabled+0EDh*4],FxOpdED - mov dword[FxTabled+0EEh*4],FxOpdEE - mov dword[FxTabled+0EFh*4],FxOpdEF - - mov dword[FxTabled+0F0h*4],FxOpdF0 - mov dword[FxTabled+0F1h*4],FxOpdF1 - mov dword[FxTabled+0F2h*4],FxOpdF2 - mov dword[FxTabled+0F3h*4],FxOpdF3 - mov dword[FxTabled+0F4h*4],FxOpdF4 - mov dword[FxTabled+0F5h*4],FxOpdF5 - mov dword[FxTabled+0F6h*4],FxOpdF6 - mov dword[FxTabled+0F7h*4],FxOpdF7 - mov dword[FxTabled+0F8h*4],FxOpdF8 - mov dword[FxTabled+0F9h*4],FxOpdF9 - mov dword[FxTabled+0FAh*4],FxOpdFA - mov dword[FxTabled+0FBh*4],FxOpdFB - mov dword[FxTabled+0FCh*4],FxOpdFC - mov dword[FxTabled+0FDh*4],FxOpdFD - mov dword[FxTabled+0FEh*4],FxOpdFE - mov dword[FxTabled+0FFh*4],FxOpdFF - - - mov dword[FxTabledA1+00h*4],FxOpd00 - mov dword[FxTabledA1+01h*4],FxOpd01 - mov dword[FxTabledA1+02h*4],FxOpd02 - mov dword[FxTabledA1+03h*4],FxOpd03 - mov dword[FxTabledA1+04h*4],FxOpd04 - mov dword[FxTabledA1+05h*4],FxOpd05 - mov dword[FxTabledA1+06h*4],FxOpd06 - mov dword[FxTabledA1+07h*4],FxOpd07 - mov dword[FxTabledA1+08h*4],FxOpd08 - mov dword[FxTabledA1+09h*4],FxOpd09 - mov dword[FxTabledA1+0Ah*4],FxOpd0A - mov dword[FxTabledA1+0Bh*4],FxOpd0B - mov dword[FxTabledA1+0Ch*4],FxOpd0C - mov dword[FxTabledA1+0Dh*4],FxOpd0D - mov dword[FxTabledA1+0Eh*4],FxOpd0E - mov dword[FxTabledA1+0Fh*4],FxOpd0F - - mov dword[FxTabledA1+10h*4],FxOpd10 - mov dword[FxTabledA1+11h*4],FxOpd11 - mov dword[FxTabledA1+12h*4],FxOpd12 - mov dword[FxTabledA1+13h*4],FxOpd13 - mov dword[FxTabledA1+14h*4],FxOpd14 - mov dword[FxTabledA1+15h*4],FxOpd15 - mov dword[FxTabledA1+16h*4],FxOpd16 - mov dword[FxTabledA1+17h*4],FxOpd17 - mov dword[FxTabledA1+18h*4],FxOpd18 - mov dword[FxTabledA1+19h*4],FxOpd19 - mov dword[FxTabledA1+1Ah*4],FxOpd1A - mov dword[FxTabledA1+1Bh*4],FxOpd1B - mov dword[FxTabledA1+1Ch*4],FxOpd1C - mov dword[FxTabledA1+1Dh*4],FxOpd1D - mov dword[FxTabledA1+1Eh*4],FxOpd1E - mov dword[FxTabledA1+1Fh*4],FxOpd1F - - mov dword[FxTabledA1+20h*4],FxOpd20 - mov dword[FxTabledA1+21h*4],FxOpd21 - mov dword[FxTabledA1+22h*4],FxOpd22 - mov dword[FxTabledA1+23h*4],FxOpd23 - mov dword[FxTabledA1+24h*4],FxOpd24 - mov dword[FxTabledA1+25h*4],FxOpd25 - mov dword[FxTabledA1+26h*4],FxOpd26 - mov dword[FxTabledA1+27h*4],FxOpd27 - mov dword[FxTabledA1+28h*4],FxOpd28 - mov dword[FxTabledA1+29h*4],FxOpd29 - mov dword[FxTabledA1+2Ah*4],FxOpd2A - mov dword[FxTabledA1+2Bh*4],FxOpd2B - mov dword[FxTabledA1+2Ch*4],FxOpd2C - mov dword[FxTabledA1+2Dh*4],FxOpd2D - mov dword[FxTabledA1+2Eh*4],FxOpd2E - mov dword[FxTabledA1+2Fh*4],FxOpd2F - - mov dword[FxTabledA1+30h*4],FxOpd30A1 - mov dword[FxTabledA1+31h*4],FxOpd31A1 - mov dword[FxTabledA1+32h*4],FxOpd32A1 - mov dword[FxTabledA1+33h*4],FxOpd33A1 - mov dword[FxTabledA1+34h*4],FxOpd34A1 - mov dword[FxTabledA1+35h*4],FxOpd35A1 - mov dword[FxTabledA1+36h*4],FxOpd36A1 - mov dword[FxTabledA1+37h*4],FxOpd37A1 - mov dword[FxTabledA1+38h*4],FxOpd38A1 - mov dword[FxTabledA1+39h*4],FxOpd39A1 - mov dword[FxTabledA1+3Ah*4],FxOpd3AA1 - mov dword[FxTabledA1+3Bh*4],FxOpd3BA1 - mov dword[FxTabledA1+3Ch*4],FxOpd3C - mov dword[FxTabledA1+3Dh*4],FxOpd3D - mov dword[FxTabledA1+3Eh*4],FxOpd3E - mov dword[FxTabledA1+3Fh*4],FxOpd3F - - mov dword[FxTabledA1+40h*4],FxOpd40A1 - mov dword[FxTabledA1+41h*4],FxOpd41A1 - mov dword[FxTabledA1+42h*4],FxOpd42A1 - mov dword[FxTabledA1+43h*4],FxOpd43A1 - mov dword[FxTabledA1+44h*4],FxOpd44A1 - mov dword[FxTabledA1+45h*4],FxOpd45A1 - mov dword[FxTabledA1+46h*4],FxOpd46A1 - mov dword[FxTabledA1+47h*4],FxOpd47A1 - mov dword[FxTabledA1+48h*4],FxOpd48A1 - mov dword[FxTabledA1+49h*4],FxOpd49A1 - mov dword[FxTabledA1+4Ah*4],FxOpd4AA1 - mov dword[FxTabledA1+4Bh*4],FxOpd4BA1 - mov dword[FxTabledA1+4Ch*4],FxOpd4CA1 - mov dword[FxTabledA1+4Dh*4],FxOpd4D - mov dword[FxTabledA1+4Eh*4],FxOpd4EA1 - mov dword[FxTabledA1+4Fh*4],FxOpd4F - - mov dword[FxTabledA1+50h*4],FxOpd50A1 - mov dword[FxTabledA1+51h*4],FxOpd51A1 - mov dword[FxTabledA1+52h*4],FxOpd52A1 - mov dword[FxTabledA1+53h*4],FxOpd53A1 - mov dword[FxTabledA1+54h*4],FxOpd54A1 - mov dword[FxTabledA1+55h*4],FxOpd55A1 - mov dword[FxTabledA1+56h*4],FxOpd56A1 - mov dword[FxTabledA1+57h*4],FxOpd57A1 - mov dword[FxTabledA1+58h*4],FxOpd58A1 - mov dword[FxTabledA1+59h*4],FxOpd59A1 - mov dword[FxTabledA1+5Ah*4],FxOpd5AA1 - mov dword[FxTabledA1+5Bh*4],FxOpd5BA1 - mov dword[FxTabledA1+5Ch*4],FxOpd5CA1 - mov dword[FxTabledA1+5Dh*4],FxOpd5DA1 - mov dword[FxTabledA1+5Eh*4],FxOpd5EA1 - mov dword[FxTabledA1+5Fh*4],FxOpd5FA1 - - mov dword[FxTabledA1+60h*4],FxOpd60A1 - mov dword[FxTabledA1+61h*4],FxOpd61A1 - mov dword[FxTabledA1+62h*4],FxOpd62A1 - mov dword[FxTabledA1+63h*4],FxOpd63A1 - mov dword[FxTabledA1+64h*4],FxOpd64A1 - mov dword[FxTabledA1+65h*4],FxOpd65A1 - mov dword[FxTabledA1+66h*4],FxOpd66A1 - mov dword[FxTabledA1+67h*4],FxOpd67A1 - mov dword[FxTabledA1+68h*4],FxOpd68A1 - mov dword[FxTabledA1+69h*4],FxOpd69A1 - mov dword[FxTabledA1+6Ah*4],FxOpd6AA1 - mov dword[FxTabledA1+6Bh*4],FxOpd6BA1 - mov dword[FxTabledA1+6Ch*4],FxOpd6CA1 - mov dword[FxTabledA1+6Dh*4],FxOpd6DA1 - mov dword[FxTabledA1+6Eh*4],FxOpd6EA1 - mov dword[FxTabledA1+6Fh*4],FxOpd6FA1 - - mov dword[FxTabledA1+70h*4],FxOpd70 - mov dword[FxTabledA1+71h*4],FxOpd71A1 - mov dword[FxTabledA1+72h*4],FxOpd72A1 - mov dword[FxTabledA1+73h*4],FxOpd73A1 - mov dword[FxTabledA1+74h*4],FxOpd74A1 - mov dword[FxTabledA1+75h*4],FxOpd75A1 - mov dword[FxTabledA1+76h*4],FxOpd76A1 - mov dword[FxTabledA1+77h*4],FxOpd77A1 - mov dword[FxTabledA1+78h*4],FxOpd78A1 - mov dword[FxTabledA1+79h*4],FxOpd79A1 - mov dword[FxTabledA1+7Ah*4],FxOpd7AA1 - mov dword[FxTabledA1+7Bh*4],FxOpd7BA1 - mov dword[FxTabledA1+7Ch*4],FxOpd7CA1 - mov dword[FxTabledA1+7Dh*4],FxOpd7DA1 - mov dword[FxTabledA1+7Eh*4],FxOpd7EA1 - mov dword[FxTabledA1+7Fh*4],FxOpd7FA1 - - mov dword[FxTabledA1+80h*4],FxOpd80A1 - mov dword[FxTabledA1+81h*4],FxOpd81A1 - mov dword[FxTabledA1+82h*4],FxOpd82A1 - mov dword[FxTabledA1+83h*4],FxOpd83A1 - mov dword[FxTabledA1+84h*4],FxOpd84A1 - mov dword[FxTabledA1+85h*4],FxOpd85A1 - mov dword[FxTabledA1+86h*4],FxOpd86A1 - mov dword[FxTabledA1+87h*4],FxOpd87A1 - mov dword[FxTabledA1+88h*4],FxOpd88A1 - mov dword[FxTabledA1+89h*4],FxOpd89A1 - mov dword[FxTabledA1+8Ah*4],FxOpd8AA1 - mov dword[FxTabledA1+8Bh*4],FxOpd8BA1 - mov dword[FxTabledA1+8Ch*4],FxOpd8CA1 - mov dword[FxTabledA1+8Dh*4],FxOpd8DA1 - mov dword[FxTabledA1+8Eh*4],FxOpd8EA1 - mov dword[FxTabledA1+8Fh*4],FxOpd8FA1 - - mov dword[FxTabledA1+90h*4],FxOpd90 - mov dword[FxTabledA1+91h*4],FxOpd91 - mov dword[FxTabledA1+92h*4],FxOpd92 - mov dword[FxTabledA1+93h*4],FxOpd93 - mov dword[FxTabledA1+94h*4],FxOpd94 - mov dword[FxTabledA1+95h*4],FxOpd95 - mov dword[FxTabledA1+96h*4],FxOpd96A1 - mov dword[FxTabledA1+97h*4],FxOpd97 - mov dword[FxTabledA1+98h*4],FxOpd98A1 - mov dword[FxTabledA1+99h*4],FxOpd99A1 - mov dword[FxTabledA1+9Ah*4],FxOpd9AA1 - mov dword[FxTabledA1+9Bh*4],FxOpd9BA1 - mov dword[FxTabledA1+9Ch*4],FxOpd9CA1 - mov dword[FxTabledA1+9Dh*4],FxOpd9DA1 - mov dword[FxTabledA1+9Eh*4],FxOpd9E - mov dword[FxTabledA1+9Fh*4],FxOpd9FA1 - - mov dword[FxTabledA1+0A0h*4],FxOpdA0A1 - mov dword[FxTabledA1+0A1h*4],FxOpdA1A1 - mov dword[FxTabledA1+0A2h*4],FxOpdA2A1 - mov dword[FxTabledA1+0A3h*4],FxOpdA3A1 - mov dword[FxTabledA1+0A4h*4],FxOpdA4A1 - mov dword[FxTabledA1+0A5h*4],FxOpdA5A1 - mov dword[FxTabledA1+0A6h*4],FxOpdA6A1 - mov dword[FxTabledA1+0A7h*4],FxOpdA7A1 - mov dword[FxTabledA1+0A8h*4],FxOpdA8A1 - mov dword[FxTabledA1+0A9h*4],FxOpdA9A1 - mov dword[FxTabledA1+0AAh*4],FxOpdAAA1 - mov dword[FxTabledA1+0ABh*4],FxOpdABA1 - mov dword[FxTabledA1+0ACh*4],FxOpdACA1 - mov dword[FxTabledA1+0ADh*4],FxOpdADA1 - mov dword[FxTabledA1+0AEh*4],FxOpdAEA1 - mov dword[FxTabledA1+0AFh*4],FxOpdAFA1 - - mov dword[FxTabledA1+0B0h*4],FxOpdB0 - mov dword[FxTabledA1+0B1h*4],FxOpdB1 - mov dword[FxTabledA1+0B2h*4],FxOpdB2 - mov dword[FxTabledA1+0B3h*4],FxOpdB3 - mov dword[FxTabledA1+0B4h*4],FxOpdB4 - mov dword[FxTabledA1+0B5h*4],FxOpdB5 - mov dword[FxTabledA1+0B6h*4],FxOpdB6 - mov dword[FxTabledA1+0B7h*4],FxOpdB7 - mov dword[FxTabledA1+0B8h*4],FxOpdB8 - mov dword[FxTabledA1+0B9h*4],FxOpdB9 - mov dword[FxTabledA1+0BAh*4],FxOpdBA - mov dword[FxTabledA1+0BBh*4],FxOpdBB - mov dword[FxTabledA1+0BCh*4],FxOpdBC - mov dword[FxTabledA1+0BDh*4],FxOpdBD - mov dword[FxTabledA1+0BEh*4],FxOpdBE - mov dword[FxTabledA1+0BFh*4],FxOpdBF - - mov dword[FxTabledA1+0C0h*4],FxOpdC0 - mov dword[FxTabledA1+0C1h*4],FxOpdC1A1 - mov dword[FxTabledA1+0C2h*4],FxOpdC2A1 - mov dword[FxTabledA1+0C3h*4],FxOpdC3A1 - mov dword[FxTabledA1+0C4h*4],FxOpdC4A1 - mov dword[FxTabledA1+0C5h*4],FxOpdC5A1 - mov dword[FxTabledA1+0C6h*4],FxOpdC6A1 - mov dword[FxTabledA1+0C7h*4],FxOpdC7A1 - mov dword[FxTabledA1+0C8h*4],FxOpdC8A1 - mov dword[FxTabledA1+0C9h*4],FxOpdC9A1 - mov dword[FxTabledA1+0CAh*4],FxOpdCAA1 - mov dword[FxTabledA1+0CBh*4],FxOpdCBA1 - mov dword[FxTabledA1+0CCh*4],FxOpdCCA1 - mov dword[FxTabledA1+0CDh*4],FxOpdCDA1 - mov dword[FxTabledA1+0CEh*4],FxOpdCEA1 - mov dword[FxTabledA1+0CFh*4],FxOpdCFA1 - - mov dword[FxTabledA1+0D0h*4],FxOpdD0 - mov dword[FxTabledA1+0D1h*4],FxOpdD1 - mov dword[FxTabledA1+0D2h*4],FxOpdD2 - mov dword[FxTabledA1+0D3h*4],FxOpdD3 - mov dword[FxTabledA1+0D4h*4],FxOpdD4 - mov dword[FxTabledA1+0D5h*4],FxOpdD5 - mov dword[FxTabledA1+0D6h*4],FxOpdD6 - mov dword[FxTabledA1+0D7h*4],FxOpdD7 - mov dword[FxTabledA1+0D8h*4],FxOpdD8 - mov dword[FxTabledA1+0D9h*4],FxOpdD9 - mov dword[FxTabledA1+0DAh*4],FxOpdDA - mov dword[FxTabledA1+0DBh*4],FxOpdDB - mov dword[FxTabledA1+0DCh*4],FxOpdDC - mov dword[FxTabledA1+0DDh*4],FxOpdDD - mov dword[FxTabledA1+0DEh*4],FxOpdDE - mov dword[FxTabledA1+0DFh*4],FxOpdDF - - mov dword[FxTabledA1+0E0h*4],FxOpdE0 - mov dword[FxTabledA1+0E1h*4],FxOpdE1 - mov dword[FxTabledA1+0E2h*4],FxOpdE2 - mov dword[FxTabledA1+0E3h*4],FxOpdE3 - mov dword[FxTabledA1+0E4h*4],FxOpdE4 - mov dword[FxTabledA1+0E5h*4],FxOpdE5 - mov dword[FxTabledA1+0E6h*4],FxOpdE6 - mov dword[FxTabledA1+0E7h*4],FxOpdE7 - mov dword[FxTabledA1+0E8h*4],FxOpdE8 - mov dword[FxTabledA1+0E9h*4],FxOpdE9 - mov dword[FxTabledA1+0EAh*4],FxOpdEA - mov dword[FxTabledA1+0EBh*4],FxOpdEB - mov dword[FxTabledA1+0ECh*4],FxOpdEC - mov dword[FxTabledA1+0EDh*4],FxOpdED - mov dword[FxTabledA1+0EEh*4],FxOpdEE - mov dword[FxTabledA1+0EFh*4],FxOpdEFA1 - - mov dword[FxTabledA1+0F0h*4],FxOpdF0A1 - mov dword[FxTabledA1+0F1h*4],FxOpdF1A1 - mov dword[FxTabledA1+0F2h*4],FxOpdF2A1 - mov dword[FxTabledA1+0F3h*4],FxOpdF3A1 - mov dword[FxTabledA1+0F4h*4],FxOpdF4A1 - mov dword[FxTabledA1+0F5h*4],FxOpdF5A1 - mov dword[FxTabledA1+0F6h*4],FxOpdF6A1 - mov dword[FxTabledA1+0F7h*4],FxOpdF7A1 - mov dword[FxTabledA1+0F8h*4],FxOpdF8A1 - mov dword[FxTabledA1+0F9h*4],FxOpdF9A1 - mov dword[FxTabledA1+0FAh*4],FxOpdFAA1 - mov dword[FxTabledA1+0FBh*4],FxOpdFBA1 - mov dword[FxTabledA1+0FCh*4],FxOpdFCA1 - mov dword[FxTabledA1+0FDh*4],FxOpdFDA1 - mov dword[FxTabledA1+0FEh*4],FxOpdFEA1 - mov dword[FxTabledA1+0FFh*4],FxOpdFFA1 - - - mov dword[FxTabledA2+00h*4],FxOpd00 - mov dword[FxTabledA2+01h*4],FxOpd01 - mov dword[FxTabledA2+02h*4],FxOpd02 - mov dword[FxTabledA2+03h*4],FxOpd03 - mov dword[FxTabledA2+04h*4],FxOpd04 - mov dword[FxTabledA2+05h*4],FxOpd05 - mov dword[FxTabledA2+06h*4],FxOpd06 - mov dword[FxTabledA2+07h*4],FxOpd07 - mov dword[FxTabledA2+08h*4],FxOpd08 - mov dword[FxTabledA2+09h*4],FxOpd09 - mov dword[FxTabledA2+0Ah*4],FxOpd0A - mov dword[FxTabledA2+0Bh*4],FxOpd0B - mov dword[FxTabledA2+0Ch*4],FxOpd0C - mov dword[FxTabledA2+0Dh*4],FxOpd0D - mov dword[FxTabledA2+0Eh*4],FxOpd0E - mov dword[FxTabledA2+0Fh*4],FxOpd0F - - mov dword[FxTabledA2+10h*4],FxOpd10 - mov dword[FxTabledA2+11h*4],FxOpd11 - mov dword[FxTabledA2+12h*4],FxOpd12 - mov dword[FxTabledA2+13h*4],FxOpd13 - mov dword[FxTabledA2+14h*4],FxOpd14 - mov dword[FxTabledA2+15h*4],FxOpd15 - mov dword[FxTabledA2+16h*4],FxOpd16 - mov dword[FxTabledA2+17h*4],FxOpd17 - mov dword[FxTabledA2+18h*4],FxOpd18 - mov dword[FxTabledA2+19h*4],FxOpd19 - mov dword[FxTabledA2+1Ah*4],FxOpd1A - mov dword[FxTabledA2+1Bh*4],FxOpd1B - mov dword[FxTabledA2+1Ch*4],FxOpd1C - mov dword[FxTabledA2+1Dh*4],FxOpd1D - mov dword[FxTabledA2+1Eh*4],FxOpd1E - mov dword[FxTabledA2+1Fh*4],FxOpd1F - - mov dword[FxTabledA2+20h*4],FxOpd20 - mov dword[FxTabledA2+21h*4],FxOpd21 - mov dword[FxTabledA2+22h*4],FxOpd22 - mov dword[FxTabledA2+23h*4],FxOpd23 - mov dword[FxTabledA2+24h*4],FxOpd24 - mov dword[FxTabledA2+25h*4],FxOpd25 - mov dword[FxTabledA2+26h*4],FxOpd26 - mov dword[FxTabledA2+27h*4],FxOpd27 - mov dword[FxTabledA2+28h*4],FxOpd28 - mov dword[FxTabledA2+29h*4],FxOpd29 - mov dword[FxTabledA2+2Ah*4],FxOpd2A - mov dword[FxTabledA2+2Bh*4],FxOpd2B - mov dword[FxTabledA2+2Ch*4],FxOpd2C - mov dword[FxTabledA2+2Dh*4],FxOpd2D - mov dword[FxTabledA2+2Eh*4],FxOpd2E - mov dword[FxTabledA2+2Fh*4],FxOpd2F - - mov dword[FxTabledA2+30h*4],FxOpd30 - mov dword[FxTabledA2+31h*4],FxOpd31 - mov dword[FxTabledA2+32h*4],FxOpd32 - mov dword[FxTabledA2+33h*4],FxOpd33 - mov dword[FxTabledA2+34h*4],FxOpd34 - mov dword[FxTabledA2+35h*4],FxOpd35 - mov dword[FxTabledA2+36h*4],FxOpd36 - mov dword[FxTabledA2+37h*4],FxOpd37 - mov dword[FxTabledA2+38h*4],FxOpd38 - mov dword[FxTabledA2+39h*4],FxOpd39 - mov dword[FxTabledA2+3Ah*4],FxOpd3A - mov dword[FxTabledA2+3Bh*4],FxOpd3B - mov dword[FxTabledA2+3Ch*4],FxOpd3C - mov dword[FxTabledA2+3Dh*4],FxOpd3D - mov dword[FxTabledA2+3Eh*4],FxOpd3E - mov dword[FxTabledA2+3Fh*4],FxOpd3F - - mov dword[FxTabledA2+40h*4],FxOpd40 - mov dword[FxTabledA2+41h*4],FxOpd41 - mov dword[FxTabledA2+42h*4],FxOpd42 - mov dword[FxTabledA2+43h*4],FxOpd43 - mov dword[FxTabledA2+44h*4],FxOpd44 - mov dword[FxTabledA2+45h*4],FxOpd45 - mov dword[FxTabledA2+46h*4],FxOpd46 - mov dword[FxTabledA2+47h*4],FxOpd47 - mov dword[FxTabledA2+48h*4],FxOpd48 - mov dword[FxTabledA2+49h*4],FxOpd49 - mov dword[FxTabledA2+4Ah*4],FxOpd4A - mov dword[FxTabledA2+4Bh*4],FxOpd4B - mov dword[FxTabledA2+4Ch*4],FxOpd4C - mov dword[FxTabledA2+4Dh*4],FxOpd4D - mov dword[FxTabledA2+4Eh*4],FxOpd4E - mov dword[FxTabledA2+4Fh*4],FxOpd4F - - mov dword[FxTabledA2+50h*4],FxOpd50A2 - mov dword[FxTabledA2+51h*4],FxOpd51A2 - mov dword[FxTabledA2+52h*4],FxOpd52A2 - mov dword[FxTabledA2+53h*4],FxOpd53A2 - mov dword[FxTabledA2+54h*4],FxOpd54A2 - mov dword[FxTabledA2+55h*4],FxOpd55A2 - mov dword[FxTabledA2+56h*4],FxOpd56A2 - mov dword[FxTabledA2+57h*4],FxOpd57A2 - mov dword[FxTabledA2+58h*4],FxOpd58A2 - mov dword[FxTabledA2+59h*4],FxOpd59A2 - mov dword[FxTabledA2+5Ah*4],FxOpd5AA2 - mov dword[FxTabledA2+5Bh*4],FxOpd5BA2 - mov dword[FxTabledA2+5Ch*4],FxOpd5CA2 - mov dword[FxTabledA2+5Dh*4],FxOpd5DA2 - mov dword[FxTabledA2+5Eh*4],FxOpd5EA2 - mov dword[FxTabledA2+5Fh*4],FxOpd5FA2 - - mov dword[FxTabledA2+60h*4],FxOpd60A2 - mov dword[FxTabledA2+61h*4],FxOpd61A2 - mov dword[FxTabledA2+62h*4],FxOpd62A2 - mov dword[FxTabledA2+63h*4],FxOpd63A2 - mov dword[FxTabledA2+64h*4],FxOpd64A2 - mov dword[FxTabledA2+65h*4],FxOpd65A2 - mov dword[FxTabledA2+66h*4],FxOpd66A2 - mov dword[FxTabledA2+67h*4],FxOpd67A2 - mov dword[FxTabledA2+68h*4],FxOpd68A2 - mov dword[FxTabledA2+69h*4],FxOpd69A2 - mov dword[FxTabledA2+6Ah*4],FxOpd6AA2 - mov dword[FxTabledA2+6Bh*4],FxOpd6BA2 - mov dword[FxTabledA2+6Ch*4],FxOpd6CA2 - mov dword[FxTabledA2+6Dh*4],FxOpd6DA2 - mov dword[FxTabledA2+6Eh*4],FxOpd6EA2 - mov dword[FxTabledA2+6Fh*4],FxOpd6FA2 - - mov dword[FxTabledA2+70h*4],FxOpd70 - mov dword[FxTabledA2+71h*4],FxOpd71A2 - mov dword[FxTabledA2+72h*4],FxOpd72A2 - mov dword[FxTabledA2+73h*4],FxOpd73A2 - mov dword[FxTabledA2+74h*4],FxOpd74A2 - mov dword[FxTabledA2+75h*4],FxOpd75A2 - mov dword[FxTabledA2+76h*4],FxOpd76A2 - mov dword[FxTabledA2+77h*4],FxOpd77A2 - mov dword[FxTabledA2+78h*4],FxOpd78A2 - mov dword[FxTabledA2+79h*4],FxOpd79A2 - mov dword[FxTabledA2+7Ah*4],FxOpd7AA2 - mov dword[FxTabledA2+7Bh*4],FxOpd7BA2 - mov dword[FxTabledA2+7Ch*4],FxOpd7CA2 - mov dword[FxTabledA2+7Dh*4],FxOpd7DA2 - mov dword[FxTabledA2+7Eh*4],FxOpd7EA2 - mov dword[FxTabledA2+7Fh*4],FxOpd7FA2 - - mov dword[FxTabledA2+80h*4],FxOpd80A2 - mov dword[FxTabledA2+81h*4],FxOpd81A2 - mov dword[FxTabledA2+82h*4],FxOpd82A2 - mov dword[FxTabledA2+83h*4],FxOpd83A2 - mov dword[FxTabledA2+84h*4],FxOpd84A2 - mov dword[FxTabledA2+85h*4],FxOpd85A2 - mov dword[FxTabledA2+86h*4],FxOpd86A2 - mov dword[FxTabledA2+87h*4],FxOpd87A2 - mov dword[FxTabledA2+88h*4],FxOpd88A2 - mov dword[FxTabledA2+89h*4],FxOpd89A2 - mov dword[FxTabledA2+8Ah*4],FxOpd8AA2 - mov dword[FxTabledA2+8Bh*4],FxOpd8BA2 - mov dword[FxTabledA2+8Ch*4],FxOpd8CA2 - mov dword[FxTabledA2+8Dh*4],FxOpd8DA2 - mov dword[FxTabledA2+8Eh*4],FxOpd8EA2 - mov dword[FxTabledA2+8Fh*4],FxOpd8FA2 - - mov dword[FxTabledA2+90h*4],FxOpd90 - mov dword[FxTabledA2+91h*4],FxOpd91 - mov dword[FxTabledA2+92h*4],FxOpd92 - mov dword[FxTabledA2+93h*4],FxOpd93 - mov dword[FxTabledA2+94h*4],FxOpd94 - mov dword[FxTabledA2+95h*4],FxOpd95 - mov dword[FxTabledA2+96h*4],FxOpd96 - mov dword[FxTabledA2+97h*4],FxOpd97 - mov dword[FxTabledA2+98h*4],FxOpd98 - mov dword[FxTabledA2+99h*4],FxOpd99 - mov dword[FxTabledA2+9Ah*4],FxOpd9A - mov dword[FxTabledA2+9Bh*4],FxOpd9B - mov dword[FxTabledA2+9Ch*4],FxOpd9C - mov dword[FxTabledA2+9Dh*4],FxOpd9D - mov dword[FxTabledA2+9Eh*4],FxOpd9E - mov dword[FxTabledA2+9Fh*4],FxOpd9F - - mov dword[FxTabledA2+0A0h*4],FxOpdA0A2 - mov dword[FxTabledA2+0A1h*4],FxOpdA1A2 - mov dword[FxTabledA2+0A2h*4],FxOpdA2A2 - mov dword[FxTabledA2+0A3h*4],FxOpdA3A2 - mov dword[FxTabledA2+0A4h*4],FxOpdA4A2 - mov dword[FxTabledA2+0A5h*4],FxOpdA5A2 - mov dword[FxTabledA2+0A6h*4],FxOpdA6A2 - mov dword[FxTabledA2+0A7h*4],FxOpdA7A2 - mov dword[FxTabledA2+0A8h*4],FxOpdA8A2 - mov dword[FxTabledA2+0A9h*4],FxOpdA9A2 - mov dword[FxTabledA2+0AAh*4],FxOpdAAA2 - mov dword[FxTabledA2+0ABh*4],FxOpdABA2 - mov dword[FxTabledA2+0ACh*4],FxOpdACA2 - mov dword[FxTabledA2+0ADh*4],FxOpdADA2 - mov dword[FxTabledA2+0AEh*4],FxOpdAEA2 - mov dword[FxTabledA2+0AFh*4],FxOpdAFA2 - - mov dword[FxTabledA2+0B0h*4],FxOpdB0 - mov dword[FxTabledA2+0B1h*4],FxOpdB1 - mov dword[FxTabledA2+0B2h*4],FxOpdB2 - mov dword[FxTabledA2+0B3h*4],FxOpdB3 - mov dword[FxTabledA2+0B4h*4],FxOpdB4 - mov dword[FxTabledA2+0B5h*4],FxOpdB5 - mov dword[FxTabledA2+0B6h*4],FxOpdB6 - mov dword[FxTabledA2+0B7h*4],FxOpdB7 - mov dword[FxTabledA2+0B8h*4],FxOpdB8 - mov dword[FxTabledA2+0B9h*4],FxOpdB9 - mov dword[FxTabledA2+0BAh*4],FxOpdBA - mov dword[FxTabledA2+0BBh*4],FxOpdBB - mov dword[FxTabledA2+0BCh*4],FxOpdBC - mov dword[FxTabledA2+0BDh*4],FxOpdBD - mov dword[FxTabledA2+0BEh*4],FxOpdBE - mov dword[FxTabledA2+0BFh*4],FxOpdBF - - mov dword[FxTabledA2+0C0h*4],FxOpdC0 - mov dword[FxTabledA2+0C1h*4],FxOpdC1A2 - mov dword[FxTabledA2+0C2h*4],FxOpdC2A2 - mov dword[FxTabledA2+0C3h*4],FxOpdC3A2 - mov dword[FxTabledA2+0C4h*4],FxOpdC4A2 - mov dword[FxTabledA2+0C5h*4],FxOpdC5A2 - mov dword[FxTabledA2+0C6h*4],FxOpdC6A2 - mov dword[FxTabledA2+0C7h*4],FxOpdC7A2 - mov dword[FxTabledA2+0C8h*4],FxOpdC8A2 - mov dword[FxTabledA2+0C9h*4],FxOpdC9A2 - mov dword[FxTabledA2+0CAh*4],FxOpdCAA2 - mov dword[FxTabledA2+0CBh*4],FxOpdCBA2 - mov dword[FxTabledA2+0CCh*4],FxOpdCCA2 - mov dword[FxTabledA2+0CDh*4],FxOpdCDA2 - mov dword[FxTabledA2+0CEh*4],FxOpdCEA2 - mov dword[FxTabledA2+0CFh*4],FxOpdCFA2 - - mov dword[FxTabledA2+0D0h*4],FxOpdD0 - mov dword[FxTabledA2+0D1h*4],FxOpdD1 - mov dword[FxTabledA2+0D2h*4],FxOpdD2 - mov dword[FxTabledA2+0D3h*4],FxOpdD3 - mov dword[FxTabledA2+0D4h*4],FxOpdD4 - mov dword[FxTabledA2+0D5h*4],FxOpdD5 - mov dword[FxTabledA2+0D6h*4],FxOpdD6 - mov dword[FxTabledA2+0D7h*4],FxOpdD7 - mov dword[FxTabledA2+0D8h*4],FxOpdD8 - mov dword[FxTabledA2+0D9h*4],FxOpdD9 - mov dword[FxTabledA2+0DAh*4],FxOpdDA - mov dword[FxTabledA2+0DBh*4],FxOpdDB - mov dword[FxTabledA2+0DCh*4],FxOpdDC - mov dword[FxTabledA2+0DDh*4],FxOpdDD - mov dword[FxTabledA2+0DEh*4],FxOpdDE - mov dword[FxTabledA2+0DFh*4],FxOpdDFA2 - - mov dword[FxTabledA2+0E0h*4],FxOpdE0 - mov dword[FxTabledA2+0E1h*4],FxOpdE1 - mov dword[FxTabledA2+0E2h*4],FxOpdE2 - mov dword[FxTabledA2+0E3h*4],FxOpdE3 - mov dword[FxTabledA2+0E4h*4],FxOpdE4 - mov dword[FxTabledA2+0E5h*4],FxOpdE5 - mov dword[FxTabledA2+0E6h*4],FxOpdE6 - mov dword[FxTabledA2+0E7h*4],FxOpdE7 - mov dword[FxTabledA2+0E8h*4],FxOpdE8 - mov dword[FxTabledA2+0E9h*4],FxOpdE9 - mov dword[FxTabledA2+0EAh*4],FxOpdEA - mov dword[FxTabledA2+0EBh*4],FxOpdEB - mov dword[FxTabledA2+0ECh*4],FxOpdEC - mov dword[FxTabledA2+0EDh*4],FxOpdED - mov dword[FxTabledA2+0EEh*4],FxOpdEE - mov dword[FxTabledA2+0EFh*4],FxOpdEFA2 - - mov dword[FxTabledA2+0F0h*4],FxOpdF0A2 - mov dword[FxTabledA2+0F1h*4],FxOpdF1A2 - mov dword[FxTabledA2+0F2h*4],FxOpdF2A2 - mov dword[FxTabledA2+0F3h*4],FxOpdF3A2 - mov dword[FxTabledA2+0F4h*4],FxOpdF4A2 - mov dword[FxTabledA2+0F5h*4],FxOpdF5A2 - mov dword[FxTabledA2+0F6h*4],FxOpdF6A2 - mov dword[FxTabledA2+0F7h*4],FxOpdF7A2 - mov dword[FxTabledA2+0F8h*4],FxOpdF8A2 - mov dword[FxTabledA2+0F9h*4],FxOpdF9A2 - mov dword[FxTabledA2+0FAh*4],FxOpdFAA2 - mov dword[FxTabledA2+0FBh*4],FxOpdFBA2 - mov dword[FxTabledA2+0FCh*4],FxOpdFCA2 - mov dword[FxTabledA2+0FDh*4],FxOpdFDA2 - mov dword[FxTabledA2+0FEh*4],FxOpdFEA2 - mov dword[FxTabledA2+0FFh*4],FxOpdFFA2 - - mov dword[FxTabledA3+00h*4],FxOpd00 - mov dword[FxTabledA3+01h*4],FxOpd01 - mov dword[FxTabledA3+02h*4],FxOpd02 - mov dword[FxTabledA3+03h*4],FxOpd03 - mov dword[FxTabledA3+04h*4],FxOpd04 - mov dword[FxTabledA3+05h*4],FxOpd05 - mov dword[FxTabledA3+06h*4],FxOpd06 - mov dword[FxTabledA3+07h*4],FxOpd07 - mov dword[FxTabledA3+08h*4],FxOpd08 - mov dword[FxTabledA3+09h*4],FxOpd09 - mov dword[FxTabledA3+0Ah*4],FxOpd0A - mov dword[FxTabledA3+0Bh*4],FxOpd0B - mov dword[FxTabledA3+0Ch*4],FxOpd0C - mov dword[FxTabledA3+0Dh*4],FxOpd0D - mov dword[FxTabledA3+0Eh*4],FxOpd0E - mov dword[FxTabledA3+0Fh*4],FxOpd0F - - mov dword[FxTabledA3+10h*4],FxOpd10 - mov dword[FxTabledA3+11h*4],FxOpd11 - mov dword[FxTabledA3+12h*4],FxOpd12 - mov dword[FxTabledA3+13h*4],FxOpd13 - mov dword[FxTabledA3+14h*4],FxOpd14 - mov dword[FxTabledA3+15h*4],FxOpd15 - mov dword[FxTabledA3+16h*4],FxOpd16 - mov dword[FxTabledA3+17h*4],FxOpd17 - mov dword[FxTabledA3+18h*4],FxOpd18 - mov dword[FxTabledA3+19h*4],FxOpd19 - mov dword[FxTabledA3+1Ah*4],FxOpd1A - mov dword[FxTabledA3+1Bh*4],FxOpd1B - mov dword[FxTabledA3+1Ch*4],FxOpd1C - mov dword[FxTabledA3+1Dh*4],FxOpd1D - mov dword[FxTabledA3+1Eh*4],FxOpd1E - mov dword[FxTabledA3+1Fh*4],FxOpd1F - - mov dword[FxTabledA3+20h*4],FxOpd20 - mov dword[FxTabledA3+21h*4],FxOpd21 - mov dword[FxTabledA3+22h*4],FxOpd22 - mov dword[FxTabledA3+23h*4],FxOpd23 - mov dword[FxTabledA3+24h*4],FxOpd24 - mov dword[FxTabledA3+25h*4],FxOpd25 - mov dword[FxTabledA3+26h*4],FxOpd26 - mov dword[FxTabledA3+27h*4],FxOpd27 - mov dword[FxTabledA3+28h*4],FxOpd28 - mov dword[FxTabledA3+29h*4],FxOpd29 - mov dword[FxTabledA3+2Ah*4],FxOpd2A - mov dword[FxTabledA3+2Bh*4],FxOpd2B - mov dword[FxTabledA3+2Ch*4],FxOpd2C - mov dword[FxTabledA3+2Dh*4],FxOpd2D - mov dword[FxTabledA3+2Eh*4],FxOpd2E - mov dword[FxTabledA3+2Fh*4],FxOpd2F - - mov dword[FxTabledA3+30h*4],FxOpd30 - mov dword[FxTabledA3+31h*4],FxOpd31 - mov dword[FxTabledA3+32h*4],FxOpd32 - mov dword[FxTabledA3+33h*4],FxOpd33 - mov dword[FxTabledA3+34h*4],FxOpd34 - mov dword[FxTabledA3+35h*4],FxOpd35 - mov dword[FxTabledA3+36h*4],FxOpd36 - mov dword[FxTabledA3+37h*4],FxOpd37 - mov dword[FxTabledA3+38h*4],FxOpd38 - mov dword[FxTabledA3+39h*4],FxOpd39 - mov dword[FxTabledA3+3Ah*4],FxOpd3A - mov dword[FxTabledA3+3Bh*4],FxOpd3B - mov dword[FxTabledA3+3Ch*4],FxOpd3C - mov dword[FxTabledA3+3Dh*4],FxOpd3D - mov dword[FxTabledA3+3Eh*4],FxOpd3E - mov dword[FxTabledA3+3Fh*4],FxOpd3F - - mov dword[FxTabledA3+40h*4],FxOpd40 - mov dword[FxTabledA3+41h*4],FxOpd41 - mov dword[FxTabledA3+42h*4],FxOpd42 - mov dword[FxTabledA3+43h*4],FxOpd43 - mov dword[FxTabledA3+44h*4],FxOpd44 - mov dword[FxTabledA3+45h*4],FxOpd45 - mov dword[FxTabledA3+46h*4],FxOpd46 - mov dword[FxTabledA3+47h*4],FxOpd47 - mov dword[FxTabledA3+48h*4],FxOpd48 - mov dword[FxTabledA3+49h*4],FxOpd49 - mov dword[FxTabledA3+4Ah*4],FxOpd4A - mov dword[FxTabledA3+4Bh*4],FxOpd4B - mov dword[FxTabledA3+4Ch*4],FxOpd4C - mov dword[FxTabledA3+4Dh*4],FxOpd4D - mov dword[FxTabledA3+4Eh*4],FxOpd4E - mov dword[FxTabledA3+4Fh*4],FxOpd4F - - mov dword[FxTabledA3+50h*4],FxOpd50A3 - mov dword[FxTabledA3+51h*4],FxOpd51A3 - mov dword[FxTabledA3+52h*4],FxOpd52A3 - mov dword[FxTabledA3+53h*4],FxOpd53A3 - mov dword[FxTabledA3+54h*4],FxOpd54A3 - mov dword[FxTabledA3+55h*4],FxOpd55A3 - mov dword[FxTabledA3+56h*4],FxOpd56A3 - mov dword[FxTabledA3+57h*4],FxOpd57A3 - mov dword[FxTabledA3+58h*4],FxOpd58A3 - mov dword[FxTabledA3+59h*4],FxOpd59A3 - mov dword[FxTabledA3+5Ah*4],FxOpd5AA3 - mov dword[FxTabledA3+5Bh*4],FxOpd5BA3 - mov dword[FxTabledA3+5Ch*4],FxOpd5CA3 - mov dword[FxTabledA3+5Dh*4],FxOpd5DA3 - mov dword[FxTabledA3+5Eh*4],FxOpd5EA3 - mov dword[FxTabledA3+5Fh*4],FxOpd5FA3 - - mov dword[FxTabledA3+60h*4],FxOpd60A3 - mov dword[FxTabledA3+61h*4],FxOpd61A3 - mov dword[FxTabledA3+62h*4],FxOpd62A3 - mov dword[FxTabledA3+63h*4],FxOpd63A3 - mov dword[FxTabledA3+64h*4],FxOpd64A3 - mov dword[FxTabledA3+65h*4],FxOpd65A3 - mov dword[FxTabledA3+66h*4],FxOpd66A3 - mov dword[FxTabledA3+67h*4],FxOpd67A3 - mov dword[FxTabledA3+68h*4],FxOpd68A3 - mov dword[FxTabledA3+69h*4],FxOpd69A3 - mov dword[FxTabledA3+6Ah*4],FxOpd6AA3 - mov dword[FxTabledA3+6Bh*4],FxOpd6BA3 - mov dword[FxTabledA3+6Ch*4],FxOpd6CA3 - mov dword[FxTabledA3+6Dh*4],FxOpd6DA3 - mov dword[FxTabledA3+6Eh*4],FxOpd6EA3 - mov dword[FxTabledA3+6Fh*4],FxOpd6FA3 - - mov dword[FxTabledA3+70h*4],FxOpd70 - mov dword[FxTabledA3+71h*4],FxOpd71A3 - mov dword[FxTabledA3+72h*4],FxOpd72A3 - mov dword[FxTabledA3+73h*4],FxOpd73A3 - mov dword[FxTabledA3+74h*4],FxOpd74A3 - mov dword[FxTabledA3+75h*4],FxOpd75A3 - mov dword[FxTabledA3+76h*4],FxOpd76A3 - mov dword[FxTabledA3+77h*4],FxOpd77A3 - mov dword[FxTabledA3+78h*4],FxOpd78A3 - mov dword[FxTabledA3+79h*4],FxOpd79A3 - mov dword[FxTabledA3+7Ah*4],FxOpd7AA3 - mov dword[FxTabledA3+7Bh*4],FxOpd7BA3 - mov dword[FxTabledA3+7Ch*4],FxOpd7CA3 - mov dword[FxTabledA3+7Dh*4],FxOpd7DA3 - mov dword[FxTabledA3+7Eh*4],FxOpd7EA3 - mov dword[FxTabledA3+7Fh*4],FxOpd7FA3 - - mov dword[FxTabledA3+80h*4],FxOpd80A3 - mov dword[FxTabledA3+81h*4],FxOpd81A3 - mov dword[FxTabledA3+82h*4],FxOpd82A3 - mov dword[FxTabledA3+83h*4],FxOpd83A3 - mov dword[FxTabledA3+84h*4],FxOpd84A3 - mov dword[FxTabledA3+85h*4],FxOpd85A3 - mov dword[FxTabledA3+86h*4],FxOpd86A3 - mov dword[FxTabledA3+87h*4],FxOpd87A3 - mov dword[FxTabledA3+88h*4],FxOpd88A3 - mov dword[FxTabledA3+89h*4],FxOpd89A3 - mov dword[FxTabledA3+8Ah*4],FxOpd8AA3 - mov dword[FxTabledA3+8Bh*4],FxOpd8BA3 - mov dword[FxTabledA3+8Ch*4],FxOpd8CA3 - mov dword[FxTabledA3+8Dh*4],FxOpd8DA3 - mov dword[FxTabledA3+8Eh*4],FxOpd8EA3 - mov dword[FxTabledA3+8Fh*4],FxOpd8FA3 - - mov dword[FxTabledA3+90h*4],FxOpd90 - mov dword[FxTabledA3+91h*4],FxOpd91 - mov dword[FxTabledA3+92h*4],FxOpd92 - mov dword[FxTabledA3+93h*4],FxOpd93 - mov dword[FxTabledA3+94h*4],FxOpd94 - mov dword[FxTabledA3+95h*4],FxOpd95 - mov dword[FxTabledA3+96h*4],FxOpd96 - mov dword[FxTabledA3+97h*4],FxOpd97 - mov dword[FxTabledA3+98h*4],FxOpd98 - mov dword[FxTabledA3+99h*4],FxOpd99 - mov dword[FxTabledA3+9Ah*4],FxOpd9A - mov dword[FxTabledA3+9Bh*4],FxOpd9B - mov dword[FxTabledA3+9Ch*4],FxOpd9C - mov dword[FxTabledA3+9Dh*4],FxOpd9D - mov dword[FxTabledA3+9Eh*4],FxOpd9E - mov dword[FxTabledA3+9Fh*4],FxOpd9F - - mov dword[FxTabledA3+0A0h*4],FxOpdA0 - mov dword[FxTabledA3+0A1h*4],FxOpdA1 - mov dword[FxTabledA3+0A2h*4],FxOpdA2 - mov dword[FxTabledA3+0A3h*4],FxOpdA3 - mov dword[FxTabledA3+0A4h*4],FxOpdA4 - mov dword[FxTabledA3+0A5h*4],FxOpdA5 - mov dword[FxTabledA3+0A6h*4],FxOpdA6 - mov dword[FxTabledA3+0A7h*4],FxOpdA7 - mov dword[FxTabledA3+0A8h*4],FxOpdA8 - mov dword[FxTabledA3+0A9h*4],FxOpdA9 - mov dword[FxTabledA3+0AAh*4],FxOpdAA - mov dword[FxTabledA3+0ABh*4],FxOpdAB - mov dword[FxTabledA3+0ACh*4],FxOpdAC - mov dword[FxTabledA3+0ADh*4],FxOpdAD - mov dword[FxTabledA3+0AEh*4],FxOpdAE - mov dword[FxTabledA3+0AFh*4],FxOpdAF - - mov dword[FxTabledA3+0B0h*4],FxOpdB0 - mov dword[FxTabledA3+0B1h*4],FxOpdB1 - mov dword[FxTabledA3+0B2h*4],FxOpdB2 - mov dword[FxTabledA3+0B3h*4],FxOpdB3 - mov dword[FxTabledA3+0B4h*4],FxOpdB4 - mov dword[FxTabledA3+0B5h*4],FxOpdB5 - mov dword[FxTabledA3+0B6h*4],FxOpdB6 - mov dword[FxTabledA3+0B7h*4],FxOpdB7 - mov dword[FxTabledA3+0B8h*4],FxOpdB8 - mov dword[FxTabledA3+0B9h*4],FxOpdB9 - mov dword[FxTabledA3+0BAh*4],FxOpdBA - mov dword[FxTabledA3+0BBh*4],FxOpdBB - mov dword[FxTabledA3+0BCh*4],FxOpdBC - mov dword[FxTabledA3+0BDh*4],FxOpdBD - mov dword[FxTabledA3+0BEh*4],FxOpdBE - mov dword[FxTabledA3+0BFh*4],FxOpdBF - - mov dword[FxTabledA3+0C0h*4],FxOpdC0 - mov dword[FxTabledA3+0C1h*4],FxOpdC1A3 - mov dword[FxTabledA3+0C2h*4],FxOpdC2A3 - mov dword[FxTabledA3+0C3h*4],FxOpdC3A3 - mov dword[FxTabledA3+0C4h*4],FxOpdC4A3 - mov dword[FxTabledA3+0C5h*4],FxOpdC5A3 - mov dword[FxTabledA3+0C6h*4],FxOpdC6A3 - mov dword[FxTabledA3+0C7h*4],FxOpdC7A3 - mov dword[FxTabledA3+0C8h*4],FxOpdC8A3 - mov dword[FxTabledA3+0C9h*4],FxOpdC9A3 - mov dword[FxTabledA3+0CAh*4],FxOpdCAA3 - mov dword[FxTabledA3+0CBh*4],FxOpdCBA3 - mov dword[FxTabledA3+0CCh*4],FxOpdCCA3 - mov dword[FxTabledA3+0CDh*4],FxOpdCDA3 - mov dword[FxTabledA3+0CEh*4],FxOpdCEA3 - mov dword[FxTabledA3+0CFh*4],FxOpdCFA3 - - mov dword[FxTabledA3+0D0h*4],FxOpdD0 - mov dword[FxTabledA3+0D1h*4],FxOpdD1 - mov dword[FxTabledA3+0D2h*4],FxOpdD2 - mov dword[FxTabledA3+0D3h*4],FxOpdD3 - mov dword[FxTabledA3+0D4h*4],FxOpdD4 - mov dword[FxTabledA3+0D5h*4],FxOpdD5 - mov dword[FxTabledA3+0D6h*4],FxOpdD6 - mov dword[FxTabledA3+0D7h*4],FxOpdD7 - mov dword[FxTabledA3+0D8h*4],FxOpdD8 - mov dword[FxTabledA3+0D9h*4],FxOpdD9 - mov dword[FxTabledA3+0DAh*4],FxOpdDA - mov dword[FxTabledA3+0DBh*4],FxOpdDB - mov dword[FxTabledA3+0DCh*4],FxOpdDC - mov dword[FxTabledA3+0DDh*4],FxOpdDD - mov dword[FxTabledA3+0DEh*4],FxOpdDE - mov dword[FxTabledA3+0DFh*4],FxOpdDFA3 - - mov dword[FxTabledA3+0E0h*4],FxOpdE0 - mov dword[FxTabledA3+0E1h*4],FxOpdE1 - mov dword[FxTabledA3+0E2h*4],FxOpdE2 - mov dword[FxTabledA3+0E3h*4],FxOpdE3 - mov dword[FxTabledA3+0E4h*4],FxOpdE4 - mov dword[FxTabledA3+0E5h*4],FxOpdE5 - mov dword[FxTabledA3+0E6h*4],FxOpdE6 - mov dword[FxTabledA3+0E7h*4],FxOpdE7 - mov dword[FxTabledA3+0E8h*4],FxOpdE8 - mov dword[FxTabledA3+0E9h*4],FxOpdE9 - mov dword[FxTabledA3+0EAh*4],FxOpdEA - mov dword[FxTabledA3+0EBh*4],FxOpdEB - mov dword[FxTabledA3+0ECh*4],FxOpdEC - mov dword[FxTabledA3+0EDh*4],FxOpdED - mov dword[FxTabledA3+0EEh*4],FxOpdEE - mov dword[FxTabledA3+0EFh*4],FxOpdEFA3 - - mov dword[FxTabledA3+0F0h*4],FxOpdF0 - mov dword[FxTabledA3+0F1h*4],FxOpdF1 - mov dword[FxTabledA3+0F2h*4],FxOpdF2 - mov dword[FxTabledA3+0F3h*4],FxOpdF3 - mov dword[FxTabledA3+0F4h*4],FxOpdF4 - mov dword[FxTabledA3+0F5h*4],FxOpdF5 - mov dword[FxTabledA3+0F6h*4],FxOpdF6 - mov dword[FxTabledA3+0F7h*4],FxOpdF7 - mov dword[FxTabledA3+0F8h*4],FxOpdF8 - mov dword[FxTabledA3+0F9h*4],FxOpdF9 - mov dword[FxTabledA3+0FAh*4],FxOpdFA - mov dword[FxTabledA3+0FBh*4],FxOpdFB - mov dword[FxTabledA3+0FCh*4],FxOpdFC - mov dword[FxTabledA3+0FDh*4],FxOpdFD - mov dword[FxTabledA3+0FEh*4],FxOpdFE - mov dword[FxTabledA3+0FFh*4],FxOpdFF - ret - -; normal -SECTION .data -NEWSYM sfxnametab - db 'STOP NOP CACHE LSR ' - db 'ROL BRA BLT BGE ' - db 'BNE BEQ BPL BMI ' - db 'BCC BCS BVC BVS ' - - db 'TO R0 TO R1 TO R2 TO R3 ' ; MOVE when B=1 - db 'TO R4 TO R5 TO R6 TO R7 ' - db 'TO R8 TO R9 TO R10 TO R11 ' - db 'TO R12 TO R13 TO R14 TO R15 ' - - db 'WITH R0 WITH R1 WITH R2 WITH R3 ' - db 'WITH R4 WITH R5 WITH R6 WITH R7 ' - db 'WITH R8 WITH R9 WITH R10WITH R11' - db 'WITH R12WITH R13WITH R14WITH R15' - - db 'STW(R0) STW(R1) STW(R2) STW(R3) ' - db 'STW(R4) STW(R5) STW(R6) STW(R7) ' - db 'STW(R8) STW(R9) STW(R10)STW(R11)' - db 'LOOP ALT1 ALT2 ALT3 ' - - db 'LDW(R0) LDW(R1) LDW(R2) LDW(R3) ' - db 'LDW(R4) LDW(R5) LDW(R6) LDW(R7) ' - db 'LDW(R8) LDW(R9) LDW(R10)LDW(R11)' - db 'PLOT SWAP COLOR NOT ' - - db 'ADD R0 ADD R1 ADD R2 ADD R3 ' - db 'ADD R4 ADD R5 ADD R6 ADD R7 ' - db 'ADD R8 ADD R9 ADD R10 ADD R11 ' - db 'ADD R12 ADD R13 ADD R14 ADD R15 ' - - db 'SUB R0 SUB R1 SUB R2 SUB R3 ' - db 'SUB R4 SUB R5 SUB R6 SUB R7 ' - db 'SUB R8 SUB R9 SUB R10 SUB R11 ' - db 'SUB R12 SUB R13 SUB R14 SUB R15 ' - - db 'MERGE AND R1 AND R2 AND R3 ' - db 'AND R4 AND R5 AND R6 AND R7 ' - db 'AND R8 AND R9 AND R10 AND R11 ' - db 'AND R12 AND R13 AND R14 AND R15 ' - - db 'MULT R0 MULT R1 MULT R2 MULT R3 ' - db 'MULT R4 MULT R5 MULT R6 MULT R7 ' - db 'MULT R8 MULT R9 MULT R10MULT R11' - db 'MULT R12MULT R13MULT R14MULT R15' - - db 'SBK LINK #$1LINK #$2LINK #$3' - db 'LINK #$4SEX ASR ROR ' - db 'JMP R8 JMP R9 JMP R10 JMP R11 ' - db 'JMP R12 JMP R13 LOB FMULT ' - - db 'IBT R0 IBT R1 IBT R2 IBT R3 ' - db 'IBT R4 IBT R5 IBT R6 IBT R7 ' - db 'IBT R8 IBT R9 IBT R10 IBT R11 ' - db 'IBT R12 IBT R13 IBT R14 IBT R15 ' - - db 'FROM R0 FROM R1 FROM R2 FROM R3 ' ; MOVES if B=1 - db 'FROM R4 FROM R5 FROM R6 FROM R7 ' - db 'FROM R8 FROM R9 FROM R10FROM R11' - db 'FROM R12FROM R13FROM R14FROM R15' - - db 'HIB OR R1 OR R2 OR R3 ' - db 'OR R4 OR R5 OR R6 OR R7 ' - db 'OR R8 OR R9 OR R10 OR R11 ' - db 'OR R12 OR R13 OR R14 OR R15 ' - - db 'INC R0 INC R1 INC R2 INC R3 ' - db 'INC R4 INC R5 INC R6 INC R7 ' - db 'INC R8 INC R9 INC R10 INC R11 ' - db 'INC R12 INC R13 INC R14 GETC ' - - db 'DEC R0 DEC R1 DEC R2 DEC R3 ' - db 'DEC R4 DEC R5 DEC R6 DEC R7 ' - db 'DEC R8 DEC R9 DEC R10 DEC R11 ' - db 'DEC R12 DEC R13 DEC R14 GETB ' - - db 'IWT R0 IWT R1 IWT R2 IWT R3 ' - db 'IWT R4 IWT R5 IWT R6 IWT R7 ' - db 'IWT R8 IWT R9 IWT R10 IWT R11 ' - db 'IWT R12 IWT R13 IWT R14 IWT R15 ' - -;A1 - db 'STOP NOP CACHE LSR ' - db 'ROL BRA BLT BGE ' - db 'BNE BEQ BPL BMI ' - db 'BCC BCS BVC BVS ' - - db 'TO R0 TO R1 TO R2 TO R3 ' ; MOVE when B=1 - db 'TO R4 TO R5 TO R6 TO R7 ' - db 'TO R8 TO R9 TO R10 TO R11 ' - db 'TO R12 TO R13 TO R14 TO R15 ' - - db 'WITH R0 WITH R1 WITH R2 WITH R3 ' - db 'WITH R4 WITH R5 WITH R6 WITH R7 ' - db 'WITH R8 WITH R9 WITH R10WITH R11' - db 'WITH R12WITH R13WITH R14WITH R15' - - db 'STB(R0) STB(R1) STB(R2) STB(R3) ' - db 'STB(R4) STB(R5) STB(R6) STB(R7) ' - db 'STB(R8) STB(R9) STB(R10)STB(R11)' - db 'LOOP ALT1 ALT2 ALT3 ' - - db 'LDB(R0) LDB(R1) LDB(R2) LDB(R3) ' - db 'LDB(R4) LDB(R5) LDB(R6) LDB(R7) ' - db 'LDB(R8) LDB(R9) LDB(R10)LDB(R11)' - db 'PLOT SWAP CMODE NOT ' - - db 'ADC R0 ADC R1 ADC R2 ADC R3 ' - db 'ADC R4 ADC R5 ADC R6 ADC R7 ' - db 'ADC R8 ADC R9 ADC R10 ADC R11 ' - db 'ADC R12 ADC R13 ADC R14 ADC R15 ' - - db 'SBC R0 SBC R1 SBC R2 SBC R3 ' - db 'SBC R4 SBC R5 SBC R6 SBC R7 ' - db 'SBC R8 SBC R9 SBC R10 SBC R11 ' - db 'SBC R12 SBC R13 SBC R14 SBC R15 ' - - db 'MERGE BIC R1 BIC R2 BIC R3 ' - db 'BIC R4 BIC R5 BIC R6 BIC R7 ' - db 'BIC R8 BIC R9 BIC R10 BIC R11 ' - db 'BIC R12 BIC R13 BIC R14 BIC R15 ' - - db 'UMULTR0 UMULTR1 UMULTR2 UMULTR3 ' - db 'UMULTR4 UMULTR5 UMULTR6 UMULTR7 ' - db 'UMULTR8 UMULTR9 UMULTR10UMULTR11' - db 'UMULTR12UMULTR13UMULTR14UMULTR15' - - db 'SBK LINK #$1LINK #$2LINK #$3' - db 'LINK #$4SEX DIV2 ROR ' - db 'LJMP R8 LJMP R9 LJMP R10LJMP R11' - db 'LJMP R12LJMP R13LOB LMULT ' - - db 'LMS R0 LMS R1 LMS R2 LMS R3 ' - db 'LMS R4 LMS R5 LMS R6 LMS R7 ' - db 'LMS R8 LMS R9 LMS R10 LMS R11 ' - db 'LMS R12 LMS R13 LMS R14 LMS R15 ' - - db 'FROM R0 FROM R1 FROM R2 FROM R3 ' ; MOVES if B=1 - db 'FROM R4 FROM R5 FROM R6 FROM R7 ' - db 'FROM R8 FROM R9 FROM R10FROM R11' - db 'FROM R12FROM R13FROM R14FROM R15' - - db 'HIB XOR R1 XOR R2 XOR R3 ' - db 'XOR R4 XOR R5 XOR R6 XOR R7 ' - db 'XOR R8 XOR R9 XOR R10 XOR R11 ' - db 'XOR R12 XOR R13 XOR R14 XOR R15 ' - - db 'INC R0 INC R1 INC R2 INC R3 ' - db 'INC R4 INC R5 INC R6 INC R7 ' - db 'INC R8 INC R9 INC R10 INC R11 ' - db 'INC R12 INC R13 INC R14 GETC ' - - db 'DEC R0 DEC R1 DEC R2 DEC R3 ' - db 'DEC R4 DEC R5 DEC R6 DEC R7 ' - db 'DEC R8 DEC R9 DEC R10 DEC R11 ' - db 'DEC R12 DEC R13 DEC R14 GETBH ' - - db 'LM R0 LM R1 LM R2 LM R3 ' - db 'LM R4 LM R5 LM R6 LM R7 ' - db 'LM R8 LM R9 LM R10 LM R11 ' - db 'LM R12 LM R13 LM R14 LM R15 ' -;A2 - db 'STOP NOP CACHE LSR ' - db 'ROL BRA BLT BGE ' - db 'BNE BEQ BPL BMI ' - db 'BCC BCS BVC BVS ' - - db 'TO R0 TO R1 TO R2 TO R3 ' ; MOVE when B=1 - db 'TO R4 TO R5 TO R6 TO R7 ' - db 'TO R8 TO R9 TO R10 TO R11 ' - db 'TO R12 TO R13 TO R14 TO R15 ' - - db 'WITH R0 WITH R1 WITH R2 WITH R3 ' - db 'WITH R4 WITH R5 WITH R6 WITH R7 ' - db 'WITH R8 WITH R9 WITH R10WITH R11' - db 'WITH R12WITH R13WITH R14WITH R15' - - db 'STW(R0) STW(R1) STW(R2) STW(R3) ' - db 'STW(R4) STW(R5) STW(R6) STW(R7) ' - db 'STW(R8) STW(R9) STW(R10)STW(R11)' - db 'LOOP ALT1 ALT2 ALT3 ' - - db 'LDW(R0) LDW(R1) LDW(R2) LDW(R3) ' - db 'LDW(R4) LDW(R5) LDW(R6) LDW(R7) ' - db 'LDW(R8) LDW(R9) LDW(R10)LDW(R11)' - db 'PLOT SWAP COLOR NOT ' - - db 'ADD #$0 ADD #$1 ADD #$2 ADD #$3 ' - db 'ADD #$4 ADD #$5 ADD #$6 ADD #$7 ' - db 'ADD #$8 ADD #$9 ADD #$A ADD #$B ' - db 'ADD #$C ADD #$D ADD #$E ADD #$F ' - - db 'SUB #$0 SUB #$1 SUB #$2 SUB #$3 ' - db 'SUB #$4 SUB #$5 SUB #$6 SUB #$7 ' - db 'SUB #$8 SUB #$9 SUB #$A SUB #$B ' - db 'SUB #$C SUB #$D SUB #$E SUB #$F ' - - db 'MERGE AND #$1 AND #$2 AND #$3 ' - db 'AND #$4 AND #$5 AND #$6 AND #$7 ' - db 'AND #$8 AND #$9 AND #$A AND #$B ' - db 'AND #$C AND #$D AND #$E AND #$F ' - - db 'MULTIR0 MULTIR1 MULTIR2 MULTIR3 ' - db 'MULTIR4 MULTIR5 MULTIR6 MULTIR7 ' - db 'MULTIR8 MULTIR9 MULTIR10MULTIR11' - db 'MULTIR12MULTIR13MULTIR14MULTIR15' - - db 'SBK LINK #$1LINK #$2LINK #$3' - db 'LINK #$4SEX ASR ROR ' - db 'JMP R8 JMP R9 JMP R10 JMP R11 ' - db 'JMP R12 JMP R13 LOB FMULT ' - - db 'SMS R0 SMS R1 SMS R2 SMS R3 ' - db 'SMS R4 SMS R5 SMS R6 SMS R7 ' - db 'SMS R8 SMS R9 SMS R10 SMS R11 ' - db 'SMS R12 SMS R13 SMS R14 SMS R15 ' - - db 'FROM R0 FROM R1 FROM R2 FROM R3 ' ; MOVES if B=1 - db 'FROM R4 FROM R5 FROM R6 FROM R7 ' - db 'FROM R8 FROM R9 FROM R10FROM R11' - db 'FROM R12FROM R13FROM R14FROM R15' - - db 'HIB OR #$1 OR #$2 OR #$3 ' - db 'OR #$4 OR #$5 OR #$6 OR #$7 ' - db 'OR #$8 OR #$9 OR #$A OR #$B ' - db 'OR #$C OR #$D OR #$E OR #$F ' - - db 'INC R0 INC R1 INC R2 INC R3 ' - db 'INC R4 INC R5 INC R6 INC R7 ' - db 'INC R8 INC R9 INC R10 INC R11 ' - db 'INC R12 INC R13 INC R14 RAMB ' - - db 'DEC R0 DEC R1 DEC R2 DEC R3 ' - db 'DEC R4 DEC R5 DEC R6 DEC R7 ' - db 'DEC R8 DEC R9 DEC R10 DEC R11 ' - db 'DEC R12 DEC R13 DEC R14 GETBL ' - - db 'SM R0 SM R1 SM R2 SM R3 ' - db 'SM R4 SM R5 SM R6 SM R7 ' - db 'SM R8 SM R9 SM R10 SM R11 ' - db 'SM R12 SM R13 SM R14 SM R15 ' -;A3 - db 'STOP NOP CACHE LSR ' - db 'ROL BRA BLT BGE ' - db 'BNE BEQ BPL BMI ' - db 'BCC BCS BVC BVS ' - - db 'TO R0 TO R1 TO R2 TO R3 ' ; MOVE when B=1 - db 'TO R4 TO R5 TO R6 TO R7 ' - db 'TO R8 TO R9 TO R10 TO R11 ' - db 'TO R12 TO R13 TO R14 TO R15 ' - - db 'WITH R0 WITH R1 WITH R2 WITH R3 ' - db 'WITH R4 WITH R5 WITH R6 WITH R7 ' - db 'WITH R8 WITH R9 WITH R10WITH R11' - db 'WITH R12WITH R13WITH R14WITH R15' - - db 'STW(R0) STW(R1) STW(R2) STW(R3) ' - db 'STW(R4) STW(R5) STW(R6) STW(R7) ' - db 'STW(R8) STW(R9) STW(R10)STW(R11)' - db 'LOOP ALT1 ALT2 ALT3 ' - - db 'LDW(R0) LDW(R1) LDW(R2) LDW(R3) ' - db 'LDW(R4) LDW(R5) LDW(R6) LDW(R7) ' - db 'LDW(R8) LDW(R9) LDW(R10)LDW(R11)' - db 'PLOT SWAP COLOR NOT ' - - db 'ADC #$0 ADC #$1 ADC #$2 ADC #$3 ' - db 'ADC #$4 ADC #$5 ADC #$6 ADC #$7 ' - db 'ADC #$8 ADC #$9 ADC #$A ADC #$B ' - db 'ADC #$C ADC #$D ADC #$E ADC #$F ' - - db 'CMP R0 CMP R1 CMP R2 CMP R3 ' - db 'CMP R4 CMP R5 CMP R6 CMP R7 ' - db 'CMP R8 CMP R9 CMP R10 CMP R11 ' - db 'CMP R12 CMP R13 CMP R14 CMP R15 ' - - db 'MERGE BIC #$1 BIC #$2 BIC #$3 ' - db 'BIC #$4 BIC #$5 BIC #$6 BIC #$7 ' - db 'BIC #$8 BIC #$9 BIC #$A BIC #$B ' - db 'BIC #$C BIC #$D BIC #$E BIC #$F ' - - db 'UMULIR0 UMULIR1 UMULIR2 UMULIR3 ' - db 'UMULIR4 UMULIR5 UMULIR6 UMULIR7 ' - db 'UMULIR8 UMULIR9 UMULIR10UMULIR11' - db 'UMULIR12UMULIR13UMULIR14UMULIR15' - - db 'SBK LINK #$1LINK #$2LINK #$3' - db 'LINK #$4SEX ASR ROR ' - db 'JMP R8 JMP R9 JMP R10 JMP R11 ' - db 'JMP R12 JMP R13 LOB FMULT ' - - db 'IBT R0 IBT R1 IBT R2 IBT R3 ' - db 'IBT R4 IBT R5 IBT R6 IBT R7 ' - db 'IBT R8 IBT R9 IBT R10 IBT R11 ' - db 'IBT R12 IBT R13 IBT R14 IBT R15 ' - - db 'FROM R0 FROM R1 FROM R2 FROM R3 ' ; MOVES if B=1 - db 'FROM R4 FROM R5 FROM R6 FROM R7 ' - db 'FROM R8 FROM R9 FROM R10FROM R11' - db 'FROM R12FROM R13FROM R14FROM R15' - - db 'HIB XOR #$1 XOR #$2 XOR #$3 ' - db 'XOR #$4 XOR #$5 XOR #$6 XOR #$7 ' - db 'XOR #$8 XOR #$9 XOR #$A XOR #$B ' - db 'XOR #$C XOR #$D XOR #$E XOR #$F ' - - db 'INC R0 INC R1 INC R2 INC R3 ' - db 'INC R4 INC R5 INC R6 INC R7 ' - db 'INC R8 INC R9 INC R10 INC R11 ' - db 'INC R12 INC R13 INC R14 ROMB ' - - db 'DEC R0 DEC R1 DEC R2 DEC R3 ' - db 'DEC R4 DEC R5 DEC R6 DEC R7 ' - db 'DEC R8 DEC R9 DEC R10 DEC R11 ' - db 'DEC R12 DEC R13 DEC R14 GETBS ' - - db 'IWT R0 IWT R1 IWT R2 IWT R3 ' - db 'IWT R4 IWT R5 IWT R6 IWT R7 ' - db 'IWT R8 IWT R9 IWT R10 IWT R11 ' - db 'IWT R12 IWT R13 IWT R14 IWT R15 ' - - diff --git a/tools/zsnes/src/chips/obc1emu.c b/tools/zsnes/src/chips/obc1emu.c deleted file mode 100644 index 96cd7f1..0000000 --- a/tools/zsnes/src/chips/obc1emu.c +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -typedef unsigned char bool8; -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef char int8; -typedef short int16; -typedef long int32; - -//C++ in C -typedef unsigned char bool; -#define true 1 -#define false 0 - -static uint8 *OBC1_RAM = 0; - -int OBC1_Address; -int OBC1_BasePtr; -int OBC1_Shift; - -uint16 obc1_address; -uint8 obc1_byte; - -void GetOBC1 () -{ - switch(obc1_address) { - case 0x7ff0: - obc1_byte = OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2)]; - break; - - case 0x7ff1: - obc1_byte = OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 1]; - break; - - case 0x7ff2: - obc1_byte = OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 2]; - break; - - case 0x7ff3: - obc1_byte = OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 3]; - break; - - case 0x7ff4: - obc1_byte = OBC1_RAM[OBC1_BasePtr + (OBC1_Address >> 2) + 0x200]; - break; - - default: - obc1_byte = OBC1_RAM[obc1_address & 0x1fff]; - } -} - - -void SetOBC1 () -{ - switch(obc1_address) { - case 0x7ff0: - { - OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2)] = obc1_byte; - break; - } - - case 0x7ff1: - { - OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 1] = obc1_byte; - break; - } - - case 0x7ff2: - { - OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 2] = obc1_byte; - break; - } - - case 0x7ff3: - { - OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 3] = obc1_byte; - break; - } - - case 0x7ff4: - { - unsigned char Temp; - - Temp = OBC1_RAM[OBC1_BasePtr + (OBC1_Address >> 2) + 0x200]; - Temp = (Temp & ~(3 << OBC1_Shift)) | ((obc1_byte & 3) << OBC1_Shift); - OBC1_RAM[OBC1_BasePtr + (OBC1_Address >> 2) + 0x200] = Temp; - break; - } - - case 0x7ff5: - { - if (obc1_byte & 1) - OBC1_BasePtr = 0x1800; - else - OBC1_BasePtr = 0x1c00; - - break; - } - - case 0x7ff6: - { - OBC1_Address = obc1_byte & 0x7f; - OBC1_Shift = (obc1_byte & 3) << 1; - break; - } - } - - OBC1_RAM[obc1_address & 0x1fff] = obc1_byte; -} - -extern unsigned char *romdata; -void InitOBC1() -{ - OBC1_RAM = romdata+0x400000; - if (OBC1_RAM[0x1ff5] & 1) - OBC1_BasePtr = 0x1800; - else - OBC1_BasePtr = 0x1c00; - - OBC1_Address = OBC1_RAM[0x1ff6] & 0x7f; - OBC1_Shift = (OBC1_RAM[0x1ff6] & 3) << 1; -} diff --git a/tools/zsnes/src/chips/obc1proc.asm b/tools/zsnes/src/chips/obc1proc.asm deleted file mode 100644 index 7e8ca31..0000000 --- a/tools/zsnes/src/chips/obc1proc.asm +++ /dev/null @@ -1,82 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 obc1_address,obc1_byte,SetOBC1,GetOBC1 -EXTSYM regaccessbankr16,regaccessbankr8,regaccessbankw16,regaccessbankw8 -EXTSYM memaccessbankr16,memaccessbankr8,memaccessbankw16,memaccessbankw8 - -SECTION .text - -%macro RouteAccess 1 - test ecx,8000h - jnz memaccessbank%1 - cmp ecx,6000h - jb regaccessbank%1 -%endmacro - -NEWSYM OBC1Read8b - RouteAccess r8 - mov [obc1_address],cx - pushad - call GetOBC1 - popad - mov al,[obc1_byte] - ret - -NEWSYM OBC1Write8b - RouteAccess w8 - mov [obc1_address],cx - mov [obc1_byte],al - pushad - call SetOBC1 - popad - ret - -NEWSYM OBC1Read16b - RouteAccess r16 - mov [obc1_address],cx - pushad - call GetOBC1 - mov al,[obc1_byte] - mov [obc1temp],al - inc word[obc1_address] - call GetOBC1 - popad - mov al,[obc1temp] - mov ah,[obc1_byte] - ret - -NEWSYM OBC1Write16b - RouteAccess w16 - mov [obc1_address],cx - mov [obc1_byte],al - mov [obc1temp],ah - pushad - call SetOBC1 - mov ah,[obc1temp] - mov [obc1_byte],ah - inc word[obc1_address] - call SetOBC1 - popad - ret - -SECTION .bss -NEWSYM obc1temp, resb 1 diff --git a/tools/zsnes/src/chips/sa1proc.asm b/tools/zsnes/src/chips/sa1proc.asm deleted file mode 100644 index fa63cb4..0000000 --- a/tools/zsnes/src/chips/sa1proc.asm +++ /dev/null @@ -1,363 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 initaddrl,wramdata,IRAM,SA1DoIRQ,SNSRegP,SNSRegPCS -EXTSYM SA1Ptr,SNSPtr,snesmap2,SA1tablead,SA1xpb,SA1RegP,wramdataa,SA1TimerVal -EXTSYM SA1RegPCS,SA1BWPtr,SNSBWPtr,CurBWPtr,SA1NMIV,SA1IRQV -EXTSYM membank0w8,SA1LBound,SA1UBound,SA1SH,SA1SHb,stackor,stackand,snesmmap -EXTSYM SA1xs,SA1IRQExec,SA1Message,Sflagnz,Sflagc,Sflago - -; In exec loop, jump to execloop if SA1Status != 0 -; *** Disable spc700 if possible *** - -SECTION .bss -NEWSYM SA1Status, resb 1 ; 0 = 65816, 1 = SA1A, 2 = SA1B - -NEWSYM CurrentExecSA1, resb 1 -NEWSYM CurrentCPU, resb 1 - -;ALIGN32 -NEWSYM prevedi, resd 1 - -SECTION .text - -%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,20 - 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 [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,90 - - 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 [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,18 - 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 - -SECTION .bss -NEWSYM SA1xpc, resd 1 -SECTION .text - -%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,[SA1Message] - mov [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,[SA1Message] - mov [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 diff --git a/tools/zsnes/src/chips/sa1regs.asm b/tools/zsnes/src/chips/sa1regs.asm deleted file mode 100644 index b6e5742..0000000 --- a/tools/zsnes/src/chips/sa1regs.asm +++ /dev/null @@ -1,1370 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - -; SA-1 emulation. Information provided by Ivar of Snes9x. -; coded by zsKnight -; SDD-1 emulation. SDD-1 MMC reverse engineered by zsKnight, -; SDD-1 decompress Dark Force and John Weidman, - - -; - Add MMC support -; - Add end of DMA IRQ support -; - Add Char Conversion #1 -; - Add Char Conversion #2 -; - Add Memory Disables (Guess this isn't needed) -; IRQs - IRQ Clear (also clear 2300), IRQ Disable, and IRQ Enable - -; Mario RPG Level-up not working - it was using one of the IRQ functions -; that no other place in the game is using, which I suppose is the cause -; of the problem, but it's been so long since I worked on SA-1, that -; I forgot which part. - -%include "macros.mac" - -EXTSYM regptr,regptw,romdata,SA1Status,SDD1BankA,NumofBanks,BWUsed2 -EXTSYM Get_Time,Get_TimeDate,irqv2,irqv,nmiv2,nmiv,snesmmap,snesmap2 -EXTSYM curypos,CurrentExecSA1,memaccessbankr8sdd1,memtabler8,AddrNoIncr - -%ifndef NO_DEBUGGER -EXTSYM debuggeron,debstop4 -%endif - -%include "cpu/regs.mac" -%include "cpu/regsw.mac" - -SECTION .data -NEWSYM RTCData, db 0Fh,0,0,0,0,0,0,0,0,0,0,0,0,0,0Fh,0 -NEWSYM RTCPtr, dd 0 -NEWSYM RTCPtr2, dd 0 -NEWSYM RTCRest, dd 0 - -SECTION .text - -RTC2800: - push ebx - cmp dword[RTCRest],100 -; je .go -; inc dword[RTCRest] -; jmp .notfirst -.go - cmp dword[RTCPtr],0 - jne near .notfirst -%ifndef NO_DEBUGGER - cmp byte[debuggeron],1 - je near .notfirst -%endif - ; fill time/date - push ebx - push eax - call Get_Time - mov bl,al - and bl,0Fh - mov [RTCData+1],bl ; seconds - shr eax,4 - mov bl,al - and bl,0Fh - mov [RTCData+2],bl -; jmp .done - shr eax,4 - cmp word[RTCData+1],0 -; jne .notminch - mov bl,al - and bl,0Fh - mov [RTCData+3],bl ; minutes - shr eax,4 - mov bl,al - and bl,0Fh - mov [RTCData+4],bl -.notminch -; jmp .done - shr eax,4 - mov bl,al - and bl,0Fh - mov [RTCData+5],bl ; hours - shr eax,4 - mov bl,al - and bl,0Fh - mov [RTCData+6],bl - call Get_TimeDate - mov bl,al - and bl,0Fh - mov [RTCData+7],bl ; day - shr eax,4 - mov bl,al - and bl,0Fh - mov bl,al - and bl,0Fh - mov [RTCData+8],bl - shr eax,4 - mov bl,al - and bl,0Fh - mov [RTCData+9],bl ; month - shr eax,8 - mov bl,al - and bl,0Fh - mov [RTCData+10],bl ; year - shr eax,4 - mov bl,al - and bl,01Fh - xor bh,bh -.notokay - cmp bl,9 - jbe .okay - inc bh - sub bl,10 - jmp .notokay -.okay - mov [RTCData+11],bl - add bh,9 - mov [RTCData+12],bh - shr eax,8 - and al,0Fh - mov [RTCData+13],al ; day of week -.done - pop eax - pop ebx -.notfirst - mov ebx,[RTCPtr] - mov al,[RTCData+ebx] - inc dword[RTCPtr] - cmp dword[RTCPtr],0Fh - jne .notclear - mov dword[RTCPtr],0 -.notclear - pop ebx - ret - -RTC2801w: -; mov byte[debstop3],1 - mov dword[RTCRest],0 - mov dword[RTCPtr],0 - cmp al,0Eh - jne .notreset - mov dword[RTCPtr2],0 - ret -.notreset - cmp al,0Dh - jne .notstop - mov dword[RTCPtr2],0 - ret -.notstop - push ebx - mov ebx,[RTCPtr2] - cmp ebx,0 - je .next - cmp ebx,13 - ja .nomore - mov [RTCData+ebx],al -.next - inc dword[RTCPtr2] -.nomore - pop ebx - ret - -NEWSYM RTCinit - mov dword[RTCPtr],0 - ret -NEWSYM RTCReset - setreg 2800h*4,RTC2800 - ret -NEWSYM RTCReset2 - setregw 2801h*4,RTC2801w - ret - -; SA-1 Start -; ---------- - -SECTION .data - -; IRQ Stuff -NEWSYM SA1Mode, dd 0 ; 0 = SNES CPU, 1 = SA1 CPU -NEWSYM SA1Control, dd 0 ; don't execute if b5 or 6 are set -NEWSYM SA1BankPtr, dd 0 -NEWSYM SA1ResetV, dd 0 -NEWSYM SA1NMIV, dd 0 -NEWSYM SA1IRQV, dd 0 -NEWSYM SA1RV, dd 0 -NEWSYM CurBWPtr, dd 0 -NEWSYM SA1TempVar, dd 0 -NEWSYM SA1IRQEn, dd 0 -NEWSYM SA1Message, dd 0 -NEWSYM SA1IRQExec, dd 0 -NEWSYM SA1IRQEnable, dd 0 -NEWSYM SA1DoIRQ, dd 0 -; Arithmetic Stuff -NEWSYM SA1ARC, dd 0 -NEWSYM SA1AR1, dd 0 -NEWSYM SA1AR2, dd 0 -NEWSYM SA1ARR1, dd 0 -NEWSYM SA1ARR2,dd 0 -NEWSYM SA1Stat, dd 0 - -NEWSYM SNSNMIV, dd 0 -NEWSYM SNSIRQV, dd 0 -NEWSYM SA1DMACount, dd 0 -NEWSYM SA1DMAInfo, dd 0 -NEWSYM SA1DMAChar, dd 0 -NEWSYM SA1DMASource, dd 0 -NEWSYM SA1DMADest, dd 0 -NEWSYM SA1IRQTemp, dd 0 - -NEWSYM SA1BankSw, dd 1 -NEWSYM SA1BankVal, db 0,1,2,3 - -NEWSYM BWShift, dd 0 -NEWSYM BWAndAddr, dd 0 -NEWSYM BWAnd, dd 0 -NEWSYM BWRAnd, dd 0 - -SA1Reserved times 456 db 0 - - -; SA1 Swap Stuff -NEWSYM SA1xa, dd 0 -NEWSYM SA1xx, dd 0 -NEWSYM SA1xy, dd 0 -NEWSYM SA1xd, dd 0 -NEWSYM SA1xdb, dd 0 -NEWSYM SA1xpb, dd 0 -NEWSYM SA1xs, dd 0 -NEWSYM SA1RegP, dd 0 -NEWSYM SA1RegE, dd 0 -NEWSYM SA1RegPCS,dd 0 -NEWSYM SA1BWPtr,dd 0 -NEWSYM SA1Ptr, dd 0 ; Current PC, SA-1 - -NEWSYM SA1Overflow, dd 0 -NEWSYM VarLenAddr, dd 0 -NEWSYM VarLenAddrB, dd 0 -NEWSYM VarLenBarrel, dd 0 -NEWSYM SA1TimerVal, dd 0 -NEWSYM SA1TimerSet, dd 0 -NEWSYM SA1TimerCount, dd 0 -NEWSYM SA1IRQData, dd 0 - -; SNES Swap Stuff -NEWSYM SNSRegP, dd 0 -NEWSYM SNSRegE, dd 0 -NEWSYM SNSRegPCS,dd 0 -NEWSYM SNSBWPtr,dd 0 -NEWSYM SNSPtr, dd 0 ; Current PC, SNES - -NEWSYM IRAM, times 2049 db 0 ;2 kbytes of iram -num2writesa1reg equ $-SA1Mode -NEWSYM PHnum2writesa1reg, dd num2writesa1reg - -NEWSYM SA1RAMArea, dd 0 -NEWSYM SA1Temp, dd 0 -NEWSYM Sdd1Mode, dd 0 -NEWSYM Sdd1Bank, dd 0 -NEWSYM Sdd1Addr, dd 0 -NEWSYM Sdd1NewAddr, dd 0 - -SECTION .text - -%macro SA1QuickF 2 -NEWSYM %1 - mov [%2],al - ret -%endmacro - -NEWSYM SA1Reset - mov byte[SA1IRQData+1],0 - mov byte[SA1Mode],0 - mov byte[SA1Status],0 - mov byte[SA1Control],20h - mov dword[SA1DoIRQ],0 - mov ax,[irqv2] - mov [irqv],ax - mov ax,[nmiv2] - mov [nmiv],ax - mov eax,[romdata] - sub eax,8000h - mov [SA1RegPCS],eax - mov eax,[romdata] - add eax,4096*1024 - mov [SA1RAMArea],eax - mov eax,[romdata] - add eax,4096*1024-6000h - mov [CurBWPtr],eax - mov [SA1BWPtr],eax - mov [SNSBWPtr],eax - mov dword[SA1xa],0 - mov dword[SA1xx],0 - mov dword[SA1xy],0 - mov dword[SA1xd],0 - mov dword[SA1xdb],0 - mov dword[SA1xpb],0 - mov dword[SA1xs],1FFh - mov dword[SA1RegP],0 - mov dword[SA1RegE],0 - mov dword[SA1IRQExec],0 - mov dword[SA1IRQEnable],0 - mov dword[SA1Message],0 - mov word[SA1Overflow],0 - ret - -%macro BankSwitch 4 - push ecx - push edx - push eax - mov [SA1BankVal+%1],al - mov ebx,snesmmap+%2*4 - test al,80h - jz .noupper - cmp byte[NumofBanks],64 - jne .BSBigBank - and eax,1 -.BSBigBank - and eax,07h - shl eax,20 - push eax - jmp .yesupper -.noupper - cmp byte[NumofBanks],64 - jne .BSBigBank2 - and eax,1 -.BSBigBank2 - and eax,07h - shl eax,20 - push eax - mov eax,%4 -.yesupper - mov ecx,20h - add eax,[romdata] - sub eax,8000h -.mmaploop - mov [ebx],eax - add eax,8000h - add ebx,4 - dec ecx - jnz .mmaploop - pop eax - add eax,[romdata] - mov ecx,10h - mov ebx,snesmap2+%3*4 - mov edx,snesmmap+%3*4 -.mmaploop2 - mov [ebx],eax - mov [edx],eax - add eax,10000h - add ebx,4 - add edx,4 - dec ecx - jnz .mmaploop2 - pop eax - pop edx - pop ecx - ret -%endmacro - -NEWSYM sa12220w - BankSwitch 0,0,0C0h,0 -NEWSYM sa12221w - BankSwitch 1,20h,0D0h,100000h -NEWSYM sa12222w - BankSwitch 2,80h,0E0h,200000h -NEWSYM sa12223w - BankSwitch 3,0A0h,0F0h,300000h - -%macro BankSwitchSDD1 2 - push ecx - push edx - push eax - mov [SDD1BankA+%1],al - and eax,07h - shl eax,20 - add eax,[romdata] - mov ecx,10h - mov ebx,snesmap2+%2*4 - mov edx,snesmmap+%2*4 -.mmaploop2 - mov [ebx],eax - mov [edx],eax - add eax,10000h - add ebx,4 - add edx,4 - dec ecx - jnz .mmaploop2 - pop eax - pop edx - pop ecx - ret -%endmacro - -sdd14804: - mov al,[SDD1BankA] - ret -sdd14805: - mov al,[SDD1BankA+1] - ret -sdd14806: - mov al,[SDD1BankA+2] - ret -sdd14807: - mov al,[SDD1BankA+3] - ret - -NEWSYM sdd14804w - BankSwitchSDD1 0,0C0h -NEWSYM sdd14805w - BankSwitchSDD1 1,0D0h -NEWSYM sdd14806w - BankSwitchSDD1 2,0E0h -NEWSYM sdd14807w - BankSwitchSDD1 3,0F0h - -NEWSYM sa12200w - mov bl,al - and bl,0Fh - mov [SA1Message],bl - test al,80h - jz .noirq - or byte[SA1DoIRQ],1 -.noirq - test al,10h - jz .nonmi - or byte[SA1DoIRQ],2 -.nonmi - test byte[SA1Control],20h - jz .noreset - test al,20h - jnz .noreset - mov [SA1Control],al - mov ebx,[romdata] - mov [SA1BankPtr],ebx - xor ebx,ebx - mov bx,[SA1ResetV] - add ebx,[romdata] - sub ebx,8000h - mov [SA1Ptr],ebx - mov byte[SA1xpb],0 - mov word[SA1xs],1FFh - mov ebx,[romdata] - sub ebx,8000h - mov [SA1RegPCS],ebx - xor ebx,ebx - ret -.noreset - mov [SA1Control],al - ret - -NEWSYM sa12201w ; IRQ Enable - mov [SA1IRQEnable],al - ret -NEWSYM sa12202w ; IRQ Clear - test al,80h - jz .noirqclear - and byte[SA1IRQExec],0FEh - and byte[SA1DoIRQ],0FBh -.noirqclear - test al,20h - jz .nocdmairqclear - and byte[SA1IRQExec],0FDh - and byte[SA1DoIRQ],0F7h -.nocdmairqclear - ret - -SA1QuickF sa12203w, SA1ResetV -SA1QuickF sa12204w, SA1ResetV+1 -SA1QuickF sa12205w, SA1NMIV -SA1QuickF sa12206w, SA1NMIV+1 -SA1QuickF sa12207w, SA1IRQV -SA1QuickF sa12208w, SA1IRQV+1 -NEWSYM sa12209w ; IRQ Stuff - mov [SA1IRQData+1],al - test al,80h - jz .noirq - ; execute IRQ on the SNES - or byte[SA1DoIRQ],4 -.noirq - mov bl,al - and bl,0Fh - mov [SA1Message+1],bl - mov bx,[irqv2] - test al,40h - jz .noirqchange - mov bx,[SNSIRQV] -.noirqchange - mov [irqv],bx - mov bx,[nmiv2] - test al,10h - jz .nonmichange - mov bx,[SNSNMIV] -.nonmichange - mov [nmiv],bx - ret - -SA1QuickF sa1220Aw, SA1IRQEn - -NEWSYM sa1220Bw ; SA-1 IRQ Clear - test al,80h - jz .noirqclear - mov byte[SA1IRQExec+1],0 - and byte[SA1DoIRQ],0FEh -.noirqclear - test al,20h - jz .nocdmairqclear -.nocdmairqclear - test al,10h - jz .nonmiclear - mov byte[SA1IRQExec+2],0 - and byte[SA1DoIRQ],0FDh -.nonmiclear - ret - -SA1QuickF sa1220Cw, SNSNMIV -SA1QuickF sa1220Dw, SNSNMIV+1 -SA1QuickF sa1220Ew, SNSIRQV -SA1QuickF sa1220Fw, SNSIRQV+1 - -NEWSYM sa12224w ; BWRAM - mov bl,al - and ebx,1Fh - shl ebx,13 - add ebx,[romdata] - add ebx,1024*4096-6000h - mov [SNSBWPtr],ebx - cmp byte[SA1Status],0 - jne .nosnes - mov [CurBWPtr],ebx -.nosnes - ret -NEWSYM sa12225w ; BWRAM - mov [BWUsed2],al - test al,80h - jnz .upper - mov bl,al - and ebx,1Fh - shl ebx,13 - add ebx,[romdata] - add ebx,1024*4096-6000h - mov [SA1BWPtr],ebx - cmp byte[SA1Status],0 - je .nosa1b - mov [CurBWPtr],ebx -.nosa1b - mov byte[BWShift],0 - mov byte[BWAndAddr],0 - mov byte[BWAnd],0FFh - mov byte[BWRAnd],0h - ret -.upper - mov bl,al - and ebx,7Fh - test byte[SA1Overflow+1],80h - jz .16col - shl ebx,11 - mov byte[BWShift],2 - mov byte[BWAndAddr],03h - mov byte[BWAnd],03h - mov byte[BWRAnd],0FCh - jmp .4col -.16col - mov byte[BWShift],1 - mov byte[BWAndAddr],01h - mov byte[BWAnd],0Fh - mov byte[BWRAnd],0F0h - and ebx,3Fh - shl ebx,12 -.4col - add ebx,[romdata] - add ebx,1024*4096 - mov [SA1BWPtr],ebx - cmp byte[SA1Status],0 - je .nosa1 - mov [CurBWPtr],ebx -.nosa1 -; mov byte[debstop3],1 - ret -NEWSYM sa12250w - mov [SA1ARC],al - mov byte[SA1ARC+1],1 - test al,2 - jz .notcumul - mov word[SA1ARR1],0 - mov word[SA1ARR1+2],0 - mov word[SA1ARR1+4],0 -.notcumul - ret -NEWSYM sa12251w - mov [SA1AR1],al - mov byte[SA1ARC+1],1 - ret -NEWSYM sa12252w - mov [SA1AR1+1],al - mov byte[SA1ARC+1],1 - ret -NEWSYM sa12253w - mov [SA1AR2],al - mov byte[SA1ARC+1],1 - ret -NEWSYM sa12254w - mov [SA1AR2+1],al - mov byte[SA1ARC+1],1 - test byte[SA1ARC],2 - jnz .cumul - call UpdateArithStuff - ret - ; set overflow bit if exceeds 40bits -.cumul - pushad - xor edx,edx - mov ax,[SA1AR1] - mov bx,[SA1AR2] - imul bx - shl edx,16 - mov dx,ax - mov byte[SA1Overflow],0 - add [SA1ARR1],edx - adc byte[SA1ARR2],0 - jnc .notoverflow - mov byte[SA1Overflow],80h -.notoverflow - popad - ret - -UpdateArithStuff: - cmp byte[SA1ARC+1],1 - jne .noarith - pushad - mov byte[SA1ARC+1],0 - test byte[SA1ARC],3 - jz .multiply - test byte[SA1ARC],2 - jnz near .cumulativesum - test byte[SA1ARC],1 - jnz .division -.multiply - xor edx,edx - mov ax,[SA1AR1] - mov bx,[SA1AR2] - imul bx - mov [SA1ARR1],ax - mov [SA1ARR1+2],dx - popad -.noarith - ret -.division - movsx eax,word[SA1AR1] - xor edx,edx - test eax,80000000h - jz .notneg - mov edx,0FFFFFFFFh -.notneg - xor ebx,ebx - mov bx,[SA1AR2] - or ebx,ebx - jz .invalid - idiv ebx - mov [SA1ARR1],ax - mov [SA1ARR1+2],dx -; mov word[SA1AR1],0 -; mov word[SA1AR2],0 - popad - ret -.invalid - mov word[SA1ARR1],0 - mov word[SA1ARR1+2],0 - popad - ret -.cumulativesum - popad - ret - -sa12300r: - mov al,[SA1Message+1] - test byte[SA1IRQExec],1 - jz .notexecuted - or al,80h -.notexecuted - test byte[SA1IRQExec],2 - jz .notexecutedi - or al,20h -.notexecutedi - mov bl,[SA1IRQData+1] - and bl,50h - or al,bl - ret -sa12301r: - mov al,[SA1Message] - test byte[SA1IRQExec+1],1 - jz .notexecuted - or al,80h -.notexecuted - ret -sa12306r: -; call UpdateArithStuff - mov al,[SA1ARR1] - ret -sa12307r: -; call UpdateArithStuff - mov al,[SA1ARR1+1] - ret -sa12308r: -; call UpdateArithStuff - mov al,[SA1ARR1+2] - ret -sa12309r: -; call UpdateArithStuff - mov al,[SA1ARR1+3] - ret -sa1230Ar: -; call UpdateArithStuff - mov al,[SA1ARR2] - ret -sa1230Br: - mov al,[SA1Overflow] - ret - -NEWSYM IRamRead - mov al,[IRAM+ecx-3000h] - ret - -NEWSYM IRamWrite - mov [IRAM+ecx-3000h],al - ret -NEWSYM IRamWrite2 - mov [IRAM+ecx-3000h],al - xor dh,dh - ret - -NEWSYM sa1223Fw - mov [SA1Overflow+1],al - ret - -; Variable Length Data -NEWSYM sa12258w - mov [VarLenBarrel+2],al - mov bl,al - and bl,0Fh - cmp bl,0 - jne .not0 - mov bl,16 -.not0 - mov [VarLenBarrel+3],bl - test al,80h - jz .notchange - mov [VarLenBarrel],bl - mov [VarLenBarrel+1],bl -.notchange - ret -NEWSYM sa12259w - mov [VarLenAddr],al - mov [VarLenAddrB],al - mov byte[VarLenBarrel],0 - mov byte[VarLenBarrel+1],0 - ret -NEWSYM sa1225Aw - mov [VarLenAddr+1],al - mov [VarLenAddrB+1],al - mov byte[VarLenBarrel],0 - mov byte[VarLenBarrel+1],0 - ret -NEWSYM sa1225Bw - mov [VarLenAddr+2],al - mov [VarLenAddrB+2],al - mov byte[VarLenBarrel],0 - mov byte[VarLenBarrel+1],0 - ret - -; Variable Length Read -NEWSYM sa1230Cr - push ecx - xor ebx,ebx - xor ecx,ecx - mov bl,[VarLenAddr+2] - mov cx,[VarLenAddr] - test ecx,8000h - jz .loweraddr - add ecx,[snesmmap+ebx*4] - jmp .upperaddr -.loweraddr - add ecx,[snesmap2+ebx*4] -.upperaddr - mov ebx,[ecx] - mov cl,[VarLenBarrel+1] - shr ebx,cl - mov al,bl - pop ecx - test byte[VarLenBarrel+2],80h - jnz .autoinc - ret -.autoinc - mov bl,[VarLenBarrel+3] - add [VarLenBarrel],bl - mov bl,[VarLenBarrel] - cmp bl,16 - jbe .notover - sub byte[VarLenBarrel],16 - add dword[VarLenAddr],2 - mov byte[VarLenAddr+3],0 -.notover - ret - -NEWSYM sa1230Dr - push ecx - xor ebx,ebx - xor ecx,ecx - mov bl,[VarLenAddrB+2] - mov cx,[VarLenAddrB] - test ecx,8000h - jz .loweraddr - add ecx,[snesmmap+ebx*4] - jmp .upperaddr -.loweraddr - add ecx,[snesmap2+ebx*4] -.upperaddr - mov ebx,[ecx] - mov cl,[VarLenBarrel+1] - shr ebx,cl - mov al,bh - pop ecx - test byte[VarLenBarrel+2],80h - jnz .autoinc - ret -.autoinc - mov bl,[VarLenBarrel+3] - add [VarLenBarrel+1],bl - mov bl,[VarLenBarrel+1] - cmp bl,16 - jbe .notover - sub byte[VarLenBarrel+1],16 - add dword[VarLenAddrB],2 - mov byte[VarLenAddrB+3],0 -.notover - ret - -NEWSYM sa1230Er - mov al,10h - ret - -; Approximate H loc -NEWSYM sa12302r - test byte[SA1TimerSet],80h - jnz .timeron - mov al,[CurrentExecSA1] - shl al,2 - add al,dh - ret -.timeron - mov al,[SA1TimerCount] - ret -NEWSYM sa12303r - test byte[SA1TimerSet],80h - jnz .timeron - mov al,[CurrentExecSA1] - shr al,3 - ret -.timeron - mov al,[SA1TimerCount+1] - and al,1 - ret -NEWSYM sa12304r - test byte[SA1TimerSet],80h - jnz .timeron - mov al,[curypos] - ret -.timeron - mov bx,[SA1TimerCount+1] - shr bx,1 - mov al,bl - ret -NEWSYM sa12305r - test byte[SA1TimerSet],80h - jnz .timeron - mov al,[curypos+1] - ret -.timeron - mov bx,[SA1TimerCount+2] - shr bx,1 - mov al,bl - and al,1 - ret - -NEWSYM sa12210w ; Timer Settings - mov [SA1TimerSet],al - ret -NEWSYM sa12211w ; Timer Clear - mov dword[SA1TimerVal],0 - ret -NEWSYM sa12212w - mov [SA1TimerCount],al - ret -NEWSYM sa12213w - mov [SA1TimerCount+1],al - ret -NEWSYM sa12214w - mov [SA1TimerCount+2],al - ret -NEWSYM sa12215w - mov [SA1TimerCount+3],al - ret - -NEWSYM sa12230w - mov [SA1DMAInfo],al - ret -NEWSYM sa12231w - mov [SA1DMAChar],al - ; if b7=1, then end of chdma process - ret -SA1QuickF sa12232w, SA1DMASource -SA1QuickF sa12233w, SA1DMASource+1 -SA1QuickF sa12234w, SA1DMASource+2 -SA1QuickF sa12235w, SA1DMADest -NEWSYM sa12236w - mov [SA1DMADest+1],al - test byte[SA1DMAInfo],10h - jnz near sa1chconv - test byte[SA1DMAInfo],4 - jnz .noiram - jmp sa1dmairam -.noiram - ret -NEWSYM sa12237w - mov [SA1DMADest+2],al - test byte[SA1DMAInfo],10h - jnz .nobwram - test byte[SA1DMAInfo],4 - jz .nobwram - jmp sa1dmabwram -.nobwram - ret -NEWSYM sa12238w - mov [SA1DMACount],al - ret -NEWSYM sa12239w - mov [SA1DMACount+1],al - ret - -SECTION .bss -NEWSYM sa1dmaptr, resd 1 -NEWSYM sa1dmaptrs, resd 1 - -SECTION .text - -NEWSYM sa1dmairam - mov ebx,[SA1DMADest] - and ebx,7FFh - add ebx,IRAM - mov [sa1dmaptr],ebx - jmp executesa1dma -NEWSYM sa1dmabwram - mov ebx,[SA1DMADest] - and ebx,3FFFFh - add ebx,[SA1RAMArea] - mov [sa1dmaptr],ebx -executesa1dma: - test byte[SA1DMAInfo],1 - jz .nobwram - mov ebx,[SA1DMASource] - and ebx,3FFFFh - add ebx,[SA1RAMArea] - mov [sa1dmaptrs],ebx - jmp .doneram -.nobwram - test byte[SA1DMAInfo],2 - jz .noiram - mov ebx,[SA1DMASource] - and ebx,7FFh - add ebx,IRAM - mov [sa1dmaptrs],ebx - jmp .doneram -.noiram - xor ebx,ebx - mov bl,[SA1DMASource+2] - mov ebx,[snesmmap+ebx*4] - push ecx - xor ecx,ecx - mov cx,[SA1DMASource] - add ebx,ecx - mov [sa1dmaptrs],ebx - pop ecx -.doneram - push edx - push eax - push ecx - mov ecx,[SA1DMACount] - or ecx,ecx - jz .notransfer - mov ebx,[sa1dmaptrs] - mov edx,[sa1dmaptr] -.loop - mov al,[ebx] - mov [edx],al - inc ebx - inc edx - dec ecx - jnz .loop -.notransfer - pop ecx - pop eax - pop edx - ret - -SECTION .bss -tempblah resb 1 - -SECTION .text - -%macro setbit2b 2 - test al,%1 - jz %%nosb - or word[ebx],%2 -%%nosb -%endmacro - -%macro setbit2b2 2 - test al,%1 - jz %%nosb - or word[ebx+16],%2 -%%nosb -%endmacro - -; Character Conversion DMA -sa1chconv: -; or byte[SA1DoIRQ],4 - or byte[SA1DoIRQ],8 -; mov byte[debstop3],1 - - - mov ebx,[SA1DMADest] -%ifndef NO_DEBUGGER - mov byte[debstop4],1 -%endif -; and ebx,7FFh - and ebx,3FFFFh - add ebx,[SA1RAMArea] - mov [sa1dmaptr],ebx - mov ebx,[SA1DMASource] - and ebx,3FFFFh - add ebx,[SA1RAMArea] - mov [sa1dmaptrs],ebx - ; 4 colors = 32 bytes, 16 colors = 64 bytes, 256 colors = 128 bytes - ; SA1DMAChar,bit 2-4 = # of 8x8 tiles/horizontal row (0=1,1=2,2=3,..,5=32) - ; SA1DMAChar,bit 0-1 = Color Mode (0=8b,1=4b,2=2b,3=?) - test byte[SA1DMAChar],1 - jnz .4bit - test byte[SA1DMAChar],2 - jnz near .2bit - mov ebx,[sa1dmaptr] - push ecx - pop ecx - ret -.4bit - pushad - mov edx,[sa1dmaptrs] - mov ebx,[romdata] - add ebx,4096*1024+1024*1024 - mov edi,16 -.loop34b - push ebx - push edx - mov ecx,32 -.loop4b - mov esi,8 - push ebx - push edx -.loop24b - mov word[ebx],0 - mov al,[edx+3] - setbit2b 10h,0001h - setbit2b 20h,0100h - setbit2b2 40h,0001h - setbit2b2 80h,0100h - setbit2b 01h,0002h - setbit2b 02h,0200h - setbit2b2 04h,0002h - setbit2b2 08h,0200h - mov al,[edx+2] - setbit2b 10h,0004h - setbit2b 20h,0400h - setbit2b2 40h,0004h - setbit2b2 80h,0400h - setbit2b 01h,0008h - setbit2b 02h,0800h - setbit2b2 04h,0008h - setbit2b2 08h,0800h - mov al,[edx+1] - setbit2b 10h,0010h - setbit2b 20h,1000h - setbit2b2 40h,0010h - setbit2b2 80h,1000h - setbit2b 01h,0020h - setbit2b 02h,2000h - setbit2b2 04h,0020h - setbit2b2 08h,2000h - mov al,[edx] - setbit2b 10h,0040h - setbit2b 20h,4000h - setbit2b2 40h,0040h - setbit2b2 80h,4000h - setbit2b 01h,0080h - setbit2b 02h,8000h - setbit2b2 04h,0080h - setbit2b2 08h,8000h - add ebx,2 - add edx,128 - dec esi - jnz near .loop24b - pop edx - pop ebx - add edx,4 - add ebx,32 - dec ecx - jnz near .loop4b - pop edx - pop ebx - add edx,128*8 - add ebx,128*8 - dec edi - jnz near .loop34b - - mov ecx,10*128*8 - mov edx,[sa1dmaptrs] - mov ebx,[romdata] - add ebx,4096*1024+1024*1024 -.next4b - mov al,[ebx] - mov [edx],al - inc ebx - inc edx - dec ecx - jnz .next4b - - popad - ret - -.2bit - pushad - mov edx,[sa1dmaptrs] - mov ebx,[romdata] - add ebx,4096*1024+1024*1024 - mov edi,16 -.loop3 - push ebx - push edx - mov ecx,32 -.loop - mov esi,8 - push ebx - push edx -.loop2 - mov word[ebx],0 - mov al,[edx+1] - setbit2b 40h,0001h - setbit2b 80h,0100h - setbit2b 10h,0002h - setbit2b 20h,0200h - setbit2b 04h,0004h - setbit2b 08h,0400h - setbit2b 01h,0008h - setbit2b 02h,0800h - mov al,[edx] - setbit2b 40h,0010h - setbit2b 80h,1000h - setbit2b 10h,0020h - setbit2b 20h,2000h - setbit2b 04h,0040h - setbit2b 08h,4000h - setbit2b 01h,0080h - setbit2b 02h,8000h - add ebx,2 - add edx,64 - dec esi - jnz near .loop2 - pop edx - pop ebx - add edx,2 - add ebx,16 - dec ecx - jnz near .loop - pop edx - pop ebx - add edx,64*8 - add ebx,64*8 - dec edi - jnz near .loop3 - - mov ecx,10*64*8 - mov edx,[sa1dmaptrs] - mov ebx,[romdata] - add ebx,4096*1024+1024*1024 -.next - mov al,[ebx] - mov [edx],al - inc ebx - inc edx - dec ecx - jnz .next - - popad - ret -SECTION .bss -.numrows resd 1 - -SECTION .text - -NEWSYM initSA1regs - setreg 2300h*4,sa12300r - setreg 2301h*4,sa12301r - setreg 2302h*4,sa12302r - setreg 2303h*4,sa12303r - setreg 2304h*4,sa12304r - setreg 2305h*4,sa12305r - setreg 2306h*4,sa12306r - setreg 2307h*4,sa12307r - setreg 2308h*4,sa12308r - setreg 2309h*4,sa12309r - setreg 230Ah*4,sa1230Ar - setreg 230Bh*4,sa1230Br - setreg 230Ch*4,sa1230Cr - setreg 230Dh*4,sa1230Dr - setreg 230Eh*4,sa1230Er - ; Set IRam, memory address 3000-37FF - - mov edi,3000h*4 - add edi,[regptr] - mov eax,IRamRead - mov ecx,800h -.loopr - mov [edi],eax - add edi,4 - dec ecx - jnz .loopr - ret - -NEWSYM initSA1regsw - setregw 2200h*4,sa12200w - setregw 2201h*4,sa12201w - setregw 2202h*4,sa12202w - setregw 2203h*4,sa12203w - setregw 2204h*4,sa12204w - setregw 2205h*4,sa12205w - setregw 2206h*4,sa12206w - setregw 2207h*4,sa12207w - setregw 2208h*4,sa12208w - setregw 2209h*4,sa12209w - setregw 220Ah*4,sa1220Aw - setregw 220Bh*4,sa1220Bw - setregw 220Ch*4,sa1220Cw - setregw 220Dh*4,sa1220Dw - setregw 220Eh*4,sa1220Ew - setregw 220Fh*4,sa1220Fw - setregw 2210h*4,sa12210w - setregw 2211h*4,sa12211w - setregw 2212h*4,sa12212w - setregw 2213h*4,sa12213w - setregw 2214h*4,sa12214w - setregw 2215h*4,sa12215w - - setregw 2220h*4,sa12220w - setregw 2221h*4,sa12221w - setregw 2222h*4,sa12222w - setregw 2223h*4,sa12223w - - setregw 2224h*4,sa12224w - setregw 2225h*4,sa12225w - ; Missing 2226-222A - ; Missing 2240-224F (Bitmap register file) - - setregw 2230h*4,sa12230w - setregw 2231h*4,sa12231w - setregw 2232h*4,sa12232w - setregw 2233h*4,sa12233w - setregw 2234h*4,sa12234w - setregw 2235h*4,sa12235w - setregw 2236h*4,sa12236w - setregw 2237h*4,sa12237w - setregw 2238h*4,sa12238w - setregw 2239h*4,sa12239w - setregw 223Fh*4,sa1223Fw - - setregw 2250h*4,sa12250w - setregw 2251h*4,sa12251w - setregw 2252h*4,sa12252w - setregw 2253h*4,sa12253w - setregw 2254h*4,sa12254w - - setregw 2259h*4,sa12259w - setregw 225Ah*4,sa1225Aw - setregw 225Bh*4,sa1225Bw - - mov edi,3000h*4 - add edi,[regptw] - mov eax,IRamWrite - mov ecx,800h -.loopw - mov [edi],eax - add edi,4 - dec ecx - jnz .loopw - setregw 3000h*4,IRamWrite2 - ret - -NEWSYM SDD1Reset - setregw 4801h*4,sdd14801w - setregw 4802h*4,dbstop - setregw 4803h*4,dbstop - setregw 4804h*4,sdd14804w - setregw 4805h*4,sdd14805w - setregw 4806h*4,sdd14806w - setregw 4807h*4,sdd14807w - setregw 4808h*4,dbstop - setregw 4809h*4,dbstop - setregw 480Ah*4,dbstop - setregw 480Bh*4,dbstop - setregw 480Ch*4,dbstop - setregw 480Dh*4,dbstop - setregw 480Eh*4,dbstop - setregw 480Fh*4,dbstop - ret - -NEWSYM initSDD1regs - setreg 4804h*4,sdd14804 - setreg 4805h*4,sdd14805 - setreg 4806h*4,sdd14806 - setreg 4807h*4,sdd14807 - ret - -dbstop: -; mov byte[debstop3],1 - ret - -NEWSYM sdd14801w - cmp al,0 - jne .notzero - ret -.notzero - mov byte[AddrNoIncr],0 - ; set banks C0h-FFh to decompressing routine - push eax - push ebx - mov eax,memtabler8+0C0h*4 - mov ebx,40h -.loop - mov dword[eax],memaccessbankr8sdd1 - add eax,4 - dec ebx - jnz .loop - mov dword[Sdd1Mode],1 - pop ebx - pop eax - ret \ No newline at end of file diff --git a/tools/zsnes/src/chips/sdd1emu.c b/tools/zsnes/src/chips/sdd1emu.c deleted file mode 100644 index a365fa4..0000000 --- a/tools/zsnes/src/chips/sdd1emu.c +++ /dev/null @@ -1,271 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - -/******************************************************************************* - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman -*******************************************************************************/ -/* S-DD1 decompressor - * - * Based on code and documentation by Andreas Naive, who deserves a great deal - * of thanks and credit for figuring this out. - * - * Andreas says: - * The author is greatly indebted with The Dumper, without whose help and - * patience providing him with real S-DD1 data the research had never been - * possible. He also wish to note that in the very beggining of his research, - * Neviksti had done some steps in the right direction. By last, the author is - * indirectly indebted to all the people that worked and contributed in the - * S-DD1 issue in the past. - */ - -#include - -#ifndef __GNUC__ -#define INLINE -#else -#define INLINE static inline -#endif - -static int valid_bits; -static unsigned short in_stream; -static unsigned char *in_buf; -static unsigned char bit_ctr[8]; -static unsigned char context_states[32]; -static int context_MPS[32]; -static int bitplane_type; -static int high_context_bits; -static int low_context_bits; -static int prev_bits[8]; - -static struct { - unsigned char code_size; - unsigned char MPS_next; - unsigned char LPS_next; -} evolution_table[] = { - /* 0 */ { 0,25,25}, - /* 1 */ { 0, 2, 1}, - /* 2 */ { 0, 3, 1}, - /* 3 */ { 0, 4, 2}, - /* 4 */ { 0, 5, 3}, - /* 5 */ { 1, 6, 4}, - /* 6 */ { 1, 7, 5}, - /* 7 */ { 1, 8, 6}, - /* 8 */ { 1, 9, 7}, - /* 9 */ { 2,10, 8}, - /* 10 */ { 2,11, 9}, - /* 11 */ { 2,12,10}, - /* 12 */ { 2,13,11}, - /* 13 */ { 3,14,12}, - /* 14 */ { 3,15,13}, - /* 15 */ { 3,16,14}, - /* 16 */ { 3,17,15}, - /* 17 */ { 4,18,16}, - /* 18 */ { 4,19,17}, - /* 19 */ { 5,20,18}, - /* 20 */ { 5,21,19}, - /* 21 */ { 6,22,20}, - /* 22 */ { 6,23,21}, - /* 23 */ { 7,24,22}, - /* 24 */ { 7,24,23}, - /* 25 */ { 0,26, 1}, - /* 26 */ { 1,27, 2}, - /* 27 */ { 2,28, 4}, - /* 28 */ { 3,29, 8}, - /* 29 */ { 4,30,12}, - /* 30 */ { 5,31,16}, - /* 31 */ { 6,32,18}, - /* 32 */ { 7,24,22} -}; - -static unsigned char run_table[128] = { - 128, 64, 96, 32, 112, 48, 80, 16, 120, 56, 88, 24, 104, 40, 72, - 8, 124, 60, 92, 28, 108, 44, 76, 12, 116, 52, 84, 20, 100, 36, - 68, 4, 126, 62, 94, 30, 110, 46, 78, 14, 118, 54, 86, 22, 102, - 38, 70, 6, 122, 58, 90, 26, 106, 42, 74, 10, 114, 50, 82, 18, - 98, 34, 66, 2, 127, 63, 95, 31, 111, 47, 79, 15, 119, 55, 87, - 23, 103, 39, 71, 7, 123, 59, 91, 27, 107, 43, 75, 11, 115, 51, - 83, 19, 99, 35, 67, 3, 125, 61, 93, 29, 109, 45, 77, 13, 117, - 53, 85, 21, 101, 37, 69, 5, 121, 57, 89, 25, 105, 41, 73, 9, - 113, 49, 81, 17, 97, 33, 65, 1 -}; - -INLINE unsigned char GetCodeword(int bits){ - unsigned char tmp; - - if(!valid_bits){ - in_stream|=*(in_buf++); - valid_bits=8; - } - in_stream<<=1; - valid_bits--; - in_stream^=0x8000; - if(in_stream&0x8000) return 0x80+(1<>8) | (0x7f>>bits); - in_stream<<=bits; - valid_bits-=bits; - if(valid_bits<0){ - in_stream |= (*(in_buf++))<<(-valid_bits); - valid_bits+=8; - } - return run_table[tmp]; -} - -INLINE unsigned char GolombGetBit(int code_size){ - if(!bit_ctr[code_size]) bit_ctr[code_size]=GetCodeword(code_size); - bit_ctr[code_size]--; - if(bit_ctr[code_size]==0x80){ - bit_ctr[code_size]=0; - return 2; /* secret code for 'last zero'. ones are always last. */ - } - return (bit_ctr[code_size]==0)?1:0; -} - -INLINE unsigned char ProbGetBit(unsigned char context){ - unsigned char state=context_states[context]; - unsigned char bit=GolombGetBit(evolution_table[state].code_size); - - if(bit&1){ - context_states[context]=evolution_table[state].LPS_next; - if(state<2){ - context_MPS[context]^=1; - return context_MPS[context]; /* just inverted, so just return it */ - } else{ - return context_MPS[context]^1; /* we know bit is 1, so use a constant */ - } - } else if(bit){ - context_states[context]=evolution_table[state].MPS_next; - /* zero here, zero there, no difference so drop through. */ - } - return context_MPS[context]; /* we know bit is 0, so don't bother xoring */ -} - -INLINE unsigned char GetBit(unsigned char cur_bitplane){ - unsigned char bit; - - bit=ProbGetBit(((cur_bitplane&1)<<4) - | ((prev_bits[cur_bitplane]&high_context_bits)>>5) - | (prev_bits[cur_bitplane]&low_context_bits)); - - prev_bits[cur_bitplane] <<= 1; - prev_bits[cur_bitplane] |= bit; - return bit; -} - -static unsigned char cur_plane; -static unsigned char num_bits; -static unsigned char next_byte; - -void SDD1_init(unsigned char *in){ - bitplane_type=in[0]>>6; - - switch(in[0]&0x30){ - case 0x00: - high_context_bits=0x01c0; - low_context_bits =0x0001; - break; - case 0x10: - high_context_bits=0x0180; - low_context_bits =0x0001; - break; - case 0x20: - high_context_bits=0x00c0; - low_context_bits =0x0001; - break; - case 0x30: - high_context_bits=0x0180; - low_context_bits =0x0003; - break; - } - - in_stream=(in[0]<<11) | (in[1]<<3); - valid_bits=5; - in_buf=in+2; - memset(bit_ctr, 0, sizeof(bit_ctr)); - memset(context_states, 0, sizeof(context_states)); - memset(context_MPS, 0, sizeof(context_MPS)); - memset(prev_bits, 0, sizeof(prev_bits)); - - cur_plane=0; - num_bits=0; -} - -unsigned char SDD1_get_byte(void){ - unsigned char bit; - unsigned char byte=0; - - switch(bitplane_type){ - case 0: - num_bits+=16; - if(num_bits&16){ - next_byte=0; - for(bit=0x80; bit; bit>>=1){ - if(GetBit(0)) byte |= bit; - if(GetBit(1)) next_byte |= bit; - } - return byte; - } else { - return next_byte; - } - - case 1: - num_bits+=16; - if(num_bits&16){ - next_byte=0; - for(bit=0x80; bit; bit>>=1){ - if(GetBit(cur_plane)) byte |= bit; - if(GetBit(cur_plane+1)) next_byte |= bit; - } - return byte; - } else { - if(!num_bits) cur_plane = (cur_plane+2)&7; - return next_byte; - } - - case 2: - num_bits+=16; - if(num_bits&16){ - next_byte=0; - for(bit=0x80; bit; bit>>=1){ - if(GetBit(cur_plane)) byte |= bit; - if(GetBit(cur_plane+1)) next_byte |= bit; - } - return byte; - } else { - if(!num_bits) cur_plane ^= 2; - return next_byte; - } - - case 3: - for(cur_plane=0, bit=1; bit; bit<<=1, cur_plane++){ - if(GetBit(cur_plane)) byte |= bit; - } - return byte; - - default: - /* should never happen */ - return 0; - } -} - - diff --git a/tools/zsnes/src/chips/seta10.c b/tools/zsnes/src/chips/seta10.c deleted file mode 100644 index a7d95d0..0000000 --- a/tools/zsnes/src/chips/seta10.c +++ /dev/null @@ -1,566 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -//http://users.tpg.com.au/trauma/dsp/st010.html - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#else -#include //sqrt() -#include //abs() -#endif - -#define SRAM setaramdata - -extern unsigned char *setaramdata; -void ST010DoCommand(void); - -//C++ style code in C -#define bool unsigned char -#define true 1 -#define false 0 - -typedef signed char int8; -typedef unsigned char uint8; -typedef short int16; -typedef unsigned short uint16; -typedef int int32; -typedef unsigned int uint32; - -// Mode 7 scaling constants for all raster lines -const int16 ST010_M7Scale[176] = { - 0x0380, 0x0325, 0x02da, 0x029c, 0x0268, 0x023b, 0x0215, 0x01f3, - 0x01d5, 0x01bb, 0x01a3, 0x018e, 0x017b, 0x016a, 0x015a, 0x014b, - 0x013e, 0x0132, 0x0126, 0x011c, 0x0112, 0x0109, 0x0100, 0x00f8, - 0x00f0, 0x00e9, 0x00e3, 0x00dc, 0x00d6, 0x00d1, 0x00cb, 0x00c6, - 0x00c1, 0x00bd, 0x00b8, 0x00b4, 0x00b0, 0x00ac, 0x00a8, 0x00a5, - 0x00a2, 0x009e, 0x009b, 0x0098, 0x0095, 0x0093, 0x0090, 0x008d, - 0x008b, 0x0088, 0x0086, 0x0084, 0x0082, 0x0080, 0x007e, 0x007c, - 0x007a, 0x0078, 0x0076, 0x0074, 0x0073, 0x0071, 0x006f, 0x006e, - 0x006c, 0x006b, 0x0069, 0x0068, 0x0067, 0x0065, 0x0064, 0x0063, - 0x0062, 0x0060, 0x005f, 0x005e, 0x005d, 0x005c, 0x005b, 0x005a, - 0x0059, 0x0058, 0x0057, 0x0056, 0x0055, 0x0054, 0x0053, 0x0052, - 0x0051, 0x0051, 0x0050, 0x004f, 0x004e, 0x004d, 0x004d, 0x004c, - 0x004b, 0x004b, 0x004a, 0x0049, 0x0048, 0x0048, 0x0047, 0x0047, - 0x0046, 0x0045, 0x0045, 0x0044, 0x0044, 0x0043, 0x0042, 0x0042, - 0x0041, 0x0041, 0x0040, 0x0040, 0x003f, 0x003f, 0x003e, 0x003e, - 0x003d, 0x003d, 0x003c, 0x003c, 0x003b, 0x003b, 0x003a, 0x003a, - 0x003a, 0x0039, 0x0039, 0x0038, 0x0038, 0x0038, 0x0037, 0x0037, - 0x0036, 0x0036, 0x0036, 0x0035, 0x0035, 0x0035, 0x0034, 0x0034, - 0x0034, 0x0033, 0x0033, 0x0033, 0x0032, 0x0032, 0x0032, 0x0031, - 0x0031, 0x0031, 0x0030, 0x0030, 0x0030, 0x0030, 0x002f, 0x002f, - 0x002f, 0x002e, 0x002e, 0x002e, 0x002e, 0x002d, 0x002d, 0x002d, - 0x002d, 0x002c, 0x002c, 0x002c, 0x002c, 0x002b, 0x002b, 0x002b -}; - -const int16 ST010_SinTable[256] = { - 0x0000, 0x0324, 0x0648, 0x096a, 0x0c8c, 0x0fab, 0x12c8, 0x15e2, - 0x18f9, 0x1c0b, 0x1f1a, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11, - 0x30fb, 0x33df, 0x36ba, 0x398c, 0x3c56, 0x3f17, 0x41ce, 0x447a, - 0x471c, 0x49b4, 0x4c3f, 0x4ebf, 0x5133, 0x539b, 0x55f5, 0x5842, - 0x5a82, 0x5cb3, 0x5ed7, 0x60eb, 0x62f1, 0x64e8, 0x66cf, 0x68a6, - 0x6a6d, 0x6c23, 0x6dc9, 0x6f5e, 0x70e2, 0x7254, 0x73b5, 0x7504, - 0x7641, 0x776b, 0x7884, 0x7989, 0x7a7c, 0x7b5c, 0x7c29, 0x7ce3, - 0x7d89, 0x7e1d, 0x7e9c, 0x7f09, 0x7f61, 0x7fa6, 0x7fd8, 0x7ff5, - 0x7fff, 0x7ff5, 0x7fd8, 0x7fa6, 0x7f61, 0x7f09, 0x7e9c, 0x7e1d, - 0x7d89, 0x7ce3, 0x7c29, 0x7b5c, 0x7a7c, 0x7989, 0x7884, 0x776b, - 0x7641, 0x7504, 0x73b5, 0x7254, 0x70e2, 0x6f5e, 0x6dc9, 0x6c23, - 0x6a6d, 0x68a6, 0x66cf, 0x64e8, 0x62f1, 0x60eb, 0x5ed7, 0x5cb3, - 0x5a82, 0x5842, 0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, - 0x471c, 0x447a, 0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33df, - 0x30fb, 0x2e11, 0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f1a, 0x1c0b, - 0x18f8, 0x15e2, 0x12c8, 0x0fab, 0x0c8c, 0x096a, 0x0648, 0x0324, - 0x0000, -0x0324, -0x0648, -0x096b, -0x0c8c, -0x0fab, -0x12c8, -0x15e2, - -0x18f9, -0x1c0b, -0x1f1a, -0x2223, -0x2528, -0x2826, -0x2b1f, -0x2e11, - -0x30fb, -0x33df, -0x36ba, -0x398d, -0x3c56, -0x3f17, -0x41ce, -0x447a, - -0x471c, -0x49b4, -0x4c3f, -0x4ebf, -0x5133, -0x539b, -0x55f5, -0x5842, - -0x5a82, -0x5cb3, -0x5ed7, -0x60ec, -0x62f1, -0x64e8, -0x66cf, -0x68a6, - -0x6a6d, -0x6c23, -0x6dc9, -0x6f5e, -0x70e2, -0x7254, -0x73b5, -0x7504, - -0x7641, -0x776b, -0x7884, -0x7989, -0x7a7c, -0x7b5c, -0x7c29, -0x7ce3, - -0x7d89, -0x7e1d, -0x7e9c, -0x7f09, -0x7f61, -0x7fa6, -0x7fd8, -0x7ff5, - -0x7fff, -0x7ff5, -0x7fd8, -0x7fa6, -0x7f61, -0x7f09, -0x7e9c, -0x7e1d, - -0x7d89, -0x7ce3, -0x7c29, -0x7b5c, -0x7a7c, -0x7989, -0x7883, -0x776b, - -0x7641, -0x7504, -0x73b5, -0x7254, -0x70e2, -0x6f5e, -0x6dc9, -0x6c23, - -0x6a6d, -0x68a6, -0x66cf, -0x64e8, -0x62f1, -0x60eb, -0x5ed7, -0x5cb3, - -0x5a82, -0x5842, -0x55f5, -0x539a, -0x5133, -0x4ebf, -0x4c3f, -0x49b3, - -0x471c, -0x447a, -0x41cd, -0x3f17, -0x3c56, -0x398c, -0x36b9, -0x33de, - -0x30fb, -0x2e10, -0x2b1f, -0x2826, -0x2527, -0x2223, -0x1f19, -0x1c0b, - -0x18f8, -0x15e2, -0x12c8, -0x0fab, -0x0c8b, -0x096a, -0x0647, -0x0324}; - -const unsigned char ST010_ArcTan[32][32] = { - { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}, - { 0x80, 0xa0, 0xad, 0xb3, 0xb6, 0xb8, 0xb9, 0xba, 0xbb, 0xbb, 0xbc, 0xbc, 0xbd, 0xbd, 0xbd, 0xbd, - 0xbd, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbf, 0xbf, 0xbf, 0xbf}, - { 0x80, 0x93, 0xa0, 0xa8, 0xad, 0xb0, 0xb3, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xb9, 0xba, 0xba, 0xbb, - 0xbb, 0xbb, 0xbb, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd}, - { 0x80, 0x8d, 0x98, 0xa0, 0xa6, 0xaa, 0xad, 0xb0, 0xb1, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb7, 0xb8, - 0xb8, 0xb9, 0xb9, 0xba, 0xba, 0xba, 0xba, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbc, 0xbc, 0xbc, 0xbc}, - { 0x80, 0x8a, 0x93, 0x9a, 0xa0, 0xa5, 0xa8, 0xab, 0xad, 0xaf, 0xb0, 0xb2, 0xb3, 0xb4, 0xb5, 0xb5, - 0xb6, 0xb7, 0xb7, 0xb8, 0xb8, 0xb8, 0xb9, 0xb9, 0xb9, 0xba, 0xba, 0xba, 0xba, 0xba, 0xbb, 0xbb}, - { 0x80, 0x88, 0x90, 0x96, 0x9b, 0xa0, 0xa4, 0xa7, 0xa9, 0xab, 0xad, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, - 0xb4, 0xb4, 0xb5, 0xb6, 0xb6, 0xb6, 0xb7, 0xb7, 0xb8, 0xb8, 0xb8, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9}, - { 0x80, 0x87, 0x8d, 0x93, 0x98, 0x9c, 0xa0, 0xa3, 0xa6, 0xa8, 0xaa, 0xac, 0xad, 0xae, 0xb0, 0xb0, - 0xb1, 0xb2, 0xb3, 0xb4, 0xb4, 0xb5, 0xb5, 0xb6, 0xb6, 0xb6, 0xb7, 0xb7, 0xb7, 0xb8, 0xb8, 0xb8}, - { 0x80, 0x86, 0x8b, 0x90, 0x95, 0x99, 0x9d, 0xa0, 0xa3, 0xa5, 0xa7, 0xa9, 0xaa, 0xac, 0xad, 0xae, - 0xaf, 0xb0, 0xb1, 0xb2, 0xb2, 0xb3, 0xb3, 0xb4, 0xb4, 0xb5, 0xb5, 0xb6, 0xb6, 0xb6, 0xb7, 0xb7}, - { 0x80, 0x85, 0x8a, 0x8f, 0x93, 0x97, 0x9a, 0x9d, 0xa0, 0xa2, 0xa5, 0xa6, 0xa8, 0xaa, 0xab, 0xac, - 0xad, 0xae, 0xaf, 0xb0, 0xb0, 0xb1, 0xb2, 0xb2, 0xb3, 0xb3, 0xb4, 0xb4, 0xb5, 0xb5, 0xb5, 0xb5}, - { 0x80, 0x85, 0x89, 0x8d, 0x91, 0x95, 0x98, 0x9b, 0x9e, 0xa0, 0xa0, 0xa4, 0xa6, 0xa7, 0xa9, 0xaa, - 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb0, 0xb1, 0xb1, 0xb2, 0xb2, 0xb3, 0xb3, 0xb4, 0xb4, 0xb4}, - { 0x80, 0x84, 0x88, 0x8c, 0x90, 0x93, 0x96, 0x99, 0x9b, 0x9e, 0xa0, 0xa2, 0xa4, 0xa5, 0xa7, 0xa8, - 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xaf, 0xb0, 0xb0, 0xb1, 0xb2, 0xb2, 0xb2, 0xb3, 0xb3}, - { 0x80, 0x84, 0x87, 0x8b, 0x8e, 0x91, 0x94, 0x97, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2, 0xa3, 0xa5, 0xa6, - 0xa7, 0xa9, 0xaa, 0xab, 0xac, 0xac, 0xad, 0xae, 0xae, 0xaf, 0xb0, 0xb0, 0xb1, 0xb1, 0xb2, 0xb2}, - { 0x80, 0x83, 0x87, 0x8a, 0x8d, 0x90, 0x93, 0x96, 0x98, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2, 0xa3, 0xa5, - 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xac, 0xad, 0xae, 0xae, 0xaf, 0xb0, 0xb0, 0xb0, 0xb1}, - { 0x80, 0x83, 0x86, 0x89, 0x8c, 0x8f, 0x92, 0x94, 0x96, 0x99, 0x9b, 0x9d, 0x9e, 0xa0, 0xa2, 0xa3, - 0xa4, 0xa5, 0xa7, 0xa8, 0xa9, 0xa9, 0xaa, 0xab, 0xac, 0xac, 0xad, 0xae, 0xae, 0xaf, 0xaf, 0xb0}, - { 0x80, 0x83, 0x86, 0x89, 0x8b, 0x8e, 0x90, 0x93, 0x95, 0x97, 0x99, 0x9b, 0x9d, 0x9e, 0xa0, 0xa1, - 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xaa, 0xab, 0xac, 0xad, 0xad, 0xae, 0xae, 0xaf}, - { 0x80, 0x83, 0x85, 0x88, 0x8b, 0x8d, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9b, 0x9d, 0x9f, 0xa0, - 0xa1, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa8, 0xa9, 0xaa, 0xab, 0xab, 0xac, 0xad, 0xad, 0xae}, - { 0x80, 0x83, 0x85, 0x88, 0x8a, 0x8c, 0x8f, 0x91, 0x93, 0x95, 0x97, 0x99, 0x9a, 0x9c, 0x9d, 0x9f, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa5, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xaa, 0xab, 0xab, 0xac, 0xad}, - { 0x80, 0x82, 0x85, 0x87, 0x89, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x97, 0x99, 0x9b, 0x9c, 0x9d, - 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa8, 0xa9, 0xaa, 0xaa, 0xab, 0xac}, - { 0x80, 0x82, 0x85, 0x87, 0x89, 0x8b, 0x8d, 0x8f, 0x91, 0x93, 0x95, 0x96, 0x98, 0x99, 0x9b, 0x9c, - 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa7, 0xa8, 0xa9, 0xa9, 0xaa, 0xab}, - { 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x95, 0x97, 0x98, 0x9a, 0x9b, - 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa6, 0xa7, 0xa8, 0xa8, 0xa9, 0xaa}, - { 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x91, 0x93, 0x94, 0x96, 0x97, 0x99, 0x9a, - 0x9b, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa5, 0xa6, 0xa7, 0xa7, 0xa8, 0xa9}, - { 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8b, 0x8d, 0x8f, 0x90, 0x92, 0x94, 0x95, 0x97, 0x98, 0x99, - 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa5, 0xa6, 0xa6, 0xa7, 0xa8}, - { 0x80, 0x82, 0x84, 0x86, 0x87, 0x89, 0x8b, 0x8d, 0x8e, 0x90, 0x91, 0x93, 0x94, 0x96, 0x97, 0x98, - 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa3, 0xa4, 0xa5, 0xa6, 0xa6, 0xa7}, - { 0x80, 0x82, 0x84, 0x85, 0x87, 0x89, 0x8a, 0x8c, 0x8e, 0x8f, 0x91, 0x92, 0x94, 0x95, 0x96, 0x98, - 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa2, 0xa3, 0xa4, 0xa5, 0xa5, 0xa6}, - { 0x80, 0x82, 0x83, 0x85, 0x87, 0x88, 0x8a, 0x8c, 0x8d, 0x8f, 0x90, 0x92, 0x93, 0x94, 0x96, 0x97, - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa2, 0xa3, 0xa4, 0xa5, 0xa5}, - { 0x80, 0x82, 0x83, 0x85, 0x86, 0x88, 0x8a, 0x8b, 0x8d, 0x8e, 0x90, 0x91, 0x92, 0x94, 0x95, 0x96, - 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa2, 0xa3, 0xa4, 0xa4}, - { 0x80, 0x82, 0x83, 0x85, 0x86, 0x88, 0x89, 0x8b, 0x8c, 0x8e, 0x8f, 0x90, 0x92, 0x93, 0x94, 0x95, - 0x96, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa2, 0xa3, 0xa4}, - { 0x80, 0x82, 0x83, 0x85, 0x86, 0x87, 0x89, 0x8a, 0x8c, 0x8d, 0x8e, 0x90, 0x91, 0x92, 0x93, 0x95, - 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9e, 0x9f, 0xa0, 0xa1, 0xa1, 0xa2, 0xa3}, - { 0x80, 0x81, 0x83, 0x84, 0x86, 0x87, 0x89, 0x8a, 0x8b, 0x8d, 0x8e, 0x8f, 0x90, 0x92, 0x93, 0x94, - 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9e, 0x9f, 0xa0, 0xa1, 0xa1, 0xa2}, - { 0x80, 0x81, 0x83, 0x84, 0x86, 0x87, 0x88, 0x8a, 0x8b, 0x8c, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, - 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x9f, 0xa0, 0xa1, 0xa1}, - { 0x80, 0x81, 0x83, 0x84, 0x85, 0x87, 0x88, 0x89, 0x8b, 0x8c, 0x8d, 0x8e, 0x90, 0x91, 0x92, 0x93, - 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x9f, 0xa0, 0xa1}, - { 0x80, 0x81, 0x83, 0x84, 0x85, 0x87, 0x88, 0x89, 0x8a, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, - 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9c, 0x9d, 0x9e, 0x9f, 0x9f, 0xa0}}; - -short ST010_Sin(short Theta) -{ - return ST010_SinTable[(Theta >> 8) & 0xff]; -} - -short ST010_Cos(short Theta) -{ - return ST010_SinTable[((Theta + 0x4000) >> 8) & 0xff]; -} - -void ST010_OP01(short x0, short y0, short *x1, short *y1, short *Quadrant, short *Theta) -{ - if ((x0 < 0) && (y0 < 0)) - { - *x1 = -x0; - *y1 = -y0; - *Quadrant = -0x8000; - } - else if (x0 < 0) - { - *x1 = y0; - *y1 = -x0; - *Quadrant = -0x4000; - } - else if (y0 < 0) - { - *x1 = -y0; - *y1 = x0; - *Quadrant = 0x4000; - } - else - { - *x1 = x0; - *y1 = y0; - *Quadrant = 0x0000; - } - - while ((*x1 > 0x1f) || (*y1 > 0x1f)) - { - if (*x1 > 1) *x1 >>= 1; - if (*y1 > 1) *y1 >>= 1; - } - - if (*y1 == 0) *Quadrant += 0x4000; - - *Theta = (ST010_ArcTan[*y1][*x1] << 8) ^ *Quadrant; -} - -void ST010_Scale(short Multiplier, short X0, short Y0, int *X1, int *Y1) -{ - *X1 = X0 * Multiplier << 1; - *Y1 = Y0 * Multiplier << 1; -} - -void ST010_Multiply(short Multiplicand, short Multiplier, int *Product) -{ - *Product = Multiplicand * Multiplier << 1; -} - -void ST010_Rotate(short Theta, short X0, short Y0, short *X1, short *Y1) -{ - *X1 = (Y0 * ST010_Sin(Theta) >> 15) + (X0 * ST010_Cos(Theta) >> 15); - *Y1 = (Y0 * ST010_Cos(Theta) >> 15) - (X0 * ST010_Sin(Theta) >> 15); -} - -void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32]) -{ - bool Sorted; - uint16 Temp; - - if (Positions > 1) - { - do - { - int i; - Sorted = true; - for (i = 0; i < Positions - 1; i++) - { - if (Places[i] < Places[i + 1]) - { - Temp = Places[i + 1]; - Places[i + 1] = Places[i]; - Places[i] = Temp; - - Temp = Drivers[i + 1]; - Drivers[i + 1] = Drivers[i]; - Drivers[i] = Temp; - - Sorted = false; - } - } - Positions--; - } while (!Sorted); - } -} - -#define ST010_WORD(offset) (*((short *)(SRAM+offset))) -//#define ST010_WORD(offset) (SRAM[offset + 1] << 8) | SRAM[offset] - -void ST010DoCommand(void) -{ - switch(SRAM[0x20]) - { - /* - Calculate track data based on direction coords - - Input - 0x0000-0x0001 : DX (signed) - 0x0002-0x0003 : DY (signed) - Output - 0x0010-0x0011 : Angle (signed) - */ - - case 0x01: - { - SRAM[0x0006] = SRAM[0x0002]; - SRAM[0x0007] = SRAM[0x0003]; - ST010_OP01(*(short*)&SRAM[0x0000], *(short*)&SRAM[0x0002], (short *)SRAM, (short *)&SRAM[2], (short *)&SRAM[4], (short *)&SRAM[0x10]); - } - break; - - //Sorts a bunch of values by weight - - case 0x02: - { - ST010_SortDrivers(*(short*)&SRAM[0x0024], (uint16*)&SRAM[0x0040], (uint16*)&SRAM[0x0080]); - } - break; - - /* - Two Dimensional Coordinate Scale - - Input - 0x0000-0x0001 : X0 (signed) - 0x0002-0x0003 : Y0 (signed) - 0x0004-0x0005 : Multiplier (signed) - Output - 0x0010-0x0013 : X1 (signed) - 0x0014-0x0017 : Y1 (signed) - */ - - case 0x03: - { - ST010_Scale(*(short*)&SRAM[0x0004], *(short*)&SRAM[0x0000], *(short*)&SRAM[0x0002], (int *)&SRAM[0x10], (int *)&SRAM[0x14]); - } - break; - - //Calculate the vector length of (x,y) - - case 0x04: - { - int16 square, x,y; - x=*((int16*)SRAM); - y=*((int16*)&SRAM[2]); - square=(int16)sqrt((double)(y*y+x*x)); - *((int16*)&SRAM[0x10])=square; - break; - } - - //Calculate AI orientation based on specific guidelines - case 0x05: - { - int dx,dy; - int16 a1,b1,c1; - uint16 o1; - - bool wrap=false; - - //Target (x,y) coordinates - int16 ypos_max = ST010_WORD(0x00C0); - int16 xpos_max = ST010_WORD(0x00C2); - - //Current coordinates and direction - int32 ypos = SRAM[0xC4]|(SRAM[0xC5]<<8)|(SRAM[0xC6]<<16)|(SRAM[0xC7]<<24); - int32 xpos = SRAM[0xC8]|(SRAM[0xC9]<<8)|(SRAM[0xCA]<<16)|(SRAM[0xCB]<<24); - uint16 rot = SRAM[0xCC]|(SRAM[0xCD]<<8); - - //Physics - uint16 speed = ST010_WORD(0x00D4); - uint16 accel = ST010_WORD(0x00D6); - uint16 speed_max = ST010_WORD(0x00D8); - - //Special condition acknowledgment - int16 system = ST010_WORD(0x00DA); - int16 flags = ST010_WORD(0x00DC); - - //New target coordinates - int16 ypos_new = ST010_WORD(0x00DE); - int16 xpos_new = ST010_WORD(0x00E0); - - //Backup speed - uint16 old_speed = speed; - - //Mask upper bit - xpos_new &= 0x7FFF; - - //Get the current distance - dx = xpos_max-(xpos>>16); - dy = ypos_max-(ypos>>16); - - //Quirk: clear and move in9 - SRAM[0xD2]=0xFF; - SRAM[0xD3]=0xFF; - SRAM[0xDA]=0; - SRAM[0xDB]=0; - - //Grab the target angle - ST010_OP01(dy,dx,&a1,&b1,&c1,(int16 *)&o1); - - //Check for wrapping - if (abs(o1-rot)>0x8000) - { - o1+=0x8000; - rot+=0x8000; - wrap=true; - } - - //Special case - if (abs(o1-rot)==0x8000) - { - speed = 0x100; - } - - //Slow down for sharp curves - else if (abs(o1-rot)>=0x1000) - { - uint32 slow = abs(o1-rot); - slow >>= 4; //Scaling - speed -= slow; - } - //Otherwise accelerate - else - { - speed += accel; - if (speed > speed_max) - { - //Clip speed - speed = speed_max; - } - } - - //Prevent negative/positive overflow - if( abs(old_speed-speed)>0x8000) - { - if (old_speedrot && (o1-rot)>0x80) || (o1=0x80)) - { - if (o1rot) { rot+=0x280; } - } - - //Turn off wrapping - if (wrap) { rot-=0x8000; } - - //Now check the distances (store for later) - dx = (xpos_max<<16)-xpos; - dy = (ypos_max<<16)-ypos; - dx>>=16; - dy>>=16; - - //If we're in so many units of the target, signal it - if ((system && (dy<=6 && dy>=-8) && (dx<=126 && dx>=-128)) || - (!system && (dx<=6 && dx>=-8) && (dy<=126 && dy>=-128))) - { - //Announce our new destination and flag it - xpos_max = xpos_new&0x7FFF; - ypos_max = ypos_new; - flags |= 0x08; - } - - //Update position - xpos -= (ST010_Cos(rot) * 0x400 >> 15) * (speed >> 8) << 1; - ypos -= (ST010_Sin(rot) * 0x400 >> 15) * (speed >> 8) << 1; - - //Quirk: mask upper byte - xpos &= 0x1FFFFFFF; - ypos &= 0x1FFFFFFF; - - SRAM[0x00C0]=(uint8)(ypos_max); - SRAM[0x00C1]=(uint8)(ypos_max >> 8); - SRAM[0x00C2]=(uint8)(xpos_max); - SRAM[0x00C3]=(uint8)(xpos_max >> 8); - SRAM[0x00C4]=(uint8)(ypos); - SRAM[0x00C5]=(uint8)(ypos >> 8); - SRAM[0x00C6]=(uint8)(ypos >> 16); - SRAM[0x00C7]=(uint8)(ypos >> 24); - SRAM[0x00C8]=(uint8)(xpos); - SRAM[0x00C9]=(uint8)(xpos >> 8); - SRAM[0x00CA]=(uint8)(xpos >> 16); - SRAM[0x00CB]=(uint8)(xpos >> 24); - SRAM[0x00CC]=(uint8)(rot); - SRAM[0x00CD]=(uint8)(rot >> 8); - SRAM[0x00D4]=(uint8)(speed); - SRAM[0x00D5]=(uint8)(speed >> 8); - SRAM[0x00DC]=(uint8)(flags); - SRAM[0x00DD]=(uint8)(flags >> 8); - } - break; - - /* - 16-bit Multiplication - - Input - 0x0000-0x0001 : Multiplcand (signed) - 0x0002-0x0003 : Multiplier (signed) - Output - 0x0010-0x0013 : Product (signed) - */ - - case 0x06: - { - ST010_Multiply(*(short*)&SRAM[0x0000], *(short*)&SRAM[0x0002], (int *)&SRAM[0x10]); - } - break; - - /* - Mode 7 Raster Data Calculation - - Input - 0x0000-0x0001 : Angle (signed) - Output - 0x00f0-0x024f : Mode 7 Matrix A - 0x0250-0x03af : Mode 7 Matrix B - 0x03b0-0x050f : Mode 7 Matrix C - 0x0510-0x066f : Mode 7 Matrix D - */ - - case 0x07: - { - int16 data; - int32 offset = 0; - int16 Theta = ST010_WORD(0x0000); - - int32 line; - for (line = 0; line < 176; line++) - { - //Calculate Mode 7 Matrix A/D data - data = ST010_M7Scale[line] * ST010_Cos(Theta) >> 15; - SRAM[0x00f0 + offset]=(uint8)(data); - SRAM[0x00f1 + offset]=(uint8)(data >> 8); - SRAM[0x0510 + offset]=(uint8)(data); - SRAM[0x0511 + offset]=(uint8)(data >> 8); - - //Calculate Mode 7 Matrix B/C data - data = ST010_M7Scale[line] * ST010_Sin(Theta) >> 15; - SRAM[0x0250 + offset]=(uint8)(data); - SRAM[0x0251 + offset]=(uint8)(data >> 8); - - if (data) { data = ~data; } - - SRAM[0x03b0 + offset]=(uint8)(data); - SRAM[0x03b1 + offset]=(uint8)(data >> 8); - - offset += 2; - } - - //Shift Angle for use with Lookup table - SRAM[0x00] = SRAM[0x01]; - SRAM[0x01] = 0x00; - } - break; - - /* - Two dimensional Coordinate Rotation - - Input - 0x0000-0x0001 : X0 (signed) - 0x0002-0x0003 : Y0 (signed) - 0x0004-0x0005 : Angle (signed) - Output - 0x0010-0x0011 : X1 (signed) - 0x0012-0x0013 : Y1 (signed) - */ - - case 0x08: - { - ST010_Rotate(*(short*)&SRAM[0x0004], *(short*)&SRAM[0x0000], *(short*)&SRAM[0x0002], (short *)&SRAM[0x10], (short *)&SRAM[0x12]); - } - break; - - default: break; - } - - //Lower signal: op processed - SRAM[0x20]=0; - SRAM[0x21]=0; -} - diff --git a/tools/zsnes/src/chips/seta11.c b/tools/zsnes/src/chips/seta11.c deleted file mode 100644 index a6ff711..0000000 --- a/tools/zsnes/src/chips/seta11.c +++ /dev/null @@ -1,585 +0,0 @@ -// ST-011 SNES DSP adapted from Morita Shogi 64 -// -// notes: -// - the SNES uses DMA to/from 60:0000 and maybe 68:0xxx -// - some code redundancy (helper subroutines for movement projection) -// -// - OPS04/05 have unknown output values (!) -// - OPS06/07 have unknown purposes -// -// - plenty of missing opcodes that don't show up in the only known binary log (st011-demo) -// (play the game until captured/promoted pieces, king checked, endgame) -// - minus emulation cycles (busy signals), bit-perfect to 'st011-demo' - -//#define DEBUG_DSP - -#ifdef DEBUG_DSP -#include -int debug1, debug2; -int line_count; -#endif - - -void (*RunST011)(); -void ST011_Command(); - -unsigned char ST011_DR; -unsigned char ST011_SR; - -int ST011_input_length; - -#define ST011_ram setaramdata - -extern unsigned char *setaramdata; - -#define ST011_board ( ST011_ram+0x130 ) - -int ST011_dma_count; -int ST011_dma_index; - -int ST011_king1; -int ST011_king2; - -// (x,y) -#define MOVE_UUL -1,-20 -#define MOVE_UL -1,-10 -#define MOVE_ULAll -9,- 9 -#define MOVE_U 0,-10 -#define MOVE_UAll 0,- 9 -#define MOVE_UR 1,-10 -#define MOVE_URAll 9,- 9 -#define MOVE_UUR 1,-20 - -#define MOVE_L -1, 0 -#define MOVE_LAll -9, 0 -#define MOVE_R 1, 0 -#define MOVE_RAll 9, 0 - -#define MOVE_DDL -1, 20 -#define MOVE_DL -1, 10 -#define MOVE_DLAll -9, 9 -#define MOVE_D 0, 10 -#define MOVE_DAll 0, 9 -#define MOVE_DR 1, 10 -#define MOVE_DRAll 9, 9 -#define MOVE_DDR 1, 20 - -#define MOVE_STOP 127,127 -#define MOVE_NOP 0, 0 -const int ST011_move_table[8*2][9*2] = -{ - // Pawn: one step forward - // - Promoted: same as Gold - { MOVE_D, MOVE_STOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP }, - { MOVE_DR, MOVE_D, MOVE_DL, MOVE_R, MOVE_L, MOVE_U, MOVE_STOP, MOVE_NOP, MOVE_NOP }, - - // Lance: all steps forward - // - Promoted: same as Gold - { MOVE_DAll, MOVE_STOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP }, - { MOVE_DR, MOVE_D, MOVE_DL, MOVE_R, MOVE_L, MOVE_U, MOVE_STOP, MOVE_NOP, MOVE_NOP }, - - // Knight: one step side, two forward - // - Promoted: same as Gold - { MOVE_DDR, MOVE_DDL, MOVE_STOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP }, - { MOVE_DR, MOVE_D, MOVE_DL, MOVE_R, MOVE_L, MOVE_U, MOVE_STOP, MOVE_NOP, MOVE_NOP }, - - // Silver general: one any diagonal, one step forward - // - Promoted: same as Gold - { MOVE_DR, MOVE_D, MOVE_DL, MOVE_UR, MOVE_UL, MOVE_STOP, MOVE_NOP, MOVE_NOP, MOVE_NOP }, - { MOVE_DR, MOVE_D, MOVE_DL, MOVE_R, MOVE_L, MOVE_U, MOVE_STOP, MOVE_NOP, MOVE_NOP }, - - // Gold general: one any forward, one sideways or one backward - // - Promoted: N/A - { MOVE_DR, MOVE_D, MOVE_DL, MOVE_R, MOVE_L, MOVE_U, MOVE_STOP, MOVE_NOP, MOVE_NOP }, - { MOVE_STOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP }, - - // Bishop: any diagonal - // - Promoted: Bishop + King - { MOVE_DRAll, MOVE_DLAll, MOVE_URAll, MOVE_ULAll, MOVE_STOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP }, - { MOVE_DRAll, MOVE_D, MOVE_DLAll, MOVE_R, MOVE_L, MOVE_URAll, MOVE_U, MOVE_ULAll, MOVE_STOP }, - - // Rook: any vertical, horizontal - // - Promoted: Rook + King - { MOVE_DAll, MOVE_RAll, MOVE_LAll, MOVE_UAll, MOVE_STOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP }, - { MOVE_DR, MOVE_DAll, MOVE_DL, MOVE_RAll, MOVE_LAll, MOVE_UR, MOVE_UAll, MOVE_UL, MOVE_STOP }, - - // King: one any direction - // - Promoted: N/A - { MOVE_DR, MOVE_D, MOVE_DL, MOVE_R, MOVE_L, MOVE_UR, MOVE_U, MOVE_UL, MOVE_STOP }, - { MOVE_STOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP, MOVE_NOP }, -}; - - -void ST011_Reset() -{ - RunST011 = &ST011_Command; - ST011_SR=0xff; -} - - -void ST011_OP01_A() -{ - if( ST011_dma_count-- ) - { - ST011_board[ ST011_dma_index++ ] = ST011_DR; - } - - if( ST011_dma_count == 0 ) - { -#ifdef DEBUG_DSP - int lcv1, lcv2; -#endif - int lcv; - - for( lcv = 0; lcv < 11; lcv++ ) - { - ST011_board[ lcv ] = 0; - } - for( lcv = 11; lcv < 21; lcv++ ) - { - ST011_board[ lcv ] = 0x80; - } - - ST011_king1 = ST011_board[ 126+21 ]; - ST011_king2 = ST011_board[ 127+21 ]; - - RunST011 = &ST011_Command; - ST011_SR = 0xc4; - -#ifdef DEBUG_DSP - // Debug - printf( "OP01\n" ); - for( lcv1 = 0; lcv1 < 9; lcv1++ ) - { - for( lcv2 = 0; lcv2 < 10; lcv2++ ) - { - printf( "%02x ", ST011_board[ lcv1*10 + lcv2 + 21 ] ); - } - - printf( "\n" ); - } - printf( "OP01 END\n\n" ); -#endif - } -} - -void ST011_OP01() -{ - ST011_dma_count = 128; - ST011_dma_index = 0+21; - - RunST011 = &ST011_OP01_A; - ST011_SR = 0xa4; -} - - -void ST011_OP02_A() -{ - if( ST011_dma_count-- ) - { - ST011_DR = ST011_ram[ ST011_dma_index-- ]; - } - - if( ST011_dma_count == 0 ) - { -#ifdef DEBUG_DSP - int lcv1, lcv2; -#endif - - RunST011 = &ST011_Command; - ST011_SR = 0xc4; - -#ifdef DEBUG_DSP - // Debug -#define OP02_ROW 10 - - printf( "OP02\n" ); - for( lcv1 = 0; lcv1 < 0x83 / OP02_ROW; lcv1++ ) - { - for( lcv2 = 0; lcv2 < OP02_ROW; lcv2++ ) - { - printf( "%02x ", ST011_ram[ debug1 - lcv1 * OP02_ROW - lcv2 ] ); - } - - printf( "\n" ); - } - printf( "OP02 END\n\n" ); -#endif - } -} - -void ST011_OP02() -{ - switch( ST011_input_length-- ) - { - case 4: ST011_dma_index = ST011_DR; break; - case 3: ST011_dma_index |= ST011_DR << 8; break; - case 2: ST011_dma_count = ST011_DR; break; - case 1: - ST011_dma_count |= ST011_DR << 8; - -#ifdef DEBUG_DSP - debug1 = ST011_dma_index; - debug2 = 0; -#endif - - RunST011 = &ST011_OP02_A; - ST011_SR = 0xa4; - break; - } -} - - -void ST011_Project_Moves( int color ) -{ - int row, col, lcv, index; - int dir; - - index = 0x121; - for( lcv = 0; lcv < 0x83; lcv++ ) - { - ST011_ram[ index-- ] = 0; - } - index = 0x121 - 21; - - if( color == 0x20 ) - { - dir = 1; - } - else - { - dir = -1; - } - - for( row = 0; row < 9; row++ ) - { - for( col = 0; col < 10; col++ ) - { - int shogi_piece; - int piece_id; - int lcv_steps, lcv_move; - int move_list[ 9*2 ]; - - shogi_piece = ST011_board[ row*10+col+21 ]; - piece_id = shogi_piece & 0x1f; - - if( col == 9 ) continue; - if( shogi_piece == 0x00 ) continue; - if( ( shogi_piece & ~0x1f ) != color ) continue; - - for( lcv = 0; lcv < 9*2; lcv++ ) - { - move_list[ lcv ] = ST011_move_table[ piece_id >> 1 ][ lcv ]; - } - - lcv_move = 0; - while( move_list[ lcv_move ] != 0x7f ) - { - int pos_x, pos_y; - - lcv_steps = 1; - if( move_list[ lcv_move ] == 9 || move_list[ lcv_move ] == -9 ) - { - lcv_steps = 9; - if( move_list[ lcv_move ] == 9 ) - { - move_list[ lcv_move ] = 1; - } - else - { - move_list[ lcv_move ] = -1; - } - } - - if( move_list[ lcv_move+1 ] == 9 || move_list[ lcv_move+1 ] == -9 ) - { - lcv_steps = 9; - if( move_list[ lcv_move+1 ] == 9 ) - { - move_list[ lcv_move+1 ] = 1; - } - else - { - move_list[ lcv_move+1 ] = -1; - } - } - else - { - move_list[ lcv_move+1 ] /= 10; - } - - pos_x = col; - pos_y = row; - while( lcv_steps-- ) - { - pos_x += move_list[ lcv_move+0 ]; - pos_y += ( move_list[ lcv_move+1 ] * dir ); - - ST011_ram[ index - pos_y*10 - pos_x ] = 0x80; - - if( ST011_board[ pos_y*10 + pos_x + 21 ] ) break; - } - - lcv_move += 2; - } - } // end col - } // end row -} - - -int ST011_Project_Valid_Moves( int color ) -{ - int row, col, lcv, index; - int dir; - - index = 0x556; - - if( color == 0x20 ) - { - dir = 1; - } - else - { - dir = -1; - } - - for( row = 0; row < 9; row++ ) - { - for( col = 0; col < 10; col++ ) - { - int shogi_piece; - int piece_id; - int lcv_steps, lcv_move; - int move_list[ 9*2 ]; - - shogi_piece = ST011_board[ row*10+col+21 ]; - piece_id = shogi_piece & 0x1f; - - if( col == 9 ) continue; - if( shogi_piece == 0x00 ) continue; - if( ( shogi_piece & ~0x1f ) != color ) continue; - - for( lcv = 0; lcv < 9*2; lcv++ ) - { - move_list[ lcv ] = ST011_move_table[ piece_id >> 1 ][ lcv ]; - } - - lcv_move = 0; - while( move_list[ lcv_move ] != 0x7f ) - { - int pos_x, pos_y; - - lcv_steps = 1; - if( move_list[ lcv_move ] == 9 || move_list[ lcv_move ] == -9 ) - { - lcv_steps = 9; - if( move_list[ lcv_move ] == 9 ) - { - move_list[ lcv_move ] = 1; - } - else - { - move_list[ lcv_move ] = -1; - } - } - - if( move_list[ lcv_move+1 ] == 9 || move_list[ lcv_move+1 ] == -9 ) - { - lcv_steps = 9; - if( move_list[ lcv_move+1 ] == 9 ) - { - move_list[ lcv_move+1 ] = 1; - } - else - { - move_list[ lcv_move+1 ] = -1; - } - } - else - { - move_list[ lcv_move+1 ] /= 10; - } - - pos_x = col; - pos_y = row; - while( lcv_steps-- ) - { - pos_x += move_list[ lcv_move+0 ]; - pos_y += ( move_list[ lcv_move+1 ] * dir ); - - if( pos_x < 0 ) break; - if( pos_x > 8 ) break; - if( pos_y < 0 ) break; - if( pos_y > 8 ) break; - if( ( ST011_board[ pos_y*10 + pos_x + 21 ] & ~0x1f ) == color ) break; - - ST011_ram[ index + 0x000 ] = 21 + row*10 + col; - ST011_ram[ index + 0x001 ] = 0; - ST011_ram[ index + 0x418 ] = 21 + pos_y*10 + pos_x; - ST011_ram[ index + 0x419 ] = 0; - - if( pos_y >= 6 ) - { - ST011_ram[ index + 0x418 ] |= 0x80; - } - index += 2; - - if( ST011_board[ pos_y*10+pos_x+21 ] ) break; - } - - lcv_move += 2; - } - } // end col - } // end row - - return ( index-0x556 ) >> 1; -} - - -void ST011_OP04() -{ - ST011_Project_Moves( 0x40 ); - - // unknown outputs - ST011_ram[ 0x12c ] = 0; - ST011_ram[ 0x12d ] = 0; - ST011_ram[ 0x12e ] = 0; - ST011_ram[ 0x12f ] = 0; - - RunST011 = &ST011_Command; - ST011_SR = 0xc4; -} - - -void ST011_OP05() -{ - ST011_Project_Moves( 0x20 ); - - // unknown outputs - ST011_ram[ 0x12c ] = 0; - ST011_ram[ 0x12d ] = 0; - ST011_ram[ 0x12e ] = 0; - ST011_ram[ 0x12f ] = 0; - - RunST011 = &ST011_Command; - ST011_SR = 0xc4; -} - - -void ST011_OP0E() -{ - int valid_moves; - - valid_moves = ST011_Project_Valid_Moves( 0x20 ); - - ST011_ram[ 0x12c ] = valid_moves & 0xff; - ST011_ram[ 0x12d ] = ( valid_moves >> 8 ) & 0xff; - - RunST011 = &ST011_Command; - ST011_SR = 0xc4; -} - - -void ST011_Command() -{ -#ifdef DEBUG_DSP - printf( "OP%02X @ line %d\n", ST011_DR, line_count ); -#endif - - // busy - ST011_SR = 0x84; - - switch( ST011_DR ) - { - // Download shogi playboard to on-board memory - case 0x01: - ST011_OP01(); - break; - - // Upload shogi analysis data to outside memory - case 0x02: - ST011_input_length = 4; - RunST011 = ST011_OP02; - break; - - // Project all moves of player color $40 - case 0x04: - ST011_OP04(); - break; - - // Project all moves of player color $20 - case 0x05: - ST011_OP05(); - break; - - // Unknown - seems to set flags $00,$20,$40,..$e0 for restricted movement lists - case 0x06: - //ST011_OP06(); - ST011_SR = 0xc4; - break; - - // Unknown - seems to set flags $00,$20,$40,..$e0 for restricted movement lists - case 0x07: - //ST011_OP07(); - ST011_SR = 0xc4; - break; - - // List valid moves of player color $20 - case 0x0E: - ST011_OP0E(); - break; - - default: -#ifdef DEBUG_DSP - printf( "Unknown OP @ line %d\n", line_count ); -#endif - break; - } -} - - -unsigned short seta11_address; -unsigned char seta11_byte; - -void ST011_MapR_68() -{ - if (seta11_address < 0x1000) - { - ST011_DR = ST011_ram[seta11_address & 0xfff]; - } - seta11_byte = ST011_DR; -} - -void ST011_MapW_68() -{ - ST011_DR = seta11_byte; - - if (seta11_address < 0x1000) - { - ST011_ram[seta11_address & 0xfff] = ST011_DR; - } -} - -void ST011_MapR_60() -{ - if (seta11_address == 0) - { - RunST011(); - } - if (seta11_address == 1) - { - seta11_byte = ST011_SR; - return; - } - seta11_byte = ST011_DR; -} - -void ST011_MapW_60() -{ - ST011_DR = seta11_byte; - - if (seta11_address == 0) - { - RunST011(); - } -} diff --git a/tools/zsnes/src/chips/sfxproc.asm b/tools/zsnes/src/chips/sfxproc.asm deleted file mode 100644 index 66ceab1..0000000 --- a/tools/zsnes/src/chips/sfxproc.asm +++ /dev/null @@ -1,667 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 SfxB,SfxBRAMR,SfxCBR,SfxCFGR,SfxCLSR,SfxCPB,SfxCROM -EXTSYM SfxCarry,SfxMemTable,SfxOverflow,SfxPBR,SfxPIPE,SfxR0,SfxR1,SfxR10 -EXTSYM SfxR11,SfxR12,SfxR13,SfxR14,SfxR15,SfxR2,SfxR3,SfxR4,SfxR5,SfxR6 -EXTSYM SfxR7,SfxR8,SfxR9,SfxRAMBR,SfxRAMMem,SfxROMBR,SfxSCBR,SfxSCMR,SfxSFR -EXTSYM SfxSignZero,SfxnRamBanks,regptr,regptw,sfxramdata,ChangeOps -EXTSYM SfxPOR,sfxclineloc,UpdatePORSCMR,UpdateCLSR,UpdateSCBRCOLR,SfxAC -EXTSYM sfx128lineloc,sfx160lineloc,sfx192lineloc,sfxobjlineloc,SFXProc - -%include "cpu/regs.mac" -%include "cpu/regsw.mac" - -%macro AssembleSFXFlags 0 - and word[SfxSFR],8F60h - test byte[SfxCarry],1 - jz .nosfxcarry - or word[SfxSFR],04h -.nosfxcarry - cmp word[SfxSignZero],0 - jne .nozero - or word[SfxSFR],02h -.nozero - test word[SfxSignZero],8000h - jz .noneg - or word[SfxSFR],08h -.noneg - cmp byte[SfxOverflow],0 - je .noof - or word[SfxSFR],10h -.noof - cmp byte[SfxB],0 - je .bzero - or word[SfxSFR],1000h -.bzero -%endmacro - -SECTION .text - -NEWSYM initsfxregsr - setreg 3000h*4,reg3000r - setreg 3001h*4,reg3001r - setreg 3002h*4,reg3002r - setreg 3003h*4,reg3003r - setreg 3004h*4,reg3004r - setreg 3005h*4,reg3005r - setreg 3006h*4,reg3006r - setreg 3007h*4,reg3007r - setreg 3008h*4,reg3008r - setreg 3009h*4,reg3009r - setreg 300Ah*4,reg300Ar - setreg 300Bh*4,reg300Br - setreg 300Ch*4,reg300Cr - setreg 300Dh*4,reg300Dr - setreg 300Eh*4,reg300Er - setreg 300Fh*4,reg300Fr - setreg 3010h*4,reg3010r - setreg 3011h*4,reg3011r - setreg 3012h*4,reg3012r - setreg 3013h*4,reg3013r - setreg 3014h*4,reg3014r - setreg 3015h*4,reg3015r - setreg 3016h*4,reg3016r - setreg 3017h*4,reg3017r - setreg 3018h*4,reg3018r - setreg 3019h*4,reg3019r - setreg 301Ah*4,reg301Ar - setreg 301Bh*4,reg301Br - setreg 301Ch*4,reg301Cr - setreg 301Dh*4,reg301Dr - setreg 301Eh*4,reg301Er - setreg 301Fh*4,reg301Fr - setreg 3030h*4,reg3030r - setreg 3031h*4,reg3031r - setreg 3032h*4,reg3032r - setreg 3033h*4,reg3033r - setreg 3034h*4,reg3034r - setreg 3035h*4,reg3035r - setreg 3036h*4,reg3036r - setreg 3037h*4,reg3037r - setreg 3038h*4,reg3038r - setreg 3039h*4,reg3039r - setreg 303Ah*4,reg303Ar - setreg 303Bh*4,reg303Br - setreg 303Ch*4,reg303Cr - setreg 303Dh*4,reg303Dr - setreg 303Eh*4,reg303Er - setreg 303Fh*4,reg303Fr - ; set 3100-31FF to cacheregr - mov edi,3100h*4 - add edi,[regptr] - mov eax,cacheregr - mov ecx,200h -.loop - mov [edi],eax - add edi,4 - dec ecx - jnz .loop - ret - -NEWSYM initsfxregsw - setregw 3000h*4,reg3000w - setregw 3001h*4,reg3001w - setregw 3002h*4,reg3002w - setregw 3003h*4,reg3003w - setregw 3004h*4,reg3004w - setregw 3005h*4,reg3005w - setregw 3006h*4,reg3006w - setregw 3007h*4,reg3007w - setregw 3008h*4,reg3008w - setregw 3009h*4,reg3009w - setregw 300Ah*4,reg300Aw - setregw 300Bh*4,reg300Bw - setregw 300Ch*4,reg300Cw - setregw 300Dh*4,reg300Dw - setregw 300Eh*4,reg300Ew - setregw 300Fh*4,reg300Fw - setregw 3010h*4,reg3010w - setregw 3011h*4,reg3011w - setregw 3012h*4,reg3012w - setregw 3013h*4,reg3013w - setregw 3014h*4,reg3014w - setregw 3015h*4,reg3015w - setregw 3016h*4,reg3016w - setregw 3017h*4,reg3017w - setregw 3018h*4,reg3018w - setregw 3019h*4,reg3019w - setregw 301Ah*4,reg301Aw - setregw 301Bh*4,reg301Bw - setregw 301Ch*4,reg301Cw - setregw 301Dh*4,reg301Dw - setregw 301Eh*4,reg301Ew - setregw 301Fh*4,reg301Fw - setregw 3030h*4,reg3030w - setregw 3031h*4,reg3031w - setregw 3032h*4,reg3032w - setregw 3033h*4,reg3033w - setregw 3034h*4,reg3034w - setregw 3035h*4,reg3035w - setregw 3036h*4,reg3036w - setregw 3037h*4,reg3037w - setregw 3038h*4,reg3038w - setregw 3039h*4,reg3039w - setregw 303Ah*4,reg303Aw - setregw 303Bh*4,reg303Bw - setregw 303Ch*4,reg303Cw - setregw 303Dh*4,reg303Dw - setregw 303Eh*4,reg303Ew - setregw 303Fh*4,reg303Fw - ; set 3100-31FF to cacheregw - mov edi,3100h*4 - add edi,[regptw] - mov eax,cacheregw - mov ecx,200h -.loop - mov [edi],eax - add edi,4 - dec ecx - jnz .loop - ret - -NEWSYM cacheregr - or byte[cachewarning],1 - ret - -NEWSYM cacheregw - or byte[cachewarning],2 - ret - -SECTION .bss -NEWSYM cachewarning, resb 1 - -SECTION .text - -; SFX Registers - -NEWSYM reg3000r - mov al,[SfxR0] - ret -NEWSYM reg3001r - mov al,[SfxR0+1] - ret -NEWSYM reg3002r - mov al,[SfxR1] - ret -NEWSYM reg3003r - mov al,[SfxR1+1] - ret -NEWSYM reg3004r - mov al,[SfxR2] - ret -NEWSYM reg3005r - mov al,[SfxR2+1] - ret -NEWSYM reg3006r - mov al,[SfxR3] - ret -NEWSYM reg3007r - mov al,[SfxR3+1] - ret -NEWSYM reg3008r - mov al,[SfxR4] - ret -NEWSYM reg3009r - mov al,[SfxR4+1] - ret -NEWSYM reg300Ar - mov al,[SfxR5] - ret -NEWSYM reg300Br - mov al,[SfxR5+1] - ret -NEWSYM reg300Cr - mov al,[SfxR6] - ret -NEWSYM reg300Dr - mov al,[SfxR6+1] - ret -NEWSYM reg300Er - mov al,[SfxR7] - ret -NEWSYM reg300Fr - mov al,[SfxR7+1] - ret -NEWSYM reg3010r - mov al,[SfxR8] - ret -NEWSYM reg3011r - mov al,[SfxR8+1] - ret -NEWSYM reg3012r - mov al,[SfxR9] - ret -NEWSYM reg3013r - mov al,[SfxR9+1] - ret -NEWSYM reg3014r - mov al,[SfxR10] - ret -NEWSYM reg3015r - mov al,[SfxR10+1] - ret -NEWSYM reg3016r - mov al,[SfxR11] - ret -NEWSYM reg3017r - mov al,[SfxR11+1] - ret -NEWSYM reg3018r - mov al,[SfxR12] - ret -NEWSYM reg3019r - mov al,[SfxR12+1] - ret -NEWSYM reg301Ar - mov al,[SfxR13] - ret -NEWSYM reg301Br - mov al,[SfxR13+1] - ret -NEWSYM reg301Cr - mov al,[SfxR14] - ret -NEWSYM reg301Dr - mov al,[SfxR14+1] - ret -NEWSYM reg301Er - mov al,[SfxR15] - ret -NEWSYM reg301Fr - mov al,[SfxR15+1] - ret - -; Other SFX stuff - -NEWSYM reg3030r - AssembleSFXFlags - mov al,[SfxSFR] - ret -NEWSYM reg3031r - cmp byte[SfxAC],1 - je .alwaysclear - cmp dword[ChangeOps],-350*240 - jl .noclear -.alwaysclear - and byte[SfxSFR+1],07fh ; clear IRQ flag - jmp .cleared -.noclear - cmp dword[ChangeOps],-350*240*4 - jge .clear - mov dword[ChangeOps],-350*240*4 - jmp .cleared -.clear - add dword[ChangeOps],350*240 -.cleared - mov al,[SfxSFR+1] - ret -SECTION .bss -.test resb 1 -SECTION .text - -NEWSYM reg3032r ; Unused - xor al,al - ret -NEWSYM reg3033r ; BRAMR Backup Ram Read only on/off (bits 1-15 unused) - mov al,[SfxBRAMR] - ret -NEWSYM reg3034r ; PBR (Program Bank) - mov al,[SfxPBR] - ret -NEWSYM reg3035r ; Unused - xor al,al - ret -NEWSYM reg3036r ; ROMBR (Gamepak Rom Bank Register) - mov al,[SfxROMBR] - ret -NEWSYM reg3037r ; CFGR (Control Flags Register) - mov al,[SfxCFGR] - ret -NEWSYM reg3038r ; SCBR (Screen Bank Register) - mov al,[SfxSCBR] - ret -NEWSYM reg3039r ; CLSR (Clock Speed Register) - mov al,[SfxCLSR] - ret -NEWSYM reg303Ar ; SCMR (Screen Mode Register) - mov al,[SfxSCMR] - test byte[SfxPOR],10h - jnz .objmode - mov al,[SfxSCMR] - and al,00100100b ; 4 + 32 - cmp al,4 - je .lines160 - cmp al,32 - je .lines192 - cmp al,36 - je .objmode - mov eax,[sfx128lineloc] - jmp .donelines -.lines160 - mov eax,[sfx160lineloc] - jmp .donelines -.lines192 - mov eax,[sfx192lineloc] - jmp .donelines -.objmode - mov eax,[sfxobjlineloc] -.donelines - mov [sfxclineloc],eax - ret -NEWSYM reg303Br ; VCR (Version Code Register) - mov al,20h - ret -NEWSYM reg303Cr ; RAMBR (Ram bank register) - mov al,[SfxRAMBR] - ret -NEWSYM reg303Dr ; Unused - xor al,al - ret -NEWSYM reg303Er ; CBR (Cache Base Register), lower byte - mov al,[SfxCBR] - ret -NEWSYM reg303Fr ; CBR (Cache Base Register), upper byte - mov al,[SfxCBR+1] - ret - -; SFX Write Registers - -NEWSYM reg3000w - mov [SfxR0],al - ret -NEWSYM reg3001w - mov [SfxR0+1],al - ret -NEWSYM reg3002w - mov [SfxR1],al - ret -NEWSYM reg3003w - mov [SfxR1+1],al - ret -NEWSYM reg3004w - mov [SfxR2],al - ret -NEWSYM reg3005w - mov [SfxR2+1],al - ret -NEWSYM reg3006w - mov [SfxR3],al - ret -NEWSYM reg3007w - mov [SfxR3+1],al - ret -NEWSYM reg3008w - mov [SfxR4],al - ret -NEWSYM reg3009w - mov [SfxR4+1],al - ret -NEWSYM reg300Aw - mov [SfxR5],al - ret -NEWSYM reg300Bw - mov [SfxR5+1],al - ret -NEWSYM reg300Cw - mov [SfxR6],al - ret -NEWSYM reg300Dw - mov [SfxR6+1],al - ret -NEWSYM reg300Ew - mov [SfxR7],al - ret -NEWSYM reg300Fw - mov [SfxR7+1],al - ret -NEWSYM reg3010w - mov [SfxR8],al - ret -NEWSYM reg3011w - mov [SfxR8+1],al - ret -NEWSYM reg3012w - mov [SfxR9],al - ret -NEWSYM reg3013w - mov [SfxR9+1],al - ret -NEWSYM reg3014w - mov [SfxR10],al - ret -NEWSYM reg3015w - mov [SfxR10+1],al - ret -NEWSYM reg3016w - mov [SfxR11],al - ret -NEWSYM reg3017w - mov [SfxR11+1],al - ret -NEWSYM reg3018w - mov [SfxR12],al - ret -NEWSYM reg3019w - mov [SfxR12+1],al - ret -NEWSYM reg301Aw - mov [SfxR13],al - ret -NEWSYM reg301Bw - mov [SfxR13+1],al - ret -NEWSYM reg301Cw - mov [SfxR14],al - ret -NEWSYM reg301Dw - mov [SfxR14+1],al - ret -NEWSYM reg301Ew - mov [SfxR15],al - ret -NEWSYM reg301Fw - mov [SfxR15+1],al - ; start execution - push edx - mov edx,[SfxPBR] - mov edx,[SfxMemTable+edx*4] - add edx,[SfxR15] - mov dl,[edx] - mov [SfxPIPE],dl - pop edx - inc word[SfxR15] - or byte[SfxSFR],20h - or dword[SfxSFR],08000h ; Set IRQ Flag - mov dword[SFXProc],1 -; call StartSFXret - ret - -; Other SFX stuff - -NEWSYM reg3030w - mov [SfxSFR],al - mov byte[SfxAC],1 - mov dh,10 - ret -NEWSYM reg3031w - mov [SfxSFR+1],al - ret -NEWSYM reg3032w ; Unused - ret -NEWSYM reg3033w ; BRAMR Backup Ram Read only on/off (bits 1-15 unused) - and al,0FEh - mov [SfxBRAMR],al - ret -NEWSYM reg3034w ; PBR (Program Bank) - mov [SfxPBR],al - xor ebx,ebx - mov bl,al - mov ebx,[SfxMemTable+ebx*4] - mov [SfxCPB],ebx - ret -NEWSYM reg3035w ; Unused - ret -NEWSYM reg3036w ; ROMBR (Gamepak Rom Bank Register) - mov [SfxROMBR],al - xor ebx,ebx - mov bl,al - mov ebx,[SfxMemTable+ebx*4] - mov [SfxCROM],ebx - ret -NEWSYM reg3037w ; CFGR (Control Flags Register) - mov [SfxCFGR],al - ret -NEWSYM reg3038w ; SCBR (Screen Bank Register) - mov [SfxSCBR],al - call UpdateSCBRCOLR - ret -NEWSYM reg3039w ; CLSR (Clock Speed Register) - and al,0FEh - mov [SfxCLSR],al - call UpdateCLSR - ret -NEWSYM reg303Aw ; SCMR (Screen Mode Register) - mov [SfxSCMR],al - call UpdatePORSCMR - ret -NEWSYM reg303Bw ; VCR (Version Code Register) - ret -NEWSYM reg303Cw ; RAMBR (Ram bank register) - mov bl,[SfxnRamBanks] - dec bl - and al,bl - mov ebx,[SfxnRamBanks] - dec ebx - and eax,ebx - mov [SfxRAMBR],eax - xor ebx,ebx - mov bl,al - shl ebx,16 - add ebx,[sfxramdata] - mov [SfxRAMMem],ebx - ret -NEWSYM reg303Dw ; Unused - ret -NEWSYM reg303Ew ; CBR (Cache Base Register), lower byte - mov [SfxCBR],al - ret -NEWSYM reg303Fw ; CBR (Cache Base Register), upper byte - mov [SfxCBR+1],al - ret - -NEWSYM sfxaccessbankr8 - mov ebx,[sfxramdata] - mov al,[ebx+ecx] - xor ebx,ebx - ret - -NEWSYM sfxaccessbankw8 - mov ebx,[sfxramdata] - mov [ebx+ecx],al - xor ebx,ebx - ret - -NEWSYM sfxaccessbankr16 - mov ebx,[sfxramdata] - mov ax,[ebx+ecx] - xor ebx,ebx - ret - -NEWSYM sfxaccessbankw16 - mov ebx,[sfxramdata] - mov [ebx+ecx],ax - xor ebx,ebx - ret - -NEWSYM sfxaccessbankr8b - mov ebx,[sfxramdata] - mov al,[ebx+ecx+65536] - xor ebx,ebx - ret - -NEWSYM sfxaccessbankw8b - mov ebx,[sfxramdata] - mov [ebx+ecx+65536],al - xor ebx,ebx - ret - -NEWSYM sfxaccessbankr16b - mov ebx,[sfxramdata] - mov ax,[ebx+ecx+65536] - xor ebx,ebx - ret - -NEWSYM sfxaccessbankw16b - mov ebx,[sfxramdata] - mov [ebx+ecx+65536],ax - xor ebx,ebx - ret - -NEWSYM sfxaccessbankr8c - mov ebx,[sfxramdata] - mov al,[ebx+ecx+65536*2] - xor ebx,ebx - ret - -NEWSYM sfxaccessbankw8c - mov ebx,[sfxramdata] - mov [ebx+ecx+65536*2],al - xor ebx,ebx - ret - -NEWSYM sfxaccessbankr16c - mov ebx,[sfxramdata] - mov ax,[ebx+ecx+65536*2] - xor ebx,ebx - ret - -NEWSYM sfxaccessbankw16c - mov ebx,[sfxramdata] - mov [ebx+ecx+65536*2],ax - xor ebx,ebx - ret - -NEWSYM sfxaccessbankr8d - mov ebx,[sfxramdata] - mov al,[ebx+ecx+65536*3] - xor ebx,ebx - ret - -NEWSYM sfxaccessbankw8d - mov ebx,[sfxramdata] - mov [ebx+ecx+65536*3],al - xor ebx,ebx - ret - -NEWSYM sfxaccessbankr16d - mov ebx,[sfxramdata] - mov ax,[ebx+ecx+65536*3] - xor ebx,ebx - ret - -NEWSYM sfxaccessbankw16d - mov ebx,[sfxramdata] - mov [ebx+ecx+65536*3],ax - xor ebx,ebx - ret - - diff --git a/tools/zsnes/src/chips/st10proc.asm b/tools/zsnes/src/chips/st10proc.asm deleted file mode 100644 index 82d3def..0000000 --- a/tools/zsnes/src/chips/st10proc.asm +++ /dev/null @@ -1,133 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 setaramdata,ST010DoCommand - -SECTION .data -NEWSYM SetaCmdEnable, dd 0 ; Seta ST010/ST011 command enable register. Maybe also status. -SECTION .text - -;; TODO - should return ROM for > 8000h -NEWSYM setaaccessbankr8 - mov ebx,[setaramdata] - and ecx,0fffh - mov al,[ebx+ecx] - xor ebx,ebx - ret - -NEWSYM setaaccessbankw8 - test ecx,8000h - jnz .nosetenablew8 ; ignore ROM writes - and ecx,0fffh - mov ebx,[setaramdata] - mov [ebx+ecx],al - cmp byte[ebx+021h], 80h - jnz .nosetenablew8 - pushad - call ST010DoCommand - popad -.nosetenablew8 - xor ebx,ebx - ret - -;; We ignore the case where it wraps into ROM reads - should never happen -NEWSYM setaaccessbankr16 - mov ebx,[setaramdata] - and ecx,0fffh - mov ax,[ebx+ecx] - xor ebx,ebx - ret - -NEWSYM setaaccessbankw16 - test ecx,8000h - jnz .nosetenablew16 ; ignore ROM writes - cmp ecx,7fffh - jne .noromw16 - mov [setaramdata+0fffh],al ; only write ram part in, not rom part - jmp short .nosetenablew16 -.noromw16 - and ecx,0fffh - mov ebx,[setaramdata] - cmp ecx,0fffh - jne .nowrapw16 - mov [ebx+ecx],al - xchg ah,al - mov [ebx],al - jmp short .nosetenablew16 -.nowrapw16 - mov [ebx+ecx],ax - cmp byte[ebx+021h], 80h - jnz .nosetenablew16 - pushad - call ST010DoCommand - popad -.nosetenablew16 - xor ebx,ebx - ret - - -NEWSYM setaaccessbankr8a - xor al,al - cmp ecx,4000h - jae .nosetenabler8a - and ecx, 3 - mov al,[SetaCmdEnable+ecx] -.nosetenabler8a - xor ebx,ebx - ret - -NEWSYM setaaccessbankw8a - cmp ecx,4000h - jae .nosetenablew8a - and ecx, 03h - mov [SetaCmdEnable+ecx],al -.nosetenablew8a - xor ebx,ebx - ret - -NEWSYM setaaccessbankr16a - xor ax,ax - cmp ecx,4000h - jae .nosetenabler16a - and ecx,3 - mov al,[SetaCmdEnable+ecx] - xchg ah,al - inc ecx - and ecx,3 - mov al,[SetaCmdEnable+ecx] -.nosetenabler16a - xor ebx,ebx - ret - -NEWSYM setaaccessbankw16a - cmp ecx,4000h - jae .nosetenablew16a - mov ebx,[setaramdata] - and ecx,3 - mov [ebx+ecx],al - xchg ah,al - inc ecx - and ecx,3 - mov [ebx+ecx],al -.nosetenablew16a - xor ebx,ebx - ret - diff --git a/tools/zsnes/src/chips/st11proc.asm b/tools/zsnes/src/chips/st11proc.asm deleted file mode 100644 index 43f9022..0000000 --- a/tools/zsnes/src/chips/st11proc.asm +++ /dev/null @@ -1,136 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 seta11_address,seta11_byte,setaramdata,ST011_DR -EXTSYM ST011_MapR_60,ST011_MapW_60,ST011_MapW_68;ST011_MapR_68 - -SECTION .text - - -NEWSYM Seta11Read8_68 - mov ebx,[setaramdata] - and ecx,0fffh - mov al,[ebx+ecx] - mov [ST011_DR],al - xor ebx,ebx - ret - -NEWSYM Seta11Write8_68 - test ecx,8000h - jnz .nosetenablew8 ; ignore ROM writes - mov [seta11_address],cx - mov [seta11_byte],al - pushad - call ST011_MapW_68 - popad -.nosetenablew8 - ret - -NEWSYM Seta11Read16_68 - mov ebx,[setaramdata] - and ecx,0fffh - mov ax,[ebx+ecx] - mov [ST011_DR],ah - xor ebx,ebx - ret - -NEWSYM Seta11Write16_68 - test ecx,8000h - jnz .nosetenablew16 ; ignore ROM writes - mov [seta11_address],cx - mov [seta11_byte],al - mov [seta11temp],ah - pushad - call ST011_MapW_68 - mov ah,[seta11temp] - mov [seta11_byte],ah - inc word[seta11_address] - call ST011_MapW_68 - popad -.nosetenablew16 - ret - - -NEWSYM Seta11Read8_60 - xor al,al - cmp ecx,4000h - jae .nosetenabler8 - and ecx,3 - mov [seta11_address],cx - pushad - call ST011_MapR_60 - popad - mov al,[seta11_byte] - .nosetenabler8 - ret - -NEWSYM Seta11Write8_60 - cmp ecx,4000h - jae .nosetenablew8 - and ecx,3 - mov [seta11_address],cx - mov [seta11_byte],al - pushad - call ST011_MapW_60 - popad -.nosetenablew8 - ret - -NEWSYM Seta11Read16_60 - xor ax,ax - cmp ecx,4000h - jae .nosetenabler16 - and ecx,3 - mov [seta11_address],cx - pushad - call ST011_MapR_60 - mov al,[seta11_byte] - mov [seta11temp],al - inc word[seta11_address] - and word[seta11_address],3 - call ST011_MapR_60 - popad - mov al,[seta11temp] - mov ah,[seta11_byte] -.nosetenabler16 - ret - -NEWSYM Seta11Write16_60 - cmp ecx,4000h - jae .nosetenablew16 - and ecx,3 - mov [seta11_address],cx - mov [seta11_byte],al - mov [seta11temp],ah - pushad - call ST011_MapW_60 - mov ah,[seta11temp] - mov [seta11_byte],ah - inc word[seta11_address] - and word[seta11_address],3 - call ST011_MapW_60 - popad -.nosetenablew16 - ret - - -SECTION .bss -NEWSYM seta11temp, resb 1 diff --git a/tools/zsnes/src/config.guess b/tools/zsnes/src/config.guess deleted file mode 100755 index c085f4f..0000000 --- a/tools/zsnes/src/config.guess +++ /dev/null @@ -1,1497 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-05-13' - -# This file 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., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerppc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - x86:Interix*:[345]*) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T:Interix*:[345]*) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/tools/zsnes/src/config.h.in b/tools/zsnes/src/config.h.in deleted file mode 100644 index 0d0f1a3..0000000 --- a/tools/zsnes/src/config.h.in +++ /dev/null @@ -1,8 +0,0 @@ -#undef TIME_WITH_SYS_TIME -#undef HAVE_SYS_TIME_H -#undef HAVE_DIRENT_H -#undef HAVE_SYS_NDIR_H -#undef HAVE_SYS_DIR_H -#undef HAVE_NDIR_H -#undef HAVE_MEMCPY -#undef HAVE_UNISTD_H diff --git a/tools/zsnes/src/config.sub b/tools/zsnes/src/config.sub deleted file mode 100755 index 4d936e2..0000000 --- a/tools/zsnes/src/config.sub +++ /dev/null @@ -1,1608 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-05-13' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16c) - basic_machine=cr16c-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/tools/zsnes/src/configure b/tools/zsnes/src/configure deleted file mode 100755 index 0dbbb43..0000000 --- a/tools/zsnes/src/configure +++ /dev/null @@ -1,7190 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61. -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - -exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="zsnes" -ac_unique_file="init.asm" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -build -build_cpu -build_vendor -build_os -host -host_cpu -host_vendor -host_os -target -target_cpu -target_vendor -target_os -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -CXX -CXXFLAGS -ac_ct_CXX -NASMPATH -SDL_CONFIG -SDL_CFLAGS -SDL_LIBS -ZLIB_CFLAGS -ZLIB_VERSION -ZLIB_LIBS -LIBPNG_CFLAGS -LIBPNG_VERSION -LIBPNG_LIBS -XMKMF -CPP -ARCH_INFO -force_arch -GREP -EGREP -VERSION -ZC -ZCFLAGS -PSRFLAGS -NFLAGS -ZSNESEXE -GL_DRAW -JMA_FILES -MMLIB_FILES -DEBUGGER_FILES -PSR_TEMP -LIBOBJS -LTLIBOBJS' -ac_subst_files='' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CXX -CXXFLAGS -CCC -XMKMF -CPP -force_arch' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=\$ac_optarg ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute directory names. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -X features: - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-sdltest Do not try to compile and run a test SDL program - --disable-libpng Build without libpng support - --disable-debugger Build without the zsnes debugger - --enable-libao Build with libao support - --disable-opengl Build without OpenGL support - --disable-jma Build without JMA support - --disable-cpucheck Do not try to autodetect cpu architecture - --enable-debug Build GDB friendly binary (zsnesd) - --enable-release Build ultra-optimized release binary (zsnes) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-nasm-prefix=PFX Prefix where nasm is installed (optional) - --with-zconf-path=PATH Path where ZSNES looks for zsnesl.cfg (default is .zsnes) - --with-sdl-prefix=PFX Prefix where SDL is installed (optional) - --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) - --with-zlib-prefix=PFX Prefix where zlib is installed (optional) - --with-libpng-prefix=PFX Prefix where libpng is installed (optional) - --with-opengl-prefix=PFX Prefix where OpenGL is installed (optional) - --with-x use the X Window System - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags - XMKMF Path to xmkmf, Makefile generator for X Window System - CPP C preprocessor - force_arch Force architecture to optimize GCC/G++ for - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.61 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" -else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" -fi -shift -for ac_site_file -do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - -ac_config_headers="$ac_config_headers config.h" - - -VERSION=1.51 - -CFLAGS="$CFLAGS -pipe -I. -I/usr/local/include -I/usr/include" - -LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/lib" - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6; } -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6; } -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ echo "$as_me:$LINENO: checking target system type" >&5 -echo $ECHO_N "checking target system type... $ECHO_C" >&6; } -if test "${ac_cv_target+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5 -echo "${ECHO_T}$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 -echo "$as_me: error: invalid value of canonical target" >&2;} - { (exit 1); exit 1; }; };; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done -IFS=$as_save_IFS - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi - -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } -if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CXXFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# Check whether --with-nasm-prefix was given. -if test "${with_nasm_prefix+set}" = set; then - withval=$with_nasm_prefix; nasm_prefix="$withval" -else - nasm_prefix="" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nasm", so it can be a program name with args. -set dummy ${ac_tool_prefix}nasm; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_NASMPATH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NASMPATH"; then - ac_cv_prog_NASMPATH="$NASMPATH" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$nasm_prefix:$PATH" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NASMPATH="${ac_tool_prefix}nasm" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -NASMPATH=$ac_cv_prog_NASMPATH -if test -n "$NASMPATH"; then - { echo "$as_me:$LINENO: result: $NASMPATH" >&5 -echo "${ECHO_T}$NASMPATH" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NASMPATH"; then - ac_ct_NASMPATH=$NASMPATH - # Extract the first word of "nasm", so it can be a program name with args. -set dummy nasm; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_NASMPATH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_NASMPATH"; then - ac_cv_prog_ac_ct_NASMPATH="$ac_ct_NASMPATH" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$nasm_prefix:$PATH" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_NASMPATH="nasm" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_NASMPATH=$ac_cv_prog_ac_ct_NASMPATH -if test -n "$ac_ct_NASMPATH"; then - { echo "$as_me:$LINENO: result: $ac_ct_NASMPATH" >&5 -echo "${ECHO_T}$ac_ct_NASMPATH" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_NASMPATH" = x; then - NASMPATH=""no"" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - NASMPATH=$ac_ct_NASMPATH - fi -else - NASMPATH="$ac_cv_prog_NASMPATH" -fi - -if test x$NASMPATH = xno; then - { { echo "$as_me:$LINENO: error: You need NASM installed to compile ZSNES" >&5 -echo "$as_me: error: You need NASM installed to compile ZSNES" >&2;} - { (exit 1); exit 1; }; } -fi - - -# Check whether --with-zconf-path was given. -if test "${with_zconf_path+set}" = set; then - withval=$with_zconf_path; ZCONF="$withval" -else - ZCONF="" -fi - - -CFLAGS="$CFLAGS -D__UNIXSDL__" -NFLAGS="$NFLAGS -w-orphan-labels -D__UNIXSDL__" -PSRFLAGS="$PSRFLAGS -D__UNIXSDL__" -MMLIB_FILES="\$(MMLIB_D)/mm.o" -STRIP="-s" -case x$target in - *-*-linux*) - NFLAGS="$NFLAGS -f elf -DELF" - MMLIB_FILES="$MMLIB_FILES \$(MMLIB_D)/linux.o" - ;; - *-*-beos*) - CFLAGS="$CFLAGS -D__BEOS__" - NFLAGS="$NFLAGS -D__BEOS__ -f elf -DELF" - ;; - *-*-*bsd*) - CFLAGS="$CFLAGS -D__BSDSDL__" - NFLAGS="$NFLAGS -D__BSDSDL__ -f elf -DELF" - ;; - *-*-darwin* ) - CFLAGS="$CFLAGS -D__MACOSX__ -D__OPENGL__ -arch i386 -mdynamic-no-pic -mstackrealign -fno-unit-at-a-time" - NFLAGS="$NFLAGS -D__MACOSX__ -D__OPENGL__ -f macho -DMACHO" - PSRFLAGS="$PSRFLAGS -D__OPENGL__" - MMLIB_FILES="$MMLIB_FILES \$(MMLIB_D)/osx.o" - STRIP="" - LDFLAGS="$LDFLAGS -framework Carbon -framework IOKit -framework Foundation -framework OpenGL -mdynamic-no-pic -read_only_relocs suppress -undefined dynamic_lookup" - GL_DRAW="\$(PORT_D)/gl_draw.o" - found_opengl=yes - ;; - *-*-cygwin* | *-*-*ming*) - NFLAGS="$NFLAGS -f win32" - ;; - *) - { { echo "$as_me:$LINENO: error: This target is not supported" >&5 -echo "$as_me: error: This target is not supported" >&2;} - { (exit 1); exit 1; }; } - ;; -esac - -if test x$ZCONF != x; then - CFLAGS="$CFLAGS -DZCONF=\"\\\"$ZCONF\\\"\"" -fi - - - - -# Check whether --with-sdl-prefix was given. -if test "${with_sdl_prefix+set}" = set; then - withval=$with_sdl_prefix; sdl_prefix="$withval" -else - sdl_prefix="" -fi - - -# Check whether --with-sdl-exec-prefix was given. -if test "${with_sdl_exec_prefix+set}" = set; then - withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval" -else - sdl_exec_prefix="" -fi - -# Check whether --enable-sdltest was given. -if test "${enable_sdltest+set}" = set; then - enableval=$enable_sdltest; -else - enable_sdltest=yes -fi - - - if test x$sdl_exec_prefix != x ; then - sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config - fi - fi - if test x$sdl_prefix != x ; then - sdl_args="$sdl_args --prefix=$sdl_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_prefix/bin/sdl-config - fi - fi - - if test "x$prefix" != xNONE; then - PATH="$prefix/bin:$prefix/usr/bin:$PATH" - fi - # Extract the first word of "sdl-config", so it can be a program name with args. -set dummy sdl-config; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_SDL_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $SDL_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no" - ;; -esac -fi -SDL_CONFIG=$ac_cv_path_SDL_CONFIG -if test -n "$SDL_CONFIG"; then - { echo "$as_me:$LINENO: result: $SDL_CONFIG" >&5 -echo "${ECHO_T}$SDL_CONFIG" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - min_sdl_version=1.2.0 - { echo "$as_me:$LINENO: checking for SDL - version >= $min_sdl_version" >&5 -echo $ECHO_N "checking for SDL - version >= $min_sdl_version... $ECHO_C" >&6; } - no_sdl="" - if test "$SDL_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` - SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` - - sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - if test "x$enable_sdltest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_CXXFLAGS="$CXXFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - rm -f conf.sdltest - if test "$cross_compiling" = yes; then - echo $ac_n "cross compiling; assumed OK... $ac_c" -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -#include -#include "SDL.h" - -char* -my_strdup (char *str) -{ - char *new_str; - - if (str) - { - new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); - } - else - new_str = NULL; - - return new_str; -} - -int main (int argc, char *argv[]) -{ - int major, minor, micro; - char *tmp_version; - - /* This hangs on some systems (?) - system ("touch conf.sdltest"); - */ - { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup("$min_sdl_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_sdl_version"); - exit(1); - } - - if (($sdl_major_version > major) || - (($sdl_major_version == major) && ($sdl_minor_version > minor)) || - (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); - printf("*** to point to the correct copy of sdl-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - - -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -no_sdl=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_sdl" = x ; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - : - else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - if test "$SDL_CONFIG" = "no" ; then - echo "*** The sdl-config script installed by SDL could not be found" - echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL_CONFIG environment variable to the" - echo "*** full path to sdl-config." - else - if test -f conf.sdltest ; then - : - else - echo "*** Could not run SDL test program, checking why..." - CFLAGS="$CFLAGS $SDL_CFLAGS" - CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include "SDL.h" - -int main(int argc, char *argv[]) -{ return 0; } -#undef main -#define main K_and_R_C_main - -int -main () -{ - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding SDL or finding the wrong" - echo "*** version of SDL. If it is not finding SDL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means SDL was incorrectly installed" - echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl-config script: $SDL_CONFIG" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - SDL_CFLAGS="" - SDL_LIBS="" - { { echo "$as_me:$LINENO: error: SDL >= 1.2.0 is required" >&5 -echo "$as_me: error: SDL >= 1.2.0 is required" >&2;} - { (exit 1); exit 1; }; } - fi - - - rm -f conf.sdltest - - - -# Check whether --with-zlib-prefix was given. -if test "${with_zlib_prefix+set}" = set; then - withval=$with_zlib_prefix; zlib_prefix="$withval" -else - zlib_prefix="" -fi - -min_zlib_version=1.2.3 -{ echo "$as_me:$LINENO: checking for zlib - version >= $min_zlib_version" >&5 -echo $ECHO_N "checking for zlib - version >= $min_zlib_version... $ECHO_C" >&6; } - -tempLIBS="$LIBS" -tempCFLAGS="$CFLAGS" -if test x$zlib_prefix != x ; then - ZLIB_LIBS="-L$zlib_prefix" - ZLIB_CFLAGS="-I$zlib_prefix" -fi -ZLIB_LIBS="$ZLIB_LIBS -lz" -LIBS="$LIBS $ZLIB_LIBS" -CFLAGS="$CFLAGS $ZLIB_CFLAGS" - -if test "$cross_compiling" = yes; then - { echo "$as_me:$LINENO: result: cross-compiling" >&5 -echo "${ECHO_T}cross-compiling" >&6; } - with_zlib="" - { echo "$as_me:$LINENO: WARNING: Assuming zlib is available" >&5 -echo "$as_me: WARNING: Assuming zlib is available" >&2;} -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -#include -#include - -char* my_strdup (char *str) -{ - char *new_str; - - if (str) - { - new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); - } - else new_str = NULL; - - return new_str; -} - -int main (int argc, char *argv[]) -{ - int major, minor, micro, zlib_major_version, zlib_minor_version, zlib_micro_version; - - char *zlibver, *tmp_version; - - zlibver = ZLIB_VERSION; - - FILE *fp = fopen("conf.zlibtest", "a"); - if ( fp ) { - fprintf(fp, "%s", zlibver); - fclose(fp); - } - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup("$min_zlib_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string for\n\tmin_zlib_version... ", "$min_zlib_version"); - exit(1); - } - if (sscanf(zlibver, "%d.%d.%d", &zlib_major_version, &zlib_minor_version, &zlib_micro_version) != 3) { - printf("%s, bad version string given\n", zlibver); - puts("\tby zlib, sometimes due to very old zlibs that didnt correctly"); - printf("\tdefine their version. Please upgrade if you are running an\n\told zlib... "); - exit(1); - } - - if ((zlib_major_version > major) || - ((zlib_major_version == major) && (zlib_minor_version > minor)) || - ((zlib_major_version == major) && (zlib_minor_version == minor) && (zlib_micro_version >= micro))) - { - return 0; - } - else - { - return 1; - } -} - -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - with_zlib=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -with_zlib=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - - -if test x$with_zlib != x; then - { echo "$as_me:$LINENO: result: $with_zlib" >&5 -echo "${ECHO_T}$with_zlib" >&6; } -fi -if test x$with_zlib = xyes; then - ZLIB_VERSION=$(= 1.2.3 is required" >&5 -echo "$as_me: error: zlib >= 1.2.3 is required" >&2;} - { (exit 1); exit 1; }; } -fi -LIBS="$tempLIBS" -CFLAGS="$tempCFLAGS" -rm conf.zlibtest - - - - -CFLAGS="$CFLAGS $ZLIB_CFLAGS" -LDFLAGS="$LDFLAGS $ZLIB_LIBS" - - - -# Check whether --enable-libpng was given. -if test "${enable_libpng+set}" = set; then - enableval=$enable_libpng; -else - enable_libpng=yes -fi - - - -# Check whether --with-libpng-prefix was given. -if test "${with_libpng_prefix+set}" = set; then - withval=$with_libpng_prefix; libpng_prefix="$withval" -else - libpng_prefix="" -fi - - -min_libpng_version=1.2.0 -tempLIBS="$LIBS" -tempCFLAGS="$CFLAGS" -if test x$libpng_prefix != x ; then - LIBPNG_LIBS="-L$libpng_prefix" - LIBPNG_CFLAGS="-I$libpng_prefix" -fi -LIBPNG_LIBS="$LIBPNG_LIBS -lpng -lm" -LIBS="$LIBS $LIBPNG_LIBS" -CFLAGS="$CFLAGS $LIBPNG_CFLAGS" - -{ echo "$as_me:$LINENO: checking for libpng - version >= $min_libpng_version" >&5 -echo $ECHO_N "checking for libpng - version >= $min_libpng_version... $ECHO_C" >&6; } - -if test x$enable_libpng != xno; then - - if test "$cross_compiling" = yes; then - { echo "$as_me:$LINENO: result: cross-compiling" >&5 -echo "${ECHO_T}cross-compiling" >&6; } - with_libpng="" - { echo "$as_me:$LINENO: WARNING: Assuming libpng is available" >&5 -echo "$as_me: WARNING: Assuming libpng is available" >&2;} -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -#include -#include - -char* my_strdup (char *str) -{ - char *new_str; - - if (str) - { - new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); - } - else new_str = NULL; - - return new_str; -} - -int main (int argc, char *argv[]) -{ - int major, minor, micro, libpng_major_version, libpng_minor_version, libpng_micro_version; - char *libpngver, *tmp_version; - - libpngver = PNG_LIBPNG_VER_STRING; - - FILE *fp = fopen("conf.libpngtest", "a"); - if ( fp ) { - fprintf(fp, "%s", libpngver); - fclose(fp); - } - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup("$min_libpng_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string for\n\tmin_libpng_version... ", "$min_libpng_version"); - exit(1); - } - if (sscanf(libpngver, "%d.%d.%d", &libpng_major_version, &libpng_minor_version, &libpng_micro_version) != 3) { - printf("%s, bad version string given\n", libpngver); - puts("\tby libpng, sometimes due to very old libpngs that didnt correctly"); - printf("\tdefine their version. Please upgrade if you are running an\n\told libpng... "); - exit(1); - } - if ((libpng_major_version > major) || - ((libpng_major_version == major) && (libpng_minor_version > minor)) || - ((libpng_major_version == major) && (libpng_minor_version == minor) && (libpng_micro_version >= micro))) - { - return 0; - } - else - { - return 1; - } -} - -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - with_libpng=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -with_libpng=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - - - if test x$with_libpng != x; then - { echo "$as_me:$LINENO: result: $with_libpng" >&5 -echo "${ECHO_T}$with_libpng" >&6; } - fi - if test x$with_libpng = xyes; then - LIBPNG_VERSION=$(&5 -echo "${ECHO_T}disabled by user" >&6; } -fi - -CFLAGS="$CFLAGS $SDL_CFLAGS" -LDFLAGS="$LDFLAGS $SDL_LIBS" - -if test x$with_libpng != xyes; then - CFLAGS="$CFLAGS -DNO_PNG" - NFLAGS="$NFLAGS -DNO_PNG" - PSRFLAGS="$PSRFLAGS -DNO_PNG" -else - CFLAGS="$CFLAGS $LIBPNG_CFLAGS" - LDFLAGS="$LDFLAGS $LIBPNG_LIBS" -fi - -# Check whether --enable-debugger was given. -if test "${enable_debugger+set}" = set; then - enableval=$enable_debugger; -else - enable_debugger=yes -fi - -{ echo "$as_me:$LINENO: checking if you want the zsnes debugger" >&5 -echo $ECHO_N "checking if you want the zsnes debugger... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $enable_debugger" >&5 -echo "${ECHO_T}$enable_debugger" >&6; } -if test x$enable_debugger != xyes; then - CFLAGS="$CFLAGS -DNO_DEBUGGER" - NFLAGS="$NFLAGS -DNO_DEBUGGER" - PSRFLAGS="$PSRFLAGS -DNO_DEBUGGER" - DEBUGGER_FILES="" -else - DEBUGGER_FILES="debugasm.o debugger.o" - - { echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5 -echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_curses_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char initscr (); -int -main () -{ -return initscr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_curses_initscr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_curses_initscr=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6; } -if test $ac_cv_lib_curses_initscr = yes; then - found_curses=yes -else - found_curses=no -fi - - { echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5 -echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_ncurses_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char initscr (); -int -main () -{ -return initscr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_ncurses_initscr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_ncurses_initscr=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6; } -if test $ac_cv_lib_ncurses_initscr = yes; then - found_ncurses=yes -else - found_ncurses=no -fi - - { echo "$as_me:$LINENO: checking for initscr in -lpdcurses" >&5 -echo $ECHO_N "checking for initscr in -lpdcurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_pdcurses_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpdcurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char initscr (); -int -main () -{ -return initscr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_pdcurses_initscr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_pdcurses_initscr=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_pdcurses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_pdcurses_initscr" >&6; } -if test $ac_cv_lib_pdcurses_initscr = yes; then - found_pdcurses=yes -else - found_pdcurses=no -fi - - - if test x$found_curses = xyes; then - LDFLAGS="$LDFLAGS -lcurses" - else - if test x$found_ncurses = xyes; then - CFLAGS="$CFLAGS -DNCURSES" - LDFLAGS="$LDFLAGS -lncurses" - else - if test x$found_pdcurses = xyes; then - LDFLAGS="$LDFLAGS -lpdcurses" - else - { { echo "$as_me:$LINENO: error: A curses library is required to use the debugger" >&5 -echo "$as_me: error: A curses library is required to use the debugger" >&2;} - { (exit 1); exit 1; }; } - DEBUGGER_FILES="" - fi - fi - fi -fi - -# Check whether --enable-libao was given. -if test "${enable_libao+set}" = set; then - enableval=$enable_libao; want_ao=$enableval -else - want_ao=no -fi - -{ echo "$as_me:$LINENO: checking if you want libao support" >&5 -echo $ECHO_N "checking if you want libao support... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $want_ao" >&5 -echo "${ECHO_T}$want_ao" >&6; } -if test x$want_ao = xyes; then - { echo "$as_me:$LINENO: checking for ao_initialize in -lao" >&5 -echo $ECHO_N "checking for ao_initialize in -lao... $ECHO_C" >&6; } -if test "${ac_cv_lib_ao_ao_initialize+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lao $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char ao_initialize (); -int -main () -{ -return ao_initialize (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_ao_ao_initialize=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_ao_ao_initialize=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ao_ao_initialize" >&5 -echo "${ECHO_T}$ac_cv_lib_ao_ao_initialize" >&6; } -if test $ac_cv_lib_ao_ao_initialize = yes; then - got_ao=yes -else - got_ao=no -fi - - - if test x$got_ao = xyes; then - CFLAGS="$CFLAGS -D__LIBAO__" - LDFLAGS="$LDFLAGS -lao" - else - { { echo "$as_me:$LINENO: error: Couldn't find libao" >&5 -echo "$as_me: error: Couldn't find libao" >&2;} - { (exit 1); exit 1; }; } - fi -fi - -if test x$found_opengl != xyes; then - # Check whether --enable-opengl was given. -if test "${enable_opengl+set}" = set; then - enableval=$enable_opengl; -else - enable_opengl=yes -fi - - -# Check whether --with-opengl-prefix was given. -if test "${with_opengl_prefix+set}" = set; then - withval=$with_opengl_prefix; opengl_prefix="$withval" -else - opengl_prefix="" -fi - - if test x$enable_opengl != xno; then - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ echo "$as_me:$LINENO: checking for X" >&5 -echo $ECHO_N "checking for X... $ECHO_C" >&6; } - - -# Check whether --with-x was given. -if test "${with_x+set}" = set; then - withval=$with_x; -fi - -# $have_x is `yes', `no', `disabled', or empty when we do not yet know. -if test "x$with_x" = xno; then - # The user explicitly disabled X. - have_x=disabled -else - case $x_includes,$x_libraries in #( - *\'*) { { echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5 -echo "$as_me: error: Cannot use X directory names containing '" >&2;} - { (exit 1); exit 1; }; };; #( - *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # One or both of the vars are not set, and there is no cached value. -ac_x_includes=no ac_x_libraries=no -rm -f -r conftest.dir -if mkdir conftest.dir; then - cd conftest.dir - cat >Imakefile <<'_ACEOF' -incroot: - @echo incroot='${INCROOT}' -usrlibdir: - @echo usrlibdir='${USRLIBDIR}' -libdir: - @echo libdir='${LIBDIR}' -_ACEOF - if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then - # GNU make sometimes prints "make[1]: Entering...", which would confuse us. - for ac_var in incroot usrlibdir libdir; do - eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" - done - # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. - for ac_extension in a so sl; do - if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && - test -f "$ac_im_libdir/libX11.$ac_extension"; then - ac_im_usrlibdir=$ac_im_libdir; break - fi - done - # Screen out bogus values from the imake configuration. They are - # bogus both because they are the default anyway, and because - # using them would break gcc on systems where it needs fixed includes. - case $ac_im_incroot in - /usr/include) ac_x_includes= ;; - *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; - esac - case $ac_im_usrlibdir in - /usr/lib | /lib) ;; - *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; - esac - fi - cd .. - rm -f -r conftest.dir -fi - -# Standard set of common directories for X headers. -# Check X11 before X11Rn because it is often a symlink to the current release. -ac_x_header_dirs=' -/usr/X11/include -/usr/X11R6/include -/usr/X11R5/include -/usr/X11R4/include - -/usr/include/X11 -/usr/include/X11R6 -/usr/include/X11R5 -/usr/include/X11R4 - -/usr/local/X11/include -/usr/local/X11R6/include -/usr/local/X11R5/include -/usr/local/X11R4/include - -/usr/local/include/X11 -/usr/local/include/X11R6 -/usr/local/include/X11R5 -/usr/local/include/X11R4 - -/usr/X386/include -/usr/x386/include -/usr/XFree86/include/X11 - -/usr/include -/usr/local/include -/usr/unsupported/include -/usr/athena/include -/usr/local/x11r5/include -/usr/lpp/Xamples/include - -/usr/openwin/include -/usr/openwin/share/include' - -if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Xlib.h. - # First, try using that file with no special directory specified. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # We can compile using X headers with no special include directory. -ac_x_includes= -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Xlib.h"; then - ac_x_includes=$ac_dir - break - fi -done -fi - -rm -f conftest.err conftest.$ac_ext -fi # $ac_x_includes = no - -if test "$ac_x_libraries" = no; then - # Check for the libraries. - # See if we find them without any special options. - # Don't add to $LIBS permanently. - ac_save_LIBS=$LIBS - LIBS="-lX11 $LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -XrmInitialize () - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - LIBS=$ac_save_LIBS -# We can link X programs with no special library path. -ac_x_libraries= -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - LIBS=$ac_save_LIBS -for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` -do - # Don't even attempt the hair of trying to link an X program! - for ac_extension in a so sl; do - if test -r "$ac_dir/libX11.$ac_extension"; then - ac_x_libraries=$ac_dir - break 2 - fi - done -done -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi # $ac_x_libraries = no - -case $ac_x_includes,$ac_x_libraries in #( - no,* | *,no | *\'*) - # Didn't find X, or a directory has "'" in its name. - ac_cv_have_x="have_x=no";; #( - *) - # Record where we found X for the cache. - ac_cv_have_x="have_x=yes\ - ac_x_includes='$ac_x_includes'\ - ac_x_libraries='$ac_x_libraries'" -esac -fi -;; #( - *) have_x=yes;; - esac - eval "$ac_cv_have_x" -fi # $with_x != no - -if test "$have_x" != yes; then - { echo "$as_me:$LINENO: result: $have_x" >&5 -echo "${ECHO_T}$have_x" >&6; } - no_x=yes -else - # If each of the values was on the command line, it overrides each guess. - test "x$x_includes" = xNONE && x_includes=$ac_x_includes - test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries - # Update the cache value to reflect the command line values. - ac_cv_have_x="have_x=yes\ - ac_x_includes='$x_includes'\ - ac_x_libraries='$x_libraries'" - { echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 -echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6; } -fi - - if test x$opengl_prefix != x; then - CFLAGS="$CFLAGS -I$opengl_prefix/include" - LDFLAGS-"$LDFLAGS -L$opengl_prefix/lib" - fi - if test x$x_libraries != x; then - LDFLAGS="$LDFLAGS -L$x_libraries" - fi - { echo "$as_me:$LINENO: checking for glGetError in -lGL" >&5 -echo $ECHO_N "checking for glGetError in -lGL... $ECHO_C" >&6; } -if test "${ac_cv_lib_GL_glGetError+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lGL $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char glGetError (); -int -main () -{ -return glGetError (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_GL_glGetError=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_GL_glGetError=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_GL_glGetError" >&5 -echo "${ECHO_T}$ac_cv_lib_GL_glGetError" >&6; } -if test $ac_cv_lib_GL_glGetError = yes; then - found_opengl=yes -else - found_opengl=no -fi - - fi - - { echo "$as_me:$LINENO: checking for OpenGL" >&5 -echo $ECHO_N "checking for OpenGL... $ECHO_C" >&6; } - if test x$enable_opengl != xno; then - if test x$found_opengl = xyes; then - LDFLAGS="$LDFLAGS -lGL" - CFLAGS="$CFLAGS -D__OPENGL__" - NFLAGS="$NFLAGS -D__OPENGL__" - PSRFLAGS="$PSRFLAGS -D__OPENGL__" - GL_DRAW="\$(PORT_D)/gl_draw.o" - fi - { echo "$as_me:$LINENO: result: $found_opengl" >&5 -echo "${ECHO_T}$found_opengl" >&6; } - else - { echo "$as_me:$LINENO: result: disabled by user" >&5 -echo "${ECHO_T}disabled by user" >&6; } - fi -fi - -# Check whether --enable-jma was given. -if test "${enable_jma+set}" = set; then - enableval=$enable_jma; -else - enable_jma=yes -fi - -{ echo "$as_me:$LINENO: checking for JMA support" >&5 -echo $ECHO_N "checking for JMA support... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $enable_jma" >&5 -echo "${ECHO_T}$enable_jma" >&6; } -if test x$enable_jma != xyes; then - CFLAGS="$CFLAGS -DNO_JMA" - NFLAGS="$NFLAGS -DNO_JMA" - PSRFLAGS="$PSRFLAGS -DNO_JMA" -fi - - -{ echo "$as_me:$LINENO: checking for cpu info" >&5 -echo $ECHO_N "checking for cpu info... $ECHO_C" >&6; } -# Check whether --enable-cpucheck was given. -if test "${enable_cpucheck+set}" = set; then - enableval=$enable_cpucheck; -else - enable_cpucheck=yes -fi - - -if test x$enable_cpucheck != xno; then - if test "$cross_compiling" = yes; then - { echo "$as_me:$LINENO: result: cross-compiling" >&5 -echo "${ECHO_T}cross-compiling" >&6; } - cpu_test="" - { echo "$as_me:$LINENO: WARNING: You should use --target" >&5 -echo "$as_me: WARNING: You should use --target" >&2;} -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include - -int main() -{ - int check; - system("$CC -O3 -o tools/archopt tools/archopt.c"); - check = system("tools/archopt > conf.archchk"); - return((check) ? 1:0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cpu_test=found -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -cpu_test=failed -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - - - if test x$cpu_test != x; then - { echo "$as_me:$LINENO: result: $cpu_test" >&5 -echo "${ECHO_T}$cpu_test" >&6; } - fi - if test x$cpu_test = xfound; then - ARCH_INFO=$(&5 -echo "${ECHO_T}disabled by user" >&6; } -fi - - -# Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then - enableval=$enable_debug; debug=$enableval -else - debug=no -fi - -{ echo "$as_me:$LINENO: checking if you want gdb friendly executable" >&5 -echo $ECHO_N "checking if you want gdb friendly executable... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $debug" >&5 -echo "${ECHO_T}$debug" >&6; } -if test x$debug = xyes; then - ZSNESEXE="zsnesd" - PSR_TEMP="" - CFLAGS="$CFLAGS -Wall -W -DDEBUG -O0 -fno-omit-frame-pointer -gstabs3" - NFLAGS="$NFLAGS -DDEBUG -g -F stabs -s -O0" -else - ZSNESEXE="zsnes" - PSR_TEMP=" rm -f t_\$*.c" - - CFLAGSBAK="$CFLAGS" - - { echo "$as_me:$LINENO: checking which cpu architecture to optimize for" >&5 -echo $ECHO_N "checking which cpu architecture to optimize for... $ECHO_C" >&6; } - if test x$force_arch != x; then - CFLAGS="$CFLAGS -march=$force_arch" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - { echo "$as_me:$LINENO: result: forcing $force_arch" >&5 -echo "${ECHO_T}forcing $force_arch" >&6; } -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { echo "$as_me:$LINENO: result: $force_arch ??" >&5 -echo "${ECHO_T}$force_arch ??" >&6; } - { echo "$as_me:$LINENO: WARNING: incorrect force_arch parameter" >&5 -echo "$as_me: WARNING: incorrect force_arch parameter" >&2;} - force_arch="" - CFLAGS="$CFLAGSBAK" - { echo "$as_me:$LINENO: checking for autodetected architecture" >&5 -echo $ECHO_N "checking for autodetected architecture... $ECHO_C" >&6; } -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - else - if test x$ARCH_INFO = x; then - case x$target in - i686-*-*) - { echo "$as_me:$LINENO: result: guessing i686" >&5 -echo "${ECHO_T}guessing i686" >&6; } - CFLAGS="$CFLAGS -march=i686" - ;; - i586-*-*) - { echo "$as_me:$LINENO: result: guessing i586" >&5 -echo "${ECHO_T}guessing i586" >&6; } - CFLAGS="$CFLAGS -march=i586" - ;; - i486-*-*) - { echo "$as_me:$LINENO: result: guessing i486" >&5 -echo "${ECHO_T}guessing i486" >&6; } - CFLAGS="$CFLAGS -march=i486" - ;; - *) - { echo "$as_me:$LINENO: result: guessing i386" >&5 -echo "${ECHO_T}guessing i386" >&6; } - CFLAGS="$CFLAGS -march=i386" - { echo "$as_me:$LINENO: WARNING: This is not what you want, use --target or force-arch" >&5 -echo "$as_me: WARNING: This is not what you want, use --target or force-arch" >&2;} - ;; - esac - else - { echo "$as_me:$LINENO: result: $ARCH_INFO" >&5 -echo "${ECHO_T}$ARCH_INFO" >&6; } - CFLAGS="$CFLAGS -march=$ARCH_INFO" - fi - fi - - # Check whether --enable-release was given. -if test "${enable_release+set}" = set; then - enableval=$enable_release; release=$enableval -else - release=no -fi - - { echo "$as_me:$LINENO: checking if you want crazy optimizations" >&5 -echo $ECHO_N "checking if you want crazy optimizations... $ECHO_C" >&6; } - { echo "$as_me:$LINENO: result: $release" >&5 -echo "${ECHO_T}$release" >&6; } - if test x$release = xyes; then - if test x$force_arch = x; then - { echo "$as_me:$LINENO: WARNING: If you intend to distribute this binary, make sure you use force_arch and set to i586 (or whichever CPU Arch you intend for)" >&5 -echo "$as_me: WARNING: If you intend to distribute this binary, make sure you use force_arch and set to i586 (or whichever CPU Arch you intend for)" >&2;} - fi - CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -fprefetch-loop-arrays -fforce-addr $STRIP -D__RELEASE__" - NFLAGS="$NFLAGS -O99999999 -D__RELEASE__" - else - CFLAGS="$CFLAGS -O3 -fomit-frame-pointer $STRIP" - NFLAGS="$NFLAGS -O1" - fi -fi -CXXFLAGS="$CFLAGS -fno-rtti" - -if test x$enable_jma != xno; then - JMA_FILES="\$(JMA_D)/7zlzma.o \$(JMA_D)/crc32.o \$(JMA_D)/iiostrm.o\ - \$(JMA_D)/inbyte.o \$(JMA_D)/jma.o \$(JMA_D)/lzma.o\ - \$(JMA_D)/lzmadec.o \$(JMA_D)/winout.o \$(JMA_D)/zsnesjma.o" - ZC="$CXX" - ZCFLAGS="$CXXFLAGS" -else - JMA_FILES="" - ZC="$CC" - ZCFLAGS="$CFLAGS" -fi - -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_GREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_GREP=$GREP -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_EGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_EGREP=$EGREP -fi - - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -{ echo "$as_me:$LINENO: checking whether sys/types.h defines makedev" >&5 -echo $ECHO_N "checking whether sys/types.h defines makedev... $ECHO_C" >&6; } -if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -return makedev(0, 0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_header_sys_types_h_makedev=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_sys_types_h_makedev=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h_makedev" >&5 -echo "${ECHO_T}$ac_cv_header_sys_types_h_makedev" >&6; } - -if test $ac_cv_header_sys_types_h_makedev = no; then -if test "${ac_cv_header_sys_mkdev_h+set}" = set; then - { echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 -echo $ECHO_N "checking for sys/mkdev.h... $ECHO_C" >&6; } -if test "${ac_cv_header_sys_mkdev_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_mkdev_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking sys/mkdev.h usability" >&5 -echo $ECHO_N "checking sys/mkdev.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking sys/mkdev.h presence" >&5 -echo $ECHO_N "checking sys/mkdev.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sys/mkdev.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sys/mkdev.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 -echo $ECHO_N "checking for sys/mkdev.h... $ECHO_C" >&6; } -if test "${ac_cv_header_sys_mkdev_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_sys_mkdev_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_mkdev_h" >&6; } - -fi -if test $ac_cv_header_sys_mkdev_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define MAJOR_IN_MKDEV 1 -_ACEOF - -fi - - - - if test $ac_cv_header_sys_mkdev_h = no; then - if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then - { echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 -echo $ECHO_N "checking for sys/sysmacros.h... $ECHO_C" >&6; } -if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_sysmacros_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking sys/sysmacros.h usability" >&5 -echo $ECHO_N "checking sys/sysmacros.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking sys/sysmacros.h presence" >&5 -echo $ECHO_N "checking sys/sysmacros.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sys/sysmacros.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 -echo $ECHO_N "checking for sys/sysmacros.h... $ECHO_C" >&6; } -if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_sys_sysmacros_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_sysmacros_h" >&6; } - -fi -if test $ac_cv_header_sys_sysmacros_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define MAJOR_IN_SYSMACROS 1 -_ACEOF - -fi - - - fi -fi - - - - - - - - - - - - - - - -ac_config_files="$ac_config_files Makefile" - -touch -t 198001010000 makefile.dep - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.61, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2006 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - { echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL - export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - -_ACEOF - - - -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -build!$build$ac_delim -build_cpu!$build_cpu$ac_delim -build_vendor!$build_vendor$ac_delim -build_os!$build_os$ac_delim -host!$host$ac_delim -host_cpu!$host_cpu$ac_delim -host_vendor!$host_vendor$ac_delim -host_os!$host_os$ac_delim -target!$target$ac_delim -target_cpu!$target_cpu$ac_delim -target_vendor!$target_vendor$ac_delim -target_os!$target_os$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -CXX!$CXX$ac_delim -CXXFLAGS!$CXXFLAGS$ac_delim -ac_ct_CXX!$ac_ct_CXX$ac_delim -NASMPATH!$NASMPATH$ac_delim -SDL_CONFIG!$SDL_CONFIG$ac_delim -SDL_CFLAGS!$SDL_CFLAGS$ac_delim -SDL_LIBS!$SDL_LIBS$ac_delim -ZLIB_CFLAGS!$ZLIB_CFLAGS$ac_delim -ZLIB_VERSION!$ZLIB_VERSION$ac_delim -ZLIB_LIBS!$ZLIB_LIBS$ac_delim -LIBPNG_CFLAGS!$LIBPNG_CFLAGS$ac_delim -LIBPNG_VERSION!$LIBPNG_VERSION$ac_delim -LIBPNG_LIBS!$LIBPNG_LIBS$ac_delim -XMKMF!$XMKMF$ac_delim -CPP!$CPP$ac_delim -ARCH_INFO!$ARCH_INFO$ac_delim -force_arch!$force_arch$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -VERSION!$VERSION$ac_delim -ZC!$ZC$ac_delim -ZCFLAGS!$ZCFLAGS$ac_delim -PSRFLAGS!$PSRFLAGS$ac_delim -NFLAGS!$NFLAGS$ac_delim -ZSNESEXE!$ZSNESEXE$ac_delim -GL_DRAW!$GL_DRAW$ac_delim -JMA_FILES!$JMA_FILES$ac_delim -MMLIB_FILES!$MMLIB_FILES$ac_delim -DEBUGGER_FILES!$DEBUGGER_FILES$ac_delim -PSR_TEMP!$PSR_TEMP$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi - -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end -_ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof -_ACEOF - - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF -fi # test -n "$CONFIG_FILES" - - -for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - ac_file_inputs="$ac_file_inputs $ac_f" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - fi - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p -' $ac_file_inputs` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac - ;; - :H) - # - # CONFIG_HEADER - # -_ACEOF - -# Transform confdefs.h into a sed script `conftest.defines', that -# substitutes the proper values into config.h.in to produce config.h. -rm -f conftest.defines conftest.tail -# First, append a space to every undef/define line, to ease matching. -echo 's/$/ /' >conftest.defines -# Then, protect against being on the right side of a sed subst, or in -# an unquoted here document, in config.status. If some macros were -# called several times there might be several #defines for the same -# symbol, which is useless. But do not sort them, since the last -# AC_DEFINE must be honored. -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where -# NAME is the cpp macro being defined, VALUE is the value it is being given. -# PARAMS is the parameter list in the macro definition--in most cases, it's -# just an empty string. -ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' -ac_dB='\\)[ (].*,\\1define\\2' -ac_dC=' ' -ac_dD=' ,' - -uniq confdefs.h | - sed -n ' - t rset - :rset - s/^[ ]*#[ ]*define[ ][ ]*// - t ok - d - :ok - s/[\\&,]/\\&/g - s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p - s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p - ' >>conftest.defines - -# Remove the space that was appended to ease matching. -# Then replace #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -# (The regexp can be short, since the line contains either #define or #undef.) -echo 's/ $// -s,^[ #]*u.*,/* & */,' >>conftest.defines - -# Break up conftest.defines: -ac_max_sed_lines=50 - -# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" -# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" -# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" -# et cetera. -ac_in='$ac_file_inputs' -ac_out='"$tmp/out1"' -ac_nxt='"$tmp/out2"' - -while : -do - # Write a here document: - cat >>$CONFIG_STATUS <<_ACEOF - # First, check the format of the line: - cat >"\$tmp/defines.sed" <<\\CEOF -/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def -/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def -b -:def -_ACEOF - sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS - ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in - sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail - grep . conftest.tail >/dev/null || break - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines conftest.tail - -echo "ac_result=$ac_in" >>$CONFIG_STATUS -cat >>$CONFIG_STATUS <<\_ACEOF - if test x"$ac_file" != x-; then - echo "/* $configure_input */" >"$tmp/config.h" - cat "$ac_result" >>"$tmp/config.h" - if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f $ac_file - mv "$tmp/config.h" $ac_file - fi - else - echo "/* $configure_input */" - cat "$ac_result" - fi - rm -f "$tmp/out12" - ;; - - - esac - -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - - -echo -echo -echo ZSNES v$VERSION -echo -echo "SDL support Version `$SDL_CONFIG --version`" -echo "NASM support `nasm -v`" -echo "zlib support Version $ZLIB_VERSION" -echo $ECHO_N "PNG support $ECHO_C" -if test x$with_libpng = xyes; then - echo "${ECHO_T}Yes, version $LIBPNG_VERSION" -elif test x$enable_libpng = xno; then - echo "${ECHO_T}Disabled by user" -else - echo "${ECHO_T}Disabled, library not found" -fi -echo $ECHO_N "OpenGL support $ECHO_C" -if test x$found_opengl = xyes; then - echo "${ECHO_T}Yes" -elif test x$enable_opengl = xno; then - echo "${ECHO_T}Disabled by user" -else - echo "${ECHO_T}Disabled, library not found" -fi -echo $ECHO_N "JMA support $ECHO_C" -if test x$enable_jma = xno; then - echo "${ECHO_T}Disabled by user" -else - echo "${ECHO_T}Yes" -fi -echo $ECHO_N "ZSNES debugger $ECHO_C" -if test x$enable_debugger = xno; then - echo "${ECHO_T}Disabled" -else - echo "${ECHO_T}Enabled" -fi -echo -echo The binary will be installed in $prefix/bin -echo -echo $ECHO_N "Configure complete, now type '$ECHO_C" -case x$target in - *-*-*bsd*) - echo $ECHO_N "${ECHO_T}g$ECHO_C" - ;; - *) - ;; -esac -echo "${ECHO_T}make' and pray." -echo diff --git a/tools/zsnes/src/configure.in b/tools/zsnes/src/configure.in deleted file mode 100644 index 8eece58..0000000 --- a/tools/zsnes/src/configure.in +++ /dev/null @@ -1,387 +0,0 @@ -dnl - Process this file with autoconf to produce a configure script. -dnl -dnl Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -dnl -dnl http://www.zsnes.com -dnl http://sourceforge.net/projects/zsnes -dnl https://zsnes.bountysource.com -dnl -dnl This program is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU General Public License -dnl version 2 as published by the Free Software Foundation. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -AC_INIT([zsnes], [], [http://www.zsnes.com]) -AC_PREREQ(2.50) -AC_CONFIG_SRCDIR(init.asm) -AC_CONFIG_HEADER(config.h) - -VERSION=1.51 - -CFLAGS="$CFLAGS -pipe -I. -I/usr/local/include -I/usr/include" -dnl - You might wanna change -I/usr/include if you're trying to do this with -dnl Mingw, because it doesnt have a standard file tree. Maybe if ming do this -dnl else do -I/usr/include. Or some shit. You figure it out. - -LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/lib" -dnl - Same thing here. - -dnl - Where are our compilers, and who are we compiling for? -AC_CANONICAL_TARGET -AC_PROG_INSTALL -AC_PROG_CC -AC_PROG_CXX - -AC_ARG_WITH(nasm-prefix, - [ --with-nasm-prefix=PFX Prefix where nasm is installed (optional)], - nasm_prefix="$withval", - nasm_prefix="") -AC_CHECK_TOOL(NASMPATH,nasm,"no",$nasm_prefix:$PATH) -if test x$NASMPATH = xno; then - AC_MSG_ERROR(You need NASM installed to compile ZSNES) -fi - -AC_ARG_WITH(zconf-path, - [ --with-zconf-path=PATH Path where ZSNES looks for zsnesl.cfg (default is .zsnes)], - ZCONF="$withval", - ZCONF="") - -CFLAGS="$CFLAGS -D__UNIXSDL__" -NFLAGS="$NFLAGS -w-orphan-labels -D__UNIXSDL__" -PSRFLAGS="$PSRFLAGS -D__UNIXSDL__" -MMLIB_FILES="\$(MMLIB_D)/mm.o" -STRIP="-s" -case x$target in - *-*-linux*) - NFLAGS="$NFLAGS -f elf -DELF" - MMLIB_FILES="$MMLIB_FILES \$(MMLIB_D)/linux.o" - ;; - *-*-beos*) - CFLAGS="$CFLAGS -D__BEOS__" - NFLAGS="$NFLAGS -D__BEOS__ -f elf -DELF" - ;; - *-*-*bsd*) - CFLAGS="$CFLAGS -D__BSDSDL__" - NFLAGS="$NFLAGS -D__BSDSDL__ -f elf -DELF" - ;; - *-*-darwin* ) - CFLAGS="$CFLAGS -D__MACOSX__ -D__OPENGL__ -arch i386 -mdynamic-no-pic -mstackrealign -fno-unit-at-a-time" - NFLAGS="$NFLAGS -D__MACOSX__ -D__OPENGL__ -f macho -DMACHO" - PSRFLAGS="$PSRFLAGS -D__OPENGL__" - MMLIB_FILES="$MMLIB_FILES \$(MMLIB_D)/osx.o" - STRIP="" - LDFLAGS="$LDFLAGS -framework Carbon -framework IOKit -framework Foundation -framework OpenGL -mdynamic-no-pic -read_only_relocs suppress -undefined dynamic_lookup" - GL_DRAW="\$(PORT_D)/gl_draw.o" - found_opengl=yes - ;; - *-*-cygwin* | *-*-*ming*) - NFLAGS="$NFLAGS -f win32" - ;; - *) - AC_MSG_ERROR(This target is not supported) - ;; -esac - -if test x$ZCONF != x; then - CFLAGS="$CFLAGS -DZCONF=\"\\\"$ZCONF\\\"\"" -fi - -dnl - Library checks (requisites marked *, others optionnal): -dnl - libSDL*, zlib*, libpng, curses, libao, OpenGL, JMAlib - -dnl - libsdl stuff -AM_PATH_SDL(1.2.0,,[AC_MSG_ERROR(SDL >= 1.2.0 is required)]) - -dnl - zlib stuff -AM_PATH_ZLIB(1.2.3,,[AC_MSG_ERROR(zlib >= 1.2.3 is required)]) -CFLAGS="$CFLAGS $ZLIB_CFLAGS" -LDFLAGS="$LDFLAGS $ZLIB_LIBS" - -dnl - libpng stuff -AM_PATH_LIBPNG(1.2.0,,) -CFLAGS="$CFLAGS $SDL_CFLAGS" -LDFLAGS="$LDFLAGS $SDL_LIBS" - -if test x$with_libpng != xyes; then - CFLAGS="$CFLAGS -DNO_PNG" - NFLAGS="$NFLAGS -DNO_PNG" - PSRFLAGS="$PSRFLAGS -DNO_PNG" -else - CFLAGS="$CFLAGS $LIBPNG_CFLAGS" - LDFLAGS="$LDFLAGS $LIBPNG_LIBS" -fi - -dnl - debugger stuff -AC_ARG_ENABLE(debugger, - [ --disable-debugger Build without the zsnes debugger], - , - enable_debugger=yes) -AC_MSG_CHECKING(if you want the zsnes debugger) -AC_MSG_RESULT($enable_debugger) -if test x$enable_debugger != xyes; then - CFLAGS="$CFLAGS -DNO_DEBUGGER" - NFLAGS="$NFLAGS -DNO_DEBUGGER" - PSRFLAGS="$PSRFLAGS -DNO_DEBUGGER" - DEBUGGER_FILES="" -else - DEBUGGER_FILES="debugasm.o debugger.o" - - AC_CHECK_LIB(curses, initscr, found_curses=yes,found_curses=no) - AC_CHECK_LIB(ncurses, initscr, found_ncurses=yes,found_ncurses=no) - AC_CHECK_LIB(pdcurses, initscr, found_pdcurses=yes,found_pdcurses=no) - - if test x$found_curses = xyes; then - LDFLAGS="$LDFLAGS -lcurses" - else - if test x$found_ncurses = xyes; then - CFLAGS="$CFLAGS -DNCURSES" - LDFLAGS="$LDFLAGS -lncurses" - else - if test x$found_pdcurses = xyes; then - LDFLAGS="$LDFLAGS -lpdcurses" - else - AC_MSG_ERROR(A curses library is required to use the debugger) - DEBUGGER_FILES="" - fi - fi - fi -fi - -dnl - libao stuff -AC_ARG_ENABLE(libao, - [ --enable-libao Build with libao support], - want_ao=$enableval, - want_ao=no) -AC_MSG_CHECKING(if you want libao support) -AC_MSG_RESULT($want_ao) -if test x$want_ao = xyes; then - AC_CHECK_LIB(ao, ao_initialize, got_ao=yes, got_ao=no) - - if test x$got_ao = xyes; then - CFLAGS="$CFLAGS -D__LIBAO__" - LDFLAGS="$LDFLAGS -lao" - else - AC_MSG_ERROR(Couldn't find libao) - fi -fi - -dnl - opengl stuff -if test x$found_opengl != xyes; then - AC_ARG_ENABLE(opengl, - [ --disable-opengl Build without OpenGL support], - , - enable_opengl=yes) - AC_ARG_WITH( - opengl-prefix, - [ --with-opengl-prefix=PFX Prefix where OpenGL is installed (optional)], - opengl_prefix="$withval", - opengl_prefix="") - if test x$enable_opengl != xno; then - AC_PATH_X - if test x$opengl_prefix != x; then - CFLAGS="$CFLAGS -I$opengl_prefix/include" - LDFLAGS-"$LDFLAGS -L$opengl_prefix/lib" - fi - if test x$x_libraries != x; then - LDFLAGS="$LDFLAGS -L$x_libraries" - fi - AC_CHECK_LIB(GL, glGetError, found_opengl=yes,found_opengl=no) - fi - - AC_MSG_CHECKING(for OpenGL) - if test x$enable_opengl != xno; then - if test x$found_opengl = xyes; then - LDFLAGS="$LDFLAGS -lGL" - CFLAGS="$CFLAGS -D__OPENGL__" - NFLAGS="$NFLAGS -D__OPENGL__" - PSRFLAGS="$PSRFLAGS -D__OPENGL__" - GL_DRAW="\$(PORT_D)/gl_draw.o" - fi - AC_MSG_RESULT($found_opengl) - else - AC_MSG_RESULT(disabled by user) - fi -fi - -dnl - jma stuff -AC_ARG_ENABLE(jma, - [ --disable-jma Build without JMA support], - , - enable_jma=yes) -AC_MSG_CHECKING(for JMA support) -AC_MSG_RESULT($enable_jma) -if test x$enable_jma != xyes; then - CFLAGS="$CFLAGS -DNO_JMA" - NFLAGS="$NFLAGS -DNO_JMA" - PSRFLAGS="$PSRFLAGS -DNO_JMA" -fi - -dnl - Various debug and optimization option checks -AM_ARCH_DETECT() - -AC_ARG_ENABLE(debug, - [ --enable-debug Build GDB friendly binary (zsnesd)], - debug=$enableval, - debug=no) -AC_MSG_CHECKING(if you want gdb friendly executable) -AC_MSG_RESULT($debug) -if test x$debug = xyes; then -dnl - It is easier to debug zsnes with no optimization enabled. - ZSNESEXE="zsnesd" - PSR_TEMP="" - CFLAGS="$CFLAGS -Wall -W -DDEBUG -O0 -fno-omit-frame-pointer -gstabs3" - NFLAGS="$NFLAGS -DDEBUG -g -F stabs -s -O0" -else - ZSNESEXE="zsnes" - PSR_TEMP=" rm -f t_\$*.c" - - CFLAGSBAK="$CFLAGS" - AC_ARG_VAR(force_arch, [Force architecture to optimize GCC/G++ for]) - AC_MSG_CHECKING(which cpu architecture to optimize for) - if test x$force_arch != x; then - CFLAGS="$CFLAGS -march=$force_arch" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]])], - [AC_MSG_RESULT(forcing $force_arch)], - [AC_MSG_RESULT($force_arch ??) - AC_MSG_WARN(incorrect force_arch parameter) - force_arch="" - CFLAGS="$CFLAGSBAK" - AC_MSG_CHECKING(for autodetected architecture)]) - else - if test x$ARCH_INFO = x; then - case x$target in - i686-*-*) - AC_MSG_RESULT(guessing i686) - CFLAGS="$CFLAGS -march=i686" - ;; - i586-*-*) - AC_MSG_RESULT(guessing i586) - CFLAGS="$CFLAGS -march=i586" - ;; - i486-*-*) - AC_MSG_RESULT(guessing i486) - CFLAGS="$CFLAGS -march=i486" - ;; - *) - AC_MSG_RESULT(guessing i386) - CFLAGS="$CFLAGS -march=i386" - AC_MSG_WARN([This is not what you want, use --target or force-arch]) - ;; - esac - else - AC_MSG_RESULT($ARCH_INFO) - CFLAGS="$CFLAGS -march=$ARCH_INFO" - fi - fi - - AC_ARG_ENABLE(release, - [ --enable-release Build ultra-optimized release binary (zsnes)], - release=$enableval, - release=no) - AC_MSG_CHECKING(if you want crazy optimizations) - AC_MSG_RESULT($release) - if test x$release = xyes; then - if test x$force_arch = x; then - AC_MSG_WARN([If you intend to distribute this binary, make sure you use force_arch and set to i586 (or whichever CPU Arch you intend for)]) - fi - CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -fprefetch-loop-arrays -fforce-addr $STRIP -D__RELEASE__" - NFLAGS="$NFLAGS -O99999999 -D__RELEASE__" - else - CFLAGS="$CFLAGS -O3 -fomit-frame-pointer $STRIP" - NFLAGS="$NFLAGS -O1" - fi -fi -CXXFLAGS="$CFLAGS -fno-rtti" - -if test x$enable_jma != xno; then - JMA_FILES="\$(JMA_D)/7zlzma.o \$(JMA_D)/crc32.o \$(JMA_D)/iiostrm.o\ - \$(JMA_D)/inbyte.o \$(JMA_D)/jma.o \$(JMA_D)/lzma.o\ - \$(JMA_D)/lzmadec.o \$(JMA_D)/winout.o \$(JMA_D)/zsnesjma.o" - ZC="$CXX" - ZCFLAGS="$CXXFLAGS" -else - JMA_FILES="" - ZC="$CC" - ZCFLAGS="$CFLAGS" -fi - -dnl - Check for header files -AC_HEADER_STDC -AC_HEADER_MAJOR - -dnl - Create Makefile -AC_SUBST(VERSION) -AC_SUBST(NASMPATH) -AC_SUBST(ZC) -AC_SUBST(ZCFLAGS) -AC_SUBST(PSRFLAGS) -AC_SUBST(NFLAGS) -AC_SUBST(ZSNESEXE) -AC_SUBST(GL_DRAW) -AC_SUBST(JMA_FILES) -AC_SUBST(MMLIB_FILES) -AC_SUBST(DEBUGGER_FILES) -AC_SUBST(PSR_TEMP) - -AC_CONFIG_FILES(Makefile) -touch -t 198001010000 makefile.dep - -AC_OUTPUT - -dnl - Info output -echo -echo -echo ZSNES v$VERSION -echo -echo "SDL support Version `$SDL_CONFIG --version`" -echo "NASM support `nasm -v`" -echo "zlib support Version $ZLIB_VERSION" -echo $ECHO_N "PNG support $ECHO_C" -if test x$with_libpng = xyes; then - echo "${ECHO_T}Yes, version $LIBPNG_VERSION" -elif test x$enable_libpng = xno; then - echo "${ECHO_T}Disabled by user" -else - echo "${ECHO_T}Disabled, library not found" -fi -echo $ECHO_N "OpenGL support $ECHO_C" -if test x$found_opengl = xyes; then - echo "${ECHO_T}Yes" -elif test x$enable_opengl = xno; then - echo "${ECHO_T}Disabled by user" -else - echo "${ECHO_T}Disabled, library not found" -fi -echo $ECHO_N "JMA support $ECHO_C" -if test x$enable_jma = xno; then - echo "${ECHO_T}Disabled by user" -else - echo "${ECHO_T}Yes" -fi -echo $ECHO_N "ZSNES debugger $ECHO_C" -if test x$enable_debugger = xno; then - echo "${ECHO_T}Disabled" -else - echo "${ECHO_T}Enabled" -fi -echo -echo The binary will be installed in $prefix/bin -echo -echo $ECHO_N "Configure complete, now type '$ECHO_C" -case x$target in - *-*-*bsd*) - echo $ECHO_N "${ECHO_T}g$ECHO_C" - ;; - *) - ;; -esac -echo "${ECHO_T}make' and pray." -echo diff --git a/tools/zsnes/src/cpu/65816d.inc b/tools/zsnes/src/cpu/65816d.inc deleted file mode 100644 index 765cfff..0000000 --- a/tools/zsnes/src/cpu/65816d.inc +++ /dev/null @@ -1,1693 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 flagnz,flago,flagc,execloopdeb,Sjoinflags,Ssplitflags,SA1RegP - -;******************************************************* -; Flag Setting Macros -;******************************************************* - - -%macro endloop 0 - jmp execloopdeb -%endmacro - -%macro restoredl 0 - mov dword[flagnz],0 - test dl,80h - jz %%noneg - or dword[flagnz],10000h -%%noneg - test dl,2h - jnz %%zero - or dword[flagnz],1 -%%zero - mov dword[flagc],0 - test dl,01h - jz %%nocarry - mov dword[flagc],0FFh -%%nocarry - mov dword[flago],0 - test dl,40h - jz %%nov - mov dword[flago],0FFh -%%nov -%endmacro - -%macro makedl 0 - and dl,00111100b - test dword[flagnz],18000h - jz %%noneg - or dl,80h -%%noneg - test dword[flagnz],0FFFFh - jnz %%nozero - or dl,02h -%%nozero - test dword[flagc],0FFh - jz %%nocarry - or dl,01h -%%nocarry - test dword[flago],0FFh - jz %%nov - or dl,40h -%%nov -%endmacro - -SECTION .text - -NEWSYM splitflags - push edx - mov dl,[SA1RegP] - call Ssplitflags - pop edx - restoredl - ret - -NEWSYM joinflags - makedl - push edx - mov dl,[SA1RegP] - call Sjoinflags - mov [SA1RegP],dl - pop edx - ret - -; Sets flags n and z according to al -%macro flagsetnz8b 0 - mov dword[flagnz],0 - mov [flagnz+1],al - endloop -%endmacro - -; Sets flags n and z according to ax -%macro flagsetnz16b 0 - mov cx,ax - mov [flagnz],ecx - endloop -%endmacro - -; Sets flags n and z according to al -%macro flagsetnz8bnel 0 - mov dword[flagnz],0 - mov [flagnz+1],al -%endmacro - -; Sets flags n and z according to ax -%macro flagsetnz16bnel 0 - mov cx,ax - mov [flagnz],ecx -%endmacro - -; Sets flags N V . . . . Z C according to flags -%macro flagsetnvzc8b 0 - mov dword[flagnz],0 - mov al,[xa] - seto byte[flago] - mov [flagnz+1],al - jc .carry - mov dword[flagc],0h - endloop -.carry - mov dword[flagc],0FFh - endloop -%endmacro - -%macro flagsetnvzc16b 0 - mov cx,[xa] - seto byte[flago] - mov [flagnz],ecx - jc .carry - mov dword[flagc],0h - endloop -.carry - mov dword[flagc],0FFh - endloop -%endmacro - -; Sets flags N V . . . . Z C according to flags -%macro flagsetnvzcs8b 0 - mov dword[flagnz],0 - mov al,[xa] - seto byte[flago] - mov [flagnz+1],al - jc .carry - mov dword[flagc],0FFh - endloop -.carry - mov dword[flagc],0h - endloop -%endmacro - -%macro flagsetnvzcs16b 0 - mov cx,[xa] - seto byte[flago] - mov [flagnz],ecx - jc .carry - mov dword[flagc],0FFh - endloop -.carry - mov dword[flagc],0h - endloop -%endmacro - -; Sets flags N V . . . . Z C for 16-bit decimal mode only -%macro flagsetnvzcd 0 - mov cx,[xa] - seto byte[flago] - mov [flagnz],ecx - jc .carry - mov dword[flagc],0h - endloop -.carry - mov dword[flagc],0FFh - endloop -%endmacro - -; Sets flags N . . . . . Z C according to flags and don't jump to execloop -%macro flagsetnzc8b 0 - mov dword[flagnz],0 - mov dword[flagc],0h - mov [flagnz+1],al - jnc .carry - mov dword[flagc],0FFh -.carry -%endmacro - -; Sets flags N . . . . . Z C according to flags and don't jump to execloop -%macro flagsetnzc 0 - mov cx,ax - mov dword[flagc],0h - mov [flagnz],ecx - jnc .carry - mov dword[flagc],0FFh -.carry -%endmacro - -; Sets flags N . . . . . Z C according to flags and jump to execloop -%macro flagsetnzcel8b 0 - mov dword[flagnz],0h - jc .carry - mov [flagnz+1],cl - mov dword[flagc],0FFh - endloop -.carry - mov [flagnz+1],cl - mov dword[flagc],0h - endloop -%endmacro - -%macro flagsetnzcel16b 0 - jc .carry - mov [flagnz],ecx - mov dword[flagc],0FFh - endloop -.carry - mov [flagnz],ecx - mov dword[flagc],0h - endloop -%endmacro - -;******************************************************* -; Opcode Instructions -;******************************************************* - -%macro ADCMacro8bnd 0 - mov cl,[flagc] - add cl,cl - adc [xa],al - flagsetnvzc8b -%endmacro - -%macro ADCMacro16bnd 0 - mov cl,[flagc] - add cl,cl - adc [xa],ax - flagsetnvzc16b -%endmacro - -%macro ADCMacro8bd 0 - mov cl,[flagc] - add cl,cl - mov cl,al - mov al,[xa] - adc al,cl - daa - mov [xa],al - flagsetnvzc8b - endloop -%endmacro - -%macro ADCMacro16bd 0 - mov cl,[flagc] - add cl,cl - mov cx,ax - mov al,[xa] - adc al,cl - daa - mov [xa],al - mov al,[xa+1] - adc al,ch - daa - mov [xa+1],al - flagsetnvzcd -%endmacro - -%macro ANDMacro8b 0 - and al,[xa] - mov dword[flagnz],0 - mov [xa],al - mov [flagnz+1],al - endloop -%endmacro - -%macro ANDMacro16b 0 - and eax,[xa] - mov [xa],ax - flagsetnz16b -%endmacro - -%macro ASLMacro8b 0 - add al,al - flagsetnzc8b -%endmacro - -%macro ASLMacro16b 0 - add ax,ax - flagsetnzc -%endmacro - -%macro JumpMacro 0 - movsx eax,byte[esi] - add esi,eax -.skip - inc esi - endloop -%endmacro - -%macro BITMacroim8b 0 - mov al,[esi] - test dword[flagnz],18000h - jz .notflagnz - or dword[flagnz],10000h -.notflagnz - inc esi - test [xa],al - jz .zero - mov word[flagnz],1 - endloop -.zero - mov word[flagnz],0 - endloop -%endmacro - -%macro BITMacroim16b 0 - mov ax,[esi] - test dword[flagnz],18000h - jz .notflagnz - or dword[flagnz],10000h -.notflagnz - add esi,2 - test [xa],ax - jz .zero - mov word[flagnz],1 - endloop -.zero - mov word[flagnz],0 - endloop -%endmacro - -%macro BITMacro8b 0 - mov dword[flagnz],10000h - test al,80h - jnz .flagn - mov dword[flagnz],0 -.flagn - mov dword[flago],1 - test al,40h - jnz .flago - mov dword[flago],0 -.flago - test [xa],al - jz .zero - mov word[flagnz],1 - endloop -.zero - mov word[flagnz],0 - endloop -%endmacro - -%macro BITMacro16b 0 - mov dword[flagnz],10000h - test ax,8000h - jnz .flagn - mov dword[flagnz],0 -.flagn - mov dword[flago],1 - test ax,4000h - jnz .flago - mov dword[flago],0 -.flago - test [xa],ax - jz .zero - mov word[flagnz],1 - endloop -.zero - mov word[flagnz],0 - endloop -%endmacro - -%macro BRKMacro 0 - inc esi - test byte[xe],1 - jne near BRKemulmode - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - xor ebx,ebx - mov bx,[xs] - mov cl,[xpb] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [xs],bx - xor bh,bh - mov bl,[xirqb] - mov [xpb],bl - xor eax,eax - mov ax,[brkv] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -BRKemulmode - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - xor ebx,ebx - mov bx,[xs] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [xs],bx - xor bh,bh - mov bl,[xpb] - xor eax,eax - mov ax,[brkv8] - mov [xpc],ax - and dl,11110011b - or dl,00001100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro BRLMacro 0 - mov ebx,esi - sub ebx,[initaddrl] - add bx,2 - xor eax,eax - add bx,[esi] - mov ax,bx - xor ebx,ebx - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro CMPMacro8b 0 - mov cl,[xa] - sub cl,al - flagsetnzcel8b -%endmacro - -%macro CMPMacro16b 0 - mov cx,[xa] - sub cx,ax - flagsetnzcel16b -%endmacro - -%macro COPMacro 0 - inc esi - test byte[xe],1 - jne near COPemulmode - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - xor ebx,ebx - mov bx,[xs] - mov cl,[xpb] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [xs],bx - xor bh,bh - mov bl,[xirqb] - mov [xpb],bl - xor eax,eax - mov ax,[copv] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -COPemulmode - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - xor ebx,ebx - mov bx,[xs] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [xs],bx - xor bh,bh - mov bl,[xpb] - xor eax,eax - mov ax,[copv8] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro CPXMacro8b 0 - mov cl,[xx] - sub cl,al - flagsetnzcel8b -%endmacro - -%macro CPXMacro16b 0 - mov cx,[xx] - sub cx,ax - flagsetnzcel16b -%endmacro - -%macro CPYMacro8b 0 - mov cl,[xy] - sub cl,al - flagsetnzcel8b -%endmacro - -%macro CPYMacro16b 0 - mov cx,[xy] - sub cx,ax - flagsetnzcel16b -%endmacro - -%macro EORMacro8b 0 - xor al,[xa] - mov dword[flagnz],0 - mov [xa],al - mov [flagnz+1],al - endloop -%endmacro - -%macro EORMacro16b 0 - xor eax,[xa] - mov [xa],ax - flagsetnz16b -%endmacro - -%macro JMLMacro 0 - mov cx,[esi] - xor eax,eax - call membank0r16 - add cx,2 - push eax - call membank0r8 - mov bl,al - pop eax - mov [xpc],ax - mov [xpb],bl - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro4C 0 - xor eax,eax - mov ax,[esi] - mov bl,[xpb] - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr -; mov esi,[snesmap2+ebx*4] -; mov [initaddrl],esi -; add esi,eax -; endloop - mov esi,[snesmap2+ebx*4] - cmp eax,4300h - jae .upperlower - mov [initaddrl],esi - add esi,eax - endloop -.upperlower - cmp dword[memtabler8+ebx*4],regaccessbankr8 - je .dma - mov [initaddrl],esi - add esi,eax - endloop -.dma - mov esi,dmadata-4300h - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro6C 0 - mov cx,[esi] - xor eax,eax - call membank0r16 - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro7C 0 - mov cx,[esi] - xor eax,eax - add cx,[xx] - mov bl,[xpb] - call dword near [memtabler16+ebx*4] - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro5C 0 - xor eax,eax - mov bl,[esi+2] - mov ax,[esi] - mov [xpb],bl - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JSLMacro 0 - mov ebx,esi - sub ebx,[initaddrl] - add bx,2 - mov [xpc],bx - - mov cx,[xs] - mov al,[xpb] - call membank0w8 - - dec cx - or cx,word[stackor] - mov al,[xpc+1] - call membank0w8 - - dec cx - or cx,word[stackor] - mov al,[xpc] - call membank0w8 - - dec cx - or cx,word[stackor] - - mov [xs],cx - xor eax,eax - xor bh,bh - mov ax,[esi] - mov bl,[esi+2] - mov [xpc],ax - mov [xpb],bl - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JSRMacro20 0 - mov ebx,esi - sub ebx,[initaddrl] - inc bx - mov [xpc],bx - - mov cx,[xs] - mov al,[xpc+1] - call membank0w8 - - dec cx - or cx,word[stackor] - mov al,[xpc] - call membank0w8 - - dec cx - or cx,word[stackor] - - xor eax,eax - mov [xs],cx - - mov ax,[esi] - xor bh,bh - - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - cmp eax,4300h - jae .upperlower - mov [initaddrl],esi - add esi,eax - endloop -.upperlower - cmp dword[memtabler8+ebx*4],regaccessbankr8 - je .dma - mov [initaddrl],esi - add esi,eax - endloop -.dma - mov esi,dmadata-4300h - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JSRMacroFC 0 - mov ebx,esi - sub ebx,[initaddrl] - inc bx - mov [xpc],bx - - mov cx,[xs] - mov al,[xpc+1] - call membank0w8 - - dec cx - or cx,word[stackor] - mov al,[xpc] - call membank0w8 - - dec cx - or cx,word[stackor] - - xor eax,eax - mov [xs],cx - - - xor eax,eax - xor bh,bh - mov cx,[esi] - mov bl,[xpb] - add cx,[xx] - call dword near [memtabler16+ebx*4] - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro LDAMacro8b 0 - mov dword[flagnz],0 - mov [xa],al - mov [flagnz+1],al - endloop -%endmacro - -%macro LDAMacro16b 0 - mov [xa],ax - flagsetnz16b - endloop -%endmacro - -%macro LDXMacro8b 0 - mov dword[flagnz],0 - mov [xx],al - mov [flagnz+1],al - endloop -%endmacro - -%macro LDXMacro16b 0 - mov [xx],ax - flagsetnz16b - endloop -%endmacro - -%macro LDYMacro8b 0 - mov dword[flagnz],0 - mov [xy],al - mov [flagnz+1],al - endloop -%endmacro - -%macro LDYMacro16b 0 - mov [xy],ax - flagsetnz16b - endloop -%endmacro - -%macro LSRMacro8b 0 - shr al,1 - flagsetnzc8b -%endmacro - -%macro LSRMacro16b 0 - shr ax,1 - flagsetnzc -%endmacro - -%macro MVNMacro 0 - mov ax,[esi] - mov [xdb],al - mov bl,ah - mov cx,[xx] - call dword near [memtabler8+ebx*4] - mov bl,[xdb] - mov cx,[xy] - call dword near [memtablew8+ebx*4] - test dl,10h - jnz .pagezero - inc word[xx] - inc word[xy] - dec word[xa] - cmp word[xa],0FFFFh - je .endmove - dec esi - endloop -.endmove - add esi,2 - endloop -.pagezero - inc byte[xx] - inc byte[xy] - dec word[xa] - cmp word[xa],0FFFFh - je .endmove - dec esi - endloop -%endmacro - -%macro MVPMacro 0 - mov ax,[esi] - mov [xdb],al - mov bl,ah - mov cx,[xx] - call dword near [memtabler8+ebx*4] - mov bl,[xdb] - mov cx,[xy] - call dword near [memtablew8+ebx*4] - test dl,10h - jnz .pagezero - dec word[xx] - dec word[xy] - dec word[xa] - cmp word[xa],0FFFFh - je .endmove - dec esi - endloop -.endmove - add esi,2 - endloop -.pagezero - dec byte[xx] - dec byte[xy] - dec word[xa] - cmp word[xa],0FFFFh - je .endmove - dec esi - endloop -%endmacro - -%macro ORAMacro8b 0 - or al,[xa] - mov dword[flagnz],0 - mov [xa],al - mov [flagnz+1],al - endloop -%endmacro - -%macro ORAMacro16b 0 - or ax,[xa] - mov [xa],ax - flagsetnz16b -%endmacro - -%macro PUSHMacro8b 1 - mov cx,[xs] - mov al,%1 - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - endloop -%endmacro - -%macro PUSHMacro8bp 0 - makedl - mov cx,[xs] - mov al,dl - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - endloop -%endmacro - -%macro PUSHMacro16b 2 - mov cx,[xs] - mov al,%2 - call membank0w8 - dec cx - or cx,word[stackor] - mov al,%1 - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - endloop -%endmacro - -%macro PEAMacro 0 - mov cx,[xs] - mov al,[esi+1] - call membank0w8 - dec cx - or cx,word[stackor] - mov al,[esi] - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - add esi,2 - endloop -%endmacro - -%macro PEIMacro 0 - xor ah,ah - mov al,[esi] - mov cx,[xd] - inc esi - add cx,ax - call membank0r16 - mov cx,[xs] - push eax - mov al,ah - call membank0w8 - pop eax - dec cx - or cx,word[stackor] - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - endloop -%endmacro - -%macro PERMacro 0 - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr - mov eax,[snesmmap+ebx*4] - mov ebx,esi - sub ebx,eax - add bx,[esi] - mov ax,bx - add esi,2 - add ax,2 - mov cx,[xs] - push eax - mov al,ah - call membank0w8 - pop eax - dec cx - or cx,word[stackor] - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - xor ebx,ebx - endloop -.loweraddr - mov eax,[snesmap2+ebx*4] - mov ebx,esi - sub ebx,eax - add bx,[esi] - mov ax,bx - add esi,2 - add ax,2 - mov cx,[xs] - push eax - mov al,ah - call membank0w8 - pop eax - dec cx - or cx,word[stackor] - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - xor ebx,ebx - endloop -%endmacro - -%macro POPMacro8b 1 - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xs],cx - mov %1,al - flagsetnz8b - endloop -%endmacro - -%macro POPMacro16b 2 - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov %1,al - mov [xs],cx - inc cx - and cx,word[stackand] - call membank0r8 - mov %2,al - mov [xs],cx - mov ah,al - mov al,%1 - flagsetnz16b -%endmacro - -%macro POPMacro16bd 2 - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov %1,al - mov [xs],cx - inc cx - and cx,word[stackand] - call membank0r8 - mov %2,al - call UpdateDPage - mov [xs],cx - mov ah,al - mov al,%1 - flagsetnz16b -%endmacro - -%macro POPMacroP 0 - - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xs],cx - - xor bh,bh - mov dl,al - restoredl - test byte[xe],01h - jnz .emul - mov bl,dl - mov edi,[tablead+ebx*4] - test dl,00010000b - jnz .setx - endloop -.setx - mov byte[xx+1],0 - mov byte[xy+1],0 - endloop -.emul - or dl,00110000b - mov bl,dl - mov edi,[tablead+ebx*4] - endloop -%endmacro - -%macro REPMacro 0 - mov al,[esi] - inc esi - test al,11000011b - jnz .extraflags - not al - and dl,al - test byte[xe],01h - jnz .emul - mov bl,dl - mov edi,[tablead+ebx*4] - endloop -.emul - or dl,00110000b - mov bl,dl - mov edi,[tablead+ebx*4] - endloop - -.extraflags - not al - makedl - and dl,al - restoredl - test byte[xe],01h - jnz .emul2 - mov bl,dl - mov edi,[tablead+ebx*4] - endloop -.emul2 - or dl,00110000b - mov bl,dl - mov edi,[tablead+ebx*4] - endloop -%endmacro - -%macro ROLMacro8b 0 - mov cl,[flagc] - add cl,cl - rcl al,1 - flagsetnzc8b -%endmacro - -%macro ROLMacro16b 0 - mov cl,[flagc] - add cl,cl - rcl ax,1 - flagsetnzc -%endmacro - -%macro RORMacro8b 0 - mov cl,[flagc] - add cl,cl - rcr al,1 - flagsetnzc8b -%endmacro - -%macro RORMacro16b 0 - mov cl,[flagc] - add cl,cl - rcr ax,1 - flagsetnzc -%endmacro - -%macro RTIMacro 0 - cmp byte[nmistatus],3 - jne .nodis658162 - test byte[curexecstate],01h - jz .nodis65816 - and byte[curexecstate],0FEh -.nodis65816 - cmp byte[curexecstate],0 - jne .nn - xor dh,dh -.nn -.nodis658162 - mov byte[curnmi],0 - test byte[xe],1 - jne near emulRTI - - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xs],cx - mov dl,al - restoredl - - mov cx,[xs] - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc+1],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpb],al - mov [xs],cx - - xor bh,bh - xor eax,eax - mov ax,[xpc] - mov bl,dl - mov edi,[tablead+ebx*4] - mov bl,[xpb] - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - test dl,00010000b - jnz .setx - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - cmp eax,4300h - jae .upperlower - mov [initaddrl],esi - add esi,eax - cmp byte[esi],0CBh - jne .notwai - mov byte[intrset],2 -.notwai - test dl,00010000b - jnz .setx - endloop -.setx - mov byte[xx+1],0 - mov byte[xy+1],0 - endloop -.upperlower - cmp dword[memtabler8+ebx*4],regaccessbankr8 - je .dma - mov byte[doirqnext],0 - mov [initaddrl],esi - add esi,eax - cmp byte[esi],0CBh - jne .notwai2 - mov byte[intrset],2 -.notwai2 - test dl,00010000b - jnz .setx - endloop -.dma - mov esi,dmadata-4300h - mov [initaddrl],esi - add esi,eax - test dl,00010000b - jnz .setx - endloop - -emulRTI - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xs],cx - - mov dl,al - or dl,00110000b - restoredl - - mov cx,[xs] - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc+1],al - mov [xs],cx - - - xor bh,bh - xor eax,eax - mov ax,[xpc] - mov bl,dl - mov edi,[tablead+ebx*4] - xor bl,bl - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro RTLMacro 0 - mov cx,[xs] - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc+1],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpb],al - -; inc bx -; and bx,word[stackand] -; mov cl,[eax+ebx] - -; inc bx -; and bx,word[stackand] -; mov ch,[eax+ebx] - -; inc bx -; and bx,word[stackand] -; mov al,[eax+ebx] - -; mov [xpb],al - - mov [xs],cx - xor bh,bh - xor eax,eax - mov ax,[xpc] - inc ax - mov bl,[xpb] - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro RTSMacro 0 - - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc],al - - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc+1],al - - mov [xs],cx - xor bh,bh - xor eax,eax - mov ax,[xpc] - inc ax - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro SBCMacro8bnd 0 - mov cl,[flagc] - sub cl,1 - sbb [xa],al - flagsetnvzcs8b - endloop -%endmacro - -%macro SBCMacro16bnd 0 - mov cl,[flagc] - sub cl,1 - sbb [xa],ax - flagsetnvzcs16b - endloop -%endmacro - -%macro SBCMacro8bd 0 - mov cl,[flagc] - sub cl,1 - mov cl,al - mov al,[xa] - sbb al,cl - das - mov [xa],al - flagsetnvzcs8b - endloop -%endmacro - -%macro SBCMacro16bd 0 - mov cl,[flagc] - sub cl,1 - mov cx,ax - mov al,[xa] - sbb al,cl - das - mov [xa],al - mov al,[xa+1] - sbb al,ch - das - mov [xa+1],al - cmc - flagsetnvzcd - endloop -%endmacro - -%macro SEPMacro 0 - mov al,[esi] - inc esi - test al,11000011b - jnz .extraflags - or dl,al - mov bl,dl - mov edi,[tablead+ebx*4] - test dl,00010000b - jnz .setx - endloop -.setx - mov byte[xx+1],0 - mov byte[xy+1],0 - endloop -.extraflags - makedl - or dl,al - restoredl - mov bl,dl - mov edi,[tablead+ebx*4] - test dl,00010000b - jnz .setx2 - endloop -.setx2 - mov byte[xx+1],0 - mov byte[xy+1],0 - endloop -%endmacro - -%macro STAMacro8b 0 - mov al,[xa] -%endmacro - -%macro STAMacro16b 0 - mov eax,[xa] -%endmacro - -%macro STXMacro8b 0 - mov al,[xx] -%endmacro - -%macro STXMacro16b 0 - mov eax,[xx] -%endmacro - -%macro STYMacro8b 0 - mov al,[xy] -%endmacro - -%macro STYMacro16b 0 - mov eax,[xy] -%endmacro - -%macro WAIMacro 0 - cmp byte[intrset],1 - jne .notws - dec esi - endloop -.notws - test byte[intrset],0FFh - jz .waitstate - cmp byte[intrset],2 - je .stopint - dec esi - endloop -.waitstate - mov byte[intrset],1 - dec esi - endloop -.stopint - mov byte[intrset],0 - mov byte[doirqnext],0 - endloop -%endmacro - -%macro XCEMacro 0 - mov al,[flagc] - mov dword[flagc],0 - and al,00000001b - cmp [xe],al - jne .nochange - endloop -.nochange - test byte[xe],0FFh - jz .noemul - mov dword[flagc],0FFh -.noemul - mov [xe],al - test byte[xe],01h - jnz .emul - or dl,00100000b - mov word[stackand],0FFFFh - mov word[stackor],0000h - endloop -.emul - or dl,00110000b - mov bl,dl - mov edi,[tablead+ebx*4] - mov byte[xx+1],0 - mov byte[xy+1],0 - mov byte[xs+1],1 - mov word[stackand],01FFh - mov word[stackor],0100h - endloop -%endmacro - - diff --git a/tools/zsnes/src/cpu/65816dc.inc b/tools/zsnes/src/cpu/65816dc.inc deleted file mode 100644 index 04145b1..0000000 --- a/tools/zsnes/src/cpu/65816dc.inc +++ /dev/null @@ -1,1707 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 flagnz,flago,flagc,cpucycle,cycpbl,cycpblt,opcjmptab,doirqnext,dmadata - -;******************************************************* -; Flag Setting Macros -;******************************************************* - - -%macro endloop 0 - sub dword[cycpbl],55 - jnc %%skipallspc - mov eax,[cycpblt] - mov bl,[ebp] - add dword[cycpbl],eax - ; 1260, 10000/12625 - inc ebp - call dword [opcjmptab+ebx*4] - xor ebx,ebx -%%skipallspc - mov bl,[esi] - inc esi - sub dh,[cpucycle+ebx] - jc %%cpuover - jmp dword [edi+ebx*4] -%%cpuover - ret -%endmacro - -%macro restoredl 0 - mov dword[flagnz],0 - test dl,80h - jz %%noneg - or dword[flagnz],10000h -%%noneg - test dl,2h - jnz %%zero - or dword[flagnz],1 -%%zero - mov dword[flagc],0 - test dl,01h - jz %%nocarry - mov dword[flagc],0FFh -%%nocarry - mov dword[flago],0 - test dl,40h - jz %%nov - mov dword[flago],0FFh -%%nov -%endmacro - -%macro makedl 0 - and dl,00111100b - test dword[flagnz],18000h - jz %%noneg - or dl,80h -%%noneg - test dword[flagnz],0FFFFh - jnz %%nozero - or dl,02h -%%nozero - test dword[flagc],0FFh - jz %%nocarry - or dl,01h -%%nocarry - test dword[flago],0FFh - jz %%nov - or dl,40h -%%nov -%endmacro - -; Sets flags n and z according to al -%macro flagsetnz8b 0 - mov dword[flagnz],0 - mov [flagnz+1],al - endloop -%endmacro - -; Sets flags n and z according to ax -%macro flagsetnz16b 0 - mov cx,ax - mov [flagnz],ecx - endloop -%endmacro - -; Sets flags n and z according to al -%macro flagsetnz8bnel 0 - mov dword[flagnz],0 - mov [flagnz+1],al -%endmacro - -; Sets flags n and z according to ax -%macro flagsetnz16bnel 0 - mov cx,ax - mov [flagnz],ecx -%endmacro - -; Sets flags N V . . . . Z C according to flags -%macro flagsetnvzc8b 0 - mov dword[flagnz],0 - mov al,[xa] - seto byte[flago] - mov [flagnz+1],al - jc .carry - mov dword[flagc],0h - endloop -.carry - mov dword[flagc],0FFh - endloop -%endmacro - -%macro flagsetnvzc16b 0 - mov cx,[xa] - seto byte[flago] - mov [flagnz],ecx - jc .carry - mov dword[flagc],0h - endloop -.carry - mov dword[flagc],0FFh - endloop -%endmacro - -; Sets flags N V . . . . Z C according to flags -%macro flagsetnvzcs8b 0 - mov dword[flagnz],0 - mov al,[xa] - seto byte[flago] - mov [flagnz+1],al - jc .carry - mov dword[flagc],0FFh - endloop -.carry - mov dword[flagc],0h - endloop -%endmacro - -%macro flagsetnvzcs16b 0 - mov cx,[xa] - seto byte[flago] - mov [flagnz],ecx - jc .carry - mov dword[flagc],0FFh - endloop -.carry - mov dword[flagc],0h - endloop -%endmacro - -; Sets flags N V . . . . Z C for 16-bit decimal mode only -%macro flagsetnvzcd 0 - mov cx,[xa] - seto byte[flago] - mov [flagnz],ecx - jc .carry - mov dword[flagc],0h - endloop -.carry - mov dword[flagc],0FFh - endloop -%endmacro - -; Sets flags N . . . . . Z C according to flags and don't jump to execloop -%macro flagsetnzc8b 0 - mov dword[flagnz],0 - mov dword[flagc],0h - mov [flagnz+1],al - jnc .carry - mov dword[flagc],0FFh -.carry -%endmacro - -; Sets flags N . . . . . Z C according to flags and don't jump to execloop -%macro flagsetnzc 0 - mov cx,ax - mov dword[flagc],0h - mov [flagnz],ecx - jnc .carry - mov dword[flagc],0FFh -.carry -%endmacro - -; Sets flags N . . . . . Z C according to flags and jump to execloop -%macro flagsetnzcel8b 0 - mov dword[flagnz],0h - jc .carry - mov [flagnz+1],cl - mov dword[flagc],0FFh - endloop -.carry - mov [flagnz+1],cl - mov dword[flagc],0h - endloop -%endmacro - -%macro flagsetnzcel16b 0 - jc .carry - mov [flagnz],ecx - mov dword[flagc],0FFh - endloop -.carry - mov [flagnz],ecx - mov dword[flagc],0h - endloop -%endmacro - -;******************************************************* -; Opcode Instructions -;******************************************************* - -%macro ADCMacro8bnd 0 - mov cl,[flagc] - add cl,cl - adc [xa],al - flagsetnvzc8b -%endmacro - -%macro ADCMacro16bnd 0 - mov cl,[flagc] - add cl,cl - adc [xa],ax - flagsetnvzc16b -%endmacro - -%macro ADCMacro8bd 0 - mov cl,[flagc] - add cl,cl - mov cl,al - mov al,[xa] - adc al,cl - daa - mov [xa],al - flagsetnvzc8b - endloop -%endmacro - -%macro ADCMacro16bd 0 - mov cl,[flagc] - add cl,cl - mov cx,ax - mov al,[xa] - adc al,cl - daa - mov [xa],al - mov al,[xa+1] - adc al,ch - daa - mov [xa+1],al - flagsetnvzcd -%endmacro - -%macro ANDMacro8b 0 - and al,[xa] - mov dword[flagnz],0 - mov [xa],al - mov [flagnz+1],al - endloop -%endmacro - -%macro ANDMacro16b 0 - and eax,[xa] - mov [xa],ax - flagsetnz16b -%endmacro - -%macro ASLMacro8b 0 - add al,al - flagsetnzc8b -%endmacro - -%macro ASLMacro16b 0 - add ax,ax - flagsetnzc -%endmacro - -%macro JumpMacro 0 - movsx eax,byte[esi] - add esi,eax -.skip - inc esi - endloop -%endmacro - -%macro BITMacroim8b 0 - mov al,[esi] - test dword[flagnz],18000h - jz .notflagnz - or dword[flagnz],10000h -.notflagnz - inc esi - test [xa],al - jz .zero - mov word[flagnz],1 - endloop -.zero - mov word[flagnz],0 - endloop -%endmacro - -%macro BITMacroim16b 0 - mov ax,[esi] - test dword[flagnz],18000h - jz .notflagnz - or dword[flagnz],10000h -.notflagnz - add esi,2 - test [xa],ax - jz .zero - mov word[flagnz],1 - endloop -.zero - mov word[flagnz],0 - endloop -%endmacro - -%macro BITMacro8b 0 - mov dword[flagnz],10000h - test al,80h - jnz .flagn - mov dword[flagnz],0 -.flagn - mov dword[flago],1 - test al,40h - jnz .flago - mov dword[flago],0 -.flago - test [xa],al - jz .zero - mov word[flagnz],1 - endloop -.zero - mov word[flagnz],0 - endloop -%endmacro - -%macro BITMacro16b 0 - mov dword[flagnz],10000h - test ax,8000h - jnz .flagn - mov dword[flagnz],0 -.flagn - mov dword[flago],1 - test ax,4000h - jnz .flago - mov dword[flago],0 -.flago - test [xa],ax - jz .zero - mov word[flagnz],1 - endloop -.zero - mov word[flagnz],0 - endloop -%endmacro - -%macro BRKMacro 0 - inc esi - test byte[xe],1 - jne near BRKemulmode - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - xor ebx,ebx - mov bx,[xs] - mov cl,[xpb] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [xs],bx - xor bh,bh - mov bl,[xirqb] - mov [xpb],bl - xor eax,eax - mov ax,[brkv] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -BRKemulmode - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - xor ebx,ebx - mov bx,[xs] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [xs],bx - xor bh,bh - mov bl,[xpb] - xor eax,eax - mov ax,[brkv8] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro BRLMacro 0 - mov ax,[xpc] - mov bl,[xpb] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - add bx,2 - xor eax,eax - add bx,[esi] - mov ax,bx - xor ebx,ebx - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro CMPMacro8b 0 - mov cl,[xa] - sub cl,al - flagsetnzcel8b -%endmacro - -%macro CMPMacro16b 0 - mov cx,[xa] - sub cx,ax - flagsetnzcel16b -%endmacro - -%macro COPMacro 0 - inc esi - test byte[xe],1 - jne near COPemulmode - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - xor ebx,ebx - mov bx,[xs] - mov cl,[xpb] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [xs],bx - xor bh,bh - mov bl,[xirqb] - mov [xpb],bl - xor eax,eax - mov ax,[copv] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -COPemulmode - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - xor ebx,ebx - mov bx,[xs] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [xs],bx - xor bh,bh - mov bl,[xpb] - xor eax,eax - mov ax,[copv8] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro CPXMacro8b 0 - mov cl,[xx] - sub cl,al - flagsetnzcel8b -%endmacro - -%macro CPXMacro16b 0 - mov cx,[xx] - sub cx,ax - flagsetnzcel16b -%endmacro - -%macro CPYMacro8b 0 - mov cl,[xy] - sub cl,al - flagsetnzcel8b -%endmacro - -%macro CPYMacro16b 0 - mov cx,[xy] - sub cx,ax - flagsetnzcel16b -%endmacro - -%macro EORMacro8b 0 - xor al,[xa] - mov dword[flagnz],0 - mov [xa],al - mov [flagnz+1],al - endloop -%endmacro - -%macro EORMacro16b 0 - xor eax,[xa] - mov [xa],ax - flagsetnz16b -%endmacro - -%macro JMLMacro 0 - mov cx,[esi] - xor eax,eax - call membank0r16 - add cx,2 - push eax - call membank0r8 - mov bl,al - pop eax - mov [xpc],ax - mov [xpb],bl - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - - -%macro JMPMacro4C 0 - xor eax,eax - mov ax,[esi] - mov bl,[xpb] - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr -; mov esi,[snesmap2+ebx*4] -; mov [initaddrl],esi -; add esi,eax -; endloop - mov esi,[snesmap2+ebx*4] - cmp eax,4300h - jae .upperlower - mov [initaddrl],esi - add esi,eax - endloop -.upperlower - cmp dword[memtabler8+ebx*4],regaccessbankr8 - je .dma - mov [initaddrl],esi - add esi,eax - endloop -.dma - mov esi,dmadata-4300h - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro6C 0 - mov cx,[esi] - xor eax,eax - call membank0r16 - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro7C 0 - mov cx,[esi] - xor eax,eax - add cx,[xx] - mov bl,[xpb] - call dword [memtabler16+ebx*4] - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro5C 0 - xor eax,eax - mov bl,[esi+2] - mov ax,[esi] - mov [xpb],bl - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JSLMacro 0 - mov ebx,esi - sub ebx,[initaddrl] - add bx,2 - mov [xpc],bx - - mov cx,[xs] - mov al,[xpb] - call membank0w8 - - dec cx - or cx,word[stackor] - mov al,[xpc+1] - call membank0w8 - - dec cx - or cx,word[stackor] - mov al,[xpc] - call membank0w8 - - dec cx - or cx,word[stackor] - - mov [xs],cx - xor eax,eax - xor bh,bh - mov ax,[esi] - mov bl,[esi+2] - mov [xpc],ax - mov [xpb],bl - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JSRMacro20 0 - mov ebx,esi - sub ebx,[initaddrl] - inc bx - mov [xpc],bx - - mov cx,[xs] - mov al,[xpc+1] - call membank0w8 - - dec cx - or cx,word[stackor] - mov al,[xpc] - call membank0w8 - - dec cx - or cx,word[stackor] - - xor eax,eax - mov [xs],cx - - mov ax,[esi] - xor bh,bh - - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - cmp eax,4300h - jae .upperlower - mov [initaddrl],esi - add esi,eax - endloop -.upperlower - cmp dword[memtabler8+ebx*4],regaccessbankr8 - je .dma - mov [initaddrl],esi - add esi,eax - endloop -.dma - mov esi,dmadata-4300h - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JSRMacroFC 0 - mov ebx,esi - sub ebx,[initaddrl] - inc bx - mov [xpc],bx - - mov cx,[xs] - mov al,[xpc+1] - call membank0w8 - - dec cx - or cx,word[stackor] - mov al,[xpc] - call membank0w8 - - dec cx - or cx,word[stackor] - - xor eax,eax - mov [xs],cx - - - xor eax,eax - xor bh,bh - mov cx,[esi] - mov bl,[xpb] - add cx,[xx] - call dword [memtabler16+ebx*4] - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro LDAMacro8b 0 - mov dword[flagnz],0 - mov [xa],al - mov [flagnz+1],al - endloop -%endmacro - -%macro LDAMacro16b 0 - mov [xa],ax - flagsetnz16b - endloop -%endmacro - -%macro LDXMacro8b 0 - mov dword[flagnz],0 - mov [xx],al - mov [flagnz+1],al - endloop -%endmacro - -%macro LDXMacro16b 0 - mov [xx],ax - flagsetnz16b - endloop -%endmacro - -%macro LDYMacro8b 0 - mov dword[flagnz],0 - mov [xy],al - mov [flagnz+1],al - endloop -%endmacro - -%macro LDYMacro16b 0 - mov [xy],ax - flagsetnz16b - endloop -%endmacro - -%macro LSRMacro8b 0 - shr al,1 - flagsetnzc8b -%endmacro - -%macro LSRMacro16b 0 - shr ax,1 - flagsetnzc -%endmacro - -%macro MVNMacro 0 - mov ax,[esi] - mov [xdb],al - mov bl,ah - mov cx,[xx] - call dword [memtabler8+ebx*4] - mov bl,[xdb] - mov cx,[xy] - call dword [memtablew8+ebx*4] - test dl,10h - jnz near .pagezero - inc word[xx] - inc word[xy] - dec word[xa] - cmp word[xa],0FFFFh - je .endmove - dec esi - endloop -.endmove - add esi,2 - endloop -.pagezero - inc byte[xx] - inc byte[xy] - dec word[xa] - cmp word[xa],0FFFFh - je .endmove - dec esi - endloop -%endmacro - -%macro MVPMacro 0 - mov ax,[esi] - mov [xdb],al - mov bl,ah - mov cx,[xx] - call dword [memtabler8+ebx*4] - mov bl,[xdb] - mov cx,[xy] - call dword [memtablew8+ebx*4] - test dl,10h - jnz near .pagezero - dec word[xx] - dec word[xy] - dec word[xa] - cmp word[xa],0FFFFh - je .endmove - dec esi - endloop -.endmove - add esi,2 - endloop -.pagezero - dec byte[xx] - dec byte[xy] - dec word[xa] - cmp word[xa],0FFFFh - je .endmove - dec esi - endloop -%endmacro - -%macro ORAMacro8b 0 - or al,[xa] - mov dword[flagnz],0 - mov [xa],al - mov [flagnz+1],al - endloop -%endmacro - -%macro ORAMacro16b 0 - or ax,[xa] - mov [xa],ax - flagsetnz16b -%endmacro - -%macro PUSHMacro8b 1 - mov eax,[wramdata] - mov cx,[xs] - mov al,%1 - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - endloop -%endmacro - -%macro PUSHMacro8bp 0 - mov eax,[wramdata] - makedl - mov cx,[xs] - mov al,dl - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - endloop -%endmacro - -%macro PUSHMacro16b 2 - mov cx,[xs] - mov al,%2 - call membank0w8 - dec cx - or cx,word[stackor] - mov al,%1 - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - endloop -%endmacro - -%macro PEAMacro 0 - mov cx,[xs] - mov al,[esi+1] - call membank0w8 - dec cx - or cx,word[stackor] - mov al,[esi] - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - add esi,2 - endloop -%endmacro - -%macro PEIMacro 0 - xor ah,ah - mov al,[esi] - mov cx,[xd] - inc esi - add cx,ax - call membank0r16 - mov cx,[xs] - push eax - mov al,ah - call membank0w8 - pop eax - dec cx - or cx,word[stackor] - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - endloop -%endmacro - -%macro PERMacro 0 - mov bl,[xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr - mov eax,[snesmmap+ebx*4] - mov ebx,esi - sub ebx,eax - add bx,[esi] - mov ax,bx - add esi,2 - add ax,2 - mov cx,[xs] - push eax - mov al,ah - call membank0w8 - pop eax - dec cx - or cx,word[stackor] - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - xor ebx,ebx - endloop -.loweraddr - mov eax,[snesmap2+ebx*4] - mov ebx,esi - sub ebx,eax - add bx,[esi] - mov ax,bx - add esi,2 - add ax,2 - mov cx,[xs] - push eax - mov al,ah - call membank0w8 - pop eax - dec cx - or cx,word[stackor] - call membank0w8 - dec cx - or cx,word[stackor] - mov [xs],cx - xor ebx,ebx - endloop -%endmacro - -%macro POPMacro8b 1 - mov eax,[wramdata] - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xs],cx - mov %1,al - flagsetnz8b - endloop -%endmacro - -%macro POPMacro16b 2 - mov eax,[wramdata] - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov %1,al - mov [xs],cx - inc cx - and cx,word[stackand] - call membank0r8 - mov %2,al - mov [xs],cx - mov ah,al - mov al,%1 - flagsetnz16b -%endmacro - -%macro POPMacro16bd 2 - mov eax,[wramdata] - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov %1,al - mov [xs],cx - inc cx - and cx,word[stackand] - call membank0r8 - mov %2,al - call UpdateDPage - mov [xs],cx - mov ah,al - mov al,%1 - flagsetnz16b -%endmacro - -%macro POPMacroP 0 - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xs],cx - - xor bh,bh - mov dl,al - restoredl - test byte[xe],01h - jnz near .emul - mov bl,dl - mov edi,[tableadc+ebx*4] - test dl,00010000b - jnz .setx - endloop -.setx - mov byte[xx+1],0 - mov byte[xy+1],0 - endloop -.emul - or dl,00110000b - mov bl,dl - mov edi,[tableadc+ebx*4] - endloop -%endmacro - -%macro REPMacro 0 - mov al,[esi] - inc esi - test al,11000011b - jnz near .extraflags - not al - and dl,al - test byte[xe],01h - jnz .emul - mov bl,dl - mov edi,[tableadc+ebx*4] - endloop -.emul - or dl,00110000b - mov bl,dl - mov edi,[tableadc+ebx*4] - endloop - -.extraflags - not al - makedl - and dl,al - restoredl - test byte[xe],01h - jnz .emul2 - mov bl,dl - mov edi,[tableadc+ebx*4] - endloop -.emul2 - or dl,00110000b - mov bl,dl - mov edi,[tableadc+ebx*4] - endloop -%endmacro - -%macro ROLMacro8b 0 - mov cl,[flagc] - add cl,cl - rcl al,1 - flagsetnzc8b -%endmacro - -%macro ROLMacro16b 0 - mov cl,[flagc] - add cl,cl - rcl ax,1 - flagsetnzc -%endmacro - -%macro RORMacro8b 0 - mov cl,[flagc] - add cl,cl - rcr al,1 - flagsetnzc8b -%endmacro - -%macro RORMacro16b 0 - mov cl,[flagc] - add cl,cl - rcr ax,1 - flagsetnzc -%endmacro - -%macro RTIMacro 0 - cmp byte[nmistatus],3 - jne .nodis658162 - test byte[curexecstate],01h - jz .nodis65816 - and byte[curexecstate],0FEh -.nodis65816 - cmp byte[curexecstate],0 - jne .nn - xor dh,dh -.nn -.nodis658162 - mov byte[curnmi],0 - test byte[xe],1 - jne near emulRTI - - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xs],cx - - mov dl,al - restoredl - - mov cx,[xs] - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc+1],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpb],al - mov [xs],cx - - xor bh,bh - xor eax,eax - mov ax,[xpc] - mov bl,dl - mov edi,[tableadc+ebx*4] - mov bl,[xpb] - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - cmp byte[esi],0CBh - jne .notwai - mov byte[intrset],2 -.notwai - test dl,00010000b - jnz near .setx - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - cmp eax,4300h - jae near .upperlower - mov [initaddrl],esi - add esi,eax - cmp byte[esi],0CBh - jne .notwai2 - mov byte[intrset],2 -.notwai2 - test dl,00010000b - jnz .setx - endloop -.setx - mov byte[xx+1],0 - mov byte[xy+1],0 - endloop -.upperlower - cmp dword[memtabler8+ebx*4],regaccessbankr8 - je .dma - mov byte[doirqnext],0 - mov [initaddrl],esi - add esi,eax - test dl,00010000b - jnz .setx - endloop -.dma - mov esi,dmadata-4300h - mov [initaddrl],esi - add esi,eax - test dl,00010000b - jnz .setx - endloop - -emulRTI - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xs],cx - - mov dl,al - or dl,00110000b - restoredl - - mov cx,[xs] - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc+1],al - mov [xs],cx - - - xor bh,bh - xor eax,eax - mov ax,[xpc] - mov bl,dl - mov edi,[tableadc+ebx*4] - xor bl,bl - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro RTLMacro 0 - - mov cx,[xs] - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpc+1],al - - inc cx - and cx,word[stackand] - xor eax,eax - call membank0r8 - mov [xpb],al - -; inc bx -; and bx,word[stackand] -; mov cl,[eax+ebx] - -; inc bx -; and bx,word[stackand] -; mov ch,[eax+ebx] - -; inc bx -; and bx,word[stackand] -; mov al,[eax+ebx] - -; mov [xpb],al - - mov [xs],cx - xor bh,bh - xor eax,eax - mov ax,[xpc] - inc ax - mov bl,[xpb] - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro RTSMacro 0 - - mov cx,[xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc],al - - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc+1],al - - mov [xs],cx - xor bh,bh - xor eax,eax - mov ax,[xpc] - inc ax - mov [xpc],ax - mov bl,[xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro SBCMacro8bnd 0 - mov cl,[flagc] - sub cl,1 - sbb [xa],al - flagsetnvzcs8b - endloop -%endmacro - -%macro SBCMacro16bnd 0 - mov cl,[flagc] - sub cl,1 - sbb [xa],ax - flagsetnvzcs16b - endloop -%endmacro - -%macro SBCMacro8bd 0 - mov cl,[flagc] - sub cl,1 - mov cl,al - mov al,[xa] - sbb al,cl - das - mov [xa],al - flagsetnvzcs8b - endloop -%endmacro - -%macro SBCMacro16bd 0 - mov cl,[flagc] - sub cl,1 - mov cx,ax - mov al,[xa] - sbb al,cl - das - mov [xa],al - mov al,[xa+1] - sbb al,ch - das - mov [xa+1],al - cmc - flagsetnvzcd - endloop -%endmacro - -%macro SEPMacro 0 - mov al,[esi] - inc esi - test al,11000011b - jnz near .extraflags - or dl,al - mov bl,dl - mov edi,[tableadc+ebx*4] - test dl,00010000b - jnz .setx - endloop -.setx - mov byte[xx+1],0 - mov byte[xy+1],0 - endloop -.extraflags - makedl - or dl,al - restoredl - mov bl,dl - mov edi,[tableadc+ebx*4] - test dl,00010000b - jnz .setx2 - endloop -.setx2 - mov byte[xx+1],0 - mov byte[xy+1],0 - endloop -%endmacro - -%macro STAMacro8b 0 - mov al,[xa] -%endmacro - -%macro STAMacro16b 0 - mov eax,[xa] -%endmacro - -%macro STXMacro8b 0 - mov al,[xx] -%endmacro - -%macro STXMacro16b 0 - mov eax,[xx] -%endmacro - -%macro STYMacro8b 0 - mov al,[xy] -%endmacro - -%macro STYMacro16b 0 - mov eax,[xy] -%endmacro - -%macro WAIMacro 0 - cmp byte[intrset],1 - jne .notws - dec esi - endloop -.notws - test byte[intrset],0FFh - jz .waitstate - cmp byte[intrset],2 - je .stopint - dec esi - endloop -.waitstate - mov byte[intrset],1 - dec esi - endloop -.stopint - mov byte[intrset],0 - mov byte[doirqnext],0 - endloop -%endmacro - -%macro XCEMacro 0 - mov al,[flagc] - mov dword[flagc],0 - and al,00000001b - cmp [xe],al - jne .nochange - endloop -.nochange - test byte[xe],0FFh - jz .noemul - mov dword[flagc],0FFh -.noemul - mov [xe],al - test byte[xe],01h - jnz .emul - or dl,00100000b - mov word[stackand],0FFFFh - mov word[stackor],0000h - endloop -.emul - or dl,00110000b - mov bl,dl - mov edi,[tableadc+ebx*4] - mov byte[xx+1],0 - mov byte[xy+1],0 - mov byte[xs+1],1 - mov word[stackand],01FFh - mov word[stackor],0100h - endloop -%endmacro - - - diff --git a/tools/zsnes/src/cpu/address.inc b/tools/zsnes/src/cpu/address.inc deleted file mode 100644 index d5230e5..0000000 --- a/tools/zsnes/src/cpu/address.inc +++ /dev/null @@ -1,810 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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_8br 0 - mov al,[esi] - inc esi -%endmacro - -%macro addr_I_16br 0 - mov eax,[esi] - add esi,2 -%endmacro - -; 2. Absolute -- a (TESTED) - -%macro addr_a_8br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_a_16br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_a_8bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_a_16bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - call dword near [memtablew16+ebx*4] -%endmacro - -; 3. Absolute Long -- al - -%macro addr_al_8br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_al_16br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_al_8bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_al_16bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtablew16+ebx*4] -%endmacro - -; 4. Direct -- d (TESTED) - -%macro addr_d_8br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR8] -%endmacro - -%macro addr_d_16br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] -%endmacro - - -%macro addr_d_8bw 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageW8] -%endmacro - -%macro addr_d_16bw 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageW16] -%endmacro - -; 5. Accumulator -- A - -%macro addr_A_8br 0 - mov al,[xa] -%endmacro - -%macro addr_A_16br 0 - mov eax,[xa] -%endmacro - -%macro addr_A_8bw 0 - mov [xa],al -%endmacro - -%macro addr_A_16bw 0 - mov [xa],ax -%endmacro - -; 7. Direct Indirect Indexed -- (d),y - -%macro addr_BdBCy_8br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdBCy_16br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdBCy_8bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdBCy_16bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 8. Direct Indirect Indexed Long -- [d],y - -%macro addr_LdLCy_8br 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_LdLCy_16br 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_LdLCy_8bw 0 - push ax - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - add cx,[xy] - pop ax - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_LdLCy_16bw 0 - push ax - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - push cx - call membank0r16 - pop cx - add cx,2 - xor bl,bl - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - add cx,[xy] - pop ax - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 9. Direct Indexed Indirect -- (d,x) - -%macro addr_BdCxB_8br 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xx] - call membank0r16 - mov cx,ax - mov bl,[xdb] - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdCxB_16br 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xx] - call membank0r16 - mov cx,ax - mov bl,[xdb] - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdCxB_8bw 0 - push ax - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xx] - call membank0r16 - mov cx,ax - mov bl,[xdb] - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdCxB_16bw 0 - push ax - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xx] - call membank0r16 - mov cx,ax - mov bl,[xdb] - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 10. Direct Indexed With X -- d,x - -%macro addr_dCx_8br 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xx] - call membank0r8 -%endmacro - -%macro addr_dCx_16br 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xx] - call membank0r16 -%endmacro - -%macro addr_dCx_8bw 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xx] - call membank0w8 -%endmacro - -%macro addr_dCx_16bw 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xx] - call membank0w16 -%endmacro - -; 11. Direct Indexed With Y -- d,y - -%macro addr_dCy_8br 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xy] - call membank0r8 -%endmacro - -%macro addr_dCy_16br 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xy] - call membank0r16 -%endmacro - -%macro addr_dCy_8bw 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xy] - call membank0w8 -%endmacro - -%macro addr_dCy_16bw 0 - mov ecx,[xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[xy] - call membank0w16 -%endmacro - -; 12. Absolute Indexed With X -- a,x - -%macro addr_aCx_8br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_aCx_16br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_aCx_8bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_aCx_16bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 13. Absolute Indexed With Y -- a,y - -%macro addr_aCy_8br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_aCy_16br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_aCy_8bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_aCy_16bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 14. Absolute Long Indexed With X -- al,x - -%macro addr_alCx_8br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_alCx_16br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_alCx_8bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_alCx_16bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 18. Direct Indirect -- (d) -; ___________________ -; Instruction: | opcode | offset | -; ~~~~~~~~~~~~~~~~~~~ -; | Direct Register | -; + | offset | -; --------------------- -; | 00 | direct address | -; then: -; | 00 | (direct address) | -; + | DB | -; ------------------------------- -; Address: | effective address | - -%macro addr_BdB_8br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdB_16br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdB_8bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdB_16bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 19. Direct Indirect Long -- [d] -; ___________________ -; Instruction: | opcode | offset | -; ~~~~~~~~~~~~~~~~~~~ -; | Direct Register | -; + | offset | -; --------------------- -; | 00 | direct address | -; then: -; ------------------------------- -; Address: | (direct address) | - -%macro addr_LdL_8br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - add cx,bx - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_LdL_16br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - add cx,bx - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_LdL_8bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - add cx,bx - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_LdL_16bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - add cx,bx - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 22. Stack Relative -- d,s - -%macro addr_dCs_8br 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r8 -%endmacro - -%macro addr_dCs_16br 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 -%endmacro - -%macro addr_dCs_8bw 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0w8 -%endmacro - -%macro addr_dCs_16bw 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0w16 -%endmacro - -; 23. Stack Relative Indirect Indexed -- (d,s),y (TESTED) - -%macro addr_BdCsBCy_8br 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdCsBCy_16br 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdCsBCy_8bw 0 - push ax - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[xdb] - pop ax - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdCsBCy_16bw 0 - push ax - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[xdb] - pop ax - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - - diff --git a/tools/zsnes/src/cpu/address2.inc b/tools/zsnes/src/cpu/address2.inc deleted file mode 100644 index 76f6cd9..0000000 --- a/tools/zsnes/src/cpu/address2.inc +++ /dev/null @@ -1,795 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -EXTSYM DPageR8,DPageR16,DPageW8,DPageW16 - - - - - - -;******************************************************* -; Address Modes -;******************************************************* - -; 1. Immediate Addressing -- # - DONE IN PROGRAM - -%macro addr_I_8br 0 - mov al,[esi] - inc esi -%endmacro - -%macro addr_I_16br 0 - mov eax,[esi] - add esi,2 -%endmacro - -; 2. Absolute -- a (TESTED) - -%macro addr_a_8br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_a_16br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_a_8bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_a_16bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - call dword near [memtablew16+ebx*4] -%endmacro - -; 3. Absolute Long -- al - -%macro addr_al_8br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_al_16br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_al_8bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_al_16bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtablew16+ebx*4] -%endmacro - -; 4. Direct -- d (TESTED) - -%macro addr_d_8br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR8] -%endmacro - -%macro addr_d_16br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] -%endmacro - -%macro addr_d_8bw 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageW8] -%endmacro - -%macro addr_d_16bw 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageW16] -%endmacro - -; 5. Accumulator -- A - -%macro addr_A_8br 0 - mov al,[xa] -%endmacro - -%macro addr_A_16br 0 - mov eax,[xa] -%endmacro - -%macro addr_A_8bw 0 - mov [xa],al -%endmacro - -%macro addr_A_16bw 0 - mov [xa],ax -%endmacro - -; 7. Direct Indirect Indexed -- (d),y - -%macro addr_BdBCy_8br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdBCy_16br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdBCy_8bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdBCy_16bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 8. Direct Indirect Indexed Long -- [d],y - -%macro addr_LdLCy_8br 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - push cx - call dword near [DPageR16] - pop cx - add cx,2 - push ax - call dword near [DPageR8] - mov bl,al - pop ax - mov cx,ax - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_LdLCy_16br 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - push cx - call dword near [DPageR16] - pop cx - add cx,2 - push ax - call dword near [DPageR8] - mov bl,al - pop ax - mov cx,ax - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_LdLCy_8bw 0 - push ax - mov ecx,[xd] - mov bl,[esi] - inc esi - push cx - call dword near [DPageR16] - pop cx - add cx,2 - push ax - call dword near [DPageR8] - mov bl,al - pop ax - mov cx,ax - add cx,[xy] - pop ax - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_LdLCy_16bw 0 - push ax - mov ecx,[xd] - mov bl,[esi] - inc esi - push cx - call dword near [DPageR16] - pop cx - add cx,2 - xor bl,bl - push ax - call dword near [DPageR8] - mov bl,al - pop ax - mov cx,ax - add cx,[xy] - pop ax - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 9. Direct Indexed Indirect -- (d,x) - -%macro addr_BdCxB_8br 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xx] - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdCxB_16br 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xx] - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdCxB_8bw 0 - push ax - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xx] - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdCxB_16bw 0 - push ax - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xx] - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 10. Direct Indexed With X -- d,x - -%macro addr_dCx_8br 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xx] - call dword near [DPageR8] -%endmacro - -%macro addr_dCx_16br 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xx] - call dword near [DPageR16] -%endmacro - -%macro addr_dCx_8bw 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xx] - call dword near [DPageW8] -%endmacro - -%macro addr_dCx_16bw 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xx] - call dword near [DPageW16] -%endmacro - -; 11. Direct Indexed With Y -- d,y - -%macro addr_dCy_8br 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xy] - call dword near [DPageR8] -%endmacro - -%macro addr_dCy_16br 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xy] - call dword near [DPageR16] -%endmacro - -%macro addr_dCy_8bw 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xy] - call dword near [DPageW8] -%endmacro - -%macro addr_dCy_16bw 0 - mov ecx,[xd] - mov bl,[esi] - inc esi - add cx,[xy] - call dword near [DPageW16] -%endmacro - -; 12. Absolute Indexed With X -- a,x - -%macro addr_aCx_8br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_aCx_16br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_aCx_8bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_aCx_16bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 13. Absolute Indexed With Y -- a,y - -%macro addr_aCy_8br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_aCy_16br 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_aCy_8bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_aCy_16bw 0 - mov cx,[esi] - mov bl,[xdb] - add esi,2 - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 14. Absolute Long Indexed With X -- al,x - -%macro addr_alCx_8br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_alCx_16br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_alCx_8bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_alCx_16bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[xx] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 18. Direct Indirect -- (d) -; ___________________ -; Instruction: | opcode | offset | -; ~~~~~~~~~~~~~~~~~~~ -; | Direct Register | -; + | offset | -; --------------------- -; | 00 | direct address | -; then: -; | 00 | (direct address) | -; + | DB | -; ------------------------------- -; Address: | effective address | - -%macro addr_BdB_8br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdB_16br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdB_8bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdB_16bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - call dword near [DPageR16] - mov cx,ax - mov bl,[xdb] - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 19. Direct Indirect Long -- [d] -; ___________________ -; Instruction: | opcode | offset | -; ~~~~~~~~~~~~~~~~~~~ -; | Direct Register | -; + | offset | -; --------------------- -; | 00 | direct address | -; then: -; ------------------------------- -; Address: | (direct address) | - -%macro addr_LdL_8br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - push cx - call dword near [DPageR16] - pop cx - add cx,2 - push ax - call dword near [DPageR8] - mov bl,al - pop ax - mov cx,ax - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_LdL_16br 0 - mov bl,[esi] - mov ecx,[xd] - inc esi - push cx - call dword near [DPageR16] - pop cx - add cx,2 - push ax - call dword near [DPageR8] - mov bl,al - pop ax - mov cx,ax - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_LdL_8bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - push cx - call dword near [DPageR16] - pop cx - add cx,2 - push ax - call dword near [DPageR8] - mov bl,al - pop ax - mov cx,ax - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_LdL_16bw 0 - push ax - mov bl,[esi] - mov ecx,[xd] - inc esi - push cx - call dword near [DPageR16] - pop cx - add cx,2 - push ax - call dword near [DPageR8] - mov bl,al - pop ax - mov cx,ax - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 22. Stack Relative -- d,s - -%macro addr_dCs_8br 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r8 -%endmacro - -%macro addr_dCs_16br 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 -%endmacro - -%macro addr_dCs_8bw 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0w8 -%endmacro - -%macro addr_dCs_16bw 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0w16 -%endmacro - -; 23. Stack Relative Indirect Indexed -- (d,s),y (TESTED) - -%macro addr_BdCsBCy_8br 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdCsBCy_16br 0 - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[xdb] - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdCsBCy_8bw 0 - push ax - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[xdb] - pop ax - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdCsBCy_16bw 0 - push ax - mov bl,[esi] - mov cx,[xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[xdb] - pop ax - add cx,[xy] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - - diff --git a/tools/zsnes/src/cpu/addrni.inc b/tools/zsnes/src/cpu/addrni.inc deleted file mode 100644 index 858fe8f..0000000 --- a/tools/zsnes/src/cpu/addrni.inc +++ /dev/null @@ -1,408 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 - - - diff --git a/tools/zsnes/src/cpu/dma.asm b/tools/zsnes/src/cpu/dma.asm deleted file mode 100644 index 660e1ef..0000000 --- a/tools/zsnes/src/cpu/dma.asm +++ /dev/null @@ -1,1310 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 memtabler8,regptw,snesmap2,snesmmap,memtablew8,regptr,memtabler16 -EXTSYM dmadata,hdmatype,nexthdma,resolutn,curhdma,curypos,hdmadata -EXTSYM hdmadelay,hdmarestart,nohdmaframe,INTEnab,HIRQLoc - -;******************************************************* -; Transfer DMA Inits & Transfers DMA -;******************************************************* -; DMA transfer register - -section .bss -NEWSYM AddrNoIncr, resb 1 -section .text - -%macro ExecSPCCycles 0 - movzx ebx,word[esi+5] - inc bx - inc ebx - shr ebx,2 - mov [soundcycleft],ebx - or ebx,ebx - jz .nocycles - xor ebx,ebx - xor ecx,ecx - call pexecs2 -.nocycles -%endmacro - -NEWSYM transdma - push eax - cmp word[esi+5],480h - jne .no -; mov byte[debstop3],1 -.no -; ExecSPCCycles - - mov al,[esi] - test al,80h - jnz near transdmappu2cpu - - ; set address increment value - mov dword[.addrincr],0 - test al,00001000b - jnz .skipaddrincr - test al,00010000b - jnz .autodec - mov dword[.addrincr],1 - jmp .skipaddrincr -.autodec - mov dword[.addrincr],0FFFFFFFFh -.skipaddrincr - - mov byte[AddrNoIncr],0 - cmp dword[.addrincr],0 - jne .notzero - mov byte[AddrNoIncr],1 -.notzero - ; get address order to be written - xor ebx,ebx - and al,00000111b - cmp al,5 - jne .notmode5dma - sub al,4 -.notmode5dma - mov bl,al - shl bl,3 - add ebx,.addrwrite - mov edi,ebx - - ; get pointer #1 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi] - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [.regptra],eax - - ; get pointer #2 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+2] - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [.regptrb],eax - - ; get pointer #3 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+4] - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [.regptrc],eax - - ; get pointer #4 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+6] - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [.regptrd],eax - - mov dx,[esi+5] ; Number of bytes to transfer - movzx ebx,byte[esi+4] ; Bank # - mov ecx,[esi+2] ; address offset # - and ecx,0FFFFh - mov [.curbank],bl - mov word[esi+5],0 - - mov ebx,[.curbank] - mov eax,snesmap2 - test ecx,8000h - jz .nomap1 - mov eax,snesmmap -.nomap1 - and edx,0FFFFh - mov ebx,[eax+ebx*4] - - push esi - mov esi,ebx - movzx ebx,byte[.curbank] - ; do loop - cmp edx,0 - jne .no0 - mov edx,65536 -.no0 - mov ebx,[memtabler8+ebx*4] - mov [.readaddr],ebx - movzx ebx,byte[.curbank] - mov [.cebx],ebx -.againloop - cmp edx,4 - jbe .deccheckloop - mov ebx,[.cebx] - call dword near [.readaddr] - add cx,[.addrincr] - call dword near [.regptra] - mov ebx,[.cebx] - call dword near [.readaddr] - add cx,[.addrincr] - call dword near [.regptrb] - mov ebx,[.cebx] - call dword near [.readaddr] - add cx,[.addrincr] - call dword near [.regptrc] - mov ebx,[.cebx] - call dword near [.readaddr] - add cx,[.addrincr] - call dword near [.regptrd] - sub edx,4 - jmp .againloop -.deccheckloop - mov ebx,[.cebx] - call dword near [.readaddr] - add cx,[.addrincr] - call dword near [.regptra] - dec edx - jz .findma - mov ebx,[.cebx] - call dword near [.readaddr] - add cx,[.addrincr] - call dword near [.regptrb] - dec edx - jz .findma - mov ebx,[.cebx] - call dword near [.readaddr] - add cx,[.addrincr] - call dword near [.regptrc] - dec edx - jz .findma - mov ebx,[.cebx] - call dword near [.readaddr] - add cx,[.addrincr] - call dword near [.regptrd] -.findma - pop esi - mov [esi+2],cx - pop eax - mov byte[AddrNoIncr],0 - ret - -section .data -ALIGN32 - -.curbank dd 0 -.addrincr dd 0 -.addrwrite dw 0,0,0,0, 0,1,0,1, 0,0,0,0, 0,0,1,1, 0,1,2,3, 0,1,2,3, 0,1,2,3 - dw 0,1,2,3 -; pointer address of registers -.regptra dd 0 -.regptrb dd 0 -.regptrc dd 0 -.regptrd dd 0 -.readaddr dd 0 -.cebx dd 0 -section .text - -NEWSYM transdmappu2cpu - ; set address increment value - mov dword[.addrincr],0 - test al,00001000b - jnz .skipaddrincr - test al,00010000b - jnz .autodec - mov dword[.addrincr],1 - jmp .skipaddrincr -.autodec - mov dword[.addrincr],0FFFFFFFFh -.skipaddrincr - - ; get address order to be written - and al,00000111b - movzx ebx,al - shl bl,3 - add ebx,.addrwrite - mov edi,ebx - - ; get pointer #1 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi] - shl ebx,2 - add ebx,[regptr] - mov eax,[ebx] - mov [.regptra],eax - - ; get pointer #2 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+2] - shl ebx,2 - add ebx,[regptr] - mov eax,[ebx] - mov [.regptrb],eax - - ; get pointer #3 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+4] - shl ebx,2 - add ebx,[regptr] - mov eax,[ebx] - mov [.regptrc],eax - - ; get pointer #4 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+6] - shl ebx,2 - add ebx,[regptr] - mov eax,[ebx] - mov [.regptrd],eax - - mov dx,[esi+5] ; Number of bytes to transfer - movzx ebx,byte[esi+4] ; Bank # - mov ecx,[esi+2] ; address offset # - and ecx,0FFFFh - mov [.curbank],bl - mov word[esi+5],0 - - mov ebx,[.curbank] - mov eax,snesmap2 - test ecx,8000h - jz .nomap1 - mov eax,snesmmap -.nomap1 - and edx,0FFFFh - mov ebx,[eax+ebx*4] - - push esi - mov esi,ebx - movzx ebx,byte[.curbank] - ; do loop - cmp edx,0 - jne .no0 - mov edx,65536 -.no0 - mov ebx,[memtablew8+ebx*4] - mov [.writeaddr],ebx - movzx ebx,byte[.curbank] - mov [.cebx],ebx -.againloop - cmp edx,4 - jbe .deccheckloop - call dword near [.regptra] - mov ebx,[.cebx] - call dword near [.writeaddr] - add cx,[.addrincr] - call dword near [.regptrb] - mov ebx,[.cebx] - call dword near [.writeaddr] - add cx,[.addrincr] - call dword near [.regptrc] - mov ebx,[.cebx] - call dword near [.writeaddr] - add cx,[.addrincr] - call dword near [.regptrd] - mov ebx,[.cebx] - call dword near [.writeaddr] - add cx,[.addrincr] - sub edx,4 - jmp .againloop -.deccheckloop - call dword near [.regptra] - mov ebx,[.cebx] - call dword near [.writeaddr] - add cx,[.addrincr] - dec edx - jz .findma - call dword near [.regptrb] - mov ebx,[.cebx] - call dword near [.writeaddr] - add cx,[.addrincr] - dec edx - jz .findma - call dword near [.regptrc] - mov ebx,[.cebx] - call dword near [.writeaddr] - add cx,[.addrincr] - dec edx - jz .findma - call dword near [.regptrd] - mov ebx,[.cebx] - call dword near [.writeaddr] - add cx,[.addrincr] -.findma - pop esi - mov [esi+2],cx - pop eax - ret - -section .data -ALIGN32 - -.curbank dd 0 -.addrincr dd 0 -.addrwrite dw 0,0,0,0, 0,1,0,1, 0,0,0,0, 0,0,1,1, 0,1,2,3, 0,1,2,3, 0,1,2,3 - dw 0,1,2,3 -; pointer address of registers -.regptra dd 0 -.regptrb dd 0 -.regptrc dd 0 -.regptrd dd 0 -.writeaddr dd 0 -.cebx dd 0 -section .text - -%macro TestDMA 0 -%endmacro - -; DMA enable register -; use dmadata for input on dma -NEWSYM reg420Bw - push eax - push esi - push edi - push ecx - push edx - mov esi,dmadata - test al,01h - jz .notransa - TestDMA - call transdma -.notransa - add esi,16 - test al,02h - jz .notransb - TestDMA - call transdma -.notransb - add esi,16 - test al,04h - jz .notransc - TestDMA - call transdma -.notransc - add esi,16 - test al,08h - jz .notransd - TestDMA - call transdma -.notransd - add esi,16 - test al,10h - jz .notranse - TestDMA - call transdma -.notranse - add esi,16 - test al,20h - jz .notransf - TestDMA - call transdma -.notransf - add esi,16 - test al,40h - jz .notransg - TestDMA - call transdma -.notransg - add esi,16 - test al,80h - jz .notransh - TestDMA - call transdma -.notransh - pop edx - pop ecx - pop edi - pop esi - pop eax - ret - -;******************************************************* -; HDMA Settings -;******************************************************* -NEWSYM setuphdma - push eax - - ; transfer old address to new address - mov ax,[esi+2] - mov [esi+8],ax - mov [edx+17],ax - ; get address order to be written - xor ebx,ebx - xor ecx,ecx - movzx eax,byte[esi] - and al,00000111b - cmp al,5 - jb .notmode567dma - sub al,4 -.notmode567dma - mov ah,[.addrnumt+eax] - mov [edx+16],ah - mov bl,al - shl bl,3 - add ebx,.addrwrite - mov edi,ebx - - ; get pointer #1 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi] - cmp bx,2118h - je .notnormalhdma1 - cmp bx,2119h - je .notnormalhdma1 - jmp .normalhdma1 -.notnormalhdma1 - mov bx,2200h ; bad hack _Demo_ -.normalhdma1 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx],eax - - ; get pointer #2 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+2] - cmp bx,2118h - je .notnormalhdma2 - cmp bx,2119h - je .notnormalhdma2 - jmp .normalhdma2 -.notnormalhdma2 - mov bx,2200h ; bad hack _Demo_ -.normalhdma2 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx+4],eax - - ; get pointer #3 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+4] - cmp bx,2118h - je .notnormalhdma3 - cmp bx,2119h - je .notnormalhdma3 - jmp .normalhdma3 -.notnormalhdma3 - mov bx,2200h ; bad hack _Demo_ -.normalhdma3 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx+8],eax - - ; get pointer #4 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+6] - cmp bx,2118h - je .notnormalhdma4 - cmp bx,2119h - je .notnormalhdma4 - jmp .normalhdma4 -.notnormalhdma4 - mov bx,2200h ; bad hack _Demo_ -.normalhdma4 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx+12],eax - - xor ebx,ebx - mov byte[esi+10],0 - pop eax - or [hdmatype],ah - ret - -section .data -.addrwrite dw 0,0,0,0, 0,1,0,1, 0,0,0,0, 0,0,1,1, 0,1,2,3, 0,1,2,3, 0,1,2,3 - dw 0,1,2,3 -.addrnumt db 1,2,2,4,4,4,4,4 -section .text - -NEWSYM setuphdmars - push eax - - ; get address order to be written - xor ebx,ebx - xor ecx,ecx - movzx eax,byte[esi] - and al,00000111b - cmp al,5 - jb .notmode567dma - sub al,4 -.notmode567dma - mov ah,[.addrnumt+eax] - mov [edx+16],ah - mov bl,al - shl bl,3 - add ebx,.addrwrite - mov edi,ebx - - ; get pointer #1 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi] - cmp bx,2118h - je .notnormalhdma1 - cmp bx,2119h - je .notnormalhdma1 - jmp .normalhdma1 -.notnormalhdma1 - mov bx,2200h ; bad hack _Demo_ -.normalhdma1 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx],eax - - ; get pointer #2 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+2] - cmp bx,2118h - je .notnormalhdma2 - cmp bx,2119h - je .notnormalhdma2 - jmp .normalhdma2 -.notnormalhdma2 - mov bx,2200h ; bad hack _Demo_ -.normalhdma2 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx+4],eax - - ; get pointer #3 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+4] - cmp bx,2118h - je .notnormalhdma3 - cmp bx,2119h - je .notnormalhdma3 - jmp .normalhdma3 -.notnormalhdma3 - mov bx,2200h ; bad hack _Demo_ -.normalhdma3 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx+8],eax - - ; get pointer #4 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+6] - cmp bx,2118h - je .notnormalhdma4 - cmp bx,2119h - je .notnormalhdma4 - jmp .normalhdma4 -.notnormalhdma4 - mov bx,2200h ; bad hack _Demo_ -.normalhdma4 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx+12],eax - - xor ebx,ebx - pop eax - ret - -section .data -.addrwrite dw 0,0,0,0, 0,1,0,1, 0,0,0,0, 0,0,1,1, 0,1,2,3, 0,1,2,3, 0,1,2,3 - dw 0,1,2,3 -.addrnumt db 1,2,2,4,4,4,4,4 -section .text - -NEWSYM setuphdma2 - push eax - - cmp byte[esi+10],0 - je near .nohdma - - ; transfer old address to new address - mov ax,[esi+8] - mov [edx+17],ax - ; get address order to be written - xor ebx,ebx - xor ecx,ecx - movzx eax,byte[esi] - and al,00000111b - cmp al,5 - jb .notmode567dma - sub al,4 -.notmode567dma - mov ah,[.addrnumt+eax] - mov [edx+16],ah - mov bl,al - shl bl,3 - add ebx,.addrwrite - mov edi,ebx - - ; get pointer #1 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi] - cmp bx,2118h - je .notnormalhdma1 - cmp bx,2119h - je .notnormalhdma1 - jmp .normalhdma1 -.notnormalhdma1 - mov bx,2200h ; bad hack _Demo_ -.normalhdma1 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx],eax - - ; get pointer #2 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+2] - cmp bx,2118h - je .notnormalhdma2 - cmp bx,2119h - je .notnormalhdma2 - jmp .normalhdma2 -.notnormalhdma2 - mov bx,2200h ; bad hack _Demo_ -.normalhdma2 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx+4],eax - - ; get pointer #3 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+4] - cmp bx,2118h - je .notnormalhdma3 - cmp bx,2119h - je .notnormalhdma3 - jmp .normalhdma3 -.notnormalhdma3 - mov bx,2200h ; bad hack _Demo_ -.normalhdma3 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx+8],eax - - ; get pointer #4 - movzx ebx,byte[esi+1] ; PPU memory - 21xx - mov bh,21h - add bx,[edi+6] - cmp bx,2118h - je .notnormalhdma4 - cmp bx,2119h - je .notnormalhdma4 - jmp .normalhdma4 -.notnormalhdma4 - mov bx,2200h ; bad hack _Demo_ -.normalhdma4 - shl ebx,2 - add ebx,[regptw] - mov eax,[ebx] - mov [edx+12],eax - - xor ebx,ebx - pop eax - and [hdmatype],ah - ret -.nohdma - pop eax - and [nexthdma],ah - ret - -section .data -.addrwrite dw 0,0,0,0, 0,1,0,1, 0,0,0,0, 0,0,1,1, 0,1,2,3, 0,1,2,3, 0,1,2,3 - dw 0,1,2,3 -.addrnumt db 1,2,2,4,4,4,4,4 - -section .text - -NEWSYM reg420Cw - mov [curhdma],al - mov bx,[resolutn] - cmp word[curypos],bx - jae near .nohdma - mov al,[curhdma] - mov bx,[HIRQLoc] - test byte[INTEnab],10h - jz .skipcheck - cmp bx,80 - jb near .nohdma - cmp bx,176 - ja near .nohdma -.skipcheck - mov bl,[nexthdma] - and bl,al - jnz near .nohdma - mov [nexthdma],al - push ebx - push esi - push edi - push ecx - push edx - mov esi,dmadata - mov edx,hdmadata - mov ah,01h - test al,01h - jz .notransa - call setuphdma -.notransa - add esi,16 - add edx,19 - mov ah,02h - test al,02h - jz .notransb - call setuphdma -.notransb - add esi,16 - add edx,19 - mov ah,04h - test al,04h - jz .notransc - call setuphdma -.notransc - add esi,16 - add edx,19 - mov ah,08h - test al,08h - jz .notransd - call setuphdma -.notransd - add esi,16 - add edx,19 - mov ah,10h - test al,10h - jz .notranse - call setuphdma -.notranse - add esi,16 - add edx,19 - mov ah,20h - test al,20h - jz .notransf - call setuphdma -.notransf - add esi,16 - add edx,19 - mov ah,40h - test al,40h - jz .notransg - call setuphdma -.notransg - add esi,16 - add edx,19 - mov ah,80h - test al,80h - jz .notransh - call setuphdma -.notransh - pop edx - pop ecx - pop edi - pop esi - pop ebx -; call exechdma -; call exechdma -.nohdma - cmp byte[nohdmaframe],1 - jne .notframe - inc byte[hdmadelay] -.notframe - mov byte[hdmarestart],0 - ret - -; HDMA enable register -NEWSYM starthdma - mov al,[curhdma] -NEWSYM startnexthdma - mov [nexthdma],al - cmp al,0 - je near .nohdma - push ebx - push esi - push edi - push ecx - push edx - mov esi,dmadata - mov edx,hdmadata - mov ah,01h - test al,01h - jz .notransa - call setuphdma -.notransa - add esi,16 - add edx,19 - mov ah,02h - test al,02h - jz .notransb - call setuphdma -.notransb - add esi,16 - add edx,19 - mov ah,04h - test al,04h - jz .notransc - call setuphdma -.notransc - add esi,16 - add edx,19 - mov ah,08h - test al,08h - jz .notransd - call setuphdma -.notransd - add esi,16 - add edx,19 - mov ah,10h - test al,10h - jz .notranse - call setuphdma -.notranse - add esi,16 - add edx,19 - mov ah,20h - test al,20h - jz .notransf - call setuphdma -.notransf - add esi,16 - add edx,19 - mov ah,40h - test al,40h - jz .notransg - call setuphdma -.notransg - add esi,16 - add edx,19 - mov ah,80h - test al,80h - jz .notransh - call setuphdma -.notransh - pop edx - pop ecx - pop edi - pop esi - pop ebx -.nohdma - ret - -NEWSYM dohdma - xor ebx,ebx - test byte[esi],40h - jnz near indirectaddr - push eax - test byte[esi+10],07Fh - jnz near .nozero - test byte[esi+10],80h - jnz near .noincr - test [hdmatype],ah - jnz .noincr - mov bl,[edx+16] - add word[edx+17],bx -.noincr - mov bl,ah - not bl - and [hdmatype],bl - mov bl,[esi+4] - mov cx,[edx+17] - call dword near [memtabler8+ebx*4] - inc word[edx+17] - mov [esi+10],al - test al,0FFh - jnz .yeszero - xor [nexthdma],ah - jmp .finhdma2 -.yeszero - cmp byte[esi+10],80h - ja near hdmatype2 - mov al,[edx+16] - mov [.tempdecr],al - movzx ebx,byte[esi+4] - movzx ecx,word[edx+17] ; increment/decrement/keep pointer location - call dword near [memtabler8+ebx*4] - call dword near [edx] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+4] - mov cx,[edx+17] ; increment/decrement/keep pointer location - inc cx - call dword near [memtabler8+ebx*4] - call dword near [edx+4] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+4] - mov cx,[edx+17] ; increment/decrement/keep pointer location - add cx,2 - call dword near [memtabler8+ebx*4] - call dword near [edx+8] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+4] - mov cx,[edx+17] ; increment/decrement/keep pointer location - add cx,3 - call dword near [memtabler8+ebx*4] - call dword near [edx+12] - jmp .finhdma -.nozero - test byte[esi+10],80h - jnz near hdmatype2 -.finhdma - mov ax,[edx+17] - mov [esi+8],ax - pop eax - dec byte[esi+10] - ret -.finhdma2 - mov ax,[edx+17] - mov [esi+8],ax - pop eax - ret - -section .bss -.tempdecr resd 1 -section .text - -NEWSYM hdmatype2 - mov al,[edx+16] - mov [.tempdecr],al - movzx ebx,byte[esi+4] - movzx ecx,word[edx+17] ; increment/decrement/keep pointer location - inc word[edx+17] - call dword near [memtabler8+ebx*4] - call dword near [edx] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+4] - mov cx,[edx+17] ; increment/decrement/keep pointer location - inc word[edx+17] - call dword near [memtabler8+ebx*4] - call dword near [edx+4] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+4] - mov cx,[edx+17] ; increment/decrement/keep pointer location - inc word[edx+17] - call dword near [memtabler8+ebx*4] - call dword near [edx+8] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+4] - mov cx,[edx+17] ; increment/decrement/keep pointer location - inc word[edx+17] - call dword near [memtabler8+ebx*4] - call dword near [edx+12] -.finhdma - mov ax,[edx+17] - mov [esi+8],ax - pop eax - dec byte[esi+10] - ret - -section .bss -.tempdecr resd 1 -section .text - -NEWSYM indirectaddr - push eax - test byte[esi+10],07Fh - jnz near .nozero - test [hdmatype],ah - jnz .noincr - add word[edx+17],2 -.noincr - mov bl,ah - not bl - and [hdmatype],bl - mov bl,[esi+4] - mov cx,[edx+17] - call dword near [memtabler8+ebx*4] - inc word[edx+17] - mov [esi+10],al - push eax - mov bl,[esi+4] - mov cx,[edx+17] - call dword near [memtabler16+ebx*4] - mov [esi+5],ax - pop eax - test al,0FFh - jnz .yeszero - xor [nexthdma],ah - jmp .finhdma2 -.yeszero - cmp byte[esi+10],80h - ja near hdmatype2indirect - mov al,[edx+16] - mov [.tempdecr],al - movzx ebx,byte[esi+7] - movzx ecx,word[esi+5] ; increment/decrement/keep pointer location - call dword near [memtabler8+ebx*4] - call dword near [edx] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+7] - mov cx,[esi+5] ; increment/decrement/keep pointer location - inc cx - call dword near [memtabler8+ebx*4] - call dword near [edx+4] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+7] - mov cx,[esi+5] ; increment/decrement/keep pointer location - add cx,2 - call dword near [memtabler8+ebx*4] - call dword near [edx+8] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+7] - mov cx,[esi+5] ; increment/decrement/keep pointer location - add cx,3 - call dword near [memtabler8+ebx*4] - call dword near [edx+12] - jmp .finhdma -.nozero - test byte[esi+10],80h - jnz near hdmatype2indirect -.finhdma - mov ax,[edx+17] - mov [esi+8],ax - pop eax - dec byte[esi+10] - ret -.finhdma2 - mov ax,[edx+17] - mov [esi+8],ax - pop eax - ret - -section .bss -.tempdecr resd 1 - -section .data -.fname2 db 9,'vram2.dat',0 -section .text - -NEWSYM hdmatype2indirect - mov al,[edx+16] - mov [.tempdecr],al - movzx ebx,byte[esi+7] - movzx ecx,word[esi+5] ; increment/decrement/keep pointer location - inc word[esi+5] - call dword near [memtabler8+ebx*4] - call dword near [edx] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+7] - mov cx,[esi+5] ; increment/decrement/keep pointer location - inc word[esi+5] - call dword near [memtabler8+ebx*4] - call dword near [edx+4] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+7] - mov cx,[esi+5] ; increment/decrement/keep pointer location - inc word[esi+5] - call dword near [memtabler8+ebx*4] - call dword near [edx+8] - dec byte[.tempdecr] - jz .finhdma - movzx ebx,byte[esi+7] - mov cx,[esi+5] ; increment/decrement/keep pointer location - inc word[esi+5] - call dword near [memtabler8+ebx*4] - call dword near [edx+12] -.finhdma - pop eax - dec byte[esi+10] - ret - -section .bss -.tempdecr resd 1 -.dest resd 1 -section .text - -NEWSYM exechdma - cmp byte[hdmarestart],1 - je near exechdmars - mov al,[nexthdma] - cmp al,0 - je near .nohdma - push ebx - push esi - push edi - push ecx - push edx - mov esi,dmadata - mov edx,hdmadata - mov ah,01h - test al,01h - jz .notransa - call dohdma -.notransa - add esi,16 - add edx,19 - mov ah,02h - test al,02h - jz .notransb - call dohdma -.notransb - add esi,16 - add edx,19 - mov ah,04h - test al,04h - jz .notransc - call dohdma -.notransc - add esi,16 - add edx,19 - mov ah,08h - test al,08h - jz .notransd - call dohdma -.notransd - add esi,16 - add edx,19 - mov ah,10h - test al,10h - jz .notranse - call dohdma -.notranse - add esi,16 - add edx,19 - mov ah,20h - test al,20h - jz .notransf - call dohdma -.notransf - add esi,16 - add edx,19 - mov ah,40h - test al,40h - jz .notransg - call dohdma -.notransg - add esi,16 - add edx,19 - mov ah,80h - test al,80h - jz .notransh - call dohdma -.notransh - pop edx - pop ecx - pop edi - pop esi - pop ebx -.nohdma - ret - -NEWSYM exechdmars - mov al,[nexthdma] - cmp al,0 - je near .nohdma - push ebx - push esi - push edi - push ecx - push edx - mov esi,dmadata - mov edx,hdmadata - mov ah,01h - test al,01h - jz .notransa - call setuphdmars - call dohdma -.notransa - add esi,16 - add edx,19 - mov ah,02h - test al,02h - jz .notransb - call setuphdmars - call dohdma -.notransb - add esi,16 - add edx,19 - mov ah,04h - test al,04h - jz .notransc - call setuphdmars - call dohdma -.notransc - add esi,16 - add edx,19 - mov ah,08h - test al,08h - jz .notransd - call setuphdmars - call dohdma -.notransd - add esi,16 - add edx,19 - mov ah,10h - test al,10h - jz .notranse - call setuphdmars - call dohdma -.notranse - add esi,16 - add edx,19 - mov ah,20h - test al,20h - jz .notransf - call setuphdmars - call dohdma -.notransf - add esi,16 - add edx,19 - mov ah,40h - test al,40h - jz .notransg - call setuphdmars - call dohdma -.notransg - add esi,16 - add edx,19 - mov ah,80h - test al,80h - jz .notransh - call setuphdmars - call dohdma -.notransh - pop edx - pop ecx - pop edi - pop esi - pop ebx -.nohdma - mov byte[hdmarestart],0 - ret - - diff --git a/tools/zsnes/src/cpu/dsp.asm b/tools/zsnes/src/cpu/dsp.asm deleted file mode 100644 index 40ec273..0000000 --- a/tools/zsnes/src/cpu/dsp.asm +++ /dev/null @@ -1,2836 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 Decrease,DecreaseRateExp,EchoFB,EchoRate,EchoVL,EchoVR -EXTSYM FIRTAPVal0,FIRTAPVal1,FIRTAPVal2,FIRTAPVal3,FIRTAPVal4,FIRTAPVal5 -EXTSYM FIRTAPVal6,FIRTAPVal7,GlobalVL,GlobalVR,Increase -EXTSYM MaxEcho,MusicVol,NoiseInc,NoiseSpeeds,dspPAdj,Voice0EnvInc -EXTSYM Voice0IncNumber,Voice0State,Voice0Time -EXTSYM Voice0Start,Voice1Start,Voice2Start,Voice3Start -EXTSYM Voice4Start,Voice5Start,Voice6Start,Voice7Start -EXTSYM Voice0Noise,Voice1Noise,Voice2Noise,Voice3Noise -EXTSYM Voice4Noise,Voice5Noise,Voice6Noise,Voice7Noise -EXTSYM VolumeConvTable,VolumeTableb -EXTSYM Voice0Status,Voice1Status,Voice2Status,Voice3Status -EXTSYM Voice4Status,Voice5Status,Voice6Status,Voice7Status -EXTSYM GainDecBendDataPos,GainDecBendDataTime,GainDecBendDataDat -EXTSYM AdsrSustLevLoc,AdsrBlocksLeft,AdsrNextTimeDepth -EXTSYM MuteVoiceF,VoiceStarter,DecayRate,SustainRate -EXTSYM KeyOnStA,KeyOnStB,SoundTest,keyonsn - -SECTION .data -identcode db 255,1,78,78 -SECTION .text - -; Digital Sound Processor of the SPC700 By _Demo_ - -%macro initrevsthelp 1 - mov al,[DSPMem+01h+%1] - mov ah,[DSPMem+00h+%1] - mov [DSPMem+01h+%1],ah - mov [DSPMem+00h+%1],al -%endmacro - -SECTION .data -ALIGN32 -NEWSYM DSPMem, times 256 db 0 -SECTION .text - -;Read DSP Registers functions - -NEWSYM RDSPReg00 ; Voice 0 Volume Left - mov al,[DSPMem+00h] - ret - -NEWSYM RDSPReg01 ; Voice 0 Volume Right - mov al,[DSPMem+01h] - ret - -NEWSYM RDSPReg02 ; Voice 0 Pitch Low - mov al,[DSPMem+02h] - ret - -NEWSYM RDSPReg03 ; Voice 0 Pitch High - mov al,[DSPMem+03h] - ret - -NEWSYM RDSPReg04 ; Voice 0 SCRN - mov al,[DSPMem+04h] - ret - -NEWSYM RDSPReg05 ; Voice 0 ADSR (1) - mov al,[DSPMem+05h] - ret - -NEWSYM RDSPReg06 ; Voice 0 ADSR (2) - mov al,[DSPMem+06h] - ret - -NEWSYM RDSPReg07 ; Voice 0 GAIN - mov al,[DSPMem+07h] - ret - -NEWSYM RDSPReg08 ; Voice 0 ENVX - mov al,[DSPMem+08h] - and al,7Fh - ret - -NEWSYM RDSPReg09 ; Voice 0 OUTX - mov al,[DSPMem+09h] - ret - -NEWSYM RDSPReg0A ; - mov al,[DSPMem+0Ah] - ret - -NEWSYM RDSPReg0B ; - mov al,[DSPMem+0Bh] - ret - -NEWSYM RDSPReg0C ; - mov al,[DSPMem+0Ch] - ret - -NEWSYM RDSPReg0D ; - mov al,[DSPMem+0Dh] - ret - -NEWSYM RDSPReg0E ; - mov al,[DSPMem+0Eh] - ret - -NEWSYM RDSPReg0F ; Voice 0 Echo coefficient - mov al,[DSPMem+0Fh] - ret - -NEWSYM RDSPReg10 ; Voice 1 Volume Left - mov al,[DSPMem+10h] - ret - -NEWSYM RDSPReg11 ; Voice 1 Volume Right - mov al,[DSPMem+11h] - ret - -NEWSYM RDSPReg12 ; Voice 1 Pitch Low - mov al,[DSPMem+012h] - ret - -NEWSYM RDSPReg13 ; Voice 1 Pitch High - mov al,[DSPMem+013h] - ret - -NEWSYM RDSPReg14 ; Voice 1 SCRN - mov al,[DSPMem+014h] - ret - -NEWSYM RDSPReg15 ; Voice 1 ADSR (1) - mov al,[DSPMem+015h] - ret - -NEWSYM RDSPReg16 ; Voice 1 ADSR (2) - mov al,[DSPMem+016h] - ret - -NEWSYM RDSPReg17 ; Voice 1 GAIN - mov al,[DSPMem+017h] - ret - -NEWSYM RDSPReg18 ; Voice 1 ENVX - mov al,[DSPMem+018h] - and al,7Fh - ret - -NEWSYM RDSPReg19 ; Voice 1 OUTX - mov al,[DSPMem+019h] - ret - -NEWSYM RDSPReg1A ; - mov al,[DSPMem+01Ah] - ret - -NEWSYM RDSPReg1B ; - mov al,[DSPMem+01Bh] - ret - -NEWSYM RDSPReg1C ; - mov al,[DSPMem+01Ch] - ret - -NEWSYM RDSPReg1D ; - mov al,[DSPMem+01Dh] - ret - -NEWSYM RDSPReg1E ; - mov al,[DSPMem+01Eh] - ret - -NEWSYM RDSPReg1F ; Voice 1 Echo coefficient - mov al,[DSPMem+01Fh] - ret - -NEWSYM RDSPReg20 ; Voice 2 Volume Left - mov al,[DSPMem+20h] - ret - -NEWSYM RDSPReg21 ; Voice 2 Volume Right - mov al,[DSPMem+21h] - ret - -NEWSYM RDSPReg22 ; Voice 2 Pitch Low - mov al,[DSPMem+022h] - ret - -NEWSYM RDSPReg23 ; Voice 2 Pitch High - mov al,[DSPMem+023h] - ret - -NEWSYM RDSPReg24 ; Voice 2 SCRN - mov al,[DSPMem+024h] - ret - -NEWSYM RDSPReg25 ; Voice 2 ADSR (1) - mov al,[DSPMem+025h] - ret - -NEWSYM RDSPReg26 ; Voice 2 ADSR (2) - mov al,[DSPMem+026h] - ret - -NEWSYM RDSPReg27 ; Voice 2 GAIN - mov al,[DSPMem+027h] - ret - -NEWSYM RDSPReg28 ; Voice 2 ENVX - mov al,[DSPMem+028h] - and al,7Fh - ret - -NEWSYM RDSPReg29 ; Voice 2 OUTX - mov al,[DSPMem+029h] - ret - -NEWSYM RDSPReg2A ; - mov al,[DSPMem+02Ah] - ret - -NEWSYM RDSPReg2B ; - mov al,[DSPMem+02Bh] - ret - -NEWSYM RDSPReg2C ; - mov al,[DSPMem+02Ch] - ret - -NEWSYM RDSPReg2D ; - mov al,[DSPMem+02Dh] - ret - -NEWSYM RDSPReg2E ; - mov al,[DSPMem+02Eh] - ret - -NEWSYM RDSPReg2F ; Voice 2 Echo coefficient - mov al,[DSPMem+02Fh] - ret - -NEWSYM RDSPReg30 ; Voice 3 Volume Left - mov al,[DSPMem+30h] - ret - -NEWSYM RDSPReg31 ; Voice 3 Volume Right - mov al,[DSPMem+31h] - ret - -NEWSYM RDSPReg32 ; Voice 3 Pitch Low - mov al,[DSPMem+032h] - ret - -NEWSYM RDSPReg33 ; Voice 3 Pitch High - mov al,[DSPMem+033h] - ret - -NEWSYM RDSPReg34 ; Voice 3 SCRN - mov al,[DSPMem+034h] - ret - -NEWSYM RDSPReg35 ; Voice 3 ADSR (1) - mov al,[DSPMem+035h] - ret - -NEWSYM RDSPReg36 ; Voice 3 ADSR (2) - mov al,[DSPMem+036h] - ret - -NEWSYM RDSPReg37 ; Voice 3 GAIN - mov al,[DSPMem+037h] - ret - -NEWSYM RDSPReg38 ; Voice 3 ENVX - mov al,[DSPMem+038h] - and al,7Fh - ret - -NEWSYM RDSPReg39 ; Voice 3 OUTX - mov al,[DSPMem+039h] - ret - -NEWSYM RDSPReg3A ; - mov al,[DSPMem+03Ah] - ret - -NEWSYM RDSPReg3B ; - mov al,[DSPMem+03Bh] - ret - -NEWSYM RDSPReg3C ; - mov al,[DSPMem+03Ch] - ret - -NEWSYM RDSPReg3D ; - mov al,[DSPMem+03Dh] - ret - -NEWSYM RDSPReg3E ; - mov al,[DSPMem+03Eh] - ret - -NEWSYM RDSPReg3F ; Voice 3 Echo coefficient - mov al,[DSPMem+03Fh] - ret - -NEWSYM RDSPReg40 ; Voice 4 Volume Left - mov al,[DSPMem+40h] - ret - -NEWSYM RDSPReg41 ; Voice 4 Volume Right - mov al,[DSPMem+41h] - ret - -NEWSYM RDSPReg42 ; Voice 4 Pitch Low - mov al,[DSPMem+042h] - ret - -NEWSYM RDSPReg43 ; Voice 4 Pitch High - mov al,[DSPMem+043h] - ret - -NEWSYM RDSPReg44 ; Voice 4 SCRN - mov al,[DSPMem+044h] - ret - -NEWSYM RDSPReg45 ; Voice 4 ADSR (1) - mov al,[DSPMem+045h] - ret - -NEWSYM RDSPReg46 ; Voice 4 ADSR (2) - mov al,[DSPMem+046h] - ret - -NEWSYM RDSPReg47 ; Voice 4 GAIN - mov al,[DSPMem+047h] - ret - -NEWSYM RDSPReg48 ; Voice 4 ENVX - mov al,[DSPMem+048h] - and al,7Fh - ret - -NEWSYM RDSPReg49 ; Voice 4 OUTX - mov al,[DSPMem+049h] - ret - -NEWSYM RDSPReg4A ; - mov al,[DSPMem+04Ah] - ret - -NEWSYM RDSPReg4B ; - mov al,[DSPMem+04Bh] - ret - -NEWSYM RDSPReg4C ; - mov al,[DSPMem+04Ch] - ret - -NEWSYM RDSPReg4D ; - mov al,[DSPMem+04Dh] - ret - -NEWSYM RDSPReg4E ; - mov al,[DSPMem+04Eh] - ret - -NEWSYM RDSPReg4F ; Voice 4 Echo coefficient - mov al,[DSPMem+04Fh] - ret - -NEWSYM RDSPReg50 ; Voice 5 Volume Left - mov al,[DSPMem+50h] - ret - -NEWSYM RDSPReg51 ; Voice 5 Volume Right - mov al,[DSPMem+51h] - ret - -NEWSYM RDSPReg52 ; Voice 5 Pitch Low - mov al,[DSPMem+052h] - ret - -NEWSYM RDSPReg53 ; Voice 5 Pitch High - mov al,[DSPMem+053h] - ret - -NEWSYM RDSPReg54 ; Voice 5 SCRN - mov al,[DSPMem+054h] - ret - -NEWSYM RDSPReg55 ; Voice 5 ADSR (1) - mov al,[DSPMem+055h] - ret - -NEWSYM RDSPReg56 ; Voice 5 ADSR (2) - mov al,[DSPMem+056h] - ret - -NEWSYM RDSPReg57 ; Voice 5 GAIN - mov al,[DSPMem+057h] - ret - -NEWSYM RDSPReg58 ; Voice 5 ENVX - mov al,[DSPMem+058h] - and al,7Fh - ret - -NEWSYM RDSPReg59 ; Voice 5 OUTX - mov al,[DSPMem+059h] - ret - -NEWSYM RDSPReg5A ; - mov al,[DSPMem+05Ah] - ret - -NEWSYM RDSPReg5B ; - mov al,[DSPMem+05Bh] - ret - -NEWSYM RDSPReg5C ; - mov al,[DSPMem+05Ch] - ret - -NEWSYM RDSPReg5D ; - mov al,[DSPMem+05Dh] - ret - -NEWSYM RDSPReg5E ; - mov al,[DSPMem+05Eh] - ret - -NEWSYM RDSPReg5F ; Voice 5 Echo coefficient - mov al,[DSPMem+05Fh] - ret - -NEWSYM RDSPReg60 ; Voice 6 Volume Left - mov al,[DSPMem+60h] - ret - -NEWSYM RDSPReg61 ; Voice 6 Volume Right - mov al,[DSPMem+61h] - ret - -NEWSYM RDSPReg62 ; Voice 6 Pitch Low - mov al,[DSPMem+062h] - ret - -NEWSYM RDSPReg63 ; Voice 6 Pitch High - mov al,[DSPMem+063h] - ret - -NEWSYM RDSPReg64 ; Voice 6 SCRN - mov al,[DSPMem+064h] - ret - -NEWSYM RDSPReg65 ; Voice 6 ADSR (1) - mov al,[DSPMem+065h] - ret - -NEWSYM RDSPReg66 ; Voice 6 ADSR (2) - mov al,[DSPMem+066h] - ret - -NEWSYM RDSPReg67 ; Voice 6 GAIN - mov al,[DSPMem+067h] - ret - -NEWSYM RDSPReg68 ; Voice 6 ENVX - mov al,[DSPMem+068h] - and al,7Fh - ret - -NEWSYM RDSPReg69 ; Voice 6 OUTX - mov al,[DSPMem+069h] - ret - -NEWSYM RDSPReg6A ; - mov al,[DSPMem+06Ah] - ret - -NEWSYM RDSPReg6B ; - mov al,[DSPMem+06Bh] - ret - -NEWSYM RDSPReg6C ; - mov al,[DSPMem+06Ch] - ret - -NEWSYM RDSPReg6D ; - mov al,[DSPMem+06Dh] - ret - -NEWSYM RDSPReg6E ; - mov al,[DSPMem+06Eh] - ret - -NEWSYM RDSPReg6F ; Voice 6 Echo coefficient - mov al,[DSPMem+06Fh] - ret - -NEWSYM RDSPReg70 ; Voice 7 Volume Left - mov al,[DSPMem+70h] - ret - -NEWSYM RDSPReg71 ; Voice 7 Volume Right - mov al,[DSPMem+71h] - ret - -NEWSYM RDSPReg72 ; Voice 7 Pitch Low - mov al,[DSPMem+072h] - ret - -NEWSYM RDSPReg73 ; Voice 7 Pitch High - mov al,[DSPMem+073h] - ret - -NEWSYM RDSPReg74 ; Voice 7 SCRN - mov al,[DSPMem+074h] - ret - -NEWSYM RDSPReg75 ; Voice 7 ADSR (1) - mov al,[DSPMem+075h] - ret - -NEWSYM RDSPReg76 ; Voice 7 ADSR (2) - mov al,[DSPMem+076h] - ret - -NEWSYM RDSPReg77 ; Voice 7 GAIN - mov al,[DSPMem+077h] - ret - -NEWSYM RDSPReg78 ; Voice 7 ENVX - mov al,[DSPMem+078h] - and al,7Fh - ret - -NEWSYM RDSPReg79 ; Voice 7 OUTX - mov al,[DSPMem+079h] - ret - -NEWSYM RDSPReg7A ; - mov al,[DSPMem+07Ah] - ret - -NEWSYM RDSPReg7B ; - mov al,[DSPMem+07Bh] - ret - -NEWSYM RDSPReg7C ; - mov al,[DSPMem+07Ch] - ret - -NEWSYM RDSPReg7D ; - mov al,[DSPMem+07Dh] - ret - -NEWSYM RDSPReg7E ; - mov al,[DSPMem+07Eh] - ret - -NEWSYM RDSPReg7F ; Voice 7 Echo coefficient - mov al,[DSPMem+07Fh] - ret - -NEWSYM RDSPReg80 ; - mov al,[DSPMem+080h] - ret - -NEWSYM RDSPReg81 ; - mov al,[DSPMem+081h] - ret - -NEWSYM RDSPReg82 ; - mov al,[DSPMem+082h] - ret - -NEWSYM RDSPReg83 ; - mov al,[DSPMem+083h] - ret - -NEWSYM RDSPReg84 ; - mov al,[DSPMem+084h] - ret - -NEWSYM RDSPReg85 ; - mov al,[DSPMem+085h] - ret - -NEWSYM RDSPReg86 ; - mov al,[DSPMem+086h] - ret - -NEWSYM RDSPReg87 ; - mov al,[DSPMem+087h] - ret - -NEWSYM RDSPReg88 ; - mov al,[DSPMem+088h] - ret - -NEWSYM RDSPReg89 ; - mov al,[DSPMem+089h] - ret - -NEWSYM RDSPReg8A ; - mov al,[DSPMem+08Ah] - ret - -NEWSYM RDSPReg8B ; - mov al,[DSPMem+08Bh] - ret - -NEWSYM RDSPReg8C ; - mov al,[DSPMem+08Ch] - ret - -NEWSYM RDSPReg8D ; - mov al,[DSPMem+08Dh] - ret - -NEWSYM RDSPReg8E ; - mov al,[DSPMem+08Eh] - ret - -NEWSYM RDSPReg8F ; - mov al,[DSPMem+08Fh] - ret - -NEWSYM RDSPReg90 ; - mov al,[DSPMem+090h] - ret - -NEWSYM RDSPReg91 ; - mov al,[DSPMem+091h] - ret - -NEWSYM RDSPReg92 ; - mov al,[DSPMem+092h] - ret - -NEWSYM RDSPReg93 ; - mov al,[DSPMem+093h] - ret - -NEWSYM RDSPReg94 ; - mov al,[DSPMem+094h] - ret - -NEWSYM RDSPReg95 ; - mov al,[DSPMem+095h] - ret - -NEWSYM RDSPReg96 ; - mov al,[DSPMem+096h] - ret - -NEWSYM RDSPReg97 ; - mov al,[DSPMem+097h] - ret - -NEWSYM RDSPReg98 ; - mov al,[DSPMem+098h] - ret - -NEWSYM RDSPReg99 ; - mov al,[DSPMem+099h] - ret - -NEWSYM RDSPReg9A ; - mov al,[DSPMem+09Ah] - ret - -NEWSYM RDSPReg9B ; - mov al,[DSPMem+09Bh] - ret - -NEWSYM RDSPReg9C ; - mov al,[DSPMem+09Ch] - ret - -NEWSYM RDSPReg9D ; - mov al,[DSPMem+09Dh] - ret - -NEWSYM RDSPReg9E ; - mov al,[DSPMem+09Eh] - ret - -NEWSYM RDSPReg9F ; - mov al,[DSPMem+09Fh] - ret - -NEWSYM RDSPRegA0 ; - mov al,[DSPMem+0A0h] - ret - -NEWSYM RDSPRegA1 ; - mov al,[DSPMem+0A1h] - ret - -NEWSYM RDSPRegA2 ; - mov al,[DSPMem+0A2h] - ret - -NEWSYM RDSPRegA3 ; - mov al,[DSPMem+0A3h] - ret - -NEWSYM RDSPRegA4 ; - mov al,[DSPMem+0A4h] - ret - -NEWSYM RDSPRegA5 ; - mov al,[DSPMem+0A5h] - ret - -NEWSYM RDSPRegA6 ; - mov al,[DSPMem+0A6h] - ret - -NEWSYM RDSPRegA7 ; - mov al,[DSPMem+0A7h] - ret - -NEWSYM RDSPRegA8 ; - mov al,[DSPMem+0A8h] - ret - -NEWSYM RDSPRegA9 ; - mov al,[DSPMem+0A9h] - ret - -NEWSYM RDSPRegAA ; - mov al,[DSPMem+0AAh] - ret - -NEWSYM RDSPRegAB ; - mov al,[DSPMem+0ABh] - ret - -NEWSYM RDSPRegAC ; - mov al,[DSPMem+0ACh] - ret - -NEWSYM RDSPRegAD ; - mov al,[DSPMem+0ADh] - ret - -NEWSYM RDSPRegAE ; - mov al,[DSPMem+0AEh] - ret - -NEWSYM RDSPRegAF ; - mov al,[DSPMem+0AFh] - ret - -NEWSYM RDSPRegB0 ; - mov al,[DSPMem+0B0h] - ret - -NEWSYM RDSPRegB1 ; - mov al,[DSPMem+0B1h] - ret - -NEWSYM RDSPRegB2 ; - mov al,[DSPMem+0B2h] - ret - -NEWSYM RDSPRegB3 ; - mov al,[DSPMem+0B3h] - ret - -NEWSYM RDSPRegB4 ; - mov al,[DSPMem+0B4h] - ret - -NEWSYM RDSPRegB5 ; - mov al,[DSPMem+0B5h] - ret - -NEWSYM RDSPRegB6 ; - mov al,[DSPMem+0B6h] - ret - -NEWSYM RDSPRegB7 ; - mov al,[DSPMem+0B7h] - ret - -NEWSYM RDSPRegB8 ; - mov al,[DSPMem+0B8h] - ret - -NEWSYM RDSPRegB9 ; - mov al,[DSPMem+0B9h] - ret - -NEWSYM RDSPRegBA ; - mov al,[DSPMem+0BAh] - ret - -NEWSYM RDSPRegBB ; - mov al,[DSPMem+0BBh] - ret - -NEWSYM RDSPRegBC ; - mov al,[DSPMem+0BCh] - ret - -NEWSYM RDSPRegBD ; - mov al,[DSPMem+0BDh] - ret - -NEWSYM RDSPRegBE ; - mov al,[DSPMem+0BEh] - ret - -NEWSYM RDSPRegBF ; - mov al,[DSPMem+0BFh] - ret - -NEWSYM RDSPRegC0 ; - mov al,[DSPMem+0C0h] - ret - -NEWSYM RDSPRegC1 ; - mov al,[DSPMem+0C1h] - ret - -NEWSYM RDSPRegC2 ; - mov al,[DSPMem+0C2h] - ret - -NEWSYM RDSPRegC3 ; - mov al,[DSPMem+0C3h] - ret - -NEWSYM RDSPRegC4 ; - mov al,[DSPMem+0C4h] - ret - -NEWSYM RDSPRegC5 ; - mov al,[DSPMem+0C5h] - ret - -NEWSYM RDSPRegC6 ; - mov al,[DSPMem+0C6h] - ret - -NEWSYM RDSPRegC7 ; - mov al,[DSPMem+0C7h] - ret - -NEWSYM RDSPRegC8 ; - mov al,[DSPMem+0C8h] - ret - -NEWSYM RDSPRegC9 ; - mov al,[DSPMem+0C9h] - ret - -NEWSYM RDSPRegCA ; - mov al,[DSPMem+0CAh] - ret - -NEWSYM RDSPRegCB ; - mov al,[DSPMem+0CBh] - ret - -NEWSYM RDSPRegCC ; - mov al,[DSPMem+0CCh] - ret - -NEWSYM RDSPRegCD ; - mov al,[DSPMem+0CDh] - ret - -NEWSYM RDSPRegCE ; - mov al,[DSPMem+0CEh] - ret - -NEWSYM RDSPRegCF ; - mov al,[DSPMem+0CFh] - ret - -NEWSYM RDSPRegD0 ; - mov al,[DSPMem+0D0h] - ret - -NEWSYM RDSPRegD1 ; - mov al,[DSPMem+0D1h] - ret - -NEWSYM RDSPRegD2 ; - mov al,[DSPMem+0D2h] - ret - -NEWSYM RDSPRegD3 ; - mov al,[DSPMem+0D3h] - ret - -NEWSYM RDSPRegD4 ; - mov al,[DSPMem+0D4h] - ret - -NEWSYM RDSPRegD5 ; - mov al,[DSPMem+0D5h] - ret - -NEWSYM RDSPRegD6 ; - mov al,[DSPMem+0D6h] - ret - -NEWSYM RDSPRegD7 ; - mov al,[DSPMem+0D7h] - ret - -NEWSYM RDSPRegD8 ; - mov al,[DSPMem+0D8h] - ret - -NEWSYM RDSPRegD9 ; - mov al,[DSPMem+0D9h] - ret - -NEWSYM RDSPRegDA ; - mov al,[DSPMem+0DAh] - ret - -NEWSYM RDSPRegDB ; - mov al,[DSPMem+0DBh] - ret - -NEWSYM RDSPRegDC ; - mov al,[DSPMem+0DCh] - ret - -NEWSYM RDSPRegDD ; - mov al,[DSPMem+0DDh] - ret - -NEWSYM RDSPRegDE ; - mov al,[DSPMem+0DEh] - ret - -NEWSYM RDSPRegDF ; - mov al,[DSPMem+0DFh] - ret - -NEWSYM RDSPRegE0 ; - mov al,[DSPMem+0E0h] - ret - -NEWSYM RDSPRegE1 ; - mov al,[DSPMem+0E1h] - ret - -NEWSYM RDSPRegE2 ; - mov al,[DSPMem+0E2h] - ret - -NEWSYM RDSPRegE3 ; - mov al,[DSPMem+0E3h] - ret - -NEWSYM RDSPRegE4 ; - mov al,[DSPMem+0E4h] - ret - -NEWSYM RDSPRegE5 ; - mov al,[DSPMem+0E5h] - ret - -NEWSYM RDSPRegE6 ; - mov al,[DSPMem+0E6h] - ret - -NEWSYM RDSPRegE7 ; - mov al,[DSPMem+0E7h] - ret - -NEWSYM RDSPRegE8 ; - mov al,[DSPMem+0E8h] - ret - -NEWSYM RDSPRegE9 ; - mov al,[DSPMem+0E9h] - ret - -NEWSYM RDSPRegEA ; - mov al,[DSPMem+0EAh] - ret - -NEWSYM RDSPRegEB ; - mov al,[DSPMem+0EBh] - ret - -NEWSYM RDSPRegEC ; - mov al,[DSPMem+0ECh] - ret - -NEWSYM RDSPRegED ; - mov al,[DSPMem+0EDh] - ret - -NEWSYM RDSPRegEE ; - mov al,[DSPMem+0EEh] - ret - -NEWSYM RDSPRegEF ; - mov al,[DSPMem+0EFh] - ret - -NEWSYM RDSPRegF0 ; - mov al,[DSPMem+0F0h] - ret - -NEWSYM RDSPRegF1 ; - mov al,[DSPMem+0F1h] - ret - -NEWSYM RDSPRegF2 ; - mov al,[DSPMem+0F2h] - ret - -NEWSYM RDSPRegF3 ; - mov al,[DSPMem+0F3h] - ret - -NEWSYM RDSPRegF4 ; - mov al,[DSPMem+0F4h] - ret - -NEWSYM RDSPRegF5 ; - mov al,[DSPMem+0F5h] - ret - -NEWSYM RDSPRegF6 ; - mov al,[DSPMem+0F6h] - ret - -NEWSYM RDSPRegF7 ; - mov al,[DSPMem+0F7h] - ret - -NEWSYM RDSPRegF8 ; - mov al,[DSPMem+0F8h] - ret - -NEWSYM RDSPRegF9 ; - mov al,[DSPMem+0F9h] - ret - -NEWSYM RDSPRegFA ; - mov al,[DSPMem+0FAh] - ret - -NEWSYM RDSPRegFB ; - mov al,[DSPMem+0FBh] - ret - -NEWSYM RDSPRegFC ; - mov al,[DSPMem+0FCh] - ret - -NEWSYM RDSPRegFD ; - mov al,[DSPMem+0FDh] - ret - -NEWSYM RDSPRegFE ; - mov al,[DSPMem+0FEh] - ret - -NEWSYM RDSPRegFF ; - mov al,[DSPMem+0FFh] - ret - -%macro ProcessGain 1 - push eax - push ebx - push edx - test byte[DSPMem+07h+%1*10h],80h - jz near %%Direct - test byte[DSPMem+07h+%1*10h],40h - jnz near %%Increase - test byte[DSPMem+07h+%1*10h],20h - jz %%LinearDec - xor eax,eax - mov al,[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[DecreaseRateExp+eax*4] - mov dword[Voice0EnvInc+%1*4],007FFFFFh - shr ebx,5 - mov [Voice0Time+%1*4],ebx - mov [GainDecBendDataTime+%1*4],ebx - xor edx,edx - mov eax,127*65536 - sub eax,118*65536 - mov byte[GainDecBendDataPos+%1],0 - mov byte[GainDecBendDataDat+%1],127 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],7 - ret -%%LinearDec - xor eax,eax - mov al,[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Decrease+eax*4] - mov dword[Voice0EnvInc+%1*4],007FFFFFh - mov [Voice0Time+%1*4],ebx - xor edx,edx - mov eax,127*65536 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],5 - ret -%%Increase - test byte[DSPMem+07h+%1*10h],20h - jz %%LinearInc - xor eax,eax - mov al,[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Increase+eax*4] - mov dword[Voice0EnvInc+%1*4],0 - mov [Voice0Time+%1*4],ebx - xor edx,edx - mov eax,127*65536 - div ebx - mov [Voice0IncNumber+%1*4],eax - mov ebx,[Voice0Time+%1*4] - mov eax,ebx - shr eax,2 - sub ebx,eax - dec ebx - mov [Voice0Time+%1*4],ebx - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],6 - ret -%%LinearInc - xor eax,eax - mov al,[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Increase+eax*4] - mov dword[Voice0EnvInc+%1*4],0 - mov [Voice0Time+%1*4],ebx - xor edx,edx - mov eax,127*65536 - div ebx - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],3 - ret -%%Direct - mov al,[DSPMem+07h+%1*10h] - and al,7Fh - mov dword[Voice0EnvInc+%1*4],0 - mov [Voice0EnvInc+%1*4+2],al - mov dword[Voice0Time+%1*4],0FFFFFFFFh - mov dword[Voice0IncNumber+%1*4],0 - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],4 - ret -%endmacro - -%macro ProcessGain2 1 - push eax - push ebx - push edx - test byte[DSPMem+07h+%1*10h],80h - jz near %%Direct - test byte[DSPMem+07h+%1*10h],40h - jnz near %%Increase - test byte[DSPMem+07h+%1*10h],20h - jz %%LinearDec - xor eax,eax - mov al,[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[DecreaseRateExp+eax*4] - shr ebx,5 - mov [Voice0Time+%1*4],ebx - mov [GainDecBendDataTime+%1*4],ebx - xor edx,edx - mov dh,118 - mov dl,[Voice0EnvInc+%1*4+2] - xor eax,eax - mov al,[VolumeConvTable+edx*2] - xor edx,edx - shl eax,16 - mov dl,[Voice0EnvInc+%1*4+2] - neg eax - shl edx,16 - add eax,edx - xor edx,edx - mov byte[GainDecBendDataPos+%1],0 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - mov al,[Voice0EnvInc+%1*4+2] - mov [GainDecBendDataDat+%1],al - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],7 - ret -%%LinearDec - xor eax,eax - mov al,[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Decrease+eax*4] - mov [Voice0Time+%1*4],ebx - xor edx,edx - xor eax,eax - mov al,[Voice0EnvInc+%1*4+2] - shl eax,16 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],5 - ret -%%Increase - test byte[DSPMem+07h+%1*10h],20h - jz %%LinearInc - xor eax,eax - mov al,[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Increase+eax*4] - mov [Voice0Time+%1*4],ebx - xor edx,edx - xor eax,eax - mov al,[Voice0EnvInc+%1*4+2] - inc al - test al,80h - jz %%noof - mov al,127 -%%noof - xor al,127 - shl eax,16 - div ebx - mov [Voice0IncNumber+%1*4],eax - mov ebx,[Voice0Time+%1*4] - mov eax,ebx - shr eax,2 - sub ebx,eax - dec ebx - mov [Voice0Time+%1*4],ebx - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],6 - ret -%%LinearInc - xor eax,eax - mov al,[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Increase+eax*4] - mov [Voice0Time+%1*4],ebx - xor edx,edx - xor eax,eax - mov al,[Voice0EnvInc+%1*4+2] - inc al - test al,80h - jz %%noof2 - mov al,127 -%%noof2 - xor al,127 - shl eax,16 - div ebx - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],3 - ret -%%Direct - mov al,[DSPMem+07h+%1*10h] - and al,7Fh - mov dword[Voice0EnvInc+%1*4],0 - mov [Voice0EnvInc+%1*4+2],al - mov dword[Voice0Time+%1*4],0FFFFFFFFh - mov dword[Voice0IncNumber+%1*4],0 - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],4 - ret -%%end - pop edx - pop ebx - pop eax - ret -%endmacro - - -%macro SwitchSustain 1 - push eax - push ebx - push edx - mov al,[Voice0EnvInc+%1*4+2] - mov [GainDecBendDataDat+%1],al - cmp byte[Voice0State+%1],8 - je %%full - cmp byte[Voice0State+%1],2 - jae %%nofull -%%full - mov byte[GainDecBendDataDat+%1],7Fh -%%nofull - mov al,[DSPMem+05h+%1*10h] - shr al,4 - and eax,07h - mov edx,[DecayRate+eax*4] - xor eax,eax - mov al,[DSPMem+06h+%1*10h] - and al,1Fh - mov ebx,[SustainRate+eax*4] - cmp edx,ebx - jae near %%decayover - ; ebx = total sustain time - xor eax,eax - mov al,[DSPMem+06h+%1*10h] - shr al,5 - mov al,[AdsrSustLevLoc+eax] - ; traverse through al entries in edx time - ; then through 64-al entries in ebx-edx time - mov [AdsrBlocksLeft+%1],al - sub ebx,edx - push ebx - push eax - mov ebx,eax - mov eax,edx - xor edx,edx - or ebx,ebx - jz .oopszero - div ebx -.oopszero - mov [Voice0Time+%1*4],eax - mov [GainDecBendDataTime+%1*4],eax - pop eax - pop ebx - mov edx,ebx - mov ebx,64 - sub bl,al - mov eax,edx - xor edx,edx - div ebx - mov [AdsrNextTimeDepth+%1*4],eax - mov dword[Voice0EnvInc+%1*4],0 - mov al,[GainDecBendDataDat+%1] - mov [Voice0EnvInc+%1*4+2],al - mov ebx,[Voice0Time+%1*4] - xor edx,edx - - mov dh,122 - mov dl,[Voice0EnvInc+%1*4+2] - xor eax,eax - mov al,[VolumeConvTable+edx*2] - xor edx,edx - shl eax,16 - mov dl,[Voice0EnvInc+%1*4+2] - neg eax - shl edx,16 - add eax,edx - xor edx,edx - mov byte[GainDecBendDataPos+%1],0 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],9 - ret -%%decayover - sub edx,ebx - push ebx - mov eax,edx - xor ebx,ebx - mov bl,[DSPMem+06h+%1*10h] - shr bl,5 - xor bl,07h - mul ebx - mov ebx,7 - div ebx - pop ebx - add ebx,eax - mov dword[Voice0EnvInc+%1*4],007FFFFFh - shr ebx,5 - mov [Voice0Time+%1*4],ebx - mov [GainDecBendDataTime+%1*4],ebx - xor edx,edx - - mov dh,118 - mov dl,[Voice0EnvInc+%1*4+2] - xor eax,eax - mov al,[VolumeConvTable+edx*2] - xor edx,edx - shl eax,16 - mov dl,[Voice0EnvInc+%1*4+2] - neg eax - shl edx,16 - add eax,edx - xor edx,edx - mov byte[GainDecBendDataPos+%1],0 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - pop eax - mov byte[Voice0State+%1],7 - ret -%endmacro - -%macro VoiceAdsr 1 - test byte[MuteVoiceF],1 << %1 - jnz near .nogain - cmp byte[Voice0State+%1],200 - je near .nogain - cmp [DSPMem+05h+%1*10h],al - je near .nogain - test al,80h - jz near .gain - mov [DSPMem+05h+%1*10h],al - SwitchSustain %1 - ret -.nogain - mov [DSPMem+05h+%1*10h],al - ret -.gain - cmp byte[Voice0Status+%1],1 - jne .nogain - cmp word[DSPMem+06h+%1*10h],0A0E0h - je .nogain - test byte[DSPMem+05h+%1*10h],80h - jz near .gain2 - cmp byte[Voice0State+%1],8 - je .gain1 - cmp byte[Voice0State+%1],2 - jae near .gain2 -.gain1 - mov [DSPMem+05h+%1*10h],al - ProcessGain %1 ; Normal - ret -.gain2 - mov [DSPMem+05h+%1*10h],al - cmp byte[Voice0State+%1],210 - jne %%noendofsamp2 - push eax - push ebx - mov al,%1 - call VoiceStarter - mov dword[Voice0EnvInc+%1*4],007FFFFFh - pop ebx - pop eax -%%noendofsamp2 - ProcessGain2 %1 - ret -%endmacro - -%macro VoiceAdsr2 1 - test byte[MuteVoiceF],1 << %1 - jnz near .noadsrswitch - cmp byte[Voice0State+%1],200 - je near .noadsrswitch - cmp [DSPMem+06h+%1*10h],al - je near .noadsrswitch - mov [DSPMem+06h+%1*10h],al - test byte[DSPMem+05h+%1*10h],80h - jz near .noadsrswitch - SwitchSustain %1 - ret -.noadsrswitch - mov [DSPMem+06h+%1*10h],al - ret -%endmacro - - -%macro VoiceGain 1 - test byte[MuteVoiceF],1 << %1 - jnz .nogain - cmp byte[Voice0State+%1],200 - je .nogain - cmp [DSPMem+07h+%1*10h],al - je .nogain - mov [DSPMem+07h+%1*10h],al - cmp byte[Voice0Status+%1],1 - jne .nogain - test byte[DSPMem+05h+%1*10h],80h - jz .gain -.nogain - mov [DSPMem+07h+%1*10h],al - ret -.gain - cmp byte[Voice0State+%1],210 - jne %%noendofsamp - push eax - push ebx - mov al,%1 - call VoiceStarter - pop ebx - pop eax -%%noendofsamp - ProcessGain2 %1 -%endmacro - -;Write DSP Registers functions - -NEWSYM WDSPReg00 ; Voice 0 Volume Left - mov [DSPMem+00h],al - ret - mov [DSPMem+01h],al - ret - -NEWSYM WDSPReg01 ; Voice 0 Volume Right - mov [DSPMem+01h],al - ret - mov [DSPMem+00h],al - ret - -NEWSYM WDSPReg02 ; Voice 0 Pitch Low - mov [DSPMem+02h],al - ret - -NEWSYM WDSPReg03 ; Voice 0 Pitch High - mov [DSPMem+03h],al - ret - -NEWSYM WDSPReg04 ; Voice 0 SCRN - mov [DSPMem+04h],al - ret - -NEWSYM WDSPReg05 ; Voice 0 ADSR (1) - VoiceAdsr 0 - ret - -NEWSYM WDSPReg06 ; Voice 0 ADSR (2) - VoiceAdsr2 0 - ret - -NEWSYM WDSPReg07 ; Voice 0 GAIN - VoiceGain 0 - ret - -NEWSYM WDSPReg08 ; Voice 0 ENVX - mov [DSPMem+08h],al - ret - -NEWSYM WDSPReg09 ; Voice 0 OUTX - mov [DSPMem+09h],al - ret - -NEWSYM WDSPReg0A ; Voice 0 - mov [DSPMem+0Ah],al - ret - -NEWSYM WDSPReg0B ; Voice 0 - mov [DSPMem+0Bh],al - ret - -NEWSYM WDSPReg0C ; Voice 0 - mov [DSPMem+0Ch],al - push eax - and eax,0FFh - mov al,[VolumeTableb+eax] - mov ah,[MusicVol] - mov al,[VolumeConvTable+eax*2] - mov [GlobalVL],al - pop eax - ret - -NEWSYM WDSPReg0D ; Echo Feedback - mov [DSPMem+0Dh],al - push eax - and eax,0FFh - mov al,[VolumeTableb+eax] - mov [EchoFB],eax - pop eax - ret - -NEWSYM WDSPReg0E ; Voice 0 - mov [DSPMem+0Eh],al - ret - -NEWSYM WDSPReg0F ; Voice 0 Echo coefficient - mov [DSPMem+0Fh],al - push eax - movsx eax,al - mov [FIRTAPVal0],eax - pop eax - ret - -NEWSYM WDSPReg10 ; Voice 1 Volume Left - mov [DSPMem+10h],al - ret - -NEWSYM WDSPReg11 ; Voice 1 Volume Right - mov [DSPMem+11h],al - ret - -NEWSYM WDSPReg12 ; Voice 1 Pitch Low - mov [DSPMem+012h],al - ret - -NEWSYM WDSPReg13 ; Voice 1 Pitch High - mov [DSPMem+013h],al - ret - -NEWSYM WDSPReg14 ; Voice 1 SCRN - mov [DSPMem+14h],al - ret - -NEWSYM WDSPReg15 ; Voice 1 ADSR (1) - VoiceAdsr 1 - ret - -NEWSYM WDSPReg16 ; Voice 1 ADSR (2) - VoiceAdsr2 1 - ret - -NEWSYM WDSPReg17 ; Voice 1 GAIN - VoiceGain 1 - ret - -NEWSYM WDSPReg18 ; Voice 1 ENVX - mov [DSPMem+018h],al - ret - -NEWSYM WDSPReg19 ; Voice 1 OUTX - mov [DSPMem+019h],al - ret - -NEWSYM WDSPReg1A ; Voice 1 - mov [DSPMem+01Ah],al - ret - -NEWSYM WDSPReg1B ; Voice 1 - mov [DSPMem+01Bh],al - ret - -NEWSYM WDSPReg1C ; Voice 1 - mov [DSPMem+01Ch],al - push eax - and eax,0FFh - mov al,[VolumeTableb+eax] - mov ah,[MusicVol] - mov al,[VolumeConvTable+eax*2] - mov [GlobalVR],al - pop eax - ret - -NEWSYM WDSPReg1D ; Voice 1 - mov [DSPMem+01Dh],al - ret - -NEWSYM WDSPReg1E ; Voice 1 - mov [DSPMem+01Eh],al - ret - -NEWSYM WDSPReg1F ; Voice 1 Echo coefficient - mov [DSPMem+01Fh],al - push eax - movsx eax,al - mov [FIRTAPVal1],eax - pop eax - ret - -NEWSYM WDSPReg20 ; Voice 2 Volume Left - mov [DSPMem+20h],al - ret - -NEWSYM WDSPReg21 ; Voice 2 Volume Right - mov [DSPMem+21h],al - ret - -NEWSYM WDSPReg22 ; Voice 2 Pitch Low - mov [DSPMem+022h],al - ret - -NEWSYM WDSPReg23 ; Voice 2 Pitch High - mov [DSPMem+023h],al - ret - -NEWSYM WDSPReg24 ; Voice 2 SCRN - mov [DSPMem+24h],al - ret - -NEWSYM WDSPReg25 ; Voice 2 ADSR (1) - VoiceAdsr 2 - ret - -NEWSYM WDSPReg26 ; Voice 2 ADSR (2) - VoiceAdsr2 2 - ret - -NEWSYM WDSPReg27 ; Voice 2 GAIN - VoiceGain 2 - ret - -NEWSYM WDSPReg28 ; Voice 2 ENVX - mov [DSPMem+028h],al - ret - -NEWSYM WDSPReg29 ; Voice 2 OUTX - mov [DSPMem+029h],al - ret - -NEWSYM WDSPReg2A ; Voice 2 - mov [DSPMem+02Ah],al - ret - -NEWSYM WDSPReg2B ; Voice 2 - mov [DSPMem+02Bh],al - ret - -NEWSYM WDSPReg2C ; Voice 2 - mov [DSPMem+02Ch],al - push eax - and eax,0FFh - mov al,[VolumeTableb+eax] - mov ah,[MusicVol] - mov al,[VolumeConvTable+eax*2] - mov [EchoVL],al - pop eax - ret - -NEWSYM WDSPReg2D ; Voice 2 - mov [DSPMem+02Dh],al - ret - -NEWSYM WDSPReg2E ; Voice 2 - mov [DSPMem+02Eh],al - ret - -NEWSYM WDSPReg2F ; Voice 2 Echo coefficient - mov [DSPMem+02Fh],al - push eax - movsx eax,al - mov [FIRTAPVal2],eax - pop eax - ret - -NEWSYM WDSPReg30 ; Voice 3 Volume Left - mov [DSPMem+30h],al - ret - -NEWSYM WDSPReg31 ; Voice 3 Volume Right - mov [DSPMem+31h],al - ret - -NEWSYM WDSPReg32 ; Voice 3 Pitch Low - mov [DSPMem+032h],al - ret - -NEWSYM WDSPReg33 ; Voice 3 Pitch High - mov [DSPMem+033h],al - ret - -NEWSYM WDSPReg34 ; Voice 3 SCRN - mov [DSPMem+34h],al - ret - -NEWSYM WDSPReg35 ; Voice 3 ADSR (1) - VoiceAdsr 3 - ret - -NEWSYM WDSPReg36 ; Voice 3 ADSR (2) - VoiceAdsr2 3 - ret - -NEWSYM WDSPReg37 ; Voice 3 GAIN - VoiceGain 3 - ret - -NEWSYM WDSPReg38 ; Voice 3 ENVX - mov [DSPMem+038h],al - ret - -NEWSYM WDSPReg39 ; Voice 3 OUTX - mov [DSPMem+039h],al - ret - -NEWSYM WDSPReg3A ; Voice 3 - mov [DSPMem+03Ah],al - ret - -NEWSYM WDSPReg3B ; Voice 3 - mov [DSPMem+03Bh],al - ret - -NEWSYM WDSPReg3C ; Voice 3 - mov [DSPMem+03Ch],al - push eax - and eax,0FFh - mov al,[VolumeTableb+eax] - mov ah,[MusicVol] - mov al,[VolumeConvTable+eax*2] - mov [EchoVR],al - pop eax - ret - -NEWSYM WDSPReg3D ; Voice 3 - mov byte[Voice0Noise],0 - mov byte[Voice1Noise],0 - mov byte[Voice2Noise],0 - mov byte[Voice3Noise],0 - mov byte[Voice4Noise],0 - mov byte[Voice5Noise],0 - mov byte[Voice6Noise],0 - mov byte[Voice7Noise],0 - test al,1 - jz .TestVoice1 - mov byte[Voice0Noise],1 -.TestVoice1 - test al,2 - jz .TestVoice2 - mov byte[Voice1Noise],1 -.TestVoice2 - test al,4 - jz .TestVoice3 - mov byte[Voice2Noise],1 -.TestVoice3 - test al,8 - jz .TestVoice4 - mov byte[Voice3Noise],1 -.TestVoice4 - test al,16 - jz .TestVoice5 - mov byte[Voice4Noise],1 -.TestVoice5 - test al,32 - jz .TestVoice6 - mov byte[Voice5Noise],1 -.TestVoice6 - test al,64 - jz .TestVoice7 - mov byte[Voice6Noise],1 -.TestVoice7 - test al,128 - jz .TestVoice8 - mov byte[Voice7Noise],1 -.TestVoice8 - mov [DSPMem+03Dh],al - ret - -NEWSYM WDSPReg3E ; Voice 3 - mov [DSPMem+03Eh],al - ret - -NEWSYM WDSPReg3F ; Voice 3 Echo coefficient - mov [DSPMem+03Fh],al - push eax - movsx eax,al - mov [FIRTAPVal3],eax - pop eax - ret - -NEWSYM WDSPReg40 ; Voice 4 Volume Left - mov [DSPMem+40h],al - ret - -NEWSYM WDSPReg41 ; Voice 4 Volume Right - mov [DSPMem+41h],al - ret - -NEWSYM WDSPReg42 ; Voice 4 Pitch Low - mov [DSPMem+042h],al - ret - -NEWSYM WDSPReg43 ; Voice 4 Pitch High - mov [DSPMem+043h],al - ret - -NEWSYM WDSPReg44 ; Voice 4 SCRN - mov [DSPMem+44h],al - ret - -NEWSYM WDSPReg45 ; Voice 4 ADSR (1) - VoiceAdsr 4 - ret - -NEWSYM WDSPReg46 ; Voice 4 ADSR (2) - VoiceAdsr2 4 - ret - -NEWSYM WDSPReg47 ; Voice 4 GAIN - VoiceGain 4 - ret - -NEWSYM WDSPReg48 ; Voice 4 ENVX - mov [DSPMem+048h],al - ret - -NEWSYM WDSPReg49 ; Voice 4 OUTX - mov [DSPMem+049h],al - ret - -NEWSYM WDSPReg4A ; Voice 4 - mov [DSPMem+04Ah],al - ret - -NEWSYM WDSPReg4B ; Voice 4 - mov [DSPMem+04Bh],al - ret - -NEWSYM WDSPReg4C ; Key On - push ebx - mov bl,[MuteVoiceF] - xor bl,0FFh - and bl,al - - xor byte[DSPMem+05Ch],0FFh - jnz .notzero - and bl,[DSPMem+05Ch] -.notzero - xor byte[DSPMem+05Ch],0FFh - - or byte[KeyOnStA],bl - pop ebx - test al,80h - jz .nokon - inc byte[SoundTest] -.nokon - mov [DSPMem+04Ch],al - push eax - xor al,0FFh - and byte[DSPMem+07Ch],al - pop eax - ret - -NEWSYM ProcessKeyOn - test al,1 - jz .TestVoice1 - push edx - call Voice0Start - pop edx -.TestVoice1 - test al,2 - jz .TestVoice2 - push edx - call Voice1Start - pop edx -.TestVoice2 - test al,4 - jz .TestVoice3 - push edx - call Voice2Start - pop edx -.TestVoice3 - test al,8 - jz .TestVoice4 - push edx - call Voice3Start - pop edx -.TestVoice4 - test al,16 - jz .TestVoice5 - push edx - call Voice4Start - pop edx -.TestVoice5 - test al,32 - jz .TestVoice6 - push edx - call Voice5Start - pop edx -.TestVoice6 - test al,64 - jz .TestVoice7 - push edx - call Voice6Start - pop edx -.TestVoice7 - test al,128 - jz .TestVoice8 - push edx - call Voice7Start - pop edx -.TestVoice8 - test al,0FFh - jz .novoice - mov byte[keyonsn],1 -.novoice - ret - -NEWSYM WDSPReg4D ; Voice 4 - mov [DSPMem+04Dh],al - ret - -NEWSYM WDSPReg4E ; Voice 4 - mov [DSPMem+04Eh],al - ret - -NEWSYM WDSPReg4F ; Voice 4 Echo coefficient - mov [DSPMem+04Fh],al - push eax - movsx eax,al - mov [FIRTAPVal4],eax - pop eax - ret - -NEWSYM WDSPReg50 ; Voice 5 Volume Left - mov [DSPMem+50h],al - ret - -NEWSYM WDSPReg51 ; Voice 5 Volume Right - mov [DSPMem+51h],al - ret - -NEWSYM WDSPReg52 ; Voice 5 Pitch Low - mov [DSPMem+052h],al - ret - -NEWSYM WDSPReg53 ; Voice 5 Pitch High - mov [DSPMem+053h],al - ret - -NEWSYM WDSPReg54 ; Voice 5 SCRN - mov [DSPMem+54h],al - ret - -NEWSYM WDSPReg55 ; Voice 5 ADSR (1) - VoiceAdsr 5 - ret - -NEWSYM WDSPReg56 ; Voice 5 ADSR (2) - VoiceAdsr2 5 - ret - -NEWSYM WDSPReg57 ; Voice 5 GAIN - VoiceGain 5 - ret - -NEWSYM WDSPReg58 ; Voice 5 ENVX - mov [DSPMem+058h],al - ret - -NEWSYM WDSPReg59 ; Voice 5 OUTX - mov [DSPMem+059h],al - ret - -NEWSYM WDSPReg5A ; Voice 5 - mov [DSPMem+05Ah],al - ret - -NEWSYM WDSPReg5B ; Voice 5 - mov [DSPMem+05Bh],al - ret - -%macro keyoffm 1 - test byte[MuteVoiceF],1 << %1 - jnz %%nokeyoff - push eax - push edx - push ebx - mov dword[Voice0Time+%1*4],255 - mov eax,[Voice0EnvInc+%1*4] - shr eax,8 - neg eax - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],200 - mov byte[DSPMem+08h+%1*10h],0 - or byte[DSPMem+7Ch],1 << %1 - pop ebx - pop edx - pop eax -%%nokeyoff -%endmacro - -NEWSYM WDSPReg5C ; Key Off - push eax - xor al,0FFh - and byte[KeyOnStA],al - and byte[KeyOnStB],al - pop eax - test al,1 - jz .TestVoice1 - keyoffm 0 -.TestVoice1 - test al,2 - jz .TestVoice2 - keyoffm 1 -.TestVoice2 - test al,4 - jz .TestVoice3 - keyoffm 2 -.TestVoice3 - test al,8 - jz .TestVoice4 - keyoffm 3 -.TestVoice4 - test al,16 - jz .TestVoice5 - keyoffm 4 -.TestVoice5 - test al,32 - jz .TestVoice6 - keyoffm 5 -.TestVoice6 - test al,64 - jz .TestVoice7 - keyoffm 6 -.TestVoice7 - test al,128 - jz .TestVoice8 - keyoffm 7 -.TestVoice8 - mov [DSPMem+05Ch],al - ret - -NEWSYM WDSPReg5D ; Voice 5 - mov [DSPMem+05Dh],al - ret - -NEWSYM WDSPReg5E ; Voice 5 - mov [DSPMem+05Eh],al - ret - -NEWSYM WDSPReg5F ; Voice 5 Echo coefficient - mov [DSPMem+05Fh],al - push eax - movsx eax,al - mov [FIRTAPVal5],eax - pop eax - ret - -NEWSYM WDSPReg60 ; Voice 6 Volume Left - mov [DSPMem+60h],al - ret - -NEWSYM WDSPReg61 ; Voice 6 Volume Right - mov [DSPMem+61h],al - ret - -NEWSYM WDSPReg62 ; Voice 6 Pitch Low - mov [DSPMem+062h],al - ret - -NEWSYM WDSPReg63 ; Voice 6 Pitch High - mov [DSPMem+063h],al - ret - -NEWSYM WDSPReg64 ; Voice 6 SCRN - mov [DSPMem+64h],al - ret - -NEWSYM WDSPReg65 ; Voice 6 ADSR (1) - VoiceAdsr 6 - ret - -NEWSYM WDSPReg66 ; Voice 6 ADSR (2) - VoiceAdsr2 6 - ret - -NEWSYM WDSPReg67 ; Voice 6 GAIN - VoiceGain 6 - ret - -NEWSYM WDSPReg68 ; Voice 6 ENVX - mov [DSPMem+068h],al - ret - -NEWSYM WDSPReg69 ; Voice 6 OUTX - mov [DSPMem+069h],al - ret - -NEWSYM WDSPReg6A ; Voice 6 - mov [DSPMem+06Ah],al - ret - -NEWSYM WDSPReg6B ; Voice 6 - mov [DSPMem+06Bh],al - ret - -NEWSYM WDSPReg6C ; Voice 6 - mov [DSPMem+06Ch],al - and byte[DSPMem+06Ch],7Fh - test al,0C0h - jz .NoRes2 - 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 -.NoRes2 - push eax - push ebx - push ecx - push edx - and eax,1Fh - xor edx,edx - mov eax,[NoiseSpeeds+eax*4] - Mul dword[dspPAdj] - ShrD EAX, EDX, 17 - mov [NoiseInc],eax - pop edx - pop ecx - pop ebx - pop eax - ret - -NEWSYM WDSPReg6D ; Voice 6 - mov [DSPMem+06Dh],al - ret - -NEWSYM WDSPReg6E ; Voice 6 - mov [DSPMem+06Eh],al - ret - -NEWSYM WDSPReg6F ; Voice 6 Echo coefficient - mov [DSPMem+06Fh],al - push eax - movsx eax,al - mov [FIRTAPVal6],eax - pop eax - ret - -NEWSYM WDSPReg70 ; Voice 7 Volume Left - mov [DSPMem+70h],al - ret - -NEWSYM WDSPReg71 ; Voice 7 Volume Right - mov [DSPMem+71h],al - ret - -NEWSYM WDSPReg72 ; Voice 7 Pitch Low - mov [DSPMem+072h],al - ret - -NEWSYM WDSPReg73 ; Voice 7 Pitch High - mov [DSPMem+073h],al - ret - -NEWSYM WDSPReg74 ; Voice 7 SCRN - mov [DSPMem+74h],al - ret - -NEWSYM WDSPReg75 ; Voice 7 ADSR (1) - VoiceAdsr 7 - ret - -NEWSYM WDSPReg76 ; Voice 7 ADSR (2) - VoiceAdsr2 7 - ret - -NEWSYM WDSPReg77 ; Voice 7 GAIN - VoiceGain 7 - ret - -NEWSYM WDSPReg78 ; Voice 7 ENVX - mov [DSPMem+078h],al - ret - -NEWSYM WDSPReg79 ; Voice 7 OUTX - mov [DSPMem+079h],al - ret - -NEWSYM WDSPReg7A ; Voice 7 - mov [DSPMem+07Ah],al - ret - -NEWSYM WDSPReg7B ; Voice 7 - mov [DSPMem+07Bh],al - ret - -NEWSYM WDSPReg7C ; ENDX - mov byte[DSPMem+07Ch],0 - ret - -NEWSYM WDSPReg7D ; Echo Delay - mov [DSPMem+07Dh],al - push ebx - mov ebx,eax - and ebx,0Fh - mov ebx,[EchoRate+ebx*4] - mov [MaxEcho],ebx - pop ebx - ret - -NEWSYM WDSPReg7E ; Voice 7 - mov [DSPMem+07Eh],al - ret - -NEWSYM WDSPReg7F ; Voice 7 Echo coefficient - mov [DSPMem+07Fh],al - push eax - movsx eax,al - mov [FIRTAPVal7],eax - pop eax - ret - -NEWSYM WDSPReg80 ; - mov [DSPMem+080h],al - ret - -NEWSYM WDSPReg81 ; - mov [DSPMem+081h],al - ret - -NEWSYM WDSPReg82 ; - mov [DSPMem+082h],al - ret - -NEWSYM WDSPReg83 ; - mov [DSPMem+083h],al - ret - -NEWSYM WDSPReg84 ; - mov [DSPMem+084h],al - ret - -NEWSYM WDSPReg85 ; - mov [DSPMem+085h],al - ret - -NEWSYM WDSPReg86 ; - mov [DSPMem+086h],al - ret - -NEWSYM WDSPReg87 ; - mov [DSPMem+087h],al - ret - -NEWSYM WDSPReg88 ; - mov [DSPMem+088h],al - ret - -NEWSYM WDSPReg89 ; - mov [DSPMem+089h],al - ret - -NEWSYM WDSPReg8A ; - mov [DSPMem+08Ah],al - ret - -NEWSYM WDSPReg8B ; - mov [DSPMem+08Bh],al - ret - -NEWSYM WDSPReg8C ; - mov [DSPMem+08Ch],al - ret - -NEWSYM WDSPReg8D ; - mov [DSPMem+08Dh],al - ret - -NEWSYM WDSPReg8E ; - mov [DSPMem+08Eh],al - ret - -NEWSYM WDSPReg8F ; - mov [DSPMem+08Fh],al - ret - -NEWSYM WDSPReg90 ; - mov [DSPMem+090h],al - ret - -NEWSYM WDSPReg91 ; - mov [DSPMem+091h],al - ret - -NEWSYM WDSPReg92 ; - mov [DSPMem+092h],al - ret - -NEWSYM WDSPReg93 ; - mov [DSPMem+093h],al - ret - -NEWSYM WDSPReg94 ; - mov [DSPMem+094h],al - ret - -NEWSYM WDSPReg95 ; - mov [DSPMem+095h],al - ret - -NEWSYM WDSPReg96 ; - mov [DSPMem+096h],al - ret - -NEWSYM WDSPReg97 ; - mov [DSPMem+097h],al - ret - -NEWSYM WDSPReg98 ; - mov [DSPMem+098h],al - ret - -NEWSYM WDSPReg99 ; - mov [DSPMem+099h],al - ret - -NEWSYM WDSPReg9A ; - mov [DSPMem+09Ah],al - ret - -NEWSYM WDSPReg9B ; - mov [DSPMem+09Bh],al - ret - -NEWSYM WDSPReg9C ; - mov [DSPMem+09Ch],al - ret - -NEWSYM WDSPReg9D ; - mov [DSPMem+09Dh],al - ret - -NEWSYM WDSPReg9E ; - mov [DSPMem+09Eh],al - ret - -NEWSYM WDSPReg9F ; - mov [DSPMem+09Fh],al - ret - -NEWSYM WDSPRegA0 ; - mov [DSPMem+0A0h],al - ret - -NEWSYM WDSPRegA1 ; - mov [DSPMem+0A1h],al - ret - -NEWSYM WDSPRegA2 ; - mov [DSPMem+0A2h],al - ret - -NEWSYM WDSPRegA3 ; - mov [DSPMem+0A3h],al - ret - -NEWSYM WDSPRegA4 ; - mov [DSPMem+0A4h],al - ret - -NEWSYM WDSPRegA5 ; - mov [DSPMem+0A5h],al - ret - -NEWSYM WDSPRegA6 ; - mov [DSPMem+0A6h],al - ret - -NEWSYM WDSPRegA7 ; - mov [DSPMem+0A7h],al - ret - -NEWSYM WDSPRegA8 ; - mov [DSPMem+0A8h],al - ret - -NEWSYM WDSPRegA9 ; - mov [DSPMem+0A9h],al - ret - -NEWSYM WDSPRegAA ; - mov [DSPMem+0AAh],al - ret - -NEWSYM WDSPRegAB ; - mov [DSPMem+0ABh],al - ret - -NEWSYM WDSPRegAC ; - mov [DSPMem+0ACh],al - ret - -NEWSYM WDSPRegAD ; - mov [DSPMem+0ADh],al - ret - -NEWSYM WDSPRegAE ; - mov [DSPMem+0AEh],al - ret - -NEWSYM WDSPRegAF ; - mov [DSPMem+0AFh],al - ret - -NEWSYM WDSPRegB0 ; - mov [DSPMem+0B0h],al - ret - -NEWSYM WDSPRegB1 ; - mov [DSPMem+0B1h],al - ret - -NEWSYM WDSPRegB2 ; - mov [DSPMem+0B2h],al - ret - -NEWSYM WDSPRegB3 ; - mov [DSPMem+0B3h],al - ret - -NEWSYM WDSPRegB4 ; - mov [DSPMem+0B4h],al - ret - -NEWSYM WDSPRegB5 ; - mov [DSPMem+0B5h],al - ret - -NEWSYM WDSPRegB6 ; - mov [DSPMem+0B6h],al - ret - -NEWSYM WDSPRegB7 ; - mov [DSPMem+0B7h],al - ret - -NEWSYM WDSPRegB8 ; - mov [DSPMem+0B8h],al - ret - -NEWSYM WDSPRegB9 ; - mov [DSPMem+0B9h],al - ret - -NEWSYM WDSPRegBA ; - mov [DSPMem+0BAh],al - ret - -NEWSYM WDSPRegBB ; - mov [DSPMem+0BBh],al - ret - -NEWSYM WDSPRegBC ; - mov [DSPMem+0BCh],al - ret - -NEWSYM WDSPRegBD ; - mov [DSPMem+0BDh],al - ret - -NEWSYM WDSPRegBE ; - mov [DSPMem+0BEh],al - ret - -NEWSYM WDSPRegBF ; - mov [DSPMem+0BFh],al - ret - -NEWSYM WDSPRegC0 ; - mov [DSPMem+0C0h],al - ret - -NEWSYM WDSPRegC1 ; - mov [DSPMem+0C1h],al - ret - -NEWSYM WDSPRegC2 ; - mov [DSPMem+0C2h],al - ret - -NEWSYM WDSPRegC3 ; - mov [DSPMem+0C3h],al - ret - -NEWSYM WDSPRegC4 ; - mov [DSPMem+0C4h],al - ret - -NEWSYM WDSPRegC5 ; - mov [DSPMem+0C5h],al - ret - -NEWSYM WDSPRegC6 ; - mov [DSPMem+0C6h],al - ret - -NEWSYM WDSPRegC7 ; - mov [DSPMem+0C7h],al - ret - -NEWSYM WDSPRegC8 ; - mov [DSPMem+0C8h],al - ret - -NEWSYM WDSPRegC9 ; - mov [DSPMem+0C9h],al - ret - -NEWSYM WDSPRegCA ; - mov [DSPMem+0CAh],al - ret - -NEWSYM WDSPRegCB ; - mov [DSPMem+0CBh],al - ret - -NEWSYM WDSPRegCC ; - mov [DSPMem+0CCh],al - ret - -NEWSYM WDSPRegCD ; - mov [DSPMem+0CDh],al - ret - -NEWSYM WDSPRegCE ; - mov [DSPMem+0CEh],al - ret - -NEWSYM WDSPRegCF ; - mov [DSPMem+0CFh],al - ret - -NEWSYM WDSPRegD0 ; - mov [DSPMem+0D0h],al - ret - -NEWSYM WDSPRegD1 ; - mov [DSPMem+0D1h],al - ret - -NEWSYM WDSPRegD2 ; - mov [DSPMem+0D2h],al - ret - -NEWSYM WDSPRegD3 ; - mov [DSPMem+0D3h],al - ret - -NEWSYM WDSPRegD4 ; - mov [DSPMem+0D4h],al - ret - -NEWSYM WDSPRegD5 ; - mov [DSPMem+0D5h],al - ret - -NEWSYM WDSPRegD6 ; - mov [DSPMem+0D6h],al - ret - -NEWSYM WDSPRegD7 ; - mov [DSPMem+0D7h],al - ret - -NEWSYM WDSPRegD8 ; - mov [DSPMem+0D8h],al - ret - -NEWSYM WDSPRegD9 ; - mov [DSPMem+0D9h],al - ret - -NEWSYM WDSPRegDA ; - mov [DSPMem+0DAh],al - ret - -NEWSYM WDSPRegDB ; - mov [DSPMem+0DBh],al - ret - -NEWSYM WDSPRegDC ; - mov [DSPMem+0DCh],al - ret - -NEWSYM WDSPRegDD ; - mov [DSPMem+0DDh],al - ret - -NEWSYM WDSPRegDE ; - mov [DSPMem+0DEh],al - ret - -NEWSYM WDSPRegDF ; - mov [DSPMem+0DFh],al - ret - -NEWSYM WDSPRegE0 ; - mov [DSPMem+0E0h],al - ret - -NEWSYM WDSPRegE1 ; - mov [DSPMem+0E1h],al - ret - -NEWSYM WDSPRegE2 ; - mov [DSPMem+0E2h],al - ret - -NEWSYM WDSPRegE3 ; - mov [DSPMem+0E3h],al - ret - -NEWSYM WDSPRegE4 ; - mov [DSPMem+0E4h],al - ret - -NEWSYM WDSPRegE5 ; - mov [DSPMem+0E5h],al - ret - -NEWSYM WDSPRegE6 ; - mov [DSPMem+0E6h],al - ret - -NEWSYM WDSPRegE7 ; - mov [DSPMem+0E7h],al - ret - -NEWSYM WDSPRegE8 ; - mov [DSPMem+0E8h],al - ret - -NEWSYM WDSPRegE9 ; - mov [DSPMem+0E9h],al - ret - -NEWSYM WDSPRegEA ; - mov [DSPMem+0EAh],al - ret - -NEWSYM WDSPRegEB ; - mov [DSPMem+0EBh],al - ret - -NEWSYM WDSPRegEC ; - mov [DSPMem+0ECh],al - ret - -NEWSYM WDSPRegED ; - mov [DSPMem+0EDh],al - ret - -NEWSYM WDSPRegEE ; - mov [DSPMem+0EEh],al - ret - -NEWSYM WDSPRegEF ; - mov [DSPMem+0EFh],al - ret - -NEWSYM WDSPRegF0 ; - mov [DSPMem+0F0h],al - ret - -NEWSYM WDSPRegF1 ; - mov [DSPMem+0F1h],al - ret - -NEWSYM WDSPRegF2 ; - mov [DSPMem+0F2h],al - ret - -NEWSYM WDSPRegF3 ; - mov [DSPMem+0F3h],al - ret - -NEWSYM WDSPRegF4 ; - mov [DSPMem+0F4h],al - ret - -NEWSYM WDSPRegF5 ; - mov [DSPMem+0F5h],al - ret - -NEWSYM WDSPRegF6 ; - mov [DSPMem+0F6h],al - ret - -NEWSYM WDSPRegF7 ; - mov [DSPMem+0F7h],al - ret - -NEWSYM WDSPRegF8 ; - mov [DSPMem+0F8h],al - ret - -NEWSYM WDSPRegF9 ; - mov [DSPMem+0F9h],al - ret - -NEWSYM WDSPRegFA ; - mov [DSPMem+0FAh],al - ret - -NEWSYM WDSPRegFB ; - mov [DSPMem+0FBh],al - ret - -NEWSYM WDSPRegFC ; - mov [DSPMem+0FCh],al - ret - -NEWSYM WDSPRegFD ; - mov [DSPMem+0FDh],al - ret - -NEWSYM WDSPRegFE ; - mov [DSPMem+0FEh],al - ret - -NEWSYM WDSPRegFF ; - mov [DSPMem+0FFh],al - ret - - diff --git a/tools/zsnes/src/cpu/dspproc.asm b/tools/zsnes/src/cpu/dspproc.asm deleted file mode 100644 index 167864d..0000000 --- a/tools/zsnes/src/cpu/dspproc.asm +++ /dev/null @@ -1,5203 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 SPCRAM,spcPCRam,spcRamDP,spcS,spcX,RevStereo -EXTSYM Invalidopcode,RSPCRegF0,RSPCRegF1,RSPCRegF2,RSPCRegF3 -EXTSYM RSPCRegF4,RSPCRegF5,RSPCRegF6,RSPCRegF7,RSPCRegF8,RSPCRegF9 -EXTSYM RSPCRegFA,RSPCRegFB,RSPCRegFC,RSPCRegFD,RSPCRegFE,RSPCRegFF -EXTSYM SPCRegF0,SPCRegF1,SPCRegF2,SPCRegF3,SPCRegF4,SPCRegF5,SPCRegF6 -EXTSYM SPCRegF7,SPCRegF8,SPCRegF9,SPCRegFA,SPCRegFB,SPCRegFC,SPCRegFD -EXTSYM SPCRegFE,SPCRegFF,VolumeConvTable,dspRptr,dspWptr,opcjmptab -EXTSYM Op00,Op01,Op02,Op03,Op04,Op05,Op06,Op07,Op08,Op09,Op0A,Op0B,Op0C,Op0D -EXTSYM Op0E,Op0F,Op10,Op11,Op12,Op13,Op14,Op15,Op16,Op17,Op18,Op19,Op1A,Op1B -EXTSYM Op1C,Op1D,Op1E,Op1F,Op20,Op21,Op22,Op23,Op24,Op25,Op26,Op27,Op28,Op29 -EXTSYM Op2A,Op2B,Op2C,Op2D,Op2E,Op2F,Op30,Op31,Op32,Op33,Op34,Op35,Op36,Op37 -EXTSYM Op38,Op39,Op3A,Op3B,Op3C,Op3D,Op3E,Op3F,Op40,Op41,Op42,Op43,Op44,Op45 -EXTSYM Op46,Op47,Op48,Op49,Op4A,Op4B,Op4C,Op4D,Op4E,Op4F,Op50,Op51,Op52,Op53 -EXTSYM Op54,Op55,Op56,Op57,Op58,Op59,Op5A,Op5B,Op5C,Op5D,Op5E,Op5F,Op60,Op61 -EXTSYM Op62,Op63,Op64,Op65,Op66,Op67,Op68,Op69,Op6A,Op6B,Op6C,Op6D,Op6E,Op6F -EXTSYM Op70,Op71,Op72,Op73,Op74,Op75,Op76,Op77,Op78,Op79,Op7A,Op7B,Op7C,Op7D -EXTSYM Op7E,Op7F,Op80,Op81,Op82,Op83,Op84,Op85,Op86,Op87,Op88,Op89,Op8A,Op8B -EXTSYM Op8C,Op8D,Op8E,Op8F,Op90,Op91,Op92,Op93,Op94,Op95,Op96,Op97,Op98,Op99 -EXTSYM Op9A,Op9B,Op9C,Op9D,Op9E,Op9F,OpA0,OpA1,OpA2,OpA3,OpA4,OpA5,OpA6,OpA7 -EXTSYM OpA8,OpA9,OpAA,OpAB,OpAC,OpAD,OpAE,OpAF,OpB0,OpB1,OpB2,OpB3,OpB4,OpB5 -EXTSYM OpB6,OpB7,OpB8,OpB9,OpBA,OpBB,OpBC,OpBD,OpBE,OpBF,OpC0,OpC1,OpC2,OpC3 -EXTSYM OpC4,OpC5,OpC6,OpC7,OpC8,OpC9,OpCA,OpCB,OpCC,OpCD,OpCE,OpCF,OpD0,OpD1 -EXTSYM OpD2,OpD3,OpD4,OpD5,OpD6,OpD7,OpD8,OpD9,OpDA,OpDB,OpDC,OpDD,OpDE,OpDF -EXTSYM OpE0,OpE1,OpE2,OpE3,OpE4,OpE5,OpE6,OpE7,OpE8,OpE9,OpEA,OpEB,OpEC,OpED -EXTSYM OpEE,OpEF,OpF0,OpF1,OpF2,OpF3,OpF4,OpF5,OpF6,OpF7,OpF8,OpF9,OpFA,OpFB -EXTSYM OpFC,OpFD,OpFE,OpFF -EXTSYM RDSPReg00,RDSPReg01,RDSPReg02,RDSPReg03,RDSPReg04,RDSPReg05,RDSPReg06 -EXTSYM RDSPReg07,RDSPReg08,RDSPReg09,RDSPReg0A,RDSPReg0B,RDSPReg0C,RDSPReg0D -EXTSYM RDSPReg0E,RDSPReg0F,RDSPReg10,RDSPReg11,RDSPReg12,RDSPReg13,RDSPReg14 -EXTSYM RDSPReg15,RDSPReg16,RDSPReg17,RDSPReg18,RDSPReg19,RDSPReg1A,RDSPReg1B -EXTSYM RDSPReg1C,RDSPReg1D,RDSPReg1E,RDSPReg1F,RDSPReg20,RDSPReg21,RDSPReg22 -EXTSYM RDSPReg23,RDSPReg24,RDSPReg25,RDSPReg26,RDSPReg27,RDSPReg28,RDSPReg29 -EXTSYM RDSPReg2A,RDSPReg2B,RDSPReg2C,RDSPReg2D,RDSPReg2E,RDSPReg2F,RDSPReg30 -EXTSYM RDSPReg31,RDSPReg32,RDSPReg33,RDSPReg34,RDSPReg35,RDSPReg36,RDSPReg37 -EXTSYM RDSPReg38,RDSPReg39,RDSPReg3A,RDSPReg3B,RDSPReg3C,RDSPReg3D,RDSPReg3E -EXTSYM RDSPReg3F,RDSPReg40,RDSPReg41,RDSPReg42,RDSPReg43,RDSPReg44,RDSPReg45 -EXTSYM RDSPReg46,RDSPReg47,RDSPReg48,RDSPReg49,RDSPReg4A,RDSPReg4B,RDSPReg4C -EXTSYM RDSPReg4D,RDSPReg4E,RDSPReg4F,RDSPReg50,RDSPReg51,RDSPReg52,RDSPReg53 -EXTSYM RDSPReg54,RDSPReg55,RDSPReg56,RDSPReg57,RDSPReg58,RDSPReg59,RDSPReg5A -EXTSYM RDSPReg5B,RDSPReg5C,RDSPReg5D,RDSPReg5E,RDSPReg5F,RDSPReg60,RDSPReg61 -EXTSYM RDSPReg62,RDSPReg63,RDSPReg64,RDSPReg65,RDSPReg66,RDSPReg67,RDSPReg68 -EXTSYM RDSPReg69,RDSPReg6A,RDSPReg6B,RDSPReg6C,RDSPReg6D,RDSPReg6E,RDSPReg6F -EXTSYM RDSPReg70,RDSPReg71,RDSPReg72,RDSPReg73,RDSPReg74,RDSPReg75,RDSPReg76 -EXTSYM RDSPReg77,RDSPReg78,RDSPReg79,RDSPReg7A,RDSPReg7B,RDSPReg7C,RDSPReg7D -EXTSYM RDSPReg7E,RDSPReg7F,RDSPReg80,RDSPReg81,RDSPReg82,RDSPReg83,RDSPReg84 -EXTSYM RDSPReg85,RDSPReg86,RDSPReg87,RDSPReg88,RDSPReg89,RDSPReg8A,RDSPReg8B -EXTSYM RDSPReg8C,RDSPReg8D,RDSPReg8E,RDSPReg8F,RDSPReg90,RDSPReg91,RDSPReg92 -EXTSYM RDSPReg93,RDSPReg94,RDSPReg95,RDSPReg96,RDSPReg97,RDSPReg98,RDSPReg99 -EXTSYM RDSPReg9A,RDSPReg9B,RDSPReg9C,RDSPReg9D,RDSPReg9E,RDSPReg9F,RDSPRegA0 -EXTSYM RDSPRegA1,RDSPRegA2,RDSPRegA3,RDSPRegA4,RDSPRegA5,RDSPRegA6,RDSPRegA7 -EXTSYM RDSPRegA8,RDSPRegA9,RDSPRegAA,RDSPRegAB,RDSPRegAC,RDSPRegAD,RDSPRegAE -EXTSYM RDSPRegAF,RDSPRegB0,RDSPRegB1,RDSPRegB2,RDSPRegB3,RDSPRegB4,RDSPRegB5 -EXTSYM RDSPRegB6,RDSPRegB7,RDSPRegB8,RDSPRegB9,RDSPRegBA,RDSPRegBB,RDSPRegBC -EXTSYM RDSPRegBD,RDSPRegBE,RDSPRegBF,RDSPRegC0,RDSPRegC1,RDSPRegC2,RDSPRegC3 -EXTSYM RDSPRegC4,RDSPRegC5,RDSPRegC6,RDSPRegC7,RDSPRegC8,RDSPRegC9,RDSPRegCA -EXTSYM RDSPRegCB,RDSPRegCC,RDSPRegCD,RDSPRegCE,RDSPRegCF,RDSPRegD0,RDSPRegD1 -EXTSYM RDSPRegD2,RDSPRegD3,RDSPRegD4,RDSPRegD5,RDSPRegD6,RDSPRegD7,RDSPRegD8 -EXTSYM RDSPRegD9,RDSPRegDA,RDSPRegDB,RDSPRegDC,RDSPRegDD,RDSPRegDE,RDSPRegDF -EXTSYM RDSPRegE0,RDSPRegE1,RDSPRegE2,RDSPRegE3,RDSPRegE4,RDSPRegE5,RDSPRegE6 -EXTSYM RDSPRegE7,RDSPRegE8,RDSPRegE9,RDSPRegEA,RDSPRegEB,RDSPRegEC,RDSPRegED -EXTSYM RDSPRegEE,RDSPRegEF,RDSPRegF0,RDSPRegF1,RDSPRegF2,RDSPRegF3,RDSPRegF4 -EXTSYM RDSPRegF5,RDSPRegF6,RDSPRegF7,RDSPRegF8,RDSPRegF9,RDSPRegFA,RDSPRegFB -EXTSYM RDSPRegFC,RDSPRegFD,RDSPRegFE,RDSPRegFF -EXTSYM WDSPReg00,WDSPReg01,WDSPReg02,WDSPReg03,WDSPReg04,WDSPReg05,WDSPReg06 -EXTSYM WDSPReg07,WDSPReg08,WDSPReg09,WDSPReg0A,WDSPReg0B,WDSPReg0C,WDSPReg0D -EXTSYM WDSPReg0E,WDSPReg0F,WDSPReg10,WDSPReg11,WDSPReg12,WDSPReg13,WDSPReg14 -EXTSYM WDSPReg15,WDSPReg16,WDSPReg17,WDSPReg18,WDSPReg19,WDSPReg1A,WDSPReg1B -EXTSYM WDSPReg1C,WDSPReg1D,WDSPReg1E,WDSPReg1F,WDSPReg20,WDSPReg21,WDSPReg22 -EXTSYM WDSPReg23,WDSPReg24,WDSPReg25,WDSPReg26,WDSPReg27,WDSPReg28,WDSPReg29 -EXTSYM WDSPReg2A,WDSPReg2B,WDSPReg2C,WDSPReg2D,WDSPReg2E,WDSPReg2F,WDSPReg30 -EXTSYM WDSPReg31,WDSPReg32,WDSPReg33,WDSPReg34,WDSPReg35,WDSPReg36,WDSPReg37 -EXTSYM WDSPReg38,WDSPReg39,WDSPReg3A,WDSPReg3B,WDSPReg3C,WDSPReg3D,WDSPReg3E -EXTSYM WDSPReg3F,WDSPReg40,WDSPReg41,WDSPReg42,WDSPReg43,WDSPReg44,WDSPReg45 -EXTSYM WDSPReg46,WDSPReg47,WDSPReg48,WDSPReg49,WDSPReg4A,WDSPReg4B,WDSPReg4C -EXTSYM WDSPReg4D,WDSPReg4E,WDSPReg4F,WDSPReg50,WDSPReg51,WDSPReg52,WDSPReg53 -EXTSYM WDSPReg54,WDSPReg55,WDSPReg56,WDSPReg57,WDSPReg58,WDSPReg59,WDSPReg5A -EXTSYM WDSPReg5B,WDSPReg5C,WDSPReg5D,WDSPReg5E,WDSPReg5F,WDSPReg60,WDSPReg61 -EXTSYM WDSPReg62,WDSPReg63,WDSPReg64,WDSPReg65,WDSPReg66,WDSPReg67,WDSPReg68 -EXTSYM WDSPReg69,WDSPReg6A,WDSPReg6B,WDSPReg6C,WDSPReg6D,WDSPReg6E,WDSPReg6F -EXTSYM WDSPReg70,WDSPReg71,WDSPReg72,WDSPReg73,WDSPReg74,WDSPReg75,WDSPReg76 -EXTSYM WDSPReg77,WDSPReg78,WDSPReg79,WDSPReg7A,WDSPReg7B,WDSPReg7C,WDSPReg7D -EXTSYM WDSPReg7E,WDSPReg7F,WDSPReg80,WDSPReg81,WDSPReg82,WDSPReg83,WDSPReg84 -EXTSYM WDSPReg85,WDSPReg86,WDSPReg87,WDSPReg88,WDSPReg89,WDSPReg8A,WDSPReg8B -EXTSYM WDSPReg8C,WDSPReg8D,WDSPReg8E,WDSPReg8F,WDSPReg90,WDSPReg91,WDSPReg92 -EXTSYM WDSPReg93,WDSPReg94,WDSPReg95,WDSPReg96,WDSPReg97,WDSPReg98,WDSPReg99 -EXTSYM WDSPReg9A,WDSPReg9B,WDSPReg9C,WDSPReg9D,WDSPReg9E,WDSPReg9F,WDSPRegA0 -EXTSYM WDSPRegA1,WDSPRegA2,WDSPRegA3,WDSPRegA4,WDSPRegA5,WDSPRegA6,WDSPRegA7 -EXTSYM WDSPRegA8,WDSPRegA9,WDSPRegAA,WDSPRegAB,WDSPRegAC,WDSPRegAD,WDSPRegAE -EXTSYM WDSPRegAF,WDSPRegB0,WDSPRegB1,WDSPRegB2,WDSPRegB3,WDSPRegB4,WDSPRegB5 -EXTSYM WDSPRegB6,WDSPRegB7,WDSPRegB8,WDSPRegB9,WDSPRegBA,WDSPRegBB,WDSPRegBC -EXTSYM WDSPRegBD,WDSPRegBE,WDSPRegBF,WDSPRegC0,WDSPRegC1,WDSPRegC2,WDSPRegC3 -EXTSYM WDSPRegC4,WDSPRegC5,WDSPRegC6,WDSPRegC7,WDSPRegC8,WDSPRegC9,WDSPRegCA -EXTSYM WDSPRegCB,WDSPRegCC,WDSPRegCD,WDSPRegCE,WDSPRegCF,WDSPRegD0,WDSPRegD1 -EXTSYM WDSPRegD2,WDSPRegD3,WDSPRegD4,WDSPRegD5,WDSPRegD6,WDSPRegD7,WDSPRegD8 -EXTSYM WDSPRegD9,WDSPRegDA,WDSPRegDB,WDSPRegDC,WDSPRegDD,WDSPRegDE,WDSPRegDF -EXTSYM WDSPRegE0,WDSPRegE1,WDSPRegE2,WDSPRegE3,WDSPRegE4,WDSPRegE5,WDSPRegE6 -EXTSYM WDSPRegE7,WDSPRegE8,WDSPRegE9,WDSPRegEA,WDSPRegEB,WDSPRegEC,WDSPRegED -EXTSYM WDSPRegEE,WDSPRegEF,WDSPRegF0,WDSPRegF1,WDSPRegF2,WDSPRegF3,WDSPRegF4 -EXTSYM WDSPRegF5,WDSPRegF6,WDSPRegF7,WDSPRegF8,WDSPRegF9,WDSPRegFA,WDSPRegFB -EXTSYM WDSPRegFC,WDSPRegFD,WDSPRegFE,WDSPRegFF -EXTSYM spcBuffera,DSPMem,SoundInterpType,NoiseData,Voice0Disable,EchoDis -EXTSYM Surround,echobuf,ENVDisable,LowPassFilterType,EMUPause,AudioLogging -EXTSYM MMXSupport,StereoSound,SoundQuality - -%ifdef __MSDOS__ -EXTSYM SB_alloc_dma,SB_quality_limiter,vibracard -%endif - -SECTION .data -NEWSYM SBHDMA, db 0 ; stupid legacy code ... - -SECTION .bss - -; How the sound code works : -; Clear memory at $01 to $EF -; Store $BBAA into $2140 -; Wait for $CC in $2142 -; Goto FFEF: -;FFD6: -; Move $2140 into Y -; Repeat until Y = 0 -;FFDA: -; If $2140 <> 0, then jump to FFE9 -; Move $2141 into A -; Move Y into $2140 -; Move A into [$00]+Y -; Increment Y -; Jump to FFDA if Y <> 0 -; Increment value at $01 -;FFE9: -; If plus flag set, goto FFDA -; If (Y-$2140) <> 0, goto FFE9 -;FFEF: -; Move 2142 into YA -; Move YA into Address $00 -; Move A into 2140 -; Move Y into A -; Move A into X -; If A is not zero, goto FFD6 -; Jump to Address [0000] - -DSPInterP resw 1024 - -section .data -ALIGN32 - -Gaussian: - dw 1305,1305,1304,1304,1304,1304,1304,1303 - dw 1303,1303,1302,1302,1301,1300,1300,1299 - dw 1298,1297,1297,1296,1295,1294,1293,1292 - dw 1291,1290,1288,1287,1286,1284,1283,1282 - dw 1280,1279,1277,1275,1274,1272,1270,1269 - dw 1267,1265,1263,1261,1259,1257,1255,1253 - dw 1251,1248,1246,1244,1241,1239,1237,1234 - dw 1232,1229,1227,1224,1221,1219,1216,1213 - dw 1210,1207,1205,1202,1199,1196,1193,1190 - dw 1186,1183,1180,1177,1174,1170,1167,1164 - dw 1160,1157,1153,1150,1146,1143,1139,1136 - dw 1132,1128,1125,1121,1117,1113,1109,1106 - dw 1102,1098,1094,1090,1086,1082,1078,1074 - dw 1070,1066,1061,1057,1053,1049,1045,1040 - dw 1036,1032,1027,1023,1019,1014,1010,1005 - dw 1001, 997, 992, 988, 983, 978, 974, 969 - dw 965, 960, 955, 951, 946, 941, 937, 932 - dw 927, 923, 918, 913, 908, 904, 899, 894 - dw 889, 884, 880, 875, 870, 865, 860, 855 - dw 851, 846, 841, 836, 831, 826, 821, 816 - dw 811, 806, 802, 797, 792, 787, 782, 777 - dw 772, 767, 762, 757, 752, 747, 742, 737 - dw 732, 728, 723, 718, 713, 708, 703, 698 - dw 693, 688, 683, 678, 674, 669, 664, 659 - dw 654, 649, 644, 640, 635, 630, 625, 620 - dw 615, 611, 606, 601, 596, 592, 587, 582 - dw 577, 573, 568, 563, 559, 554, 550, 545 - dw 540, 536, 531, 527, 522, 517, 513, 508 - dw 504, 499, 495, 491, 486, 482, 477, 473 - dw 469, 464, 460, 456, 451, 447, 443, 439 - dw 434, 430, 426, 422, 418, 414, 410, 405 - dw 401, 397, 393, 389, 385, 381, 378, 374 - dw 370, 366, 362, 358, 354, 351, 347, 343 - dw 339, 336, 332, 328, 325, 321, 318, 314 - dw 311, 307, 304, 300, 297, 293, 290, 286 - dw 283, 280, 276, 273, 270, 267, 263, 260 - dw 257, 254, 251, 248, 245, 242, 239, 236 - dw 233, 230, 227, 224, 221, 218, 215, 212 - dw 210, 207, 204, 201, 199, 196, 193, 191 - dw 188, 186, 183, 180, 178, 175, 173, 171 - dw 168, 166, 163, 161, 159, 156, 154, 152 - dw 150, 147, 145, 143, 141, 139, 137, 134 - dw 132, 130, 128, 126, 124, 122, 120, 118 - dw 117, 115, 113, 111, 109, 107, 106, 104 - dw 102, 100, 99, 97, 95, 94, 92, 90 - dw 89, 87, 86, 84, 83, 81, 80, 78 - dw 77, 76, 74, 73, 71, 70, 69, 67 - dw 66, 65, 64, 62, 61, 60, 59, 58 - dw 56, 55, 54, 53, 52, 51, 50, 49 - dw 48, 47, 46, 45, 44, 43, 42, 41 - dw 40, 39, 38, 37, 36, 36, 35, 34 - dw 33, 32, 32, 31, 30, 29, 29, 28 - dw 27, 27, 26, 25, 24, 24, 23, 23 - dw 22, 21, 21, 20, 20, 19, 19, 18 - dw 17, 17, 16, 16, 15, 15, 15, 14 - dw 14, 13, 13, 12, 12, 11, 11, 11 - dw 10, 10, 10, 9, 9, 9, 8, 8 - dw 8, 7, 7, 7, 6, 6, 6, 6 - dw 5, 5, 5, 5, 4, 4, 4, 4 - dw 4, 3, 3, 3, 3, 3, 2, 2 - dw 2, 2, 2, 2, 2, 1, 1, 1 - dw 1, 1, 1, 1, 1, 1, 1, 1 - dw 0, 0, 0, 0, 0, 0, 0, 0 - dw 0, 0, 0, 0, 0, 0, 0, 0 - dw 0, 0, 0, 0, 0, 0, 0, 0 - dw 0, 0, 0, 0, 0, 0, 0, 0 - dw 0, 0, 0, 0, 0, 0, 0, 0 - dw 0, 0, 0, 0, 0, 0, 0, 0 - dw 0, 0, 0, 0, 0, 0, 0, 0 - dw 0, 0, 0, 0, 0, 0, 0, 0 - -CubicSpline: - dw 0, 0, 0, 0, 0, 0, 0, 0 - dw 0, -1, -1, -1, -2, -2, -2, -3 - dw -3, -4, -4, -5, -5, -6, -6, -7 - dw -8, -8, -9, -10, -10, -11, -12, -13 - dw -14, -14, -15, -16, -17, -18, -19, -20 - dw -21, -22, -23, -24, -25, -26, -27, -28 - dw -29, -30, -31, -32, -33, -34, -35, -37 - dw -38, -39, -40, -41, -43, -44, -45, -46 - dw -48, -49, -50, -51, -53, -54, -55, -56 - dw -58, -59, -60, -62, -63, -64, -66, -67 - dw -68, -70, -71, -72, -74, -75, -76, -78 - dw -79, -80, -82, -83, -84, -86, -87, -88 - dw -90, -91, -92, -93, -95, -96, -97, -99 - dw -100,-101,-102,-104,-105,-106,-107,-109 - dw -110,-111,-112,-113,-114,-116,-117,-118 - dw -119,-120,-121,-122,-123,-124,-125,-126 - dw -128,-128,-129,-130,-131,-132,-133,-134 - dw -135,-136,-137,-137,-138,-139,-140,-141 - dw -141,-142,-143,-143,-144,-144,-145,-146 - dw -146,-147,-147,-148,-148,-148,-149,-149 - dw -150,-150,-150,-150,-151,-151,-151,-151 - dw -151,-151,-151,-151,-151,-151,-151,-151 - dw -151,-151,-150,-150,-150,-149,-149,-149 - dw -148,-148,-147,-147,-146,-146,-145,-144 - dw -144,-143,-142,-141,-140,-139,-138,-137 - dw -136,-135,-134,-133,-132,-130,-129,-128 - dw -126,-125,-123,-122,-120,-119,-117,-115 - dw -113,-112,-110,-108,-106,-104,-102,-100 - dw -98, -95, -93, -91, -88, -86, -83, -81 - dw -78, -76, -73, -70, -67, -65, -62, -59 - dw -56, -53, -50, -46, -43, -40, -36, -33 - dw -30, -26, -22, -19, -15, -11, -7, -3 - dw 0, 4, 8, 12, 16, 21, 26, 30 - dw 35, 40, 46, 51, 56, 62, 67, 73 - dw 79, 85, 91, 97, 103, 109, 116, 122 - dw 129, 136, 143, 149, 156, 164, 171, 178 - dw 186, 193, 201, 208, 216, 224, 232, 240 - dw 248, 256, 264, 273, 281, 289, 298, 307 - dw 315, 324, 333, 342, 351, 360, 369, 378 - dw 387, 397, 406, 415, 425, 435, 444, 454 - dw 464, 473, 483, 493, 503, 513, 523, 533 - dw 543, 553, 564, 574, 584, 594, 605, 615 - dw 626, 636, 647, 657, 668, 679, 689, 700 - dw 711, 721, 732, 743, 754, 765, 776, 787 - dw 798, 808, 819, 830, 841, 852, 863, 874 - dw 886, 897, 908, 919, 930, 941, 952, 963 - dw 974, 985, 996,1008,1019,1030,1041,1052 - dw 1063,1074,1085,1096,1107,1118,1129,1140 - dw 1152,1162,1173,1184,1195,1206,1217,1228 - dw 1239,1250,1261,1271,1282,1293,1303,1314 - dw 1325,1335,1346,1356,1367,1377,1388,1398 - dw 1408,1419,1429,1439,1449,1459,1470,1480 - dw 1490,1499,1509,1519,1529,1539,1548,1558 - dw 1567,1577,1586,1595,1605,1614,1623,1632 - dw 1641,1650,1659,1668,1677,1685,1694,1702 - dw 1711,1719,1727,1736,1744,1752,1760,1768 - dw 1776,1783,1791,1798,1806,1813,1820,1828 - dw 1835,1842,1849,1855,1862,1869,1875,1881 - dw 1888,1894,1900,1906,1912,1918,1923,1929 - dw 1934,1940,1945,1950,1955,1960,1964,1969 - dw 1974,1978,1982,1986,1990,1994,1998,2002 - dw 2005,2008,2012,2015,2018,2021,2023,2026 - dw 2028,2031,2033,2035,2037,2038,2040,2041 - dw 2043,2044,2045,2046,2046,2047,2047,2047 - - dw 2048,2047,2047,2047,2046,2046,2045,2044 - dw 2043,2041,2040,2038,2037,2035,2033,2031 - dw 2028,2026,2023,2021,2018,2015,2012,2008 - dw 2005,2002,1998,1994,1990,1986,1982,1978 - dw 1974,1969,1964,1960,1955,1950,1945,1940 - dw 1934,1929,1923,1918,1912,1906,1900,1894 - dw 1888,1881,1875,1869,1862,1855,1849,1842 - dw 1835,1828,1820,1813,1806,1798,1791,1783 - dw 1776,1768,1760,1752,1744,1736,1727,1719 - dw 1711,1702,1694,1685,1677,1668,1659,1650 - dw 1641,1632,1623,1614,1605,1595,1586,1577 - dw 1567,1558,1548,1539,1529,1519,1509,1499 - dw 1490,1480,1470,1459,1449,1439,1429,1419 - dw 1408,1398,1388,1377,1367,1356,1346,1335 - dw 1325,1314,1303,1293,1282,1271,1261,1250 - dw 1239,1228,1217,1206,1195,1184,1173,1162 - dw 1152,1140,1129,1118,1107,1096,1085,1074 - dw 1063,1052,1041,1030,1019,1008, 996, 985 - dw 974, 963, 952, 941, 930, 919, 908, 897 - dw 886, 874, 863, 852, 841, 830, 819, 808 - dw 798, 787, 776, 765, 754, 743, 732, 721 - dw 711, 700, 689, 679, 668, 657, 647, 636 - dw 626, 615, 605, 594, 584, 574, 564, 553 - dw 543, 533, 523, 513, 503, 493, 483, 473 - dw 464, 454, 444, 435, 425, 415, 406, 397 - dw 387, 378, 369, 360, 351, 342, 333, 324 - dw 315, 307, 298, 289, 281, 273, 264, 256 - dw 248, 240, 232, 224, 216, 208, 201, 193 - dw 186, 178, 171, 164, 156, 149, 143, 136 - dw 129, 122, 116, 109, 103, 97, 91, 85 - dw 79, 73, 67, 62, 56, 51, 46, 40 - dw 35, 30, 26, 21, 16, 12, 8, 4 - - dw 0, -3, -7, -11, -15, -19, -22, -26 - dw -30, -33, -36, -40, -43, -46, -50, -53 - dw -56, -59, -62, -65, -67, -70, -73, -76 - dw -78, -81, -83, -86, -88, -91, -93, -95 - dw -98,-100,-102,-104,-106,-108,-110,-112 - dw -113,-115,-117,-119,-120,-122,-123,-125 - dw -126,-128,-129,-130,-132,-133,-134,-135 - dw -136,-137,-138,-139,-140,-141,-142,-143 - dw -144,-144,-145,-146,-146,-147,-147,-148 - dw -148,-149,-149,-149,-150,-150,-150,-151 - dw -151,-151,-151,-151,-151,-151,-151,-151 - dw -151,-151,-151,-151,-151,-150,-150,-150 - dw -150,-149,-149,-148,-148,-148,-147,-147 - dw -146,-146,-145,-144,-144,-143,-143,-142 - dw -141,-141,-140,-139,-138,-137,-137,-136 - dw -135,-134,-133,-132,-131,-130,-129,-128 - dw -128,-126,-125,-124,-123,-122,-121,-120 - dw -119,-118,-117,-116,-114,-113,-112,-111 - dw -110,-109,-107,-106,-105,-104,-102,-101 - dw -100, -99, -97, -96, -95, -93, -92, -91 - dw -90, -88, -87, -86, -84, -83, -82, -80 - dw -79, -78, -76, -75, -74, -72, -71, -70 - dw -68, -67, -66, -64, -63, -62, -60, -59 - dw -58, -56, -55, -54, -53, -51, -50, -49 - dw -48, -46, -45, -44, -43, -41, -40, -39 - dw -38, -37, -35, -34, -33, -32, -31, -30 - dw -29, -28, -27, -26, -25, -24, -23, -22 - dw -21, -20, -19, -18, -17, -16, -15, -14 - dw -14, -13, -12, -11, -10, -10, -9, -8 - dw -8, -7, -6, -6, -5, -5, -4, -4 - dw -3, -3, -2, -2, -2, -1, -1, -1 - dw 0, 0, 0, 0, 0, 0, 0, 0 - -%include "cpu/firtable.inc" - -SECTION .bss - -NEWSYM spcWptr, resd 16 ; SPC Write pointers (point to their own functions) -NEWSYM spcRptr, resd 16 ; SPC Read pointers (point to their own functions) - -SECTION .data -NEWSYM SBToSPC, dd 22050 -NEWSYM dspPAdj, dd 0 -NEWSYM NumBRRconv, dd 0 -NEWSYM BufferSizeB, dd 320 -NEWSYM BufferSizeW, dd 640 - -;TIME_CONSTANT = 256 - 1000000 / frequency - -NEWSYM BufferSize, dw 320, 320, 320, 500, 320, 400, 400 -NEWSYM BufferSizes, dw 320, 320, 500, 900, 400, 750, 750 -NEWSYM SoundSpeeds, db 131, 165, 211, 233, 193, 225, 235 ; 8khz,11khz,22khz,44khz -NEWSYM SoundSpeedt, db 193, 210, 233 ; 8khz,11khz,22khz -%ifdef __MSDOS__ -NEWSYM SBToSPCSpeeds, dd 8000,10989,22222,43478,15874,32258,48000 -NEWSYM SBToSPCSpeeds2, dd 8192,11289,22579,45158,16384,32768,48000 -%else -NEWSYM SBToSPCSpeeds, dd 8000,11025,22050,44100,16000,32000,48000 -%endif -NEWSYM NumofSPCBlock, dd 626,456,228,114,314,156,104 -NEWSYM SPCBlockNum, dd 0 -NEWSYM NoiseSpeeds, dd 1,16,21,25,31,42,50,63,83,100,125,167,200,250,333,400,500 - dd 667,800,1000,1333,1600,2000,2667,3200,4000,5333,6400,8000,10667,16000,32000 - -SECTION .text - -NEWSYM conv2speed -.next - mov eax,[edi] - mov ebx,[SBToSPC] - mul ebx - mov ebx,11025 - div ebx - mov [esi],eax - add esi,4 - add edi,4 - dec ecx - jnz .next - ret - -NEWSYM AdjustFrequency - xor ebx,ebx - mov ah,[MMXSupport] - mov al,[SoundInterpType] - or ah,ah - jnz .mmx - cmp byte[LowPassFilterType],3 - jb .nothq - mov byte[LowPassFilterType],0 -.nothq - cmp al,3 - jb .mmx - mov al,1 - mov [SoundInterpType],al -.mmx - or al,al - jz near .notgaussian - cmp al,2 - je near .cubicspline - ja near .fir_mmx - ; Copy from Gaussian to DSPInterP -%ifndef __MSDOS__ - ; this ifndef is needed the workaround the "snow" in the DOS port - ; used only for Gaussian though - test ah,ah - jne .gaussian_mmx -%endif - mov ebx,DSPInterP+1024 - mov edx,DSPInterP+1022 - mov esi,Gaussian - mov ecx,512 -.intrploop - movzx eax,word[esi] - mov [edx],ax - mov [ebx],ax - add ebx,2 - sub edx,2 - add esi,2 - dec ecx - jnz .intrploop - mov ebx, DSPInterpolate_4 - jmp .notgaussian -.gaussian_mmx - mov ebx,Gaussian - mov edx,Gaussian+510 - mov esi,DSPInterP - mov ecx,256 -.intrploopm - mov ax,[ebx+512] - mov [esi],ax - mov ax,[ebx] - mov [esi+2],ax - mov ax,[edx] - mov [esi+4],ax - mov ax,[edx+512] - mov [esi+6],ax - add ebx,2 - sub edx,2 - add esi,8 - dec ecx - jnz .intrploopm - mov ebx, DSPInterpolate_4_mmx - jmp .notgaussian -.cubicspline - ; Copy from CubicSpline to DSPInterP - test ah,ah - jne .cubic_mmx - mov ebx,CubicSpline - mov edx,DSPInterP - mov ecx,1024 -.intrploopb - movzx eax,word[ebx] - push ebx - mov bx,ax - sar bx,3 - sub ax,bx - pop ebx - mov [edx],ax - add ebx,2 - add edx,2 - dec ecx - jnz .intrploopb - mov ebx, DSPInterpolate_4 - jmp .notgaussian -.cubic_mmx - mov ebx,CubicSpline - mov esi,DSPInterP - mov ecx,256 -.intrploopmb - mov ax,[ebx+256*6] - mov dx,ax - sar dx,3 - sub ax,dx - mov [esi],ax - mov ax,[ebx+256*4] - mov dx,ax - sar dx,3 - sub ax,dx - mov [esi+2],ax - mov ax,[ebx+256*2] - mov dx,ax - sar dx,3 - sub ax,dx - mov [esi+4],ax - mov ax,[ebx] - mov dx,ax - sar dx,3 - sub ax,dx - mov [esi+6],ax - add ebx,2 - add esi,8 - dec ecx - jnz .intrploopmb - mov ebx, DSPInterpolate_4_mmx - jmp .notgaussian - -.fir_mmx - mov ebx, DSPInterpolate_8 - -.notgaussian - mov [DSPInterpolate],ebx -%ifdef __MSDOS__ - call SB_quality_limiter -%endif - mov eax,[SoundQuality] - mov ebx,[NumofSPCBlock+eax*4] - cmp byte[StereoSound],1 - jne .nostereo - shr ebx,1 -.nostereo - mov [SPCBlockNum],ebx -.next - - mov ecx,[SoundQuality] - mov eax,[SBToSPCSpeeds+ecx*4] -%ifdef __MSDOS__ - ; code for supporting vibra cards (coded by Peter Santing) - cmp byte[vibracard],1 - je .vibrafix - - cmp byte[SBHDMA],0 - je .not16bit -.vibrafix - mov eax,[SBToSPCSpeeds2+ecx*4] -.not16bit -%endif - mov [SBToSPC],eax - mov [SBRateb],eax - - xor edx,edx - mov ebx,eax - mov eax,32000 - shld edx,eax,20 - shl eax,20 - div ebx - mov [dspPAdj],eax - - ; Init all rates - mov esi,EchoRate - mov edi,EchoRateO - mov ecx,16 - call conv2speed - mov esi,AttackRate - mov edi,AttackRateO - mov ecx,16 - call conv2speed - mov esi,DecayRate - mov edi,DecayRateO - mov ecx,8 - call conv2speed - mov esi,SustainRate+4 - mov edi,SustainRateO+4 - mov ecx,31 - call conv2speed - mov esi,Increase+4 - mov edi,IncreaseO+4 - mov ecx,31 - call conv2speed - mov esi,IncreaseBent+4 - mov edi,IncreaseBentO+4 - mov ecx,31 - call conv2speed - mov esi,Decrease+4 - mov edi,DecreaseO+4 - mov ecx,31 - call conv2speed - mov esi,DecreaseRateExp+4 - mov edi,DecreaseRateExpO+4 - mov ecx,31 - call conv2speed - mov dword[Voice0Pitch],0xFFFEFFFE - mov dword[Voice0Pitch+4],0xFFFEFFFE - mov dword[Voice0Pitch+8],0xFFFEFFFE - mov dword[Voice0Pitch+12],0xFFFEFFFE - ret - -NEWSYM InitSPC - push eax - push ebx - push ecx - push edx - - call AdjustFrequency - - mov ecx,32768 - mov edx,32767 -.nextvol - mov al,dh - imul dl - shr ax,7 - movsx bx,al - mov [VolumeConvTable+edx*2],bx - dec edx - dec ecx - jnz .nextvol - - mov eax,SPCRAM - mov ebx,0EFh -.loop2 - mov byte[eax],0 - inc eax - dec ebx - jnz .loop2 - mov byte[spcX],0 - - xor eax,eax - xor ebx,ebx - mov ebp,SPCRAM - mov ax,0FFC0h - add ebp,eax - mov [spcPCRam],ebp - mov dword[spcS],1EFh - mov dword[spcRamDP],SPCRAM - - ; initialize all the SPC write registers - mov dword[spcWptr+0],SPCRegF0 - mov dword[spcWptr+4],SPCRegF1 - mov dword[spcWptr+8],SPCRegF2 - mov dword[spcWptr+12],SPCRegF3 - mov dword[spcWptr+16],SPCRegF4 - mov dword[spcWptr+20],SPCRegF5 - mov dword[spcWptr+24],SPCRegF6 - mov dword[spcWptr+28],SPCRegF7 - mov dword[spcWptr+32],SPCRegF8 - mov dword[spcWptr+36],SPCRegF9 - mov dword[spcWptr+40],SPCRegFA - mov dword[spcWptr+44],SPCRegFB - mov dword[spcWptr+48],SPCRegFC - mov dword[spcWptr+52],SPCRegFD - mov dword[spcWptr+56],SPCRegFE - mov dword[spcWptr+60],SPCRegFF - mov dword[spcRptr+0],RSPCRegF0 - mov dword[spcRptr+4],RSPCRegF1 - mov dword[spcRptr+8],RSPCRegF2 - mov dword[spcRptr+12],RSPCRegF3 - mov dword[spcRptr+16],RSPCRegF4 - mov dword[spcRptr+20],RSPCRegF5 - mov dword[spcRptr+24],RSPCRegF6 - mov dword[spcRptr+28],RSPCRegF7 - mov dword[spcRptr+32],RSPCRegF8 - mov dword[spcRptr+36],RSPCRegF9 - mov dword[spcRptr+40],RSPCRegFA - mov dword[spcRptr+44],RSPCRegFB - mov dword[spcRptr+48],RSPCRegFC - mov dword[spcRptr+52],RSPCRegFD - mov dword[spcRptr+56],RSPCRegFE - mov dword[spcRptr+60],RSPCRegFF - mov dword[dspRptr+00h],RDSPReg00 - mov dword[dspRptr+04h],RDSPReg01 - mov dword[dspRptr+08h],RDSPReg02 - mov dword[dspRptr+0Ch],RDSPReg03 - mov dword[dspRptr+010h],RDSPReg04 - mov dword[dspRptr+014h],RDSPReg05 - mov dword[dspRptr+018h],RDSPReg06 - mov dword[dspRptr+01Ch],RDSPReg07 - mov dword[dspRptr+020h],RDSPReg08 - mov dword[dspRptr+024h],RDSPReg09 - mov dword[dspRptr+028h],RDSPReg0A - mov dword[dspRptr+02Ch],RDSPReg0B - mov dword[dspRptr+030h],RDSPReg0C - mov dword[dspRptr+034h],RDSPReg0D - mov dword[dspRptr+038h],RDSPReg0E - mov dword[dspRptr+03Ch],RDSPReg0F - mov dword[dspRptr+040h],RDSPReg10 - mov dword[dspRptr+044h],RDSPReg11 - mov dword[dspRptr+048h],RDSPReg12 - mov dword[dspRptr+04Ch],RDSPReg13 - mov dword[dspRptr+050h],RDSPReg14 - mov dword[dspRptr+054h],RDSPReg15 - mov dword[dspRptr+058h],RDSPReg16 - mov dword[dspRptr+05Ch],RDSPReg17 - mov dword[dspRptr+060h],RDSPReg18 - mov dword[dspRptr+064h],RDSPReg19 - mov dword[dspRptr+068h],RDSPReg1A - mov dword[dspRptr+06Ch],RDSPReg1B - mov dword[dspRptr+070h],RDSPReg1C - mov dword[dspRptr+074h],RDSPReg1D - mov dword[dspRptr+078h],RDSPReg1E - mov dword[dspRptr+07Ch],RDSPReg1F - mov dword[dspRptr+080h],RDSPReg20 - mov dword[dspRptr+084h],RDSPReg21 - mov dword[dspRptr+088h],RDSPReg22 - mov dword[dspRptr+08Ch],RDSPReg23 - mov dword[dspRptr+090h],RDSPReg24 - mov dword[dspRptr+094h],RDSPReg25 - mov dword[dspRptr+098h],RDSPReg26 - mov dword[dspRptr+09Ch],RDSPReg27 - mov dword[dspRptr+0A0h],RDSPReg28 - mov dword[dspRptr+0A4h],RDSPReg29 - mov dword[dspRptr+0A8h],RDSPReg2A - mov dword[dspRptr+0ACh],RDSPReg2B - mov dword[dspRptr+0B0h],RDSPReg2C - mov dword[dspRptr+0B4h],RDSPReg2D - mov dword[dspRptr+0B8h],RDSPReg2E - mov dword[dspRptr+0BCh],RDSPReg2F - mov dword[dspRptr+0C0h],RDSPReg30 - mov dword[dspRptr+0C4h],RDSPReg31 - mov dword[dspRptr+0C8h],RDSPReg32 - mov dword[dspRptr+0CCh],RDSPReg33 - mov dword[dspRptr+0D0h],RDSPReg34 - mov dword[dspRptr+0D4h],RDSPReg35 - mov dword[dspRptr+0D8h],RDSPReg36 - mov dword[dspRptr+0DCh],RDSPReg37 - mov dword[dspRptr+0E0h],RDSPReg38 - mov dword[dspRptr+0E4h],RDSPReg39 - mov dword[dspRptr+0E8h],RDSPReg3A - mov dword[dspRptr+0ECh],RDSPReg3B - mov dword[dspRptr+0F0h],RDSPReg3C - mov dword[dspRptr+0F4h],RDSPReg3D - mov dword[dspRptr+0F8h],RDSPReg3E - mov dword[dspRptr+0FCh],RDSPReg3F - mov dword[dspRptr+0100h],RDSPReg40 - mov dword[dspRptr+0104h],RDSPReg41 - mov dword[dspRptr+0108h],RDSPReg42 - mov dword[dspRptr+010Ch],RDSPReg43 - mov dword[dspRptr+0110h],RDSPReg44 - mov dword[dspRptr+0114h],RDSPReg45 - mov dword[dspRptr+0118h],RDSPReg46 - mov dword[dspRptr+011Ch],RDSPReg47 - mov dword[dspRptr+0120h],RDSPReg48 - mov dword[dspRptr+0124h],RDSPReg49 - mov dword[dspRptr+0128h],RDSPReg4A - mov dword[dspRptr+012Ch],RDSPReg4B - mov dword[dspRptr+0130h],RDSPReg4C - mov dword[dspRptr+0134h],RDSPReg4D - mov dword[dspRptr+0138h],RDSPReg4E - mov dword[dspRptr+013Ch],RDSPReg4F - mov dword[dspRptr+0140h],RDSPReg50 - mov dword[dspRptr+0144h],RDSPReg51 - mov dword[dspRptr+0148h],RDSPReg52 - mov dword[dspRptr+014Ch],RDSPReg53 - mov dword[dspRptr+0150h],RDSPReg54 - mov dword[dspRptr+0154h],RDSPReg55 - mov dword[dspRptr+0158h],RDSPReg56 - mov dword[dspRptr+015Ch],RDSPReg57 - mov dword[dspRptr+0160h],RDSPReg58 - mov dword[dspRptr+0164h],RDSPReg59 - mov dword[dspRptr+0168h],RDSPReg5A - mov dword[dspRptr+016Ch],RDSPReg5B - mov dword[dspRptr+0170h],RDSPReg5C - mov dword[dspRptr+0174h],RDSPReg5D - mov dword[dspRptr+0178h],RDSPReg5E - mov dword[dspRptr+017Ch],RDSPReg5F - mov dword[dspRptr+0180h],RDSPReg60 - mov dword[dspRptr+0184h],RDSPReg61 - mov dword[dspRptr+0188h],RDSPReg62 - mov dword[dspRptr+018Ch],RDSPReg63 - mov dword[dspRptr+0190h],RDSPReg64 - mov dword[dspRptr+0194h],RDSPReg65 - mov dword[dspRptr+0198h],RDSPReg66 - mov dword[dspRptr+019Ch],RDSPReg67 - mov dword[dspRptr+01A0h],RDSPReg68 - mov dword[dspRptr+01A4h],RDSPReg69 - mov dword[dspRptr+01A8h],RDSPReg6A - mov dword[dspRptr+01ACh],RDSPReg6B - mov dword[dspRptr+01B0h],RDSPReg6C - mov dword[dspRptr+01B4h],RDSPReg6D - mov dword[dspRptr+01B8h],RDSPReg6E - mov dword[dspRptr+01BCh],RDSPReg6F - mov dword[dspRptr+01C0h],RDSPReg70 - mov dword[dspRptr+01C4h],RDSPReg71 - mov dword[dspRptr+01C8h],RDSPReg72 - mov dword[dspRptr+01CCh],RDSPReg73 - mov dword[dspRptr+01D0h],RDSPReg74 - mov dword[dspRptr+01D4h],RDSPReg75 - mov dword[dspRptr+01D8h],RDSPReg76 - mov dword[dspRptr+01DCh],RDSPReg77 - mov dword[dspRptr+01E0h],RDSPReg78 - mov dword[dspRptr+01E4h],RDSPReg79 - mov dword[dspRptr+01E8h],RDSPReg7A - mov dword[dspRptr+01ECh],RDSPReg7B - mov dword[dspRptr+01F0h],RDSPReg7C - mov dword[dspRptr+01F4h],RDSPReg7D - mov dword[dspRptr+01F8h],RDSPReg7E - mov dword[dspRptr+01FCh],RDSPReg7F - mov dword[dspRptr+0200h],RDSPReg80 - mov dword[dspRptr+0204h],RDSPReg81 - mov dword[dspRptr+0208h],RDSPReg82 - mov dword[dspRptr+020Ch],RDSPReg83 - mov dword[dspRptr+0210h],RDSPReg84 - mov dword[dspRptr+0214h],RDSPReg85 - mov dword[dspRptr+0218h],RDSPReg86 - mov dword[dspRptr+021Ch],RDSPReg87 - mov dword[dspRptr+0220h],RDSPReg88 - mov dword[dspRptr+0224h],RDSPReg89 - mov dword[dspRptr+0228h],RDSPReg8A - mov dword[dspRptr+022Ch],RDSPReg8B - mov dword[dspRptr+0230h],RDSPReg8C - mov dword[dspRptr+0234h],RDSPReg8D - mov dword[dspRptr+0238h],RDSPReg8E - mov dword[dspRptr+023Ch],RDSPReg8F - mov dword[dspRptr+0240h],RDSPReg90 - mov dword[dspRptr+0244h],RDSPReg91 - mov dword[dspRptr+0248h],RDSPReg92 - mov dword[dspRptr+024Ch],RDSPReg93 - mov dword[dspRptr+0250h],RDSPReg94 - mov dword[dspRptr+0254h],RDSPReg95 - mov dword[dspRptr+0258h],RDSPReg96 - mov dword[dspRptr+025Ch],RDSPReg97 - mov dword[dspRptr+0260h],RDSPReg98 - mov dword[dspRptr+0264h],RDSPReg99 - mov dword[dspRptr+0268h],RDSPReg9A - mov dword[dspRptr+026Ch],RDSPReg9B - mov dword[dspRptr+0270h],RDSPReg9C - mov dword[dspRptr+0274h],RDSPReg9D - mov dword[dspRptr+0278h],RDSPReg9E - mov dword[dspRptr+027Ch],RDSPReg9F - mov dword[dspRptr+0280h],RDSPRegA0 - mov dword[dspRptr+0284h],RDSPRegA1 - mov dword[dspRptr+0288h],RDSPRegA2 - mov dword[dspRptr+028Ch],RDSPRegA3 - mov dword[dspRptr+0290h],RDSPRegA4 - mov dword[dspRptr+0294h],RDSPRegA5 - mov dword[dspRptr+0298h],RDSPRegA6 - mov dword[dspRptr+029Ch],RDSPRegA7 - mov dword[dspRptr+02A0h],RDSPRegA8 - mov dword[dspRptr+02A4h],RDSPRegA9 - mov dword[dspRptr+02A8h],RDSPRegAA - mov dword[dspRptr+02ACh],RDSPRegAB - mov dword[dspRptr+02B0h],RDSPRegAC - mov dword[dspRptr+02B4h],RDSPRegAD - mov dword[dspRptr+02B8h],RDSPRegAE - mov dword[dspRptr+02BCh],RDSPRegAF - mov dword[dspRptr+02C0h],RDSPRegB0 - mov dword[dspRptr+02C4h],RDSPRegB1 - mov dword[dspRptr+02C8h],RDSPRegB2 - mov dword[dspRptr+02CCh],RDSPRegB3 - mov dword[dspRptr+02D0h],RDSPRegB4 - mov dword[dspRptr+02D4h],RDSPRegB5 - mov dword[dspRptr+02D8h],RDSPRegB6 - mov dword[dspRptr+02DCh],RDSPRegB7 - mov dword[dspRptr+02E0h],RDSPRegB8 - mov dword[dspRptr+02E4h],RDSPRegB9 - mov dword[dspRptr+02E8h],RDSPRegBA - mov dword[dspRptr+02ECh],RDSPRegBB - mov dword[dspRptr+02F0h],RDSPRegBC - mov dword[dspRptr+02F4h],RDSPRegBD - mov dword[dspRptr+02F8h],RDSPRegBE - mov dword[dspRptr+02FCh],RDSPRegBF - mov dword[dspRptr+0300h],RDSPRegC0 - mov dword[dspRptr+0304h],RDSPRegC1 - mov dword[dspRptr+0308h],RDSPRegC2 - mov dword[dspRptr+030Ch],RDSPRegC3 - mov dword[dspRptr+0310h],RDSPRegC4 - mov dword[dspRptr+0314h],RDSPRegC5 - mov dword[dspRptr+0318h],RDSPRegC6 - mov dword[dspRptr+031Ch],RDSPRegC7 - mov dword[dspRptr+0320h],RDSPRegC8 - mov dword[dspRptr+0324h],RDSPRegC9 - mov dword[dspRptr+0328h],RDSPRegCA - mov dword[dspRptr+032Ch],RDSPRegCB - mov dword[dspRptr+0330h],RDSPRegCC - mov dword[dspRptr+0334h],RDSPRegCD - mov dword[dspRptr+0338h],RDSPRegCE - mov dword[dspRptr+033Ch],RDSPRegCF - mov dword[dspRptr+0340h],RDSPRegD0 - mov dword[dspRptr+0344h],RDSPRegD1 - mov dword[dspRptr+0348h],RDSPRegD2 - mov dword[dspRptr+034Ch],RDSPRegD3 - mov dword[dspRptr+0350h],RDSPRegD4 - mov dword[dspRptr+0354h],RDSPRegD5 - mov dword[dspRptr+0358h],RDSPRegD6 - mov dword[dspRptr+035Ch],RDSPRegD7 - mov dword[dspRptr+0360h],RDSPRegD8 - mov dword[dspRptr+0364h],RDSPRegD9 - mov dword[dspRptr+0368h],RDSPRegDA - mov dword[dspRptr+036Ch],RDSPRegDB - mov dword[dspRptr+0370h],RDSPRegDC - mov dword[dspRptr+0374h],RDSPRegDD - mov dword[dspRptr+0378h],RDSPRegDE - mov dword[dspRptr+037Ch],RDSPRegDF - mov dword[dspRptr+0380h],RDSPRegE0 - mov dword[dspRptr+0384h],RDSPRegE1 - mov dword[dspRptr+0388h],RDSPRegE2 - mov dword[dspRptr+038Ch],RDSPRegE3 - mov dword[dspRptr+0390h],RDSPRegE4 - mov dword[dspRptr+0394h],RDSPRegE5 - mov dword[dspRptr+0398h],RDSPRegE6 - mov dword[dspRptr+039Ch],RDSPRegE7 - mov dword[dspRptr+03A0h],RDSPRegE8 - mov dword[dspRptr+03A4h],RDSPRegE9 - mov dword[dspRptr+03A8h],RDSPRegEA - mov dword[dspRptr+03ACh],RDSPRegEB - mov dword[dspRptr+03B0h],RDSPRegEC - mov dword[dspRptr+03B4h],RDSPRegED - mov dword[dspRptr+03B8h],RDSPRegEE - mov dword[dspRptr+03BCh],RDSPRegEF - mov dword[dspRptr+03C0h],RDSPRegF0 - mov dword[dspRptr+03C4h],RDSPRegF1 - mov dword[dspRptr+03C8h],RDSPRegF2 - mov dword[dspRptr+03CCh],RDSPRegF3 - mov dword[dspRptr+03D0h],RDSPRegF4 - mov dword[dspRptr+03D4h],RDSPRegF5 - mov dword[dspRptr+03D8h],RDSPRegF6 - mov dword[dspRptr+03DCh],RDSPRegF7 - mov dword[dspRptr+03E0h],RDSPRegF8 - mov dword[dspRptr+03E4h],RDSPRegF9 - mov dword[dspRptr+03E8h],RDSPRegFA - mov dword[dspRptr+03ECh],RDSPRegFB - mov dword[dspRptr+03F0h],RDSPRegFC - mov dword[dspRptr+03F4h],RDSPRegFD - mov dword[dspRptr+03F8h],RDSPRegFE - mov dword[dspRptr+03FCh],RDSPRegFF - - mov dword[dspWptr+00h],WDSPReg00 - mov dword[dspWptr+04h],WDSPReg01 - mov dword[dspWptr+08h],WDSPReg02 - mov dword[dspWptr+0Ch],WDSPReg03 - mov dword[dspWptr+010h],WDSPReg04 - mov dword[dspWptr+014h],WDSPReg05 - mov dword[dspWptr+018h],WDSPReg06 - mov dword[dspWptr+01Ch],WDSPReg07 - mov dword[dspWptr+020h],WDSPReg08 - mov dword[dspWptr+024h],WDSPReg09 - mov dword[dspWptr+028h],WDSPReg0A - mov dword[dspWptr+02Ch],WDSPReg0B - mov dword[dspWptr+030h],WDSPReg0C - mov dword[dspWptr+034h],WDSPReg0D - mov dword[dspWptr+038h],WDSPReg0E - mov dword[dspWptr+03Ch],WDSPReg0F - mov dword[dspWptr+040h],WDSPReg10 - mov dword[dspWptr+044h],WDSPReg11 - mov dword[dspWptr+048h],WDSPReg12 - mov dword[dspWptr+04Ch],WDSPReg13 - mov dword[dspWptr+050h],WDSPReg14 - mov dword[dspWptr+054h],WDSPReg15 - mov dword[dspWptr+058h],WDSPReg16 - mov dword[dspWptr+05Ch],WDSPReg17 - mov dword[dspWptr+060h],WDSPReg18 - mov dword[dspWptr+064h],WDSPReg19 - mov dword[dspWptr+068h],WDSPReg1A - mov dword[dspWptr+06Ch],WDSPReg1B - mov dword[dspWptr+070h],WDSPReg1C - mov dword[dspWptr+074h],WDSPReg1D - mov dword[dspWptr+078h],WDSPReg1E - mov dword[dspWptr+07Ch],WDSPReg1F - mov dword[dspWptr+080h],WDSPReg20 - mov dword[dspWptr+084h],WDSPReg21 - mov dword[dspWptr+088h],WDSPReg22 - mov dword[dspWptr+08Ch],WDSPReg23 - mov dword[dspWptr+090h],WDSPReg24 - mov dword[dspWptr+094h],WDSPReg25 - mov dword[dspWptr+098h],WDSPReg26 - mov dword[dspWptr+09Ch],WDSPReg27 - mov dword[dspWptr+0A0h],WDSPReg28 - mov dword[dspWptr+0A4h],WDSPReg29 - mov dword[dspWptr+0A8h],WDSPReg2A - mov dword[dspWptr+0ACh],WDSPReg2B - mov dword[dspWptr+0B0h],WDSPReg2C - mov dword[dspWptr+0B4h],WDSPReg2D - mov dword[dspWptr+0B8h],WDSPReg2E - mov dword[dspWptr+0BCh],WDSPReg2F - mov dword[dspWptr+0C0h],WDSPReg30 - mov dword[dspWptr+0C4h],WDSPReg31 - mov dword[dspWptr+0C8h],WDSPReg32 - mov dword[dspWptr+0CCh],WDSPReg33 - mov dword[dspWptr+0D0h],WDSPReg34 - mov dword[dspWptr+0D4h],WDSPReg35 - mov dword[dspWptr+0D8h],WDSPReg36 - mov dword[dspWptr+0DCh],WDSPReg37 - mov dword[dspWptr+0E0h],WDSPReg38 - mov dword[dspWptr+0E4h],WDSPReg39 - mov dword[dspWptr+0E8h],WDSPReg3A - mov dword[dspWptr+0ECh],WDSPReg3B - mov dword[dspWptr+0F0h],WDSPReg3C - mov dword[dspWptr+0F4h],WDSPReg3D - mov dword[dspWptr+0F8h],WDSPReg3E - mov dword[dspWptr+0FCh],WDSPReg3F - mov dword[dspWptr+0100h],WDSPReg40 - mov dword[dspWptr+0104h],WDSPReg41 - mov dword[dspWptr+0108h],WDSPReg42 - mov dword[dspWptr+010Ch],WDSPReg43 - mov dword[dspWptr+0110h],WDSPReg44 - mov dword[dspWptr+0114h],WDSPReg45 - mov dword[dspWptr+0118h],WDSPReg46 - mov dword[dspWptr+011Ch],WDSPReg47 - mov dword[dspWptr+0120h],WDSPReg48 - mov dword[dspWptr+0124h],WDSPReg49 - mov dword[dspWptr+0128h],WDSPReg4A - mov dword[dspWptr+012Ch],WDSPReg4B - mov dword[dspWptr+0130h],WDSPReg4C - mov dword[dspWptr+0134h],WDSPReg4D - mov dword[dspWptr+0138h],WDSPReg4E - mov dword[dspWptr+013Ch],WDSPReg4F - mov dword[dspWptr+0140h],WDSPReg50 - mov dword[dspWptr+0144h],WDSPReg51 - mov dword[dspWptr+0148h],WDSPReg52 - mov dword[dspWptr+014Ch],WDSPReg53 - mov dword[dspWptr+0150h],WDSPReg54 - mov dword[dspWptr+0154h],WDSPReg55 - mov dword[dspWptr+0158h],WDSPReg56 - mov dword[dspWptr+015Ch],WDSPReg57 - mov dword[dspWptr+0160h],WDSPReg58 - mov dword[dspWptr+0164h],WDSPReg59 - mov dword[dspWptr+0168h],WDSPReg5A - mov dword[dspWptr+016Ch],WDSPReg5B - mov dword[dspWptr+0170h],WDSPReg5C - mov dword[dspWptr+0174h],WDSPReg5D - mov dword[dspWptr+0178h],WDSPReg5E - mov dword[dspWptr+017Ch],WDSPReg5F - mov dword[dspWptr+0180h],WDSPReg60 - mov dword[dspWptr+0184h],WDSPReg61 - mov dword[dspWptr+0188h],WDSPReg62 - mov dword[dspWptr+018Ch],WDSPReg63 - mov dword[dspWptr+0190h],WDSPReg64 - mov dword[dspWptr+0194h],WDSPReg65 - mov dword[dspWptr+0198h],WDSPReg66 - mov dword[dspWptr+019Ch],WDSPReg67 - mov dword[dspWptr+01A0h],WDSPReg68 - mov dword[dspWptr+01A4h],WDSPReg69 - mov dword[dspWptr+01A8h],WDSPReg6A - mov dword[dspWptr+01ACh],WDSPReg6B - mov dword[dspWptr+01B0h],WDSPReg6C - mov dword[dspWptr+01B4h],WDSPReg6D - mov dword[dspWptr+01B8h],WDSPReg6E - mov dword[dspWptr+01BCh],WDSPReg6F - mov dword[dspWptr+01C0h],WDSPReg70 - mov dword[dspWptr+01C4h],WDSPReg71 - mov dword[dspWptr+01C8h],WDSPReg72 - mov dword[dspWptr+01CCh],WDSPReg73 - mov dword[dspWptr+01D0h],WDSPReg74 - mov dword[dspWptr+01D4h],WDSPReg75 - mov dword[dspWptr+01D8h],WDSPReg76 - mov dword[dspWptr+01DCh],WDSPReg77 - mov dword[dspWptr+01E0h],WDSPReg78 - mov dword[dspWptr+01E4h],WDSPReg79 - mov dword[dspWptr+01E8h],WDSPReg7A - mov dword[dspWptr+01ECh],WDSPReg7B - mov dword[dspWptr+01F0h],WDSPReg7C - mov dword[dspWptr+01F4h],WDSPReg7D - mov dword[dspWptr+01F8h],WDSPReg7E - mov dword[dspWptr+01FCh],WDSPReg7F - mov dword[dspWptr+0200h],WDSPReg80 - mov dword[dspWptr+0204h],WDSPReg81 - mov dword[dspWptr+0208h],WDSPReg82 - mov dword[dspWptr+020Ch],WDSPReg83 - mov dword[dspWptr+0210h],WDSPReg84 - mov dword[dspWptr+0214h],WDSPReg85 - mov dword[dspWptr+0218h],WDSPReg86 - mov dword[dspWptr+021Ch],WDSPReg87 - mov dword[dspWptr+0220h],WDSPReg88 - mov dword[dspWptr+0224h],WDSPReg89 - mov dword[dspWptr+0228h],WDSPReg8A - mov dword[dspWptr+022Ch],WDSPReg8B - mov dword[dspWptr+0230h],WDSPReg8C - mov dword[dspWptr+0234h],WDSPReg8D - mov dword[dspWptr+0238h],WDSPReg8E - mov dword[dspWptr+023Ch],WDSPReg8F - mov dword[dspWptr+0240h],WDSPReg90 - mov dword[dspWptr+0244h],WDSPReg91 - mov dword[dspWptr+0248h],WDSPReg92 - mov dword[dspWptr+024Ch],WDSPReg93 - mov dword[dspWptr+0250h],WDSPReg94 - mov dword[dspWptr+0254h],WDSPReg95 - mov dword[dspWptr+0258h],WDSPReg96 - mov dword[dspWptr+025Ch],WDSPReg97 - mov dword[dspWptr+0260h],WDSPReg98 - mov dword[dspWptr+0264h],WDSPReg99 - mov dword[dspWptr+0268h],WDSPReg9A - mov dword[dspWptr+026Ch],WDSPReg9B - mov dword[dspWptr+0270h],WDSPReg9C - mov dword[dspWptr+0274h],WDSPReg9D - mov dword[dspWptr+0278h],WDSPReg9E - mov dword[dspWptr+027Ch],WDSPReg9F - mov dword[dspWptr+0280h],WDSPRegA0 - mov dword[dspWptr+0284h],WDSPRegA1 - mov dword[dspWptr+0288h],WDSPRegA2 - mov dword[dspWptr+028Ch],WDSPRegA3 - mov dword[dspWptr+0290h],WDSPRegA4 - mov dword[dspWptr+0294h],WDSPRegA5 - mov dword[dspWptr+0298h],WDSPRegA6 - mov dword[dspWptr+029Ch],WDSPRegA7 - mov dword[dspWptr+02A0h],WDSPRegA8 - mov dword[dspWptr+02A4h],WDSPRegA9 - mov dword[dspWptr+02A8h],WDSPRegAA - mov dword[dspWptr+02ACh],WDSPRegAB - mov dword[dspWptr+02B0h],WDSPRegAC - mov dword[dspWptr+02B4h],WDSPRegAD - mov dword[dspWptr+02B8h],WDSPRegAE - mov dword[dspWptr+02BCh],WDSPRegAF - mov dword[dspWptr+02C0h],WDSPRegB0 - mov dword[dspWptr+02C4h],WDSPRegB1 - mov dword[dspWptr+02C8h],WDSPRegB2 - mov dword[dspWptr+02CCh],WDSPRegB3 - mov dword[dspWptr+02D0h],WDSPRegB4 - mov dword[dspWptr+02D4h],WDSPRegB5 - mov dword[dspWptr+02D8h],WDSPRegB6 - mov dword[dspWptr+02DCh],WDSPRegB7 - mov dword[dspWptr+02E0h],WDSPRegB8 - mov dword[dspWptr+02E4h],WDSPRegB9 - mov dword[dspWptr+02E8h],WDSPRegBA - mov dword[dspWptr+02ECh],WDSPRegBB - mov dword[dspWptr+02F0h],WDSPRegBC - mov dword[dspWptr+02F4h],WDSPRegBD - mov dword[dspWptr+02F8h],WDSPRegBE - mov dword[dspWptr+02FCh],WDSPRegBF - mov dword[dspWptr+0300h],WDSPRegC0 - mov dword[dspWptr+0304h],WDSPRegC1 - mov dword[dspWptr+0308h],WDSPRegC2 - mov dword[dspWptr+030Ch],WDSPRegC3 - mov dword[dspWptr+0310h],WDSPRegC4 - mov dword[dspWptr+0314h],WDSPRegC5 - mov dword[dspWptr+0318h],WDSPRegC6 - mov dword[dspWptr+031Ch],WDSPRegC7 - mov dword[dspWptr+0320h],WDSPRegC8 - mov dword[dspWptr+0324h],WDSPRegC9 - mov dword[dspWptr+0328h],WDSPRegCA - mov dword[dspWptr+032Ch],WDSPRegCB - mov dword[dspWptr+0330h],WDSPRegCC - mov dword[dspWptr+0334h],WDSPRegCD - mov dword[dspWptr+0338h],WDSPRegCE - mov dword[dspWptr+033Ch],WDSPRegCF - mov dword[dspWptr+0340h],WDSPRegD0 - mov dword[dspWptr+0344h],WDSPRegD1 - mov dword[dspWptr+0348h],WDSPRegD2 - mov dword[dspWptr+034Ch],WDSPRegD3 - mov dword[dspWptr+0350h],WDSPRegD4 - mov dword[dspWptr+0354h],WDSPRegD5 - mov dword[dspWptr+0358h],WDSPRegD6 - mov dword[dspWptr+035Ch],WDSPRegD7 - mov dword[dspWptr+0360h],WDSPRegD8 - mov dword[dspWptr+0364h],WDSPRegD9 - mov dword[dspWptr+0368h],WDSPRegDA - mov dword[dspWptr+036Ch],WDSPRegDB - mov dword[dspWptr+0370h],WDSPRegDC - mov dword[dspWptr+0374h],WDSPRegDD - mov dword[dspWptr+0378h],WDSPRegDE - mov dword[dspWptr+037Ch],WDSPRegDF - mov dword[dspWptr+0380h],WDSPRegE0 - mov dword[dspWptr+0384h],WDSPRegE1 - mov dword[dspWptr+0388h],WDSPRegE2 - mov dword[dspWptr+038Ch],WDSPRegE3 - mov dword[dspWptr+0390h],WDSPRegE4 - mov dword[dspWptr+0394h],WDSPRegE5 - mov dword[dspWptr+0398h],WDSPRegE6 - mov dword[dspWptr+039Ch],WDSPRegE7 - mov dword[dspWptr+03A0h],WDSPRegE8 - mov dword[dspWptr+03A4h],WDSPRegE9 - mov dword[dspWptr+03A8h],WDSPRegEA - mov dword[dspWptr+03ACh],WDSPRegEB - mov dword[dspWptr+03B0h],WDSPRegEC - mov dword[dspWptr+03B4h],WDSPRegED - mov dword[dspWptr+03B8h],WDSPRegEE - mov dword[dspWptr+03BCh],WDSPRegEF - mov dword[dspWptr+03C0h],WDSPRegF0 - mov dword[dspWptr+03C4h],WDSPRegF1 - mov dword[dspWptr+03C8h],WDSPRegF2 - mov dword[dspWptr+03CCh],WDSPRegF3 - mov dword[dspWptr+03D0h],WDSPRegF4 - mov dword[dspWptr+03D4h],WDSPRegF5 - mov dword[dspWptr+03D8h],WDSPRegF6 - mov dword[dspWptr+03DCh],WDSPRegF7 - mov dword[dspWptr+03E0h],WDSPRegF8 - mov dword[dspWptr+03E4h],WDSPRegF9 - mov dword[dspWptr+03E8h],WDSPRegFA - mov dword[dspWptr+03ECh],WDSPRegFB - mov dword[dspWptr+03F0h],WDSPRegFC - mov dword[dspWptr+03F4h],WDSPRegFD - mov dword[dspWptr+03F8h],WDSPRegFE - mov dword[dspWptr+03FCh],WDSPRegFF - - ; first fill all pointer to an invalid access function - mov ecx,256 - mov eax,Invalidopcode - mov ebp,0 -.loop -%ifdef __MSDOS__ - mov [ds:opcjmptab+ebp],eax -%else - mov [opcjmptab+ebp],eax -%endif - add ebp,4 - dec ecx - jnz .loop - ; now fill the table - mov dword[opcjmptab+00h],Op00 - mov dword[opcjmptab+04h],Op01 - mov dword[opcjmptab+08h],Op02 - mov dword[opcjmptab+0Ch],Op03 - mov dword[opcjmptab+010h],Op04 - mov dword[opcjmptab+014h],Op05 - mov dword[opcjmptab+018h],Op06 - mov dword[opcjmptab+01Ch],Op07 - mov dword[opcjmptab+020h],Op08 - mov dword[opcjmptab+024h],Op09 - mov dword[opcjmptab+028h],Op0A - mov dword[opcjmptab+02Ch],Op0B - mov dword[opcjmptab+030h],Op0C - mov dword[opcjmptab+034h],Op0D - mov dword[opcjmptab+038h],Op0E - mov dword[opcjmptab+03Ch],Op0F - mov dword[opcjmptab+040h],Op10 - mov dword[opcjmptab+044h],Op11 - mov dword[opcjmptab+048h],Op12 - mov dword[opcjmptab+04Ch],Op13 - mov dword[opcjmptab+050h],Op14 - mov dword[opcjmptab+054h],Op15 - mov dword[opcjmptab+058h],Op16 - mov dword[opcjmptab+05Ch],Op17 - mov dword[opcjmptab+060h],Op18 - mov dword[opcjmptab+064h],Op19 - mov dword[opcjmptab+068h],Op1A - mov dword[opcjmptab+06Ch],Op1B - mov dword[opcjmptab+070h],Op1C - mov dword[opcjmptab+074h],Op1D - mov dword[opcjmptab+078h],Op1E - mov dword[opcjmptab+07Ch],Op1F - mov dword[opcjmptab+080h],Op20 - mov dword[opcjmptab+084h],Op21 - mov dword[opcjmptab+088h],Op22 - mov dword[opcjmptab+08Ch],Op23 - mov dword[opcjmptab+090h],Op24 - mov dword[opcjmptab+094h],Op25 - mov dword[opcjmptab+098h],Op26 - mov dword[opcjmptab+09Ch],Op27 - mov dword[opcjmptab+0A0h],Op28 - mov dword[opcjmptab+0A4h],Op29 - mov dword[opcjmptab+0A8h],Op2A - mov dword[opcjmptab+0ACh],Op2B - mov dword[opcjmptab+0B0h],Op2C - mov dword[opcjmptab+0B4h],Op2D - mov dword[opcjmptab+0B8h],Op2E - mov dword[opcjmptab+0BCh],Op2F - mov dword[opcjmptab+0C0h],Op30 - mov dword[opcjmptab+0C4h],Op31 - mov dword[opcjmptab+0C8h],Op32 - mov dword[opcjmptab+0CCh],Op33 - mov dword[opcjmptab+0D0h],Op34 - mov dword[opcjmptab+0D4h],Op35 - mov dword[opcjmptab+0D8h],Op36 - mov dword[opcjmptab+0DCh],Op37 - mov dword[opcjmptab+0E0h],Op38 - mov dword[opcjmptab+0E4h],Op39 - mov dword[opcjmptab+0E8h],Op3A - mov dword[opcjmptab+0ECh],Op3B - mov dword[opcjmptab+0F0h],Op3C - mov dword[opcjmptab+0F4h],Op3D - mov dword[opcjmptab+0F8h],Op3E - mov dword[opcjmptab+0FCh],Op3F - mov dword[opcjmptab+0100h],Op40 - mov dword[opcjmptab+0104h],Op41 - mov dword[opcjmptab+0108h],Op42 - mov dword[opcjmptab+010Ch],Op43 - mov dword[opcjmptab+0110h],Op44 - mov dword[opcjmptab+0114h],Op45 - mov dword[opcjmptab+0118h],Op46 - mov dword[opcjmptab+011Ch],Op47 - mov dword[opcjmptab+0120h],Op48 - mov dword[opcjmptab+0124h],Op49 - mov dword[opcjmptab+0128h],Op4A - mov dword[opcjmptab+012Ch],Op4B - mov dword[opcjmptab+0130h],Op4C - mov dword[opcjmptab+0134h],Op4D - mov dword[opcjmptab+0138h],Op4E - mov dword[opcjmptab+013Ch],Op4F - mov dword[opcjmptab+0140h],Op50 - mov dword[opcjmptab+0144h],Op51 - mov dword[opcjmptab+0148h],Op52 - mov dword[opcjmptab+014Ch],Op53 - mov dword[opcjmptab+0150h],Op54 - mov dword[opcjmptab+0154h],Op55 - mov dword[opcjmptab+0158h],Op56 - mov dword[opcjmptab+015Ch],Op57 - mov dword[opcjmptab+0160h],Op58 - mov dword[opcjmptab+0164h],Op59 - mov dword[opcjmptab+0168h],Op5A - mov dword[opcjmptab+016Ch],Op5B - mov dword[opcjmptab+0170h],Op5C - mov dword[opcjmptab+0174h],Op5D - mov dword[opcjmptab+0178h],Op5E - mov dword[opcjmptab+017Ch],Op5F - mov dword[opcjmptab+0180h],Op60 - mov dword[opcjmptab+0184h],Op61 - mov dword[opcjmptab+0188h],Op62 - mov dword[opcjmptab+018Ch],Op63 - mov dword[opcjmptab+0190h],Op64 - mov dword[opcjmptab+0194h],Op65 - mov dword[opcjmptab+0198h],Op66 - mov dword[opcjmptab+019Ch],Op67 - mov dword[opcjmptab+01A0h],Op68 - mov dword[opcjmptab+01A4h],Op69 - mov dword[opcjmptab+01A8h],Op6A - mov dword[opcjmptab+01ACh],Op6B - mov dword[opcjmptab+01B0h],Op6C - mov dword[opcjmptab+01B4h],Op6D - mov dword[opcjmptab+01B8h],Op6E - mov dword[opcjmptab+01BCh],Op6F - mov dword[opcjmptab+01C0h],Op70 - mov dword[opcjmptab+01C4h],Op71 - mov dword[opcjmptab+01C8h],Op72 - mov dword[opcjmptab+01CCh],Op73 - mov dword[opcjmptab+01D0h],Op74 - mov dword[opcjmptab+01D4h],Op75 - mov dword[opcjmptab+01D8h],Op76 - mov dword[opcjmptab+01DCh],Op77 - mov dword[opcjmptab+01E0h],Op78 - mov dword[opcjmptab+01E4h],Op79 - mov dword[opcjmptab+01E8h],Op7A - mov dword[opcjmptab+01ECh],Op7B - mov dword[opcjmptab+01F0h],Op7C - mov dword[opcjmptab+01F4h],Op7D - mov dword[opcjmptab+01F8h],Op7E - mov dword[opcjmptab+01FCh],Op7F - mov dword[opcjmptab+0200h],Op80 - mov dword[opcjmptab+0204h],Op81 - mov dword[opcjmptab+0208h],Op82 - mov dword[opcjmptab+020Ch],Op83 - mov dword[opcjmptab+0210h],Op84 - mov dword[opcjmptab+0214h],Op85 - mov dword[opcjmptab+0218h],Op86 - mov dword[opcjmptab+021Ch],Op87 - mov dword[opcjmptab+0220h],Op88 - mov dword[opcjmptab+0224h],Op89 - mov dword[opcjmptab+0228h],Op8A - mov dword[opcjmptab+022Ch],Op8B - mov dword[opcjmptab+0230h],Op8C - mov dword[opcjmptab+0234h],Op8D - mov dword[opcjmptab+0238h],Op8E - mov dword[opcjmptab+023Ch],Op8F - mov dword[opcjmptab+0240h],Op90 - mov dword[opcjmptab+0244h],Op91 - mov dword[opcjmptab+0248h],Op92 - mov dword[opcjmptab+024Ch],Op93 - mov dword[opcjmptab+0250h],Op94 - mov dword[opcjmptab+0254h],Op95 - mov dword[opcjmptab+0258h],Op96 - mov dword[opcjmptab+025Ch],Op97 - mov dword[opcjmptab+0260h],Op98 - mov dword[opcjmptab+0264h],Op99 - mov dword[opcjmptab+0268h],Op9A - mov dword[opcjmptab+026Ch],Op9B - mov dword[opcjmptab+0270h],Op9C - mov dword[opcjmptab+0274h],Op9D - mov dword[opcjmptab+0278h],Op9E - mov dword[opcjmptab+027Ch],Op9F - mov dword[opcjmptab+0280h],OpA0 - mov dword[opcjmptab+0284h],OpA1 - mov dword[opcjmptab+0288h],OpA2 - mov dword[opcjmptab+028Ch],OpA3 - mov dword[opcjmptab+0290h],OpA4 - mov dword[opcjmptab+0294h],OpA5 - mov dword[opcjmptab+0298h],OpA6 - mov dword[opcjmptab+029Ch],OpA7 - mov dword[opcjmptab+02A0h],OpA8 - mov dword[opcjmptab+02A4h],OpA9 - mov dword[opcjmptab+02A8h],OpAA - mov dword[opcjmptab+02ACh],OpAB - mov dword[opcjmptab+02B0h],OpAC - mov dword[opcjmptab+02B4h],OpAD - mov dword[opcjmptab+02B8h],OpAE - mov dword[opcjmptab+02BCh],OpAF - mov dword[opcjmptab+02C0h],OpB0 - mov dword[opcjmptab+02C4h],OpB1 - mov dword[opcjmptab+02C8h],OpB2 - mov dword[opcjmptab+02CCh],OpB3 - mov dword[opcjmptab+02D0h],OpB4 - mov dword[opcjmptab+02D4h],OpB5 - mov dword[opcjmptab+02D8h],OpB6 - mov dword[opcjmptab+02DCh],OpB7 - mov dword[opcjmptab+02E0h],OpB8 - mov dword[opcjmptab+02E4h],OpB9 - mov dword[opcjmptab+02E8h],OpBA - mov dword[opcjmptab+02ECh],OpBB - mov dword[opcjmptab+02F0h],OpBC - mov dword[opcjmptab+02F4h],OpBD - mov dword[opcjmptab+02F8h],OpBE - mov dword[opcjmptab+02FCh],OpBF - mov dword[opcjmptab+0300h],OpC0 - mov dword[opcjmptab+0304h],OpC1 - mov dword[opcjmptab+0308h],OpC2 - mov dword[opcjmptab+030Ch],OpC3 - mov dword[opcjmptab+0310h],OpC4 - mov dword[opcjmptab+0314h],OpC5 - mov dword[opcjmptab+0318h],OpC6 - mov dword[opcjmptab+031Ch],OpC7 - mov dword[opcjmptab+0320h],OpC8 - mov dword[opcjmptab+0324h],OpC9 - mov dword[opcjmptab+0328h],OpCA - mov dword[opcjmptab+032Ch],OpCB - mov dword[opcjmptab+0330h],OpCC - mov dword[opcjmptab+0334h],OpCD - mov dword[opcjmptab+0338h],OpCE - mov dword[opcjmptab+033Ch],OpCF - mov dword[opcjmptab+0340h],OpD0 - mov dword[opcjmptab+0344h],OpD1 - mov dword[opcjmptab+0348h],OpD2 - mov dword[opcjmptab+034Ch],OpD3 - mov dword[opcjmptab+0350h],OpD4 - mov dword[opcjmptab+0354h],OpD5 - mov dword[opcjmptab+0358h],OpD6 - mov dword[opcjmptab+035Ch],OpD7 - mov dword[opcjmptab+0360h],OpD8 - mov dword[opcjmptab+0364h],OpD9 - mov dword[opcjmptab+0368h],OpDA - mov dword[opcjmptab+036Ch],OpDB - mov dword[opcjmptab+0370h],OpDC - mov dword[opcjmptab+0374h],OpDD - mov dword[opcjmptab+0378h],OpDE - mov dword[opcjmptab+037Ch],OpDF - mov dword[opcjmptab+0380h],OpE0 - mov dword[opcjmptab+0384h],OpE1 - mov dword[opcjmptab+0388h],OpE2 - mov dword[opcjmptab+038Ch],OpE3 - mov dword[opcjmptab+0390h],OpE4 - mov dword[opcjmptab+0394h],OpE5 - mov dword[opcjmptab+0398h],OpE6 - mov dword[opcjmptab+039Ch],OpE7 - mov dword[opcjmptab+03A0h],OpE8 - mov dword[opcjmptab+03A4h],OpE9 - mov dword[opcjmptab+03A8h],OpEA - mov dword[opcjmptab+03ACh],OpEB - mov dword[opcjmptab+03B0h],OpEC - mov dword[opcjmptab+03B4h],OpED - mov dword[opcjmptab+03B8h],OpEE - mov dword[opcjmptab+03BCh],OpEF - mov dword[opcjmptab+03C0h],OpF0 - mov dword[opcjmptab+03C4h],OpF1 - mov dword[opcjmptab+03C8h],OpF2 - mov dword[opcjmptab+03CCh],OpF3 - mov dword[opcjmptab+03D0h],OpF4 - mov dword[opcjmptab+03D4h],OpF5 - mov dword[opcjmptab+03D8h],OpF6 - mov dword[opcjmptab+03DCh],OpF7 - mov dword[opcjmptab+03E0h],OpF8 - mov dword[opcjmptab+03E4h],OpF9 - mov dword[opcjmptab+03E8h],OpFA - mov dword[opcjmptab+03ECh],OpFB - mov dword[opcjmptab+03F0h],OpFC - mov dword[opcjmptab+03F4h],OpFD - mov dword[opcjmptab+03F8h],OpFE - mov dword[opcjmptab+03FCh],OpFF -%ifdef __MSDOS__ - call SB_alloc_dma -%endif -.nosound - pop edx - pop ecx - pop ebx - pop eax - ret - -SECTION .bss - -PSampleBuf resd 24*8 - -NEWSYM LPFsample1, resd 1 -NEWSYM LPFsample2, resd 1 - -NEWSYM BRRreadahead, resw 4 -NEWSYM DLPFsamples, resd 8*24 - -section .text - -%macro ProcessA 0 - shr al,4 -%endmacro - -%macro ProcessB 0 - and al,0Fh -%endmacro - -%macro ProcessSample 1 - mov cl,[bshift] - movzx eax,byte[esi] - %1 - ;sign extend - xor eax,8 - sub eax,8 - - cmp cl,12 - ja %%invalid_range - shl eax,cl - sar eax,1 - jmp %%got_delta -%%invalid_range - and eax,~0x7FF -%%got_delta - mov edx,eax - - cmp dword[filter0],240 - jne %%notfilter1 - mov eax,[prev0] - sar eax,1 - add edx,eax - mov eax,[prev0] - neg eax - sar eax,5 - add edx,eax -%%notfilter1 - cmp dword[filter0],488 - jne %%notfilter2 - mov eax,[prev0] - add edx,eax - mov eax,[prev0] - sar eax,1 - add eax,[prev0] - neg eax - sar eax,5 - add edx,eax - mov eax,[prev1] - sar eax,1 - sub edx,eax - mov eax,[prev1] - sar eax,5 - add edx,eax -%%notfilter2 - cmp dword[filter0],460 - jne %%notfilter3 - mov eax,[prev0] - add edx,eax - mov eax,[prev0] - shl eax,1 - add eax,[prev0] - shl eax,2 - add eax,[prev0] - neg eax - sar eax,7 - add edx,eax - mov eax,[prev1] - sar eax,1 - sub edx,eax - mov eax,[prev1] - sar eax,1 - add eax,[prev1] - sar eax,4 - add edx,eax -%%notfilter3 - - cmp edx,-32768 - jnl %%notless - mov edx,-32768 -%%notless - cmp edx,32767 - jng %%notgreater - mov edx,32767 -%%notgreater - - mov eax,[prev0] - mov [prev1],eax - - shl edx,1 - movsx edx,dx - mov [prev0],edx -%endmacro - -%macro ProcessDynamicLowPass 0 - mov ecx,[curvoice] - mov edx, [Voice0Freq+ecx*4] - cmp edx, dword 800000h - ja %%DLPF - ret -%%DLPF - lea ebx,[ecx*4] - lea ebx,[ebx*4] - lea ecx,[ecx*4] - lea ebx,[ecx*2+ebx] - lea ebx,[DLPFsamples+ebx*4] - cmp byte[LowPassFilterType],3 - je near %%DLPF_fir -;dynamic - mov eax,[ebx+16*4] - mov [ebx],eax - mov eax,[ebx+17*4] - mov [ebx+1*4],eax - mov eax,[ebx+18*4] - mov [ebx+2*4],eax - mov eax,[ebx+19*4] - mov [ebx+3*4],eax - sub edi,32 - movsx eax,word[edi+24] - mov [ebx+16*4],eax - movsx eax,word[edi+26] - mov [ebx+17*4],eax - movsx eax,word[edi+28] - mov [ebx+18*4],eax - movsx eax,word[edi+30] - mov [ebx+19*4],eax - mov ecx,16 - shr edx,24 - cmp dl,2 - jle %%dlpf_by_2 - cmp dl,3 - jle %%dlpf_by_3 - cmp dl,4 - jle near %%dlpf_by_4 - jmp %%dlpf_by_5 - -%%dlpf_by_2 - mov eax,[ebx+4*4] - jmp %%dlpf_by_2_loop - -ALIGN16 -%%dlpf_by_2_loop - movsx edx,word[edi] - add eax,edx - sar eax,1 - mov [edi],ax - mov eax,edx - add edi,2 - dec ecx - jnz %%dlpf_by_2_loop - ret - -%%dlpf_by_3 - mov eax,[ebx+3*4] - mov ebp,[ebx+4*4] - jmp %%dlpf_by_3_loop - -ALIGN16 -%%dlpf_by_3_loop - movsx ebx,word[edi] - add eax,ebx - add eax,ebp - mov edx,55555555h ; (1/3) - imul edx - mov [edi],dx - add edi,2 - mov eax,ebp - mov ebp,ebx - dec ecx - jnz %%dlpf_by_3_loop - ret - -%%dlpf_by_4 - mov eax,[ebx+2*4] - mov edx,[ebx+3*4] - mov ebp,[ebx+4*4] - jmp %%dlpf_by_4_loop - -ALIGN16 -%%dlpf_by_4_loop - movsx ebx,word[edi] - add eax,ebx - add eax,edx - add eax,ebp - sar eax,2 - mov [edi],ax - add edi,2 - mov eax,edx - mov edx,ebp - mov ebp,ebx - dec ecx - jnz %%dlpf_by_4_loop - ret - -%%dlpf_by_5 - push ecx - mov eax,[ebx+1*4] - mov esi,[ebx+2*4] - mov ebp,[ebx+3*4] - mov ecx,[ebx+4*4] - jmp %%dlpf_by_5_loop - -ALIGN16 -%%dlpf_by_5_loop - movsx ebx,word[edi] - add eax,ebx - add eax,esi - add eax,ebp - add eax,ecx - mov edx,33333333h ; 1/5 - imul edx - mov [edi],dx - add edi,2 - mov eax,esi - mov esi,ebp - mov ebp,ecx - mov ecx,ebx - dec dword[esp] - jnz %%dlpf_by_5_loop - pop ecx - ret - -%%DLPF_fir - sub edi,byte 32 - sub edx,0780000h ;ac - address calculation (see below) - mov eax,[ebx+16*4] - mov ecx,[ebx+17*4] - mov [ebx],eax - mov [ebx+1*4],ecx - shr edx,18 ;ac - mov eax,[ebx+18*4] - and edx,3FF0h ;ac - mov ecx,[ebx+19*4] - mov [ebx+2*4],eax - mov [ebx+3*4],ecx - - movq mm1,[edi] ;u1 (U-pipe marker) - movq mm3,[edi+8] ;u2 - punpcklwd mm0,mm1 - movq mm5,[edi+16] ;u3 - psrad mm0, 16 - movq mm7,[edi+24] ;u4 - punpckhwd mm1,mm1 - movq [ebx+4*4],mm0 ;u5 - psrad mm1, 16 - movq mm4,[BRRreadahead] ;u6 - punpcklwd mm0,mm3 - movq [ebx+6*4],mm1 ;u7 - psrad mm0, 16 - punpckhwd mm3,mm3 ;u8 - movq [ebx+8*4],mm0 ;u9 - psrad mm3, 16 - punpcklwd mm0,mm5 ;u10 - movq [ebx+10*4],mm3 ;u11 - psrad mm0, 16 - punpckhwd mm5,mm5 ;u12 - movq [ebx+12*4],mm0 ;u13 - psrad mm5, 16 - punpcklwd mm0,mm7 ;u14 - movq [ebx+14*4],mm5 ;u15 - psrad mm0, 16 - punpckhwd mm7,mm7 ;u16 - movq mm2,[fir_lut_co+edx] ;u17 - psrad mm7, 16 - punpcklwd mm6,mm4 ;u18 - movq [ebx+16*4],mm0 ;u19 - psrad mm6, 16 - movq [ebx+18*4],mm7 ;u20 - punpckhwd mm4,mm4 - movq mm3,[fir_lut_co+edx+8] ;u21 - psrad mm4, 16 - movq [ebx+20*4],mm6 ;u22 - movq [ebx+22*4],mm4 ;u23 - - mov ecx,16 - jmp %%DLPF_fir_loop - ALIGN16 - -; output 2 samples per iteration -%%DLPF_fir_loop - movq mm0,[ebx] - packssdw mm0,[ebx+8] - movq mm4,[ebx+4] - pmaddwd mm0,mm2 - packssdw mm4,[ebx+12] - movq mm1,[ebx+16] - pmaddwd mm4,mm2 - packssdw mm1,[ebx+24] - movq mm5,[ebx+20] - pmaddwd mm1,mm3 - packssdw mm5,[ebx+28] - pmaddwd mm5,mm3 - paddd mm0,mm1 - add ebx,byte 8 - paddd mm4,mm5 - movq mm1,mm0 - movq mm5,mm4 - psrlq mm0,32 - psrlq mm4,32 - paddd mm0,mm1 - paddd mm4,mm5 - punpckldq mm0,mm4 - psrad mm0,14 - packssdw mm0,mm0 - sub ecx,byte 2 - movd [edi],mm0 - lea edi,[edi+4] - jnz %%DLPF_fir_loop - emms - ret -%endmacro - -section .bss -NEWSYM curvoice, resd 1 -section .text - -BRRDecode: - mov [curvoice],ecx - mov byte[lastbl],0 - mov byte[loopbl],0 - push ecx - - movzx eax,byte[esi] - test al,01h - jz .nolast - mov byte[lastbl],1 - test al,02h - jz .nolast - mov byte[loopbl],1 -.nolast - mov cl,al - and al,0Ch - inc esi - mov ebx,[Filter+eax*2] - shr cl,4 - mov [filter0],ebx - mov ebx,[Filter+eax*2+4] - mov [bshift],cl - mov [filter1],ebx - mov byte[sampleleft],8 - jmp .nextsample - ALIGN16 - -.nextsample - ProcessSample ProcessA - mov [edi],dx - ProcessSample ProcessB - mov [edi+2],dx - add edi,4 - inc esi - dec byte[sampleleft] - jnz .nextsample - - cmp dword[DSPInterpolate],0 - jnz .BRR_decode_ahead - - cmp byte[LowPassFilterType],2 - jle near .no_dlpf - - mov eax,[curvoice] - mov eax,[Voice0Freq+eax*4] - cmp eax,800000h - jb near .no_dlpf - -.BRR_decode_ahead - - push esi - - cmp byte[lastbl],1 - jne .dlpf_fill - - cmp byte[loopbl],1 - jne near .dlpf_clear - - mov eax,[curvoice] - mov esi,[Voice0LoopPtr+eax*4] - add esi,SPCRAM - -.dlpf_fill - push dword[prev0] - push dword[prev1] - - movzx eax,byte[esi] - mov cl,al - and al,0Ch - inc esi - mov ebx,[Filter+eax*2] - shr cl,4 - mov [filter0],ebx - mov ebx,[Filter+eax*2+4] - mov [bshift],cl - mov [filter1],ebx - - ProcessSample ProcessA - mov [BRRreadahead],dx - ProcessSample ProcessB - mov [BRRreadahead+2],dx - inc esi - ProcessSample ProcessA - mov [BRRreadahead+4],dx - ProcessSample ProcessB - mov [BRRreadahead+6],dx - - pop dword[prev1] - pop dword[prev0] - pop esi - jmp .no_dlpf - -.dlpf_clear - xor eax,eax - mov [BRRreadahead],eax - mov [BRRreadahead+4],eax - pop esi - -.no_dlpf - - pop ecx - - cmp byte[LowPassFilterType],1 - ja .dlpf - ret - -.dlpf - ProcessDynamicLowPass - -section .data -ALIGN32 - -; Original Values -NEWSYM EchoRateO - dd 2,172,344,517,689,861,1033,1205,1378,1550,1722,1895,2067,2239,2412,2584 -NEWSYM AttackRateO - dd 45202,28665,16537,11025,7056,4189,2866,1764,1058,705,441,264,176,110,66,4 -NEWSYM DecayRateO - dd 13230,8158,4851,2697,2284,1212,815,407 -NEWSYM SustainRateO - dd 0FFFFFFFFh,418950,308700,265600,209475,154350,132300,103635,78277,65047 - dd 51817,38587,31972,26460,19845,16537,13230,9702,8158,6504,4851,3879,2697 - dd 2050,1572,1212,1014,815,606,407,202,125 -NEWSYM SustainValueO - db 15,31,47,63,79,95,111,127 -NEWSYM IncreaseO - dd 0FFFFFFFFh,45202,34177,28665,22050,16537,14332,11025,8489,7056,5622,4189 - dd 3528,2866,2094,1764,1433,1058,882,705,529,441,352,264,220,176,132,110,88 - dd 66,44,22 -NEWSYM IncreaseBentO - dd 0FFFFFFFFh,79100,59535,50160,38580,28665,25000,19250,14332,12127,9800,7320 - dd 6160,4961,3650,3060,2425,1845,1540,1212,920,770,614,460,383,306,229,190,152 - dd 113,75,36 -NEWSYM DecreaseO - dd 0FFFFFFFFh,45202,34177,28665,22050,16537,14332,11025,8489,7056,5622,4189 - dd 3528,2866,2094,1764,1433,1058,882,705,529,441,352,264,220,176,132,110,88,66 - dd 44,22 -NEWSYM DecreaseRateExpO - dd 0FFFFFFFFh,418950,308700,264600,209470,154350,132300,103635,78277,65047 - dd 51817,38587,31972,26460,19845,16537,13230,9702,8158,6504,4851,4079,3197 - dd 2425,1984,1653,1212,1014,815,606,407,198 - -SECTION .bss -NoisePtr resd 1 - -; used only in dspproc.asm -SECTION .data -ALIGN32 - -Filter dd 0,0,240,0,488,-240,460,-208 - -prev0 dd 0 ; previous value 1 -prev1 dd 0 ; previous value 2 -nextsamp dd 0 ; next sample -filter0 dd 0 ; filter 0 -filter1 dd 0 ; filter 1 -bshift dd 0 -sampleleft dd 0 ; 8 bytes/sample - -lastbl dd 0 ; Last block if = 1 -loopbl dd 0 ; Loop if = 1 -usenoisedata dd 0 - -VolumeTableD: -db 0,3,6,9,12,15,17,18,19,21,22,23,24,24,26,28,30,31,33,35,36,38,40,41,43,45,46,48,49 -db 51,52,54,56,57,58,60,61,63,64,66,67,68,70,71,72,74,75,76,78,79,80,81,82,84,85,86 -db 87,88,89,90,91,92,93,94,96,96,97,98,99,100,101,102,103,104,105,106,106,107,108 -db 109,110,110,111,112,112,113,114,114,115,116,116,117,117,118,118,119,120,120,120 -db 121,121,122,122,123,123,123,124,124,124,125,125,125,126,126,126,126,126,127,127 -db 127,127,127,127,127,127,127,127,127,128,128,128,128,128,128,128,128,128,128 -db 128,129,129,129,129,129,130,130,130,131,131,131,132,132,132,133,133,134,134,135 -db 135,135,136,137,137,138,138,139,139,140,141,141,142,143,143,144,145,145,146,147 -db 148,149,149,150,151,152,153,154,155,156,157,158,159,159,161,162,163,164,165,166 -db 167,168,169,170,171,173,174,175,176,177,179,180,181,183,184,185,187,188,189,191 -db 192,194,195,197,198,199,201,203,204,206,207,209,210,212,214,215,217,219,220,222 -db 224,225,227,229,231,231,232,233,234,236,237,238,240,243,246,249,252,255 - -db 0,1,3,5,7,9,11,13,15,17,19,21,22,24,26,28,30,31,33,35,36,38,40,41,43,45,46,48,49 -db 51,52,54,56,57,58,60,61,63,64,66,67,68,70,71,72,74,75,76,78,79,80,81,82,84,85,86 -db 87,88,89,90,91,92,93,94,96,96,97,98,99,100,101,102,103,104,105,106,106,107,108 -db 109,110,110,111,112,112,113,114,114,115,116,116,117,117,118,118,119,120,120,120 -db 121,121,122,122,123,123,123,124,124,124,125,125,125,126,126,126,126,126,127,127 -db 127,127,127,127,127,127,127,127,127,128,128,128,128,128,128,128,128,128,128 -db 128,129,129,129,129,129,130,130,130,131,131,131,132,132,132,133,133,134,134,135 -db 135,135,136,137,137,138,138,139,139,140,141,141,142,143,143,144,145,145,146,147 -db 148,149,149,150,151,152,153,154,155,156,157,158,159,159,161,162,163,164,165,166 -db 167,168,169,170,171,173,174,175,176,177,179,180,181,183,184,185,187,188,189,191 -db 192,194,195,197,198,199,201,203,204,206,207,209,210,212,214,215,217,219,220,222 -db 224,225,227,229,231,233,234,236,238,240,242,244,246,248,250,252,254,255 - -NEWSYM VolumeTableb - db 00h,01h,02h,03h,04h,05h,06h,07h,08h,09h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh - db 10h,11h,12h,13h,14h,15h,16h,17h,18h,19h,1Ah,1Bh,1Ch,1Dh,1Eh,1Fh - db 20h,21h,22h,23h,24h,25h,26h,27h,28h,29h,2Ah,2Bh,2Ch,2Dh,2Eh,2Fh - db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h,3Ah,3Bh,3Ch,3Dh,3Eh,3Fh - db 40h,41h,42h,43h,44h,45h,46h,47h,48h,49h,4Ah,4Bh,4Ch,4Dh,4Eh,4Fh - db 50h,51h,52h,53h,54h,55h,56h,57h,58h,59h,5Ah,5Bh,5Ch,5Dh,5Eh,5Fh - db 60h,61h,62h,63h,64h,65h,66h,67h,68h,69h,6Ah,6Bh,6Ch,6Dh,6Eh,6Fh - db 70h,71h,72h,73h,74h,75h,76h,77h,78h,79h,7Ah,7Bh,7Ch,7Dh,7Eh,7Fh - db 7Fh,7Eh,7Dh,7Ch,7Bh,7Ah,79h,78h,77h,76h,75h,74h,73h,72h,71h,70h - db 6Fh,6Eh,6Dh,6Ch,6Bh,6Ah,69h,68h,67h,66h,65h,64h,63h,62h,61h,60h - db 5Fh,5Eh,5Dh,5Ch,5Bh,5Ah,59h,58h,57h,56h,55h,54h,53h,52h,51h,50h - db 4Fh,4Eh,4Dh,4Ch,4Bh,4Ah,49h,48h,47h,46h,45h,44h,43h,42h,41h,40h - db 3Fh,3Eh,3Dh,3Ch,3Bh,3Ah,39h,38h,37h,36h,35h,34h,33h,32h,31h,30h - db 2Fh,2Eh,2Dh,2Ch,2Bh,2Ah,29h,28h,27h,26h,25h,24h,23h,22h,21h,20h - db 1Fh,1Eh,1Dh,1Ch,1Bh,1Ah,19h,18h,17h,16h,15h,14h,13h,12h,11h,10h - db 0Fh,0Eh,0Dh,0Ch,0Bh,0Ah,09h,08h,07h,06h,05h,04h,03h,02h,01h,00h - -; appears to only be used in dspproc.asm - -;VolumeTable: db 0,2,4,6,8,10,12,14,16,18 -; db 20,22,24,26,28,30,32,34,36,38 -; db 40,42,44,46,48,50,52,54,56,58 -; db 60,62,64,66,68,70,72,74,76,78 -; db 80,82,84,86,88,90,92,94,96,98 -; db 100,102,104,106,108,110,112,114,116,118 -; db 120,122,124,126,127,127,127,127,127,127 -;VolumeTable: db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127,127,127 -; db 127,127,127,127,127,127,127,127 -;VolumeTable db 1,1,2,3,4,5,6,7,8,9 -; db 10,11,12,13,14,15,16,17,18,19 -; db 20,21,22,23,24,25,26,27,28,29 -; db 30,31,32,33,34,35,36,37,38,39 -; db 40,41,42,43,44,45,46,47,48,49 -; db 50,51,52,53,54,55,46,57,58,59 -; db 60,61,62,63,64,65,56,67,68,69 -; db 70,71,72,73,74,75,66,77,78,79 -; db 80,81,82,83,84,85,76,87,88,89 -; db 90,91,92,93,94,95,86,97,98,99 -; db 100,101,102,103,104,105,106,107,108,109 -; db 110,111,112,113,114,115,116,117,118,119 -; db 120,121,122,123,124,125,126,127 -;VolumeTable db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1,1,1 -; db 1,1,1,1,1,1,1,1 - -SECTION .bss -NEWSYM DSPBuffer, resd 320*4 ; The play buffer... -NEWSYM EchoBuffer, resd 320*4 ; The play buffer... -NEWSYM PModBuffer, resd 320*4 ; The play buffer... -NEWSYM BRRBuffer, resb 32 ; The BRR Decode Buffer - -NEWSYM BRRPlace0, resd 1 ; Place in the BRRBuffer for Voice 0 -NEWSYM BRRTemp0, resd 1 ; Keep this 0 -NEWSYM BRRPlace1, resd 1 ; Place in the BRRBuffer for Voice 0 -NEWSYM BRRTemp1, resd 1 ; Keep this 0 -NEWSYM BRRPlace2, resd 1 ; Place in the BRRBuffer for Voice 0 -NEWSYM BRRTemp2, resd 1 ; Keep this 0 -NEWSYM BRRPlace3, resd 1 ; Place in the BRRBuffer for Voice 0 -NEWSYM BRRTemp3, resd 1 ; Keep this 0 -NEWSYM BRRPlace4, resd 1 ; Place in the BRRBuffer for Voice 0 -NEWSYM BRRTemp4, resd 1 ; Keep this 0 -NEWSYM BRRPlace5, resd 1 ; Place in the BRRBuffer for Voice 0 -NEWSYM BRRTemp5, resd 1 ; Keep this 0 -NEWSYM BRRPlace6, resd 1 ; Place in the BRRBuffer for Voice 0 -NEWSYM BRRTemp6, resd 1 ; Keep this 0 -NEWSYM BRRPlace7, resd 1 ; Place in the BRRBuffer for Voice 0 -NEWSYM BRRTemp7, resd 1 ; Keep this 0 - -NEWSYM Voice0Freq, resd 1 ; Frequency of Voice 0 (Delta Freq) -NEWSYM Voice1Freq, resd 1 ; Frequency of Voice 1 (Delta Freq) -NEWSYM Voice2Freq, resd 1 ; Frequency of Voice 2 (Delta Freq) -NEWSYM Voice3Freq, resd 1 ; Frequency of Voice 3 (Delta Freq) -NEWSYM Voice4Freq, resd 1 ; Frequency of Voice 4 (Delta Freq) -NEWSYM Voice5Freq, resd 1 ; Frequency of Voice 5 (Delta Freq) -NEWSYM Voice6Freq, resd 1 ; Frequency of Voice 6 (Delta Freq) -NEWSYM Voice7Freq, resd 1 ; Frequency of Voice 7 (Delta Freq) - -NEWSYM Voice0Pitch, resw 1 ; Previous Pitch for Voice 0 -NEWSYM Voice1Pitch, resw 1 ; Previous Pitch for Voice 1 -NEWSYM Voice2Pitch, resw 1 ; Previous Pitch for Voice 2 -NEWSYM Voice3Pitch, resw 1 ; Previous Pitch for Voice 3 -NEWSYM Voice4Pitch, resw 1 ; Previous Pitch for Voice 4 -NEWSYM Voice5Pitch, resw 1 ; Previous Pitch for Voice 5 -NEWSYM Voice6Pitch, resw 1 ; Previous Pitch for Voice 6 -NEWSYM Voice7Pitch, resw 1 ; Previous Pitch for Voice 7 - -NEWSYM Voice0Status, resb 1 ; 0=Not Playing 1=Playing -NEWSYM Voice1Status, resb 1 -NEWSYM Voice2Status, resb 1 -NEWSYM Voice3Status, resb 1 -NEWSYM Voice4Status, resb 1 -NEWSYM Voice5Status, resb 1 -NEWSYM Voice6Status, resb 1 -NEWSYM Voice7Status, resb 1 - -NEWSYM Voice0Ptr, resd 1 ; Ptr to Next BRR Block to be played -NEWSYM Voice1Ptr, resd 1 -NEWSYM Voice2Ptr, resd 1 -NEWSYM Voice3Ptr, resd 1 -NEWSYM Voice4Ptr, resd 1 -NEWSYM Voice5Ptr, resd 1 -NEWSYM Voice6Ptr, resd 1 -NEWSYM Voice7Ptr, resd 1 -NEWSYM Voice0LoopPtr, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice1LoopPtr, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice2LoopPtr, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice3LoopPtr, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice4LoopPtr, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice5LoopPtr, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice6LoopPtr, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice7LoopPtr, resd 1 ; Ptr to Loop BRR Block to be played - -NEWSYM Voice0BufPtr, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice1BufPtr, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice2BufPtr, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice3BufPtr, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice4BufPtr, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice5BufPtr, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice6BufPtr, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice7BufPtr, resd 1 ; Ptr to Buffer Block to be played - -NEWSYM SoundCounter, resd 1 ; Counter used for sound generation -NEWSYM SoundCounter2, resd 1 ; Counter used for sound generation -NEWSYM Voice0Prev0, resd 1 -NEWSYM Voice1Prev0, resd 1 -NEWSYM Voice2Prev0, resd 1 -NEWSYM Voice3Prev0, resd 1 -NEWSYM Voice4Prev0, resd 1 -NEWSYM Voice5Prev0, resd 1 -NEWSYM Voice6Prev0, resd 1 -NEWSYM Voice7Prev0, resd 1 -NEWSYM Voice0Prev1, resd 1 -NEWSYM Voice1Prev1, resd 1 -NEWSYM Voice2Prev1, resd 1 -NEWSYM Voice3Prev1, resd 1 -NEWSYM Voice4Prev1, resd 1 -NEWSYM Voice5Prev1, resd 1 -NEWSYM Voice6Prev1, resd 1 -NEWSYM Voice7Prev1, resd 1 - -NEWSYM Voice0Loop, resb 1 -NEWSYM Voice1Loop, resb 1 -NEWSYM Voice2Loop, resb 1 -NEWSYM Voice3Loop, resb 1 -NEWSYM Voice4Loop, resb 1 -NEWSYM Voice5Loop, resb 1 -NEWSYM Voice6Loop, resb 1 -NEWSYM Voice7Loop, resb 1 - -NEWSYM Voice0End, resb 1 -NEWSYM Voice1End, resb 1 -NEWSYM Voice2End, resb 1 -NEWSYM Voice3End, resb 1 -NEWSYM Voice4End, resb 1 -NEWSYM Voice5End, resb 1 -NEWSYM Voice6End, resb 1 -NEWSYM Voice7End, resb 1 - -NEWSYM Voice0Noise, resb 1 -NEWSYM Voice1Noise, resb 1 -NEWSYM Voice2Noise, resb 1 -NEWSYM Voice3Noise, resb 1 -NEWSYM Voice4Noise, resb 1 -NEWSYM Voice5Noise, resb 1 -NEWSYM Voice6Noise, resb 1 -NEWSYM Voice7Noise, resb 1 - -NEWSYM Voice0Volume, resb 1 -NEWSYM Voice1Volume, resb 1 -NEWSYM Voice2Volume, resb 1 -NEWSYM Voice3Volume, resb 1 -NEWSYM Voice4Volume, resb 1 -NEWSYM Voice5Volume, resb 1 -NEWSYM Voice6Volume, resb 1 -NEWSYM Voice7Volume, resb 1 - -NEWSYM Voice0VolumeR, resb 1 -NEWSYM Voice1VolumeR, resb 1 -NEWSYM Voice2VolumeR, resb 1 -NEWSYM Voice3VolumeR, resb 1 -NEWSYM Voice4VolumeR, resb 1 -NEWSYM Voice5VolumeR, resb 1 -NEWSYM Voice6VolumeR, resb 1 -NEWSYM Voice7VolumeR, resb 1 - -NEWSYM Voice0VolumeL, resb 1 -NEWSYM Voice1VolumeL, resb 1 -NEWSYM Voice2VolumeL, resb 1 -NEWSYM Voice3VolumeL, resb 1 -NEWSYM Voice4VolumeL, resb 1 -NEWSYM Voice5VolumeL, resb 1 -NEWSYM Voice6VolumeL, resb 1 -NEWSYM Voice7VolumeL, resb 1 - -NEWSYM Voice0Env, resb 1 -NEWSYM Voice1Env, resb 1 -NEWSYM Voice2Env, resb 1 -NEWSYM Voice3Env, resb 1 -NEWSYM Voice4Env, resb 1 -NEWSYM Voice5Env, resb 1 -NEWSYM Voice6Env, resb 1 -NEWSYM Voice7Env, resb 1 - -NEWSYM Voice0Out, resb 1 -NEWSYM Voice1Out, resb 1 -NEWSYM Voice2Out, resb 1 -NEWSYM Voice3Out, resb 1 -NEWSYM Voice4Out, resb 1 -NEWSYM Voice5Out, resb 1 -NEWSYM Voice6Out, resb 1 -NEWSYM Voice7Out, resb 1 - -; 1 Attack, 2 Decrease,3 Sustain, 0 Gain -NEWSYM Voice0State, resb 1 -NEWSYM Voice1State, resb 1 -NEWSYM Voice2State, resb 1 -NEWSYM Voice3State, resb 1 -NEWSYM Voice4State, resb 1 -NEWSYM Voice5State, resb 1 -NEWSYM Voice6State, resb 1 -NEWSYM Voice7State, resb 1 - -NEWSYM Voice0Time, resd 1 -NEWSYM Voice1Time, resd 1 -NEWSYM Voice2Time, resd 1 -NEWSYM Voice3Time, resd 1 -NEWSYM Voice4Time, resd 1 -NEWSYM Voice5Time, resd 1 -NEWSYM Voice6Time, resd 1 -NEWSYM Voice7Time, resd 1 - -NEWSYM Voice0Attack, resd 1 -NEWSYM Voice1Attack, resd 1 -NEWSYM Voice2Attack, resd 1 -NEWSYM Voice3Attack, resd 1 -NEWSYM Voice4Attack, resd 1 -NEWSYM Voice5Attack, resd 1 -NEWSYM Voice6Attack, resd 1 -NEWSYM Voice7Attack, resd 1 - -NEWSYM Voice0Decay, resd 1 -NEWSYM Voice1Decay, resd 1 -NEWSYM Voice2Decay, resd 1 -NEWSYM Voice3Decay, resd 1 -NEWSYM Voice4Decay, resd 1 -NEWSYM Voice5Decay, resd 1 -NEWSYM Voice6Decay, resd 1 -NEWSYM Voice7Decay, resd 1 - -NEWSYM Voice0SustainL, resb 1 -NEWSYM Voice1SustainL, resb 1 -NEWSYM Voice2SustainL, resb 1 -NEWSYM Voice3SustainL, resb 1 -NEWSYM Voice4SustainL, resb 1 -NEWSYM Voice5SustainL, resb 1 -NEWSYM Voice6SustainL, resb 1 -NEWSYM Voice7SustainL, resb 1 - -NEWSYM Voice0SustainL2, resb 1 -NEWSYM Voice1SustainL2, resb 1 -NEWSYM Voice2SustainL2, resb 1 -NEWSYM Voice3SustainL2, resb 1 -NEWSYM Voice4SustainL2, resb 1 -NEWSYM Voice5SustainL2, resb 1 -NEWSYM Voice6SustainL2, resb 1 -NEWSYM Voice7SustainL2, resb 1 - -NEWSYM Voice0SustainR, resd 1 -NEWSYM Voice1SustainR, resd 1 -NEWSYM Voice2SustainR, resd 1 -NEWSYM Voice3SustainR, resd 1 -NEWSYM Voice4SustainR, resd 1 -NEWSYM Voice5SustainR, resd 1 -NEWSYM Voice6SustainR, resd 1 -NEWSYM Voice7SustainR, resd 1 - -NEWSYM Voice0SustainR2, resd 1 -NEWSYM Voice1SustainR2, resd 1 -NEWSYM Voice2SustainR2, resd 1 -NEWSYM Voice3SustainR2, resd 1 -NEWSYM Voice4SustainR2, resd 1 -NEWSYM Voice5SustainR2, resd 1 -NEWSYM Voice6SustainR2, resd 1 -NEWSYM Voice7SustainR2, resd 1 - -NEWSYM Voice0IncNumber, resd 1 -NEWSYM Voice1IncNumber, resd 1 -NEWSYM Voice2IncNumber, resd 1 -NEWSYM Voice3IncNumber, resd 1 -NEWSYM Voice4IncNumber, resd 1 -NEWSYM Voice5IncNumber, resd 1 -NEWSYM Voice6IncNumber, resd 1 -NEWSYM Voice7IncNumber, resd 1 - -; END formerly initialized to 1 junk - -NEWSYM Voice0SLenNumber, resd 1 -NEWSYM Voice1SLenNumber, resd 1 -NEWSYM Voice2SLenNumber, resd 1 -NEWSYM Voice3SLenNumber, resd 1 -NEWSYM Voice4SLenNumber, resd 1 -NEWSYM Voice5SLenNumber, resd 1 -NEWSYM Voice6SLenNumber, resd 1 -NEWSYM Voice7SLenNumber, resd 1 - -NEWSYM Voice0SEndNumber, resd 1 -NEWSYM Voice1SEndNumber, resd 1 -NEWSYM Voice2SEndNumber, resd 1 -NEWSYM Voice3SEndNumber, resd 1 -NEWSYM Voice4SEndNumber, resd 1 -NEWSYM Voice5SEndNumber, resd 1 -NEWSYM Voice6SEndNumber, resd 1 -NEWSYM Voice7SEndNumber, resd 1 - -NEWSYM Voice0SEndLNumber, resd 1 -NEWSYM Voice1SEndLNumber, resd 1 -NEWSYM Voice2SEndLNumber, resd 1 -NEWSYM Voice3SEndLNumber, resd 1 -NEWSYM Voice4SEndLNumber, resd 1 -NEWSYM Voice5SEndLNumber, resd 1 -NEWSYM Voice6SEndLNumber, resd 1 -NEWSYM Voice7SEndLNumber, resd 1 - -; MORE junk that was initialized to 1 - -NEWSYM Voice0DecreaseNumber, resd 1 -NEWSYM Voice1DecreaseNumber, resd 1 -NEWSYM Voice2DecreaseNumber, resd 1 -NEWSYM Voice3DecreaseNumber, resd 1 -NEWSYM Voice4DecreaseNumber, resd 1 -NEWSYM Voice5DecreaseNumber, resd 1 -NEWSYM Voice6DecreaseNumber, resd 1 -NEWSYM Voice7DecreaseNumber, resd 1 - -NEWSYM Voice0EnvInc, resd 1 -NEWSYM Voice1EnvInc, resd 1 -NEWSYM Voice2EnvInc, resd 1 -NEWSYM Voice3EnvInc, resd 1 -NEWSYM Voice4EnvInc, resd 1 -NEWSYM Voice5EnvInc, resd 1 -NEWSYM Voice6EnvInc, resd 1 -NEWSYM Voice7EnvInc, resd 1 - -; END initialized to 1 junk - -; 0 = Direct, 1 = Increase, 2 = Increase2, 3 = Decrease, 4 = Decrease2 -NEWSYM Voice0GainType, resb 1 -NEWSYM Voice1GainType, resb 1 -NEWSYM Voice2GainType, resb 1 -NEWSYM Voice3GainType, resb 1 -NEWSYM Voice4GainType, resb 1 -NEWSYM Voice5GainType, resb 1 -NEWSYM Voice6GainType, resb 1 -NEWSYM Voice7GainType, resb 1 - -; YET ANOTHER block that was initialized to 1 - -NEWSYM Voice0GainTime, resd 1 -NEWSYM Voice1GainTime, resd 1 -NEWSYM Voice2GainTime, resd 1 -NEWSYM Voice3GainTime, resd 1 -NEWSYM Voice4GainTime, resd 1 -NEWSYM Voice5GainTime, resd 1 -NEWSYM Voice6GainTime, resd 1 -NEWSYM Voice7GainTime, resd 1 - -NEWSYM useless, resd 2 ;This is needed because of the stupid - ;alignment dependency in the savestates. - -NEWSYM Freqdisp, resd 1 -NEWSYM SBRateb, resd 1 - -NEWSYM Voice0Looped, resb 1 -NEWSYM Voice1Looped, resb 1 -NEWSYM Voice2Looped, resb 1 -NEWSYM Voice3Looped, resb 1 -NEWSYM Voice4Looped, resb 1 -NEWSYM Voice5Looped, resb 1 -NEWSYM Voice6Looped, resb 1 -NEWSYM Voice7Looped, resb 1 - -VoiceNoiseEn resb 8 -NEWSYM GainDecBendDataPos, resb 8 -NEWSYM GainDecBendDataTime, resd 8 -NEWSYM GainDecBendDataDat, resb 8 - -NEWSYM AdsrBlocksLeft, resb 8 -NEWSYM AdsrNextTimeDepth, resd 8 - -TimeTemp resd 8 ; 104 bytes -IncNTemp resd 8 -EnvITemp resd 8 -StatTemp resd 2 - -NEWSYM FutureExpand, resb 44 -; pharos equ hack *sigh* -marksave: - -NEWSYM echoon0, resb 1 -NEWSYM echoon1, resb 1 -NEWSYM echoon2, resb 1 -NEWSYM echoon3, resb 1 -NEWSYM echoon4, resb 1 -NEWSYM echoon5, resb 1 -NEWSYM echoon6, resb 1 -NEWSYM echoon7, resb 1 - -NEWSYM GlobalVL, resd 1 -NEWSYM GlobalVR, resd 1 -NEWSYM EchoVL, resd 1 -NEWSYM EchoVR, resd 1 -NEWSYM EchoT, resd 1 - -NEWSYM Voice0Volumee, resb 1 -NEWSYM Voice1Volumee, resb 1 -NEWSYM Voice2Volumee, resb 1 -NEWSYM Voice3Volumee, resb 1 -NEWSYM Voice4Volumee, resb 1 -NEWSYM Voice5Volumee, resb 1 -NEWSYM Voice6Volumee, resb 1 -NEWSYM Voice7Volumee, resb 1 - -NEWSYM Voice0VolumeRe, resb 1 -NEWSYM Voice1VolumeRe, resb 1 -NEWSYM Voice2VolumeRe, resb 1 -NEWSYM Voice3VolumeRe, resb 1 -NEWSYM Voice4VolumeRe, resb 1 -NEWSYM Voice5VolumeRe, resb 1 -NEWSYM Voice6VolumeRe, resb 1 -NEWSYM Voice7VolumeRe, resb 1 - -NEWSYM Voice0VolumeLe, resb 1 -NEWSYM Voice1VolumeLe, resb 1 -NEWSYM Voice2VolumeLe, resb 1 -NEWSYM Voice3VolumeLe, resb 1 -NEWSYM Voice4VolumeLe, resb 1 -NEWSYM Voice5VolumeLe, resb 1 -NEWSYM Voice6VolumeLe, resb 1 -NEWSYM Voice7VolumeLe, resb 1 - -NEWSYM FIRTAPVal0, resd 1 -NEWSYM FIRTAPVal1, resd 1 -NEWSYM FIRTAPVal2, resd 1 -NEWSYM FIRTAPVal3, resd 1 -NEWSYM FIRTAPVal4, resd 1 -NEWSYM FIRTAPVal5, resd 1 -NEWSYM FIRTAPVal6, resd 1 -NEWSYM FIRTAPVal7, resd 1 - -NEWSYM CEchoPtr, resd 1 -NEWSYM EchoFB, resd 1 - -NEWSYM Voice0Ptre, resd 1 ; Ptr to Next BRR Block to be played -NEWSYM Voice1Ptre, resd 1 -NEWSYM Voice2Ptre, resd 1 -NEWSYM Voice3Ptre, resd 1 -NEWSYM Voice4Ptre, resd 1 -NEWSYM Voice5Ptre, resd 1 -NEWSYM Voice6Ptre, resd 1 -NEWSYM Voice7Ptre, resd 1 -NEWSYM Voice0LoopPtre, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice1LoopPtre, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice2LoopPtre, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice3LoopPtre, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice4LoopPtre, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice5LoopPtre, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice6LoopPtre, resd 1 ; Ptr to Loop BRR Block to be played -NEWSYM Voice7LoopPtre, resd 1 ; Ptr to Loop BRR Block to be played - -NEWSYM Voice0BufPtre, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice1BufPtre, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice2BufPtre, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice3BufPtre, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice4BufPtre, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice5BufPtre, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice6BufPtre, resd 1 ; Ptr to Buffer Block to be played -NEWSYM Voice7BufPtre, resd 1 ; Ptr to Buffer Block to be played - -NEWSYM CurFiltPtr, resd 1 -NEWSYM FiltLoop, resd 16 -NEWSYM FiltLoopR, resd 16 - -NEWSYM SoundLooped0, resb 1 -NEWSYM SoundLooped1, resb 1 -NEWSYM SoundLooped2, resb 1 -NEWSYM SoundLooped3, resb 1 -NEWSYM SoundLooped4, resb 1 -NEWSYM SoundLooped5, resb 1 -NEWSYM SoundLooped6, resb 1 -NEWSYM SoundLooped7, resb 1 - -NEWSYM UniqueSoundv, resd 1 - -NEWSYM Voice0FirstBlock, resb 1 -NEWSYM Voice1FirstBlock, resb 1 -NEWSYM Voice2FirstBlock, resb 1 -NEWSYM Voice3FirstBlock, resb 1 -NEWSYM Voice4FirstBlock, resb 1 -NEWSYM Voice5FirstBlock, resb 1 -NEWSYM Voice6FirstBlock, resb 1 -NEWSYM Voice7FirstBlock, resb 1 - -marksave2: - -SECTION .data -ALIGN32 - -NEWSYM MaxEcho, dd 172 - -; |AR Time 0 to 1|DR|Time 1 to SL|SL|Ratio| SR Time 1to 1/10| -;--------------------------------------------------------------------- -; |0 | 4.1 sec | 0| 1.2 sec | 0| 1/8 | 0| INF |10|1.2 sec -; |1 | 2.6 | 1| 740 msec | 1| 2/8 | 1| 38 |11|880 msec -; |2 | 1.5 | 2| 440 | 2| 3/8 | 2| 28 |12|740 -; |3 | 1.0 | 3| 290 | 3| 4/8 | 3| 24 |13|590 -; |4 |640 msec | 4| 180 | 4| 5/8 | 4| 19 |14|440 -; |5 |380 | 5| 110 | 5| 6/8 | 5| 14 |15|370 -; |6 |260 | 6| 74 | 6| 7/8 | 6| 12 |16|290 -; |7 |160 | 7| 37 | 7| 1 | 7| 9.4 |17|220 -; |8 | 96 -------------------------- 8| 7.1 |18|180 -; |9 | 64 | | 9| 5.9 |19|150 -; |A | 40 | | A| 4.7 |1A|110 -; |B | 24 | | B| 3.5 |1B| 92 -; |C | 16 | | C| 2.9 |1C| 74 -; |D | 10 | | D| 2.4 |1D| 55 -; |E | 6 | | E| 1.8 |1E| 37 -; |F | 0 | | F| 1.5 |1F| 28 -; --------------- --------------------------- - -; All the values are in 1/11025 - -NEWSYM EchoRate - dd 2,172,344,517,689,861,1033,1205,1378,1550,1722,1895, - dd 2067,2239,2412,2584 - -NEWSYM AttackRate - dd 45202,28665,16537,11025,7056,4189,2866,1764,1058,705,441 - dd 264,176,110,66,4 - -NEWSYM DecayRate - dd 13230,8158,4851,2697,1984,815,407,125 -NEWSYM SustainRate - dd 0FFFFFFFFh,418950,308700,265600,209475,154350,132300 - dd 103635,78277,65047,51817,38587,31972,26460,19845,16537 - dd 13230,9702,8158,6504,4851,3879,2697,1450 - dd 1212,1014,815,606,407,202,125,70 - -NEWSYM SustainValue - db 15,31,47,63,79,95,111,127 - -NEWSYM Increase - dd 0FFFFFFFFh,45202,34177,28665,22050,16537,14332,11025 - dd 8489,7056,5622,4189,3528,2866,2094,1764 - dd 1433,1058,882,705,529,441,352,264 - dd 220,176,132,110,88,66,44,22 - -NEWSYM IncreaseBent - dd 0FFFFFFFFh,79100,59535,50160,38580,28665,25000,19250 - dd 14332,12127,9800,7320,6160,4961,3650,3060 - dd 2425,1845,1540,1212,920,770,614,460 - dd 383,306,229,190,152,113,75,36 - -NEWSYM Decrease - dd 0FFFFFFFFh,45202,34177,28665,22050,16537,14332,11025 - dd 8489,7056,5622,4189,3528,2866,2094,1764 - dd 1433,1058,882,705,529,441,352,264 - dd 220,176,132,110,88,66,44,22 - -NEWSYM DecreaseRateExp - dd 0FFFFFFFFh,418950,308700,264600,209470,154350,132300,103635 - dd 78277,65047,51817,38587,31972,26460,19845,16537 - dd 13230,9702,8158,6504,4851,4079,3197,2425 - dd 1984,1653,1212,1014,815,606,407,198 - -GainDecBendData db 118,110,102,95,89,83,77,72,67,62,58,54,50,47,44,41,38,35 - db 33,30,28,26,24,23,21,20,18,17,16,15,14,13 - db 12,11,10,9,9,8,7,7,6,6,5,5,5,4,4,4,3,3,3,3,2,2,2,2,2,1,1,1,1 - db 255 - -AdsrBendData db 122,118,114,110,106,102,99,95,92,89,86,83,80,77,74,72,69,67 - db 64,62,60,58,56,54,52,50,48,47,45,44,42,41,39,38,36,35,34,33 - db 32,30,29,28,27,26,25,24,24,23,22,21,20,20,19,18,18,17,16,16 - db 15,15,14,14,13,13,12,12,11,11,11,10,10,9,9,9,8,8,8,7,7,7,7,6 - db 6,6,6,5,5,5,5,5,4,4,4,4,4,4,4,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2 - db 2,2,1,1,1,1,1,1,1,1,1,1,1,1,255 - -NEWSYM AdsrSustLevLoc, db 58,39,27,19,13,8,3,1 - -dspsave equ marksave-BRRBuffer -dspconvb equ marksave-Voice0Freq -dspsave2 equ marksave2-echoon0 -NEWSYM PHdspsave, dd dspsave -NEWSYM PHdspconvb, dd dspconvb -NEWSYM PHdspsave2, dd dspsave2 - -SECTION .bss -spc700temp resd 2 -SECTION .text - -%macro VoiceStart 2 - mov byte[Voice0FirstBlock+%1],1 - mov dword[spc700temp+4],0 - cmp byte[Voice0Status+%1],0 - je .moveon - push eax - mov eax,[Voice0EnvInc+%1*4] - mov [spc700temp],eax - mov dword[spc700temp+4],1 - pop eax -.moveon - mov byte[Voice0Status+%1],0 - push eax - push ebx - push edx - mov eax,[DSPMem+%1*10h] - cmp al,40h - jae .noskip - cmp ah,40h - jae .noskip - mov eax,[DSPMem+%1*10h+4] - cmp eax,0050FF07h - jne .noskip - cmp byte[DSPMem+5Dh],6 - jne .noskip - mov byte[DSPMem+%1*10h],15 - mov byte[DSPMem+%1*10h+1],15 - pop edx - pop ebx - pop eax - ret -.noskip - - ; Check if adsr or gain - test byte[DSPMem+05h+%1*10h],80h - jz near .gain - - ; Calculate attack rate - movzx eax,byte[DSPMem+05h+%1*10h] - and al,0Fh - cmp eax,0Fh - je .skipattack - mov ebx,[AttackRate+eax*4] - mov [Voice0Time+%1*4],ebx - xor edx,edx - mov eax,127*65536 - div ebx - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],8 - mov dword[Voice0EnvInc+%1*4],0 - mov byte[GainDecBendDataDat+%1],7Fh - mov byte[Voice0Status+%1],1 - jmp .finproc -.skipattack - mov al,[DSPMem+05h+%1*10h] - shr al,4 - and eax,07h - mov edx,[DecayRate+eax*4] - movzx eax,byte[DSPMem+06h+%1*10h] - and al,1Fh - mov ebx,[SustainRate+eax*4] - cmp edx,ebx - jae near .decayover - - ; ebx = total sustain time - movzx eax,byte[DSPMem+06h+%1*10h] - shr al,5 - mov al,[AdsrSustLevLoc+eax] - ; traverse through al entries in edx time - ; then through 64-al entries in ebx-edx time - mov [AdsrBlocksLeft+%1],al - sub ebx,edx - push ebx - push eax - mov ebx,eax - mov eax,edx - xor edx,edx - div ebx - mov [Voice0Time+%1*4],eax - mov [GainDecBendDataTime+%1*4],eax - pop eax - pop ebx - mov edx,ebx - mov ebx,64 - sub bl,al - mov eax,edx - xor edx,edx - div ebx - mov [AdsrNextTimeDepth+%1*4],eax - mov dword[Voice0EnvInc+%1*4],007FFFFFh - mov ebx,[Voice0Time+%1*4] - xor edx,edx - mov eax,127*65536 - sub eax,122*65536 - mov byte[GainDecBendDataPos+%1],0 - mov byte[GainDecBendDataDat+%1],127 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],9 - mov byte[Voice0Status+%1],1 - jmp .finproc -.decayover - sub edx,ebx - push ebx - mov eax,edx - movzx ebx,byte[DSPMem+06h+%1*10h] - shr bl,5 - xor bl,07h - mul ebx - mov ebx,7 - div ebx - pop ebx - add ebx,eax - mov dword[Voice0EnvInc+%1*4],007FFFFFh - shr ebx,5 - mov [Voice0Time+%1*4],ebx - mov [GainDecBendDataTime+%1*4],ebx - xor edx,edx - mov eax,127*65536 - sub eax,118*65536 - mov byte[GainDecBendDataPos+%1],0 - mov byte[GainDecBendDataDat+%1],127 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],7 - mov byte[Voice0Status+%1],1 - jmp .finproc -.gain - test byte[DSPMem+07h+%1*10h],80h - jz near .Direct - test byte[DSPMem+07h+%1*10h],40h - jnz near .Increase - test byte[DSPMem+07h+%1*10h],20h - jz .LinearDec - movzx eax,byte[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[DecreaseRateExp+eax*4] - mov dword[Voice0EnvInc+%1*4],007FFFFFh - shr ebx,5 - mov [Voice0Time+%1*4],ebx - mov [GainDecBendDataTime+%1*4],ebx - xor edx,edx - mov eax,127*65536 - sub eax,118*65536 - mov byte[GainDecBendDataPos+%1],0 - mov byte[GainDecBendDataDat+%1],127 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],7 - mov byte[Voice0Status+%1],1 - jmp .finproc -.LinearDec - movzx eax,byte[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Decrease+eax*4] - mov dword[Voice0EnvInc+%1*4],007FFFFFh - mov [Voice0Time+%1*4],ebx - xor edx,edx - mov eax,127*65536 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],5 - mov byte[Voice0Status+%1],1 - jmp .finproc -.Increase - test byte[DSPMem+07h+%1*10h],20h - jz .LinearInc - movzx eax,byte[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Increase+eax*4] - mov dword[Voice0EnvInc+%1*4],0 - mov [Voice0Time+%1*4],ebx - xor edx,edx - mov eax,127*65536 - div ebx - mov [Voice0IncNumber+%1*4],eax - mov ebx,[Voice0Time+%1*4] - mov eax,ebx - shr eax,2 - sub ebx,eax - dec ebx - mov [Voice0Time+%1*4],ebx - mov byte[Voice0State+%1],6 - mov byte[Voice0Status+%1],1 - jmp .finproc -.LinearInc - movzx eax,byte[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Increase+eax*4] - mov dword[Voice0EnvInc+%1*4],0 - mov [Voice0Time+%1*4],ebx - xor edx,edx - mov eax,127*65536 - div ebx - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],3 - mov byte[Voice0Status+%1],1 - jmp .finproc -.Direct - mov al,[DSPMem+07h+%1*10h] - and al,7Fh - mov dword[Voice0EnvInc+%1*4],0 - mov [Voice0EnvInc+%1*4+2],al - mov dword[Voice0Time+%1*4],0FFFFFFFFh - mov dword[Voice0IncNumber+%1*4],0 - mov byte[Voice0State+%1],4 - mov byte[Voice0Status+%1],1 - jmp .finproc -.finproc - cmp dword[spc700temp+4],0 - je .skipall - mov eax,[Voice0Time+%1*4] - mov [TimeTemp+%1*4],eax - mov eax,[Voice0IncNumber+%1*4] - mov [IncNTemp+%1*4],eax - mov eax,[Voice0EnvInc+%1*4] - mov [EnvITemp+%1*4],eax - mov al,[Voice0State+%1] - mov [StatTemp+%1],al - mov eax,[spc700temp] - mov [Voice0EnvInc+%1*4],eax - mov dword[Voice0Time+%1*4],127 - shr eax,7 - neg eax - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],210 - jmp .novoice -.skipall - mov ax,[DSPMem+02h+%1*10h] - cmp word[Voice0Pitch+%1*2],ax - je .nopitchc - mov [Voice0Pitch+%1*2],ax - And EAX, 03FFFh - Mul dword[dspPAdj] - ShRD EAX,EDX,8 - mov [Voice0Freq+%1*4],eax - ; modpitch -.nopitchc - mov dword[BRRPlace0+%1*8],10000000h - mov dword[Voice0Prev0+%1*4],0 - mov dword[Voice0Prev1+%1*4],0 - mov byte[Voice0End+%1],0 - mov byte[Voice0Loop+%1],0 - mov dword[PSampleBuf+%1*24*4+16*4],0 - mov dword[PSampleBuf+%1*24*4+17*4],0 - mov dword[PSampleBuf+%1*24*4+18*4],0 - mov byte[SoundLooped0+%1],0 - mov byte[echoon0+%1],0 - test byte[DSPMem+4Dh],%2 - jz .noecho - mov byte[echoon0+%1],1 -.noecho -.novoice - mov edx,[DSPMem+04h+%1*10h] - and edx,0ffh - shl edx,2 - xor eax,eax - mov ah,[DSPMem+5Dh] - add ax,dx - movzx ebx,word[SPCRAM+eax] - mov [Voice0Ptr+%1*4],ebx - movzx ebx,word[SPCRAM+eax+2] - mov [Voice0LoopPtr+%1*4],ebx - pop edx - pop ebx - pop eax - ret -%endmacro - -NEWSYM Voice0Start - VoiceStart 0,1 - ret - -NEWSYM Voice1Start - VoiceStart 1,2 - ret - -NEWSYM Voice2Start - VoiceStart 2,4 - ret - -NEWSYM Voice3Start - VoiceStart 3,8 - ret - -NEWSYM Voice4Start - VoiceStart 4,16 - ret - -NEWSYM Voice5Start - VoiceStart 5,32 - ret - -NEWSYM Voice6Start - VoiceStart 6,64 - ret - -NEWSYM Voice7Start - VoiceStart 7,128 - ret - -; mov byte[Voice0Env+%1],3Fh -; jmp .Adsr -; Pass both voice # and next function name - -%macro VoiceStarterM 1 - cmp al,%1 - jne near %%nope - push edx - mov eax,[TimeTemp+%1*4] - mov [Voice0Time+%1*4],eax - mov eax,[IncNTemp+%1*4] - mov [Voice0IncNumber+%1*4],eax - mov eax,[EnvITemp+%1*4] - mov [Voice0EnvInc+%1*4],eax - mov al,[StatTemp+%1] - mov [Voice0State+%1],al - - mov byte[SoundLooped0+%1],0 - mov byte[echoon0+%1],0 - test byte[DSPMem+4Dh],1 << %1 - jz %%noecho - mov byte[echoon0+%1],1 -%%noecho - mov edx,[DSPMem+04h+%1*10h] - and edx,0ffh - shl edx,2 - xor eax,eax - mov ah,[DSPMem+5Dh] - add ax,dx - movzx ebx,word[SPCRAM+eax] - mov [Voice0Ptr+%1*4],ebx - movzx ebx,word[SPCRAM+eax+2] - mov [Voice0LoopPtr+%1*4],ebx - mov ax,[DSPMem+02h+%1*10h] - cmp word[Voice0Pitch+%1*2],ax - je %%nopitchc - mov [Voice0Pitch+%1*2],ax - And EAX, 03FFFh - Mul dword[dspPAdj] - ShRD EAX,EDX,8 - mov [Voice0Freq+%1*4],eax - ; modpitch -%%nopitchc - mov dword[BRRPlace0+%1*8],10000000h - mov dword[Voice0Prev0+%1*4],0 - mov dword[Voice0Prev1+%1*4],0 - mov byte[Voice0End+%1],0 - mov byte[Voice0Loop+%1],0 - mov dword[PSampleBuf+%1*24*4+16*4],0 - mov dword[PSampleBuf+%1*24*4+17*4],0 - mov dword[PSampleBuf+%1*24*4+18*4],0 - pop edx - ret -%%nope -%endmacro - -NEWSYM VoiceStarter - VoiceStarterM 0 - VoiceStarterM 1 - VoiceStarterM 2 - VoiceStarterM 3 - VoiceStarterM 4 - VoiceStarterM 5 - VoiceStarterM 6 - VoiceStarterM 7 - ret - -section .bss -NEWSYM NoiseInc, resd 1 -NEWSYM NoisePointer, resd 1 -NEWSYM LastNoise, resd 1 -section .text - -%macro CalculatePMod 1 - movzx eax,byte[PModBuffer+esi] - mov ebx,[Voice0Freq+%1*4] - add al,80h - mul ebx - shr eax,7 - shl edx,25 - or eax,edx - mov ebx,eax -%endmacro - -%macro ProcessPMod 1 - push ecx - push edx - mov cl,[Voice0EnvInc+%1*4+2] - mov ax,[edi+edx*2] - imul cx - shr ax,7 - add dl,dl - or ah,dl - mov [PModBuffer+esi],ah - pop edx - pop ecx -%endmacro - -section .bss -powhack resd 1 -paramhack resd 4 -section .text - -ALIGN16 -NEWSYM NonEchoMonoPM -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0Volume+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - movzx eax,byte[Voice0Volume+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] - mov edx,[BRRPlace0+ebp*8+3] -%endif - mov cx,[VolumeConvTable+eax*2] - cmp byte[UniqueSoundv],0 - je .NotNoise1 - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1 -.PMod - ProcessPMod ebp -.NotNoise1 - mov ax,[edi+edx*2] -.AfterNoise1 - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [DSPBuffer+esi*2],eax - add esi,2 - CalculatePMod ebp -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -ALIGN16 -NEWSYM NonEchoStereoPM -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeR+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - movzx eax,byte[Voice0VolumeR+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] - mov edx,[BRRPlace0+ebp*8+3] -%endif - mov cx,[VolumeConvTable+eax*2] - cmp byte[UniqueSoundv],0 - je .NotNoise1b - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1b -.PMod - ProcessPMod ebp -.NotNoise1b - mov ax,[edi+edx*2] -.AfterNoise1b - movsx eax,ax - push eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeL+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeL+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - add esi,2 - mov cx,[VolumeConvTable+eax*2] - pop eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4-4],eax - CalculatePMod ebp -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -ALIGN16 -NEWSYM EchoMonoPM -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0Volume+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - movzx eax,byte[Voice0Volume+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] - mov edx,[BRRPlace0+ebp*8+3] -%endif - mov cx,[VolumeConvTable+eax*2] - cmp byte[UniqueSoundv],0 - je .NotNoise1 - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1 -.PMod - ProcessPMod ebp -.NotNoise1 - mov ax,[edi+edx*2] -.AfterNoise1 - movsx eax,ax - push eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [DSPBuffer+esi*2],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0Volumee+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0Volumee+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - pop eax - - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [EchoBuffer+esi*2],eax - - add esi,2 - CalculatePMod ebp -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -ALIGN16 -NEWSYM EchoStereoPM -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeR+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - movzx eax,byte[Voice0VolumeR+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] - mov edx,[BRRPlace0+ebp*8+3] -%endif - mov cx,[VolumeConvTable+eax*2] - cmp byte[UniqueSoundv],0 - je .NotNoise1b - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1b -.PMod - ProcessPMod ebp -.NotNoise1b - mov ax,[edi+edx*2] -.AfterNoise1b - movsx eax,ax - mov ebx,eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeRe+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] - mov cx,[ds:VolumeConvTable+eax*2] -%else - movzx eax,byte[Voice0VolumeRe+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] - mov cx,[VolumeConvTable+eax*2] -%endif - mov eax,ebx - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [EchoBuffer+esi*4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeL+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeL+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - - mov eax,ebx - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4+4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeLe+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeLe+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - mov eax,ebx - - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax -%ifdef __MSDOS__ - mov ebx,[ds:Voice0Freq+ebp*4] -%else - mov ebx,[Voice0Freq+ebp*4] -%endif - add [EchoBuffer+esi*4+4],eax - - add esi,2 - CalculatePMod ebp -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -; interpolation is only done when the rate < mixRate, so ebx always contains -; less than 100000h. - -SECTION .data -ALIGN16 -NEWSYM DSPInterpolate, dd 0 - -SECTION .text - -ALIGN16 -DSPInterpolate_4 - push edi -%ifdef __MSDOS__ - lea edi,[ds:ebp*2+ebp] -%else - lea edi,[ebp*2+ebp] -%endif - shl edi,5 -%ifdef __MSDOS__ - movzx ebx,byte[ds:BRRPlace0+ebp*8+2] -%else - movzx ebx,byte[BRRPlace0+ebp*8+2] -%endif - - mov ax,[PSampleBuf+edx*4+8+edi] - mov dx,[DSPInterP+ebx*2+256*6] - imul dx - shl edx,16 - mov dx,ax -%ifdef __MSDOS__ - mov eax,[ds:BRRPlace0+ebp*8+3] -%else - mov eax,[BRRPlace0+ebp*8+3] -%endif - mov ecx,edx - - mov ax,[PSampleBuf+eax*4+12+edi] - mov dx,[DSPInterP+ebx*2+256*4] - imul dx - shl edx,16 - mov dx,ax -%ifdef __MSDOS__ - mov eax,[ds:BRRPlace0+ebp*8+3] -%else - mov eax,[BRRPlace0+ebp*8+3] -%endif - add ecx,edx - - mov ax,[PSampleBuf+eax*4+16+edi] - mov dx,[DSPInterP+ebx*2+256*2] - imul dx - shl edx,16 - mov dx,ax -%ifdef __MSDOS__ - mov eax,[ds:BRRPlace0+ebp*8+3] -%else - mov eax,[BRRPlace0+ebp*8+3] -%endif - add ecx,edx - - mov ax,[PSampleBuf+eax*4+20+edi] - mov dx,[DSPInterP+ebx*2] - imul dx - shl edx,16 - mov dx,ax - add ecx,edx - - sar ecx,11 - - cmp ecx, -32768 - jge .sat1 - mov ecx, -32768 -.sat1 - cmp ecx, 32767 - jle .sat2 - mov ecx, 32767 -.sat2 - - mov ax,cx - pop edi - ret - -ALIGN16 -DSPInterpolate_8: - - push edi -%ifdef __MSDOS__ - lea edi,[ds:ebp*2+ebp] -%else - lea edi,[ebp*2+ebp] -%endif - shl edi,5 -%ifdef __MSDOS__ - mov ebx,[ds:BRRPlace0+ebp*8] - movzx eax,byte[ds:BRRPlace0+ebp*8+3] -%else - mov ebx,[BRRPlace0+ebp*8] - movzx eax,byte[BRRPlace0+ebp*8+3] -%endif - shl eax,2 - and ebx,0FFFFFFh - add ebx,1000h - shr ebx,9 - and ebx,0FFF0h - add ebx,fir_lut - movq mm0,[eax+PSampleBuf+edi] - packssdw mm0,[eax+PSampleBuf+edi+8] - movq mm1,[eax+PSampleBuf+edi+16] - packssdw mm1,[eax+PSampleBuf+edi+24] - movq mm2,[ebx] - movq mm3,[ebx+8] - pmaddwd mm0,mm2 - pmaddwd mm1,mm3 - paddd mm0,mm1 - movq mm1,mm0 - psrlq mm0, 32 - paddd mm0, mm1 - psrad mm0, 14 - packssdw mm0, mm0 - movd eax, mm0 - movsx eax, ax -.end - pop edi - ret - -ALIGN16 -DSPInterpolate_4_mmx: - - push edi -%ifdef __MSDOS__ - lea edi,[ds:ebp*2+ebp] -%else - lea edi,[ebp*2+ebp] -%endif - shl edi,5 -%ifdef __MSDOS__ - movzx eax,byte[ds:BRRPlace0+ebp*8+2] -%else - movzx eax,byte[BRRPlace0+ebp*8+2] -%endif - movq mm0,[edx*4+PSampleBuf+edi+8] - packssdw mm0,[edx*4+PSampleBuf+edi+16] - movq mm1,[DSPInterP+eax*8] - pmaddwd mm0,mm1 - movq mm1, mm0 - psrlq mm0, 32 - paddd mm0, mm1 - psrad mm0, 11 - packssdw mm0, mm0 - movd eax, mm0 - emms - pop edi - ret - -ALIGN16 -NEWSYM NonEchoMonoInterpolated -%ifdef __MSDOS__ - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - mov edx,[BRRPlace0+ebp*8+3] -%endif - cmp byte[UniqueSoundv],0 - je .NotNoise1 - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1 -.PMod - ProcessPMod ebp -.NotNoise1 - call [DSPInterpolate] ;ebp -; mov edx,[BRRPlace0+ebp*8+3] -; mov ax,[edi+edx*2] - ; DSPInterP (Samp*i+Samp2*i2+Samp3*i3+Samp4*i3)>>11 -.AfterNoise1 -%ifdef __MSDOS__ - movzx edx,byte[ds:Voice0Volume+ebp] - mov dh,[ds:Voice0EnvInc+ebp*4+2] - mov ebx,[ds:Voice0Freq+ebp*4] -%else - movzx edx,byte[Voice0Volume+ebp] - mov dh,[Voice0EnvInc+ebp*4+2] - mov ebx,[Voice0Freq+ebp*4] -%endif - mov cx,[VolumeConvTable+edx*2] - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [DSPBuffer+esi*2],eax - add esi,2 -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -ALIGN16 -NEWSYM EchoMonoInterpolated -%ifdef __MSDOS__ - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - mov edx,[BRRPlace0+ebp*8+3] -%endif - cmp byte[UniqueSoundv],0 - je .NotNoise1 - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1 -.PMod - ProcessPMod ebp -.NotNoise1 - call [DSPInterpolate] ;ebp -; mov edx,[BRRPlace0+ebp*8+3] -; mov ax,[edi+edx*2] -.AfterNoise1 -%ifdef __MSDOS__ - movzx edx,byte[ds:Voice0Volume+ebp] - mov dh,[ds:Voice0EnvInc+ebp*4+2] - mov ebx,[ds:Voice0Freq+ebp*4] -%else - movzx edx,byte[Voice0Volume+ebp] - mov dh,[Voice0EnvInc+ebp*4+2] - mov ebx,[Voice0Freq+ebp*4] -%endif - mov cx,[VolumeConvTable+edx*2] -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx ; *** -%else - add [BRRPlace0+ebp*8],ebx ; *** -%endif - add esi,2 ; *** - mov ebx,eax - - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [DSPBuffer+esi*2-4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0Volumee+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0Volumee+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - - mov eax,ebx - - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [EchoBuffer+esi*2-4],eax - ret - -ALIGN16 -NEWSYM NonEchoStereoInterpolated -%ifdef __MSDOS__ - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - mov edx,[BRRPlace0+ebp*8+3] -%endif - cmp byte[UniqueSoundv],0 - je .NotNoise1b - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1b -.PMod - ProcessPMod ebp -.NotNoise1b - call [DSPInterpolate]; %1 -.AfterNoise1b -%ifdef __MSDOS__ - movzx edx,byte[ds:Voice0VolumeR+ebp] - mov dh,[ds:Voice0EnvInc+ebp*4+2] - mov ebx,[ds:Voice0Freq+ebp*4] -%else - movzx edx,byte[Voice0VolumeR+ebp] - mov dh,[Voice0EnvInc+ebp*4+2] - mov ebx,[Voice0Freq+ebp*4] -%endif - mov cx,[VolumeConvTable+edx*2] - - movsx eax,ax - push eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeL+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeL+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - add esi,2 - mov cx,[VolumeConvTable+eax*2] - pop eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4-4],eax -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -ALIGN16 -NEWSYM EchoStereoInterpolated -%ifdef __MSDOS__ - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - mov edx,[BRRPlace0+ebp*8+3] -%endif - cmp byte[UniqueSoundv],0 - je .NotNoise1b - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1b -.PMod - ProcessPMod ebp -.NotNoise1b -; mov ax,[edi+edx*2] - call [DSPInterpolate] ;%1 -.AfterNoise1b -%ifdef __MSDOS__ - movzx edx,byte[ds:Voice0VolumeR+ebp] - mov dh,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx edx,byte[Voice0VolumeR+ebp] - mov dh,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+edx*2] - - movsx eax,ax - mov ebx,eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeRe+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeRe+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - mov eax,ebx - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [EchoBuffer+esi*4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeL+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeL+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - - mov eax,ebx - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4+4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeLe+ebp] - mov ah,[dS:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeLe+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - mov eax,ebx - - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax -%ifdef __MSDOS__ - mov ebx,[ds:Voice0Freq+ebp*4] -%else - mov ebx,[Voice0Freq+ebp*4] -%endif - add [EchoBuffer+esi*4+4],eax - - add esi,2 -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -ALIGN16 -NEWSYM NonEchoMono -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0Volume+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - movzx eax,byte[Voice0Volume+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] - mov edx,[BRRPlace0+ebp*8+3] -%endif - mov cx,[VolumeConvTable+eax*2] - cmp byte[UniqueSoundv],0 - je .NotNoise1 - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1 -.PMod - ProcessPMod ebp -.NotNoise1 - mov ax,[edi+edx*2] -.AfterNoise1 - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [DSPBuffer+esi*2],eax - add esi,2 -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -ALIGN16 -NEWSYM NonEchoStereo -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeR+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - movzx eax,byte[Voice0VolumeR+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] - mov edx,[BRRPlace0+ebp*8+3] -%endif - mov cx,[VolumeConvTable+eax*2] - cmp byte[UniqueSoundv],0 - je .NotNoise1b - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1b -.PMod - ProcessPMod ebp -.NotNoise1b - mov ax,[edi+edx*2] -.AfterNoise1b - movsx eax,ax - push eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeL+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeL+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - add esi,2 - mov cx,[VolumeConvTable+eax*2] - pop eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4-4],eax -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -ALIGN16 -NEWSYM EchoMono -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0Volume+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - movzx eax,byte[Voice0Volume+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] - mov edx,[BRRPlace0+ebp*8+3] -%endif - mov cx,[VolumeConvTable+eax*2] - cmp byte[UniqueSoundv],0 - je .NotNoise1 - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1 -.PMod - ProcessPMod ebp -.NotNoise1 - mov ax,[edi+edx*2] -.AfterNoise1 - movsx eax,ax - push eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [DSPBuffer+esi*2],eax - -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0Volumee+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0Volumee+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - pop eax - - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [EchoBuffer+esi*2],eax - - add esi,2 -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -ALIGN16 -NEWSYM EchoStereo -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeR+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] - mov edx,[ds:BRRPlace0+ebp*8+3] -%else - movzx eax,byte[Voice0VolumeR+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] - mov edx,[BRRPlace0+ebp*8+3] -%endif - mov cx,[VolumeConvTable+eax*2] - cmp byte[UniqueSoundv],0 - je .NotNoise1b - mov al,[powhack] - test byte[DSPMem+3Dh],al - jz .PMod - mov eax, [NoiseInc] - add dword[NoisePointer],eax - mov eax,[NoisePointer] - shr eax,18 ; maybe will need a change - mov ax,[NoiseData+eax*2] - mov [LastNoise],ax - jmp .AfterNoise1b -.PMod - ProcessPMod ebp -.NotNoise1b - mov ax,[edi+edx*2] -.AfterNoise1b - movsx eax,ax - mov ebx,eax - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeRe+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeRe+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - mov eax,ebx - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add [EchoBuffer+esi*4],eax - -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeL+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeL+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - - mov eax,ebx - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax - add dword[DSPBuffer+esi*4+4],eax -%ifdef __MSDOS__ - movzx eax,byte[ds:Voice0VolumeLe+ebp] - mov ah,[ds:Voice0EnvInc+ebp*4+2] -%else - movzx eax,byte[Voice0VolumeLe+ebp] - mov ah,[Voice0EnvInc+ebp*4+2] -%endif - mov cx,[VolumeConvTable+eax*2] - mov eax,ebx - - imul cx - shr ax,7 - add dl,dl - or ah,dl - movsx eax,ax -%ifdef __MSDOS__ - mov ebx,[ds:Voice0Freq+ebp*4] -%else - mov ebx,[Voice0Freq+ebp*4] -%endif - add [EchoBuffer+esi*4+4],eax - - add esi,2 -%ifdef __MSDOS__ - add [ds:BRRPlace0+ebp*8],ebx -%else - add [BRRPlace0+ebp*8],ebx -%endif - ret - -%macro ProcessVoiceStuff 4 - mov ax,[DSPMem+02h+%1*10h] - cmp word[Voice0Pitch+%1*2],ax - je %%nopitchc - mov [Voice0Pitch+%1*2],ax - And EAX, 03FFFh - Mul dword[dspPAdj] - ShRD EAX,EDX,8 - ; modpitch - mov [Voice0Freq+%1*4],eax -%%nopitchc - jmp %%SkipProcess -%%ProcessNextEnvelope - cmp byte[Voice0State+%1],10 - je near %%ADSRSustain - cmp byte[Voice0State+%1],9 - je near %%ADSRDecayProc - cmp byte[Voice0State+%1],7 - je near %%DecreaseBent - cmp byte[Voice0State+%1],8 - je near %%ADSRDecay - cmp byte[Voice0State+%1],1 - je near %%Decay - cmp byte[Voice0State+%1],2 - je near %%Sustain - cmp byte[Voice0State+%1],3 - je near %%Blank - cmp byte[Voice0State+%1],4 - je near %%EndofSamp - cmp byte[Voice0State+%1],200 - je near %%EndofSamp - cmp byte[Voice0State+%1],210 - je near %%EndofSamp2 - cmp byte[Voice0State+%1],5 - je %%MuteGain - cmp byte[Voice0State+%1],6 - je %%IncreaseBent - jmp %%EndofSamp -%%MuteGain - mov dword[Voice0EnvInc+%1*4],0 - mov dword[Voice0IncNumber+%1*4],0 - mov dword[Voice0Time+%1*4],0FFFFFFFFh - jmp %%ContinueGain -%%IncreaseBent - push ebx - movzx eax,byte[DSPMem+07h+%1*10h] - and al,1Fh - mov ebx,[Increase+eax*4] - mov [Voice0Time+%1*4],ebx - shr dword[Voice0IncNumber+%1*4],2 - mov byte[Voice0State+%1],3 - pop ebx - jmp %%ContinueGain -%%ADSRDecay - push ebx - push edx - mov al,[DSPMem+05h+%1*10h] - shr al,4 - and eax,07h - mov edx,[DecayRate+eax*4] - movzx eax,byte[DSPMem+06h+%1*10h] - and al,1Fh - mov ebx,[SustainRate+eax*4] - cmp edx,ebx - jae %%decayover - ; ebx = total sustain time - movzx eax,byte[DSPMem+06h+%1*10h] - shr al,5 - mov al,[AdsrSustLevLoc+eax] - ; traverse through al entries in edx time - ; then through 64-al entries in ebx-edx time - mov [AdsrBlocksLeft+%1],al - sub ebx,edx - push ebx - push eax - mov ebx,eax - mov eax,edx - xor edx,edx - div ebx - mov [Voice0Time+%1*4],eax - mov [GainDecBendDataTime+%1*4],eax - pop eax - pop ebx - mov edx,ebx - mov ebx,64 - sub bl,al - mov eax,edx - xor edx,edx - div ebx - mov [AdsrNextTimeDepth+%1*4],eax - mov dword[Voice0EnvInc+%1*4],007FFFFFh - mov ebx,[Voice0Time+%1*4] - xor edx,edx - mov eax,127*65536-122*65536 - mov byte[GainDecBendDataPos+%1],0 - mov byte[GainDecBendDataDat+%1],127 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - mov byte[Voice0State+%1],9 - jmp %%ContinueGain -%%decayover - sub edx,ebx - push ebx - mov eax,edx - movzx ebx,byte[DSPMem+06h+%1*10h] - shr bl,5 - xor bl,07h - mul ebx - mov ebx,7 - div ebx - pop ebx - add ebx,eax - mov dword[Voice0EnvInc+%1*4],007FFFFFh - shr ebx,5 - mov [Voice0Time+%1*4],ebx - mov [GainDecBendDataTime+%1*4],ebx - xor edx,edx - mov eax,127*65536-118*65536 - mov byte[GainDecBendDataPos+%1],0 - mov byte[GainDecBendDataDat+%1],127 - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - mov byte[Voice0State+%1],7 - jmp %%ContinueGain -%%ADSRDecayProc - push ebx - push edx - mov dword[Voice0EnvInc+%1*4],0 - movzx ebx,byte[GainDecBendDataPos+%1] - movzx edx,byte[GainDecBendDataDat+%1] - mov dh,[AdsrBendData+ebx] - movzx eax,byte[VolumeConvTable+edx*2] - mov [Voice0EnvInc+%1*4+2],al - mov dl,[GainDecBendDataDat+%1] - mov dh,[AdsrBendData+ebx+1] - sub al,[VolumeConvTable+edx*2] - mov ebx,[GainDecBendDataTime+%1*4] - mov [Voice0Time+%1*4],ebx - xor edx,edx - shl eax,16 - inc byte[GainDecBendDataPos+%1] - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - dec byte[AdsrBlocksLeft+%1] - jz %%nomoredecay - jmp %%ContinueGain -%%nomoredecay - mov byte[Voice0State+%1],10 - jmp %%ContinueGain -%%ADSRSustain - push ebx - push edx - mov dword[Voice0EnvInc+%1*4],0 - movzx ebx,byte[GainDecBendDataPos+%1] - movzx edx,byte[GainDecBendDataDat+%1] - mov dh,[AdsrBendData+ebx] - movzx eax,byte[VolumeConvTable+edx*2] - mov [Voice0EnvInc+%1*4+2],al - mov dl,[GainDecBendDataDat+%1] - mov dh,[AdsrBendData+ebx+1] - cmp dh,255 - je %%nomoreadsr - mov dl,[VolumeConvTable+edx*2] - mov ebx,[AdsrNextTimeDepth+%1*4] - sub al,dl - mov [Voice0Time+%1*4],ebx - xor edx,edx - shl eax,16 - inc byte[GainDecBendDataPos+%1] - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - jmp %%ContinueGain -%%nomoreadsr - pop edx - pop ebx - mov byte[Voice0State+%1],5 - jmp %%MuteGain -%%DecreaseBent - push ebx - push edx - movzx ebx,byte[GainDecBendDataPos+%1] - movzx edx,byte[GainDecBendDataDat+%1] - mov dh,[GainDecBendData+ebx] - mov dword[Voice0EnvInc+%1*4],0 - movzx eax,byte[VolumeConvTable+edx*2] - mov [Voice0EnvInc+%1*4+2],al - mov dh,[GainDecBendData+ebx+1] - cmp dh,255 - je %%nomore - mov ebx,[GainDecBendDataTime+%1*4] - sub al,[VolumeConvTable+edx*2] - mov [Voice0Time+%1*4],ebx - xor edx,edx - shl eax,16 - inc byte[GainDecBendDataPos+%1] - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - pop edx - pop ebx - jmp %%ContinueGain -%%nomore - pop edx - pop ebx - mov byte[Voice0State+%1],5 - jmp %%MuteGain -%%Decay - ; Calculate Decay Value - push ebx - push edx - mov dword[Voice0EnvInc+%1*4],07FFFFFh - mov al,[DSPMem+05h+%1*10h] - mov dl,[DSPMem+06h+%1*10h] - shr al,4 - and eax,07h - and edx,1Fh - mov ebx,[DecayRate+eax*4] - cmp edx,1Fh - je %%nodecayfix - cmp ebx,[SustainRate+edx*4] - jbe %%nodecayfix - cmp al,0 - jne %%nodecayskip - mov al,[DSPMem+06h+%1*10h] - and al,0E0h - cmp al,0E0h - je near %%Sustain2 -%%nodecayskip - mov al,[DSPMem+05h+%1*10h] - shr al,4 - and eax,07h - mov ebx,[DecayRate+eax*4] - sub ebx,[SustainRate+edx*4] - cmp ebx,[SustainRate+edx*4] - jae %%nodecayfix - mov ebx,[SustainRate+edx*4] -%%nodecayfix - or ebx,ebx - jnz %%nozero - inc ebx -%%nozero - mov dl,[DSPMem+06h+%1*10h] - shr dl,5 - and dl,07h - mov [Voice0Time+%1*4],ebx - mov al,[SustainValue+edx] - xor al,7Fh - shl eax,16 - xor edx,edx - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],2 - pop edx - pop ebx - mov ebx,[Voice0Freq+%1*4] - cmp dword[DSPInterpolate],0 - je %%notinterpsound - cmp byte[StereoSound],1 - je near %%EndofProcessNEnvsi - jmp %%EndofProcessNEnvi -%%notinterpsound - cmp byte[StereoSound],1 - je near %%EndofProcessNEnvs - jmp %%EndofProcessNEnv -%%Sustain2 - mov ebx,[SustainRate+edx*4] - jmp %%continuesust -%%Sustain - ; Calculate Decay Value - push ebx - push edx - mov al,[DSPMem+05h+%1*10h] - mov dl,[DSPMem+06h+%1*10h] - and edx,1Fh - shr al,4 - and eax,07h - mov ebx,[SustainRate+edx*4] - test ebx,80000000h - jnz %%sustainokay - sub ebx,[DecayRate+eax*4] -%%continuesust - cmp ebx,100 - jg %%sustainokay - mov ebx,100 -%%sustainokay - mov [Voice0Time+%1*4],ebx - mov al,[Voice0EnvInc+%1*4+2] - shl eax,16 - xor edx,edx - div ebx - neg eax - mov [Voice0IncNumber+%1*4],eax - mov byte[Voice0State+%1],4 - pop edx - pop ebx - mov ebx,[Voice0Freq+%1*4] - cmp dword[DSPInterpolate],0 - je %%notinterpsound2 - cmp byte[StereoSound],1 - je near %%EndofProcessNEnvsi - jmp %%EndofProcessNEnvi -%%notinterpsound2 - cmp byte[StereoSound],1 - je near %%EndofProcessNEnvs - jmp %%EndofProcessNEnv -%%Blank - mov dword[Voice0EnvInc+%1*4],007F0000h - mov dword[Voice0IncNumber+%1*4],0 - mov dword[Voice0Time+%1*4],0FFFFFFFFh -%%ContinueGain - mov ebx,[Voice0Freq+%1*4] - cmp dword[DSPInterpolate],0 - je %%notinterpsound3 - cmp byte[StereoSound],1 - je near %%EndofProcessNEnvsi - jmp %%EndofProcessNEnvi -%%notinterpsound3 - cmp byte[StereoSound],1 - je near %%EndofProcessNEnvs - jmp %%EndofProcessNEnv -%%EndofSamp - mov dword[DLPFsamples+%1*24*4+16*4],0 - mov dword[DLPFsamples+%1*24*4+17*4],0 - mov dword[DLPFsamples+%1*24*4+18*4],0 - mov dword[DLPFsamples+%1*24*4+19*4],0 - mov dword[Voice0EnvInc+%1*4],0 - mov dword[Voice0IncNumber+%1*4],0 - mov byte[Voice0Status+%1],0 - mov byte[Voice0State+%1],0 - mov byte[DSPMem+08h+%1*10h],0 - mov byte[DSPMem+09h+%1*10h],0 - or byte[DSPMem+7Ch],%3 - jmp %2 -%%EndofSamp2 - mov dword[Voice0EnvInc+%1*4],0 - mov dword[Voice0IncNumber+%1*4],0 - mov byte[Voice0State+%1],0 - mov byte[DSPMem+08h+%1*10h],0 - mov byte[DSPMem+09h+%1*10h],0 - mov al,%1 -call VoiceStarter - jmp %%SkipProcess2 -%%SkipProcess - xor esi,esi -%%SkipProcess2 - - movzx eax,byte[DSPMem+00h+%1*10h] - movzx ebx,byte[DSPMem+01h+%1*10h] - mov al,[VolumeTableD+eax] - mov bl,[VolumeTableD+ebx] - mov [Voice0VolumeRe+%1],al - mov [Voice0VolumeLe+%1],bl - mov ah,al - mov bh,bl - test ah,80h - jz %%notnegc - neg ah -%%notnegc - test bh,80h - jz %%notnegd - neg bh -%%notnegd - add ah,bh - shr ah,1 - test al,80h - jnz %%neg2 - test bl,80h - jz %%notneg2 -%%neg2 - neg ah -%%notneg2 - mov [Voice0Volumee+%1],ah - - movzx eax,byte[DSPMem+00h+%1*10h] - movzx ebx,byte[DSPMem+01h+%1*10h] - mov al,[VolumeTableD+eax] - mov bl,[VolumeTableD+ebx] - mov ah,[GlobalVL] - mov bh,[GlobalVR] - mov al,[VolumeConvTable+eax*2] - mov bl,[VolumeConvTable+ebx*2] - mov [Voice0VolumeR+%1],al - mov [Voice0VolumeL+%1],bl - mov ah,al - mov bh,bl - test ah,80h - jz %%notneg - neg ah -%%notneg - test bh,80h - jz %%notnegb - neg bh -%%notnegb - add ah,bh - shr ah,1 - test al,80h - jnz %%neg3 - test bl,80h - jz %%notneg3 -%%neg3 - neg ah -%%notneg3 - mov [Voice0Volume+%1],ah - -; cmp byte[Voice0Volume+%1],0 -; je %%volskip - mov byte[lastbl],0 - mov byte[loopbl],0 - mov ebx,[Voice0Freq+%1*4] - mov edi,[Voice0BufPtr+%1*4] - - mov byte[UniqueSoundv],0 - test byte[DSPMem+3Dh],%3 - jnz %%Unique -%if %1<7 ; added - test byte[DSPMem+2Dh],%3 << 1 - jnz %%Uniquepm -%endif ; added - jmp %%NotUnique -%%Uniquepm -%%Unique - mov byte[UniqueSoundv],1 -%%NotUnique - - cmp dword[DSPInterpolate],0 - je %%notinterpsound4 - cmp byte[StereoSound],1 - je %%NextSampleSi - jmp %%NextSamplei -%%notinterpsound4 - cmp byte[StereoSound],1 - je near %%NextSampleS -%%NextSample - cmp dword[BRRPlace0+%1*8],10000000h - jae near %%ProcessBRR - mov eax,[Voice0IncNumber+%1*4] - add [Voice0EnvInc+%1*4],eax - dec dword[Voice0Time+%1*4] - jz %%ProcessNextEnvelope -%%EndofProcessNEnv - ;%5 %1, %2, %3, %4 - call dword[paramhack];%5 - cmp esi,[BufferSizeW] - jne %%NextSample -; mov [DSPMem+09h+%1*10h],ah - mov al,[Voice0EnvInc+%1*4+2] - mov [DSPMem+08h+%1*10h],al - cmp byte[ENVDisable],1 - jne %%skipenvclear - mov byte[DSPMem+08h+%1*10h],0 -%%skipenvclear - jmp %2 -%%NextSampleSi - cmp dword[BRRPlace0+%1*8],10000000h - jae near %%ProcessBRR - mov eax,[Voice0IncNumber+%1*4] - add [Voice0EnvInc+%1*4],eax - dec dword[Voice0Time+%1*4] - jz %%ProcessNextEnvelope -%%EndofProcessNEnvsi - ;%8 %1, %2, %3, %4 - call dword[paramhack+12];%8 - cmp esi,[BufferSizeB] - jne %%NextSampleSi -; mov [DSPMem+09h+%1*10h],ah - mov al,[Voice0EnvInc+%1*4+2] - mov [DSPMem+08h+%1*10h],al - cmp byte[ENVDisable],1 - jne %%skipenvclearsi - mov byte[DSPMem+08h+%1*10h],0 -%%skipenvclearsi - jmp %2 -%%NextSamplei - cmp dword[BRRPlace0+%1*8],10000000h - jae near %%ProcessBRR - mov eax,[Voice0IncNumber+%1*4] - add [Voice0EnvInc+%1*4],eax - dec dword[Voice0Time+%1*4] - jz %%ProcessNextEnvelope -%%EndofProcessNEnvi - ;%7 %1, %2, %3, %4 - call dword[paramhack+8];%7 - cmp esi,[BufferSizeW] - jne %%NextSamplei -; mov [DSPMem+09h+%1*10h],ah - mov al,[Voice0EnvInc+%1*4+2] - mov [DSPMem+08h+%1*10h],al - cmp byte[ENVDisable],1 - jne %%skipenvcleari - mov byte[DSPMem+08h+%1*10h],0 -%%skipenvcleari - jmp %2 -%%NextSampleS - cmp dword[BRRPlace0+%1*8],10000000h - jae %%ProcessBRR - mov eax,[Voice0IncNumber+%1*4] - add [Voice0EnvInc+%1*4],eax - dec dword[Voice0Time+%1*4] - jz %%ProcessNextEnvelope -%%EndofProcessNEnvs - ;%6 %1, %2, %3, %4 - call dword[paramhack+4];%6 - cmp esi,[BufferSizeB] - jne %%NextSampleS -; mov [DSPMem+09h+%1*10h],ah - mov al,[Voice0EnvInc+%1*4+2] - mov [DSPMem+08h+%1*10h],al - cmp byte[ENVDisable],1 - jne %%skipenvclear2 - mov byte[DSPMem+08h+%1*10h],0 -%%skipenvclear2 -%%noclearenv - jmp %2 -%%ProcessBRR - cmp byte[Voice0End+%1],1 - je near %%noDecode1Block -%%Decode1Block - sub dword[BRRPlace0+%1*8],10000000h - push esi - mov esi, [Voice0Ptr+%1*4] -; cmp byte[Voice0Looped+%1],0 -; je %%nobrrcheck - - mov eax,[PSampleBuf+16*4+%1*24*4] - mov [PSampleBuf+0*4+%1*24*4],eax - mov eax,[PSampleBuf+17*4+%1*24*4] - mov [PSampleBuf+1*4+%1*24*4],eax - mov eax,[PSampleBuf+18*4+%1*24*4] - mov [PSampleBuf+2*4+%1*24*4],eax - - mov edi,esi - inc edi - shl edi,2 - add esi,SPCRAM - add edi,[spcBuffera] - mov eax,[Voice0Prev0+%1*4] - mov [Voice0BufPtr+%1*4],edi - mov [prev0],eax - mov eax,[Voice0Prev1+%1*4] - mov [prev1],eax - mov ecx,%1 - push ebp - call BRRDecode - pop ebp - pop esi - mov edi,[Voice0BufPtr+%1*4] - - movsx eax,word[edi] - mov [PSampleBuf+3*4+%1*24*4],eax - movsx eax,word[edi+2*1] - mov [PSampleBuf+4*4+%1*24*4],eax - movsx eax,word[edi+2*2] - mov [PSampleBuf+5*4+%1*24*4],eax - movsx eax,word[edi+2*3] - mov [PSampleBuf+6*4+%1*24*4],eax - movsx eax,word[edi+2*4] - mov [PSampleBuf+7*4+%1*24*4],eax - movsx eax,word[edi+2*5] - mov [PSampleBuf+8*4+%1*24*4],eax - movsx eax,word[edi+2*6] - mov [PSampleBuf+9*4+%1*24*4],eax - movsx eax,word[edi+2*7] - mov [PSampleBuf+10*4+%1*24*4],eax - movsx eax,word[edi+2*8] - mov [PSampleBuf+11*4+%1*24*4],eax - movsx eax,word[edi+2*9] - mov [PSampleBuf+12*4+%1*24*4],eax - movsx eax,word[edi+2*10] - mov [PSampleBuf+13*4+%1*24*4],eax - movsx eax,word[edi+2*11] - mov [PSampleBuf+14*4+%1*24*4],eax - movsx eax,word[edi+2*12] - mov [PSampleBuf+15*4+%1*24*4],eax - movsx eax,word[edi+2*13] - mov [PSampleBuf+16*4+%1*24*4],eax - movsx eax,word[edi+2*14] - mov [PSampleBuf+17*4+%1*24*4],eax - movsx eax,word[edi+2*15] - mov [PSampleBuf+18*4+%1*24*4],eax - - movsx eax,word[BRRreadahead] - mov [PSampleBuf+19*4+%1*24*4],eax - movsx eax,word[BRRreadahead+2] - mov [PSampleBuf+20*4+%1*24*4],eax - movsx eax,word[BRRreadahead+4] - mov [PSampleBuf+21*4+%1*24*4],eax - movsx eax,word[BRRreadahead+6] - mov [PSampleBuf+22*4+%1*24*4],eax - - mov eax,[prev0] - mov [Voice0Prev0+%1*4],eax - mov eax,[prev1] - mov [Voice0Prev1+%1*4],eax - mov al,[loopbl] - mov [Voice0Loop+%1],al - mov al,[lastbl] - mov [Voice0End+%1],al - mov ebx,[Voice0Freq+%1*4] - add dword[Voice0Ptr+%1*4],9 - cmp dword[DSPInterpolate],0 - je %%notinterpsound6 - cmp byte[StereoSound],1 - je near %%NextSampleSi - jmp %%NextSamplei -%%notinterpsound6 - cmp byte[StereoSound],1 - je %%NextSampleS - jmp %%NextSample -%%noDecode1Block -; and byte[DSPMem+5Ch],%4 -; and byte[DSPMem+4Ch],%4 -; mov byte[Voice0Looped+%1],0 - cmp byte[Voice0Loop+%1],1 - jne %%EndSample -; mov byte[Voice0Looped+%1],1 - mov byte[SoundLooped0+%1],1 - or byte[DSPMem+7Ch],%3 -%%SkipStuff3 -; mov dword[Voice0Prev0+%1*4],0 -; mov dword[Voice0Prev1+%1*4],0 - -; push eax -; push edx -; push ebx -; mov edx,[DSPMem+04h+%1*10h] -; and edx,0ffh -; shl edx,2 -; xor eax,eax -; mov ah,[DSPMem+5Dh] -; add ax,dx -; xor ebx,ebx -; mov bx,[SPCRAM+eax] -; mov dword[Voice0Ptr+%1*4],ebx -; xor ebx,ebx -; mov bx,[SPCRAM+eax+2] -; mov dword[Voice0LoopPtr+%1*4],ebx -; pop ebx -; pop edx -; pop eax - - mov eax,[Voice0LoopPtr+%1*4] - mov [Voice0Ptr+%1*4],eax -; mov eax,[Voice0Prev0+%1*4] -; mov [Voice0Prev1+%1*4],eax - jmp %%Decode1Block -%%EndSample -; cmp byte[ENVDisable],1 -; je %%noSkipStuff4 -%%noSkipStuff4 - or byte[DSPMem+7Ch],%3 - mov byte[DSPMem+08h+%1*10h],0 -%%SkipStuff4 - mov dword[DLPFsamples+%1*24*4+16*4],0 - mov dword[DLPFsamples+%1*24*4+17*4],0 - mov dword[DLPFsamples+%1*24*4+18*4],0 - mov dword[DLPFsamples+%1*24*4+19*4],0 -; and byte[DSPMem+5Ch],%4 - mov dword[Voice0EnvInc+%1*4],0 - mov dword[Voice0IncNumber+%1*4],0 - mov byte[Voice0Status+%1],0 -; mov byte[DSPMem+09h+%1*10h],0h -; jmp %2 -;%%ProcessVoice1 -; jmp %2 -%endmacro - -%macro ProcessVoiceHandler16 4 - cmp byte[Voice0Disable+%1],1 - jne near %2 - cmp byte[Voice0Status+%1],1 - jne near %2 - mov ebp,%1 - mov dword[powhack],1<<%1 - mov eax,%1 - dec al - cmp al,0FFh - je .nopitchmod - - cmp byte[Voice0Disable+eax],1 - jne .nopitchmod - cmp byte[Voice0Status+eax],1 - jne .nopitchmod - - test byte[DSPMem+2Dh],%3 - jnz .pitchmod -.nopitchmod - test byte[DSPMem+3Dh],%3 - jnz .NoEcho - cmp byte[echoon0+%1],1 - je .echostuff -.NoEcho - mov dword[paramhack],NonEchoMono - mov dword[paramhack+4],NonEchoStereo - mov dword[paramhack+8],NonEchoMonoInterpolated - mov dword[paramhack+12],NonEchoStereoInterpolated - jmp .pvs - ;ProcessVoiceStuff %1, %2, %3, %4, NonEchoMono, NonEchoStereo, NonEchoMonoInterpolated, NonEchoStereoInterpolated - ; Process Echo -.echostuff - mov dword[paramhack],EchoMono - mov dword[paramhack+4],EchoStereo - mov dword[paramhack+8],EchoMonoInterpolated - mov dword[paramhack+12],EchoStereoInterpolated - jmp .pvs - ;ProcessVoiceStuff %1, %2, %3, %4, EchoMono, EchoStereo, EchoMonoInterpolated, EchoStereoInterpolated -.pitchmod - mov al,[DSPMem+4+%1*10h] - cmp al,[DSPMem+4+%1*10h-10h] - je .nopitchmod - test byte[DSPMem+3Dh],%3 - jnz .NoEchopm - cmp byte[echoon0+%1],1 - je .echopm -.NoEchopm - mov dword[paramhack],NonEchoMonoPM - mov dword[paramhack+4],NonEchoStereoPM - mov dword[paramhack+8],NonEchoMonoPM - mov dword[paramhack+12],NonEchoStereoPM - jmp .pvs - ;ProcessVoiceStuff %1, %2, %3, %4, NonEchoMonoPM, NonEchoStereoPM, NonEchoMonoPM, NonEchoStereoPM -.echopm - mov dword[paramhack],EchoMonoPM - mov dword[paramhack+4],EchoStereoPM - mov dword[paramhack+8],EchoMonoPM - mov dword[paramhack+12],EchoStereoPM - - ;ProcessVoiceStuff %1, %2, %3, %4, EchoMonoPM, EchoStereoPM, EchoMonoPM, EchoStereoPM -.pvs - ProcessVoiceStuff %1, %2, %3, %4 -%endmacro - -%macro FiltTapProc 1 - sub edx,2 - mov eax,[FIRTAPVal0+%1*4] - and edx,0Fh - mov ebx,[FiltLoop+edx*4] - imul eax,ebx - sar eax,7 - add ecx,eax -%endmacro - -%macro FiltTapProcR 1 - sub edx,2 - mov eax,[FIRTAPVal0+%1*4] - and edx,0Fh - mov ebx,[FiltLoopR+edx*4] - imul eax,ebx - sar eax,7 - add ecx,eax -%endmacro - -%macro MixEcho 0 - mov al,[EchoVL] - mov bl,[EchoVR] - cmp bl,al - ja .novol - mov bl,al -.novol - mov [EchoT],bl - - ; Copy echobuf to DSPBuffer, EchoBuffer to echobuf - cmp byte[StereoSound],1 - je near .Stereo - mov esi,[CEchoPtr] - xor edi,edi -.next - ; Get current echo buffer - mov ebx,[echobuf+esi*4] - ; Process FIR Filter - mov edx,[CurFiltPtr] - mov eax,ebx - mov [FiltLoop+edx*4],ebx - mov ecx,[FIRTAPVal0] - imul eax,ecx - sar eax,7 - mov ecx,eax - FiltTapProc 1 - FiltTapProc 2 - FiltTapProc 3 - FiltTapProc 4 - FiltTapProc 5 - FiltTapProc 6 - FiltTapProc 7 - inc dword[CurFiltPtr] - and byte[CurFiltPtr],0Fh - ; Set feedback on previous echo - mov eax,[EchoFB] - imul eax,ecx - sar eax,7 - ; Add in new echo/Store into Echo Buffer - mov ecx,eax - xor ebx,ebx - add [DSPBuffer+edi*4],ecx - mov eax,[EchoBuffer+edi*4] - mov bl,[EchoT] - mul ebx - sar eax,7 - add eax,ecx - mov [echobuf+esi*4],eax - inc esi - cmp esi,[MaxEcho] - jb .nexte - xor esi,esi -.nexte - inc edi - cmp edi,[BufferSizeB] - jne .next - mov [CEchoPtr],esi - jmp .Mono - -.Stereo - mov esi,[CEchoPtr] - xor edi,edi -.nexts - ; Get current echo buffer - mov ebx,[echobuf+esi*4] - ; Process FIR Filter - mov edx,[CurFiltPtr] - mov eax,ebx - mov [FiltLoop+edx*4],ebx - mov ecx,[FIRTAPVal0] - imul eax,ecx - sar eax,7 - mov ecx,eax - FiltTapProc 1 - FiltTapProc 2 - FiltTapProc 3 - FiltTapProc 4 - FiltTapProc 5 - FiltTapProc 6 - FiltTapProc 7 - add [DSPBuffer+edi*4],ecx - ; Set feedback on previous echo - mov eax,[EchoFB] - imul eax,ecx - sar eax,7 - - ; Add in new echo/Store into Echo Buffer - - mov ecx,eax - mov eax,[EchoBuffer+edi*4] - movzx ebx,byte[EchoVL] - mul ebx - sar eax,7 - add eax,ecx - - mov [echobuf+esi*4],eax - inc esi - inc edi - - ; Get current echo buffer - mov ebx,[echobuf+esi*4] - ; Process FIR Filter - mov edx,[CurFiltPtr] - mov eax,ebx - mov [FiltLoopR+edx*4],ebx - mov ecx,[FIRTAPVal0] - imul eax,ecx - sar eax,7 - mov ecx,eax - FiltTapProcR 1 - FiltTapProcR 2 - FiltTapProcR 3 - FiltTapProcR 4 - FiltTapProcR 5 - FiltTapProcR 6 - FiltTapProcR 7 - add [DSPBuffer+edi*4],ecx - inc dword[CurFiltPtr] - and byte[CurFiltPtr],0Fh - ; Set feedback on previous echo - mov eax,[EchoFB] - imul eax,ecx - sar eax,7 - ; Add in new echo/Store into Echo Buffer - mov ecx,eax - mov eax,[EchoBuffer+edi*4] - movzx ebx,byte[EchoVR] - mul ebx - sar eax,7 - add eax,ecx - mov [echobuf+esi*4],eax - - mov eax,[MaxEcho] - inc esi - shl eax,1 - cmp esi,eax - jb .nextes - xor esi,esi -.nextes - inc edi - cmp edi,[BufferSizeB] - jne .nexts - mov [CEchoPtr],esi -.Mono -%endmacro - -%macro MixEcho2 0 - mov al,[EchoVL] - mov bl,[EchoVR] - cmp bl,al - ja %%novol - mov bl,al -%%novol - mov [EchoT],bl - - ; Copy echobuf to DSPBuffer, EchoBuffer to echobuf - cmp byte[StereoSound],1 - je %%Stereo - mov esi,[CEchoPtr] - xor edi,edi -%%next - ; Get current echo buffer - mov ebx,[echobuf+esi*4] - mov eax,[EchoFB] - add [DSPBuffer+edi*4],ebx - imul eax,ebx - sar eax,7 - ; Add in new echo/Store into Echo Buffer - mov ecx,eax - mov eax,[EchoBuffer+edi*4] - movzx ebx,byte[EchoT] - mul ebx - sar eax,7 - add eax,ecx - mov [echobuf+esi*4],eax - inc esi - cmp esi,[MaxEcho] - jae %%echowrap -%%nexte - inc edi - cmp edi,[BufferSizeB] - jne %%next - mov [CEchoPtr],esi - jmp %%Mono -%%echowrap - xor esi,esi - jmp %%nexte - -%%Stereo - mov esi,[CEchoPtr] - xor edi,edi -%%nexts - ; Get current echo buffer - mov ecx,[echobuf+esi*4] - mov eax,[EchoFB] - add [DSPBuffer+edi*4],ecx - imul eax,ecx - sar eax,7 - ; Add in new echo/Store into Echo Buffer - mov ecx,eax - mov eax,[EchoBuffer+edi*4] - movzx ebx,byte[EchoVL] - mul ebx - sar eax,7 - add eax,ecx - mov [echobuf+esi*4],eax - inc esi - inc edi - - ; Get current echo buffer - mov ecx,[echobuf+esi*4] - mov eax,[EchoFB] - add [DSPBuffer+edi*4],ecx - imul eax,ecx - sar eax,7 - ; Add in new echo/Store into Echo Buffer - mov ecx,eax - mov eax,[EchoBuffer+edi*4] - movzx ebx,byte[EchoVR] - mul ebx - sar eax,7 - add eax,ecx - mov [echobuf+esi*4],eax - - mov eax,[MaxEcho] - inc esi - shl eax,1 - cmp esi,eax - jae %%echowrap2 -%%nextes - inc edi - cmp edi,[BufferSizeB] - jne %%nexts - mov [CEchoPtr],esi - jmp %%Mono -%%echowrap2 - xor esi,esi - jmp %%nextes -%%Mono -%endmacro - -section .bss -echowrittento resb 1 -section .text - -NEWSYM ProcessSoundBuffer - ; Clear the DSP Buffer - mov edi,DSPBuffer - mov ax,ds - mov es,ax - xor eax,eax - mov ecx,[BufferSizeB] - rep stosd - - ; Clear Echo Buffer - cmp byte[EchoDis],1 - je .nowriteecho - test byte[DSPMem+6Ch],20h - jnz .nowriteecho - mov edi,EchoBuffer - mov ecx,[BufferSizeB] - rep stosd -.nowriteecho - - cmp byte[EMUPause],1 - jne .nopause - ret -.nopause - - ;When logging is enabled but don't want logging this pass, return - cmp byte[AudioLogging],1 - jne .rawdump - ret -.rawdump - - ; Process the sound :I - - ProcessVoiceHandler16 0,ProcessVoice116,1,254 -NEWSYM ProcessVoice116 - ProcessVoiceHandler16 1,ProcessVoice216,2,253 -NEWSYM ProcessVoice216 - ProcessVoiceHandler16 2,ProcessVoice316,4,251 -NEWSYM ProcessVoice316 - ProcessVoiceHandler16 3,ProcessVoice416,8,247 -NEWSYM ProcessVoice416 - ProcessVoiceHandler16 4,ProcessVoice516,16,239 -NEWSYM ProcessVoice516 - ProcessVoiceHandler16 5,ProcessVoice616,32,223 -NEWSYM ProcessVoice616 - ProcessVoiceHandler16 6,ProcessVoice716,64,191 -NEWSYM ProcessVoice716 - ProcessVoiceHandler16 7,ProcessVoice816,128,127 -NEWSYM ProcessVoice816 - - cmp byte[EchoDis],1 - je near .echowritten - test byte[DSPMem+6Ch],20h - jnz near .nowriteecho2 - mov byte[echowrittento],1 - ; Mix Echo with DSP Buffer - cmp dword[FIRTAPVal0],7Fh - jne near .echonotokay - cmp dword[FIRTAPVal1],0 - jne near .echonotokay - cmp dword[FIRTAPVal2],0 - jne near .echonotokay - cmp dword[FIRTAPVal3],0 - jne near .echonotokay - cmp dword[FIRTAPVal4],0 - jne near .echonotokay - cmp dword[FIRTAPVal5],0 - jne near .echonotokay - cmp dword[FIRTAPVal6],0 - jne near .echonotokay - cmp dword[FIRTAPVal7],0 - jne near .echonotokay - MixEcho2 - jmp .echowritten -.echonotokay - MixEcho - jmp .echowritten -.nowriteecho2 - cmp byte[echowrittento],0 - je .echowritten - mov edi,echobuf - mov ecx,[MaxEcho] - cmp byte[StereoSound],1 - jne .noechostereo - add ecx,ecx -.noechostereo - xor eax,eax - rep stosd - mov byte[echowrittento],0 -.echowritten - - cmp byte[RevStereo],0 - je .norevstereo - mov edi,DSPBuffer - mov ax,ds - mov es,ax - xor eax,eax - mov ecx,[BufferSizeB] - shr ecx,1 -.revstloop - mov eax,[edi] - mov ebx,[edi+4] - mov [edi],ebx - mov [edi+4],eax - add edi,8 - dec ecx - jnz .revstloop -.norevstereo - - cmp byte[LowPassFilterType],1 - jne near LPFexit - mov esi,DSPBuffer - cmp byte[StereoSound],1 - jz LPFstereo - mov ecx, [BufferSizeB] - shr ecx,1 - mov ebx,[LPFsample1] -NEWSYM LPFmonoloop - mov eax,[esi] - sar eax,1 - add ebx,eax - mov [esi],ebx - add esi,4 - mov ebx,[esi] - sar ebx,1 - add eax,ebx - mov [esi],eax - add esi,4 - dec ecx - jnz LPFmonoloop - mov [LPFsample1],ebx - jmp LPFexit - -NEWSYM LPFstereo - mov ecx, [BufferSizeB] - shr ecx,2 -; mov ecx, <------------------- # of samples to mix / 4 - mov ebx,[LPFsample1] - mov edx,[LPFsample2] - -NEWSYM LPFstereoloop - push ecx - mov eax,[esi] - sar eax,1 - add ebx,eax - mov [esi],ebx - mov ecx,[esi+4] - sar ecx,1 - add edx,ecx - mov [esi+4],edx - add esi,8 - mov ebx,[esi] - sar ebx,1 - add eax,ebx - mov [esi],eax - mov edx,[esi+4] - sar edx,1 - add ecx,edx - mov [esi+4],ecx - add esi,8 - pop ecx - dec ecx - jnz LPFstereoloop - mov [LPFsample1],ebx - mov [LPFsample2],edx - -NEWSYM LPFexit - cmp byte[Surround],1 - jnz .nosurround - cmp byte[StereoSound],1 - jnz .nosurround - mov esi,DSPBuffer - mov ecx,[BufferSizeB] - shr ecx,1 -.loop - mov eax,[esi] - mov edx,[esi+4] - add edx,eax - sar edx,1 - sub eax,edx - mov ebx,[esi+4] - sub [esi+4],eax - sub ebx,edx - sub [esi],ebx - add esi,8 - dec ecx - jnz .loop -.nosurround - ret diff --git a/tools/zsnes/src/cpu/e65816.inc b/tools/zsnes/src/cpu/e65816.inc deleted file mode 100644 index 557481e..0000000 --- a/tools/zsnes/src/cpu/e65816.inc +++ /dev/null @@ -1,2001 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 brkv,brkv8,copv,copv8,curexecstate,curnmi,initaddrl -EXTSYM membank0r16,membank0r8,membank0w16,membank0w8 -EXTSYM memtabler16,memtabler8,memtablew16,memtablew8 -EXTSYM nmistatus,regaccessbankr8,snesmap2,snesmmap,stackand,stackor,tablead -EXTSYM wramdata,xa,xd,xdb,xe,xirqb,xpb,xpc,xs,xx,xy -EXTSYM intrset,UpdateDPage,switchtovirqret - -NEWSYM E65816IncStart - -; B = ( or ) -; C = , -; L = [ or ] -; I = # - -SECTION .text - -COp61m8nd: ; ADC(d,x) - addr_BdCxB_8br - ADCMacro8bnd -COp61m16nd: ; ADC(d,x) - addr_BdCxB_16br - ADCMacro16bnd -COp61m8d: ; ADC(d,x) - addr_BdCxB_8br - ADCMacro8bd -COp61m16d: ; ADC(d,x) - addr_BdCxB_16br - ADCMacro16bd -COp63m8nd: ; ADC d,s - addr_dCs_8br - ADCMacro8bnd -COp63m16nd: ; ADC d,s - addr_dCs_16br - ADCMacro16bnd -COp63m8d: ; ADC d,s - addr_dCs_8br - ADCMacro8bd -COp63m16d: ; ADC d,s - addr_dCs_16br - ADCMacro16bd -COp65m8nd: ; ADC d - addr_d_8br - ADCMacro8bnd -COp65m16nd: ; ADC d - addr_d_16br - ADCMacro16bnd -COp65m8d: ; ADC d - addr_d_8br - ADCMacro8bd -COp65m16d: ; ADC d - addr_d_16br - ADCMacro16bd -COp67m8nd: ; ADC [d] - addr_LdL_8br - ADCMacro8bnd -COp67m16nd: ; ADC [d] - addr_LdL_16br - ADCMacro16bnd -COp67m8d: ; ADC [d] - addr_LdL_8br - ADCMacro8bd -COp67m16d: ; ADC [d] - addr_LdL_16br - ADCMacro16bd -COp69m8nd: ; ADC # - addr_I_8br - ADCMacro8bnd -COp69m16nd: ; ADC # - addr_I_16br - ADCMacro16bnd -COp69m8d: ; ADC # - addr_I_8br - ADCMacro8bd -COp69m16d: ; ADC # - addr_I_16br - ADCMacro16bd -COp6Dm8nd: ; ADC a - addr_a_8br - ADCMacro8bnd -COp6Dm16nd: ; ADC a - addr_a_16br - ADCMacro16bnd -COp6Dm8d: ; ADC a - addr_a_8br - ADCMacro8bd -COp6Dm16d: ; ADC a - addr_a_16br - ADCMacro16bd -COp6Fm8nd: ; ADC al - addr_al_8br - ADCMacro8bnd -COp6Fm16nd: ; ADC al - addr_al_16br - ADCMacro16bnd -COp6Fm8d: ; ADC al - addr_al_8br - ADCMacro8bd -COp6Fm16d: ; ADC al - addr_al_16br - ADCMacro16bd -COp71m8nd: ; ADC(d),y - addr_BdBCy_8br - ADCMacro8bnd -COp71m16nd: ; ADC(d),y - addr_BdBCy_16br - ADCMacro16bnd -COp71m8d: ; ADC(d),y - addr_BdBCy_8br - ADCMacro8bd -COp71m16d: ; ADC(d),y - addr_BdBCy_16br - ADCMacro16bd -COp72m8nd: ; ADC (d) - addr_BdB_8br - ADCMacro8bnd -COp72m16nd: ; ADC (d) - addr_BdB_16br - ADCMacro16bnd -COp72m8d: ; ADC (d) - addr_BdB_8br - ADCMacro8bd -COp72m16d: ; ADC (d) - addr_BdB_16br - ADCMacro16bd -COp73m8nd: ; ADC(d,s),y - addr_BdCsBCy_8br - ADCMacro8bnd -COp73m16nd: ; ADC(d,s),y - addr_BdCsBCy_16br - ADCMacro16bnd -COp73m8d: ; ADC(d,s),y - addr_BdCsBCy_8br - ADCMacro8bd -COp73m16d: ; ADC(d,s),y - addr_BdCsBCy_16br - ADCMacro16bd -COp75m8nd: ; ADC d,x - addr_dCx_8br - ADCMacro8bnd -COp75m16nd: ; ADC d,x - addr_dCx_16br - ADCMacro16bnd -COp75m8d: ; ADC d,x - addr_dCx_8br - ADCMacro8bd -COp75m16d: ; ADC d,x - addr_dCx_16br - ADCMacro16bd -COp77m8nd: ; ADC [d],y - addr_LdLCy_8br - ADCMacro8bnd -COp77m16nd: ; ADC [d],y - addr_LdLCy_16br - ADCMacro16bnd -COp77m8d: ; ADC [d],y - addr_LdLCy_8br - ADCMacro8bd -COp77m16d: ; ADC [d],y - addr_LdLCy_16br - ADCMacro16bd -COp79m8nd: ; ADC a,y - addr_aCy_8br - ADCMacro8bnd -COp79m16nd: ; ADC a,y - addr_aCy_16br - ADCMacro16bnd -COp79m8d: ; ADC a,y - addr_aCy_8br - ADCMacro8bd -COp79m16d: ; ADC a,y - addr_aCy_16br - ADCMacro16bd -COp7Dm8nd: ; ADC a,x - addr_aCx_8br - ADCMacro8bnd -COp7Dm16nd: ; ADC a,x - addr_aCx_16br - ADCMacro16bnd -COp7Dm8d: ; ADC a,x - addr_aCx_8br - ADCMacro8bd -COp7Dm16d: ; ADC a,x - addr_aCx_16br - ADCMacro16bd -COp7Fm8nd: ; ADC al,x - addr_alCx_8br - ADCMacro8bnd -COp7Fm16nd: ; ADC al,x - addr_alCx_16br - ADCMacro16bnd -COp7Fm8d: ; ADC al,x - addr_alCx_8br - ADCMacro8bd -COp7Fm16d: ; ADC al,x - addr_alCx_16br - ADCMacro16bd - -COp21m8: ; AND(d,x) - addr_BdCxB_8br - ANDMacro8b -COp21m16:; AND(d,x) - addr_BdCxB_16br - ANDMacro16b -COp23m8: ; AND d,s - addr_dCs_8br - ANDMacro8b -COp23m16:; AND d,s - addr_dCs_16br - ANDMacro16b -COp25m8: ; AND d - addr_d_8br - ANDMacro8b -COp25m16:; AND d - addr_d_16br - ANDMacro16b -COp27m8: ; AND [d] - addr_LdL_8br - ANDMacro8b -COp27m16:; AND [d] - addr_LdL_16br - ANDMacro16b -COp29m8: ; AND # - addr_I_8br - ANDMacro8b -COp29m16:; AND # - addr_I_16br - ANDMacro16b -COp2Dm8: ; AND a - addr_a_8br - ANDMacro8b -COp2Dm16:; AND a - addr_a_16br - ANDMacro16b -COp2Fm8: ; AND al - addr_al_8br - ANDMacro8b -COp2Fm16:; AND al - addr_al_16br - ANDMacro16b -COp31m8: ; AND(d),y - addr_BdBCy_8br - ANDMacro8b -COp31m16:; AND(d),y - addr_BdBCy_16br - ANDMacro16b -COp32m8: ; AND (d) - addr_BdB_8br - ANDMacro8b -COp32m16:; AND (d) - addr_BdB_16br - ANDMacro16b -COp33m8: ; AND(d,s),y - addr_BdCsBCy_8br - ANDMacro8b -COp33m16:; AND(d,s),y - addr_BdCsBCy_16br - ANDMacro16b -COp35m8: ; AND d,x - addr_dCx_8br - ANDMacro8b -COp35m16:; AND d,x - addr_dCx_16br - ANDMacro16b -COp37m8: ; AND [d],y - addr_LdLCy_8br - ANDMacro8b -COp37m16:; AND [d],y - addr_LdLCy_16br - ANDMacro16b -COp39m8: ; AND a,y - addr_aCy_8br - ANDMacro8b -COp39m16:; AND a,y - addr_aCy_16br - ANDMacro16b -COp3Dm8: ; AND a,x - addr_aCx_8br - ANDMacro8b -COp3Dm16:; AND a,x - addr_aCx_16br - ANDMacro16b -COp3Fm8: ; AND al,x - addr_alCx_8br - ANDMacro8b -COp3Fm16:; AND al,x - addr_alCx_16br - ANDMacro16b - -COp06m8: ; ASL d - addr_d_8brni - ASLMacro8b - addr_d_8bw - endloop -COp06m16:; ASL d - addr_d_16brni - ASLMacro16b - addr_d_16bw - endloop -COp0Am8: ; ASL A - addr_A_8brni - ASLMacro8b - addr_A_8bw - endloop -COp0Am16:; ASL A - addr_A_16brni - ASLMacro16b - addr_A_16bw - endloop -COp0Em8: ; ASL a - addr_a_8brni - ASLMacro8b - addr_a_8bw - endloop -COp0Em16:; ASL a - addr_a_16brni - ASLMacro16b - addr_a_16bw - endloop -COp16m8: ; ASL d,x - addr_dCx_8brni - ASLMacro8b - addr_dCx_8bw - endloop -COp16m16:; ASL d,x - addr_dCx_16brni - ASLMacro16b - addr_dCx_16bw - endloop -COp1Em8: ; ASL a,x - addr_aCx_8brni - ASLMacro8b - addr_aCx_8bw - endloop -COp1Em16:; ASL a,x - addr_aCx_16brni - ASLMacro16b - addr_aCx_16bw - endloop - -COp90: ; BCC r - test byte[flagc],01h - jnz .skip - JumpMacro -COpB0: ; BCS r - test byte[flagc],01h - jz .skip - JumpMacro -COpF0: ; BEQ r - test dword[flagnz],0FFFFh - jnz .skip - JumpMacro -COp30: ; BMI r - test dword[flagnz],018000h - jz .skip - JumpMacro -COpD0: ; BNE r - test dword[flagnz],0FFFFh - jz .skip - JumpMacro -COp10: ; BPL r - test dword[flagnz],018000h - jnz .skip - JumpMacro -COp80: ; BRA r - movsx eax,byte[esi] - inc esi - add esi,eax - endloop -COp50: ; BVC r - test dword[flago],0FFh - jnz .skip - JumpMacro -COp70: ; BVS r - test dword[flago],0FFh - jz .skip - JumpMacro - -; BIT instruction does not affect N and V flags when using immediate -; addressing mode. When using other addressing modes, the N and V flags - -COp89m8: ; BIT # - BITMacroim8b -COp89m16:; BIT # - BITMacroim16b - -COp24m8: ; BIT d - addr_d_8br - BITMacro8b -COp24m16:; BIT d - addr_d_16br - BITMacro16b -COp2Cm8: ; BIT a - addr_a_8br - BITMacro8b -COp2Cm16:; BIT a - addr_a_16br - BITMacro16b -COp34m8: ; BIT d,x - addr_dCx_8br - BITMacro8b -COp34m16:; BIT d,x - addr_dCx_16br - BITMacro16b -COp3Cm8: ; BIT a,x - addr_aCx_8br - BITMacro8b -COp3Cm16:; BIT a,x - addr_aCx_16br - BITMacro16b - -COp00: ; BRK s - BRKMacro - -COp82: ; BRL rl - BRLMacro - -COp18: ; CLC i - mov dword[flagc],0 - endloop -COpD8: ; CLD i - and dl,0F7h - mov bl,dl - mov edi,[tablead+ebx*4] - endloop -COp58: ; CLI i - and dl,0FBh - cmp byte[doirqnext],0 - je .noirqexec - mov byte[doirqnext],0 - call switchtovirqret -.noirqexec - endloop -COpB8: ; CLV i - mov dword[flago],0 - endloop - -COpC1m8: ; CMP(d,x) - addr_BdCxB_8br - CMPMacro8b -COpC1m16:; CMP(d,x) - addr_BdCxB_16br - CMPMacro16b -COpC3m8: ; CMP d,s - addr_dCs_8br - CMPMacro8b -COpC3m16:; CMP d,s - addr_dCs_16br - CMPMacro16b -COpC5m8: ; CMP d - addr_d_8br - CMPMacro8b -COpC5m16:; CMP d - addr_d_16br - CMPMacro16b -COpC7m8: ; CMP [d] - addr_LdL_8br - CMPMacro8b -COpC7m16:; CMP [d] - addr_LdL_16br - CMPMacro16b -COpC9m8: ; CMP # - addr_I_8br - CMPMacro8b -COpC9m16:; CMP # - addr_I_16br - CMPMacro16b -COpCDm8: ; CMP a - addr_a_8br - CMPMacro8b -COpCDm16:; CMP a - addr_a_16br - CMPMacro16b -COpCFm8: ; CMP al - addr_al_8br - CMPMacro8b -COpCFm16:; CMP al - addr_al_16br - CMPMacro16b -COpD1m8: ; CMP(d),y - addr_BdBCy_8br - CMPMacro8b -COpD1m16:; CMP(d),y - addr_BdBCy_16br - CMPMacro16b -COpD2m8: ; CMP (d) - addr_BdB_8br - CMPMacro8b -COpD2m16:; CMP (d) - addr_BdB_16br - CMPMacro16b -COpD3m8: ; CMP(d,s),y - addr_BdCsBCy_8br - CMPMacro8b -COpD3m16:; CMP(d,s),y - addr_BdCsBCy_16br - CMPMacro16b -COpD5m8: ; CMP d,x - addr_dCx_8br - CMPMacro8b -COpD5m16:; CMP d,x - addr_dCx_16br - CMPMacro16b -COpD7m8: ; CMP [d],y - addr_LdLCy_8br - CMPMacro8b -COpD7m16:; CMP [d],y - addr_LdLCy_16br - CMPMacro16b -COpD9m8: ; CMP a,y - addr_aCy_8br - CMPMacro8b -COpD9m16:; CMP a,y - addr_aCy_16br - CMPMacro16b -COpDDm8: ; CMP a,x - addr_aCx_8br - CMPMacro8b -COpDDm16:; CMP a,x - addr_aCx_16br - CMPMacro16b -COpDFm8: ; CMP al,x - addr_alCx_8br - CMPMacro8b -COpDFm16:; CMP al,x - addr_alCx_16br - CMPMacro16b - -COp02: ; COP s - COPMacro - -COpE0x8: ; CPX # - addr_I_8br - CPXMacro8b -COpE0x16:; CPX # - addr_I_16br - CPXMacro16b -COpE4x8: ; CPX d - addr_d_8br - CPXMacro8b -COpE4x16:; CPX d - addr_d_16br - CPXMacro16b -COpECx8: ; CPX a - addr_a_8br - CPXMacro8b -COpECx16:; CPX a - addr_a_16br - CPXMacro16b - -COpC0x8: ; CPY # - addr_I_8br - CPYMacro8b -COpC0x16:; CPY # - addr_I_16br - CPYMacro16b -COpC4x8: ; CPY d - addr_d_8br - CPYMacro8b -COpC4x16:; CPY d - addr_d_16br - CPYMacro16b -COpCCx8: ; CPY a - addr_a_8br - CPYMacro8b -COpCCx16:; CPY a - addr_a_16br - CPYMacro16b - -COp3Am8: ; DEC A - addr_A_8brni - dec al - flagsetnz8bnel - addr_A_8bw - endloop -COp3Am16:; DEC A - addr_A_16brni - dec ax - flagsetnz16bnel - addr_A_16bw - endloop -COpCEm8: ; DEC a - addr_a_8brni - dec al - flagsetnz8bnel - addr_a_8bw - endloop -COpCEm16:; DEC a - addr_a_16brni - dec ax - flagsetnz16bnel - addr_a_16bw - endloop -COpC6m8: ; DEC d - addr_d_8brni - dec al - flagsetnz8bnel - addr_d_8bw - endloop -COpC6m16:; DEC d - addr_d_16brni - dec ax - flagsetnz16bnel - addr_d_16bw - endloop -COpD6m8: ; DEC d,x - addr_dCx_8brni - dec al - flagsetnz8bnel - addr_dCx_8bw - endloop -COpD6m16:; DEC d,x - addr_dCx_16brni - dec ax - flagsetnz16bnel - addr_dCx_16bw - endloop -COpDEm8: ; DEC a,x - addr_aCx_8brni - dec al - flagsetnz8bnel - addr_aCx_8bw - endloop -COpDEm16:; DEC a,x - addr_aCx_16brni - dec ax - flagsetnz16bnel - addr_aCx_16bw - endloop - -COpCAx8: ; DEX i - dec byte[xx] - mov al,[xx] - flagsetnz8b - endloop -COpCAx16:; DEX i - dec word[xx] - mov ax,[xx] - flagsetnz16b - endloop -COp88x8: ; DEY i - dec byte[xy] - mov al,[xy] - flagsetnz8b - endloop -COp88x16:; DEY i - dec word[xy] - mov ax,[xy] - flagsetnz16b - endloop - -COp41m8: ; EOR(d,x) - addr_BdCxB_8br - EORMacro8b -COp41m16:; EOR(d,x) - addr_BdCxB_16br - EORMacro16b -COp43m8: ; EOR d,s - addr_dCs_8br - EORMacro8b -COp43m16:; EOR d,s - addr_dCs_16br - EORMacro16b -COp45m8: ; EOR d - addr_d_8br - EORMacro8b -COp45m16:; EOR d - addr_d_16br - EORMacro16b -COp47m8: ; EOR [d] - addr_LdL_8br - EORMacro8b -COp47m16:; EOR [d] - addr_LdL_16br - EORMacro16b -COp49m8: ; EOR # - addr_I_8br - EORMacro8b -COp49m16:; EOR # - addr_I_16br - EORMacro16b -COp4Dm8: ; EOR a - addr_a_8br - EORMacro8b -COp4Dm16:; EOR a - addr_a_16br - EORMacro16b -COp4Fm8: ; EOR al - addr_al_8br - EORMacro8b -COp4Fm16:; EOR al - addr_al_16br - EORMacro16b -COp51m8: ; EOR(d),y - addr_BdBCy_8br - EORMacro8b -COp51m16:; EOR(d),y - addr_BdBCy_16br - EORMacro16b -COp52m8: ; EOR (d) - addr_BdB_8br - EORMacro8b -COp52m16:; EOR (d) - addr_BdB_16br - EORMacro16b -COp53m8: ; EOR(d,s),y - addr_BdCsBCy_8br - EORMacro8b -COp53m16:; EOR(d,s),y - addr_BdCsBCy_16br - EORMacro16b -COp55m8: ; EOR d,x - addr_dCx_8br - EORMacro8b -COp55m16:; EOR d,x - addr_dCx_16br - EORMacro16b -COp57m8: ; EOR [d],y - addr_LdLCy_8br - EORMacro8b -COp57m16:; EOR [d],y - addr_LdLCy_16br - EORMacro16b -COp59m8: ; EOR a,y - addr_aCy_8br - EORMacro8b -COp59m16:; EOR a,y - addr_aCy_16br - EORMacro16b -COp5Dm8: ; EORa,x - addr_aCx_8br - EORMacro8b -COp5Dm16:; EORa,x - addr_aCx_16br - EORMacro16b -COp5Fm8: ; EOR al,x - addr_alCx_8br - EORMacro8b -COp5Fm16:; EOR al,x - addr_alCx_16br - EORMacro16b - - -COp1Am8: ; INC A - addr_A_8brni - inc al - flagsetnz8bnel - addr_A_8bw - endloop -COp1Am16:; INC A - addr_A_16brni - inc ax - flagsetnz16bnel - addr_A_16bw - endloop -COpEEm8: ; INC a - addr_a_8brni - inc al - flagsetnz8bnel - addr_a_8bw - endloop -COpEEm16:; INC a - addr_a_16brni - inc ax - flagsetnz16bnel - addr_a_16bw - endloop -COpE6m8: ; INC d - addr_d_8brni - inc al - flagsetnz8bnel - addr_d_8bw - endloop -COpE6m16:; INC d - addr_d_16brni - inc ax - flagsetnz16bnel - addr_d_16bw - endloop -COpF6m8: ; INC d,x - addr_dCx_8brni - inc al - flagsetnz8bnel - addr_dCx_8bw - endloop -COpF6m16:; INC d,x - addr_dCx_16brni - inc ax - flagsetnz16bnel - addr_dCx_16bw - endloop -COpFEm8: ; INC a,x - addr_aCx_8brni - inc al - flagsetnz8bnel - addr_aCx_8bw - endloop -COpFEm16:; INC a,x - addr_aCx_16brni - inc ax - flagsetnz16bnel - addr_aCx_16bw - endloop - - -COpE8x8: ; INX i - inc byte[xx] - mov al,[xx] - flagsetnz8b - endloop -COpE8x16:; INX i - inc word[xx] - mov ax,[xx] - flagsetnz16b - endloop -COpC8x8: ; INY i - inc byte[xy] - mov al,[xy] - flagsetnz8b - endloop -COpC8x16:; INY i - inc word[xy] - mov ax,[xy] - flagsetnz16b - endloop - -COpDC: ; JML (a) - JMLMacro -COp4C: ; JMP a - JMPMacro4C -COp6C: ; JMP (a) - JMPMacro6C -COp7C: ; JMP(a,x) - JMPMacro7C -COp5C: ; JMP al - JMPMacro5C - -COp22: ; JSL al - JSLMacro -COp20: ; JSR a - JSRMacro20 -COpFC: ; JSR(a,x) - JSRMacroFC - -COpA1m8: ; LDA(d,x) - addr_BdCxB_8br - LDAMacro8b -COpA1m16:; LDA(d,x) - addr_BdCxB_16br - LDAMacro16b -COpA3m8: ; LDA d,s - addr_dCs_8br - LDAMacro8b -COpA3m16:; LDA d,s - addr_dCs_16br - LDAMacro16b -COpA5m8: ; LDA d - addr_d_8br - LDAMacro8b -COpA5m16:; LDA d - addr_d_16br - LDAMacro16b -COpA7m8: ; LDA [d] - addr_LdL_8br - LDAMacro8b -COpA7m16:; LDA [d] - addr_LdL_16br - LDAMacro16b -COpA9m8: ; LDA # - addr_I_8br - LDAMacro8b -COpA9m16:; LDA # - addr_I_16br - LDAMacro16b -COpADm8: ; LDA a - addr_a_8br - LDAMacro8b -COpADm16:; LDA a - addr_a_16br - LDAMacro16b -COpAFm8: ; LDA al - addr_al_8br - LDAMacro8b -COpAFm16:; LDA al - addr_al_16br - LDAMacro16b -COpB1m8: ; LDA(d),y - addr_BdBCy_8br - LDAMacro8b -COpB1m16:; LDA(d),y - addr_BdBCy_16br - LDAMacro16b -COpB2m8: ; LDA (d) - addr_BdB_8br - LDAMacro8b -COpB2m16:; LDA (d) - addr_BdB_16br - LDAMacro16b -COpB3m8: ; LDA(d,s),y - addr_BdCsBCy_8br - LDAMacro8b -COpB3m16:; LDA(d,s),y - addr_BdCsBCy_16br - LDAMacro16b -COpB5m8: ; LDA d,x - addr_dCx_8br - LDAMacro8b -COpB5m16:; LDA d,x - addr_dCx_16br - LDAMacro16b -COpB7m8: ; LDA [d],y - addr_LdLCy_8br - LDAMacro8b -COpB7m16:; LDA [d],y - addr_LdLCy_16br - LDAMacro16b -COpB9m8: ; LDA a,y - addr_aCy_8br - LDAMacro8b -COpB9m16:; LDA a,y - addr_aCy_16br - LDAMacro16b -COpBDm8: ; LDA a,x - addr_aCx_8br - LDAMacro8b -COpBDm16:; LDA a,x - addr_aCx_16br - LDAMacro16b -COpBFm8: ; LDA al,x - addr_alCx_8br - LDAMacro8b -COpBFm16:; LDA al,x - addr_alCx_16br - LDAMacro16b - -COpA2x8: ; LDX # - addr_I_8br - LDXMacro8b -COpA2x16:; LDX # - addr_I_16br - LDXMacro16b -COpA6x8: ; LDX d - addr_d_8br - LDXMacro8b -COpA6x16:; LDX d - addr_d_16br - LDXMacro16b -COpAEx8: ; LDX a - addr_a_8br - LDXMacro8b -COpAEx16:; LDX a - addr_a_16br - LDXMacro16b -COpB6x8: ; LDX d,y - addr_dCy_8br - LDXMacro8b -COpB6x16:; LDX d,y - addr_dCy_16br - LDXMacro16b -COpBEx8: ; LDX a,y - addr_aCy_8br - LDXMacro8b -COpBEx16:; LDX a,y - addr_aCy_16br - LDXMacro16b - -COpA0x8: ; LDY # - addr_I_8br - LDYMacro8b -COpA0x16:; LDY # - addr_I_16br - LDYMacro16b -COpA4x8: ; LDY d - addr_d_8br - LDYMacro8b -COpA4x16:; LDY d - addr_d_16br - LDYMacro16b -COpACx8: ; LDY a - addr_a_8br - LDYMacro8b -COpACx16:; LDY a - addr_a_16br - LDYMacro16b -COpB4x8: ; LDY d,x - addr_dCx_8br - LDYMacro8b -COpB4x16:; LDY d,x - addr_dCx_16br - LDYMacro16b -COpBCx8: ; LDY a,x - addr_aCx_8br - LDYMacro8b -COpBCx16:; LDY a,x - addr_aCx_16br - LDYMacro16b - -COp46m8: ; LSR d - addr_d_8brni - LSRMacro8b - addr_d_8bw - endloop -COp46m16:; LSR d - addr_d_16brni - LSRMacro16b - addr_d_16bw - endloop -COp4Am8: ; LSR A - addr_A_8brni - LSRMacro8b - addr_A_8bw - endloop -COp4Am16:; LSR A - addr_A_16brni - LSRMacro16b - addr_A_16bw - endloop -COp4Em8: ; LSR a - addr_a_8brni - LSRMacro8b - addr_a_8bw - endloop -COp4Em16:; LSR a - addr_a_16brni - LSRMacro16b - addr_a_16bw - endloop -COp56m8: ; LSR d,x - addr_dCx_8brni - LSRMacro8b - addr_dCx_8bw - endloop -COp56m16:; LSR d,x - addr_dCx_16brni - LSRMacro16b - addr_dCx_16bw - endloop -COp5Em8: ; LSRa,x - addr_aCx_8brni - LSRMacro8b - addr_aCx_8bw - endloop -COp5Em16:; LSRa,x - addr_aCx_16brni - LSRMacro16b - addr_aCx_16bw - endloop - -COp54: ; MVN xya - MVNMacro -COp44: ; MVP xya - MVPMacro - -COpEA: ; NOP i - endloop - -COp01m8: ; ORA(d,x) - addr_BdCxB_8br - ORAMacro8b -COp01m16:; ORA(d,x) - addr_BdCxB_16br - ORAMacro16b -COp03m8: ; ORA d,s - addr_dCs_8br - ORAMacro8b -COp03m16:; ORA d,s - addr_dCs_16br - ORAMacro16b -COp05m8: ; ORA d - addr_d_8br - ORAMacro8b -COp05m16:; ORA d - addr_d_16br - ORAMacro16b -COp07m8: ; ORA [d] - addr_LdL_8br - ORAMacro8b -COp07m16:; ORA [d] - addr_LdL_16br - ORAMacro16b -COp09m8: ; ORA # - addr_I_8br - ORAMacro8b -COp09m16:; ORA # - addr_I_16br - ORAMacro16b -COp0Dm8: ; ORA a - addr_a_8br - ORAMacro8b -COp0Dm16:; ORA a - addr_a_16br - ORAMacro16b -COp0Fm8: ; ORA al - addr_al_8br - ORAMacro8b -COp0Fm16:; ORA al - addr_al_16br - ORAMacro16b -COp11m8: ; ORA(d),y - addr_BdBCy_8br - ORAMacro8b -COp11m16:; ORA(d),y - addr_BdBCy_16br - ORAMacro16b -COp12m8: ; ORA(d) - addr_BdB_8br - ORAMacro8b -COp12m16:; ORA(d) - addr_BdB_16br - ORAMacro16b -COp13m8: ; ORA(d,s),y - addr_BdCsBCy_8br - ORAMacro8b -COp13m16:; ORA(d,s),y - addr_BdCsBCy_16br - ORAMacro16b -COp15m8: ; ORA d,x - addr_dCx_8br - ORAMacro8b -COp15m16:; ORA d,x - addr_dCx_16br - ORAMacro16b -COp17m8: ; ORA [d],y - addr_LdLCy_8br - ORAMacro8b -COp17m16:; ORA [d],y - addr_LdLCy_16br - ORAMacro16b -COp19m8: ; ORA a,y - addr_aCy_8br - ORAMacro8b -COp19m16:; ORA a,y - addr_aCy_16br - ORAMacro16b -COp1Dm8: ; ORA a,x - addr_aCx_8br - ORAMacro8b -COp1Dm16:; ORA a,x - addr_aCx_16br - ORAMacro16b -COp1Fm8: ; ORA al,x - addr_alCx_8br - ORAMacro8b -COp1Fm16:; ORA al,x - addr_alCx_16br - ORAMacro16b - -COpF4: ; PEA s - PEAMacro -COpD4: ; PEI s - PEIMacro -COp62: ; PER s - PERMacro - -COp48m8: ; PHA s - PUSHMacro8b [xa] -COp48m16:; PHA s - PUSHMacro16b [xa], [xa+1] -COp8B: ; PHB s - PUSHMacro8b [xdb] -COp0B: ; PHD s - PUSHMacro16b [xd], [xd+1] -COp4B: ; PHK s - PUSHMacro8b [xpb] -COp08: ; PHP s - PUSHMacro8bp -COpDAx8: ; PHX s - PUSHMacro8b [xx] -COpDAx16:; PHX s - PUSHMacro16b [xx], [xx+1] -COp5Ax8: ; PHY s - PUSHMacro8b [xy] -COp5Ax16:; PHY s - PUSHMacro16b [xy], [xy+1] - -COp68m8: ; PLA s - POPMacro8b [xa] -COp68m16:; PLA s - POPMacro16b [xa], [xa+1] -COpAB: ; PLB s - POPMacro8b [xdb] -COp2B: ; PLD s - POPMacro16bd [xd], [xd+1] -COp28: ; PLP s - POPMacroP -COpFAx8: ; PLX s - POPMacro8b [xx] -COpFAx16:; PLX s - POPMacro16b [xx], [xx+1] -COp7Ax8: ; PLY s - POPMacro8b [xy] -COp7Ax16:; PLY s - POPMacro16b [xy], [xy+1] - -COpC2: ; REP # - REPMacro - -COp26m8: ; ROL d - addr_d_8brni - ROLMacro8b - addr_d_8bw - endloop -COp26m16:; ROL d - addr_d_16brni - ROLMacro16b - addr_d_16bw - endloop -COp2Am8: ; ROL A - addr_A_8brni - ROLMacro8b - addr_A_8bw - endloop -COp2Am16:; ROL A - addr_A_16brni - ROLMacro16b - addr_A_16bw - endloop -COp2Em8: ; ROL a - addr_a_8brni - ROLMacro8b - addr_a_8bw - endloop -COp2Em16:; ROL a - addr_a_16brni - ROLMacro16b - addr_a_16bw - endloop -COp36m8: ; ROL d,x - addr_dCx_8brni - ROLMacro8b - addr_dCx_8bw - endloop -COp36m16:; ROL d,x - addr_dCx_16brni - ROLMacro16b - addr_dCx_16bw - endloop -COp3Em8: ; ROL a,x - addr_aCx_8brni - ROLMacro8b - addr_aCx_8bw - endloop -COp3Em16:; ROL a,x - addr_aCx_16brni - ROLMacro16b - addr_aCx_16bw - endloop - -COp66m8: ; ROR d - addr_d_8brni - RORMacro8b - addr_d_8bw - endloop -COp66m16:; ROR d - addr_d_16brni - RORMacro16b - addr_d_16bw - endloop -COp6Am8: ; ROR A - addr_A_8brni - RORMacro8b - addr_A_8bw - endloop -COp6Am16:; ROR A - addr_A_16brni - RORMacro16b - addr_A_16bw - endloop -COp6Em8: ; ROR a - addr_a_8brni - RORMacro8b - addr_a_8bw - endloop -COp6Em16:; ROR a - addr_a_16brni - RORMacro16b - addr_a_16bw - endloop -COp76m8: ; ROR d,x - addr_dCx_8brni - RORMacro8b - addr_dCx_8bw - endloop -COp76m16:; ROR d,x - addr_dCx_16brni - RORMacro16b - addr_dCx_16bw - endloop -COp7Em8: ; ROR a,x - addr_aCx_8brni - RORMacro8b - addr_aCx_8bw - endloop -COp7Em16:; ROR a,x - addr_aCx_16brni - RORMacro16b - addr_aCx_16bw - endloop - -COp40: ; RTI s - RTIMacro -COp6B: ; RTL s - RTLMacro -COp60: ; RTS s - RTSMacro - -COpE1m8nd: ; SBC(d,x) - addr_BdCxB_8br - SBCMacro8bnd -COpE1m16nd: ; SBC(d,x) - addr_BdCxB_16br - SBCMacro16bnd -COpE1m8d: ; SBC(d,x) - addr_BdCxB_8br - SBCMacro8bd -COpE1m16d: ; SBC(d,x) - addr_BdCxB_16br - SBCMacro16bd -COpE3m8nd: ; SBC d,s - addr_dCs_8br - SBCMacro8bnd -COpE3m16nd: ; SBC d,s - addr_dCs_16br - SBCMacro16bnd -COpE3m8d: ; SBC d,s - addr_dCs_8br - SBCMacro8bd -COpE3m16d: ; SBC d,s - addr_dCs_16br - SBCMacro16bd -COpE5m8nd: ; SBC d - addr_d_8br - SBCMacro8bnd -COpE5m16nd: ; SBC d - addr_d_16br - SBCMacro16bnd -COpE5m8d: ; SBC d - addr_d_8br - SBCMacro8bd -COpE5m16d: ; SBC d - addr_d_16br - SBCMacro16bd -COpE7m8nd: ; SBC [d] - addr_LdL_8br - SBCMacro8bnd -COpE7m16nd: ; SBC [d] - addr_LdL_16br - SBCMacro16bnd -COpE7m8d: ; SBC [d] - addr_LdL_8br - SBCMacro8bd -COpE7m16d: ; SBC [d] - addr_LdL_16br - SBCMacro16bd -COpE9m8nd: ; SBC # - addr_I_8br - SBCMacro8bnd -COpE9m16nd: ; SBC # - addr_I_16br - SBCMacro16bnd -COpE9m8d: ; SBC # - addr_I_8br - SBCMacro8bd -COpE9m16d: ; SBC # - addr_I_16br - SBCMacro16bd -COpEDm8nd: ; SBC a - addr_a_8br - SBCMacro8bnd -COpEDm16nd: ; SBC a - addr_a_16br - SBCMacro16bnd -COpEDm8d: ; SBC a - addr_a_8br - SBCMacro8bd -COpEDm16d: ; SBC a - addr_a_16br - SBCMacro16bd -COpEFm8nd: ; SBC al - addr_al_8br - SBCMacro8bnd -COpEFm16nd: ; SBC al - addr_al_16br - SBCMacro16bnd -COpEFm8d: ; SBC al - addr_al_8br - SBCMacro8bd -COpEFm16d: ; SBC al - addr_al_16br - SBCMacro16bd -COpF1m8nd: ; SBC(d),y - addr_BdBCy_8br - SBCMacro8bnd -COpF1m16nd: ; SBC(d),y - addr_BdBCy_16br - SBCMacro16bnd -COpF1m8d: ; SBC(d),y - addr_BdBCy_8br - SBCMacro8bd -COpF1m16d: ; SBC(d),y - addr_BdBCy_16br - SBCMacro16bd -COpF2m8nd: ; SBC (d) - addr_BdB_8br - SBCMacro8bnd -COpF2m16nd: ; SBC (d) - addr_BdB_16br - SBCMacro16bnd -COpF2m8d: ; SBC (d) - addr_BdB_8br - SBCMacro8bd -COpF2m16d: ; SBC (d) - addr_BdB_16br - SBCMacro16bd -COpF3m8nd: ; SBC(d,s),y - addr_BdCsBCy_8br - SBCMacro8bnd -COpF3m16nd: ; SBC(d,s),y - addr_BdCsBCy_16br - SBCMacro16bnd -COpF3m8d: ; SBC(d,s),y - addr_BdCsBCy_8br - SBCMacro8bd -COpF3m16d: ; SBC(d,s),y - addr_BdCsBCy_16br - SBCMacro16bd -COpF5m8nd: ; SBC d,x - addr_dCx_8br - SBCMacro8bnd -COpF5m16nd: ; SBC d,x - addr_dCx_16br - SBCMacro16bnd -COpF5m8d: ; SBC d,x - addr_dCx_8br - SBCMacro8bd -COpF5m16d: ; SBC d,x - addr_dCx_16br - SBCMacro16bd -COpF7m8nd: ; SBC [d],y - addr_LdLCy_8br - SBCMacro8bnd -COpF7m16nd: ; SBC [d],y - addr_LdLCy_16br - SBCMacro16bnd -COpF7m8d: ; SBC [d],y - addr_LdLCy_8br - SBCMacro8bd -COpF7m16d: ; SBC [d],y - addr_LdLCy_16br - SBCMacro16bd -COpF9m8nd: ; SBC a,y - addr_aCy_8br - SBCMacro8bnd -COpF9m16nd: ; SBC a,y - addr_aCy_16br - SBCMacro16bnd -COpF9m8d: ; SBC a,y - addr_aCy_8br - SBCMacro8bd -COpF9m16d: ; SBC a,y - addr_aCy_16br - SBCMacro16bd -COpFDm8nd: ; SBC a,x - addr_aCx_8br - SBCMacro8bnd -COpFDm16nd: ; SBC a,x - addr_aCx_16br - SBCMacro16bnd -COpFDm8d: ; SBC a,x - addr_aCx_8br - SBCMacro8bd -COpFDm16d: ; SBC a,x - addr_aCx_16br - SBCMacro16bd -COpFFm8nd: ; SBC al,x - addr_alCx_8br - SBCMacro8bnd -COpFFm16nd: ; SBC al,x - addr_alCx_16br - SBCMacro16bnd -COpFFm8d: ; SBC al,x - addr_alCx_8br - SBCMacro8bd -COpFFm16d: ; SBC al,x - addr_alCx_16br - SBCMacro16bd - -COp38: ; SEC i - mov dword[flagc],0FFh - endloop -COpF8: ; SED i - or dl,08h - mov bl,dl - mov edi,[tablead+ebx*4] - endloop -COp78: ; SEI i - or dl,04h - endloop - -COpE2: ; SEP # - SEPMacro - -COp81m8: ; STA(d,x) - STAMacro8b - addr_BdCxB_8bw - endloop -COp81m16:; STA(d,x) - STAMacro16b - addr_BdCxB_16bw - endloop -COp83m8: ; STA d,s - STAMacro8b - addr_dCs_8bw - endloop -COp83m16:; STA d,s - STAMacro16b - addr_dCs_16bw - endloop -COp85m8: ; STA d - STAMacro8b - addr_d_8bw - endloop -COp85m16:; STA d - STAMacro16b - addr_d_16bw - endloop -COp87m8: ; STA [d] - STAMacro8b - addr_LdL_8bw - endloop -COp87m16:; STA [d] - STAMacro16b - addr_LdL_16bw - endloop -COp8Dm8: ; STA a - STAMacro8b - addr_a_8bw - endloop -COp8Dm16:; STA a - STAMacro16b - addr_a_16bw - endloop -COp8Fm8: ; STA al - STAMacro8b - addr_al_8bw - endloop -COp8Fm16:; STA al - STAMacro16b - addr_al_16bw - endloop -COp91m8: ; STA(d),y - STAMacro8b - addr_BdBCy_8bw - endloop -COp91m16:; STA(d),y - STAMacro16b - addr_BdBCy_16bw - endloop -COp92m8: ; STA (d) - STAMacro8b - addr_BdB_8bw - endloop -COp92m16:; STA (d) - STAMacro16b - addr_BdB_16bw - endloop -COp93m8: ; STA(d,s),y - STAMacro8b - addr_BdCsBCy_8bw - endloop -COp93m16:; STA(d,s),y - STAMacro16b - addr_BdCsBCy_16bw - endloop -COp95m8: ; STA d,x - STAMacro8b - addr_dCx_8bw - endloop -COp95m16:; STA d,x - STAMacro16b - addr_dCx_16bw - endloop -COp97m8: ; STA [d],y - STAMacro8b - addr_LdLCy_8bw - endloop -COp97m16:; STA [d],y - STAMacro16b - addr_LdLCy_16bw - endloop -COp99m8: ; STA a,y - STAMacro8b - addr_aCy_8bw - endloop -COp99m16:; STA a,y - STAMacro16b - addr_aCy_16bw - endloop -COp9Dm8: ; STA a,x - STAMacro8b - addr_aCx_8bw - endloop -COp9Dm16:; STA a,x - STAMacro16b - addr_aCx_16bw - endloop -COp9Fm8: ; STA al,x - STAMacro8b - addr_alCx_8bw - endloop -COp9Fm16:; STA al,x - STAMacro16b - addr_alCx_16bw - endloop - -COp86x8: ; STX d - STXMacro8b - addr_d_8bw - endloop -COp86x16:; STX d - STXMacro16b - addr_d_16bw - endloop -COp8Ex8: ; STX a - STXMacro8b - addr_a_8bw - endloop -COp8Ex16:; STX a - STXMacro16b - addr_a_16bw - endloop -COp96x8: ; STX d,y - STXMacro8b - addr_dCy_8bw - endloop -COp96x16:; STX d,y - STXMacro16b - addr_dCy_16bw - endloop - -COp84x8: ; STY d - STYMacro8b - addr_d_8bw - endloop -COp84x16:; STY d - STYMacro16b - addr_d_16bw - endloop -COp8Cx8: ; STY a - STYMacro8b - addr_a_8bw - endloop -COp8Cx16:; STY a - STYMacro16b - addr_a_16bw - endloop -COp94x8: ; STYd,x - STYMacro8b - addr_dCx_8bw - endloop -COp94x16:; STYd,x - STYMacro16b - addr_dCx_16bw - endloop - -COpDB: ; STP i - dec esi - endloop - -COp64m8: ; STZ d - xor al,al - addr_d_8bw - endloop -COp64m16:; STZ d - xor eax,eax - addr_d_16bw - endloop -COp74m8: ; STZ d,x - xor al,al - addr_dCx_8bw - endloop -COp74m16:; STZ d,x - xor eax,eax - addr_dCx_16bw - endloop -COp9Cm8: ; STZ a - xor al,al - addr_a_8bw - endloop -COp9Cm16:; STZ a - xor eax,eax - addr_a_16bw - endloop -COp9Em8: ; STZ a,x - xor al,al - addr_aCx_8bw - endloop -COp9Em16:; STZ a,x - xor eax,eax - addr_aCx_16bw - endloop - -COp14m8: ; TRB d - addr_d_8brni - mov cl,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test cl,al - jz .zero - mov word[flagnz],1 - not cl - and al,cl - addr_d_8bw - endloop -.zero - mov word[flagnz],0 - not cl - and al,cl - addr_d_8bw - endloop -COp14m16:; TRB d - addr_d_16brni - mov cx,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test cx,ax - jz .zero - mov word[flagnz],1 - not cx - and ax,cx - addr_d_16bw - endloop -.zero - mov word[flagnz],0 - not cx - and ax,cx - addr_d_16bw - endloop -COp1Cm8: ; TRB a - addr_a_8brni - mov cl,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test cl,al - jz .zero - mov word[flagnz],1 - not cl - and al,cl - addr_a_8bw - endloop -.zero - mov word[flagnz],0 - not cl - and al,cl - addr_a_8bw - endloop -COp1Cm16:; TRB a - addr_a_16brni - mov cx,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test cx,ax - jz .zero - mov word[flagnz],1 - not cx - and ax,cx - addr_a_16bw - endloop -.zero - mov word[flagnz],0 - not cx - and ax,cx - addr_a_16bw - endloop - -COp04m8: ; TSB d - addr_d_8brni - mov cl,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test al,cl - jz .zero - mov word[flagnz],1 - or al,cl - addr_d_8bw - endloop -.zero - mov word[flagnz],0 - or al,cl - addr_d_8bw - endloop -COp04m16:; TSB d - addr_d_16brni - mov cx,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test ax,cx - jz .zero - mov word[flagnz],1 - or ax,cx - addr_d_16bw - endloop -.zero - mov word[flagnz],0 - or ax,cx - addr_d_16bw - endloop -COp0Cm8: ; TSB a - addr_a_8brni - mov cl,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test al,cl - jz .zero - mov word[flagnz],1 - or al,cl - addr_a_8bw - endloop -.zero - mov word[flagnz],0 - or al,cl - addr_a_8bw - endloop -COp0Cm16:; TSB a - addr_a_16brni - mov cx,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test ax,cx - jz .zero - mov word[flagnz],1 - or ax,cx - addr_a_16bw - endloop -.zero - mov word[flagnz],0 - or ax,cx - addr_a_16bw - endloop - -COpAAx8: ; TAX i - mov al,[xa] - mov [xx],al - flagsetnz8b - endloop -COpAAx16:; TAX i - mov ax,[xa] - mov [xx],ax - flagsetnz16b - endloop -COpA8x8: ; TAY i - mov al,[xa] - mov [xy],al - flagsetnz8b - endloop -COpA8x16:; TAY i - mov ax,[xa] - mov [xy],ax - flagsetnz16b - endloop -COp5B: ; TCD i - mov ax,[xa] - mov [xd],ax - call UpdateDPage - flagsetnz16b - endloop -COp1B: ; TCS i - mov ax,[xa] - test byte[xe],1 - jnz .emul - mov [xs],ax - endloop -.emul - mov [xs],al - endloop -COp7B: ; TDC i - mov ax,[xd] - mov [xa],ax - flagsetnz16b - endloop -COp3B: ; TSC i - mov ax,[xs] - mov [xa],ax - flagsetnz16b - endloop -COpBAx8: ; TSX i - mov al,[xs] - mov [xx],al - flagsetnz8b - endloop -COpBAx16:; TSX i - mov ax,[xs] - mov [xx],ax - flagsetnz16b - endloop -COp8Am8: ; TXA i - mov al,[xx] - mov [xa],al - flagsetnz8b - endloop -COp8Am16:; TXA i - mov ax,[xx] - mov [xa],ax - flagsetnz16b - endloop -COp9A: ; TXS i - mov ax,[xx] - mov [xs],ax - test byte[xe],1 - jnz .emul - endloop -.emul - mov byte[xs+1],1 - endloop -COp9Bx8: ; TXY i - mov al,[xx] - mov [xy],al - flagsetnz8b - endloop -COp9Bx16:; TXY i - mov ax,[xx] - mov [xy],ax - flagsetnz16b - endloop -COp98m8: ; TYA i - mov al,[xy] - mov [xa],al - flagsetnz8b - endloop -COp98m16:; TYA i - mov ax,[xy] - mov [xa],ax - flagsetnz16b - endloop -COpBBx8: ; TYX i - mov al,[xy] - mov [xx],al - flagsetnz8b - endloop -COpBBx16:; TYX i - mov ax,[xy] - mov [xx],ax - flagsetnz16b - endloop - -COpCB: ; WAI i - WAIMacro - -COpEB: ; XBA i - mov ah,[xa] - mov al,[xa+1] - mov [xa],ax - flagsetnz8b - endloop - -COpFB: ; XCE i - XCEMacro - -COp42: ; WDM - inc esi - endloop - -NEWSYM E65816IncEnd - - diff --git a/tools/zsnes/src/cpu/e65816c.inc b/tools/zsnes/src/cpu/e65816c.inc deleted file mode 100644 index 412e1a6..0000000 --- a/tools/zsnes/src/cpu/e65816c.inc +++ /dev/null @@ -1,1992 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 brkv,brkv8,copv,copv8,curexecstate,curnmi,initaddrl,intrset -EXTSYM membank0r16,membank0r8,membank0w16,membank0w8 -EXTSYM memtabler16,memtabler8,memtablew16,memtablew8 -EXTSYM nmistatus,regaccessbankr8,snesmap2,snesmmap,stackand,stackor -EXTSYM wramdata,xa,xd,xdb,xe,xirqb,xpb,xpc,xs,xx,xy -EXTSYM UpdateDPage,DPageR8,DPageW8,DPageR16,DPageW16 - -; B = ( or ) -; C = , -; L = [ or ] -; I = # - -SECTION .text - -COp61m8nd: ; ADC(d,x) - addr_BdCxB_8br - ADCMacro8bnd -COp61m16nd: ; ADC(d,x) - addr_BdCxB_16br - ADCMacro16bnd -COp61m8d: ; ADC(d,x) - addr_BdCxB_8br - ADCMacro8bd -COp61m16d: ; ADC(d,x) - addr_BdCxB_16br - ADCMacro16bd -COp63m8nd: ; ADC d,s - addr_dCs_8br - ADCMacro8bnd -COp63m16nd: ; ADC d,s - addr_dCs_16br - ADCMacro16bnd -COp63m8d: ; ADC d,s - addr_dCs_8br - ADCMacro8bd -COp63m16d: ; ADC d,s - addr_dCs_16br - ADCMacro16bd -COp65m8nd: ; ADC d - addr_d_8br - ADCMacro8bnd -COp65m16nd: ; ADC d - addr_d_16br - ADCMacro16bnd -COp65m8d: ; ADC d - addr_d_8br - ADCMacro8bd -COp65m16d: ; ADC d - addr_d_16br - ADCMacro16bd -COp67m8nd: ; ADC [d] - addr_LdL_8br - ADCMacro8bnd -COp67m16nd: ; ADC [d] - addr_LdL_16br - ADCMacro16bnd -COp67m8d: ; ADC [d] - addr_LdL_8br - ADCMacro8bd -COp67m16d: ; ADC [d] - addr_LdL_16br - ADCMacro16bd -COp69m8nd: ; ADC # - addr_I_8br - ADCMacro8bnd -COp69m16nd: ; ADC # - addr_I_16br - ADCMacro16bnd -COp69m8d: ; ADC # - addr_I_8br - ADCMacro8bd -COp69m16d: ; ADC # - addr_I_16br - ADCMacro16bd -COp6Dm8nd: ; ADC a - addr_a_8br - ADCMacro8bnd -COp6Dm16nd: ; ADC a - addr_a_16br - ADCMacro16bnd -COp6Dm8d: ; ADC a - addr_a_8br - ADCMacro8bd -COp6Dm16d: ; ADC a - addr_a_16br - ADCMacro16bd -COp6Fm8nd: ; ADC al - addr_al_8br - ADCMacro8bnd -COp6Fm16nd: ; ADC al - addr_al_16br - ADCMacro16bnd -COp6Fm8d: ; ADC al - addr_al_8br - ADCMacro8bd -COp6Fm16d: ; ADC al - addr_al_16br - ADCMacro16bd -COp71m8nd: ; ADC(d),y - addr_BdBCy_8br - ADCMacro8bnd -COp71m16nd: ; ADC(d),y - addr_BdBCy_16br - ADCMacro16bnd -COp71m8d: ; ADC(d),y - addr_BdBCy_8br - ADCMacro8bd -COp71m16d: ; ADC(d),y - addr_BdBCy_16br - ADCMacro16bd -COp72m8nd: ; ADC (d) - addr_BdB_8br - ADCMacro8bnd -COp72m16nd: ; ADC (d) - addr_BdB_16br - ADCMacro16bnd -COp72m8d: ; ADC (d) - addr_BdB_8br - ADCMacro8bd -COp72m16d: ; ADC (d) - addr_BdB_16br - ADCMacro16bd -COp73m8nd: ; ADC(d,s),y - addr_BdCsBCy_8br - ADCMacro8bnd -COp73m16nd: ; ADC(d,s),y - addr_BdCsBCy_16br - ADCMacro16bnd -COp73m8d: ; ADC(d,s),y - addr_BdCsBCy_8br - ADCMacro8bd -COp73m16d: ; ADC(d,s),y - addr_BdCsBCy_16br - ADCMacro16bd -COp75m8nd: ; ADC d,x - addr_dCx_8br - ADCMacro8bnd -COp75m16nd: ; ADC d,x - addr_dCx_16br - ADCMacro16bnd -COp75m8d: ; ADC d,x - addr_dCx_8br - ADCMacro8bd -COp75m16d: ; ADC d,x - addr_dCx_16br - ADCMacro16bd -COp77m8nd: ; ADC [d],y - addr_LdLCy_8br - ADCMacro8bnd -COp77m16nd: ; ADC [d],y - addr_LdLCy_16br - ADCMacro16bnd -COp77m8d: ; ADC [d],y - addr_LdLCy_8br - ADCMacro8bd -COp77m16d: ; ADC [d],y - addr_LdLCy_16br - ADCMacro16bd -COp79m8nd: ; ADC a,y - addr_aCy_8br - ADCMacro8bnd -COp79m16nd: ; ADC a,y - addr_aCy_16br - ADCMacro16bnd -COp79m8d: ; ADC a,y - addr_aCy_8br - ADCMacro8bd -COp79m16d: ; ADC a,y - addr_aCy_16br - ADCMacro16bd -COp7Dm8nd: ; ADC a,x - addr_aCx_8br - ADCMacro8bnd -COp7Dm16nd: ; ADC a,x - addr_aCx_16br - ADCMacro16bnd -COp7Dm8d: ; ADC a,x - addr_aCx_8br - ADCMacro8bd -COp7Dm16d: ; ADC a,x - addr_aCx_16br - ADCMacro16bd -COp7Fm8nd: ; ADC al,x - addr_alCx_8br - ADCMacro8bnd -COp7Fm16nd: ; ADC al,x - addr_alCx_16br - ADCMacro16bnd -COp7Fm8d: ; ADC al,x - addr_alCx_8br - ADCMacro8bd -COp7Fm16d: ; ADC al,x - addr_alCx_16br - ADCMacro16bd - -COp21m8: ; AND(d,x) - addr_BdCxB_8br - ANDMacro8b -COp21m16:; AND(d,x) - addr_BdCxB_16br - ANDMacro16b -COp23m8: ; AND d,s - addr_dCs_8br - ANDMacro8b -COp23m16:; AND d,s - addr_dCs_16br - ANDMacro16b -COp25m8: ; AND d - addr_d_8br - ANDMacro8b -COp25m16:; AND d - addr_d_16br - ANDMacro16b -COp27m8: ; AND [d] - addr_LdL_8br - ANDMacro8b -COp27m16:; AND [d] - addr_LdL_16br - ANDMacro16b -COp29m8: ; AND # - addr_I_8br - ANDMacro8b -COp29m16:; AND # - addr_I_16br - ANDMacro16b -COp2Dm8: ; AND a - addr_a_8br - ANDMacro8b -COp2Dm16:; AND a - addr_a_16br - ANDMacro16b -COp2Fm8: ; AND al - addr_al_8br - ANDMacro8b -COp2Fm16:; AND al - addr_al_16br - ANDMacro16b -COp31m8: ; AND(d),y - addr_BdBCy_8br - ANDMacro8b -COp31m16:; AND(d),y - addr_BdBCy_16br - ANDMacro16b -COp32m8: ; AND (d) - addr_BdB_8br - ANDMacro8b -COp32m16:; AND (d) - addr_BdB_16br - ANDMacro16b -COp33m8: ; AND(d,s),y - addr_BdCsBCy_8br - ANDMacro8b -COp33m16:; AND(d,s),y - addr_BdCsBCy_16br - ANDMacro16b -COp35m8: ; AND d,x - addr_dCx_8br - ANDMacro8b -COp35m16:; AND d,x - addr_dCx_16br - ANDMacro16b -COp37m8: ; AND [d],y - addr_LdLCy_8br - ANDMacro8b -COp37m16:; AND [d],y - addr_LdLCy_16br - ANDMacro16b -COp39m8: ; AND a,y - addr_aCy_8br - ANDMacro8b -COp39m16:; AND a,y - addr_aCy_16br - ANDMacro16b -COp3Dm8: ; AND a,x - addr_aCx_8br - ANDMacro8b -COp3Dm16:; AND a,x - addr_aCx_16br - ANDMacro16b -COp3Fm8: ; AND al,x - addr_alCx_8br - ANDMacro8b -COp3Fm16:; AND al,x - addr_alCx_16br - ANDMacro16b - -COp06m8: ; ASL d - addr_d_8brni - ASLMacro8b - addr_d_8bw - endloop -COp06m16:; ASL d - addr_d_16brni - ASLMacro16b - addr_d_16bw - endloop -COp0Am8: ; ASL A - addr_A_8brni - ASLMacro8b - addr_A_8bw - endloop -COp0Am16:; ASL A - addr_A_16brni - ASLMacro16b - addr_A_16bw - endloop -COp0Em8: ; ASL a - addr_a_8brni - ASLMacro8b - addr_a_8bw - endloop -COp0Em16:; ASL a - addr_a_16brni - ASLMacro16b - addr_a_16bw - endloop -COp16m8: ; ASL d,x - addr_dCx_8brni - ASLMacro8b - addr_dCx_8bw - endloop -COp16m16:; ASL d,x - addr_dCx_16brni - ASLMacro16b - addr_dCx_16bw - endloop -COp1Em8: ; ASL a,x - addr_aCx_8brni - ASLMacro8b - addr_aCx_8bw - endloop -COp1Em16:; ASL a,x - addr_aCx_16brni - ASLMacro16b - addr_aCx_16bw - endloop - -COp90: ; BCC r - test byte[flagc],01h - jnz .skip - JumpMacro -COpB0: ; BCS r - test byte[flagc],01h - jz .skip - JumpMacro -COpF0: ; BEQ r - test dword[flagnz],0FFFFh - jnz .skip - JumpMacro -COp30: ; BMI r - test dword[flagnz],018000h - jz .skip - JumpMacro -COpD0: ; BNE r - test dword[flagnz],0FFFFh - jz .skip - JumpMacro -COp10: ; BPL r - test dword[flagnz],018000h - jnz .skip - JumpMacro -COp80: ; BRA r - movsx eax,byte[esi] - inc esi - add esi,eax - endloop -COp50: ; BVC r - test dword[flago],0FFh - jnz .skip - JumpMacro -COp70: ; BVS r - test dword[flago],0FFh - jz .skip - JumpMacro - -; BIT instruction does not affect N and V flags when using immediate -; addressing mode. When using other addressing modes, the N and V flags - -COp89m8: ; BIT # - BITMacroim8b -COp89m16:; BIT # - BITMacroim16b - -COp24m8: ; BIT d - addr_d_8br - BITMacro8b -COp24m16:; BIT d - addr_d_16br - BITMacro16b -COp2Cm8: ; BIT a - addr_a_8br - BITMacro8b -COp2Cm16:; BIT a - addr_a_16br - BITMacro16b -COp34m8: ; BIT d,x - addr_dCx_8br - BITMacro8b -COp34m16:; BIT d,x - addr_dCx_16br - BITMacro16b -COp3Cm8: ; BIT a,x - addr_aCx_8br - BITMacro8b -COp3Cm16:; BIT a,x - addr_aCx_16br - BITMacro16b - -COp00: ; BRK s - BRKMacro - -COp82: ; BRL rl - BRLMacro - -COp18: ; CLC i - mov dword[flagc],0 - endloop -COpD8: ; CLD i - and dl,0F7h - mov bl,dl - mov edi,[tableadc+ebx*4] - endloop -COp58: ; CLI i - and dl,0FBh - endloop -COpB8: ; CLV i - mov dword[flago],0 - endloop - -COpC1m8: ; CMP(d,x) - addr_BdCxB_8br - CMPMacro8b -COpC1m16:; CMP(d,x) - addr_BdCxB_16br - CMPMacro16b -COpC3m8: ; CMP d,s - addr_dCs_8br - CMPMacro8b -COpC3m16:; CMP d,s - addr_dCs_16br - CMPMacro16b -COpC5m8: ; CMP d - addr_d_8br - CMPMacro8b -COpC5m16:; CMP d - addr_d_16br - CMPMacro16b -COpC7m8: ; CMP [d] - addr_LdL_8br - CMPMacro8b -COpC7m16:; CMP [d] - addr_LdL_16br - CMPMacro16b -COpC9m8: ; CMP # - addr_I_8br - CMPMacro8b -COpC9m16:; CMP # - addr_I_16br - CMPMacro16b -COpCDm8: ; CMP a - addr_a_8br - CMPMacro8b -COpCDm16:; CMP a - addr_a_16br - CMPMacro16b -COpCFm8: ; CMP al - addr_al_8br - CMPMacro8b -COpCFm16:; CMP al - addr_al_16br - CMPMacro16b -COpD1m8: ; CMP(d),y - addr_BdBCy_8br - CMPMacro8b -COpD1m16:; CMP(d),y - addr_BdBCy_16br - CMPMacro16b -COpD2m8: ; CMP (d) - addr_BdB_8br - CMPMacro8b -COpD2m16:; CMP (d) - addr_BdB_16br - CMPMacro16b -COpD3m8: ; CMP(d,s),y - addr_BdCsBCy_8br - CMPMacro8b -COpD3m16:; CMP(d,s),y - addr_BdCsBCy_16br - CMPMacro16b -COpD5m8: ; CMP d,x - addr_dCx_8br - CMPMacro8b -COpD5m16:; CMP d,x - addr_dCx_16br - CMPMacro16b -COpD7m8: ; CMP [d],y - addr_LdLCy_8br - CMPMacro8b -COpD7m16:; CMP [d],y - addr_LdLCy_16br - CMPMacro16b -COpD9m8: ; CMP a,y - addr_aCy_8br - CMPMacro8b -COpD9m16:; CMP a,y - addr_aCy_16br - CMPMacro16b -COpDDm8: ; CMP a,x - addr_aCx_8br - CMPMacro8b -COpDDm16:; CMP a,x - addr_aCx_16br - CMPMacro16b -COpDFm8: ; CMP al,x - addr_alCx_8br - CMPMacro8b -COpDFm16:; CMP al,x - addr_alCx_16br - CMPMacro16b - -COp02: ; COP s - COPMacro - -COpE0x8: ; CPX # - addr_I_8br - CPXMacro8b -COpE0x16:; CPX # - addr_I_16br - CPXMacro16b -COpE4x8: ; CPX d - addr_d_8br - CPXMacro8b -COpE4x16:; CPX d - addr_d_16br - CPXMacro16b -COpECx8: ; CPX a - addr_a_8br - CPXMacro8b -COpECx16:; CPX a - addr_a_16br - CPXMacro16b - -COpC0x8: ; CPY # - addr_I_8br - CPYMacro8b -COpC0x16:; CPY # - addr_I_16br - CPYMacro16b -COpC4x8: ; CPY d - addr_d_8br - CPYMacro8b -COpC4x16:; CPY d - addr_d_16br - CPYMacro16b -COpCCx8: ; CPY a - addr_a_8br - CPYMacro8b -COpCCx16:; CPY a - addr_a_16br - CPYMacro16b - -COp3Am8: ; DEC A - addr_A_8brni - dec al - flagsetnz8bnel - addr_A_8bw - endloop -COp3Am16:; DEC A - addr_A_16brni - dec ax - flagsetnz16bnel - addr_A_16bw - endloop -COpCEm8: ; DEC a - addr_a_8brni - dec al - flagsetnz8bnel - addr_a_8bw - endloop -COpCEm16:; DEC a - addr_a_16brni - dec ax - flagsetnz16bnel - addr_a_16bw - endloop -COpC6m8: ; DEC d - addr_d_8brni - dec al - flagsetnz8bnel - addr_d_8bw - endloop -COpC6m16:; DEC d - addr_d_16brni - dec ax - flagsetnz16bnel - addr_d_16bw - endloop -COpD6m8: ; DEC d,x - addr_dCx_8brni - dec al - flagsetnz8bnel - addr_dCx_8bw - endloop -COpD6m16:; DEC d,x - addr_dCx_16brni - dec ax - flagsetnz16bnel - addr_dCx_16bw - endloop -COpDEm8: ; DEC a,x - addr_aCx_8brni - dec al - flagsetnz8bnel - addr_aCx_8bw - endloop -COpDEm16:; DEC a,x - addr_aCx_16brni - dec ax - flagsetnz16bnel - addr_aCx_16bw - endloop - -COpCAx8: ; DEX i - dec byte[xx] - mov al,[xx] - flagsetnz8b - endloop -COpCAx16:; DEX i - dec word[xx] - mov ax,[xx] - flagsetnz16b - endloop -COp88x8: ; DEY i - dec byte[xy] - mov al,[xy] - flagsetnz8b - endloop -COp88x16:; DEY i - dec word[xy] - mov ax,[xy] - flagsetnz16b - endloop - -COp41m8: ; EOR(d,x) - addr_BdCxB_8br - EORMacro8b -COp41m16:; EOR(d,x) - addr_BdCxB_16br - EORMacro16b -COp43m8: ; EOR d,s - addr_dCs_8br - EORMacro8b -COp43m16:; EOR d,s - addr_dCs_16br - EORMacro16b -COp45m8: ; EOR d - addr_d_8br - EORMacro8b -COp45m16:; EOR d - addr_d_16br - EORMacro16b -COp47m8: ; EOR [d] - addr_LdL_8br - EORMacro8b -COp47m16:; EOR [d] - addr_LdL_16br - EORMacro16b -COp49m8: ; EOR # - addr_I_8br - EORMacro8b -COp49m16:; EOR # - addr_I_16br - EORMacro16b -COp4Dm8: ; EOR a - addr_a_8br - EORMacro8b -COp4Dm16:; EOR a - addr_a_16br - EORMacro16b -COp4Fm8: ; EOR al - addr_al_8br - EORMacro8b -COp4Fm16:; EOR al - addr_al_16br - EORMacro16b -COp51m8: ; EOR(d),y - addr_BdBCy_8br - EORMacro8b -COp51m16:; EOR(d),y - addr_BdBCy_16br - EORMacro16b -COp52m8: ; EOR (d) - addr_BdB_8br - EORMacro8b -COp52m16:; EOR (d) - addr_BdB_16br - EORMacro16b -COp53m8: ; EOR(d,s),y - addr_BdCsBCy_8br - EORMacro8b -COp53m16:; EOR(d,s),y - addr_BdCsBCy_16br - EORMacro16b -COp55m8: ; EOR d,x - addr_dCx_8br - EORMacro8b -COp55m16:; EOR d,x - addr_dCx_16br - EORMacro16b -COp57m8: ; EOR [d],y - addr_LdLCy_8br - EORMacro8b -COp57m16:; EOR [d],y - addr_LdLCy_16br - EORMacro16b -COp59m8: ; EOR a,y - addr_aCy_8br - EORMacro8b -COp59m16:; EOR a,y - addr_aCy_16br - EORMacro16b -COp5Dm8: ; EORa,x - addr_aCx_8br - EORMacro8b -COp5Dm16:; EORa,x - addr_aCx_16br - EORMacro16b -COp5Fm8: ; EOR al,x - addr_alCx_8br - EORMacro8b -COp5Fm16:; EOR al,x - addr_alCx_16br - EORMacro16b - - -COp1Am8: ; INC A - addr_A_8brni - inc al - flagsetnz8bnel - addr_A_8bw - endloop -COp1Am16:; INC A - addr_A_16brni - inc ax - flagsetnz16bnel - addr_A_16bw - endloop -COpEEm8: ; INC a - addr_a_8brni - inc al - flagsetnz8bnel - addr_a_8bw - endloop -COpEEm16:; INC a - addr_a_16brni - inc ax - flagsetnz16bnel - addr_a_16bw - endloop -COpE6m8: ; INC d - addr_d_8brni - inc al - flagsetnz8bnel - addr_d_8bw - endloop -COpE6m16:; INC d - addr_d_16brni - inc ax - flagsetnz16bnel - addr_d_16bw - endloop -COpF6m8: ; INC d,x - addr_dCx_8brni - inc al - flagsetnz8bnel - addr_dCx_8bw - endloop -COpF6m16:; INC d,x - addr_dCx_16brni - inc ax - flagsetnz16bnel - addr_dCx_16bw - endloop -COpFEm8: ; INC a,x - addr_aCx_8brni - inc al - flagsetnz8bnel - addr_aCx_8bw - endloop -COpFEm16:; INC a,x - addr_aCx_16brni - inc ax - flagsetnz16bnel - addr_aCx_16bw - endloop - - -COpE8x8: ; INX i - inc byte[xx] - mov al,[xx] - flagsetnz8b - endloop -COpE8x16:; INX i - inc word[xx] - mov ax,[xx] - flagsetnz16b - endloop -COpC8x8: ; INY i - inc byte[xy] - mov al,[xy] - flagsetnz8b - endloop -COpC8x16:; INY i - inc word[xy] - mov ax,[xy] - flagsetnz16b - endloop - -COpDC: ; JML (a) - JMLMacro -COp4C: ; JMP a - JMPMacro4C -COp6C: ; JMP (a) - JMPMacro6C -COp7C: ; JMP(a,x) - JMPMacro7C -COp5C: ; JMP al - JMPMacro5C - -COp22: ; JSL al - JSLMacro -COp20: ; JSR a - JSRMacro20 -COpFC: ; JSR(a,x) - JSRMacroFC - -COpA1m8: ; LDA(d,x) - addr_BdCxB_8br - LDAMacro8b -COpA1m16:; LDA(d,x) - addr_BdCxB_16br - LDAMacro16b -COpA3m8: ; LDA d,s - addr_dCs_8br - LDAMacro8b -COpA3m16:; LDA d,s - addr_dCs_16br - LDAMacro16b -COpA5m8: ; LDA d - addr_d_8br - LDAMacro8b -COpA5m16:; LDA d - addr_d_16br - LDAMacro16b -COpA7m8: ; LDA [d] - addr_LdL_8br - LDAMacro8b -COpA7m16:; LDA [d] - addr_LdL_16br - LDAMacro16b -COpA9m8: ; LDA # - addr_I_8br - LDAMacro8b -COpA9m16:; LDA # - addr_I_16br - LDAMacro16b -COpADm8: ; LDA a - addr_a_8br - LDAMacro8b -COpADm16:; LDA a - addr_a_16br - LDAMacro16b -COpAFm8: ; LDA al - addr_al_8br - LDAMacro8b -COpAFm16:; LDA al - addr_al_16br - LDAMacro16b -COpB1m8: ; LDA(d),y - addr_BdBCy_8br - LDAMacro8b -COpB1m16:; LDA(d),y - addr_BdBCy_16br - LDAMacro16b -COpB2m8: ; LDA (d) - addr_BdB_8br - LDAMacro8b -COpB2m16:; LDA (d) - addr_BdB_16br - LDAMacro16b -COpB3m8: ; LDA(d,s),y - addr_BdCsBCy_8br - LDAMacro8b -COpB3m16:; LDA(d,s),y - addr_BdCsBCy_16br - LDAMacro16b -COpB5m8: ; LDA d,x - addr_dCx_8br - LDAMacro8b -COpB5m16:; LDA d,x - addr_dCx_16br - LDAMacro16b -COpB7m8: ; LDA [d],y - addr_LdLCy_8br - LDAMacro8b -COpB7m16:; LDA [d],y - addr_LdLCy_16br - LDAMacro16b -COpB9m8: ; LDA a,y - addr_aCy_8br - LDAMacro8b -COpB9m16:; LDA a,y - addr_aCy_16br - LDAMacro16b -COpBDm8: ; LDA a,x - addr_aCx_8br - LDAMacro8b -COpBDm16:; LDA a,x - addr_aCx_16br - LDAMacro16b -COpBFm8: ; LDA al,x - addr_alCx_8br - LDAMacro8b -COpBFm16:; LDA al,x - addr_alCx_16br - LDAMacro16b - -COpA2x8: ; LDX # - addr_I_8br - LDXMacro8b -COpA2x16:; LDX # - addr_I_16br - LDXMacro16b -COpA6x8: ; LDX d - addr_d_8br - LDXMacro8b -COpA6x16:; LDX d - addr_d_16br - LDXMacro16b -COpAEx8: ; LDX a - addr_a_8br - LDXMacro8b -COpAEx16:; LDX a - addr_a_16br - LDXMacro16b -COpB6x8: ; LDX d,y - addr_dCy_8br - LDXMacro8b -COpB6x16:; LDX d,y - addr_dCy_16br - LDXMacro16b -COpBEx8: ; LDX a,y - addr_aCy_8br - LDXMacro8b -COpBEx16:; LDX a,y - addr_aCy_16br - LDXMacro16b - -COpA0x8: ; LDY # - addr_I_8br - LDYMacro8b -COpA0x16:; LDY # - addr_I_16br - LDYMacro16b -COpA4x8: ; LDY d - addr_d_8br - LDYMacro8b -COpA4x16:; LDY d - addr_d_16br - LDYMacro16b -COpACx8: ; LDY a - addr_a_8br - LDYMacro8b -COpACx16:; LDY a - addr_a_16br - LDYMacro16b -COpB4x8: ; LDY d,x - addr_dCx_8br - LDYMacro8b -COpB4x16:; LDY d,x - addr_dCx_16br - LDYMacro16b -COpBCx8: ; LDY a,x - addr_aCx_8br - LDYMacro8b -COpBCx16:; LDY a,x - addr_aCx_16br - LDYMacro16b - -COp46m8: ; LSR d - addr_d_8brni - LSRMacro8b - addr_d_8bw - endloop -COp46m16:; LSR d - addr_d_16brni - LSRMacro16b - addr_d_16bw - endloop -COp4Am8: ; LSR A - addr_A_8brni - LSRMacro8b - addr_A_8bw - endloop -COp4Am16:; LSR A - addr_A_16brni - LSRMacro16b - addr_A_16bw - endloop -COp4Em8: ; LSR a - addr_a_8brni - LSRMacro8b - addr_a_8bw - endloop -COp4Em16:; LSR a - addr_a_16brni - LSRMacro16b - addr_a_16bw - endloop -COp56m8: ; LSR d,x - addr_dCx_8brni - LSRMacro8b - addr_dCx_8bw - endloop -COp56m16:; LSR d,x - addr_dCx_16brni - LSRMacro16b - addr_dCx_16bw - endloop -COp5Em8: ; LSRa,x - addr_aCx_8brni - LSRMacro8b - addr_aCx_8bw - endloop -COp5Em16:; LSRa,x - addr_aCx_16brni - LSRMacro16b - addr_aCx_16bw - endloop - -COp54: ; MVN xya - MVNMacro -COp44: ; MVP xya - MVPMacro - -COpEA: ; NOP i - endloop - -COp01m8: ; ORA(d,x) - addr_BdCxB_8br - ORAMacro8b -COp01m16:; ORA(d,x) - addr_BdCxB_16br - ORAMacro16b -COp03m8: ; ORA d,s - addr_dCs_8br - ORAMacro8b -COp03m16:; ORA d,s - addr_dCs_16br - ORAMacro16b -COp05m8: ; ORA d - addr_d_8br - ORAMacro8b -COp05m16:; ORA d - addr_d_16br - ORAMacro16b -COp07m8: ; ORA [d] - addr_LdL_8br - ORAMacro8b -COp07m16:; ORA [d] - addr_LdL_16br - ORAMacro16b -COp09m8: ; ORA # - addr_I_8br - ORAMacro8b -COp09m16:; ORA # - addr_I_16br - ORAMacro16b -COp0Dm8: ; ORA a - addr_a_8br - ORAMacro8b -COp0Dm16:; ORA a - addr_a_16br - ORAMacro16b -COp0Fm8: ; ORA al - addr_al_8br - ORAMacro8b -COp0Fm16:; ORA al - addr_al_16br - ORAMacro16b -COp11m8: ; ORA(d),y - addr_BdBCy_8br - ORAMacro8b -COp11m16:; ORA(d),y - addr_BdBCy_16br - ORAMacro16b -COp12m8: ; ORA(d) - addr_BdB_8br - ORAMacro8b -COp12m16:; ORA(d) - addr_BdB_16br - ORAMacro16b -COp13m8: ; ORA(d,s),y - addr_BdCsBCy_8br - ORAMacro8b -COp13m16:; ORA(d,s),y - addr_BdCsBCy_16br - ORAMacro16b -COp15m8: ; ORA d,x - addr_dCx_8br - ORAMacro8b -COp15m16:; ORA d,x - addr_dCx_16br - ORAMacro16b -COp17m8: ; ORA [d],y - addr_LdLCy_8br - ORAMacro8b -COp17m16:; ORA [d],y - addr_LdLCy_16br - ORAMacro16b -COp19m8: ; ORA a,y - addr_aCy_8br - ORAMacro8b -COp19m16:; ORA a,y - addr_aCy_16br - ORAMacro16b -COp1Dm8: ; ORA a,x - addr_aCx_8br - ORAMacro8b -COp1Dm16:; ORA a,x - addr_aCx_16br - ORAMacro16b -COp1Fm8: ; ORA al,x - addr_alCx_8br - ORAMacro8b -COp1Fm16:; ORA al,x - addr_alCx_16br - ORAMacro16b - -COpF4: ; PEA s - PEAMacro -COpD4: ; PEI s - PEIMacro -COp62: ; PER s - PERMacro - -COp48m8: ; PHA s - PUSHMacro8b [xa] -COp48m16:; PHA s - PUSHMacro16b [xa], [xa+1] -COp8B: ; PHB s - PUSHMacro8b [xdb] -COp0B: ; PHD s - PUSHMacro16b [xd], [xd+1] -COp4B: ; PHK s - PUSHMacro8b [xpb] -COp08: ; PHP s - PUSHMacro8bp -COpDAx8: ; PHX s - PUSHMacro8b [xx] -COpDAx16:; PHX s - PUSHMacro16b [xx], [xx+1] -COp5Ax8: ; PHY s - PUSHMacro8b [xy] -COp5Ax16:; PHY s - PUSHMacro16b [xy], [xy+1] - -COp68m8: ; PLA s - POPMacro8b [xa] -COp68m16:; PLA s - POPMacro16b [xa], [xa+1] -COpAB: ; PLB s - POPMacro8b [xdb] -COp2B: ; PLD s - POPMacro16bd [xd], [xd+1] -COp28: ; PLP s - POPMacroP -COpFAx8: ; PLX s - POPMacro8b [xx] -COpFAx16:; PLX s - POPMacro16b [xx], [xx+1] -COp7Ax8: ; PLY s - POPMacro8b [xy] -COp7Ax16:; PLY s - POPMacro16b [xy], [xy+1] - -COpC2: ; REP # - REPMacro - -COp26m8: ; ROL d - addr_d_8brni - ROLMacro8b - addr_d_8bw - endloop -COp26m16:; ROL d - addr_d_16brni - ROLMacro16b - addr_d_16bw - endloop -COp2Am8: ; ROL A - addr_A_8brni - ROLMacro8b - addr_A_8bw - endloop -COp2Am16:; ROL A - addr_A_16brni - ROLMacro16b - addr_A_16bw - endloop -COp2Em8: ; ROL a - addr_a_8brni - ROLMacro8b - addr_a_8bw - endloop -COp2Em16:; ROL a - addr_a_16brni - ROLMacro16b - addr_a_16bw - endloop -COp36m8: ; ROL d,x - addr_dCx_8brni - ROLMacro8b - addr_dCx_8bw - endloop -COp36m16:; ROL d,x - addr_dCx_16brni - ROLMacro16b - addr_dCx_16bw - endloop -COp3Em8: ; ROL a,x - addr_aCx_8brni - ROLMacro8b - addr_aCx_8bw - endloop -COp3Em16:; ROL a,x - addr_aCx_16brni - ROLMacro16b - addr_aCx_16bw - endloop - -COp66m8: ; ROR d - addr_d_8brni - RORMacro8b - addr_d_8bw - endloop -COp66m16:; ROR d - addr_d_16brni - RORMacro16b - addr_d_16bw - endloop -COp6Am8: ; ROR A - addr_A_8brni - RORMacro8b - addr_A_8bw - endloop -COp6Am16:; ROR A - addr_A_16brni - RORMacro16b - addr_A_16bw - endloop -COp6Em8: ; ROR a - addr_a_8brni - RORMacro8b - addr_a_8bw - endloop -COp6Em16:; ROR a - addr_a_16brni - RORMacro16b - addr_a_16bw - endloop -COp76m8: ; ROR d,x - addr_dCx_8brni - RORMacro8b - addr_dCx_8bw - endloop -COp76m16:; ROR d,x - addr_dCx_16brni - RORMacro16b - addr_dCx_16bw - endloop -COp7Em8: ; ROR a,x - addr_aCx_8brni - RORMacro8b - addr_aCx_8bw - endloop -COp7Em16:; ROR a,x - addr_aCx_16brni - RORMacro16b - addr_aCx_16bw - endloop - -COp40: ; RTI s - RTIMacro -COp6B: ; RTL s - RTLMacro -COp60: ; RTS s - RTSMacro - -COpE1m8nd: ; SBC(d,x) - addr_BdCxB_8br - SBCMacro8bnd -COpE1m16nd: ; SBC(d,x) - addr_BdCxB_16br - SBCMacro16bnd -COpE1m8d: ; SBC(d,x) - addr_BdCxB_8br - SBCMacro8bd -COpE1m16d: ; SBC(d,x) - addr_BdCxB_16br - SBCMacro16bd -COpE3m8nd: ; SBC d,s - addr_dCs_8br - SBCMacro8bnd -COpE3m16nd: ; SBC d,s - addr_dCs_16br - SBCMacro16bnd -COpE3m8d: ; SBC d,s - addr_dCs_8br - SBCMacro8bd -COpE3m16d: ; SBC d,s - addr_dCs_16br - SBCMacro16bd -COpE5m8nd: ; SBC d - addr_d_8br - SBCMacro8bnd -COpE5m16nd: ; SBC d - addr_d_16br - SBCMacro16bnd -COpE5m8d: ; SBC d - addr_d_8br - SBCMacro8bd -COpE5m16d: ; SBC d - addr_d_16br - SBCMacro16bd -COpE7m8nd: ; SBC [d] - addr_LdL_8br - SBCMacro8bnd -COpE7m16nd: ; SBC [d] - addr_LdL_16br - SBCMacro16bnd -COpE7m8d: ; SBC [d] - addr_LdL_8br - SBCMacro8bd -COpE7m16d: ; SBC [d] - addr_LdL_16br - SBCMacro16bd -COpE9m8nd: ; SBC # - addr_I_8br - SBCMacro8bnd -COpE9m16nd: ; SBC # - addr_I_16br - SBCMacro16bnd -COpE9m8d: ; SBC # - addr_I_8br - SBCMacro8bd -COpE9m16d: ; SBC # - addr_I_16br - SBCMacro16bd -COpEDm8nd: ; SBC a - addr_a_8br - SBCMacro8bnd -COpEDm16nd: ; SBC a - addr_a_16br - SBCMacro16bnd -COpEDm8d: ; SBC a - addr_a_8br - SBCMacro8bd -COpEDm16d: ; SBC a - addr_a_16br - SBCMacro16bd -COpEFm8nd: ; SBC al - addr_al_8br - SBCMacro8bnd -COpEFm16nd: ; SBC al - addr_al_16br - SBCMacro16bnd -COpEFm8d: ; SBC al - addr_al_8br - SBCMacro8bd -COpEFm16d: ; SBC al - addr_al_16br - SBCMacro16bd -COpF1m8nd: ; SBC(d),y - addr_BdBCy_8br - SBCMacro8bnd -COpF1m16nd: ; SBC(d),y - addr_BdBCy_16br - SBCMacro16bnd -COpF1m8d: ; SBC(d),y - addr_BdBCy_8br - SBCMacro8bd -COpF1m16d: ; SBC(d),y - addr_BdBCy_16br - SBCMacro16bd -COpF2m8nd: ; SBC (d) - addr_BdB_8br - SBCMacro8bnd -COpF2m16nd: ; SBC (d) - addr_BdB_16br - SBCMacro16bnd -COpF2m8d: ; SBC (d) - addr_BdB_8br - SBCMacro8bd -COpF2m16d: ; SBC (d) - addr_BdB_16br - SBCMacro16bd -COpF3m8nd: ; SBC(d,s),y - addr_BdCsBCy_8br - SBCMacro8bnd -COpF3m16nd: ; SBC(d,s),y - addr_BdCsBCy_16br - SBCMacro16bnd -COpF3m8d: ; SBC(d,s),y - addr_BdCsBCy_8br - SBCMacro8bd -COpF3m16d: ; SBC(d,s),y - addr_BdCsBCy_16br - SBCMacro16bd -COpF5m8nd: ; SBC d,x - addr_dCx_8br - SBCMacro8bnd -COpF5m16nd: ; SBC d,x - addr_dCx_16br - SBCMacro16bnd -COpF5m8d: ; SBC d,x - addr_dCx_8br - SBCMacro8bd -COpF5m16d: ; SBC d,x - addr_dCx_16br - SBCMacro16bd -COpF7m8nd: ; SBC [d],y - addr_LdLCy_8br - SBCMacro8bnd -COpF7m16nd: ; SBC [d],y - addr_LdLCy_16br - SBCMacro16bnd -COpF7m8d: ; SBC [d],y - addr_LdLCy_8br - SBCMacro8bd -COpF7m16d: ; SBC [d],y - addr_LdLCy_16br - SBCMacro16bd -COpF9m8nd: ; SBC a,y - addr_aCy_8br - SBCMacro8bnd -COpF9m16nd: ; SBC a,y - addr_aCy_16br - SBCMacro16bnd -COpF9m8d: ; SBC a,y - addr_aCy_8br - SBCMacro8bd -COpF9m16d: ; SBC a,y - addr_aCy_16br - SBCMacro16bd -COpFDm8nd: ; SBC a,x - addr_aCx_8br - SBCMacro8bnd -COpFDm16nd: ; SBC a,x - addr_aCx_16br - SBCMacro16bnd -COpFDm8d: ; SBC a,x - addr_aCx_8br - SBCMacro8bd -COpFDm16d: ; SBC a,x - addr_aCx_16br - SBCMacro16bd -COpFFm8nd: ; SBC al,x - addr_alCx_8br - SBCMacro8bnd -COpFFm16nd: ; SBC al,x - addr_alCx_16br - SBCMacro16bnd -COpFFm8d: ; SBC al,x - addr_alCx_8br - SBCMacro8bd -COpFFm16d: ; SBC al,x - addr_alCx_16br - SBCMacro16bd - -COp38: ; SEC i - mov dword[flagc],0FFh - endloop -COpF8: ; SED i - or dl,08h - mov bl,dl - mov edi,[tableadc+ebx*4] - endloop -COp78: ; SEI i - or dl,04h - endloop - -COpE2: ; SEP # - SEPMacro - -COp81m8: ; STA(d,x) - STAMacro8b - addr_BdCxB_8bw - endloop -COp81m16:; STA(d,x) - STAMacro16b - addr_BdCxB_16bw - endloop -COp83m8: ; STA d,s - STAMacro8b - addr_dCs_8bw - endloop -COp83m16:; STA d,s - STAMacro16b - addr_dCs_16bw - endloop -COp85m8: ; STA d - STAMacro8b - addr_d_8bw - endloop -COp85m16:; STA d - STAMacro16b - addr_d_16bw - endloop -COp87m8: ; STA [d] - STAMacro8b - addr_LdL_8bw - endloop -COp87m16:; STA [d] - STAMacro16b - addr_LdL_16bw - endloop -COp8Dm8: ; STA a - STAMacro8b - addr_a_8bw - endloop -COp8Dm16:; STA a - STAMacro16b - addr_a_16bw - endloop -COp8Fm8: ; STA al - STAMacro8b - addr_al_8bw - endloop -COp8Fm16:; STA al - STAMacro16b - addr_al_16bw - endloop -COp91m8: ; STA(d),y - STAMacro8b - addr_BdBCy_8bw - endloop -COp91m16:; STA(d),y - STAMacro16b - addr_BdBCy_16bw - endloop -COp92m8: ; STA (d) - STAMacro8b - addr_BdB_8bw - endloop -COp92m16:; STA (d) - STAMacro16b - addr_BdB_16bw - endloop -COp93m8: ; STA(d,s),y - STAMacro8b - addr_BdCsBCy_8bw - endloop -COp93m16:; STA(d,s),y - STAMacro16b - addr_BdCsBCy_16bw - endloop -COp95m8: ; STA d,x - STAMacro8b - addr_dCx_8bw - endloop -COp95m16:; STA d,x - STAMacro16b - addr_dCx_16bw - endloop -COp97m8: ; STA [d],y - STAMacro8b - addr_LdLCy_8bw - endloop -COp97m16:; STA [d],y - STAMacro16b - addr_LdLCy_16bw - endloop -COp99m8: ; STA a,y - STAMacro8b - addr_aCy_8bw - endloop -COp99m16:; STA a,y - STAMacro16b - addr_aCy_16bw - endloop -COp9Dm8: ; STA a,x - STAMacro8b - addr_aCx_8bw - endloop -COp9Dm16:; STA a,x - STAMacro16b - addr_aCx_16bw - endloop -COp9Fm8: ; STA al,x - STAMacro8b - addr_alCx_8bw - endloop -COp9Fm16:; STA al,x - STAMacro16b - addr_alCx_16bw - endloop - -COp86x8: ; STX d - STXMacro8b - addr_d_8bw - endloop -COp86x16:; STX d - STXMacro16b - addr_d_16bw - endloop -COp8Ex8: ; STX a - STXMacro8b - addr_a_8bw - endloop -COp8Ex16:; STX a - STXMacro16b - addr_a_16bw - endloop -COp96x8: ; STX d,y - STXMacro8b - addr_dCy_8bw - endloop -COp96x16:; STX d,y - STXMacro16b - addr_dCy_16bw - endloop - -COp84x8: ; STY d - STYMacro8b - addr_d_8bw - endloop -COp84x16:; STY d - STYMacro16b - addr_d_16bw - endloop -COp8Cx8: ; STY a - STYMacro8b - addr_a_8bw - endloop -COp8Cx16:; STY a - STYMacro16b - addr_a_16bw - endloop -COp94x8: ; STYd,x - STYMacro8b - addr_dCx_8bw - endloop -COp94x16:; STYd,x - STYMacro16b - addr_dCx_16bw - endloop - -COpDB: ; STP i - dec esi - endloop - -COp64m8: ; STZ d - xor al,al - addr_d_8bw - endloop -COp64m16:; STZ d - xor eax,eax - addr_d_16bw - endloop -COp74m8: ; STZ d,x - xor al,al - addr_dCx_8bw - endloop -COp74m16:; STZ d,x - xor eax,eax - addr_dCx_16bw - endloop -COp9Cm8: ; STZ a - xor al,al - addr_a_8bw - endloop -COp9Cm16:; STZ a - xor eax,eax - addr_a_16bw - endloop -COp9Em8: ; STZ a,x - xor al,al - addr_aCx_8bw - endloop -COp9Em16:; STZ a,x - xor eax,eax - addr_aCx_16bw - endloop - -COp14m8: ; TRB d - addr_d_8brni - mov cl,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test cl,al - jz .zero - mov word[flagnz],1 - not cl - and al,cl - addr_d_8bw - endloop -.zero - mov word[flagnz],0 - not cl - and al,cl - addr_d_8bw - endloop -COp14m16:; TRB d - addr_d_16brni - mov cx,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test cx,ax - jz .zero - mov word[flagnz],1 - not cx - and ax,cx - addr_d_16bw - endloop -.zero - mov word[flagnz],0 - not cx - and ax,cx - addr_d_16bw - endloop -COp1Cm8: ; TRB a - addr_a_8brni - mov cl,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test cl,al - jz .zero - mov word[flagnz],1 - not cl - and al,cl - addr_a_8bw - endloop -.zero - mov word[flagnz],0 - not cl - and al,cl - addr_a_8bw - endloop -COp1Cm16:; TRB a - addr_a_16brni - mov cx,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test cx,ax - jz .zero - mov word[flagnz],1 - not cx - and ax,cx - addr_a_16bw - endloop -.zero - mov word[flagnz],0 - not cx - and ax,cx - addr_a_16bw - endloop - -COp04m8: ; TSB d - addr_d_8brni - mov cl,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test al,cl - jz .zero - mov word[flagnz],1 - or al,cl - addr_d_8bw - endloop -.zero - mov word[flagnz],0 - or al,cl - addr_d_8bw - endloop -COp04m16:; TSB d - addr_d_16brni - mov cx,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test ax,cx - jz .zero - mov word[flagnz],1 - or ax,cx - addr_d_16bw - endloop -.zero - mov word[flagnz],0 - or ax,cx - addr_d_16bw - endloop -COp0Cm8: ; TSB a - addr_a_8brni - mov cl,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test al,cl - jz .zero - mov word[flagnz],1 - or al,cl - addr_a_8bw - endloop -.zero - mov word[flagnz],0 - or al,cl - addr_a_8bw - endloop -COp0Cm16:; TSB a - addr_a_16brni - mov cx,[xa] - test dword[flagnz],18000h - jz .notflags - or dword[flagnz],10000h -.notflags - test ax,cx - jz .zero - mov word[flagnz],1 - or ax,cx - addr_a_16bw - endloop -.zero - mov word[flagnz],0 - or ax,cx - addr_a_16bw - endloop - -COpAAx8: ; TAX i - mov al,[xa] - mov [xx],al - flagsetnz8b - endloop -COpAAx16:; TAX i - mov ax,[xa] - mov [xx],ax - flagsetnz16b - endloop -COpA8x8: ; TAY i - mov al,[xa] - mov [xy],al - flagsetnz8b - endloop -COpA8x16:; TAY i - mov ax,[xa] - mov [xy],ax - flagsetnz16b - endloop -COp5B: ; TCD i - mov ax,[xa] - mov [xd],ax - call UpdateDPage - flagsetnz16b - endloop -COp1B: ; TCS i - mov ax,[xa] - test byte[xe],1 - jnz .emul - mov [xs],ax - endloop -.emul - mov [xs],al - endloop -COp7B: ; TDC i - mov ax,[xd] - mov [xa],ax - flagsetnz16b - endloop -COp3B: ; TSC i - mov ax,[xs] - mov [xa],ax - flagsetnz16b - endloop -COpBAx8: ; TSX i - mov al,[xs] - mov [xx],al - flagsetnz8b - endloop -COpBAx16:; TSX i - mov ax,[xs] - mov [xx],ax - flagsetnz16b - endloop -COp8Am8: ; TXA i - mov al,[xx] - mov [xa],al - flagsetnz8b - endloop -COp8Am16:; TXA i - mov ax,[xx] - mov [xa],ax - flagsetnz16b - endloop -COp9A: ; TXS i - mov ax,[xx] - mov [xs],ax - test byte[xe],1 - jnz .emul - endloop -.emul - mov byte[xs+1],1 - endloop -COp9Bx8: ; TXY i - mov al,[xx] - mov [xy],al - flagsetnz8b - endloop -COp9Bx16:; TXY i - mov ax,[xx] - mov [xy],ax - flagsetnz16b - endloop -COp98m8: ; TYA i - mov al,[xy] - mov [xa],al - flagsetnz8b - endloop -COp98m16:; TYA i - mov ax,[xy] - mov [xa],ax - flagsetnz16b - endloop -COpBBx8: ; TYX i - mov al,[xy] - mov [xx],al - flagsetnz8b - endloop -COpBBx16:; TYX i - mov ax,[xy] - mov [xx],ax - flagsetnz16b - endloop - -COpCB: ; WAI i - WAIMacro - -COpEB: ; XBA i - mov ah,[xa] - mov al,[xa+1] - mov [xa],ax - flagsetnz8b - endloop - -COpFB: ; XCE i - XCEMacro - -COp42: ; WDM - inc esi - endloop - - diff --git a/tools/zsnes/src/cpu/execute.asm b/tools/zsnes/src/cpu/execute.asm deleted file mode 100644 index e89fa53..0000000 --- a/tools/zsnes/src/cpu/execute.asm +++ /dev/null @@ -1,2206 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 KeyRewind,statesaver,Voice0Status,UpdateDPage -EXTSYM StartGUI,romdata,initvideo,DosExit,sfxramdata,deinitvideo -EXTSYM vidbufferofsa,device2,RawDumpInProgress -EXTSYM KeySaveState,KeyLoadState,KeyQuickExit,KeyQuickLoad,KeyQuickRst -EXTSYM GUIDoReset,GUIReset,KeyOnStA,KeyOnStB,ProcessKeyOn,C4Enable,KeyQuickClock -EXTSYM KeyQuickSaveSPC,TimerEnable,splitflags,joinflags -EXTSYM KeyQuickSnapShot,csounddisable,videotroub,ResetTripleBuf -EXTSYM InitPreGame,Curtableaddr,curcyc,debugdisble,dmadata,guioff,memtabler8 -EXTSYM SetupPreGame,memtablew8,regaccessbankr8,showmenu,snesmap2,snesmmap -EXTSYM DeInitPostGame,spcPCRam,xp,xpb,xpc,tablead -EXTSYM tableadc,SA1UpdateDPage,Makemode7Table,nextmenupopup,MovieProcessing -EXTSYM SFXEnable,wramdata,cycpbl,cycpblt,irqon,spcon -EXTSYM multchange,romispal,scrndis,sprlefttot,sprleftpr,processsprites -EXTSYM cachesprites,opcjmptab,CheatOn,Output_Text,Check_Key,Get_Key, -EXTSYM INTEnab,JoyCRead,NMIEnab,NumCheats,CurrentExecSA1,ReadInputDevice -EXTSYM StartDrawNewGfx,VIRQLoc,cachevideo,cfield,cheatdata,curblank,curnmi -EXTSYM curypos,cycpl,doirqnext,drawline,exechdma,hdmadelay,intrset,newengen -EXTSYM oamaddr,oamaddrs,resolutn,showvideo,starthdma,switchtonmi -EXTSYM switchtovirq,totlines,updatetimer,SA1Swap,SA1DoIRQ,JoyAOrig,JoyANow -EXTSYM JoyBOrig,JoyBNow,JoyCOrig,JoyCNow,JoyDOrig,JoyDNow,JoyEOrig,JoyENow -EXTSYM SA1Message,MultiTapStat,idledetectspc,SA1Control,SA1Enable,SA1IRQEnable -EXTSYM SPC700read,SPC700write,numspcvblleft,spc700idle,SA1IRQExec,ForceNewGfxOff -EXTSYM LethEnData,GUIQuit,IRAM,SA1Ptr,SA1BWPtr,outofmemfix -EXTSYM yesoutofmemory,ProcessMovies,MovieStop,ppustatus,C4VBlank -EXTSYM ReturnFromSPCStall,scanlines,MainLoop,MoviePassWaiting,MovieDumpRaw -EXTSYM NumberOfOpcodes,SfxCLSR,SfxSCMR,SfxPOR,sfx128lineloc,sfx160lineloc -EXTSYM sfx192lineloc,sfxobjlineloc,sfxclineloc,PLOTJmpa,PLOTJmpb,FxTable -EXTSYM FxTableb,FxTablec,FxTabled,SfxPBR,SCBRrel,SfxSCBR,SfxCOLR,SFXCounter -EXTSYM fxbit01,fxbit01pcal,fxbit23,fxbit23pcal,fxbit45,fxbit45pcal,fxbit67 -EXTSYM fxbit67pcal,SfxSFR,nosprincr,cpucycle,switchtovirqdeb,switchtonmideb -EXTSYM MovieSeekBehind,BackupCVFrame,RestoreCVFrame,loadstate -EXTSYM KeyInsrtChap,KeyNextChap,KeyPrevChap,MovieInsertChapter,MovieSeekAhead -EXTSYM ResetDuringMovie,EMUPauseKey,INCRFrameKey,MovieWaiting,NoInputRead -EXTSYM AllocatedRewindStates,PauseFrameMode,RestorePauseFrame,BackupPauseFrame - -%ifndef NO_DEBUGGER -EXTSYM debuggeron,startdebugger -%endif - -%ifdef __MSDOS__ -EXTSYM dssel,Game60hzcall,NextLineStart,FlipWait,LastLineStart,smallscreenon,ScreenScale -EXTSYM cvidmode,GUI16VID,ScreenShotFormat -%endif - -SECTION .data -NEWSYM tempedx, dd 0 -NEWSYM tempesi, dd 0 -NEWSYM tempedi, dd 0 -NEWSYM tempebp, dd 0 -NEWSYM RewindTimer, dd 0 -NEWSYM BackState, db 1 -NEWSYM BackStateSize, dd 6 -NEWSYM DblRewTimer, dd 0 -SECTION .text - -NEWSYM ProcessRewind - mov eax,[KeyRewind] - cmp byte[pressed+eax],1 - jne near .notokay - mov byte[pressed+eax],2 - - pushad - call RestoreCVFrame - popad - - cmp byte[PauseFrameMode],1 - jne .notpauserewind - pushad - call BackupPauseFrame - popad -.notpauserewind - - call UpdateDPage - mov esi,[tempesi] - mov edi,[tempedi] - mov ebp,[tempebp] - mov edx,[tempedx] - -.notokay - ret - -NEWSYM UpdateRewind - cmp byte[AllocatedRewindStates],0 - je .norewinds - cmp dword[KeyRewind],0 - je .norewinds - - dec dword[DblRewTimer] - dec dword[RewindTimer] - jnz .checkrewind - - mov [tempedx],edx - mov [tempesi],esi - mov [tempedi],edi - mov [tempebp],ebp - - pushad - call BackupCVFrame - popad - -.checkrewind - call ProcessRewind - call UpdateDPage -.norewinds - ret - -SECTION .data -NEWSYM MuteVoiceF, dd 0 -SECTION .text - -VoiceEndMute: - mov byte[MuteVoiceF],0 - ret - -%macro StartMute 1 - mov al,[Voice0Status+%1] - or al,al - jz %%notmuted - or byte[MuteVoiceF],1 << %1 -%%notmuted -%endmacro - -VoiceStartMute: - mov byte[MuteVoiceF],0 - push eax - StartMute 0 - StartMute 1 - StartMute 2 - StartMute 3 - StartMute 4 - StartMute 5 - StartMute 6 - StartMute 7 - pop eax - ret - - -%macro stim 0 -%ifdef __MSDOS__ - sti -%endif -%endmacro - -%macro ProcessIRQStuff 0 - ; check for VIRQ/HIRQ - test dl,04h - jnz %%virqdo - cmp byte[doirqnext],1 - je near .virq -%%virqdo - test byte[INTEnab],20h - jz near %%novirq - mov ax,[VIRQLoc] - cmp ax,[resolutn] - jne %%notres - dec ax -; inc ax -%%notres - cmp ax,0FFFFh - jne %%notzero - xor ax,ax -%%notzero - cmp word[curypos],ax - jne near %%noirq - test byte[INTEnab],10h - jnz %%tryhirq -%%startirq - cmp byte[intrset],1 - jne %%nointrseta - mov byte[intrset],2 -%%nointrseta - mov byte[irqon],80h - test dl,04h - jnz %%irqd - mov byte[doirqnext],1 - jmp .virq -%%novirq - test byte[INTEnab],10h - jz %%noirq -%%setagain - cmp byte[intrset],2 - jbe %%nointrseta3 - dec byte[intrset] - cmp byte[intrset],2 - ja %%noirq -%%nointrseta3 - cmp byte[intrset],1 - jne %%nointrseta2 - test byte[INTEnab],80h - jz %%tryhirq - mov byte[intrset],8 - jmp %%noirq -%%nointrseta2 - test dl,04h - jnz %%noirq -%%tryhirq - jmp %%startirq -%%irqd - mov byte[doirqnext],1 -%%noirq -%endmacro - - -; .returnfromsfx - -; pexecs -; *** Copy to PC whenever a non-relative jump is executed - -SECTION .data -NEWSYM romloadskip, db 0 -NEWSYM SSKeyPressed, dd 0 -NEWSYM SPCKeyPressed, dd 0 -NEWSYM NoSoundReinit, dd 0 -NEWSYM NextNGDisplay, db 0 -NEWSYM TempVidInfo, dd 0 -NEWSYM tempdh, db 0 - -SECTION .text - - -; this wonderful mess starts up the CPU and initialized the emulation state -NEWSYM start65816 - - call initvideo - - cmp byte[videotroub],1 - jne .notrouble - ret -.notrouble - - mov edi,[vidbufferofsa] - mov ecx,37518 - xor eax,eax - rep stosd - cmp byte[romloadskip],1 - je near StartGUI - -NEWSYM continueprog - ; clear keyboard presses - mov esi,pressed - mov ecx,256+128+64 - mov al,0 -.loopa - mov [esi],al - inc esi - dec ecx - jnz .loopa - - mov byte[romloadskip],0 -%ifndef NO_DEBUGGER - mov byte[debuggeron],0 -%endif - mov byte[exiter],0 - - call InitPreGame - jmp reexecute - -NEWSYM continueprognokeys - mov byte[romloadskip],0 -%ifndef NO_DEBUGGER - mov byte[debuggeron],0 -%endif - mov byte[exiter],0 - - call InitPreGame - jmp reexecuteb2 - -; Incorrect - -NEWSYM reexecuteb -%ifndef __MSDOS__ - jmp reexecuteb2 -%endif -NEWSYM reexecute - - ; clear keyboard presses - mov esi,pressed - mov ecx,256+128+64 - mov al,0 -.loopa - cmp byte[esi],2 - jne .notclear - mov [esi],al -.notclear - inc esi - dec ecx - jnz .loopa -reexecuteb2: - cmp byte[NoSoundReinit],1 - je .skippregame - call SetupPreGame -.skippregame - - ; initialize variables (Copy from variables) - call UpdateDPage - call SA1UpdateDPage - call Makemode7Table - cmp byte[SFXEnable],0 - je .nosfxud - call UpdateSFX -.nosfxud - xor eax,eax - xor ebx,ebx - xor ecx,ecx - xor edx,edx - mov bl,[xpb] - mov ax,[xpc] - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - jmp .skiplower -.loweraddr - cmp ax,4300h - jb .lower - cmp dword[memtabler8+ebx*4],regaccessbankr8 - je .dma -.lower - mov esi,[snesmap2+ebx*4] - jmp .skiplower -.dma - mov esi,dmadata-4300h -.skiplower - mov [initaddrl],esi - add esi,eax ; add program counter to address - mov dl,[xp] ; set flags - mov dh,[curcyc] ; set cycles - - mov bl,dl - - mov edi,[tableadc+ebx*4] - or byte[curexecstate],2 - - mov ebp,[spcPCRam] - - mov byte[NoSoundReinit],0 - mov byte[csounddisable],0 - mov byte[NextNGDisplay],0 - - call splitflags - - call execute - - call joinflags - - ; de-init variables (copy to variables) - - mov [spcPCRam],ebp - mov [Curtableaddr],edi - mov [xp],dl - mov [curcyc],dh - - mov eax,[initaddrl] - sub esi,eax ; subtract program counter by address - mov [xpc],si - call ResetTripleBuf - - mov eax,[KeySaveState] - test byte[pressed+eax],1 - jnz .soundreinit - mov eax,[KeyLoadState] - test byte[pressed+eax],1 - jz .skipsoundreinit -.soundreinit - mov byte[NoSoundReinit],1 - mov byte[csounddisable],1 -.skipsoundreinit - - cmp byte[NoSoundReinit],1 - je .skippostgame - call DeInitPostGame -.skippostgame - - ;Multipass Movies - cmp byte[MoviePassWaiting],1 - jne .nomoviepasswaiting - pushad - call MovieDumpRaw - popad - jmp continueprog -.nomoviepasswaiting - - ; clear all keys - call Check_Key - cmp al,0 - je .nokeys -.yeskeys - call Get_Key - call Check_Key - cmp al,0 - jne .yeskeys -.nokeys - - cmp byte[nextmenupopup],1 - je near showmenu - cmp byte[ReturnFromSPCStall],1 - je near .activatereset - mov eax,[KeySaveState] - test byte[pressed+eax],1 - jz .nosavestt - mov byte[pressed+1],0 - mov byte[pressed+eax],2 - pushad - call statesaver - popad - jmp reexecuteb -.nosavestt - mov eax,[KeyLoadState] - test byte[pressed+eax],1 - jz .noloadstt0 - pushad - call loadstate - popad - jmp reexecuteb -.noloadstt0 - mov eax,[KeyInsrtChap] - test byte[pressed+eax],1 - jz .noinsertchapter - mov byte[pressed+eax],0 - pushad - call MovieInsertChapter - popad - jmp continueprognokeys -.noinsertchapter - mov eax,[KeyNextChap] - test byte[pressed+eax],1 - jz .nonextchapter - mov byte[pressed+eax],0 - mov byte[multchange],1 - pushad - call MovieSeekAhead - popad - jmp continueprognokeys -.nonextchapter - mov eax,[KeyPrevChap] - test byte[pressed+eax],1 - jz .noprevchapter - mov byte[pressed+eax],0 - mov byte[multchange],1 - pushad - call MovieSeekBehind - popad - jmp continueprognokeys -.noprevchapter - cmp byte[SSKeyPressed],1 - je near showmenu - cmp byte[SPCKeyPressed],1 - je near showmenu -%ifndef NO_DEBUGGER - cmp byte[debugdisble],0 - jne .nodebugger - test byte[pressed+59],1 - jne near startdebugger -.nodebugger -%endif - test byte[pressed+59],1 - jne near showmenu - mov eax,[KeyQuickRst] - test byte[pressed+eax],1 - jz .noreset -.activatereset - pushad - mov byte[GUIReset],1 - cmp byte[MovieProcessing],2 ;Recording - jne .nomovierecording - call ResetDuringMovie - jmp .movieendif -.nomovierecording - call GUIDoReset -.movieendif - popad - mov byte[ReturnFromSPCStall],0 - jmp continueprog -.noreset - cmp byte[guioff],1 - je near endprog - mov eax,[KeyQuickExit] - test byte[pressed+eax],1 - jnz near endprog - jmp StartGUI - -NEWSYM endprog - call deinitvideo - pushad - call MovieStop - popad - - jmp DosExit - -NEWSYM interror - stim - call deinitvideo - mov edx,.nohand ;use extended - mov ah,9 ;DOS- API - call Output_Text ;to print a string - jmp DosExit - -SECTION .data -.nohand db 'Cannot process interrupt handler!',13,10,0 - -; global variables -NEWSYM invalid, db 0 -NEWSYM invopcd, db 0 -NEWSYM pressed, times 256+128+64 db 0 ; keyboard pressed keys in scancode -NEWSYM exiter, db 0 -NEWSYM oldhand9o, dd 0 -NEWSYM oldhand9s, dw 0 -NEWSYM oldhand8o, dd 0 -NEWSYM oldhand8s, dw 0 -NEWSYM opcd, dd 0 -NEWSYM pdh, dd 0 -NEWSYM pcury, dd 0 -NEWSYM timercount, dd 0 -NEWSYM initaddrl, dd 0 ; initial address location -NEWSYM NetSent, dd 0 -NEWSYM nextframe, dd 0 ; tick count for timer -NEWSYM curfps, db 0 ; frame/sec for current screen -;NEWSYM newgfxerror, db 'NEED MEMORY FOR GFX ENGINE',0 -;NEWSYM newgfxerror2, db 'NEED 320x240 FOR NEW GFX 16B',0 -;newgfxerror db 'NEW GFX IN 16BIT IS N/A',0 -NEWSYM HIRQCycNext, dd 0 -NEWSYM HIRQNextExe, db 0 - - -SECTION .text - -;******************************************************* -; Int 08h vector -;******************************************************* - -; sets to either 60Hz or 50Hz depending on PAL/NTSC -NEWSYM init60hz - cmp byte[romispal],0 - jne .dopal - mov al,00110110b - out 43h,al - mov ax,19900 ; 65536/(60/((65536*24+175)/(60*60*24))) - mov dword[timercount],19900 - out 40h,al - mov al,ah - out 40h,al - ret -.dopal - mov al,00110110b - out 43h,al - mov ax,23863 ; 65536/(50/((65536*24+175)/(60*60*24))) - mov dword[timercount],23863 - out 40h,al - mov al,ah - out 40h,al - ret - -NEWSYM init18_2hz - mov al,00110110b - out 43h,al - mov ax,0 - mov dword[timercount],65536 - out 40h,al - mov al,ah - out 40h,al - ret - -%ifdef __MSDOS__ -NEWSYM handler8h - cli - push ds - push eax -; mov ax,0 - mov ax,[cs:dssel] -NEWSYM handler8hseg - mov ds,ax - call Game60hzcall - mov eax,[timercount] - sub dword[timeradj],eax - jnc .noupd - add dword[timeradj],65536 - pushf - call far [oldhand8o] -.noupd - mov al,20h - out 20h,al - pop eax - pop ds - sti - iretd -%endif - -SECTION .data -NEWSYM timeradj, dd 65536 -NEWSYM t1cc, dw 0 -SECTION .text - -;******************************************************* -; Int 09h vector -;******************************************************* - -%ifdef __MSDOS__ -SECTION .bss -NEWSYM skipnextkey42, resb 1 -SECTION .text - -NEWSYM handler9h - cli - push ds - push eax - push ebx - mov ax,[cs:dssel] - mov ds,ax - xor ebx,ebx - in al,60h ; get keyboard scan code - cmp al,42 - jne .no42 - cmp byte[skipnextkey42],0 - je .no42 - mov byte[skipnextkey42],0 - jmp .skipkeyrel -.no42 - cmp al,0E0h - jne .noE0 - mov byte[skipnextkey42],1 - jmp .skipkeyrel -.noE0 - mov byte[skipnextkey42],0 - mov bl,al - xor bh,bh - test bl,80h ; check if bit 7 is on (key released) - jnz .keyrel - cmp byte[pressed+ebx],0 - jne .skipa - mov byte[pressed+ebx],1 ; if not, set key to pressed -.skipa - jmp .skipkeyrel -.keyrel - and ebx,7Fh - cmp ebx,59 - je .skipkeyrel - cmp ebx,[KeySaveState] - je .skipkeyrel - cmp ebx,[KeyLoadState] - je .skipkeyrel - cmp ebx,[KeyQuickExit] - je .skipkeyrel - cmp ebx,[KeyQuickLoad] - je .skipkeyrel - cmp ebx,[KeyQuickRst] - je .skipkeyrel - cmp bl,1 - je .skipkeyrel - mov byte[pressed+ebx],0 ; if not, set key to pressed -.skipkeyrel - mov byte[pressed],0 - in al,61h - mov ah,al - or al,80h - out 61h,al - mov al,20h ; turn off interrupt mode - out 20h,al - pop ebx ; Pop registers off - pop eax ; stack in correct - pop ds - sti - iretd -%endif - -SECTION .data -ALIGN32 -NEWSYM soundcycleft, dd 0 -NEWSYM curexecstate, dd 0 - -NEWSYM nmiprevaddrl, dd 0 ; observed address -5 -NEWSYM nmiprevaddrh, dd 0 ; observed address +5 -NEWSYM nmirept, dd 0 ; NMI repeat check, if 6 then okay -NEWSYM nmiprevline, dd 224 ; previous line -NEWSYM nmistatus, dd 0 ; 0 = none, 1 = waiting for nmi location, - ; 2 = found, disable at next line -NEWSYM joycontren, dd 0 ; joystick read control check -NEWSYM NextLineCache, db 0 -NEWSYM ZMVZClose, db 0 - -SECTION .text - -Donextlinecache: - cmp word[curypos],0 - je .nocache - mov ax,[resolutn] - dec ax - cmp word[curypos],ax - jae .nocache - test byte[scrndis],10h - jnz .nocache - cmp byte[curblank],0h - jne .nocache - push ecx - push ebx - push esi - push edi - xor ecx,ecx - mov cl,[curypos] - push edx -.next - mov byte[sprlefttot+ecx],0 - mov dword[sprleftpr+ecx*4],0 - inc cl - jnz .next - call processsprites - call cachesprites - pop edx - pop edi - pop esi - pop ebx - pop ecx -.nocache - mov byte[NextLineCache],0 - ret - -;******************************************************* -; 65816 execution -;******************************************************* - -SECTION .text - -NEWSYM exitloop2 - mov byte[ExecExitOkay],0 -NEWSYM exitloop - ret - -ALIGN16 - -%macro FlipCheck 0 -%ifdef __MSDOS__ - cmp byte[FlipWait],0 - je %%noflip - push edx - push eax - mov dx,3DAh ;VGA status port - in al,dx - test al,8 - jz %%skipflip - push ebx - push ecx - mov ax,4F07h - mov bh,00h - mov bl,00h - xor cx,cx - mov dx,[NextLineStart] - mov [LastLineStart],dx - int 10h - mov byte[FlipWait],0 - pop ecx - pop ebx -%%skipflip - pop eax - pop edx -%%noflip -%endif -%endmacro - -NEWSYM execute -NEWSYM execloop - mov bl,dl - test byte[curexecstate],2 - jnz .sound -.startagain - call dword near [edi+ebx*4] -.cpuover - jmp cpuover -.sound - mov edi,[tableadc+ebx*4] -%ifdef OPENSPC - pushad - mov bl,[esi] - movzx eax,byte[cpucycle+ebx] - mov ebx,0xC3A13DE6 - mul ebx - add [ospc_cycle_frac],eax - adc [SPC_Cycles],edx - call OSPC_Run - popad -%else - sub dword[cycpbl],55 - jnc .skipallspc - mov eax,[cycpblt] - mov bl,[ebp] - add dword[cycpbl],eax - ; 1260, 10000/12625 - inc ebp - call dword near [opcjmptab+ebx*4] - xor ebx,ebx -.skipallspc -%endif - mov bl,[esi] - inc esi - sub dh,[cpucycle+ebx] - jc .cpuovers - call dword near [edi+ebx*4] -.cpuovers - jmp cpuover - - - -SECTION .data -ALIGN32 -NEWSYM ExecExitOkay, db 1 -NEWSYM JoyABack, dd 0 -NEWSYM JoyBBack, dd 0 -NEWSYM JoyCBack, dd 0 -NEWSYM JoyDBack, dd 0 -NEWSYM JoyEBack, dd 0 -NEWSYM NetCommand, dd 0 -NEWSYM spc700read, dd 0 -NEWSYM lowestspc, dd 0 -NEWSYM highestspc, dd 0 -NEWSYM SA1UBound, dd 0 -NEWSYM SA1LBound, dd 0 -NEWSYM SA1SH, dd 0 -NEWSYM SA1SHb, dd 0 -NEWSYM NumberOfOpcodes2, dd 0 -NEWSYM ChangeOps, dd 0 -NEWSYM SFXProc, dd 0 -NEWSYM EMUPause, db 0 -NEWSYM INCRFrame, db 0 -NEWSYM NoHDMALine, db 0 -SECTION .text - -NEWSYM cpuover - dec esi - cmp byte[HIRQNextExe],0 - je .nohirq - add dh,[HIRQCycNext] - mov byte[HIRQCycNext],0 - jmp .hirq -.nohirq - cmp byte[SA1Enable],0 - je near .nosa1b - test byte[exiter],01h - jnz near .nosa1 - mov byte[cycpl],150 - test byte[SA1Control],60h - jnz near .nosa1 - call SA1Swap - cmp byte[CurrentExecSA1],15 - ja .nocontinueexec - xor ebx,ebx - mov bl,[esi] - inc esi - jmp execloop.startagain -.nocontinueexec - - ; check for sa-1 speed hacks - mov byte[SA1SHb],0 - cmp word[IRAM+0A0h],80BFh - jne .noshb2 - cmp word[IRAM+020h],0 - jne .noshb2 - mov ecx,[SA1Ptr] ; small speed hack - sub ecx,[romdata] - cmp ecx,83h - jb .skipsh - cmp ecx,97h - ja .skipsh - mov byte[SA1SHb],1 -.skipsh -.noshb2 - - mov ecx,[SA1Ptr] ; small speed hack - cmp dword[ecx],0FCF04BA5h - je .shm - cmp dword[ecx-2],0FCF04BA5h - jne .skipshm -.shm - cmp byte[IRAM+4Bh],0 - jne .skipshm - mov byte[SA1SHb],1 -.skipshm - - cmp dword[ecx],80602EEEh - jne .skipshc - sub ecx,[romdata] - cmp ecx,4E5h - jb .skipshc - cmp ecx,4E8h - ja .skipshc - mov byte[SA1SHb],1 - mov ecx,[SA1BWPtr] - add word[ecx+602Eh],4 -.skipshc - - test word[IRAM+0Ah],8000h - jnz .noshb2b - test word[IRAM+0Eh],8000h - jz .noshb2b - mov ecx,[SA1Ptr] ; small speed hack - sub ecx,[romdata] - cmp ecx,0C93h - jb .skipshb - cmp ecx,0C9Bh - ja .skipshb - mov byte[SA1SHb],1 -.skipshb - cmp ecx,0CB8h - jb .skipshb3 - cmp ecx,0CC0h - ja .skipshb3 - mov byte[SA1SHb],1 -.skipshb3 -.noshb2b - - sub esi,[wramdata] - cmp esi,224h - jb .nosh - cmp esi,22Eh - ja .nosh - mov ecx,[wramdata] - mov dword[SA1LBound],224h - mov dword[SA1UBound],22Eh - add dword[SA1LBound],ecx - add dword[SA1UBound],ecx - mov byte[SA1SH],1 -.nosh - cmp esi,1F7C6h - jb .noshb - cmp esi,1F7CCh - ja .noshb - mov ecx,[wramdata] - mov dword[SA1LBound],1F7C6h - mov dword[SA1UBound],1F7CCh - add dword[SA1LBound],ecx - add dword[SA1UBound],ecx - mov byte[SA1SH],1 -.noshb - cmp esi,14h - jb .noshc - cmp esi,1Ch - ja .noshc - mov ecx,[wramdata] - cmp dword[ecx+14h],0F023002Ch - jne .noshc - mov dword[SA1LBound],14h - mov dword[SA1UBound],1Ch - add dword[SA1LBound],ecx - add dword[SA1UBound],ecx - mov byte[SA1SH],1 -.noshc - add esi,[wramdata] - sub esi,[romdata] - cmp esi,0A56h - jb .noshbc - cmp esi,0A59h - ja .noshbc - mov ecx,[romdata] - mov dword[SA1LBound],0A56h - mov dword[SA1UBound],0A59h - add dword[SA1LBound],ecx - add dword[SA1UBound],ecx - mov byte[SA1SH],1 -.noshbc - xor ecx,ecx - add esi,[romdata] - xor dh,dh - mov byte[cycpl],10 - cmp byte[CurrentExecSA1],255 - jne .notsa1255 - mov byte[cycpl],160 -.notsa1255 - mov byte[CurrentExecSA1],0 - test dl,04h - jnz .nosa1 - test byte[SA1IRQEnable],80h - jz .nosa1 - test byte[SA1DoIRQ],4 - jz .nosa1 - and byte[SA1DoIRQ],0FBh - mov al,[SA1Message+1] - mov [SA1Message+3],al - or byte[SA1IRQExec],1 - ; Start IRQ - add dh,10 - jmp .virq -.nosa1 - test byte[SA1IRQEnable],20h - jz .nosa1chirq - test byte[SA1DoIRQ],8 - jz .nosa1chirq -; jmp .nosa1chirq - and byte[SA1DoIRQ],0F7h - mov al,[SA1Message+1] - mov [SA1Message+3],al - or byte[SA1IRQExec],2 - ; Start IRQ - add dh,10 - jmp .virq -.nosa1chirq -.nosa1b - FlipCheck - cmp byte[NextLineCache],0 - je .nosprcache - call Donextlinecache -.nosprcache - cmp byte[KeyOnStB],0 - je .nokeyon - mov al,[KeyOnStB] - call ProcessKeyOn -.nokeyon - mov al,[KeyOnStA] - mov [KeyOnStB],al - mov byte[KeyOnStA],0 - test byte[exiter],01h - jnz near exitloop2 - ;Multipass Movies - cmp byte[MoviePassWaiting],1 - jne .nomoviepasswaiting - jmp exitloop2 -.nomoviepasswaiting - - - test byte[SfxSFR],20h - jnz near StartSFX -.returnfromsfx -; inc dword[numinst] ;Temporary - inc word[curypos] - add dh,[cycpl] - mov ax,[totlines] - cmp word[curypos],ax - jae near .overy - cmp byte[spcon],0 - je .nosound - call updatetimer -.nosound - mov ax,[resolutn] - inc ax - cmp [curypos],ax - je near .nmi - - mov ax,[resolutn] - cmp [curypos],ax - je near .hdma -; add ax,2 -; cmp [curypos],ax -; je near .hdma -.hdmacont - - ; check for VIRQ/HIRQ/NMI - ProcessIRQStuff - mov ax,[resolutn] - test byte[nmistatus],0 - jz .drawline2 - cmp [curypos],ax - je .step2 -.drawline2 - test byte[nmistatus],1 - jnz .step2 - cmp [curypos],ax - jbe .drawline - jmp .skiphdma -.step2 - cmp [curypos],ax - jb .drawline -.skiphdma - xor ebx,ebx - mov bl,[esi] - inc esi - jmp execloop.startagain - -.hdma - call exechdma - jmp .hdmacont - -.drawline - mov al,[nmiprevline] - cmp [curypos],al - jb near .noskip - cmp byte[nmirept],10 - jb near .noskip - ; if between correct address, decrease by 2, set nmistatus as 2 - ; if not, set nmistatus as 1, increase by 2 - cmp byte[curexecstate],0 - jne .nn - xor dh,dh -.nn - cmp byte[nmistatus],2 - jae near .noskip - cmp esi,[nmiprevaddrl] - jb .failcheck2 - cmp esi,[nmiprevaddrh] - ja .failcheck2 - cmp byte[nmiprevline],20 - jb .nodec - sub byte[nmiprevline],10 -.nodec - xor eax,eax - mov al,[esi] - mov byte[nmistatus],2 - and byte[curexecstate],0FEh -.failcheck2 - add byte[nmiprevline],1 - mov byte[nmistatus],1 -.noskip - cmp byte[hdmadelay],0 - je .dohdma - dec byte[hdmadelay] - jmp .nodohdma -.dohdma - cmp word[curypos],1 - jne .nooffby1line - test byte[INTEnab],20h - jz .nooffby1line - cmp word[VIRQLoc],0 - je .nodohdma -.nooffby1line - mov ax,[resolutn] - dec ax - cmp [curypos],ax - jae .nodohdma -.dohdma3 - call exechdma -.nodohdma - cmp word[curypos],1 - jne .nocache - call cachevideo -.nocache - cmp byte[curblank],0 - jne .nodrawlineb2 - call drawline -.nodrawlineb2 - cmp byte[curexecstate],2 - je near pexecs - cmp byte[curexecstate],0 - jne .yesexec - xor dh,dh -.yesexec - xor ebx,ebx - mov bl,[esi] - inc esi - jmp execloop.startagain - -.nmi - mov byte[irqon],80h - mov byte[doirqnext],0 - cmp byte[yesoutofmemory],1 - jne .noout - call outofmemfix -.noout - - dec word[curypos] - mov [tempdh],dh - xor dh,dh - -; mov al,[SFXIRQFlag] - mov byte[doirqnext],0 - - call exechdma - call exechdma - - mov byte[NextNGDisplay],1 - cmp byte[newengen],0 - je .nonewgfx - cmp byte[curblank],0 - jne .nonewgfx - cmp byte[ForceNewGfxOff],0 - jne .nonewgfx -; cmp byte[NextNGDisplay],0 -; je .nonewgfx - call StartDrawNewGfx -.nonewgfx - cmp byte[GUIQuit],1 - je near endprog - mov eax,[KeyQuickSnapShot] - or eax,eax - jz .nosskey - test byte[pressed+eax],1 - jz .nosskey -%ifdef __MSDOS__ - movzx eax,byte[cvidmode] - cmp byte[GUI16VID+eax],1 - je .pngok - mov byte[ScreenShotFormat],0 -.pngok -%endif - mov byte[SSKeyPressed],1 - mov byte[pressed+eax],2 - jmp exitloop -.nosskey - mov eax,[KeyQuickClock] - or eax,eax - jz .noclockkey - test byte[pressed+eax],1 - jz .noclockkey - xor byte[TimerEnable],1 - mov byte[pressed+eax],2 -.noclockkey - mov eax,[KeyQuickSaveSPC] - or eax,eax - jz .nosavespckey - test byte[pressed+eax],1 - jz .nosavespckey - mov byte[SPCKeyPressed],1 - mov byte[pressed+eax],2 - jmp exitloop -.nosavespckey - mov eax,[EMUPauseKey] - or eax,eax - jz .nopausekey - test byte[pressed+eax],1 - jz .nopausekey - xor byte[EMUPause],1 - mov byte[pressed+eax],2 -.nopausekey - mov eax,[INCRFrameKey] - or eax,eax - jz .noincrframekey - test byte[pressed+eax],1 - jz .noincrframekey - xor byte[INCRFrame],1 - mov byte[pressed+eax],2 -.noincrframekey - test byte[pressed+1],01h - jnz near exitloop - test byte[pressed+59],01h - jnz near exitloop - cmp byte[nextmenupopup],1 - je near exitloop - cmp byte[nextmenupopup],2 - jb .skipmenupop - dec byte[nextmenupopup] -.skipmenupop - mov eax,[KeySaveState] - test byte[pressed+eax],01h - jnz near exitloop - mov eax,[KeyLoadState] - test byte[pressed+eax],01h - jnz near exitloop - mov eax,[KeyInsrtChap] - test byte[pressed+eax],01h - jnz near exitloop - mov eax,[KeyPrevChap] - test byte[pressed+eax],01h - jnz near exitloop - mov eax,[KeyNextChap] - test byte[pressed+eax],01h - jnz near exitloop - mov eax,[KeyQuickRst] - test byte[pressed+eax],01h - jnz near exitloop - mov eax,[KeyQuickExit] - test byte[pressed+eax],01h - jnz near exitloop - mov eax,[KeyQuickLoad] - test byte[pressed+eax],01h - jnz near exitloop - cmp byte[ExecExitOkay],0 - je .returntoloop - dec byte[ExecExitOkay] -.returntoloop - mov dh,[tempdh] - inc word[curypos] - cmp byte[NoInputRead],1 - je .noinputread - call ReadInputDevice -.noinputread - - ;Pause and Frame increment - cmp byte[PauseFrameMode],3 - jne .nopauseframemode3 - pushad - call RestorePauseFrame - popad - mov esi,[tempesi] - mov edi,[tempedi] - mov ebp,[tempebp] - mov edx,[tempedx] -.nopauseframemode3 - - cmp byte[EMUPause],1 - jne .noemupause - cmp byte[RawDumpInProgress],1 - je .noemupause - - cmp byte[PauseFrameMode],1 - jne .nopauseframemode1 - mov [tempedx],edx - mov [tempesi],esi - mov [tempedi],edi - mov [tempebp],ebp - pushad - call BackupPauseFrame - popad -.nopauseframemode1 - - call ProcessRewind - - cmp byte[PauseFrameMode],2 - jne .nopauseframemode2 - mov byte[PauseFrameMode],3 - jmp .noprocmovie -.nopauseframemode2 - - cmp byte[INCRFrame],1 - jne .noframeincr - xor byte[INCRFrame],1 - jmp .noemupause -.noframeincr - - ;Update screen - DISABLED FOR NOW - pushad - ;call StartDrawNewGfx - ;call showvideo - ;call cachevideo - popad - - jmp .nonewgfx -.noemupause - - ;Rewind update must be done before process this frame of movie, so rewind doesn't - ;back up incremented values (some vars being for the next frame) - call UpdateRewind - - cmp byte[MovieProcessing],0 - je .noprocmovie - pushad - call ProcessMovies - popad - cmp byte[GUIReset],1 - jne .notreset - mov byte[MovieWaiting],1 - mov eax,[KeyQuickRst] - mov byte[pressed+eax],01h - jmp near exitloop -.notreset - cmp byte[MovieProcessing],0 - jne .noprocmovie - cmp byte[ZMVZClose],1 - jne .noprocmovie - jmp DosExit -.noprocmovie - - cmp byte[device2],3 - jne .nolethalen1 - mov eax,[LethEnData] - mov [JoyBNow],eax -.nolethalen1 - ;Todo, add second gun... - cmp byte[device2],4 - jne .nolethalen2 - mov eax,[LethEnData] - mov [JoyBNow],eax -.nolethalen2 - - - test byte[INTEnab],1 - jz .noresetjoy - mov eax,[JoyAOrig] - rol eax,16 - mov [JoyANow],eax - mov eax,[JoyBOrig] - rol eax,16 - mov [JoyBNow],eax - mov eax,[JoyCOrig] - rol eax,16 - mov [JoyCNow],eax - mov eax,[JoyDOrig] - mov [JoyDNow],eax - mov eax,[JoyEOrig] - mov [JoyENow],eax - mov byte[JoyCRead],0 -.noresetjoy - mov byte[MultiTapStat],80h - - cmp byte[C4Enable],0 - je .noC4 - call C4VBlank -.noC4 -; mov byte[hdmastartsc],0 - mov byte[joycontren],0 - test byte[curexecstate],01h - jnz .dis65816 - or byte[curexecstate],01h -.dis65816 - cmp byte[CheatOn],1 - je near .cheater -.returncheat - mov ax,[VIRQLoc] - cmp word[curypos],ax - jne .novirqz - mov byte[doirqnext],1 -.novirqz - mov ax,[oamaddrs] - mov [oamaddr],ax - mov byte[nosprincr],0 - call showvideo - xor ebx,ebx - mov byte[NMIEnab],81h - test byte[INTEnab],80h - jz near .nonmi -; cmp byte[intrset],1 -; je near .nonmi - -.nmiokay - mov byte[curnmi],1 - cmp byte[intrset],1 - jne .nointrset - mov byte[intrset],2 -.nointrset - cmp byte[nmistatus],1 - jne .notnonmifound - mov byte[nmirept],0 -.notnonmifound - mov byte[nmistatus],0 - cmp byte[nmirept],0 - jne .nocheck - mov al,[resolutn] - sub al,2 - mov [nmiprevline],al - mov dword[nmiprevaddrl],0FFFFFFFFh - mov dword[nmiprevaddrh],0 - mov byte[nmirept],1 - mov byte[doirqnext],0 - jmp switchtonmi -.nocheck - cmp byte[nmirept],10 - je .nextcheck - cmp esi,[nmiprevaddrl] - jae .notlower - mov [nmiprevaddrl],esi -.notlower - cmp esi,[nmiprevaddrh] - jbe .notgreater - mov [nmiprevaddrh],esi -.notgreater - inc byte[nmirept] - jmp switchtonmi -.nextcheck - mov eax,[nmiprevaddrh] - sub eax,[nmiprevaddrl] - cmp eax,10 - ja .failcheck - cmp esi,[nmiprevaddrl] - jb .failcheck - cmp esi,[nmiprevaddrh] - ja .failcheck - mov byte[doirqnext],0 - jmp switchtonmi -.failcheck - mov byte[nmirept],0 - mov dword[nmiprevaddrl],0FFFFFFFFh - mov dword[nmiprevaddrh],0 - mov byte[doirqnext],0 - jmp switchtonmi -.nonmi - cmp byte[intrset],1 - jne .nointrset2w - mov byte[intrset],2 -.nointrset2w - xor ebx,ebx - xor ecx,ecx - mov bl,[esi] - inc esi - jmp execloop.startagain - - -.overy - mov dh,80 -%ifdef __MSDOS__ - cmp byte[smallscreenon],1 - je .nocfield - cmp byte[ScreenScale],1 - je .nocfield -%endif - cmp byte[scanlines],0 - jne .nocfield - xor byte[cfield],1 -.nocfield - mov word[curypos],0 - xor byte[ppustatus],80h - cmp dword[numspcvblleft],0 - je near .novblch - cmp [lowestspc],ebp - ja .failspc - cmp [highestspc],ebp - jb .failspc - jmp .okayspc -.failspc - mov eax,ebp - sub eax,10 - mov [lowestspc],eax - add eax,20 - mov [highestspc],eax - mov dword[spc700idle],0 -.okayspc - cmp dword[SPC700write],0 - jne .notwritespc - cmp dword[spc700read],0 - je .notwritespc - cmp dword[SPC700read],1500 - jb .notwritespc - inc dword[spc700idle] - cmp dword[spc700idle],30 - jne .noidleend - call idledetectspc - cmp byte[ReturnFromSPCStall],1 - jne .noidleend - mov byte[ExecExitOkay],0 - jmp exitloop -.noidleend - jmp .notidle -.notwritespc - mov dword[spc700idle],0 -.notidle - dec dword[numspcvblleft] - mov dword[SPC700write],0 - mov dword[SPC700read],0 - mov dword[spc700read],0 -.novblch - mov byte[NMIEnab],01h - call starthdma - ; check for VIRQ/HIRQ/NMI - ProcessIRQStuff - xor ebx,ebx - mov bl,[esi] - inc esi - jmp execloop.startagain - -.virq - test byte[curexecstate],01h - jnz .dis658162 - or byte[curexecstate],01h -.dis658162 - mov byte[doirqnext],0 - xor ebx,ebx - mov ax,[resolutn] - cmp word[curypos],ax - jnb .nodrawline - cmp byte[hdmadelay],1 - jne .virqstuff -.virqstuff - cmp byte[hdmadelay],0 - je .dohdma2 - dec byte[hdmadelay] - jmp .nodohdma2 -.dohdma2 - call exechdma -.nodohdma2 - cmp word[curypos],1 - jne .nocache2 - call cachevideo -.nocache2 - cmp byte[curblank],0 - jne .nodrawline - call drawline -.nodrawline - cmp byte[intrset],1 - jne .nointrset2 - mov byte[intrset],2 -.nointrset2 -; sub dh,8 - jmp switchtovirq - -.hirq - mov byte[HIRQNextExe],0 - test byte[INTEnab],10h - jz .hirqnotokay - test byte[curexecstate],01h - jnz .dis658162h - or byte[curexecstate],01h -.dis658162h - mov byte[doirqnext],0 - cmp byte[intrset],1 - jne .nointrset2h - mov byte[intrset],2 -.nointrset2h - test dl,04h - jnz .irqd - jmp switchtovirq -.irqd - mov byte[doirqnext],1 -.hirqnotokay - jmp .nodrawlineh - -.returnfromhirq - mov ax,[resolutn] - cmp word[curypos],ax - jnb .nodrawlineh - cmp byte[hdmadelay],0 - je .dohdma2h - dec byte[hdmadelay] - jmp .nodohdma2h -.dohdma2h - call exechdma -.nodohdma2h - cmp word[curypos],1 - jne .nocache2h - call cachevideo -.nocache2h - cmp byte[curblank],0 - jne .nodrawlineh - call drawline -.nodrawlineh - xor ebx,ebx - mov bl,[esi] - inc esi - jmp execloop.startagain - -.cheater - push eax - push ebx - push ecx - push edx - mov al,[NumCheats] - mov [.numcheat],al - xor edx,edx -.anothercheat - xor ebx,ebx - xor ecx,ecx - test byte[cheatdata+edx],5 - jnz .nonormcheat - test byte[cheatdata+edx-28],80h - jnz .nonormcheat - test byte[cheatdata+edx],80h - jnz .cheatcodereflect - mov al,[cheatdata+edx+1] - mov cx,[cheatdata+edx+2] - mov bl,[cheatdata+edx+4] - push edx - call dword near [memtablew8+ebx*4] - pop edx - jmp .nonormcheat -.cheatcodereflect - cmp byte[.numcheat],1 - je .nonormcheat - mov cx,[cheatdata+edx+2+28] - mov bl,[cheatdata+edx+4+28] - push edx - call dword near [memtabler8+ebx*4] - pop edx - mov cx,[cheatdata+edx+2] - mov bl,[cheatdata+edx+4] - push edx - call dword near [memtablew8+ebx*4] - pop edx - add edx,28 - dec byte[.numcheat] -.nonormcheat - add edx,28 - dec byte[.numcheat] - jnz near .anothercheat - pop edx - pop ecx - pop ebx - pop eax - jmp .returncheat - -SECTION .bss -.numcheat resb 1 -SECTION .text - -ALIGN16 - -NEWSYM pexecs - mov byte[soundcycleft],30 -.sloop - mov bl,[ebp] - ; 1260, 10000/12625 - inc ebp - call dword near [opcjmptab+ebx*4] - xor ebx,ebx - dec byte[soundcycleft] - jnz .sloop - xor dh,dh - xor ebx,ebx - mov bl,[esi] - inc esi - jmp execloop.startagain - -NEWSYM pexecs2 -.sloop - mov bl,[ebp] - ; 1260, 10000/12625 - inc ebp - call dword near [opcjmptab+ebx*4] - xor ebx,ebx - dec dword[soundcycleft] - jnz .sloop - ret - -NEWSYM UpdatePORSCMR - push ebx - push eax - test byte[SfxPOR],10h - jnz .objmode - mov al,[SfxSCMR] - and al,00100100b ; 4 + 32 - cmp al,4 - je .lines160 - cmp al,32 - je .lines192 - cmp al,36 - je .objmode - mov eax,[sfx128lineloc] - jmp .donelines -.lines160 - mov eax,[sfx160lineloc] - jmp .donelines -.lines192 - mov eax,[sfx192lineloc] - jmp .donelines -.objmode - mov eax,[sfxobjlineloc] -.donelines - mov [sfxclineloc],eax - - mov al,[SfxSCMR] - and eax,00000011b - mov bl,[SfxPOR] - and bl,0Fh - shl bl,2 - or al,bl - mov ebx,[PLOTJmpb+eax*4] - mov eax,[PLOTJmpa+eax*4] - mov [FxTable+4Ch*4],eax - mov [FxTableb+4Ch*4],eax - mov [FxTablec+4Ch*4],eax - mov [FxTabled+4Ch*4],ebx - pop eax - pop ebx - ret - -NEWSYM UpdateSCBRCOLR - push eax - push ebx - mov ebx,[SfxSCBR] - shl ebx,10 - add ebx,[sfxramdata] - mov [SCBRrel],ebx - mov eax,[SfxCOLR] - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx - pop ebx - pop eax - ret - -NEWSYM UpdateCLSR - mov dword[NumberOfOpcodes2],350 ; 0FFFFFFFh;350 - test byte[SfxCLSR],01h - jz .nohighsfx - mov dword[NumberOfOpcodes2],700 ;700 -.nohighsfx - cmp byte[SFXCounter],1 - je .noyi - mov dword[NumberOfOpcodes2],0FFFFFFFh -.noyi - ret - -NEWSYM UpdateSFX - call UpdatePORSCMR - call UpdatePORSCMR - call UpdateCLSR - ret - -NEWSYM StartSFX - push edx - push esi - push edi - push ebp - xor ebx,ebx - mov bl,[SfxPBR] - mov al,[SfxSCMR] - and bl,7Fh - cmp bl,70h - jae .ram - test al,10h - jz .noaccess - jmp .noram -.ram - test al,08h - jz .noaccess -.noram - mov eax,[NumberOfOpcodes2] - mov [NumberOfOpcodes],eax - call MainLoop -.noaccess - pop ebp - pop edi - pop esi - pop edx - xor ebx,ebx - xor ecx,ecx - jmp cpuover.returnfromsfx - -NEWSYM StartSFXdebug - push edx - push esi - push edi - push ebx - mov bl,[SfxPBR] - mov al,[SfxSCMR] - and bl,7Fh - cmp bl,70h - jae .ram - test al,10h - jz .noaccess - jmp .noram -.ram - test al,08h - jz .noaccess -.noram - mov dword[NumberOfOpcodes],350 ; 0FFFFFFFh;350 - test byte[SfxCLSR],01h - jz .nohighsfx - mov dword[NumberOfOpcodes],700 ;700 -.nohighsfx - cmp byte[SFXCounter],1 - jne .noyi - mov dword[NumberOfOpcodes],0FFFFFFFFh -.noyi -; call SFXDebugLoop -.noaccess - pop ebx - pop edi - pop esi - pop edx - xor ecx,ecx - jmp execsingle.returnfromsfx - -NEWSYM StartSFXdebugb - push edx - push esi - push edi - push ebp - push ebx - - test byte[SfxPOR],10h - jnz .objmode - mov al,[SfxSCMR] - and al,00100100b ; 4 + 32 - cmp al,4 - je .lines160 - cmp al,32 - je .lines192 - cmp al,36 - je .objmode - mov eax,[sfx128lineloc] - jmp .donelines -.lines160 - mov eax,[sfx160lineloc] - jmp .donelines -.lines192 - mov eax,[sfx192lineloc] - jmp .donelines -.objmode - mov eax,[sfxobjlineloc] -.donelines - mov [sfxclineloc],eax - - mov al,[SfxSCMR] - and eax,00000011b - mov bl,[SfxPOR] - and bl,0Fh - shl bl,2 - or al,bl - mov ebx,[PLOTJmpb+eax*4] - mov eax,[PLOTJmpa+eax*4] - mov [FxTable+4Ch*4],eax - mov [FxTableb+4Ch*4],eax - mov [FxTablec+4Ch*4],eax - mov [FxTabled+4Ch*4],ebx - - mov ebx,[SfxSCBR] - shl ebx,10 - add ebx,[sfxramdata] - mov [SCBRrel],ebx - - mov eax,[SfxCOLR] - mov ebx,[fxbit01+eax*4] - mov [fxbit01pcal],ebx - mov ebx,[fxbit23+eax*4] - mov [fxbit23pcal],ebx - mov ebx,[fxbit45+eax*4] - mov [fxbit45pcal],ebx - mov ebx,[fxbit67+eax*4] - mov [fxbit67pcal],ebx - xor ebx,ebx - - mov bl,[SfxPBR] - mov al,[SfxSCMR] - and bl,7Fh - cmp bl,70h - jae .ram - test al,10h - jz .noaccess - jmp .noram -.ram - test al,08h - jz .noaccess -.noram - mov dword[NumberOfOpcodes],420 ;678 - test byte[SfxCLSR],01h - jz .nohighsfx - mov dword[NumberOfOpcodes],800 ;678*2 -.nohighsfx - cmp byte[SFXCounter],1 - jne .noyi - mov dword[NumberOfOpcodes],0FFFFFFFh -.noyi - call MainLoop -.noaccess - pop ebx - pop ebp - pop edi - pop esi - pop edx - xor ecx,ecx - jmp execsingle.returnfromsfx - -NEWSYM StartSFXret - test byte[SfxSFR],20h - jz .endfx - pushad - mov bl,[SfxPBR] - mov al,[SfxSCMR] - and bl,7Fh - cmp bl,70h - jae .ram - test al,10h - jz .noaccess - jmp .noram -.ram - test al,08h - jz .noaccess -.noram - mov dword[NumberOfOpcodes],420 ;678 - test byte[SfxCLSR],01h - jz .nohighsfx - mov dword[NumberOfOpcodes],800 ;678*2 -.nohighsfx - mov dword[NumberOfOpcodes],0FFFFFFFFh - call MainLoop -.noaccess - popad -.endfx - ret - -;******************************************************* -; Execute a Single 65816 instruction (debugging purpose) -;******************************************************* -NEWSYM execloopdeb - jmp exitloop2 - -NEWSYM execsingle - - xor ebx,ebx - test byte[curexecstate],2 - jz .nosoundb - sub dword[cycpbl],55 - jnc .skipallspc - mov eax,[cycpblt] - mov bl,[ebp] - add dword[cycpbl],eax - ; 1260, 10000/12625 - inc ebp - call dword near [opcjmptab+ebx*4] - xor ebx,ebx -.skipallspc -.nosoundb - - mov bl,dl - mov byte[exiter],01h - mov edi,[tablead+ebx*4] - mov bl,[esi] - inc esi - sub dh,[cpucycle+ebx] - jc .cpuover - mov [pdh],dh - xor dh,dh - jmp dword near [edi+ebx*4] -.cpuover - - cmp byte[SA1Enable],0 - je near .nosa1 - mov byte[cycpl],150 - test byte[SA1Control],60h - jnz near .nosa1 - dec esi - call SA1Swap - - mov bl,[esi] - inc esi - mov [pdh],dh - xor dh,dh - cmp byte[CurrentExecSA1],17 - jb near cpuover - mov byte[CurrentExecSA1],0 - mov byte[cycpl],5 - jmp .nosa1 -.nosa1 - - cmp byte[KeyOnStB],0 - je .nokeyon - mov al,[KeyOnStB] - call ProcessKeyOn -.nokeyon - mov al,[KeyOnStA] - mov [KeyOnStB],al - mov byte[KeyOnStA],0 - test byte[SfxSFR],20h - jnz near StartSFXdebugb -.returnfromsfx - add dh,[cycpl] - mov [pdh],dh - - cmp byte[spcon],0 - je .nosound - call updatetimer - push ebx - xor ebx,ebx - mov bl,dl - mov edi,[tablead+ebx*4] - pop ebx -.nosound - xor dh,dh - inc word[curypos] - mov ax,[resolutn] - inc ax - cmp word[curypos],ax - je near .nmi - mov ax,[totlines] - cmp word[curypos],ax - jae near .overy - ; check for VIRQ/HIRQ/NMI - ProcessIRQStuff - -; test dl,04h -; jnz .noirq -; test byte[INTEnab],20h -; jz .novirq -; mov ax,[VIRQLoc] -; cmp word[curypos],ax -; je near .virq -; jmp .noirq -;.novirq -; test byte[INTEnab],10h -; jnz near .virq -;.noirq -; test byte[INTEnab],20h -; jz .novirq2b -; mov ax,[VIRQLoc] -; cmp word[curypos],ax -; jne .novirq2b -; cmp byte[intrset],1 -; jne .nointrset2b -; mov byte[intrset],2 -;.nointrset2b -;.novirq2b - mov ax,[resolutn] - cmp word[curypos],ax - jb .drawline - jmp dword near [edi+ebx*4] - -.drawline - cmp byte[hdmadelay],0 - je .dohdma - dec byte[hdmadelay] - jmp .nodohdma -.dohdma - call exechdma -.nodohdma - cmp byte[curblank],0 - jne .nodrawlineb - call drawline -.nodrawlineb - jmp dword near [edi+ebx*4] - -.nmi - mov byte[irqon],80h - cmp byte[C4Enable],0 - je .noC4 - call C4VBlank -.noC4 -; mov byte[hdmastartsc],0 - mov byte[joycontren],0 - mov ax,[VIRQLoc] - cmp word[curypos],ax - jne .novirqz - inc word[VIRQLoc] -.novirqz - - call ReadInputDevice - - test byte[INTEnab],1 - jz .noresetjoy - mov eax,[JoyAOrig] - rol eax,16 - mov [JoyANow],eax - mov eax,[JoyBOrig] - rol eax,16 - mov [JoyBNow],eax - mov eax,[JoyCOrig] - rol eax,16 - mov [JoyCNow],eax - mov eax,[JoyDOrig] - mov [JoyDNow],eax - mov byte[JoyCRead],0 -.noresetjoy - - cmp byte[device2],3 - jne .nolethalen1 - mov eax,[LethEnData] - mov [JoyBNow],eax -.nolethalen1 - cmp byte[device2],4 - jne .nolethalen2 - mov eax,[LethEnData] - mov [JoyBNow],eax -.nolethalen2 - - mov byte[MultiTapStat],80h - mov byte[NMIEnab],81h - test byte[INTEnab],80h - jz .nonmi - mov byte[curnmi],1 - dec esi - cmp byte[intrset],1 - jne .nointrset - mov byte[intrset],2 -.nointrset - jmp switchtonmideb -.nonmi - cmp byte[intrset],1 - jne .nointrset2w - mov byte[intrset],2 -.nointrset2w - cmp byte[esi],0CBh - jne .nowai - and dl,0FBh -.nowai - jmp dword near [edi+ebx*4] - -.overy - mov dh,80 - mov word[curypos],0 - xor byte[ppustatus],80h - mov byte[NMIEnab],01h - add dword[opcd],170*262 - call cachevideo - call starthdma - - ProcessIRQStuff - -; test dl,04h -; jnz .novirq2 -; test byte[INTEnab],20h -; jz .novirq2 -; mov ax,[VIRQLoc] -; cmp word[curypos],ax -; je near .virq -; mov ax,[VIRQLoc] -; cmp ax,[totlines] -; jae .virq -;.novirq2 - jmp dword near [edi+ebx*4] - -.virq - mov ax,[resolutn] - cmp word[curypos],ax - jnb .nodrawline - cmp byte[hdmadelay],0 - je .dohdma2 - dec byte[hdmadelay] - jmp .nodohdma2 -.dohdma2 - call exechdma -.nodohdma2 - cmp byte[curblank],0 - jne .nodrawline - call drawline -.nodrawline - dec esi - cmp byte[intrset],1 - jne .nointrset2 - mov byte[intrset],2 -.nointrset2 - jmp switchtovirqdeb diff --git a/tools/zsnes/src/cpu/executec.c b/tools/zsnes/src/cpu/executec.c deleted file mode 100644 index e219e5e..0000000 --- a/tools/zsnes/src/cpu/executec.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - - -#ifdef __UNIXSDL__ -#include "../gblhdr.h" -#define DIR_SLASH "/" -#else -#include -#include -#include -#include -#define DIR_SLASH "\\" -#endif -#include "../gblvars.h" - - -//Start of execute.asm goodness -extern unsigned char t1cc; // not sure about this one -extern unsigned short int nextframe; // framecounter for frameskipping - -void Game60hzcall() -{ - t1cc++; - nextframe++; -} - diff --git a/tools/zsnes/src/cpu/firtable.inc b/tools/zsnes/src/cpu/firtable.inc deleted file mode 100644 index eb72d5b..0000000 --- a/tools/zsnes/src/cpu/firtable.inc +++ /dev/null @@ -1,6171 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -SECTION .data - -fir_lut: -dw 27, -363, 1153, 14775, 1153, -363, 27, -24 -dw 27, -362, 1147, 14775, 1159, -365, 27, -24 -dw 27, -361, 1141, 14775, 1165, -366, 28, -24 -dw 27, -360, 1135, 14774, 1170, -367, 28, -24 -dw 27, -359, 1129, 14774, 1176, -368, 28, -24 -dw 27, -358, 1124, 14774, 1182, -369, 28, -24 -dw 27, -357, 1118, 14774, 1188, -370, 28, -24 -dw 27, -356, 1112, 14774, 1194, -371, 28, -24 -dw 27, -355, 1106, 14774, 1200, -372, 28, -24 -dw 27, -354, 1100, 14774, 1206, -373, 28, -24 -dw 26, -353, 1095, 14774, 1212, -374, 28, -24 -dw 26, -352, 1089, 14774, 1218, -375, 28, -24 -dw 26, -351, 1083, 14773, 1223, -376, 28, -24 -dw 26, -350, 1077, 14773, 1229, -377, 28, -24 -dw 26, -349, 1072, 14773, 1235, -378, 29, -24 -dw 26, -348, 1066, 14773, 1241, -379, 29, -24 -dw 26, -347, 1060, 14773, 1247, -381, 29, -24 -dw 26, -346, 1054, 14772, 1253, -382, 29, -23 -dw 26, -345, 1049, 14772, 1259, -383, 29, -23 -dw 26, -343, 1043, 14772, 1265, -384, 29, -23 -dw 26, -342, 1037, 14772, 1271, -385, 29, -23 -dw 26, -341, 1031, 14771, 1277, -386, 29, -23 -dw 25, -340, 1026, 14771, 1283, -387, 29, -23 -dw 25, -339, 1020, 14771, 1289, -388, 29, -23 -dw 25, -338, 1014, 14770, 1295, -389, 30, -23 -dw 25, -337, 1009, 14770, 1301, -390, 30, -23 -dw 25, -336, 1003, 14770, 1307, -391, 30, -23 -dw 25, -335, 997, 14769, 1313, -392, 30, -23 -dw 25, -334, 992, 14769, 1319, -394, 30, -23 -dw 25, -333, 986, 14769, 1325, -395, 30, -23 -dw 25, -332, 980, 14768, 1331, -396, 30, -23 -dw 25, -331, 975, 14768, 1337, -397, 30, -23 -dw 25, -330, 969, 14768, 1343, -398, 30, -23 -dw 24, -329, 963, 14767, 1349, -399, 30, -23 -dw 24, -328, 958, 14767, 1355, -400, 30, -23 -dw 24, -327, 952, 14766, 1362, -401, 31, -23 -dw 24, -326, 947, 14766, 1368, -402, 31, -23 -dw 24, -325, 941, 14765, 1374, -403, 31, -23 -dw 24, -324, 935, 14765, 1380, -404, 31, -23 -dw 24, -323, 930, 14764, 1386, -406, 31, -23 -dw 24, -322, 924, 14764, 1392, -407, 31, -23 -dw 24, -321, 919, 14763, 1398, -408, 31, -23 -dw 24, -320, 913, 14763, 1404, -409, 31, -23 -dw 24, -319, 908, 14762, 1410, -410, 31, -23 -dw 24, -318, 902, 14762, 1417, -411, 31, -22 -dw 24, -317, 896, 14761, 1423, -412, 31, -22 -dw 23, -316, 891, 14761, 1429, -413, 32, -22 -dw 23, -315, 885, 14760, 1435, -414, 32, -22 -dw 23, -314, 880, 14760, 1441, -415, 32, -22 -dw 23, -313, 874, 14759, 1447, -417, 32, -22 -dw 23, -312, 869, 14758, 1453, -418, 32, -22 -dw 23, -311, 863, 14758, 1460, -419, 32, -22 -dw 23, -310, 858, 14757, 1466, -420, 32, -22 -dw 23, -309, 852, 14756, 1472, -421, 32, -22 -dw 23, -308, 847, 14756, 1478, -422, 32, -22 -dw 23, -307, 841, 14755, 1484, -423, 32, -22 -dw 23, -306, 836, 14754, 1491, -424, 33, -22 -dw 23, -305, 830, 14754, 1497, -425, 33, -22 -dw 22, -304, 825, 14753, 1503, -427, 33, -22 -dw 22, -303, 819, 14752, 1509, -428, 33, -22 -dw 22, -302, 814, 14751, 1516, -429, 33, -22 -dw 22, -301, 809, 14751, 1522, -430, 33, -22 -dw 22, -300, 803, 14750, 1528, -431, 33, -22 -dw 22, -299, 798, 14749, 1534, -432, 33, -22 -dw 22, -298, 792, 14748, 1541, -433, 33, -22 -dw 22, -297, 787, 14748, 1547, -434, 33, -22 -dw 22, -296, 782, 14747, 1553, -436, 34, -22 -dw 22, -295, 776, 14746, 1559, -437, 34, -22 -dw 22, -294, 771, 14745, 1566, -438, 34, -22 -dw 22, -293, 765, 14744, 1572, -439, 34, -22 -dw 22, -292, 760, 14744, 1578, -440, 34, -21 -dw 21, -291, 755, 14743, 1585, -441, 34, -21 -dw 21, -290, 749, 14742, 1591, -442, 34, -21 -dw 21, -289, 744, 14741, 1597, -443, 34, -21 -dw 21, -288, 739, 14740, 1604, -445, 34, -21 -dw 21, -287, 733, 14739, 1610, -446, 34, -21 -dw 21, -286, 728, 14738, 1616, -447, 35, -21 -dw 21, -285, 723, 14737, 1623, -448, 35, -21 -dw 21, -284, 717, 14736, 1629, -449, 35, -21 -dw 21, -283, 712, 14735, 1635, -450, 35, -21 -dw 21, -282, 707, 14734, 1642, -451, 35, -21 -dw 21, -281, 701, 14733, 1648, -452, 35, -21 -dw 21, -280, 696, 14732, 1654, -454, 35, -21 -dw 21, -279, 691, 14731, 1661, -455, 35, -21 -dw 20, -278, 685, 14730, 1667, -456, 35, -21 -dw 20, -277, 680, 14729, 1674, -457, 35, -21 -dw 20, -276, 675, 14728, 1680, -458, 36, -21 -dw 20, -275, 670, 14727, 1686, -459, 36, -21 -dw 20, -274, 664, 14726, 1693, -460, 36, -21 -dw 20, -273, 659, 14725, 1699, -462, 36, -21 -dw 20, -272, 654, 14724, 1706, -463, 36, -21 -dw 20, -271, 649, 14723, 1712, -464, 36, -21 -dw 20, -270, 643, 14722, 1719, -465, 36, -21 -dw 20, -269, 638, 14721, 1725, -466, 36, -21 -dw 20, -268, 633, 14720, 1731, -467, 36, -21 -dw 20, -267, 628, 14718, 1738, -468, 36, -21 -dw 20, -266, 623, 14717, 1744, -470, 37, -20 -dw 19, -265, 617, 14716, 1751, -471, 37, -20 -dw 19, -265, 612, 14715, 1757, -472, 37, -20 -dw 19, -264, 607, 14714, 1764, -473, 37, -20 -dw 19, -263, 602, 14713, 1770, -474, 37, -20 -dw 19, -262, 597, 14711, 1777, -475, 37, -20 -dw 19, -261, 592, 14710, 1783, -476, 37, -20 -dw 19, -260, 586, 14709, 1790, -478, 37, -20 -dw 19, -259, 581, 14708, 1796, -479, 37, -20 -dw 19, -258, 576, 14706, 1803, -480, 37, -20 -dw 19, -257, 571, 14705, 1809, -481, 38, -20 -dw 19, -256, 566, 14704, 1816, -482, 38, -20 -dw 19, -255, 561, 14703, 1823, -483, 38, -20 -dw 19, -254, 556, 14701, 1829, -485, 38, -20 -dw 19, -253, 551, 14700, 1836, -486, 38, -20 -dw 18, -252, 546, 14699, 1842, -487, 38, -20 -dw 18, -251, 540, 14697, 1849, -488, 38, -20 -dw 18, -250, 535, 14696, 1855, -489, 38, -20 -dw 18, -249, 530, 14695, 1862, -490, 38, -20 -dw 18, -248, 525, 14693, 1869, -492, 39, -20 -dw 18, -248, 520, 14692, 1875, -493, 39, -20 -dw 18, -247, 515, 14690, 1882, -494, 39, -20 -dw 18, -246, 510, 14689, 1888, -495, 39, -20 -dw 18, -245, 505, 14688, 1895, -496, 39, -20 -dw 18, -244, 500, 14686, 1902, -497, 39, -20 -dw 18, -243, 495, 14685, 1908, -499, 39, -19 -dw 18, -242, 490, 14683, 1915, -500, 39, -19 -dw 18, -241, 485, 14682, 1922, -501, 39, -19 -dw 18, -240, 480, 14680, 1928, -502, 39, -19 -dw 17, -239, 475, 14679, 1935, -503, 40, -19 -dw 17, -238, 470, 14677, 1941, -504, 40, -19 -dw 17, -237, 465, 14676, 1948, -506, 40, -19 -dw 17, -236, 460, 14674, 1955, -507, 40, -19 -dw 17, -235, 455, 14673, 1961, -508, 40, -19 -dw 17, -235, 450, 14671, 1968, -509, 40, -19 -dw 17, -234, 445, 14670, 1975, -510, 40, -19 -dw 17, -233, 440, 14668, 1982, -511, 40, -19 -dw 17, -232, 435, 14666, 1988, -513, 40, -19 -dw 17, -231, 430, 14665, 1995, -514, 41, -19 -dw 17, -230, 425, 14663, 2002, -515, 41, -19 -dw 17, -229, 420, 14662, 2008, -516, 41, -19 -dw 17, -228, 416, 14660, 2015, -517, 41, -19 -dw 17, -227, 411, 14658, 2022, -519, 41, -19 -dw 17, -226, 406, 14657, 2029, -520, 41, -19 -dw 16, -225, 401, 14655, 2035, -521, 41, -19 -dw 16, -224, 396, 14653, 2042, -522, 41, -19 -dw 16, -224, 391, 14652, 2049, -523, 41, -19 -dw 16, -223, 386, 14650, 2056, -524, 42, -19 -dw 16, -222, 381, 14648, 2062, -526, 42, -19 -dw 16, -221, 377, 14647, 2069, -527, 42, -19 -dw 16, -220, 372, 14645, 2076, -528, 42, -19 -dw 16, -219, 367, 14643, 2083, -529, 42, -18 -dw 16, -218, 362, 14641, 2090, -530, 42, -18 -dw 16, -217, 357, 14640, 2096, -532, 42, -18 -dw 16, -216, 352, 14638, 2103, -533, 42, -18 -dw 16, -215, 348, 14636, 2110, -534, 42, -18 -dw 16, -215, 343, 14634, 2117, -535, 43, -18 -dw 16, -214, 338, 14632, 2124, -536, 43, -18 -dw 16, -213, 333, 14631, 2130, -538, 43, -18 -dw 16, -212, 328, 14629, 2137, -539, 43, -18 -dw 15, -211, 324, 14627, 2144, -540, 43, -18 -dw 15, -210, 319, 14625, 2151, -541, 43, -18 -dw 15, -209, 314, 14623, 2158, -542, 43, -18 -dw 15, -208, 309, 14621, 2165, -543, 43, -18 -dw 15, -207, 305, 14619, 2172, -545, 43, -18 -dw 15, -207, 300, 14618, 2178, -546, 44, -18 -dw 15, -206, 295, 14616, 2185, -547, 44, -18 -dw 15, -205, 290, 14614, 2192, -548, 44, -18 -dw 15, -204, 286, 14612, 2199, -549, 44, -18 -dw 15, -203, 281, 14610, 2206, -551, 44, -18 -dw 15, -202, 276, 14608, 2213, -552, 44, -18 -dw 15, -201, 272, 14606, 2220, -553, 44, -18 -dw 15, -200, 267, 14604, 2227, -554, 44, -18 -dw 15, -200, 262, 14602, 2234, -555, 44, -18 -dw 15, -199, 257, 14600, 2241, -557, 45, -18 -dw 15, -198, 253, 14598, 2247, -558, 45, -18 -dw 14, -197, 248, 14596, 2254, -559, 45, -18 -dw 14, -196, 243, 14594, 2261, -560, 45, -17 -dw 14, -195, 239, 14592, 2268, -562, 45, -17 -dw 14, -194, 234, 14590, 2275, -563, 45, -17 -dw 14, -194, 230, 14588, 2282, -564, 45, -17 -dw 14, -193, 225, 14585, 2289, -565, 45, -17 -dw 14, -192, 220, 14583, 2296, -566, 45, -17 -dw 14, -191, 216, 14581, 2303, -568, 46, -17 -dw 14, -190, 211, 14579, 2310, -569, 46, -17 -dw 14, -189, 206, 14577, 2317, -570, 46, -17 -dw 14, -188, 202, 14575, 2324, -571, 46, -17 -dw 14, -188, 197, 14573, 2331, -572, 46, -17 -dw 14, -187, 193, 14571, 2338, -574, 46, -17 -dw 14, -186, 188, 14568, 2345, -575, 46, -17 -dw 14, -185, 184, 14566, 2352, -576, 46, -17 -dw 14, -184, 179, 14564, 2359, -577, 47, -17 -dw 13, -183, 174, 14562, 2366, -578, 47, -17 -dw 13, -182, 170, 14560, 2373, -580, 47, -17 -dw 13, -182, 165, 14557, 2380, -581, 47, -17 -dw 13, -181, 161, 14555, 2387, -582, 47, -17 -dw 13, -180, 156, 14553, 2394, -583, 47, -17 -dw 13, -179, 152, 14551, 2402, -585, 47, -17 -dw 13, -178, 147, 14548, 2409, -586, 47, -17 -dw 13, -177, 143, 14546, 2416, -587, 47, -17 -dw 13, -176, 138, 14544, 2423, -588, 48, -17 -dw 13, -176, 134, 14541, 2430, -589, 48, -17 -dw 13, -175, 129, 14539, 2437, -591, 48, -16 -dw 13, -174, 125, 14537, 2444, -592, 48, -16 -dw 13, -173, 120, 14534, 2451, -593, 48, -16 -dw 13, -172, 116, 14532, 2458, -594, 48, -16 -dw 13, -171, 111, 14530, 2465, -596, 48, -16 -dw 13, -171, 107, 14527, 2472, -597, 48, -16 -dw 13, -170, 103, 14525, 2480, -598, 49, -16 -dw 13, -169, 98, 14522, 2487, -599, 49, -16 -dw 12, -168, 94, 14520, 2494, -600, 49, -16 -dw 12, -167, 89, 14518, 2501, -602, 49, -16 -dw 12, -166, 85, 14515, 2508, -603, 49, -16 -dw 12, -166, 80, 14513, 2515, -604, 49, -16 -dw 12, -165, 76, 14510, 2522, -605, 49, -16 -dw 12, -164, 72, 14508, 2530, -607, 49, -16 -dw 12, -163, 67, 14505, 2537, -608, 49, -16 -dw 12, -162, 63, 14503, 2544, -609, 50, -16 -dw 12, -162, 59, 14500, 2551, -610, 50, -16 -dw 12, -161, 54, 14498, 2558, -611, 50, -16 -dw 12, -160, 50, 14495, 2566, -613, 50, -16 -dw 12, -159, 45, 14493, 2573, -614, 50, -16 -dw 12, -158, 41, 14490, 2580, -615, 50, -16 -dw 12, -157, 37, 14488, 2587, -616, 50, -16 -dw 12, -157, 32, 14485, 2594, -618, 50, -16 -dw 12, -156, 28, 14482, 2602, -619, 51, -16 -dw 12, -155, 24, 14480, 2609, -620, 51, -16 -dw 12, -154, 20, 14477, 2616, -621, 51, -16 -dw 11, -153, 15, 14475, 2623, -623, 51, -15 -dw 11, -153, 11, 14472, 2631, -624, 51, -15 -dw 11, -152, 7, 14469, 2638, -625, 51, -15 -dw 11, -151, 2, 14467, 2645, -626, 51, -15 -dw 11, -150, -2, 14464, 2652, -628, 51, -15 -dw 11, -149, -6, 14461, 2660, -629, 51, -15 -dw 11, -149, -10, 14459, 2667, -630, 52, -15 -dw 11, -148, -15, 14456, 2674, -631, 52, -15 -dw 11, -147, -19, 14453, 2681, -632, 52, -15 -dw 11, -146, -23, 14450, 2689, -634, 52, -15 -dw 11, -145, -27, 14448, 2696, -635, 52, -15 -dw 11, -145, -32, 14445, 2703, -636, 52, -15 -dw 11, -144, -36, 14442, 2711, -637, 52, -15 -dw 11, -143, -40, 14439, 2718, -639, 52, -15 -dw 11, -142, -44, 14437, 2725, -640, 53, -15 -dw 11, -141, -48, 14434, 2733, -641, 53, -15 -dw 11, -141, -53, 14431, 2740, -642, 53, -15 -dw 11, -140, -57, 14428, 2747, -644, 53, -15 -dw 11, -139, -61, 14426, 2755, -645, 53, -15 -dw 10, -138, -65, 14423, 2762, -646, 53, -15 -dw 10, -138, -69, 14420, 2769, -647, 53, -15 -dw 10, -137, -73, 14417, 2777, -649, 53, -15 -dw 10, -136, -78, 14414, 2784, -650, 54, -15 -dw 10, -135, -82, 14411, 2791, -651, 54, -15 -dw 10, -134, -86, 14408, 2799, -652, 54, -15 -dw 10, -134, -90, 14405, 2806, -654, 54, -15 -dw 10, -133, -94, 14403, 2814, -655, 54, -15 -dw 10, -132, -98, 14400, 2821, -656, 54, -14 -dw 10, -131, -102, 14397, 2828, -657, 54, -14 -dw 10, -131, -106, 14394, 2836, -659, 54, -14 -dw 10, -130, -111, 14391, 2843, -660, 55, -14 -dw 10, -129, -115, 14388, 2851, -661, 55, -14 -dw 10, -128, -119, 14385, 2858, -662, 55, -14 -dw 10, -128, -123, 14382, 2866, -664, 55, -14 -dw 10, -127, -127, 14379, 2873, -665, 55, -14 -dw 10, -126, -131, 14376, 2880, -666, 55, -14 -dw 10, -125, -135, 14373, 2888, -667, 55, -14 -dw 10, -124, -139, 14370, 2895, -669, 55, -14 -dw 10, -124, -143, 14367, 2903, -670, 56, -14 -dw 10, -123, -147, 14364, 2910, -671, 56, -14 -dw 9, -122, -151, 14361, 2918, -672, 56, -14 -dw 9, -121, -155, 14358, 2925, -674, 56, -14 -dw 9, -121, -159, 14355, 2933, -675, 56, -14 -dw 9, -120, -163, 14351, 2940, -676, 56, -14 -dw 9, -119, -167, 14348, 2948, -677, 56, -14 -dw 9, -118, -171, 14345, 2955, -679, 56, -14 -dw 9, -118, -175, 14342, 2963, -680, 57, -14 -dw 9, -117, -179, 14339, 2970, -681, 57, -14 -dw 9, -116, -183, 14336, 2978, -682, 57, -14 -dw 9, -115, -187, 14333, 2985, -684, 57, -14 -dw 9, -115, -191, 14329, 2993, -685, 57, -14 -dw 9, -114, -195, 14326, 3000, -686, 57, -14 -dw 9, -113, -199, 14323, 3008, -687, 57, -14 -dw 9, -112, -203, 14320, 3015, -689, 57, -13 -dw 9, -112, -207, 14317, 3023, -690, 58, -13 -dw 9, -111, -211, 14313, 3030, -691, 58, -13 -dw 9, -110, -214, 14310, 3038, -692, 58, -13 -dw 9, -110, -218, 14307, 3045, -694, 58, -13 -dw 9, -109, -222, 14304, 3053, -695, 58, -13 -dw 9, -108, -226, 14300, 3060, -696, 58, -13 -dw 9, -107, -230, 14297, 3068, -697, 58, -13 -dw 8, -107, -234, 14294, 3076, -699, 58, -13 -dw 8, -106, -238, 14291, 3083, -700, 59, -13 -dw 8, -105, -242, 14287, 3091, -701, 59, -13 -dw 8, -104, -245, 14284, 3098, -703, 59, -13 -dw 8, -104, -249, 14281, 3106, -704, 59, -13 -dw 8, -103, -253, 14277, 3114, -705, 59, -13 -dw 8, -102, -257, 14274, 3121, -706, 59, -13 -dw 8, -101, -261, 14270, 3129, -708, 59, -13 -dw 8, -101, -265, 14267, 3136, -709, 59, -13 -dw 8, -100, -268, 14264, 3144, -710, 60, -13 -dw 8, -99, -272, 14260, 3152, -711, 60, -13 -dw 8, -99, -276, 14257, 3159, -713, 60, -13 -dw 8, -98, -280, 14253, 3167, -714, 60, -13 -dw 8, -97, -284, 14250, 3175, -715, 60, -13 -dw 8, -96, -287, 14247, 3182, -716, 60, -13 -dw 8, -96, -291, 14243, 3190, -718, 60, -13 -dw 8, -95, -295, 14240, 3198, -719, 60, -13 -dw 8, -94, -299, 14236, 3205, -720, 61, -13 -dw 8, -94, -302, 14233, 3213, -721, 61, -13 -dw 8, -93, -306, 14229, 3221, -723, 61, -13 -dw 8, -92, -310, 14226, 3228, -724, 61, -12 -dw 8, -91, -314, 14222, 3236, -725, 61, -12 -dw 8, -91, -317, 14219, 3244, -727, 61, -12 -dw 8, -90, -321, 14215, 3251, -728, 61, -12 -dw 7, -89, -325, 14212, 3259, -729, 62, -12 -dw 7, -89, -329, 14208, 3267, -730, 62, -12 -dw 7, -88, -332, 14204, 3274, -732, 62, -12 -dw 7, -87, -336, 14201, 3282, -733, 62, -12 -dw 7, -87, -340, 14197, 3290, -734, 62, -12 -dw 7, -86, -343, 14194, 3298, -735, 62, -12 -dw 7, -85, -347, 14190, 3305, -737, 62, -12 -dw 7, -85, -351, 14186, 3313, -738, 62, -12 -dw 7, -84, -354, 14183, 3321, -739, 63, -12 -dw 7, -83, -358, 14179, 3329, -740, 63, -12 -dw 7, -82, -362, 14175, 3336, -742, 63, -12 -dw 7, -82, -365, 14172, 3344, -743, 63, -12 -dw 7, -81, -369, 14168, 3352, -744, 63, -12 -dw 7, -80, -372, 14164, 3360, -746, 63, -12 -dw 7, -80, -376, 14161, 3367, -747, 63, -12 -dw 7, -79, -380, 14157, 3375, -748, 63, -12 -dw 7, -78, -383, 14153, 3383, -749, 64, -12 -dw 7, -78, -387, 14150, 3391, -751, 64, -12 -dw 7, -77, -390, 14146, 3399, -752, 64, -12 -dw 7, -76, -394, 14142, 3406, -753, 64, -12 -dw 7, -76, -398, 14138, 3414, -754, 64, -12 -dw 7, -75, -401, 14135, 3422, -756, 64, -12 -dw 7, -74, -405, 14131, 3430, -757, 64, -12 -dw 7, -74, -408, 14127, 3438, -758, 64, -12 -dw 7, -73, -412, 14123, 3445, -760, 65, -11 -dw 6, -72, -415, 14119, 3453, -761, 65, -11 -dw 6, -72, -419, 14116, 3461, -762, 65, -11 -dw 6, -71, -422, 14112, 3469, -763, 65, -11 -dw 6, -70, -426, 14108, 3477, -765, 65, -11 -dw 6, -70, -429, 14104, 3485, -766, 65, -11 -dw 6, -69, -433, 14100, 3492, -767, 65, -11 -dw 6, -68, -436, 14096, 3500, -768, 66, -11 -dw 6, -68, -440, 14092, 3508, -770, 66, -11 -dw 6, -67, -443, 14088, 3516, -771, 66, -11 -dw 6, -66, -447, 14085, 3524, -772, 66, -11 -dw 6, -66, -450, 14081, 3532, -774, 66, -11 -dw 6, -65, -454, 14077, 3540, -775, 66, -11 -dw 6, -64, -457, 14073, 3547, -776, 66, -11 -dw 6, -64, -461, 14069, 3555, -777, 66, -11 -dw 6, -63, -464, 14065, 3563, -779, 67, -11 -dw 6, -62, -468, 14061, 3571, -780, 67, -11 -dw 6, -62, -471, 14057, 3579, -781, 67, -11 -dw 6, -61, -474, 14053, 3587, -782, 67, -11 -dw 6, -60, -478, 14049, 3595, -784, 67, -11 -dw 6, -60, -481, 14045, 3603, -785, 67, -11 -dw 6, -59, -485, 14041, 3611, -786, 67, -11 -dw 6, -58, -488, 14037, 3619, -788, 68, -11 -dw 6, -58, -491, 14033, 3627, -789, 68, -11 -dw 6, -57, -495, 14029, 3635, -790, 68, -11 -dw 6, -57, -498, 14025, 3642, -791, 68, -11 -dw 6, -56, -501, 14020, 3650, -793, 68, -11 -dw 6, -55, -505, 14016, 3658, -794, 68, -11 -dw 6, -55, -508, 14012, 3666, -795, 68, -11 -dw 5, -54, -512, 14008, 3674, -796, 68, -10 -dw 5, -53, -515, 14004, 3682, -798, 69, -10 -dw 5, -53, -518, 14000, 3690, -799, 69, -10 -dw 5, -52, -522, 13996, 3698, -800, 69, -10 -dw 5, -51, -525, 13992, 3706, -802, 69, -10 -dw 5, -51, -528, 13987, 3714, -803, 69, -10 -dw 5, -50, -531, 13983, 3722, -804, 69, -10 -dw 5, -50, -535, 13979, 3730, -805, 69, -10 -dw 5, -49, -538, 13975, 3738, -807, 70, -10 -dw 5, -48, -541, 13971, 3746, -808, 70, -10 -dw 5, -48, -545, 13967, 3754, -809, 70, -10 -dw 5, -47, -548, 13962, 3762, -810, 70, -10 -dw 5, -46, -551, 13958, 3770, -812, 70, -10 -dw 5, -46, -554, 13954, 3778, -813, 70, -10 -dw 5, -45, -558, 13950, 3786, -814, 70, -10 -dw 5, -45, -561, 13945, 3794, -816, 70, -10 -dw 5, -44, -564, 13941, 3802, -817, 71, -10 -dw 5, -43, -567, 13937, 3810, -818, 71, -10 -dw 5, -43, -571, 13932, 3818, -819, 71, -10 -dw 5, -42, -574, 13928, 3826, -821, 71, -10 -dw 5, -41, -577, 13924, 3834, -822, 71, -10 -dw 5, -41, -580, 13920, 3843, -823, 71, -10 -dw 5, -40, -583, 13915, 3851, -825, 71, -10 -dw 5, -40, -587, 13911, 3859, -826, 72, -10 -dw 5, -39, -590, 13906, 3867, -827, 72, -10 -dw 5, -38, -593, 13902, 3875, -828, 72, -10 -dw 5, -38, -596, 13898, 3883, -830, 72, -10 -dw 5, -37, -599, 13893, 3891, -831, 72, -10 -dw 5, -37, -602, 13889, 3899, -832, 72, -10 -dw 5, -36, -606, 13885, 3907, -833, 72, -10 -dw 5, -35, -609, 13880, 3915, -835, 72, -9 -dw 5, -35, -612, 13876, 3923, -836, 73, -9 -dw 4, -34, -615, 13871, 3931, -837, 73, -9 -dw 4, -34, -618, 13867, 3940, -839, 73, -9 -dw 4, -33, -621, 13862, 3948, -840, 73, -9 -dw 4, -32, -624, 13858, 3956, -841, 73, -9 -dw 4, -32, -627, 13853, 3964, -842, 73, -9 -dw 4, -31, -631, 13849, 3972, -844, 73, -9 -dw 4, -31, -634, 13844, 3980, -845, 74, -9 -dw 4, -30, -637, 13840, 3988, -846, 74, -9 -dw 4, -29, -640, 13835, 3996, -847, 74, -9 -dw 4, -29, -643, 13831, 4005, -849, 74, -9 -dw 4, -28, -646, 13826, 4013, -850, 74, -9 -dw 4, -28, -649, 13822, 4021, -851, 74, -9 -dw 4, -27, -652, 13817, 4029, -853, 74, -9 -dw 4, -27, -655, 13813, 4037, -854, 74, -9 -dw 4, -26, -658, 13808, 4045, -855, 75, -9 -dw 4, -25, -661, 13803, 4054, -856, 75, -9 -dw 4, -25, -664, 13799, 4062, -858, 75, -9 -dw 4, -24, -667, 13794, 4070, -859, 75, -9 -dw 4, -24, -670, 13790, 4078, -860, 75, -9 -dw 4, -23, -673, 13785, 4086, -861, 75, -9 -dw 4, -23, -676, 13780, 4094, -863, 75, -9 -dw 4, -22, -679, 13776, 4103, -864, 76, -9 -dw 4, -21, -682, 13771, 4111, -865, 76, -9 -dw 4, -21, -685, 13766, 4119, -867, 76, -9 -dw 4, -20, -688, 13762, 4127, -868, 76, -9 -dw 4, -20, -691, 13757, 4136, -869, 76, -9 -dw 4, -19, -694, 13752, 4144, -870, 76, -9 -dw 4, -19, -697, 13748, 4152, -872, 76, -9 -dw 4, -18, -700, 13743, 4160, -873, 76, -9 -dw 4, -17, -703, 13738, 4168, -874, 77, -8 -dw 4, -17, -706, 13733, 4177, -875, 77, -8 -dw 4, -16, -709, 13729, 4185, -877, 77, -8 -dw 4, -16, -712, 13724, 4193, -878, 77, -8 -dw 4, -15, -715, 13719, 4201, -879, 77, -8 -dw 4, -15, -717, 13714, 4210, -880, 77, -8 -dw 3, -14, -720, 13710, 4218, -882, 77, -8 -dw 3, -14, -723, 13705, 4226, -883, 78, -8 -dw 3, -13, -726, 13700, 4234, -884, 78, -8 -dw 3, -12, -729, 13695, 4243, -886, 78, -8 -dw 3, -12, -732, 13690, 4251, -887, 78, -8 -dw 3, -11, -735, 13686, 4259, -888, 78, -8 -dw 3, -11, -738, 13681, 4267, -889, 78, -8 -dw 3, -10, -740, 13676, 4276, -891, 78, -8 -dw 3, -10, -743, 13671, 4284, -892, 79, -8 -dw 3, -9, -746, 13666, 4292, -893, 79, -8 -dw 3, -9, -749, 13661, 4301, -894, 79, -8 -dw 3, -8, -752, 13656, 4309, -896, 79, -8 -dw 3, -8, -755, 13651, 4317, -897, 79, -8 -dw 3, -7, -757, 13647, 4326, -898, 79, -8 -dw 3, -6, -760, 13642, 4334, -899, 79, -8 -dw 3, -6, -763, 13637, 4342, -901, 79, -8 -dw 3, -5, -766, 13632, 4350, -902, 80, -8 -dw 3, -5, -769, 13627, 4359, -903, 80, -8 -dw 3, -4, -771, 13622, 4367, -905, 80, -8 -dw 3, -4, -774, 13617, 4375, -906, 80, -8 -dw 3, -3, -777, 13612, 4384, -907, 80, -8 -dw 3, -3, -780, 13607, 4392, -908, 80, -8 -dw 3, -2, -782, 13602, 4400, -910, 80, -8 -dw 3, -2, -785, 13597, 4409, -911, 81, -8 -dw 3, -1, -788, 13592, 4417, -912, 81, -8 -dw 3, -1, -791, 13587, 4426, -913, 81, -8 -dw 3, 0, -793, 13582, 4434, -915, 81, -8 -dw 3, 0, -796, 13577, 4442, -916, 81, -7 -dw 3, 1, -799, 13572, 4451, -917, 81, -7 -dw 3, 2, -801, 13567, 4459, -918, 81, -7 -dw 3, 2, -804, 13562, 4467, -920, 82, -7 -dw 3, 3, -807, 13556, 4476, -921, 82, -7 -dw 3, 3, -810, 13551, 4484, -922, 82, -7 -dw 3, 4, -812, 13546, 4493, -923, 82, -7 -dw 3, 4, -815, 13541, 4501, -925, 82, -7 -dw 3, 5, -818, 13536, 4509, -926, 82, -7 -dw 3, 5, -820, 13531, 4518, -927, 82, -7 -dw 3, 6, -823, 13526, 4526, -928, 82, -7 -dw 3, 6, -825, 13521, 4535, -930, 83, -7 -dw 3, 7, -828, 13515, 4543, -931, 83, -7 -dw 3, 7, -831, 13510, 4551, -932, 83, -7 -dw 3, 8, -833, 13505, 4560, -934, 83, -7 -dw 3, 8, -836, 13500, 4568, -935, 83, -7 -dw 2, 9, -839, 13495, 4577, -936, 83, -7 -dw 2, 9, -841, 13489, 4585, -937, 83, -7 -dw 2, 10, -844, 13484, 4593, -939, 84, -7 -dw 2, 10, -846, 13479, 4602, -940, 84, -7 -dw 2, 11, -849, 13474, 4610, -941, 84, -7 -dw 2, 11, -852, 13469, 4619, -942, 84, -7 -dw 2, 12, -854, 13463, 4627, -944, 84, -7 -dw 2, 12, -857, 13458, 4636, -945, 84, -7 -dw 2, 13, -859, 13453, 4644, -946, 84, -7 -dw 2, 13, -862, 13447, 4653, -947, 84, -7 -dw 2, 14, -864, 13442, 4661, -949, 85, -7 -dw 2, 14, -867, 13437, 4669, -950, 85, -7 -dw 2, 15, -869, 13432, 4678, -951, 85, -7 -dw 2, 15, -872, 13426, 4686, -952, 85, -7 -dw 2, 16, -875, 13421, 4695, -954, 85, -7 -dw 2, 16, -877, 13416, 4703, -955, 85, -7 -dw 2, 17, -880, 13410, 4712, -956, 85, -7 -dw 2, 17, -882, 13405, 4720, -957, 86, -7 -dw 2, 18, -885, 13399, 4729, -959, 86, -7 -dw 2, 18, -887, 13394, 4737, -960, 86, -6 -dw 2, 19, -890, 13389, 4746, -961, 86, -6 -dw 2, 19, -892, 13383, 4754, -962, 86, -6 -dw 2, 19, -894, 13378, 4763, -964, 86, -6 -dw 2, 20, -897, 13372, 4771, -965, 86, -6 -dw 2, 20, -899, 13367, 4780, -966, 87, -6 -dw 2, 21, -902, 13362, 4788, -967, 87, -6 -dw 2, 21, -904, 13356, 4797, -969, 87, -6 -dw 2, 22, -907, 13351, 4805, -970, 87, -6 -dw 2, 22, -909, 13345, 4814, -971, 87, -6 -dw 2, 23, -912, 13340, 4822, -972, 87, -6 -dw 2, 23, -914, 13334, 4831, -973, 87, -6 -dw 2, 24, -916, 13329, 4839, -975, 87, -6 -dw 2, 24, -919, 13323, 4848, -976, 88, -6 -dw 2, 25, -921, 13318, 4857, -977, 88, -6 -dw 2, 25, -924, 13312, 4865, -978, 88, -6 -dw 2, 26, -926, 13307, 4874, -980, 88, -6 -dw 2, 26, -928, 13301, 4882, -981, 88, -6 -dw 2, 26, -931, 13296, 4891, -982, 88, -6 -dw 2, 27, -933, 13290, 4899, -983, 88, -6 -dw 2, 27, -936, 13285, 4908, -985, 89, -6 -dw 2, 28, -938, 13279, 4916, -986, 89, -6 -dw 2, 28, -940, 13273, 4925, -987, 89, -6 -dw 2, 29, -943, 13268, 4934, -988, 89, -6 -dw 2, 29, -945, 13262, 4942, -990, 89, -6 -dw 2, 30, -947, 13257, 4951, -991, 89, -6 -dw 2, 30, -950, 13251, 4959, -992, 89, -6 -dw 2, 31, -952, 13245, 4968, -993, 90, -6 -dw 2, 31, -954, 13240, 4976, -994, 90, -6 -dw 2, 31, -957, 13234, 4985, -996, 90, -6 -dw 2, 32, -959, 13228, 4994, -997, 90, -6 -dw 2, 32, -961, 13223, 5002, -998, 90, -6 -dw 2, 33, -963, 13217, 5011, -999, 90, -6 -dw 2, 33, -966, 13211, 5019, -1001, 90, -6 -dw 2, 34, -968, 13206, 5028, -1002, 90, -6 -dw 1, 34, -970, 13200, 5037, -1003, 91, -6 -dw 1, 35, -972, 13194, 5045, -1004, 91, -6 -dw 1, 35, -975, 13189, 5054, -1006, 91, -6 -dw 1, 35, -977, 13183, 5062, -1007, 91, -5 -dw 1, 36, -979, 13177, 5071, -1008, 91, -5 -dw 1, 36, -981, 13171, 5080, -1009, 91, -5 -dw 1, 37, -984, 13166, 5088, -1010, 91, -5 -dw 1, 37, -986, 13160, 5097, -1012, 92, -5 -dw 1, 38, -988, 13154, 5106, -1013, 92, -5 -dw 1, 38, -990, 13148, 5114, -1014, 92, -5 -dw 1, 39, -993, 13143, 5123, -1015, 92, -5 -dw 1, 39, -995, 13137, 5132, -1017, 92, -5 -dw 1, 39, -997, 13131, 5140, -1018, 92, -5 -dw 1, 40, -999, 13125, 5149, -1019, 92, -5 -dw 1, 40, -1001, 13119, 5157, -1020, 92, -5 -dw 1, 41, -1004, 13113, 5166, -1021, 93, -5 -dw 1, 41, -1006, 13108, 5175, -1023, 93, -5 -dw 1, 41, -1008, 13102, 5183, -1024, 93, -5 -dw 1, 42, -1010, 13096, 5192, -1025, 93, -5 -dw 1, 42, -1012, 13090, 5201, -1026, 93, -5 -dw 1, 43, -1014, 13084, 5209, -1027, 93, -5 -dw 1, 43, -1016, 13078, 5218, -1029, 93, -5 -dw 1, 44, -1019, 13072, 5227, -1030, 94, -5 -dw 1, 44, -1021, 13067, 5235, -1031, 94, -5 -dw 1, 44, -1023, 13061, 5244, -1032, 94, -5 -dw 1, 45, -1025, 13055, 5253, -1034, 94, -5 -dw 1, 45, -1027, 13049, 5262, -1035, 94, -5 -dw 1, 46, -1029, 13043, 5270, -1036, 94, -5 -dw 1, 46, -1031, 13037, 5279, -1037, 94, -5 -dw 1, 46, -1033, 13031, 5288, -1038, 94, -5 -dw 1, 47, -1035, 13025, 5296, -1040, 95, -5 -dw 1, 47, -1037, 13019, 5305, -1041, 95, -5 -dw 1, 48, -1040, 13013, 5314, -1042, 95, -5 -dw 1, 48, -1042, 13007, 5322, -1043, 95, -5 -dw 1, 48, -1044, 13001, 5331, -1044, 95, -5 -dw 1, 49, -1046, 12995, 5340, -1046, 95, -5 -dw 1, 49, -1048, 12989, 5349, -1047, 95, -5 -dw 1, 50, -1050, 12983, 5357, -1048, 96, -5 -dw 1, 50, -1052, 12977, 5366, -1049, 96, -5 -dw 1, 50, -1054, 12971, 5375, -1050, 96, -5 -dw 1, 51, -1056, 12965, 5383, -1052, 96, -5 -dw 1, 51, -1058, 12959, 5392, -1053, 96, -5 -dw 1, 52, -1060, 12953, 5401, -1054, 96, -5 -dw 1, 52, -1062, 12947, 5410, -1055, 96, -5 -dw 1, 52, -1064, 12941, 5418, -1056, 96, -5 -dw 1, 53, -1066, 12934, 5427, -1058, 97, -4 -dw 1, 53, -1068, 12928, 5436, -1059, 97, -4 -dw 1, 54, -1070, 12922, 5445, -1060, 97, -4 -dw 1, 54, -1072, 12916, 5453, -1061, 97, -4 -dw 1, 54, -1074, 12910, 5462, -1062, 97, -4 -dw 1, 55, -1076, 12904, 5471, -1063, 97, -4 -dw 1, 55, -1078, 12898, 5480, -1065, 97, -4 -dw 1, 56, -1080, 12892, 5488, -1066, 98, -4 -dw 1, 56, -1082, 12885, 5497, -1067, 98, -4 -dw 1, 56, -1084, 12879, 5506, -1068, 98, -4 -dw 1, 57, -1085, 12873, 5515, -1069, 98, -4 -dw 1, 57, -1087, 12867, 5523, -1071, 98, -4 -dw 1, 57, -1089, 12861, 5532, -1072, 98, -4 -dw 1, 58, -1091, 12855, 5541, -1073, 98, -4 -dw 1, 58, -1093, 12848, 5550, -1074, 98, -4 -dw 1, 59, -1095, 12842, 5559, -1075, 99, -4 -dw 1, 59, -1097, 12836, 5567, -1076, 99, -4 -dw 1, 59, -1099, 12830, 5576, -1078, 99, -4 -dw 1, 60, -1101, 12823, 5585, -1079, 99, -4 -dw 1, 60, -1103, 12817, 5594, -1080, 99, -4 -dw 1, 60, -1104, 12811, 5602, -1081, 99, -4 -dw 1, 61, -1106, 12805, 5611, -1082, 99, -4 -dw 1, 61, -1108, 12798, 5620, -1084, 99, -4 -dw 1, 62, -1110, 12792, 5629, -1085, 100, -4 -dw 1, 62, -1112, 12786, 5638, -1086, 100, -4 -dw 1, 62, -1114, 12780, 5646, -1087, 100, -4 -dw 1, 63, -1116, 12773, 5655, -1088, 100, -4 -dw 1, 63, -1117, 12767, 5664, -1089, 100, -4 -dw 1, 63, -1119, 12761, 5673, -1091, 100, -4 -dw 1, 64, -1121, 12754, 5682, -1092, 100, -4 -dw 1, 64, -1123, 12748, 5691, -1093, 100, -4 -dw 1, 64, -1125, 12742, 5699, -1094, 101, -4 -dw 1, 65, -1126, 12735, 5708, -1095, 101, -4 -dw 1, 65, -1128, 12729, 5717, -1096, 101, -4 -dw 1, 66, -1130, 12722, 5726, -1097, 101, -4 -dw 1, 66, -1132, 12716, 5735, -1099, 101, -4 -dw 1, 66, -1134, 12710, 5743, -1100, 101, -4 -dw 0, 67, -1135, 12703, 5752, -1101, 101, -4 -dw 0, 67, -1137, 12697, 5761, -1102, 102, -4 -dw 0, 67, -1139, 12690, 5770, -1103, 102, -4 -dw 0, 68, -1141, 12684, 5779, -1104, 102, -4 -dw 0, 68, -1142, 12678, 5788, -1106, 102, -4 -dw 0, 68, -1144, 12671, 5796, -1107, 102, -4 -dw 0, 69, -1146, 12665, 5805, -1108, 102, -4 -dw 0, 69, -1148, 12658, 5814, -1109, 102, -4 -dw 0, 69, -1149, 12652, 5823, -1110, 102, -4 -dw 0, 70, -1151, 12645, 5832, -1111, 103, -4 -dw 0, 70, -1153, 12639, 5841, -1112, 103, -3 -dw 0, 70, -1154, 12632, 5850, -1114, 103, -3 -dw 0, 71, -1156, 12626, 5858, -1115, 103, -3 -dw 0, 71, -1158, 12619, 5867, -1116, 103, -3 -dw 0, 71, -1159, 12613, 5876, -1117, 103, -3 -dw 0, 72, -1161, 12606, 5885, -1118, 103, -3 -dw 0, 72, -1163, 12600, 5894, -1119, 103, -3 -dw 0, 72, -1165, 12593, 5903, -1120, 104, -3 -dw 0, 73, -1166, 12587, 5912, -1122, 104, -3 -dw 0, 73, -1168, 12580, 5921, -1123, 104, -3 -dw 0, 73, -1169, 12574, 5929, -1124, 104, -3 -dw 0, 74, -1171, 12567, 5938, -1125, 104, -3 -dw 0, 74, -1173, 12560, 5947, -1126, 104, -3 -dw 0, 74, -1174, 12554, 5956, -1127, 104, -3 -dw 0, 75, -1176, 12547, 5965, -1128, 104, -3 -dw 0, 75, -1178, 12541, 5974, -1130, 105, -3 -dw 0, 75, -1179, 12534, 5983, -1131, 105, -3 -dw 0, 76, -1181, 12528, 5992, -1132, 105, -3 -dw 0, 76, -1182, 12521, 6000, -1133, 105, -3 -dw 0, 76, -1184, 12514, 6009, -1134, 105, -3 -dw 0, 77, -1186, 12508, 6018, -1135, 105, -3 -dw 0, 77, -1187, 12501, 6027, -1136, 105, -3 -dw 0, 77, -1189, 12494, 6036, -1137, 105, -3 -dw 0, 78, -1190, 12488, 6045, -1138, 106, -3 -dw 0, 78, -1192, 12481, 6054, -1140, 106, -3 -dw 0, 78, -1194, 12474, 6063, -1141, 106, -3 -dw 0, 78, -1195, 12468, 6072, -1142, 106, -3 -dw 0, 79, -1197, 12461, 6081, -1143, 106, -3 -dw 0, 79, -1198, 12454, 6089, -1144, 106, -3 -dw 0, 79, -1200, 12448, 6098, -1145, 106, -3 -dw 0, 80, -1201, 12441, 6107, -1146, 106, -3 -dw 0, 80, -1203, 12434, 6116, -1147, 107, -3 -dw 0, 80, -1204, 12427, 6125, -1148, 107, -3 -dw 0, 81, -1206, 12421, 6134, -1150, 107, -3 -dw 0, 81, -1207, 12414, 6143, -1151, 107, -3 -dw 0, 81, -1209, 12407, 6152, -1152, 107, -3 -dw 0, 82, -1210, 12400, 6161, -1153, 107, -3 -dw 0, 82, -1212, 12394, 6170, -1154, 107, -3 -dw 0, 82, -1213, 12387, 6179, -1155, 107, -3 -dw 0, 82, -1215, 12380, 6188, -1156, 108, -3 -dw 0, 83, -1216, 12373, 6197, -1157, 108, -3 -dw 0, 83, -1218, 12367, 6205, -1158, 108, -3 -dw 0, 83, -1219, 12360, 6214, -1159, 108, -3 -dw 0, 84, -1221, 12353, 6223, -1161, 108, -3 -dw 0, 84, -1222, 12346, 6232, -1162, 108, -3 -dw 0, 84, -1224, 12339, 6241, -1163, 108, -3 -dw 0, 85, -1225, 12332, 6250, -1164, 108, -3 -dw 0, 85, -1227, 12326, 6259, -1165, 109, -3 -dw 0, 85, -1228, 12319, 6268, -1166, 109, -3 -dw 0, 85, -1229, 12312, 6277, -1167, 109, -3 -dw 0, 86, -1231, 12305, 6286, -1168, 109, -3 -dw 0, 86, -1232, 12298, 6295, -1169, 109, -3 -dw 0, 86, -1234, 12291, 6304, -1170, 109, -3 -dw 0, 87, -1235, 12284, 6313, -1171, 109, -3 -dw 0, 87, -1236, 12277, 6322, -1173, 109, -3 -dw 0, 87, -1238, 12271, 6331, -1174, 109, -2 -dw 0, 87, -1239, 12264, 6340, -1175, 110, -2 -dw 0, 88, -1241, 12257, 6349, -1176, 110, -2 -dw 0, 88, -1242, 12250, 6358, -1177, 110, -2 -dw 0, 88, -1243, 12243, 6367, -1178, 110, -2 -dw 0, 89, -1245, 12236, 6376, -1179, 110, -2 -dw 0, 89, -1246, 12229, 6385, -1180, 110, -2 -dw 0, 89, -1247, 12222, 6393, -1181, 110, -2 -dw 0, 89, -1249, 12215, 6402, -1182, 110, -2 -dw 0, 90, -1250, 12208, 6411, -1183, 111, -2 -dw 0, 90, -1252, 12201, 6420, -1184, 111, -2 -dw 0, 90, -1253, 12194, 6429, -1185, 111, -2 -dw 0, 90, -1254, 12187, 6438, -1186, 111, -2 -dw 0, 91, -1255, 12180, 6447, -1187, 111, -2 -dw 0, 91, -1257, 12173, 6456, -1188, 111, -2 -dw 0, 91, -1258, 12166, 6465, -1190, 111, -2 -dw 0, 92, -1259, 12159, 6474, -1191, 111, -2 -dw 0, 92, -1261, 12152, 6483, -1192, 111, -2 -dw 0, 92, -1262, 12145, 6492, -1193, 112, -2 -dw 0, 92, -1263, 12138, 6501, -1194, 112, -2 -dw 0, 93, -1265, 12131, 6510, -1195, 112, -2 -dw 0, 93, -1266, 12124, 6519, -1196, 112, -2 -dw 0, 93, -1267, 12117, 6528, -1197, 112, -2 -dw 0, 93, -1268, 12110, 6537, -1198, 112, -2 -dw 0, 94, -1270, 12103, 6546, -1199, 112, -2 -dw 0, 94, -1271, 12096, 6555, -1200, 112, -2 -dw 0, 94, -1272, 12089, 6564, -1201, 113, -2 -dw 0, 94, -1273, 12082, 6573, -1202, 113, -2 -dw 0, 95, -1275, 12074, 6582, -1203, 113, -2 -dw 0, 95, -1276, 12067, 6591, -1204, 113, -2 -dw 0, 95, -1277, 12060, 6600, -1205, 113, -2 -dw 0, 95, -1278, 12053, 6609, -1206, 113, -2 -dw 0, 96, -1280, 12046, 6618, -1207, 113, -2 -dw 0, 96, -1281, 12039, 6627, -1208, 113, -2 -dw 0, 96, -1282, 12032, 6636, -1209, 113, -2 -dw 0, 96, -1283, 12024, 6645, -1210, 114, -2 -dw 0, 97, -1284, 12017, 6654, -1211, 114, -2 -dw 0, 97, -1286, 12010, 6663, -1212, 114, -2 -dw 0, 97, -1287, 12003, 6672, -1213, 114, -2 -dw 0, 97, -1288, 11996, 6681, -1214, 114, -2 -dw 0, 98, -1289, 11989, 6690, -1215, 114, -2 -dw 0, 98, -1290, 11981, 6699, -1216, 114, -2 -dw 0, 98, -1291, 11974, 6708, -1217, 114, -2 -dw 0, 98, -1293, 11967, 6717, -1218, 114, -2 -dw 0, 99, -1294, 11960, 6726, -1219, 115, -2 -dw 0, 99, -1295, 11953, 6735, -1220, 115, -2 -dw 0, 99, -1296, 11945, 6744, -1221, 115, -2 -dw 0, 99, -1297, 11938, 6753, -1222, 115, -2 -dw 0, 100, -1298, 11931, 6762, -1223, 115, -2 -dw 0, 100, -1299, 11924, 6771, -1224, 115, -2 -dw 0, 100, -1301, 11916, 6780, -1225, 115, -2 -dw 0, 100, -1302, 11909, 6789, -1226, 115, -2 -dw 0, 101, -1303, 11902, 6798, -1227, 115, -2 -dw 0, 101, -1304, 11895, 6807, -1228, 116, -2 -dw 0, 101, -1305, 11887, 6816, -1229, 116, -2 -dw 0, 101, -1306, 11880, 6825, -1230, 116, -2 -dw 0, 101, -1307, 11873, 6834, -1231, 116, -2 -dw 0, 102, -1308, 11865, 6843, -1232, 116, -2 -dw 0, 102, -1309, 11858, 6852, -1233, 116, -2 -dw 0, 102, -1310, 11851, 6862, -1234, 116, -2 -dw 0, 102, -1312, 11843, 6871, -1235, 116, -2 -dw 0, 103, -1313, 11836, 6880, -1236, 116, -2 -dw 0, 103, -1314, 11829, 6889, -1237, 116, -2 -dw 0, 103, -1315, 11821, 6898, -1238, 117, -2 -dw 0, 103, -1316, 11814, 6907, -1239, 117, -2 -dw 0, 103, -1317, 11807, 6916, -1240, 117, -2 -dw 0, 104, -1318, 11799, 6925, -1241, 117, -2 -dw 0, 104, -1319, 11792, 6934, -1242, 117, -2 -dw 0, 104, -1320, 11785, 6943, -1243, 117, -2 -dw 0, 104, -1321, 11777, 6952, -1244, 117, -2 -dw 0, 105, -1322, 11770, 6961, -1245, 117, -1 -dw 0, 105, -1323, 11762, 6970, -1246, 117, -1 -dw 0, 105, -1324, 11755, 6979, -1247, 118, -1 -dw 0, 105, -1325, 11748, 6988, -1248, 118, -1 -dw 0, 105, -1326, 11740, 6997, -1249, 118, -1 -dw 0, 106, -1327, 11733, 7006, -1250, 118, -1 -dw 0, 106, -1328, 11725, 7015, -1251, 118, -1 -dw 0, 106, -1329, 11718, 7024, -1252, 118, -1 -dw 0, 106, -1330, 11711, 7033, -1253, 118, -1 -dw 0, 106, -1331, 11703, 7042, -1254, 118, -1 -dw 0, 107, -1332, 11696, 7051, -1255, 118, -1 -dw 0, 107, -1333, 11688, 7060, -1256, 118, -1 -dw 0, 107, -1334, 11681, 7069, -1257, 119, -1 -dw 0, 107, -1335, 11673, 7078, -1257, 119, -1 -dw 0, 107, -1336, 11666, 7087, -1258, 119, -1 -dw 0, 108, -1337, 11658, 7096, -1259, 119, -1 -dw 0, 108, -1337, 11651, 7106, -1260, 119, -1 -dw 0, 108, -1338, 11643, 7115, -1261, 119, -1 -dw 0, 108, -1339, 11636, 7124, -1262, 119, -1 -dw 0, 108, -1340, 11628, 7133, -1263, 119, -1 -dw 0, 109, -1341, 11621, 7142, -1264, 119, -1 -dw 0, 109, -1342, 11613, 7151, -1265, 120, -1 -dw 0, 109, -1343, 11606, 7160, -1266, 120, -1 -dw 0, 109, -1344, 11598, 7169, -1267, 120, -1 -dw 0, 109, -1345, 11591, 7178, -1268, 120, -1 -dw 0, 110, -1346, 11583, 7187, -1269, 120, -1 -dw 0, 110, -1347, 11576, 7196, -1269, 120, -1 -dw 0, 110, -1347, 11568, 7205, -1270, 120, -1 -dw 0, 110, -1348, 11560, 7214, -1271, 120, -1 -dw 0, 110, -1349, 11553, 7223, -1272, 120, -1 -dw 0, 111, -1350, 11545, 7232, -1273, 120, -1 -dw 0, 111, -1351, 11538, 7241, -1274, 120, -1 -dw 0, 111, -1352, 11530, 7250, -1275, 121, -1 -dw 0, 111, -1353, 11522, 7259, -1276, 121, -1 -dw 0, 111, -1353, 11515, 7268, -1277, 121, -1 -dw 0, 112, -1354, 11507, 7277, -1278, 121, -1 -dw 0, 112, -1355, 11500, 7287, -1279, 121, -1 -dw 0, 112, -1356, 11492, 7296, -1279, 121, -1 -dw 0, 112, -1357, 11484, 7305, -1280, 121, -1 -dw 0, 112, -1358, 11477, 7314, -1281, 121, -1 -dw 0, 112, -1358, 11469, 7323, -1282, 121, -1 -dw 0, 113, -1359, 11461, 7332, -1283, 121, -1 -dw 0, 113, -1360, 11454, 7341, -1284, 122, -1 -dw 0, 113, -1361, 11446, 7350, -1285, 122, -1 -dw 0, 113, -1362, 11438, 7359, -1286, 122, -1 -dw 0, 113, -1362, 11431, 7368, -1287, 122, -1 -dw 0, 114, -1363, 11423, 7377, -1287, 122, -1 -dw 0, 114, -1364, 11415, 7386, -1288, 122, -1 -dw 0, 114, -1365, 11408, 7395, -1289, 122, -1 -dw 0, 114, -1365, 11400, 7404, -1290, 122, -1 -dw 0, 114, -1366, 11392, 7413, -1291, 122, -1 -dw 0, 114, -1367, 11385, 7422, -1292, 122, -1 -dw 0, 115, -1368, 11377, 7431, -1293, 122, -1 -dw 0, 115, -1368, 11369, 7440, -1293, 123, -1 -dw 0, 115, -1369, 11362, 7450, -1294, 123, -1 -dw 0, 115, -1370, 11354, 7459, -1295, 123, -1 -dw 0, 115, -1371, 11346, 7468, -1296, 123, -1 -dw 0, 115, -1371, 11338, 7477, -1297, 123, -1 -dw 0, 116, -1372, 11331, 7486, -1298, 123, -1 -dw 0, 116, -1373, 11323, 7495, -1299, 123, -1 -dw 0, 116, -1374, 11315, 7504, -1299, 123, -1 -dw 0, 116, -1374, 11307, 7513, -1300, 123, -1 -dw 0, 116, -1375, 11300, 7522, -1301, 123, -1 -dw 0, 116, -1376, 11292, 7531, -1302, 123, -1 -dw 0, 117, -1376, 11284, 7540, -1303, 124, -1 -dw 0, 117, -1377, 11276, 7549, -1304, 124, -1 -dw 0, 117, -1378, 11268, 7558, -1304, 124, -1 -dw 0, 117, -1378, 11261, 7567, -1305, 124, -1 -dw 0, 117, -1379, 11253, 7576, -1306, 124, -1 -dw 0, 117, -1380, 11245, 7585, -1307, 124, -1 -dw 0, 117, -1380, 11237, 7594, -1308, 124, -1 -dw 0, 118, -1381, 11229, 7603, -1309, 124, -1 -dw 0, 118, -1382, 11221, 7613, -1309, 124, -1 -dw 0, 118, -1382, 11214, 7622, -1310, 124, -1 -dw 0, 118, -1383, 11206, 7631, -1311, 124, -1 -dw 0, 118, -1384, 11198, 7640, -1312, 124, -1 -dw 0, 118, -1384, 11190, 7649, -1313, 125, -1 -dw 0, 119, -1385, 11182, 7658, -1313, 125, -1 -dw 0, 119, -1386, 11174, 7667, -1314, 125, -1 -dw 0, 119, -1386, 11167, 7676, -1315, 125, -1 -dw 0, 119, -1387, 11159, 7685, -1316, 125, -1 -dw 0, 119, -1387, 11151, 7694, -1317, 125, -1 -dw 0, 119, -1388, 11143, 7703, -1317, 125, -1 -dw 0, 119, -1389, 11135, 7712, -1318, 125, -1 -dw 0, 120, -1389, 11127, 7721, -1319, 125, -1 -dw 0, 120, -1390, 11119, 7730, -1320, 125, -1 -dw 0, 120, -1390, 11111, 7739, -1321, 125, -1 -dw 0, 120, -1391, 11103, 7748, -1321, 125, -1 -dw 0, 120, -1392, 11095, 7757, -1322, 126, -1 -dw 0, 120, -1392, 11088, 7766, -1323, 126, -1 -dw 0, 120, -1393, 11080, 7775, -1324, 126, -1 -dw 0, 121, -1393, 11072, 7785, -1325, 126, -1 -dw 0, 121, -1394, 11064, 7794, -1325, 126, -1 -dw 0, 121, -1394, 11056, 7803, -1326, 126, -1 -dw 0, 121, -1395, 11048, 7812, -1327, 126, -1 -dw 0, 121, -1395, 11040, 7821, -1328, 126, -1 -dw 0, 121, -1396, 11032, 7830, -1328, 126, -1 -dw 0, 121, -1397, 11024, 7839, -1329, 126, -1 -dw 0, 121, -1397, 11016, 7848, -1330, 126, -1 -dw 0, 122, -1398, 11008, 7857, -1331, 126, -1 -dw 0, 122, -1398, 11000, 7866, -1331, 126, -1 -dw 0, 122, -1399, 10992, 7875, -1332, 127, -1 -dw 0, 122, -1399, 10984, 7884, -1333, 127, -1 -dw 0, 122, -1400, 10976, 7893, -1334, 127, -1 -dw 0, 122, -1400, 10968, 7902, -1334, 127, -1 -dw 0, 122, -1401, 10960, 7911, -1335, 127, -1 -dw 0, 122, -1401, 10952, 7920, -1336, 127, -1 -dw 0, 123, -1402, 10944, 7929, -1337, 127, 0 -dw 0, 123, -1402, 10936, 7938, -1337, 127, 0 -dw 0, 123, -1403, 10928, 7947, -1338, 127, 0 -dw 0, 123, -1403, 10920, 7956, -1339, 127, 0 -dw 0, 123, -1404, 10912, 7965, -1340, 127, 0 -dw 0, 123, -1404, 10904, 7974, -1340, 127, 0 -dw 0, 123, -1404, 10896, 7983, -1341, 127, 0 -dw 0, 123, -1405, 10888, 7992, -1342, 128, 0 -dw 0, 124, -1405, 10880, 8002, -1342, 128, 0 -dw 0, 124, -1406, 10872, 8011, -1343, 128, 0 -dw 0, 124, -1406, 10864, 8020, -1344, 128, 0 -dw 0, 124, -1407, 10856, 8029, -1345, 128, 0 -dw 0, 124, -1407, 10847, 8038, -1345, 128, 0 -dw 0, 124, -1408, 10839, 8047, -1346, 128, 0 -dw 0, 124, -1408, 10831, 8056, -1347, 128, 0 -dw 0, 124, -1408, 10823, 8065, -1347, 128, 0 -dw 0, 125, -1409, 10815, 8074, -1348, 128, 0 -dw 0, 125, -1409, 10807, 8083, -1349, 128, 0 -dw 0, 125, -1410, 10799, 8092, -1349, 128, 0 -dw 0, 125, -1410, 10791, 8101, -1350, 128, 0 -dw 0, 125, -1411, 10783, 8110, -1351, 128, 0 -dw 0, 125, -1411, 10774, 8119, -1352, 128, 0 -dw 0, 125, -1411, 10766, 8128, -1352, 129, 0 -dw 0, 125, -1412, 10758, 8137, -1353, 129, 0 -dw 0, 125, -1412, 10750, 8146, -1354, 129, 0 -dw 0, 125, -1412, 10742, 8155, -1354, 129, 0 -dw 0, 126, -1413, 10734, 8164, -1355, 129, 0 -dw 0, 126, -1413, 10726, 8173, -1356, 129, 0 -dw 0, 126, -1414, 10717, 8182, -1356, 129, 0 -dw 0, 126, -1414, 10709, 8191, -1357, 129, 0 -dw 0, 126, -1414, 10701, 8200, -1358, 129, 0 -dw 0, 126, -1415, 10693, 8209, -1358, 129, 0 -dw 0, 126, -1415, 10685, 8218, -1359, 129, 0 -dw 0, 126, -1415, 10677, 8227, -1360, 129, 0 -dw 0, 126, -1416, 10668, 8236, -1360, 129, 0 -dw 0, 126, -1416, 10660, 8245, -1361, 129, 0 -dw 0, 127, -1416, 10652, 8254, -1361, 129, 0 -dw 0, 127, -1417, 10644, 8263, -1362, 129, 0 -dw 0, 127, -1417, 10636, 8272, -1363, 130, 0 -dw 0, 127, -1417, 10627, 8281, -1363, 130, 0 -dw 0, 127, -1418, 10619, 8290, -1364, 130, 0 -dw 0, 127, -1418, 10611, 8299, -1365, 130, 0 -dw 0, 127, -1418, 10603, 8308, -1365, 130, 0 -dw 0, 127, -1418, 10595, 8317, -1366, 130, 0 -dw 0, 127, -1419, 10586, 8326, -1367, 130, 0 -dw 0, 127, -1419, 10578, 8335, -1367, 130, 0 -dw 0, 128, -1419, 10570, 8344, -1368, 130, 0 -dw 0, 128, -1420, 10562, 8353, -1368, 130, 0 -dw 0, 128, -1420, 10553, 8362, -1369, 130, 0 -dw 0, 128, -1420, 10545, 8371, -1370, 130, 0 -dw 0, 128, -1420, 10537, 8380, -1370, 130, 0 -dw 0, 128, -1421, 10528, 8389, -1371, 130, 0 -dw 0, 128, -1421, 10520, 8398, -1371, 130, 0 -dw 0, 128, -1421, 10512, 8407, -1372, 130, 0 -dw 0, 128, -1421, 10504, 8416, -1373, 130, 0 -dw 0, 128, -1422, 10495, 8425, -1373, 131, 0 -dw 0, 128, -1422, 10487, 8434, -1374, 131, 0 -dw 0, 128, -1422, 10479, 8443, -1374, 131, 0 -dw 0, 129, -1422, 10470, 8452, -1375, 131, 0 -dw 0, 129, -1423, 10462, 8461, -1376, 131, 0 -dw 0, 129, -1423, 10454, 8470, -1376, 131, 0 -dw 0, 129, -1423, 10446, 8479, -1377, 131, 0 -dw 0, 129, -1423, 10437, 8488, -1377, 131, 0 -dw 0, 129, -1424, 10429, 8497, -1378, 131, 0 -dw 0, 129, -1424, 10421, 8506, -1378, 131, 0 -dw 0, 129, -1424, 10412, 8515, -1379, 131, 0 -dw 0, 129, -1424, 10404, 8524, -1380, 131, 0 -dw 0, 129, -1424, 10396, 8533, -1380, 131, 0 -dw 0, 129, -1425, 10387, 8542, -1381, 131, 0 -dw 0, 129, -1425, 10379, 8551, -1381, 131, 0 -dw 0, 129, -1425, 10371, 8560, -1382, 131, 0 -dw 0, 130, -1425, 10362, 8569, -1382, 131, 0 -dw 0, 130, -1425, 10354, 8578, -1383, 131, 0 -dw 0, 130, -1425, 10345, 8587, -1383, 131, 0 -dw 0, 130, -1426, 10337, 8596, -1384, 131, 0 -dw 0, 130, -1426, 10329, 8605, -1385, 131, 0 -dw 0, 130, -1426, 10320, 8613, -1385, 132, 0 -dw 0, 130, -1426, 10312, 8622, -1386, 132, 0 -dw 0, 130, -1426, 10304, 8631, -1386, 132, 0 -dw 0, 130, -1426, 10295, 8640, -1387, 132, 0 -dw 0, 130, -1427, 10287, 8649, -1387, 132, 0 -dw 0, 130, -1427, 10278, 8658, -1388, 132, 0 -dw 0, 130, -1427, 10270, 8667, -1388, 132, 0 -dw 0, 130, -1427, 10262, 8676, -1389, 132, 0 -dw 0, 130, -1427, 10253, 8685, -1389, 132, 0 -dw 0, 130, -1427, 10245, 8694, -1390, 132, 0 -dw 0, 131, -1427, 10236, 8703, -1390, 132, 0 -dw 0, 131, -1427, 10228, 8712, -1391, 132, 0 -dw 0, 131, -1428, 10220, 8721, -1391, 132, 0 -dw 0, 131, -1428, 10211, 8730, -1392, 132, 0 -dw 0, 131, -1428, 10203, 8739, -1392, 132, 0 -dw 0, 131, -1428, 10194, 8748, -1393, 132, 0 -dw 0, 131, -1428, 10186, 8756, -1393, 132, 0 -dw 0, 131, -1428, 10177, 8765, -1394, 132, 0 -dw 0, 131, -1428, 10169, 8774, -1394, 132, 0 -dw 0, 131, -1428, 10160, 8783, -1395, 132, 0 -dw 0, 131, -1428, 10152, 8792, -1395, 132, 0 -dw 0, 131, -1428, 10143, 8801, -1396, 132, 0 -dw 0, 131, -1428, 10135, 8810, -1396, 132, 0 -dw 0, 131, -1428, 10127, 8819, -1397, 132, 0 -dw 0, 131, -1429, 10118, 8828, -1397, 132, 0 -dw 0, 131, -1429, 10110, 8837, -1397, 132, 0 -dw 0, 131, -1429, 10101, 8846, -1398, 132, 0 -dw 0, 131, -1429, 10093, 8855, -1398, 133, 0 -dw 0, 132, -1429, 10084, 8863, -1399, 133, 0 -dw 0, 132, -1429, 10076, 8872, -1399, 133, 0 -dw 0, 132, -1429, 10067, 8881, -1400, 133, 0 -dw 0, 132, -1429, 10059, 8890, -1400, 133, 0 -dw 0, 132, -1429, 10050, 8899, -1401, 133, 0 -dw 0, 132, -1429, 10042, 8908, -1401, 133, 0 -dw 0, 132, -1429, 10033, 8917, -1401, 133, 0 -dw 0, 132, -1429, 10025, 8926, -1402, 133, 0 -dw 0, 132, -1429, 10016, 8935, -1402, 133, 0 -dw 0, 132, -1429, 10008, 8944, -1403, 133, 0 -dw 0, 132, -1429, 9999, 8952, -1403, 133, 0 -dw 0, 132, -1429, 9990, 8961, -1404, 133, 0 -dw 0, 132, -1429, 9982, 8970, -1404, 133, 0 -dw 0, 132, -1429, 9973, 8979, -1404, 133, 0 -dw 0, 132, -1429, 9965, 8988, -1405, 133, 0 -dw 0, 132, -1429, 9956, 8997, -1405, 133, 0 -dw 0, 132, -1429, 9948, 9006, -1406, 133, 0 -dw 0, 132, -1429, 9939, 9015, -1406, 133, 0 -dw 0, 132, -1429, 9931, 9023, -1406, 133, 0 -dw 0, 132, -1429, 9922, 9032, -1407, 133, 0 -dw 0, 132, -1429, 9914, 9041, -1407, 133, 0 -dw 0, 132, -1429, 9905, 9050, -1408, 133, 0 -dw 0, 132, -1429, 9896, 9059, -1408, 133, 0 -dw 0, 132, -1429, 9888, 9068, -1408, 133, 0 -dw 0, 133, -1429, 9879, 9077, -1409, 133, 0 -dw 0, 133, -1429, 9871, 9085, -1409, 133, 0 -dw 0, 133, -1429, 9862, 9094, -1409, 133, 0 -dw 0, 133, -1428, 9853, 9103, -1410, 133, 0 -dw 0, 133, -1428, 9845, 9112, -1410, 133, 0 -dw 0, 133, -1428, 9836, 9121, -1411, 133, 0 -dw 0, 133, -1428, 9828, 9130, -1411, 133, 0 -dw 0, 133, -1428, 9819, 9138, -1411, 133, 0 -dw 0, 133, -1428, 9810, 9147, -1412, 133, 0 -dw 0, 133, -1428, 9802, 9156, -1412, 133, 0 -dw 0, 133, -1428, 9793, 9165, -1412, 133, 0 -dw 0, 133, -1428, 9785, 9174, -1413, 133, 0 -dw 0, 133, -1428, 9776, 9183, -1413, 133, 0 -dw 0, 133, -1428, 9767, 9191, -1413, 133, 0 -dw 0, 133, -1428, 9759, 9200, -1414, 133, 0 -dw 0, 133, -1427, 9750, 9209, -1414, 133, 0 -dw 0, 133, -1427, 9741, 9218, -1414, 133, 0 -dw 0, 133, -1427, 9733, 9227, -1415, 133, 0 -dw 0, 133, -1427, 9724, 9235, -1415, 133, 0 -dw 0, 133, -1427, 9716, 9244, -1415, 133, 0 -dw 0, 133, -1427, 9707, 9253, -1416, 133, 0 -dw 0, 133, -1427, 9698, 9262, -1416, 133, 0 -dw 0, 133, -1427, 9690, 9271, -1416, 133, 0 -dw 0, 133, -1426, 9681, 9279, -1416, 133, 0 -dw 0, 133, -1426, 9672, 9288, -1417, 133, 0 -dw 0, 133, -1426, 9664, 9297, -1417, 133, 0 -dw 0, 133, -1426, 9655, 9306, -1417, 133, 0 -dw 0, 133, -1426, 9646, 9315, -1418, 133, 0 -dw 0, 133, -1426, 9638, 9323, -1418, 133, 0 -dw 0, 133, -1426, 9629, 9332, -1418, 133, 0 -dw 0, 133, -1425, 9620, 9341, -1418, 133, 0 -dw 0, 133, -1425, 9612, 9350, -1419, 133, 0 -dw 0, 133, -1425, 9603, 9358, -1419, 133, 0 -dw 0, 133, -1425, 9594, 9367, -1419, 133, 0 -dw 0, 133, -1425, 9586, 9376, -1420, 133, 0 -dw 0, 133, -1425, 9577, 9385, -1420, 133, 0 -dw 0, 133, -1424, 9568, 9394, -1420, 133, 0 -dw 0, 133, -1424, 9559, 9402, -1420, 133, 0 -dw 0, 133, -1424, 9551, 9411, -1421, 133, 0 -dw 0, 133, -1424, 9542, 9420, -1421, 133, 0 -dw 0, 133, -1424, 9533, 9429, -1421, 133, 0 -dw 0, 133, -1423, 9525, 9437, -1421, 133, 0 -dw 0, 133, -1423, 9516, 9446, -1421, 133, 0 -dw 0, 133, -1423, 9507, 9455, -1422, 133, 0 -dw 0, 133, -1423, 9498, 9464, -1422, 133, 0 -dw 0, 133, -1423, 9490, 9472, -1422, 133, 0 -dw 0, 133, -1422, 9481, 9481, -1422, 133, 0 -dw 0, 133, -1422, 9472, 9490, -1423, 133, 0 -dw 0, 133, -1422, 9464, 9498, -1423, 133, 0 -dw 0, 133, -1422, 9455, 9507, -1423, 133, 0 -dw 0, 133, -1421, 9446, 9516, -1423, 133, 0 -dw 0, 133, -1421, 9437, 9525, -1423, 133, 0 -dw 0, 133, -1421, 9429, 9533, -1424, 133, 0 -dw 0, 133, -1421, 9420, 9542, -1424, 133, 0 -dw 0, 133, -1421, 9411, 9551, -1424, 133, 0 -dw 0, 133, -1420, 9402, 9559, -1424, 133, 0 -dw 0, 133, -1420, 9394, 9568, -1424, 133, 0 -dw 0, 133, -1420, 9385, 9577, -1425, 133, 0 -dw 0, 133, -1420, 9376, 9586, -1425, 133, 0 -dw 0, 133, -1419, 9367, 9594, -1425, 133, 0 -dw 0, 133, -1419, 9358, 9603, -1425, 133, 0 -dw 0, 133, -1419, 9350, 9612, -1425, 133, 0 -dw 0, 133, -1418, 9341, 9620, -1425, 133, 0 -dw 0, 133, -1418, 9332, 9629, -1426, 133, 0 -dw 0, 133, -1418, 9323, 9638, -1426, 133, 0 -dw 0, 133, -1418, 9315, 9646, -1426, 133, 0 -dw 0, 133, -1417, 9306, 9655, -1426, 133, 0 -dw 0, 133, -1417, 9297, 9664, -1426, 133, 0 -dw 0, 133, -1417, 9288, 9672, -1426, 133, 0 -dw 0, 133, -1416, 9279, 9681, -1426, 133, 0 -dw 0, 133, -1416, 9271, 9690, -1427, 133, 0 -dw 0, 133, -1416, 9262, 9698, -1427, 133, 0 -dw 0, 133, -1416, 9253, 9707, -1427, 133, 0 -dw 0, 133, -1415, 9244, 9716, -1427, 133, 0 -dw 0, 133, -1415, 9235, 9724, -1427, 133, 0 -dw 0, 133, -1415, 9227, 9733, -1427, 133, 0 -dw 0, 133, -1414, 9218, 9741, -1427, 133, 0 -dw 0, 133, -1414, 9209, 9750, -1427, 133, 0 -dw 0, 133, -1414, 9200, 9759, -1428, 133, 0 -dw 0, 133, -1413, 9191, 9767, -1428, 133, 0 -dw 0, 133, -1413, 9183, 9776, -1428, 133, 0 -dw 0, 133, -1413, 9174, 9785, -1428, 133, 0 -dw 0, 133, -1412, 9165, 9793, -1428, 133, 0 -dw 0, 133, -1412, 9156, 9802, -1428, 133, 0 -dw 0, 133, -1412, 9147, 9810, -1428, 133, 0 -dw 0, 133, -1411, 9138, 9819, -1428, 133, 0 -dw 0, 133, -1411, 9130, 9828, -1428, 133, 0 -dw 0, 133, -1411, 9121, 9836, -1428, 133, 0 -dw 0, 133, -1410, 9112, 9845, -1428, 133, 0 -dw 0, 133, -1410, 9103, 9853, -1428, 133, 0 -dw 0, 133, -1409, 9094, 9862, -1429, 133, 0 -dw 0, 133, -1409, 9085, 9871, -1429, 133, 0 -dw 0, 133, -1409, 9077, 9879, -1429, 133, 0 -dw 0, 133, -1408, 9068, 9888, -1429, 132, 0 -dw 0, 133, -1408, 9059, 9896, -1429, 132, 0 -dw 0, 133, -1408, 9050, 9905, -1429, 132, 0 -dw 0, 133, -1407, 9041, 9914, -1429, 132, 0 -dw 0, 133, -1407, 9032, 9922, -1429, 132, 0 -dw 0, 133, -1406, 9023, 9931, -1429, 132, 0 -dw 0, 133, -1406, 9015, 9939, -1429, 132, 0 -dw 0, 133, -1406, 9006, 9948, -1429, 132, 0 -dw 0, 133, -1405, 8997, 9956, -1429, 132, 0 -dw 0, 133, -1405, 8988, 9965, -1429, 132, 0 -dw 0, 133, -1404, 8979, 9973, -1429, 132, 0 -dw 0, 133, -1404, 8970, 9982, -1429, 132, 0 -dw 0, 133, -1404, 8961, 9990, -1429, 132, 0 -dw 0, 133, -1403, 8952, 9999, -1429, 132, 0 -dw 0, 133, -1403, 8944, 10008, -1429, 132, 0 -dw 0, 133, -1402, 8935, 10016, -1429, 132, 0 -dw 0, 133, -1402, 8926, 10025, -1429, 132, 0 -dw 0, 133, -1401, 8917, 10033, -1429, 132, 0 -dw 0, 133, -1401, 8908, 10042, -1429, 132, 0 -dw 0, 133, -1401, 8899, 10050, -1429, 132, 0 -dw 0, 133, -1400, 8890, 10059, -1429, 132, 0 -dw 0, 133, -1400, 8881, 10067, -1429, 132, 0 -dw 0, 133, -1399, 8872, 10076, -1429, 132, 0 -dw 0, 133, -1399, 8863, 10084, -1429, 132, 0 -dw 0, 133, -1398, 8855, 10093, -1429, 131, 0 -dw 0, 132, -1398, 8846, 10101, -1429, 131, 0 -dw 0, 132, -1397, 8837, 10110, -1429, 131, 0 -dw 0, 132, -1397, 8828, 10118, -1429, 131, 0 -dw 0, 132, -1397, 8819, 10127, -1428, 131, 0 -dw 0, 132, -1396, 8810, 10135, -1428, 131, 0 -dw 0, 132, -1396, 8801, 10143, -1428, 131, 0 -dw 0, 132, -1395, 8792, 10152, -1428, 131, 0 -dw 0, 132, -1395, 8783, 10160, -1428, 131, 0 -dw 0, 132, -1394, 8774, 10169, -1428, 131, 0 -dw 0, 132, -1394, 8765, 10177, -1428, 131, 0 -dw 0, 132, -1393, 8756, 10186, -1428, 131, 0 -dw 0, 132, -1393, 8748, 10194, -1428, 131, 0 -dw 0, 132, -1392, 8739, 10203, -1428, 131, 0 -dw 0, 132, -1392, 8730, 10211, -1428, 131, 0 -dw 0, 132, -1391, 8721, 10220, -1428, 131, 0 -dw 0, 132, -1391, 8712, 10228, -1427, 131, 0 -dw 0, 132, -1390, 8703, 10236, -1427, 131, 0 -dw 0, 132, -1390, 8694, 10245, -1427, 130, 0 -dw 0, 132, -1389, 8685, 10253, -1427, 130, 0 -dw 0, 132, -1389, 8676, 10262, -1427, 130, 0 -dw 0, 132, -1388, 8667, 10270, -1427, 130, 0 -dw 0, 132, -1388, 8658, 10278, -1427, 130, 0 -dw 0, 132, -1387, 8649, 10287, -1427, 130, 0 -dw 0, 132, -1387, 8640, 10295, -1426, 130, 0 -dw 0, 132, -1386, 8631, 10304, -1426, 130, 0 -dw 0, 132, -1386, 8622, 10312, -1426, 130, 0 -dw 0, 132, -1385, 8613, 10320, -1426, 130, 0 -dw 0, 131, -1385, 8605, 10329, -1426, 130, 0 -dw 0, 131, -1384, 8596, 10337, -1426, 130, 0 -dw 0, 131, -1383, 8587, 10345, -1425, 130, 0 -dw 0, 131, -1383, 8578, 10354, -1425, 130, 0 -dw 0, 131, -1382, 8569, 10362, -1425, 130, 0 -dw 0, 131, -1382, 8560, 10371, -1425, 129, 0 -dw 0, 131, -1381, 8551, 10379, -1425, 129, 0 -dw 0, 131, -1381, 8542, 10387, -1425, 129, 0 -dw 0, 131, -1380, 8533, 10396, -1424, 129, 0 -dw 0, 131, -1380, 8524, 10404, -1424, 129, 0 -dw 0, 131, -1379, 8515, 10412, -1424, 129, 0 -dw 0, 131, -1378, 8506, 10421, -1424, 129, 0 -dw 0, 131, -1378, 8497, 10429, -1424, 129, 0 -dw 0, 131, -1377, 8488, 10437, -1423, 129, 0 -dw 0, 131, -1377, 8479, 10446, -1423, 129, 0 -dw 0, 131, -1376, 8470, 10454, -1423, 129, 0 -dw 0, 131, -1376, 8461, 10462, -1423, 129, 0 -dw 0, 131, -1375, 8452, 10470, -1422, 129, 0 -dw 0, 131, -1374, 8443, 10479, -1422, 128, 0 -dw 0, 131, -1374, 8434, 10487, -1422, 128, 0 -dw 0, 131, -1373, 8425, 10495, -1422, 128, 0 -dw 0, 130, -1373, 8416, 10504, -1421, 128, 0 -dw 0, 130, -1372, 8407, 10512, -1421, 128, 0 -dw 0, 130, -1371, 8398, 10520, -1421, 128, 0 -dw 0, 130, -1371, 8389, 10528, -1421, 128, 0 -dw 0, 130, -1370, 8380, 10537, -1420, 128, 0 -dw 0, 130, -1370, 8371, 10545, -1420, 128, 0 -dw 0, 130, -1369, 8362, 10553, -1420, 128, 0 -dw 0, 130, -1368, 8353, 10562, -1420, 128, 0 -dw 0, 130, -1368, 8344, 10570, -1419, 128, 0 -dw 0, 130, -1367, 8335, 10578, -1419, 127, 0 -dw 0, 130, -1367, 8326, 10586, -1419, 127, 0 -dw 0, 130, -1366, 8317, 10595, -1418, 127, 0 -dw 0, 130, -1365, 8308, 10603, -1418, 127, 0 -dw 0, 130, -1365, 8299, 10611, -1418, 127, 0 -dw 0, 130, -1364, 8290, 10619, -1418, 127, 0 -dw 0, 130, -1363, 8281, 10627, -1417, 127, 0 -dw 0, 130, -1363, 8272, 10636, -1417, 127, 0 -dw 0, 129, -1362, 8263, 10644, -1417, 127, 0 -dw 0, 129, -1361, 8254, 10652, -1416, 127, 0 -dw 0, 129, -1361, 8245, 10660, -1416, 126, 0 -dw 0, 129, -1360, 8236, 10668, -1416, 126, 0 -dw 0, 129, -1360, 8227, 10677, -1415, 126, 0 -dw 0, 129, -1359, 8218, 10685, -1415, 126, 0 -dw 0, 129, -1358, 8209, 10693, -1415, 126, 0 -dw 0, 129, -1358, 8200, 10701, -1414, 126, 0 -dw 0, 129, -1357, 8191, 10709, -1414, 126, 0 -dw 0, 129, -1356, 8182, 10717, -1414, 126, 0 -dw 0, 129, -1356, 8173, 10726, -1413, 126, 0 -dw 0, 129, -1355, 8164, 10734, -1413, 126, 0 -dw 0, 129, -1354, 8155, 10742, -1412, 125, 0 -dw 0, 129, -1354, 8146, 10750, -1412, 125, 0 -dw 0, 129, -1353, 8137, 10758, -1412, 125, 0 -dw 0, 129, -1352, 8128, 10766, -1411, 125, 0 -dw 0, 128, -1352, 8119, 10774, -1411, 125, 0 -dw 0, 128, -1351, 8110, 10783, -1411, 125, 0 -dw 0, 128, -1350, 8101, 10791, -1410, 125, 0 -dw 0, 128, -1349, 8092, 10799, -1410, 125, 0 -dw 0, 128, -1349, 8083, 10807, -1409, 125, 0 -dw 0, 128, -1348, 8074, 10815, -1409, 125, 0 -dw 0, 128, -1347, 8065, 10823, -1408, 124, 0 -dw 0, 128, -1347, 8056, 10831, -1408, 124, 0 -dw 0, 128, -1346, 8047, 10839, -1408, 124, 0 -dw 0, 128, -1345, 8038, 10847, -1407, 124, 0 -dw 0, 128, -1345, 8029, 10856, -1407, 124, 0 -dw 0, 128, -1344, 8020, 10864, -1406, 124, 0 -dw 0, 128, -1343, 8011, 10872, -1406, 124, 0 -dw 0, 128, -1342, 8002, 10880, -1405, 124, 0 -dw 0, 128, -1342, 7992, 10888, -1405, 123, 0 -dw 0, 127, -1341, 7983, 10896, -1404, 123, 0 -dw 0, 127, -1340, 7974, 10904, -1404, 123, 0 -dw 0, 127, -1340, 7965, 10912, -1404, 123, 0 -dw 0, 127, -1339, 7956, 10920, -1403, 123, 0 -dw 0, 127, -1338, 7947, 10928, -1403, 123, 0 -dw 0, 127, -1337, 7938, 10936, -1402, 123, 0 -dw 0, 127, -1337, 7929, 10944, -1402, 123, 0 -dw -1, 127, -1336, 7920, 10952, -1401, 122, 0 -dw -1, 127, -1335, 7911, 10960, -1401, 122, 0 -dw -1, 127, -1334, 7902, 10968, -1400, 122, 0 -dw -1, 127, -1334, 7893, 10976, -1400, 122, 0 -dw -1, 127, -1333, 7884, 10984, -1399, 122, 0 -dw -1, 127, -1332, 7875, 10992, -1399, 122, 0 -dw -1, 126, -1331, 7866, 11000, -1398, 122, 0 -dw -1, 126, -1331, 7857, 11008, -1398, 122, 0 -dw -1, 126, -1330, 7848, 11016, -1397, 121, 0 -dw -1, 126, -1329, 7839, 11024, -1397, 121, 0 -dw -1, 126, -1328, 7830, 11032, -1396, 121, 0 -dw -1, 126, -1328, 7821, 11040, -1395, 121, 0 -dw -1, 126, -1327, 7812, 11048, -1395, 121, 0 -dw -1, 126, -1326, 7803, 11056, -1394, 121, 0 -dw -1, 126, -1325, 7794, 11064, -1394, 121, 0 -dw -1, 126, -1325, 7785, 11072, -1393, 121, 0 -dw -1, 126, -1324, 7775, 11080, -1393, 120, 0 -dw -1, 126, -1323, 7766, 11088, -1392, 120, 0 -dw -1, 126, -1322, 7757, 11095, -1392, 120, 0 -dw -1, 125, -1321, 7748, 11103, -1391, 120, 0 -dw -1, 125, -1321, 7739, 11111, -1390, 120, 0 -dw -1, 125, -1320, 7730, 11119, -1390, 120, 0 -dw -1, 125, -1319, 7721, 11127, -1389, 120, 0 -dw -1, 125, -1318, 7712, 11135, -1389, 119, 0 -dw -1, 125, -1317, 7703, 11143, -1388, 119, 0 -dw -1, 125, -1317, 7694, 11151, -1387, 119, 0 -dw -1, 125, -1316, 7685, 11159, -1387, 119, 0 -dw -1, 125, -1315, 7676, 11167, -1386, 119, 0 -dw -1, 125, -1314, 7667, 11174, -1386, 119, 0 -dw -1, 125, -1313, 7658, 11182, -1385, 119, 0 -dw -1, 125, -1313, 7649, 11190, -1384, 118, 0 -dw -1, 124, -1312, 7640, 11198, -1384, 118, 0 -dw -1, 124, -1311, 7631, 11206, -1383, 118, 0 -dw -1, 124, -1310, 7622, 11214, -1382, 118, 0 -dw -1, 124, -1309, 7613, 11221, -1382, 118, 0 -dw -1, 124, -1309, 7603, 11229, -1381, 118, 0 -dw -1, 124, -1308, 7594, 11237, -1380, 117, 0 -dw -1, 124, -1307, 7585, 11245, -1380, 117, 0 -dw -1, 124, -1306, 7576, 11253, -1379, 117, 0 -dw -1, 124, -1305, 7567, 11261, -1378, 117, 0 -dw -1, 124, -1304, 7558, 11268, -1378, 117, 0 -dw -1, 124, -1304, 7549, 11276, -1377, 117, 0 -dw -1, 124, -1303, 7540, 11284, -1376, 117, 0 -dw -1, 123, -1302, 7531, 11292, -1376, 116, 0 -dw -1, 123, -1301, 7522, 11300, -1375, 116, 0 -dw -1, 123, -1300, 7513, 11307, -1374, 116, 0 -dw -1, 123, -1299, 7504, 11315, -1374, 116, 0 -dw -1, 123, -1299, 7495, 11323, -1373, 116, 0 -dw -1, 123, -1298, 7486, 11331, -1372, 116, 0 -dw -1, 123, -1297, 7477, 11338, -1371, 115, 0 -dw -1, 123, -1296, 7468, 11346, -1371, 115, 0 -dw -1, 123, -1295, 7459, 11354, -1370, 115, 0 -dw -1, 123, -1294, 7450, 11362, -1369, 115, 0 -dw -1, 123, -1293, 7440, 11369, -1368, 115, 0 -dw -1, 122, -1293, 7431, 11377, -1368, 115, 0 -dw -1, 122, -1292, 7422, 11385, -1367, 114, 0 -dw -1, 122, -1291, 7413, 11392, -1366, 114, 0 -dw -1, 122, -1290, 7404, 11400, -1365, 114, 0 -dw -1, 122, -1289, 7395, 11408, -1365, 114, 0 -dw -1, 122, -1288, 7386, 11415, -1364, 114, 0 -dw -1, 122, -1287, 7377, 11423, -1363, 114, 0 -dw -1, 122, -1287, 7368, 11431, -1362, 113, 0 -dw -1, 122, -1286, 7359, 11438, -1362, 113, 0 -dw -1, 122, -1285, 7350, 11446, -1361, 113, 0 -dw -1, 122, -1284, 7341, 11454, -1360, 113, 0 -dw -1, 121, -1283, 7332, 11461, -1359, 113, 0 -dw -1, 121, -1282, 7323, 11469, -1358, 112, 0 -dw -1, 121, -1281, 7314, 11477, -1358, 112, 0 -dw -1, 121, -1280, 7305, 11484, -1357, 112, 0 -dw -1, 121, -1279, 7296, 11492, -1356, 112, 0 -dw -1, 121, -1279, 7287, 11500, -1355, 112, 0 -dw -1, 121, -1278, 7277, 11507, -1354, 112, 0 -dw -1, 121, -1277, 7268, 11515, -1353, 111, 0 -dw -1, 121, -1276, 7259, 11522, -1353, 111, 0 -dw -1, 121, -1275, 7250, 11530, -1352, 111, 0 -dw -1, 120, -1274, 7241, 11538, -1351, 111, 0 -dw -1, 120, -1273, 7232, 11545, -1350, 111, 0 -dw -1, 120, -1272, 7223, 11553, -1349, 110, 0 -dw -1, 120, -1271, 7214, 11560, -1348, 110, 0 -dw -1, 120, -1270, 7205, 11568, -1347, 110, 0 -dw -1, 120, -1269, 7196, 11576, -1347, 110, 0 -dw -1, 120, -1269, 7187, 11583, -1346, 110, 0 -dw -1, 120, -1268, 7178, 11591, -1345, 109, 0 -dw -1, 120, -1267, 7169, 11598, -1344, 109, 0 -dw -1, 120, -1266, 7160, 11606, -1343, 109, 0 -dw -1, 120, -1265, 7151, 11613, -1342, 109, 0 -dw -1, 119, -1264, 7142, 11621, -1341, 109, 0 -dw -1, 119, -1263, 7133, 11628, -1340, 108, 0 -dw -1, 119, -1262, 7124, 11636, -1339, 108, 0 -dw -1, 119, -1261, 7115, 11643, -1338, 108, 0 -dw -1, 119, -1260, 7106, 11651, -1337, 108, 0 -dw -1, 119, -1259, 7096, 11658, -1337, 108, 0 -dw -1, 119, -1258, 7087, 11666, -1336, 107, 0 -dw -1, 119, -1257, 7078, 11673, -1335, 107, 0 -dw -1, 119, -1257, 7069, 11681, -1334, 107, 0 -dw -1, 118, -1256, 7060, 11688, -1333, 107, 0 -dw -1, 118, -1255, 7051, 11696, -1332, 107, 0 -dw -1, 118, -1254, 7042, 11703, -1331, 106, 0 -dw -1, 118, -1253, 7033, 11711, -1330, 106, 0 -dw -1, 118, -1252, 7024, 11718, -1329, 106, 0 -dw -1, 118, -1251, 7015, 11725, -1328, 106, 0 -dw -1, 118, -1250, 7006, 11733, -1327, 106, 0 -dw -1, 118, -1249, 6997, 11740, -1326, 105, 0 -dw -1, 118, -1248, 6988, 11748, -1325, 105, 0 -dw -1, 118, -1247, 6979, 11755, -1324, 105, 0 -dw -1, 117, -1246, 6970, 11762, -1323, 105, 0 -dw -1, 117, -1245, 6961, 11770, -1322, 105, 0 -dw -2, 117, -1244, 6952, 11777, -1321, 104, 0 -dw -2, 117, -1243, 6943, 11785, -1320, 104, 0 -dw -2, 117, -1242, 6934, 11792, -1319, 104, 0 -dw -2, 117, -1241, 6925, 11799, -1318, 104, 0 -dw -2, 117, -1240, 6916, 11807, -1317, 103, 0 -dw -2, 117, -1239, 6907, 11814, -1316, 103, 0 -dw -2, 117, -1238, 6898, 11821, -1315, 103, 0 -dw -2, 116, -1237, 6889, 11829, -1314, 103, 0 -dw -2, 116, -1236, 6880, 11836, -1313, 103, 0 -dw -2, 116, -1235, 6871, 11843, -1312, 102, 0 -dw -2, 116, -1234, 6862, 11851, -1310, 102, 0 -dw -2, 116, -1233, 6852, 11858, -1309, 102, 0 -dw -2, 116, -1232, 6843, 11865, -1308, 102, 0 -dw -2, 116, -1231, 6834, 11873, -1307, 101, 0 -dw -2, 116, -1230, 6825, 11880, -1306, 101, 0 -dw -2, 116, -1229, 6816, 11887, -1305, 101, 0 -dw -2, 116, -1228, 6807, 11895, -1304, 101, 0 -dw -2, 115, -1227, 6798, 11902, -1303, 101, 0 -dw -2, 115, -1226, 6789, 11909, -1302, 100, 0 -dw -2, 115, -1225, 6780, 11916, -1301, 100, 0 -dw -2, 115, -1224, 6771, 11924, -1299, 100, 0 -dw -2, 115, -1223, 6762, 11931, -1298, 100, 0 -dw -2, 115, -1222, 6753, 11938, -1297, 99, 0 -dw -2, 115, -1221, 6744, 11945, -1296, 99, 0 -dw -2, 115, -1220, 6735, 11953, -1295, 99, 0 -dw -2, 115, -1219, 6726, 11960, -1294, 99, 0 -dw -2, 114, -1218, 6717, 11967, -1293, 98, 0 -dw -2, 114, -1217, 6708, 11974, -1291, 98, 0 -dw -2, 114, -1216, 6699, 11981, -1290, 98, 0 -dw -2, 114, -1215, 6690, 11989, -1289, 98, 0 -dw -2, 114, -1214, 6681, 11996, -1288, 97, 0 -dw -2, 114, -1213, 6672, 12003, -1287, 97, 0 -dw -2, 114, -1212, 6663, 12010, -1286, 97, 0 -dw -2, 114, -1211, 6654, 12017, -1284, 97, 0 -dw -2, 114, -1210, 6645, 12024, -1283, 96, 0 -dw -2, 113, -1209, 6636, 12032, -1282, 96, 0 -dw -2, 113, -1208, 6627, 12039, -1281, 96, 0 -dw -2, 113, -1207, 6618, 12046, -1280, 96, 0 -dw -2, 113, -1206, 6609, 12053, -1278, 95, 0 -dw -2, 113, -1205, 6600, 12060, -1277, 95, 0 -dw -2, 113, -1204, 6591, 12067, -1276, 95, 0 -dw -2, 113, -1203, 6582, 12074, -1275, 95, 0 -dw -2, 113, -1202, 6573, 12082, -1273, 94, 0 -dw -2, 113, -1201, 6564, 12089, -1272, 94, 0 -dw -2, 112, -1200, 6555, 12096, -1271, 94, 0 -dw -2, 112, -1199, 6546, 12103, -1270, 94, 0 -dw -2, 112, -1198, 6537, 12110, -1268, 93, 0 -dw -2, 112, -1197, 6528, 12117, -1267, 93, 0 -dw -2, 112, -1196, 6519, 12124, -1266, 93, 0 -dw -2, 112, -1195, 6510, 12131, -1265, 93, 0 -dw -2, 112, -1194, 6501, 12138, -1263, 92, 0 -dw -2, 112, -1193, 6492, 12145, -1262, 92, 0 -dw -2, 111, -1192, 6483, 12152, -1261, 92, 0 -dw -2, 111, -1191, 6474, 12159, -1259, 92, 0 -dw -2, 111, -1190, 6465, 12166, -1258, 91, 0 -dw -2, 111, -1188, 6456, 12173, -1257, 91, 0 -dw -2, 111, -1187, 6447, 12180, -1255, 91, 0 -dw -2, 111, -1186, 6438, 12187, -1254, 90, 0 -dw -2, 111, -1185, 6429, 12194, -1253, 90, 0 -dw -2, 111, -1184, 6420, 12201, -1252, 90, 0 -dw -2, 111, -1183, 6411, 12208, -1250, 90, 0 -dw -2, 110, -1182, 6402, 12215, -1249, 89, 0 -dw -2, 110, -1181, 6393, 12222, -1247, 89, 0 -dw -2, 110, -1180, 6385, 12229, -1246, 89, 0 -dw -2, 110, -1179, 6376, 12236, -1245, 89, 0 -dw -2, 110, -1178, 6367, 12243, -1243, 88, 0 -dw -2, 110, -1177, 6358, 12250, -1242, 88, 0 -dw -2, 110, -1176, 6349, 12257, -1241, 88, 0 -dw -2, 110, -1175, 6340, 12264, -1239, 87, 0 -dw -2, 109, -1174, 6331, 12271, -1238, 87, 0 -dw -3, 109, -1173, 6322, 12277, -1236, 87, 0 -dw -3, 109, -1171, 6313, 12284, -1235, 87, 0 -dw -3, 109, -1170, 6304, 12291, -1234, 86, 0 -dw -3, 109, -1169, 6295, 12298, -1232, 86, 0 -dw -3, 109, -1168, 6286, 12305, -1231, 86, 0 -dw -3, 109, -1167, 6277, 12312, -1229, 85, 0 -dw -3, 109, -1166, 6268, 12319, -1228, 85, 0 -dw -3, 109, -1165, 6259, 12326, -1227, 85, 0 -dw -3, 108, -1164, 6250, 12332, -1225, 85, 0 -dw -3, 108, -1163, 6241, 12339, -1224, 84, 0 -dw -3, 108, -1162, 6232, 12346, -1222, 84, 0 -dw -3, 108, -1161, 6223, 12353, -1221, 84, 0 -dw -3, 108, -1159, 6214, 12360, -1219, 83, 0 -dw -3, 108, -1158, 6205, 12367, -1218, 83, 0 -dw -3, 108, -1157, 6197, 12373, -1216, 83, 0 -dw -3, 108, -1156, 6188, 12380, -1215, 82, 0 -dw -3, 107, -1155, 6179, 12387, -1213, 82, 0 -dw -3, 107, -1154, 6170, 12394, -1212, 82, 0 -dw -3, 107, -1153, 6161, 12400, -1210, 82, 0 -dw -3, 107, -1152, 6152, 12407, -1209, 81, 0 -dw -3, 107, -1151, 6143, 12414, -1207, 81, 0 -dw -3, 107, -1150, 6134, 12421, -1206, 81, 0 -dw -3, 107, -1148, 6125, 12427, -1204, 80, 0 -dw -3, 107, -1147, 6116, 12434, -1203, 80, 0 -dw -3, 106, -1146, 6107, 12441, -1201, 80, 0 -dw -3, 106, -1145, 6098, 12448, -1200, 79, 0 -dw -3, 106, -1144, 6089, 12454, -1198, 79, 0 -dw -3, 106, -1143, 6081, 12461, -1197, 79, 0 -dw -3, 106, -1142, 6072, 12468, -1195, 78, 0 -dw -3, 106, -1141, 6063, 12474, -1194, 78, 0 -dw -3, 106, -1140, 6054, 12481, -1192, 78, 0 -dw -3, 106, -1138, 6045, 12488, -1190, 78, 0 -dw -3, 105, -1137, 6036, 12494, -1189, 77, 0 -dw -3, 105, -1136, 6027, 12501, -1187, 77, 0 -dw -3, 105, -1135, 6018, 12508, -1186, 77, 0 -dw -3, 105, -1134, 6009, 12514, -1184, 76, 0 -dw -3, 105, -1133, 6000, 12521, -1182, 76, 0 -dw -3, 105, -1132, 5992, 12528, -1181, 76, 0 -dw -3, 105, -1131, 5983, 12534, -1179, 75, 0 -dw -3, 105, -1130, 5974, 12541, -1178, 75, 0 -dw -3, 104, -1128, 5965, 12547, -1176, 75, 0 -dw -3, 104, -1127, 5956, 12554, -1174, 74, 0 -dw -3, 104, -1126, 5947, 12560, -1173, 74, 0 -dw -3, 104, -1125, 5938, 12567, -1171, 74, 0 -dw -3, 104, -1124, 5929, 12574, -1169, 73, 0 -dw -3, 104, -1123, 5921, 12580, -1168, 73, 0 -dw -3, 104, -1122, 5912, 12587, -1166, 73, 0 -dw -3, 104, -1120, 5903, 12593, -1165, 72, 0 -dw -3, 103, -1119, 5894, 12600, -1163, 72, 0 -dw -3, 103, -1118, 5885, 12606, -1161, 72, 0 -dw -3, 103, -1117, 5876, 12613, -1159, 71, 0 -dw -3, 103, -1116, 5867, 12619, -1158, 71, 0 -dw -3, 103, -1115, 5858, 12626, -1156, 71, 0 -dw -3, 103, -1114, 5850, 12632, -1154, 70, 0 -dw -3, 103, -1112, 5841, 12639, -1153, 70, 0 -dw -4, 103, -1111, 5832, 12645, -1151, 70, 0 -dw -4, 102, -1110, 5823, 12652, -1149, 69, 0 -dw -4, 102, -1109, 5814, 12658, -1148, 69, 0 -dw -4, 102, -1108, 5805, 12665, -1146, 69, 0 -dw -4, 102, -1107, 5796, 12671, -1144, 68, 0 -dw -4, 102, -1106, 5788, 12678, -1142, 68, 0 -dw -4, 102, -1104, 5779, 12684, -1141, 68, 0 -dw -4, 102, -1103, 5770, 12690, -1139, 67, 0 -dw -4, 102, -1102, 5761, 12697, -1137, 67, 0 -dw -4, 101, -1101, 5752, 12703, -1135, 67, 0 -dw -4, 101, -1100, 5743, 12710, -1134, 66, 1 -dw -4, 101, -1099, 5735, 12716, -1132, 66, 1 -dw -4, 101, -1097, 5726, 12722, -1130, 66, 1 -dw -4, 101, -1096, 5717, 12729, -1128, 65, 1 -dw -4, 101, -1095, 5708, 12735, -1126, 65, 1 -dw -4, 101, -1094, 5699, 12742, -1125, 64, 1 -dw -4, 100, -1093, 5691, 12748, -1123, 64, 1 -dw -4, 100, -1092, 5682, 12754, -1121, 64, 1 -dw -4, 100, -1091, 5673, 12761, -1119, 63, 1 -dw -4, 100, -1089, 5664, 12767, -1117, 63, 1 -dw -4, 100, -1088, 5655, 12773, -1116, 63, 1 -dw -4, 100, -1087, 5646, 12780, -1114, 62, 1 -dw -4, 100, -1086, 5638, 12786, -1112, 62, 1 -dw -4, 100, -1085, 5629, 12792, -1110, 62, 1 -dw -4, 99, -1084, 5620, 12798, -1108, 61, 1 -dw -4, 99, -1082, 5611, 12805, -1106, 61, 1 -dw -4, 99, -1081, 5602, 12811, -1104, 60, 1 -dw -4, 99, -1080, 5594, 12817, -1103, 60, 1 -dw -4, 99, -1079, 5585, 12823, -1101, 60, 1 -dw -4, 99, -1078, 5576, 12830, -1099, 59, 1 -dw -4, 99, -1076, 5567, 12836, -1097, 59, 1 -dw -4, 99, -1075, 5559, 12842, -1095, 59, 1 -dw -4, 98, -1074, 5550, 12848, -1093, 58, 1 -dw -4, 98, -1073, 5541, 12855, -1091, 58, 1 -dw -4, 98, -1072, 5532, 12861, -1089, 57, 1 -dw -4, 98, -1071, 5523, 12867, -1087, 57, 1 -dw -4, 98, -1069, 5515, 12873, -1085, 57, 1 -dw -4, 98, -1068, 5506, 12879, -1084, 56, 1 -dw -4, 98, -1067, 5497, 12885, -1082, 56, 1 -dw -4, 98, -1066, 5488, 12892, -1080, 56, 1 -dw -4, 97, -1065, 5480, 12898, -1078, 55, 1 -dw -4, 97, -1063, 5471, 12904, -1076, 55, 1 -dw -4, 97, -1062, 5462, 12910, -1074, 54, 1 -dw -4, 97, -1061, 5453, 12916, -1072, 54, 1 -dw -4, 97, -1060, 5445, 12922, -1070, 54, 1 -dw -4, 97, -1059, 5436, 12928, -1068, 53, 1 -dw -4, 97, -1058, 5427, 12934, -1066, 53, 1 -dw -5, 96, -1056, 5418, 12941, -1064, 52, 1 -dw -5, 96, -1055, 5410, 12947, -1062, 52, 1 -dw -5, 96, -1054, 5401, 12953, -1060, 52, 1 -dw -5, 96, -1053, 5392, 12959, -1058, 51, 1 -dw -5, 96, -1052, 5383, 12965, -1056, 51, 1 -dw -5, 96, -1050, 5375, 12971, -1054, 50, 1 -dw -5, 96, -1049, 5366, 12977, -1052, 50, 1 -dw -5, 96, -1048, 5357, 12983, -1050, 50, 1 -dw -5, 95, -1047, 5349, 12989, -1048, 49, 1 -dw -5, 95, -1046, 5340, 12995, -1046, 49, 1 -dw -5, 95, -1044, 5331, 13001, -1044, 48, 1 -dw -5, 95, -1043, 5322, 13007, -1042, 48, 1 -dw -5, 95, -1042, 5314, 13013, -1040, 48, 1 -dw -5, 95, -1041, 5305, 13019, -1037, 47, 1 -dw -5, 95, -1040, 5296, 13025, -1035, 47, 1 -dw -5, 94, -1038, 5288, 13031, -1033, 46, 1 -dw -5, 94, -1037, 5279, 13037, -1031, 46, 1 -dw -5, 94, -1036, 5270, 13043, -1029, 46, 1 -dw -5, 94, -1035, 5262, 13049, -1027, 45, 1 -dw -5, 94, -1034, 5253, 13055, -1025, 45, 1 -dw -5, 94, -1032, 5244, 13061, -1023, 44, 1 -dw -5, 94, -1031, 5235, 13067, -1021, 44, 1 -dw -5, 94, -1030, 5227, 13072, -1019, 44, 1 -dw -5, 93, -1029, 5218, 13078, -1016, 43, 1 -dw -5, 93, -1027, 5209, 13084, -1014, 43, 1 -dw -5, 93, -1026, 5201, 13090, -1012, 42, 1 -dw -5, 93, -1025, 5192, 13096, -1010, 42, 1 -dw -5, 93, -1024, 5183, 13102, -1008, 41, 1 -dw -5, 93, -1023, 5175, 13108, -1006, 41, 1 -dw -5, 93, -1021, 5166, 13113, -1004, 41, 1 -dw -5, 92, -1020, 5157, 13119, -1001, 40, 1 -dw -5, 92, -1019, 5149, 13125, -999, 40, 1 -dw -5, 92, -1018, 5140, 13131, -997, 39, 1 -dw -5, 92, -1017, 5132, 13137, -995, 39, 1 -dw -5, 92, -1015, 5123, 13143, -993, 39, 1 -dw -5, 92, -1014, 5114, 13148, -990, 38, 1 -dw -5, 92, -1013, 5106, 13154, -988, 38, 1 -dw -5, 92, -1012, 5097, 13160, -986, 37, 1 -dw -5, 91, -1010, 5088, 13166, -984, 37, 1 -dw -5, 91, -1009, 5080, 13171, -981, 36, 1 -dw -5, 91, -1008, 5071, 13177, -979, 36, 1 -dw -5, 91, -1007, 5062, 13183, -977, 35, 1 -dw -6, 91, -1006, 5054, 13189, -975, 35, 1 -dw -6, 91, -1004, 5045, 13194, -972, 35, 1 -dw -6, 91, -1003, 5037, 13200, -970, 34, 1 -dw -6, 90, -1002, 5028, 13206, -968, 34, 2 -dw -6, 90, -1001, 5019, 13211, -966, 33, 2 -dw -6, 90, -999, 5011, 13217, -963, 33, 2 -dw -6, 90, -998, 5002, 13223, -961, 32, 2 -dw -6, 90, -997, 4994, 13228, -959, 32, 2 -dw -6, 90, -996, 4985, 13234, -957, 31, 2 -dw -6, 90, -994, 4976, 13240, -954, 31, 2 -dw -6, 90, -993, 4968, 13245, -952, 31, 2 -dw -6, 89, -992, 4959, 13251, -950, 30, 2 -dw -6, 89, -991, 4951, 13257, -947, 30, 2 -dw -6, 89, -990, 4942, 13262, -945, 29, 2 -dw -6, 89, -988, 4934, 13268, -943, 29, 2 -dw -6, 89, -987, 4925, 13273, -940, 28, 2 -dw -6, 89, -986, 4916, 13279, -938, 28, 2 -dw -6, 89, -985, 4908, 13285, -936, 27, 2 -dw -6, 88, -983, 4899, 13290, -933, 27, 2 -dw -6, 88, -982, 4891, 13296, -931, 26, 2 -dw -6, 88, -981, 4882, 13301, -928, 26, 2 -dw -6, 88, -980, 4874, 13307, -926, 26, 2 -dw -6, 88, -978, 4865, 13312, -924, 25, 2 -dw -6, 88, -977, 4857, 13318, -921, 25, 2 -dw -6, 88, -976, 4848, 13323, -919, 24, 2 -dw -6, 87, -975, 4839, 13329, -916, 24, 2 -dw -6, 87, -973, 4831, 13334, -914, 23, 2 -dw -6, 87, -972, 4822, 13340, -912, 23, 2 -dw -6, 87, -971, 4814, 13345, -909, 22, 2 -dw -6, 87, -970, 4805, 13351, -907, 22, 2 -dw -6, 87, -969, 4797, 13356, -904, 21, 2 -dw -6, 87, -967, 4788, 13362, -902, 21, 2 -dw -6, 87, -966, 4780, 13367, -899, 20, 2 -dw -6, 86, -965, 4771, 13372, -897, 20, 2 -dw -6, 86, -964, 4763, 13378, -894, 19, 2 -dw -6, 86, -962, 4754, 13383, -892, 19, 2 -dw -6, 86, -961, 4746, 13389, -890, 19, 2 -dw -6, 86, -960, 4737, 13394, -887, 18, 2 -dw -7, 86, -959, 4729, 13399, -885, 18, 2 -dw -7, 86, -957, 4720, 13405, -882, 17, 2 -dw -7, 85, -956, 4712, 13410, -880, 17, 2 -dw -7, 85, -955, 4703, 13416, -877, 16, 2 -dw -7, 85, -954, 4695, 13421, -875, 16, 2 -dw -7, 85, -952, 4686, 13426, -872, 15, 2 -dw -7, 85, -951, 4678, 13432, -869, 15, 2 -dw -7, 85, -950, 4669, 13437, -867, 14, 2 -dw -7, 85, -949, 4661, 13442, -864, 14, 2 -dw -7, 84, -947, 4653, 13447, -862, 13, 2 -dw -7, 84, -946, 4644, 13453, -859, 13, 2 -dw -7, 84, -945, 4636, 13458, -857, 12, 2 -dw -7, 84, -944, 4627, 13463, -854, 12, 2 -dw -7, 84, -942, 4619, 13469, -852, 11, 2 -dw -7, 84, -941, 4610, 13474, -849, 11, 2 -dw -7, 84, -940, 4602, 13479, -846, 10, 2 -dw -7, 84, -939, 4593, 13484, -844, 10, 2 -dw -7, 83, -937, 4585, 13489, -841, 9, 2 -dw -7, 83, -936, 4577, 13495, -839, 9, 2 -dw -7, 83, -935, 4568, 13500, -836, 8, 3 -dw -7, 83, -934, 4560, 13505, -833, 8, 3 -dw -7, 83, -932, 4551, 13510, -831, 7, 3 -dw -7, 83, -931, 4543, 13515, -828, 7, 3 -dw -7, 83, -930, 4535, 13521, -825, 6, 3 -dw -7, 82, -928, 4526, 13526, -823, 6, 3 -dw -7, 82, -927, 4518, 13531, -820, 5, 3 -dw -7, 82, -926, 4509, 13536, -818, 5, 3 -dw -7, 82, -925, 4501, 13541, -815, 4, 3 -dw -7, 82, -923, 4493, 13546, -812, 4, 3 -dw -7, 82, -922, 4484, 13551, -810, 3, 3 -dw -7, 82, -921, 4476, 13556, -807, 3, 3 -dw -7, 82, -920, 4467, 13562, -804, 2, 3 -dw -7, 81, -918, 4459, 13567, -801, 2, 3 -dw -7, 81, -917, 4451, 13572, -799, 1, 3 -dw -7, 81, -916, 4442, 13577, -796, 0, 3 -dw -8, 81, -915, 4434, 13582, -793, 0, 3 -dw -8, 81, -913, 4426, 13587, -791, -1, 3 -dw -8, 81, -912, 4417, 13592, -788, -1, 3 -dw -8, 81, -911, 4409, 13597, -785, -2, 3 -dw -8, 80, -910, 4400, 13602, -782, -2, 3 -dw -8, 80, -908, 4392, 13607, -780, -3, 3 -dw -8, 80, -907, 4384, 13612, -777, -3, 3 -dw -8, 80, -906, 4375, 13617, -774, -4, 3 -dw -8, 80, -905, 4367, 13622, -771, -4, 3 -dw -8, 80, -903, 4359, 13627, -769, -5, 3 -dw -8, 80, -902, 4350, 13632, -766, -5, 3 -dw -8, 79, -901, 4342, 13637, -763, -6, 3 -dw -8, 79, -899, 4334, 13642, -760, -6, 3 -dw -8, 79, -898, 4326, 13647, -757, -7, 3 -dw -8, 79, -897, 4317, 13651, -755, -8, 3 -dw -8, 79, -896, 4309, 13656, -752, -8, 3 -dw -8, 79, -894, 4301, 13661, -749, -9, 3 -dw -8, 79, -893, 4292, 13666, -746, -9, 3 -dw -8, 79, -892, 4284, 13671, -743, -10, 3 -dw -8, 78, -891, 4276, 13676, -740, -10, 3 -dw -8, 78, -889, 4267, 13681, -738, -11, 3 -dw -8, 78, -888, 4259, 13686, -735, -11, 3 -dw -8, 78, -887, 4251, 13690, -732, -12, 3 -dw -8, 78, -886, 4243, 13695, -729, -12, 3 -dw -8, 78, -884, 4234, 13700, -726, -13, 3 -dw -8, 78, -883, 4226, 13705, -723, -14, 3 -dw -8, 77, -882, 4218, 13710, -720, -14, 3 -dw -8, 77, -880, 4210, 13714, -717, -15, 4 -dw -8, 77, -879, 4201, 13719, -715, -15, 4 -dw -8, 77, -878, 4193, 13724, -712, -16, 4 -dw -8, 77, -877, 4185, 13729, -709, -16, 4 -dw -8, 77, -875, 4177, 13733, -706, -17, 4 -dw -8, 77, -874, 4168, 13738, -703, -17, 4 -dw -9, 76, -873, 4160, 13743, -700, -18, 4 -dw -9, 76, -872, 4152, 13748, -697, -19, 4 -dw -9, 76, -870, 4144, 13752, -694, -19, 4 -dw -9, 76, -869, 4136, 13757, -691, -20, 4 -dw -9, 76, -868, 4127, 13762, -688, -20, 4 -dw -9, 76, -867, 4119, 13766, -685, -21, 4 -dw -9, 76, -865, 4111, 13771, -682, -21, 4 -dw -9, 76, -864, 4103, 13776, -679, -22, 4 -dw -9, 75, -863, 4094, 13780, -676, -23, 4 -dw -9, 75, -861, 4086, 13785, -673, -23, 4 -dw -9, 75, -860, 4078, 13790, -670, -24, 4 -dw -9, 75, -859, 4070, 13794, -667, -24, 4 -dw -9, 75, -858, 4062, 13799, -664, -25, 4 -dw -9, 75, -856, 4054, 13803, -661, -25, 4 -dw -9, 75, -855, 4045, 13808, -658, -26, 4 -dw -9, 74, -854, 4037, 13813, -655, -27, 4 -dw -9, 74, -853, 4029, 13817, -652, -27, 4 -dw -9, 74, -851, 4021, 13822, -649, -28, 4 -dw -9, 74, -850, 4013, 13826, -646, -28, 4 -dw -9, 74, -849, 4005, 13831, -643, -29, 4 -dw -9, 74, -847, 3996, 13835, -640, -29, 4 -dw -9, 74, -846, 3988, 13840, -637, -30, 4 -dw -9, 74, -845, 3980, 13844, -634, -31, 4 -dw -9, 73, -844, 3972, 13849, -631, -31, 4 -dw -9, 73, -842, 3964, 13853, -627, -32, 4 -dw -9, 73, -841, 3956, 13858, -624, -32, 4 -dw -9, 73, -840, 3948, 13862, -621, -33, 4 -dw -9, 73, -839, 3940, 13867, -618, -34, 4 -dw -9, 73, -837, 3931, 13871, -615, -34, 4 -dw -9, 73, -836, 3923, 13876, -612, -35, 5 -dw -9, 72, -835, 3915, 13880, -609, -35, 5 -dw -10, 72, -833, 3907, 13885, -606, -36, 5 -dw -10, 72, -832, 3899, 13889, -602, -37, 5 -dw -10, 72, -831, 3891, 13893, -599, -37, 5 -dw -10, 72, -830, 3883, 13898, -596, -38, 5 -dw -10, 72, -828, 3875, 13902, -593, -38, 5 -dw -10, 72, -827, 3867, 13906, -590, -39, 5 -dw -10, 72, -826, 3859, 13911, -587, -40, 5 -dw -10, 71, -825, 3851, 13915, -583, -40, 5 -dw -10, 71, -823, 3843, 13920, -580, -41, 5 -dw -10, 71, -822, 3834, 13924, -577, -41, 5 -dw -10, 71, -821, 3826, 13928, -574, -42, 5 -dw -10, 71, -819, 3818, 13932, -571, -43, 5 -dw -10, 71, -818, 3810, 13937, -567, -43, 5 -dw -10, 71, -817, 3802, 13941, -564, -44, 5 -dw -10, 70, -816, 3794, 13945, -561, -45, 5 -dw -10, 70, -814, 3786, 13950, -558, -45, 5 -dw -10, 70, -813, 3778, 13954, -554, -46, 5 -dw -10, 70, -812, 3770, 13958, -551, -46, 5 -dw -10, 70, -810, 3762, 13962, -548, -47, 5 -dw -10, 70, -809, 3754, 13967, -545, -48, 5 -dw -10, 70, -808, 3746, 13971, -541, -48, 5 -dw -10, 70, -807, 3738, 13975, -538, -49, 5 -dw -10, 69, -805, 3730, 13979, -535, -50, 5 -dw -10, 69, -804, 3722, 13983, -531, -50, 5 -dw -10, 69, -803, 3714, 13987, -528, -51, 5 -dw -10, 69, -802, 3706, 13992, -525, -51, 5 -dw -10, 69, -800, 3698, 13996, -522, -52, 5 -dw -10, 69, -799, 3690, 14000, -518, -53, 5 -dw -10, 69, -798, 3682, 14004, -515, -53, 5 -dw -10, 68, -796, 3674, 14008, -512, -54, 5 -dw -11, 68, -795, 3666, 14012, -508, -55, 6 -dw -11, 68, -794, 3658, 14016, -505, -55, 6 -dw -11, 68, -793, 3650, 14020, -501, -56, 6 -dw -11, 68, -791, 3642, 14025, -498, -57, 6 -dw -11, 68, -790, 3635, 14029, -495, -57, 6 -dw -11, 68, -789, 3627, 14033, -491, -58, 6 -dw -11, 68, -788, 3619, 14037, -488, -58, 6 -dw -11, 67, -786, 3611, 14041, -485, -59, 6 -dw -11, 67, -785, 3603, 14045, -481, -60, 6 -dw -11, 67, -784, 3595, 14049, -478, -60, 6 -dw -11, 67, -782, 3587, 14053, -474, -61, 6 -dw -11, 67, -781, 3579, 14057, -471, -62, 6 -dw -11, 67, -780, 3571, 14061, -468, -62, 6 -dw -11, 67, -779, 3563, 14065, -464, -63, 6 -dw -11, 66, -777, 3555, 14069, -461, -64, 6 -dw -11, 66, -776, 3547, 14073, -457, -64, 6 -dw -11, 66, -775, 3540, 14077, -454, -65, 6 -dw -11, 66, -774, 3532, 14081, -450, -66, 6 -dw -11, 66, -772, 3524, 14085, -447, -66, 6 -dw -11, 66, -771, 3516, 14088, -443, -67, 6 -dw -11, 66, -770, 3508, 14092, -440, -68, 6 -dw -11, 66, -768, 3500, 14096, -436, -68, 6 -dw -11, 65, -767, 3492, 14100, -433, -69, 6 -dw -11, 65, -766, 3485, 14104, -429, -70, 6 -dw -11, 65, -765, 3477, 14108, -426, -70, 6 -dw -11, 65, -763, 3469, 14112, -422, -71, 6 -dw -11, 65, -762, 3461, 14116, -419, -72, 6 -dw -11, 65, -761, 3453, 14119, -415, -72, 6 -dw -11, 65, -760, 3445, 14123, -412, -73, 7 -dw -12, 64, -758, 3438, 14127, -408, -74, 7 -dw -12, 64, -757, 3430, 14131, -405, -74, 7 -dw -12, 64, -756, 3422, 14135, -401, -75, 7 -dw -12, 64, -754, 3414, 14138, -398, -76, 7 -dw -12, 64, -753, 3406, 14142, -394, -76, 7 -dw -12, 64, -752, 3399, 14146, -390, -77, 7 -dw -12, 64, -751, 3391, 14150, -387, -78, 7 -dw -12, 64, -749, 3383, 14153, -383, -78, 7 -dw -12, 63, -748, 3375, 14157, -380, -79, 7 -dw -12, 63, -747, 3367, 14161, -376, -80, 7 -dw -12, 63, -746, 3360, 14164, -372, -80, 7 -dw -12, 63, -744, 3352, 14168, -369, -81, 7 -dw -12, 63, -743, 3344, 14172, -365, -82, 7 -dw -12, 63, -742, 3336, 14175, -362, -82, 7 -dw -12, 63, -740, 3329, 14179, -358, -83, 7 -dw -12, 63, -739, 3321, 14183, -354, -84, 7 -dw -12, 62, -738, 3313, 14186, -351, -85, 7 -dw -12, 62, -737, 3305, 14190, -347, -85, 7 -dw -12, 62, -735, 3298, 14194, -343, -86, 7 -dw -12, 62, -734, 3290, 14197, -340, -87, 7 -dw -12, 62, -733, 3282, 14201, -336, -87, 7 -dw -12, 62, -732, 3274, 14204, -332, -88, 7 -dw -12, 62, -730, 3267, 14208, -329, -89, 7 -dw -12, 62, -729, 3259, 14212, -325, -89, 7 -dw -12, 61, -728, 3251, 14215, -321, -90, 8 -dw -12, 61, -727, 3244, 14219, -317, -91, 8 -dw -12, 61, -725, 3236, 14222, -314, -91, 8 -dw -12, 61, -724, 3228, 14226, -310, -92, 8 -dw -13, 61, -723, 3221, 14229, -306, -93, 8 -dw -13, 61, -721, 3213, 14233, -302, -94, 8 -dw -13, 61, -720, 3205, 14236, -299, -94, 8 -dw -13, 60, -719, 3198, 14240, -295, -95, 8 -dw -13, 60, -718, 3190, 14243, -291, -96, 8 -dw -13, 60, -716, 3182, 14247, -287, -96, 8 -dw -13, 60, -715, 3175, 14250, -284, -97, 8 -dw -13, 60, -714, 3167, 14253, -280, -98, 8 -dw -13, 60, -713, 3159, 14257, -276, -99, 8 -dw -13, 60, -711, 3152, 14260, -272, -99, 8 -dw -13, 60, -710, 3144, 14264, -268, -100, 8 -dw -13, 59, -709, 3136, 14267, -265, -101, 8 -dw -13, 59, -708, 3129, 14270, -261, -101, 8 -dw -13, 59, -706, 3121, 14274, -257, -102, 8 -dw -13, 59, -705, 3114, 14277, -253, -103, 8 -dw -13, 59, -704, 3106, 14281, -249, -104, 8 -dw -13, 59, -703, 3098, 14284, -245, -104, 8 -dw -13, 59, -701, 3091, 14287, -242, -105, 8 -dw -13, 59, -700, 3083, 14291, -238, -106, 8 -dw -13, 58, -699, 3076, 14294, -234, -107, 8 -dw -13, 58, -697, 3068, 14297, -230, -107, 9 -dw -13, 58, -696, 3060, 14300, -226, -108, 9 -dw -13, 58, -695, 3053, 14304, -222, -109, 9 -dw -13, 58, -694, 3045, 14307, -218, -110, 9 -dw -13, 58, -692, 3038, 14310, -214, -110, 9 -dw -13, 58, -691, 3030, 14313, -211, -111, 9 -dw -13, 58, -690, 3023, 14317, -207, -112, 9 -dw -13, 57, -689, 3015, 14320, -203, -112, 9 -dw -14, 57, -687, 3008, 14323, -199, -113, 9 -dw -14, 57, -686, 3000, 14326, -195, -114, 9 -dw -14, 57, -685, 2993, 14329, -191, -115, 9 -dw -14, 57, -684, 2985, 14333, -187, -115, 9 -dw -14, 57, -682, 2978, 14336, -183, -116, 9 -dw -14, 57, -681, 2970, 14339, -179, -117, 9 -dw -14, 57, -680, 2963, 14342, -175, -118, 9 -dw -14, 56, -679, 2955, 14345, -171, -118, 9 -dw -14, 56, -677, 2948, 14348, -167, -119, 9 -dw -14, 56, -676, 2940, 14351, -163, -120, 9 -dw -14, 56, -675, 2933, 14355, -159, -121, 9 -dw -14, 56, -674, 2925, 14358, -155, -121, 9 -dw -14, 56, -672, 2918, 14361, -151, -122, 9 -dw -14, 56, -671, 2910, 14364, -147, -123, 10 -dw -14, 56, -670, 2903, 14367, -143, -124, 10 -dw -14, 55, -669, 2895, 14370, -139, -124, 10 -dw -14, 55, -667, 2888, 14373, -135, -125, 10 -dw -14, 55, -666, 2880, 14376, -131, -126, 10 -dw -14, 55, -665, 2873, 14379, -127, -127, 10 -dw -14, 55, -664, 2866, 14382, -123, -128, 10 -dw -14, 55, -662, 2858, 14385, -119, -128, 10 -dw -14, 55, -661, 2851, 14388, -115, -129, 10 -dw -14, 55, -660, 2843, 14391, -111, -130, 10 -dw -14, 54, -659, 2836, 14394, -106, -131, 10 -dw -14, 54, -657, 2828, 14397, -102, -131, 10 -dw -14, 54, -656, 2821, 14400, -98, -132, 10 -dw -15, 54, -655, 2814, 14403, -94, -133, 10 -dw -15, 54, -654, 2806, 14405, -90, -134, 10 -dw -15, 54, -652, 2799, 14408, -86, -134, 10 -dw -15, 54, -651, 2791, 14411, -82, -135, 10 -dw -15, 54, -650, 2784, 14414, -78, -136, 10 -dw -15, 53, -649, 2777, 14417, -73, -137, 10 -dw -15, 53, -647, 2769, 14420, -69, -138, 10 -dw -15, 53, -646, 2762, 14423, -65, -138, 10 -dw -15, 53, -645, 2755, 14426, -61, -139, 11 -dw -15, 53, -644, 2747, 14428, -57, -140, 11 -dw -15, 53, -642, 2740, 14431, -53, -141, 11 -dw -15, 53, -641, 2733, 14434, -48, -141, 11 -dw -15, 53, -640, 2725, 14437, -44, -142, 11 -dw -15, 52, -639, 2718, 14439, -40, -143, 11 -dw -15, 52, -637, 2711, 14442, -36, -144, 11 -dw -15, 52, -636, 2703, 14445, -32, -145, 11 -dw -15, 52, -635, 2696, 14448, -27, -145, 11 -dw -15, 52, -634, 2689, 14450, -23, -146, 11 -dw -15, 52, -632, 2681, 14453, -19, -147, 11 -dw -15, 52, -631, 2674, 14456, -15, -148, 11 -dw -15, 52, -630, 2667, 14459, -10, -149, 11 -dw -15, 51, -629, 2660, 14461, -6, -149, 11 -dw -15, 51, -628, 2652, 14464, -2, -150, 11 -dw -15, 51, -626, 2645, 14467, 2, -151, 11 -dw -15, 51, -625, 2638, 14469, 7, -152, 11 -dw -15, 51, -624, 2631, 14472, 11, -153, 11 -dw -15, 51, -623, 2623, 14475, 15, -153, 11 -dw -16, 51, -621, 2616, 14477, 20, -154, 12 -dw -16, 51, -620, 2609, 14480, 24, -155, 12 -dw -16, 51, -619, 2602, 14482, 28, -156, 12 -dw -16, 50, -618, 2594, 14485, 32, -157, 12 -dw -16, 50, -616, 2587, 14488, 37, -157, 12 -dw -16, 50, -615, 2580, 14490, 41, -158, 12 -dw -16, 50, -614, 2573, 14493, 45, -159, 12 -dw -16, 50, -613, 2566, 14495, 50, -160, 12 -dw -16, 50, -611, 2558, 14498, 54, -161, 12 -dw -16, 50, -610, 2551, 14500, 59, -162, 12 -dw -16, 50, -609, 2544, 14503, 63, -162, 12 -dw -16, 49, -608, 2537, 14505, 67, -163, 12 -dw -16, 49, -607, 2530, 14508, 72, -164, 12 -dw -16, 49, -605, 2522, 14510, 76, -165, 12 -dw -16, 49, -604, 2515, 14513, 80, -166, 12 -dw -16, 49, -603, 2508, 14515, 85, -166, 12 -dw -16, 49, -602, 2501, 14518, 89, -167, 12 -dw -16, 49, -600, 2494, 14520, 94, -168, 12 -dw -16, 49, -599, 2487, 14522, 98, -169, 13 -dw -16, 49, -598, 2480, 14525, 103, -170, 13 -dw -16, 48, -597, 2472, 14527, 107, -171, 13 -dw -16, 48, -596, 2465, 14530, 111, -171, 13 -dw -16, 48, -594, 2458, 14532, 116, -172, 13 -dw -16, 48, -593, 2451, 14534, 120, -173, 13 -dw -16, 48, -592, 2444, 14537, 125, -174, 13 -dw -16, 48, -591, 2437, 14539, 129, -175, 13 -dw -17, 48, -589, 2430, 14541, 134, -176, 13 -dw -17, 48, -588, 2423, 14544, 138, -176, 13 -dw -17, 47, -587, 2416, 14546, 143, -177, 13 -dw -17, 47, -586, 2409, 14548, 147, -178, 13 -dw -17, 47, -585, 2402, 14551, 152, -179, 13 -dw -17, 47, -583, 2394, 14553, 156, -180, 13 -dw -17, 47, -582, 2387, 14555, 161, -181, 13 -dw -17, 47, -581, 2380, 14557, 165, -182, 13 -dw -17, 47, -580, 2373, 14560, 170, -182, 13 -dw -17, 47, -578, 2366, 14562, 174, -183, 13 -dw -17, 47, -577, 2359, 14564, 179, -184, 14 -dw -17, 46, -576, 2352, 14566, 184, -185, 14 -dw -17, 46, -575, 2345, 14568, 188, -186, 14 -dw -17, 46, -574, 2338, 14571, 193, -187, 14 -dw -17, 46, -572, 2331, 14573, 197, -188, 14 -dw -17, 46, -571, 2324, 14575, 202, -188, 14 -dw -17, 46, -570, 2317, 14577, 206, -189, 14 -dw -17, 46, -569, 2310, 14579, 211, -190, 14 -dw -17, 46, -568, 2303, 14581, 216, -191, 14 -dw -17, 45, -566, 2296, 14583, 220, -192, 14 -dw -17, 45, -565, 2289, 14585, 225, -193, 14 -dw -17, 45, -564, 2282, 14588, 230, -194, 14 -dw -17, 45, -563, 2275, 14590, 234, -194, 14 -dw -17, 45, -562, 2268, 14592, 239, -195, 14 -dw -17, 45, -560, 2261, 14594, 243, -196, 14 -dw -18, 45, -559, 2254, 14596, 248, -197, 14 -dw -18, 45, -558, 2247, 14598, 253, -198, 15 -dw -18, 45, -557, 2241, 14600, 257, -199, 15 -dw -18, 44, -555, 2234, 14602, 262, -200, 15 -dw -18, 44, -554, 2227, 14604, 267, -200, 15 -dw -18, 44, -553, 2220, 14606, 272, -201, 15 -dw -18, 44, -552, 2213, 14608, 276, -202, 15 -dw -18, 44, -551, 2206, 14610, 281, -203, 15 -dw -18, 44, -549, 2199, 14612, 286, -204, 15 -dw -18, 44, -548, 2192, 14614, 290, -205, 15 -dw -18, 44, -547, 2185, 14616, 295, -206, 15 -dw -18, 44, -546, 2178, 14618, 300, -207, 15 -dw -18, 43, -545, 2172, 14619, 305, -207, 15 -dw -18, 43, -543, 2165, 14621, 309, -208, 15 -dw -18, 43, -542, 2158, 14623, 314, -209, 15 -dw -18, 43, -541, 2151, 14625, 319, -210, 15 -dw -18, 43, -540, 2144, 14627, 324, -211, 15 -dw -18, 43, -539, 2137, 14629, 328, -212, 16 -dw -18, 43, -538, 2130, 14631, 333, -213, 16 -dw -18, 43, -536, 2124, 14632, 338, -214, 16 -dw -18, 43, -535, 2117, 14634, 343, -215, 16 -dw -18, 42, -534, 2110, 14636, 348, -215, 16 -dw -18, 42, -533, 2103, 14638, 352, -216, 16 -dw -18, 42, -532, 2096, 14640, 357, -217, 16 -dw -18, 42, -530, 2090, 14641, 362, -218, 16 -dw -18, 42, -529, 2083, 14643, 367, -219, 16 -dw -19, 42, -528, 2076, 14645, 372, -220, 16 -dw -19, 42, -527, 2069, 14647, 377, -221, 16 -dw -19, 42, -526, 2062, 14648, 381, -222, 16 -dw -19, 42, -524, 2056, 14650, 386, -223, 16 -dw -19, 41, -523, 2049, 14652, 391, -224, 16 -dw -19, 41, -522, 2042, 14653, 396, -224, 16 -dw -19, 41, -521, 2035, 14655, 401, -225, 16 -dw -19, 41, -520, 2029, 14657, 406, -226, 17 -dw -19, 41, -519, 2022, 14658, 411, -227, 17 -dw -19, 41, -517, 2015, 14660, 416, -228, 17 -dw -19, 41, -516, 2008, 14662, 420, -229, 17 -dw -19, 41, -515, 2002, 14663, 425, -230, 17 -dw -19, 41, -514, 1995, 14665, 430, -231, 17 -dw -19, 40, -513, 1988, 14666, 435, -232, 17 -dw -19, 40, -511, 1982, 14668, 440, -233, 17 -dw -19, 40, -510, 1975, 14670, 445, -234, 17 -dw -19, 40, -509, 1968, 14671, 450, -235, 17 -dw -19, 40, -508, 1961, 14673, 455, -235, 17 -dw -19, 40, -507, 1955, 14674, 460, -236, 17 -dw -19, 40, -506, 1948, 14676, 465, -237, 17 -dw -19, 40, -504, 1941, 14677, 470, -238, 17 -dw -19, 40, -503, 1935, 14679, 475, -239, 17 -dw -19, 39, -502, 1928, 14680, 480, -240, 18 -dw -19, 39, -501, 1922, 14682, 485, -241, 18 -dw -19, 39, -500, 1915, 14683, 490, -242, 18 -dw -19, 39, -499, 1908, 14685, 495, -243, 18 -dw -20, 39, -497, 1902, 14686, 500, -244, 18 -dw -20, 39, -496, 1895, 14688, 505, -245, 18 -dw -20, 39, -495, 1888, 14689, 510, -246, 18 -dw -20, 39, -494, 1882, 14690, 515, -247, 18 -dw -20, 39, -493, 1875, 14692, 520, -248, 18 -dw -20, 39, -492, 1869, 14693, 525, -248, 18 -dw -20, 38, -490, 1862, 14695, 530, -249, 18 -dw -20, 38, -489, 1855, 14696, 535, -250, 18 -dw -20, 38, -488, 1849, 14697, 540, -251, 18 -dw -20, 38, -487, 1842, 14699, 546, -252, 18 -dw -20, 38, -486, 1836, 14700, 551, -253, 19 -dw -20, 38, -485, 1829, 14701, 556, -254, 19 -dw -20, 38, -483, 1823, 14703, 561, -255, 19 -dw -20, 38, -482, 1816, 14704, 566, -256, 19 -dw -20, 38, -481, 1809, 14705, 571, -257, 19 -dw -20, 37, -480, 1803, 14706, 576, -258, 19 -dw -20, 37, -479, 1796, 14708, 581, -259, 19 -dw -20, 37, -478, 1790, 14709, 586, -260, 19 -dw -20, 37, -476, 1783, 14710, 592, -261, 19 -dw -20, 37, -475, 1777, 14711, 597, -262, 19 -dw -20, 37, -474, 1770, 14713, 602, -263, 19 -dw -20, 37, -473, 1764, 14714, 607, -264, 19 -dw -20, 37, -472, 1757, 14715, 612, -265, 19 -dw -20, 37, -471, 1751, 14716, 617, -265, 19 -dw -20, 37, -470, 1744, 14717, 623, -266, 20 -dw -21, 36, -468, 1738, 14718, 628, -267, 20 -dw -21, 36, -467, 1731, 14720, 633, -268, 20 -dw -21, 36, -466, 1725, 14721, 638, -269, 20 -dw -21, 36, -465, 1719, 14722, 643, -270, 20 -dw -21, 36, -464, 1712, 14723, 649, -271, 20 -dw -21, 36, -463, 1706, 14724, 654, -272, 20 -dw -21, 36, -462, 1699, 14725, 659, -273, 20 -dw -21, 36, -460, 1693, 14726, 664, -274, 20 -dw -21, 36, -459, 1686, 14727, 670, -275, 20 -dw -21, 36, -458, 1680, 14728, 675, -276, 20 -dw -21, 35, -457, 1674, 14729, 680, -277, 20 -dw -21, 35, -456, 1667, 14730, 685, -278, 20 -dw -21, 35, -455, 1661, 14731, 691, -279, 21 -dw -21, 35, -454, 1654, 14732, 696, -280, 21 -dw -21, 35, -452, 1648, 14733, 701, -281, 21 -dw -21, 35, -451, 1642, 14734, 707, -282, 21 -dw -21, 35, -450, 1635, 14735, 712, -283, 21 -dw -21, 35, -449, 1629, 14736, 717, -284, 21 -dw -21, 35, -448, 1623, 14737, 723, -285, 21 -dw -21, 35, -447, 1616, 14738, 728, -286, 21 -dw -21, 34, -446, 1610, 14739, 733, -287, 21 -dw -21, 34, -445, 1604, 14740, 739, -288, 21 -dw -21, 34, -443, 1597, 14741, 744, -289, 21 -dw -21, 34, -442, 1591, 14742, 749, -290, 21 -dw -21, 34, -441, 1585, 14743, 755, -291, 21 -dw -21, 34, -440, 1578, 14744, 760, -292, 22 -dw -22, 34, -439, 1572, 14744, 765, -293, 22 -dw -22, 34, -438, 1566, 14745, 771, -294, 22 -dw -22, 34, -437, 1559, 14746, 776, -295, 22 -dw -22, 34, -436, 1553, 14747, 782, -296, 22 -dw -22, 33, -434, 1547, 14748, 787, -297, 22 -dw -22, 33, -433, 1541, 14748, 792, -298, 22 -dw -22, 33, -432, 1534, 14749, 798, -299, 22 -dw -22, 33, -431, 1528, 14750, 803, -300, 22 -dw -22, 33, -430, 1522, 14751, 809, -301, 22 -dw -22, 33, -429, 1516, 14751, 814, -302, 22 -dw -22, 33, -428, 1509, 14752, 819, -303, 22 -dw -22, 33, -427, 1503, 14753, 825, -304, 22 -dw -22, 33, -425, 1497, 14754, 830, -305, 23 -dw -22, 33, -424, 1491, 14754, 836, -306, 23 -dw -22, 32, -423, 1484, 14755, 841, -307, 23 -dw -22, 32, -422, 1478, 14756, 847, -308, 23 -dw -22, 32, -421, 1472, 14756, 852, -309, 23 -dw -22, 32, -420, 1466, 14757, 858, -310, 23 -dw -22, 32, -419, 1460, 14758, 863, -311, 23 -dw -22, 32, -418, 1453, 14758, 869, -312, 23 -dw -22, 32, -417, 1447, 14759, 874, -313, 23 -dw -22, 32, -415, 1441, 14760, 880, -314, 23 -dw -22, 32, -414, 1435, 14760, 885, -315, 23 -dw -22, 32, -413, 1429, 14761, 891, -316, 23 -dw -22, 31, -412, 1423, 14761, 896, -317, 24 -dw -22, 31, -411, 1417, 14762, 902, -318, 24 -dw -23, 31, -410, 1410, 14762, 908, -319, 24 -dw -23, 31, -409, 1404, 14763, 913, -320, 24 -dw -23, 31, -408, 1398, 14763, 919, -321, 24 -dw -23, 31, -407, 1392, 14764, 924, -322, 24 -dw -23, 31, -406, 1386, 14764, 930, -323, 24 -dw -23, 31, -404, 1380, 14765, 935, -324, 24 -dw -23, 31, -403, 1374, 14765, 941, -325, 24 -dw -23, 31, -402, 1368, 14766, 947, -326, 24 -dw -23, 31, -401, 1362, 14766, 952, -327, 24 -dw -23, 30, -400, 1355, 14767, 958, -328, 24 -dw -23, 30, -399, 1349, 14767, 963, -329, 24 -dw -23, 30, -398, 1343, 14768, 969, -330, 25 -dw -23, 30, -397, 1337, 14768, 975, -331, 25 -dw -23, 30, -396, 1331, 14768, 980, -332, 25 -dw -23, 30, -395, 1325, 14769, 986, -333, 25 -dw -23, 30, -394, 1319, 14769, 992, -334, 25 -dw -23, 30, -392, 1313, 14769, 997, -335, 25 -dw -23, 30, -391, 1307, 14770, 1003, -336, 25 -dw -23, 30, -390, 1301, 14770, 1009, -337, 25 -dw -23, 30, -389, 1295, 14770, 1014, -338, 25 -dw -23, 29, -388, 1289, 14771, 1020, -339, 25 -dw -23, 29, -387, 1283, 14771, 1026, -340, 25 -dw -23, 29, -386, 1277, 14771, 1031, -341, 26 -dw -23, 29, -385, 1271, 14772, 1037, -342, 26 -dw -23, 29, -384, 1265, 14772, 1043, -343, 26 -dw -23, 29, -383, 1259, 14772, 1049, -345, 26 -dw -23, 29, -382, 1253, 14772, 1054, -346, 26 -dw -24, 29, -381, 1247, 14773, 1060, -347, 26 -dw -24, 29, -379, 1241, 14773, 1066, -348, 26 -dw -24, 29, -378, 1235, 14773, 1072, -349, 26 -dw -24, 28, -377, 1229, 14773, 1077, -350, 26 -dw -24, 28, -376, 1223, 14773, 1083, -351, 26 -dw -24, 28, -375, 1218, 14774, 1089, -352, 26 -dw -24, 28, -374, 1212, 14774, 1095, -353, 26 -dw -24, 28, -373, 1206, 14774, 1100, -354, 27 -dw -24, 28, -372, 1200, 14774, 1106, -355, 27 -dw -24, 28, -371, 1194, 14774, 1112, -356, 27 -dw -24, 28, -370, 1188, 14774, 1118, -357, 27 -dw -24, 28, -369, 1182, 14774, 1124, -358, 27 -dw -24, 28, -368, 1176, 14774, 1129, -359, 27 -dw -24, 28, -367, 1170, 14774, 1135, -360, 27 -dw -24, 28, -366, 1165, 14775, 1141, -361, 27 -dw -24, 27, -365, 1159, 14775, 1147, -362, 27 -dw -24, 27, -363, 1153, 14775, 1153, -363, 27 - -fir_lut_co: -dw 0, 0, 0, 0, 16384, 0, 0, 0 -dw -17, 33, -574, 2091, 13301, 2091, -574, 33 -dw -10, 30, -605, 2355, 12835, 2355, -605, 30 -dw -4, 27, -615, 2517, 12531, 2517, -615, 27 -dw 0, 24, -618, 2635, 12301, 2635, -618, 24 -dw 4, 21, -616, 2728, 12114, 2728, -616, 21 -dw 7, 19, -612, 2805, 11956, 2805, -612, 19 -dw 9, 16, -607, 2869, 11818, 2869, -607, 16 -dw 11, 14, -601, 2926, 11695, 2926, -601, 14 -dw 13, 12, -595, 2975, 11585, 2975, -595, 12 -dw 15, 10, -588, 3019, 11485, 3019, -588, 10 -dw 16, 9, -580, 3059, 11392, 3059, -580, 9 -dw 18, 7, -573, 3096, 11307, 3096, -573, 7 -dw 19, 5, -566, 3129, 11227, 3129, -566, 5 -dw 20, 4, -558, 3160, 11153, 3160, -558, 4 -dw 21, 2, -550, 3188, 11083, 3188, -550, 2 -dw 21, 1, -543, 3215, 11017, 3215, -543, 1 -dw 22, 0, -535, 3240, 10954, 3240, -535, 0 -dw 23, -1, -528, 3263, 10894, 3263, -528, -1 -dw 23, -3, -520, 3285, 10837, 3285, -520, -3 -dw 24, -4, -513, 3305, 10783, 3305, -513, -4 -dw 24, -5, -506, 3325, 10731, 3325, -506, -5 -dw 24, -6, -498, 3344, 10681, 3344, -498, -6 -dw 25, -7, -491, 3361, 10633, 3361, -491, -7 -dw 25, -8, -484, 3378, 10587, 3378, -484, -8 -dw 25, -9, -477, 3394, 10542, 3394, -477, -9 -dw 25, -10, -470, 3409, 10499, 3409, -470, -10 -dw 25, -10, -463, 3424, 10458, 3424, -463, -10 -dw 25, -11, -456, 3438, 10418, 3438, -456, -11 -dw 25, -12, -449, 3451, 10379, 3451, -449, -12 -dw 25, -13, -443, 3464, 10341, 3464, -443, -13 -dw 26, -13, -436, 3477, 10304, 3477, -436, -13 -dw 25, -14, -429, 3489, 10268, 3489, -429, -14 -dw 25, -15, -423, 3500, 10234, 3500, -423, -15 -dw 25, -16, -416, 3511, 10200, 3511, -416, -16 -dw 25, -16, -410, 3522, 10167, 3522, -410, -16 -dw 25, -17, -404, 3532, 10135, 3532, -404, -17 -dw 25, -17, -398, 3542, 10104, 3542, -398, -17 -dw 25, -18, -391, 3552, 10073, 3552, -391, -18 -dw 25, -19, -385, 3561, 10044, 3561, -385, -19 -dw 25, -19, -379, 3571, 10015, 3571, -379, -19 -dw 25, -20, -373, 3579, 9986, 3579, -373, -20 -dw 24, -20, -367, 3588, 9958, 3588, -367, -20 -dw 24, -21, -361, 3596, 9931, 3596, -361, -21 -dw 24, -21, -356, 3604, 9904, 3604, -356, -21 -dw 24, -22, -350, 3612, 9878, 3612, -350, -22 -dw 24, -22, -344, 3620, 9853, 3620, -344, -22 -dw 23, -22, -338, 3627, 9828, 3627, -338, -22 -dw 23, -23, -333, 3635, 9803, 3635, -333, -23 -dw 23, -23, -327, 3642, 9779, 3642, -327, -23 -dw 23, -24, -322, 3649, 9755, 3649, -322, -24 -dw 22, -24, -316, 3655, 9732, 3655, -316, -24 -dw 22, -24, -311, 3662, 9709, 3662, -311, -24 -dw 22, -25, -306, 3668, 9687, 3668, -306, -25 -dw 22, -25, -300, 3674, 9665, 3674, -300, -25 -dw 21, -26, -295, 3680, 9643, 3680, -295, -26 -dw 21, -26, -290, 3686, 9621, 3686, -290, -26 -dw 21, -26, -285, 3692, 9601, 3692, -285, -26 -dw 21, -27, -280, 3698, 9580, 3698, -280, -27 -dw 20, -27, -274, 3703, 9560, 3703, -274, -27 -dw 20, -27, -269, 3709, 9540, 3709, -269, -27 -dw 20, -27, -264, 3714, 9520, 3714, -264, -27 -dw 19, -28, -259, 3719, 9501, 3719, -259, -28 -dw 19, -28, -255, 3724, 9481, 3724, -255, -28 -dw 19, -28, -250, 3729, 9463, 3729, -250, -28 -dw 18, -29, -245, 3734, 9444, 3734, -245, -29 -dw 18, -29, -240, 3739, 9426, 3739, -240, -29 -dw 18, -29, -235, 3744, 9408, 3744, -235, -29 -dw 18, -29, -231, 3748, 9390, 3748, -231, -29 -dw 17, -29, -226, 3753, 9372, 3753, -226, -29 -dw 17, -30, -221, 3757, 9355, 3757, -221, -30 -dw 17, -30, -217, 3761, 9338, 3761, -217, -30 -dw 16, -30, -212, 3765, 9321, 3765, -212, -30 -dw 16, -30, -208, 3770, 9305, 3770, -208, -30 -dw 16, -31, -203, 3774, 9288, 3774, -203, -31 -dw 15, -31, -199, 3778, 9272, 3778, -199, -31 -dw 15, -31, -194, 3782, 9256, 3782, -194, -31 -dw 15, -31, -190, 3785, 9240, 3785, -190, -31 -dw 15, -31, -185, 3789, 9225, 3789, -185, -31 -dw 14, -31, -181, 3793, 9209, 3793, -181, -31 -dw 14, -32, -177, 3797, 9194, 3797, -177, -32 -dw 14, -32, -173, 3800, 9179, 3800, -173, -32 -dw 13, -32, -168, 3804, 9164, 3804, -168, -32 -dw 13, -32, -164, 3807, 9149, 3807, -164, -32 -dw 13, -32, -160, 3810, 9135, 3810, -160, -32 -dw 12, -32, -156, 3814, 9121, 3814, -156, -32 -dw 12, -33, -152, 3817, 9106, 3817, -152, -33 -dw 12, -33, -148, 3820, 9092, 3820, -148, -33 -dw 11, -33, -144, 3823, 9078, 3823, -144, -33 -dw 11, -33, -139, 3827, 9065, 3827, -139, -33 -dw 11, -33, -135, 3830, 9051, 3830, -135, -33 -dw 11, -33, -131, 3833, 9038, 3833, -131, -33 -dw 10, -33, -128, 3836, 9024, 3836, -128, -33 -dw 10, -33, -124, 3839, 9011, 3839, -124, -33 -dw 10, -34, -120, 3841, 8998, 3841, -120, -34 -dw 9, -34, -116, 3844, 8985, 3844, -116, -34 -dw 9, -34, -112, 3847, 8972, 3847, -112, -34 -dw 9, -34, -108, 3850, 8960, 3850, -108, -34 -dw 8, -34, -104, 3852, 8947, 3852, -104, -34 -dw 8, -34, -101, 3855, 8935, 3855, -101, -34 -dw 8, -34, -97, 3858, 8923, 3858, -97, -34 -dw 8, -34, -93, 3860, 8910, 3860, -93, -34 -dw 7, -34, -89, 3863, 8898, 3863, -89, -34 -dw 7, -34, -86, 3865, 8886, 3865, -86, -34 -dw 7, -34, -82, 3868, 8875, 3868, -82, -34 -dw 6, -35, -78, 3870, 8863, 3870, -78, -35 -dw 6, -35, -75, 3873, 8851, 3873, -75, -35 -dw 6, -35, -71, 3875, 8840, 3875, -71, -35 -dw 6, -35, -68, 3877, 8828, 3877, -68, -35 -dw 5, -35, -64, 3880, 8817, 3880, -64, -35 -dw 5, -35, -60, 3882, 8806, 3882, -60, -35 -dw 5, -35, -57, 3884, 8795, 3884, -57, -35 -dw 4, -35, -53, 3886, 8784, 3886, -53, -35 -dw 4, -35, -50, 3888, 8773, 3888, -50, -35 -dw 4, -35, -46, 3891, 8762, 3891, -46, -35 -dw 4, -35, -43, 3893, 8751, 3893, -43, -35 -dw 3, -35, -40, 3895, 8741, 3895, -40, -35 -dw 3, -35, -36, 3897, 8730, 3897, -36, -35 -dw 3, -35, -33, 3899, 8720, 3899, -33, -35 -dw 2, -35, -29, 3901, 8709, 3901, -29, -35 -dw 2, -35, -26, 3903, 8699, 3903, -26, -35 -dw 2, -35, -23, 3905, 8689, 3905, -23, -35 -dw 2, -35, -20, 3907, 8679, 3907, -20, -35 -dw 1, -35, -16, 3909, 8669, 3909, -16, -35 -dw 1, -35, -13, 3910, 8659, 3910, -13, -35 -dw 1, -35, -10, 3912, 8649, 3912, -10, -35 -dw 1, -35, -7, 3914, 8639, 3914, -7, -35 -dw 0, -35, -3, 3916, 8630, 3916, -3, -35 -dw 0, -35, 0, 3918, 8620, 3918, 0, -35 -dw 0, -35, 3, 3919, 8610, 3919, 3, -35 -dw -1, -36, 6, 3921, 8601, 3921, 6, -36 -dw -1, -36, 9, 3923, 8591, 3923, 9, -36 -dw -1, -36, 13, 3924, 8582, 3924, 13, -36 -dw -1, -36, 16, 3926, 8573, 3926, 16, -36 -dw -2, -36, 19, 3928, 8564, 3928, 19, -36 -dw -2, -36, 22, 3929, 8554, 3929, 22, -36 -dw -2, -36, 25, 3931, 8545, 3931, 25, -36 -dw -2, -36, 28, 3933, 8536, 3933, 28, -36 -dw -3, -36, 31, 3934, 8527, 3934, 31, -36 -dw -3, -36, 34, 3936, 8519, 3936, 34, -36 -dw -3, -36, 37, 3937, 8510, 3937, 37, -36 -dw -3, -36, 40, 3939, 8501, 3939, 40, -36 -dw -4, -36, 43, 3940, 8492, 3940, 43, -36 -dw -4, -36, 46, 3942, 8484, 3942, 46, -36 -dw -4, -36, 49, 3943, 8475, 3943, 49, -36 -dw -4, -35, 52, 3945, 8467, 3945, 52, -35 -dw -4, -35, 55, 3946, 8458, 3946, 55, -35 -dw -5, -35, 58, 3947, 8450, 3947, 58, -35 -dw -5, -35, 60, 3949, 8441, 3949, 60, -35 -dw -5, -35, 63, 3950, 8433, 3950, 63, -35 -dw -5, -35, 66, 3951, 8425, 3951, 66, -35 -dw -6, -35, 69, 3953, 8417, 3953, 69, -35 -dw -6, -35, 72, 3954, 8409, 3954, 72, -35 -dw -6, -35, 75, 3955, 8401, 3955, 75, -35 -dw -6, -35, 77, 3957, 8393, 3957, 77, -35 -dw -7, -35, 80, 3958, 8385, 3958, 80, -35 -dw -7, -35, 83, 3959, 8377, 3959, 83, -35 -dw -7, -35, 86, 3961, 8369, 3961, 86, -35 -dw -7, -35, 89, 3962, 8361, 3962, 89, -35 -dw -7, -35, 91, 3963, 8353, 3963, 91, -35 -dw -8, -35, 94, 3964, 8346, 3964, 94, -35 -dw -8, -35, 97, 3965, 8338, 3965, 97, -35 -dw -8, -35, 99, 3967, 8330, 3967, 99, -35 -dw -8, -35, 102, 3968, 8323, 3968, 102, -35 -dw -8, -35, 105, 3969, 8315, 3969, 105, -35 -dw -9, -35, 107, 3970, 8308, 3970, 107, -35 -dw -9, -35, 110, 3971, 8300, 3971, 110, -35 -dw -9, -35, 113, 3972, 8293, 3972, 113, -35 -dw -9, -35, 115, 3973, 8286, 3973, 115, -35 -dw -10, -35, 118, 3974, 8278, 3974, 118, -35 -dw -10, -35, 121, 3975, 8271, 3975, 121, -35 -dw -10, -35, 123, 3977, 8264, 3977, 123, -35 -dw -10, -35, 126, 3978, 8257, 3978, 126, -35 -dw -10, -35, 128, 3979, 8250, 3979, 128, -35 -dw -11, -35, 131, 3980, 8243, 3980, 131, -35 -dw -11, -35, 133, 3981, 8236, 3981, 133, -35 -dw -11, -35, 136, 3982, 8229, 3982, 136, -35 -dw -11, -34, 139, 3983, 8222, 3983, 139, -34 -dw -11, -34, 141, 3984, 8215, 3984, 141, -34 -dw -11, -34, 144, 3985, 8208, 3985, 144, -34 -dw -12, -34, 146, 3986, 8201, 3986, 146, -34 -dw -12, -34, 149, 3987, 8194, 3987, 149, -34 -dw -12, -34, 151, 3988, 8187, 3988, 151, -34 -dw -12, -34, 153, 3988, 8181, 3988, 153, -34 -dw -12, -34, 156, 3989, 8174, 3989, 156, -34 -dw -13, -34, 158, 3990, 8167, 3990, 158, -34 -dw -13, -34, 161, 3991, 8161, 3991, 161, -34 -dw -13, -34, 163, 3992, 8154, 3992, 163, -34 -dw -13, -34, 166, 3993, 8148, 3993, 166, -34 -dw -13, -34, 168, 3994, 8141, 3994, 168, -34 -dw -14, -34, 170, 3995, 8135, 3995, 170, -34 -dw -14, -34, 173, 3996, 8128, 3996, 173, -34 -dw -14, -34, 175, 3996, 8122, 3996, 175, -34 -dw -14, -34, 178, 3997, 8116, 3997, 178, -34 -dw -14, -34, 180, 3998, 8109, 3998, 180, -34 -dw -14, -33, 182, 3999, 8103, 3999, 182, -33 -dw -15, -33, 185, 4000, 8097, 4000, 185, -33 -dw -15, -33, 187, 4001, 8090, 4001, 187, -33 -dw -15, -33, 189, 4001, 8084, 4001, 189, -33 -dw -15, -33, 191, 4002, 8078, 4002, 191, -33 -dw -15, -33, 194, 4003, 8072, 4003, 194, -33 -dw -15, -33, 196, 4004, 8066, 4004, 196, -33 -dw -16, -33, 198, 4005, 8060, 4005, 198, -33 -dw -16, -33, 201, 4005, 8054, 4005, 201, -33 -dw -16, -33, 203, 4006, 8048, 4006, 203, -33 -dw -16, -33, 205, 4007, 8042, 4007, 205, -33 -dw -16, -33, 207, 4008, 8036, 4008, 207, -33 -dw -16, -33, 210, 4008, 8030, 4008, 210, -33 -dw -16, -33, 212, 4009, 8024, 4009, 212, -33 -dw -17, -33, 214, 4010, 8018, 4010, 214, -33 -dw -17, -32, 216, 4010, 8012, 4010, 216, -32 -dw -17, -32, 218, 4011, 8007, 4011, 218, -32 -dw -17, -32, 221, 4012, 8001, 4012, 221, -32 -dw -17, -32, 223, 4012, 7995, 4012, 223, -32 -dw -17, -32, 225, 4013, 7989, 4013, 225, -32 -dw -18, -32, 227, 4014, 7984, 4014, 227, -32 -dw -18, -32, 229, 4015, 7978, 4015, 229, -32 -dw -18, -32, 231, 4015, 7972, 4015, 231, -32 -dw -18, -32, 234, 4016, 7967, 4016, 234, -32 -dw -18, -32, 236, 4016, 7961, 4016, 236, -32 -dw -18, -32, 238, 4017, 7956, 4017, 238, -32 -dw -18, -32, 240, 4018, 7950, 4018, 240, -32 -dw -19, -32, 242, 4018, 7945, 4018, 242, -32 -dw -19, -32, 244, 4019, 7939, 4019, 244, -32 -dw -19, -31, 246, 4020, 7934, 4020, 246, -31 -dw -19, -31, 248, 4020, 7928, 4020, 248, -31 -dw -19, -31, 250, 4021, 7923, 4021, 250, -31 -dw -19, -31, 253, 4021, 7918, 4021, 253, -31 -dw -19, -31, 255, 4022, 7912, 4022, 255, -31 -dw -19, -31, 257, 4023, 7907, 4023, 257, -31 -dw -20, -31, 259, 4023, 7902, 4023, 259, -31 -dw -20, -31, 261, 4024, 7896, 4024, 261, -31 -dw -20, -31, 263, 4024, 7891, 4024, 263, -31 -dw -20, -31, 265, 4025, 7886, 4025, 265, -31 -dw -20, -31, 267, 4025, 7881, 4025, 267, -31 -dw -20, -31, 269, 4026, 7875, 4026, 269, -31 -dw -20, -30, 271, 4027, 7870, 4027, 271, -30 -dw -20, -30, 273, 4027, 7865, 4027, 273, -30 -dw -21, -30, 275, 4028, 7860, 4028, 275, -30 -dw -21, -30, 277, 4028, 7855, 4028, 277, -30 -dw -21, -30, 279, 4029, 7850, 4029, 279, -30 -dw -21, -30, 281, 4029, 7845, 4029, 281, -30 -dw -21, -30, 283, 4030, 7840, 4030, 283, -30 -dw -21, -30, 285, 4030, 7835, 4030, 285, -30 -dw -21, -30, 287, 4031, 7830, 4031, 287, -30 -dw -21, -30, 289, 4031, 7825, 4031, 289, -30 -dw -22, -30, 291, 4032, 7820, 4032, 291, -30 -dw -22, -30, 293, 4032, 7815, 4032, 293, -30 -dw -22, -29, 294, 4033, 7810, 4033, 294, -29 -dw -22, -29, 296, 4033, 7805, 4033, 296, -29 -dw -22, -29, 298, 4034, 7801, 4034, 298, -29 -dw -22, -29, 300, 4034, 7796, 4034, 300, -29 -dw -22, -29, 302, 4035, 7791, 4035, 302, -29 -dw -22, -29, 304, 4035, 7786, 4035, 304, -29 -dw -22, -29, 306, 4036, 7781, 4036, 306, -29 -dw -23, -29, 308, 4036, 7777, 4036, 308, -29 -dw -23, -29, 310, 4037, 7772, 4037, 310, -29 -dw -23, -29, 311, 4037, 7767, 4037, 311, -29 -dw -23, -29, 313, 4037, 7762, 4037, 313, -29 -dw -23, -28, 315, 4038, 7758, 4038, 315, -28 -dw -23, -28, 317, 4038, 7753, 4038, 317, -28 -dw -23, -28, 319, 4039, 7749, 4039, 319, -28 -dw -23, -28, 321, 4039, 7744, 4039, 321, -28 -dw -23, -28, 323, 4040, 7739, 4040, 323, -28 -dw -23, -28, 324, 4040, 7735, 4040, 324, -28 -dw -24, -28, 326, 4040, 7730, 4040, 326, -28 -dw -24, -28, 328, 4041, 7726, 4041, 328, -28 -dw -24, -28, 330, 4041, 7721, 4041, 330, -28 -dw -24, -28, 332, 4042, 7717, 4042, 332, -28 -dw -24, -28, 333, 4042, 7712, 4042, 333, -28 -dw -24, -27, 335, 4042, 7708, 4042, 335, -27 -dw -24, -27, 337, 4043, 7703, 4043, 337, -27 -dw -24, -27, 339, 4043, 7699, 4043, 339, -27 -dw -24, -27, 340, 4044, 7694, 4044, 340, -27 -dw -24, -27, 342, 4044, 7690, 4044, 342, -27 -dw -24, -27, 344, 4044, 7686, 4044, 344, -27 -dw -25, -27, 346, 4045, 7681, 4045, 346, -27 -dw -25, -27, 348, 4045, 7677, 4045, 348, -27 -dw -25, -27, 349, 4046, 7673, 4046, 349, -27 -dw -25, -27, 351, 4046, 7668, 4046, 351, -27 -dw -25, -27, 353, 4046, 7664, 4046, 353, -27 -dw -25, -26, 354, 4047, 7660, 4047, 354, -26 -dw -25, -26, 356, 4047, 7655, 4047, 356, -26 -dw -25, -26, 358, 4047, 7651, 4047, 358, -26 -dw -25, -26, 360, 4048, 7647, 4048, 360, -26 -dw -25, -26, 361, 4048, 7643, 4048, 361, -26 -dw -25, -26, 363, 4048, 7639, 4048, 363, -26 -dw -25, -26, 365, 4049, 7634, 4049, 365, -26 -dw -26, -26, 366, 4049, 7630, 4049, 366, -26 -dw -26, -26, 368, 4049, 7626, 4049, 368, -26 -dw -26, -26, 370, 4050, 7622, 4050, 370, -26 -dw -26, -25, 371, 4050, 7618, 4050, 371, -25 -dw -26, -25, 373, 4050, 7614, 4050, 373, -25 -dw -26, -25, 375, 4051, 7610, 4051, 375, -25 -dw -26, -25, 376, 4051, 7606, 4051, 376, -25 -dw -26, -25, 378, 4051, 7601, 4051, 378, -25 -dw -26, -25, 380, 4052, 7597, 4052, 380, -25 -dw -26, -25, 381, 4052, 7593, 4052, 381, -25 -dw -26, -25, 383, 4052, 7589, 4052, 383, -25 -dw -26, -25, 385, 4052, 7585, 4052, 385, -25 -dw -26, -25, 386, 4053, 7581, 4053, 386, -25 -dw -26, -24, 388, 4053, 7577, 4053, 388, -24 -dw -27, -24, 390, 4053, 7574, 4053, 390, -24 -dw -27, -24, 391, 4054, 7570, 4054, 391, -24 -dw -27, -24, 393, 4054, 7566, 4054, 393, -24 -dw -27, -24, 394, 4054, 7562, 4054, 394, -24 -dw -27, -24, 396, 4055, 7558, 4055, 396, -24 -dw -27, -24, 398, 4055, 7554, 4055, 398, -24 -dw -27, -24, 399, 4055, 7550, 4055, 399, -24 -dw -27, -24, 401, 4055, 7546, 4055, 401, -24 -dw -27, -24, 402, 4056, 7542, 4056, 402, -24 -dw -27, -23, 404, 4056, 7539, 4056, 404, -23 -dw -27, -23, 405, 4056, 7535, 4056, 405, -23 -dw -27, -23, 407, 4056, 7531, 4056, 407, -23 -dw -27, -23, 409, 4057, 7527, 4057, 409, -23 -dw -27, -23, 410, 4057, 7523, 4057, 410, -23 -dw -27, -23, 412, 4057, 7520, 4057, 412, -23 -dw -27, -23, 413, 4057, 7516, 4057, 413, -23 -dw -28, -23, 415, 4058, 7512, 4058, 415, -23 -dw -28, -23, 416, 4058, 7508, 4058, 416, -23 -dw -28, -23, 418, 4058, 7505, 4058, 418, -23 -dw -28, -22, 419, 4058, 7501, 4058, 419, -22 -dw -28, -22, 421, 4059, 7497, 4059, 421, -22 -dw -28, -22, 422, 4059, 7494, 4059, 422, -22 -dw -28, -22, 424, 4059, 7490, 4059, 424, -22 -dw -28, -22, 425, 4059, 7486, 4059, 425, -22 -dw -28, -22, 427, 4060, 7483, 4060, 427, -22 -dw -28, -22, 428, 4060, 7479, 4060, 428, -22 -dw -28, -22, 430, 4060, 7475, 4060, 430, -22 -dw -28, -22, 431, 4060, 7472, 4060, 431, -22 -dw -28, -22, 433, 4061, 7468, 4061, 433, -22 -dw -28, -21, 434, 4061, 7465, 4061, 434, -21 -dw -28, -21, 436, 4061, 7461, 4061, 436, -21 -dw -28, -21, 437, 4061, 7458, 4061, 437, -21 -dw -28, -21, 439, 4061, 7454, 4061, 439, -21 -dw -28, -21, 440, 4062, 7450, 4062, 440, -21 -dw -28, -21, 442, 4062, 7447, 4062, 442, -21 -dw -28, -21, 443, 4062, 7443, 4062, 443, -21 -dw -28, -21, 445, 4062, 7440, 4062, 445, -21 -dw -29, -21, 446, 4062, 7436, 4062, 446, -21 -dw -29, -21, 448, 4063, 7433, 4063, 448, -21 -dw -29, -20, 449, 4063, 7430, 4063, 449, -20 -dw -29, -20, 451, 4063, 7426, 4063, 451, -20 -dw -29, -20, 452, 4063, 7423, 4063, 452, -20 -dw -29, -20, 453, 4063, 7419, 4063, 453, -20 -dw -29, -20, 455, 4064, 7416, 4064, 455, -20 -dw -29, -20, 456, 4064, 7412, 4064, 456, -20 -dw -29, -20, 458, 4064, 7409, 4064, 458, -20 -dw -29, -20, 459, 4064, 7406, 4064, 459, -20 -dw -29, -20, 461, 4064, 7402, 4064, 461, -20 -dw -29, -20, 462, 4065, 7399, 4065, 462, -20 -dw -29, -19, 463, 4065, 7396, 4065, 463, -19 -dw -29, -19, 465, 4065, 7392, 4065, 465, -19 -dw -29, -19, 466, 4065, 7389, 4065, 466, -19 -dw -29, -19, 468, 4065, 7386, 4065, 468, -19 -dw -29, -19, 469, 4065, 7382, 4065, 469, -19 -dw -29, -19, 470, 4066, 7379, 4066, 470, -19 -dw -29, -19, 472, 4066, 7376, 4066, 472, -19 -dw -29, -19, 473, 4066, 7372, 4066, 473, -19 -dw -29, -19, 474, 4066, 7369, 4066, 474, -19 -dw -29, -18, 476, 4066, 7366, 4066, 476, -18 -dw -29, -18, 477, 4066, 7363, 4066, 477, -18 -dw -29, -18, 479, 4067, 7359, 4067, 479, -18 -dw -29, -18, 480, 4067, 7356, 4067, 480, -18 -dw -29, -18, 481, 4067, 7353, 4067, 481, -18 -dw -29, -18, 483, 4067, 7350, 4067, 483, -18 -dw -29, -18, 484, 4067, 7347, 4067, 484, -18 -dw -29, -18, 485, 4067, 7343, 4067, 485, -18 -dw -29, -18, 487, 4068, 7340, 4068, 487, -18 -dw -30, -18, 488, 4068, 7337, 4068, 488, -18 -dw -30, -17, 489, 4068, 7334, 4068, 489, -17 -dw -30, -17, 491, 4068, 7331, 4068, 491, -17 -dw -30, -17, 492, 4068, 7328, 4068, 492, -17 -dw -30, -17, 493, 4068, 7324, 4068, 493, -17 -dw -30, -17, 495, 4068, 7321, 4068, 495, -17 -dw -30, -17, 496, 4069, 7318, 4069, 496, -17 -dw -30, -17, 497, 4069, 7315, 4069, 497, -17 -dw -30, -17, 499, 4069, 7312, 4069, 499, -17 -dw -30, -17, 500, 4069, 7309, 4069, 500, -17 -dw -30, -16, 501, 4069, 7306, 4069, 501, -16 -dw -30, -16, 503, 4069, 7303, 4069, 503, -16 -dw -30, -16, 504, 4069, 7300, 4069, 504, -16 -dw -30, -16, 505, 4070, 7297, 4070, 505, -16 -dw -30, -16, 506, 4070, 7294, 4070, 506, -16 -dw -30, -16, 508, 4070, 7291, 4070, 508, -16 -dw -30, -16, 509, 4070, 7288, 4070, 509, -16 -dw -30, -16, 510, 4070, 7285, 4070, 510, -16 -dw -30, -16, 512, 4070, 7282, 4070, 512, -16 -dw -30, -16, 513, 4070, 7279, 4070, 513, -16 -dw -30, -15, 514, 4070, 7276, 4070, 514, -15 -dw -30, -15, 515, 4071, 7273, 4071, 515, -15 -dw -30, -15, 517, 4071, 7270, 4071, 517, -15 -dw -30, -15, 518, 4071, 7267, 4071, 518, -15 -dw -30, -15, 519, 4071, 7264, 4071, 519, -15 -dw -30, -15, 521, 4071, 7261, 4071, 521, -15 -dw -30, -15, 522, 4071, 7258, 4071, 522, -15 -dw -30, -15, 523, 4071, 7255, 4071, 523, -15 -dw -30, -15, 524, 4071, 7252, 4071, 524, -15 -dw -30, -15, 526, 4071, 7249, 4071, 526, -15 -dw -30, -14, 527, 4072, 7246, 4072, 527, -14 -dw -30, -14, 528, 4072, 7243, 4072, 528, -14 -dw -30, -14, 529, 4072, 7240, 4072, 529, -14 -dw -30, -14, 530, 4072, 7238, 4072, 530, -14 -dw -30, -14, 532, 4072, 7235, 4072, 532, -14 -dw -30, -14, 533, 4072, 7232, 4072, 533, -14 -dw -30, -14, 534, 4072, 7229, 4072, 534, -14 -dw -30, -14, 535, 4072, 7226, 4072, 535, -14 -dw -30, -14, 537, 4072, 7223, 4072, 537, -14 -dw -30, -13, 538, 4072, 7220, 4072, 538, -13 -dw -30, -13, 539, 4073, 7218, 4073, 539, -13 -dw -30, -13, 540, 4073, 7215, 4073, 540, -13 -dw -30, -13, 541, 4073, 7212, 4073, 541, -13 -dw -30, -13, 543, 4073, 7209, 4073, 543, -13 -dw -30, -13, 544, 4073, 7206, 4073, 544, -13 -dw -30, -13, 545, 4073, 7204, 4073, 545, -13 -dw -30, -13, 546, 4073, 7201, 4073, 546, -13 -dw -30, -13, 547, 4073, 7198, 4073, 547, -13 -dw -30, -13, 549, 4073, 7195, 4073, 549, -13 -dw -30, -12, 550, 4073, 7193, 4073, 550, -12 -dw -30, -12, 551, 4073, 7190, 4073, 551, -12 -dw -30, -12, 552, 4074, 7187, 4074, 552, -12 -dw -30, -12, 553, 4074, 7184, 4074, 553, -12 -dw -30, -12, 555, 4074, 7182, 4074, 555, -12 -dw -30, -12, 556, 4074, 7179, 4074, 556, -12 -dw -30, -12, 557, 4074, 7176, 4074, 557, -12 -dw -30, -12, 558, 4074, 7174, 4074, 558, -12 -dw -30, -12, 559, 4074, 7171, 4074, 559, -12 -dw -30, -11, 560, 4074, 7168, 4074, 560, -11 -dw -30, -11, 562, 4074, 7166, 4074, 562, -11 -dw -30, -11, 563, 4074, 7163, 4074, 563, -11 -dw -30, -11, 564, 4074, 7160, 4074, 564, -11 -dw -30, -11, 565, 4074, 7158, 4074, 565, -11 -dw -30, -11, 566, 4074, 7155, 4074, 566, -11 -dw -30, -11, 567, 4074, 7152, 4074, 567, -11 -dw -30, -11, 568, 4075, 7150, 4075, 568, -11 -dw -30, -11, 570, 4075, 7147, 4075, 570, -11 -dw -30, -11, 571, 4075, 7144, 4075, 571, -11 -dw -30, -10, 572, 4075, 7142, 4075, 572, -10 -dw -30, -10, 573, 4075, 7139, 4075, 573, -10 -dw -30, -10, 574, 4075, 7137, 4075, 574, -10 -dw -30, -10, 575, 4075, 7134, 4075, 575, -10 -dw -30, -10, 576, 4075, 7131, 4075, 576, -10 -dw -30, -10, 577, 4075, 7129, 4075, 577, -10 -dw -30, -10, 579, 4075, 7126, 4075, 579, -10 -dw -30, -10, 580, 4075, 7124, 4075, 580, -10 -dw -30, -10, 581, 4075, 7121, 4075, 581, -10 -dw -30, -10, 582, 4075, 7119, 4075, 582, -10 -dw -30, -9, 583, 4075, 7116, 4075, 583, -9 -dw -30, -9, 584, 4075, 7113, 4075, 584, -9 -dw -30, -9, 585, 4075, 7111, 4075, 585, -9 -dw -30, -9, 586, 4076, 7108, 4076, 586, -9 -dw -30, -9, 587, 4076, 7106, 4076, 587, -9 -dw -30, -9, 589, 4076, 7103, 4076, 589, -9 -dw -30, -9, 590, 4076, 7101, 4076, 590, -9 -dw -30, -9, 591, 4076, 7098, 4076, 591, -9 -dw -30, -9, 592, 4076, 7096, 4076, 592, -9 -dw -30, -8, 593, 4076, 7093, 4076, 593, -8 -dw -30, -8, 594, 4076, 7091, 4076, 594, -8 -dw -30, -8, 595, 4076, 7088, 4076, 595, -8 -dw -30, -8, 596, 4076, 7086, 4076, 596, -8 -dw -30, -8, 597, 4076, 7083, 4076, 597, -8 -dw -30, -8, 598, 4076, 7081, 4076, 598, -8 -dw -30, -8, 599, 4076, 7079, 4076, 599, -8 -dw -30, -8, 600, 4076, 7076, 4076, 600, -8 -dw -30, -8, 602, 4076, 7074, 4076, 602, -8 -dw -30, -8, 603, 4076, 7071, 4076, 603, -8 -dw -30, -7, 604, 4076, 7069, 4076, 604, -7 -dw -30, -7, 605, 4076, 7066, 4076, 605, -7 -dw -30, -7, 606, 4076, 7064, 4076, 606, -7 -dw -30, -7, 607, 4076, 7062, 4076, 607, -7 -dw -30, -7, 608, 4076, 7059, 4076, 608, -7 -dw -30, -7, 609, 4076, 7057, 4076, 609, -7 -dw -30, -7, 610, 4076, 7054, 4076, 610, -7 -dw -30, -7, 611, 4076, 7052, 4076, 611, -7 -dw -30, -7, 612, 4077, 7050, 4077, 612, -7 -dw -30, -7, 613, 4077, 7047, 4077, 613, -7 -dw -30, -6, 614, 4077, 7045, 4077, 614, -6 -dw -30, -6, 615, 4077, 7043, 4077, 615, -6 -dw -29, -6, 616, 4077, 7040, 4077, 616, -6 -dw -29, -6, 617, 4077, 7038, 4077, 617, -6 -dw -29, -6, 618, 4077, 7036, 4077, 618, -6 -dw -29, -6, 619, 4077, 7033, 4077, 619, -6 -dw -29, -6, 620, 4077, 7031, 4077, 620, -6 -dw -29, -6, 621, 4077, 7029, 4077, 621, -6 -dw -29, -6, 622, 4077, 7026, 4077, 622, -6 -dw -29, -5, 623, 4077, 7024, 4077, 623, -5 -dw -29, -5, 624, 4077, 7022, 4077, 624, -5 -dw -29, -5, 625, 4077, 7019, 4077, 625, -5 -dw -29, -5, 626, 4077, 7017, 4077, 626, -5 -dw -29, -5, 627, 4077, 7015, 4077, 627, -5 -dw -29, -5, 628, 4077, 7012, 4077, 628, -5 -dw -29, -5, 629, 4077, 7010, 4077, 629, -5 -dw -29, -5, 630, 4077, 7008, 4077, 630, -5 -dw -29, -5, 631, 4077, 7006, 4077, 631, -5 -dw -29, -5, 632, 4077, 7003, 4077, 632, -5 -dw -29, -4, 633, 4077, 7001, 4077, 633, -4 -dw -29, -4, 634, 4077, 6999, 4077, 634, -4 -dw -29, -4, 635, 4077, 6997, 4077, 635, -4 -dw -29, -4, 636, 4077, 6994, 4077, 636, -4 -dw -29, -4, 637, 4077, 6992, 4077, 637, -4 -dw -29, -4, 638, 4077, 6990, 4077, 638, -4 -dw -29, -4, 639, 4077, 6988, 4077, 639, -4 -dw -29, -4, 640, 4077, 6985, 4077, 640, -4 -dw -29, -4, 641, 4077, 6983, 4077, 641, -4 -dw -29, -4, 642, 4077, 6981, 4077, 642, -4 -dw -29, -3, 643, 4077, 6979, 4077, 643, -3 -dw -29, -3, 644, 4077, 6977, 4077, 644, -3 -dw -29, -3, 645, 4077, 6974, 4077, 645, -3 -dw -29, -3, 646, 4077, 6972, 4077, 646, -3 -dw -29, -3, 647, 4077, 6970, 4077, 647, -3 -dw -29, -3, 648, 4077, 6968, 4077, 648, -3 -dw -29, -3, 649, 4077, 6966, 4077, 649, -3 -dw -29, -3, 650, 4077, 6963, 4077, 650, -3 -dw -29, -3, 651, 4077, 6961, 4077, 651, -3 -dw -29, -3, 652, 4077, 6959, 4077, 652, -3 -dw -29, -2, 653, 4077, 6957, 4077, 653, -2 -dw -29, -2, 654, 4077, 6955, 4077, 654, -2 -dw -28, -2, 655, 4077, 6953, 4077, 655, -2 -dw -28, -2, 656, 4077, 6951, 4077, 656, -2 -dw -28, -2, 657, 4077, 6948, 4077, 657, -2 -dw -28, -2, 658, 4077, 6946, 4077, 658, -2 -dw -28, -2, 659, 4077, 6944, 4077, 659, -2 -dw -28, -2, 660, 4077, 6942, 4077, 660, -2 -dw -28, -2, 661, 4077, 6940, 4077, 661, -2 -dw -28, -2, 661, 4077, 6938, 4077, 661, -2 -dw -28, -1, 662, 4077, 6936, 4077, 662, -1 -dw -28, -1, 663, 4077, 6934, 4077, 663, -1 -dw -28, -1, 664, 4077, 6931, 4077, 664, -1 -dw -28, -1, 665, 4077, 6929, 4077, 665, -1 -dw -28, -1, 666, 4077, 6927, 4077, 666, -1 -dw -28, -1, 667, 4077, 6925, 4077, 667, -1 -dw -28, -1, 668, 4077, 6923, 4077, 668, -1 -dw -28, -1, 669, 4077, 6921, 4077, 669, -1 -dw -28, -1, 670, 4077, 6919, 4077, 670, -1 -dw -28, -1, 671, 4077, 6917, 4077, 671, -1 -dw -28, 0, 672, 4077, 6915, 4077, 672, 0 -dw -28, 0, 673, 4077, 6913, 4077, 673, 0 -dw -28, 0, 673, 4077, 6911, 4077, 673, 0 -dw -28, 0, 674, 4077, 6909, 4077, 674, 0 -dw -28, 0, 675, 4077, 6907, 4077, 675, 0 -dw -28, 0, 676, 4077, 6905, 4077, 676, 0 -dw -28, 0, 677, 4077, 6903, 4077, 677, 0 -dw -28, 0, 678, 4077, 6901, 4077, 678, 0 -dw -28, 0, 679, 4077, 6899, 4077, 679, 0 -dw -28, 0, 680, 4077, 6897, 4077, 680, 0 -dw -27, 1, 681, 4077, 6895, 4077, 681, 1 -dw -27, 1, 682, 4077, 6893, 4077, 682, 1 -dw -27, 1, 683, 4077, 6891, 4077, 683, 1 -dw -27, 1, 683, 4077, 6889, 4077, 683, 1 -dw -27, 1, 684, 4077, 6887, 4077, 684, 1 -dw -27, 1, 685, 4077, 6885, 4077, 685, 1 -dw -27, 1, 686, 4077, 6883, 4077, 686, 1 -dw -27, 1, 687, 4077, 6881, 4077, 687, 1 -dw -27, 1, 688, 4077, 6879, 4077, 688, 1 -dw -27, 1, 689, 4077, 6877, 4077, 689, 1 -dw -27, 2, 690, 4077, 6875, 4077, 690, 2 -dw -27, 2, 690, 4077, 6873, 4077, 690, 2 -dw -27, 2, 691, 4077, 6871, 4077, 691, 2 -dw -27, 2, 692, 4077, 6869, 4077, 692, 2 -dw -27, 2, 693, 4077, 6867, 4077, 693, 2 -dw -27, 2, 694, 4077, 6865, 4077, 694, 2 -dw -27, 2, 695, 4077, 6863, 4077, 695, 2 -dw -27, 2, 696, 4077, 6861, 4077, 696, 2 -dw -27, 2, 697, 4077, 6859, 4077, 697, 2 -dw -27, 2, 697, 4077, 6857, 4077, 697, 2 -dw -27, 3, 698, 4077, 6855, 4077, 698, 3 -dw -27, 3, 699, 4077, 6853, 4077, 699, 3 -dw -27, 3, 700, 4077, 6851, 4077, 700, 3 -dw -27, 3, 701, 4077, 6849, 4077, 701, 3 -dw -26, 3, 702, 4077, 6847, 4077, 702, 3 -dw -26, 3, 703, 4077, 6846, 4077, 703, 3 -dw -26, 3, 703, 4077, 6844, 4077, 703, 3 -dw -26, 3, 704, 4077, 6842, 4077, 704, 3 -dw -26, 3, 705, 4077, 6840, 4077, 705, 3 -dw -26, 3, 706, 4077, 6838, 4077, 706, 3 -dw -26, 3, 707, 4077, 6836, 4077, 707, 3 -dw -26, 4, 708, 4077, 6834, 4077, 708, 4 -dw -26, 4, 709, 4077, 6832, 4077, 709, 4 -dw -26, 4, 709, 4077, 6830, 4077, 709, 4 -dw -26, 4, 710, 4077, 6829, 4077, 710, 4 -dw -26, 4, 711, 4077, 6827, 4077, 711, 4 -dw -26, 4, 712, 4077, 6825, 4077, 712, 4 -dw -26, 4, 713, 4077, 6823, 4077, 713, 4 -dw -26, 4, 714, 4077, 6821, 4077, 714, 4 -dw -26, 4, 714, 4077, 6819, 4077, 714, 4 -dw -26, 4, 715, 4076, 6817, 4076, 715, 4 -dw -26, 5, 716, 4076, 6816, 4076, 716, 5 -dw -26, 5, 717, 4076, 6814, 4076, 717, 5 -dw -26, 5, 718, 4076, 6812, 4076, 718, 5 -dw -26, 5, 719, 4076, 6810, 4076, 719, 5 -dw -26, 5, 719, 4076, 6808, 4076, 719, 5 -dw -25, 5, 720, 4076, 6806, 4076, 720, 5 -dw -25, 5, 721, 4076, 6805, 4076, 721, 5 -dw -25, 5, 722, 4076, 6803, 4076, 722, 5 -dw -25, 5, 723, 4076, 6801, 4076, 723, 5 -dw -25, 5, 723, 4076, 6799, 4076, 723, 5 -dw -25, 6, 724, 4076, 6797, 4076, 724, 6 -dw -25, 6, 725, 4076, 6796, 4076, 725, 6 -dw -25, 6, 726, 4076, 6794, 4076, 726, 6 -dw -25, 6, 727, 4076, 6792, 4076, 727, 6 -dw -25, 6, 728, 4076, 6790, 4076, 728, 6 -dw -25, 6, 728, 4076, 6788, 4076, 728, 6 -dw -25, 6, 729, 4076, 6787, 4076, 729, 6 -dw -25, 6, 730, 4076, 6785, 4076, 730, 6 -dw -25, 6, 731, 4076, 6783, 4076, 731, 6 -dw -25, 6, 732, 4076, 6781, 4076, 732, 6 -dw -25, 6, 732, 4076, 6779, 4076, 732, 6 -dw -25, 7, 733, 4076, 6778, 4076, 733, 7 -dw -25, 7, 734, 4076, 6776, 4076, 734, 7 -dw -25, 7, 735, 4076, 6774, 4076, 735, 7 -dw -25, 7, 735, 4076, 6772, 4076, 735, 7 -dw -24, 7, 736, 4076, 6771, 4076, 736, 7 -dw -24, 7, 737, 4076, 6769, 4076, 737, 7 -dw -24, 7, 738, 4076, 6767, 4076, 738, 7 -dw -24, 7, 739, 4076, 6765, 4076, 739, 7 -dw -24, 7, 739, 4076, 6764, 4076, 739, 7 -dw -24, 7, 740, 4075, 6762, 4075, 740, 7 -dw -24, 8, 741, 4075, 6760, 4075, 741, 8 -dw -24, 8, 742, 4075, 6759, 4075, 742, 8 -dw -24, 8, 743, 4075, 6757, 4075, 743, 8 -dw -24, 8, 743, 4075, 6755, 4075, 743, 8 -dw -24, 8, 744, 4075, 6753, 4075, 744, 8 -dw -24, 8, 745, 4075, 6752, 4075, 745, 8 -dw -24, 8, 746, 4075, 6750, 4075, 746, 8 -dw -24, 8, 746, 4075, 6748, 4075, 746, 8 -dw -24, 8, 747, 4075, 6747, 4075, 747, 8 -dw -24, 8, 748, 4075, 6745, 4075, 748, 8 -dw -24, 8, 749, 4075, 6743, 4075, 749, 8 -dw -24, 9, 750, 4075, 6741, 4075, 750, 9 -dw -24, 9, 750, 4075, 6740, 4075, 750, 9 -dw -23, 9, 751, 4075, 6738, 4075, 751, 9 -dw -23, 9, 752, 4075, 6736, 4075, 752, 9 -dw -23, 9, 753, 4075, 6735, 4075, 753, 9 -dw -23, 9, 753, 4075, 6733, 4075, 753, 9 -dw -23, 9, 754, 4075, 6731, 4075, 754, 9 -dw -23, 9, 755, 4075, 6730, 4075, 755, 9 -dw -23, 9, 756, 4075, 6728, 4075, 756, 9 -dw -23, 9, 756, 4075, 6726, 4075, 756, 9 -dw -23, 9, 757, 4075, 6725, 4075, 757, 9 -dw -23, 10, 758, 4075, 6723, 4075, 758, 10 -dw -23, 10, 759, 4075, 6721, 4075, 759, 10 -dw -23, 10, 759, 4074, 6720, 4074, 759, 10 -dw -23, 10, 760, 4074, 6718, 4074, 760, 10 -dw -23, 10, 761, 4074, 6716, 4074, 761, 10 -dw -23, 10, 762, 4074, 6715, 4074, 762, 10 -dw -23, 10, 762, 4074, 6713, 4074, 762, 10 -dw -23, 10, 763, 4074, 6712, 4074, 763, 10 -dw -23, 10, 764, 4074, 6710, 4074, 764, 10 -dw -22, 10, 765, 4074, 6708, 4074, 765, 10 -dw -22, 10, 765, 4074, 6707, 4074, 765, 10 -dw -22, 11, 766, 4074, 6705, 4074, 766, 11 -dw -22, 11, 767, 4074, 6703, 4074, 767, 11 -dw -22, 11, 767, 4074, 6702, 4074, 767, 11 -dw -22, 11, 768, 4074, 6700, 4074, 768, 11 -dw -22, 11, 769, 4074, 6699, 4074, 769, 11 -dw -22, 11, 770, 4074, 6697, 4074, 770, 11 -dw -22, 11, 770, 4074, 6695, 4074, 770, 11 -dw -22, 11, 771, 4074, 6694, 4074, 771, 11 -dw -22, 11, 772, 4074, 6692, 4074, 772, 11 -dw -22, 11, 773, 4074, 6691, 4074, 773, 11 -dw -22, 12, 773, 4074, 6689, 4074, 773, 12 -dw -22, 12, 774, 4074, 6687, 4074, 774, 12 -dw -22, 12, 775, 4074, 6686, 4074, 775, 12 -dw -22, 12, 775, 4073, 6684, 4073, 775, 12 -dw -22, 12, 776, 4073, 6683, 4073, 776, 12 -dw -22, 12, 777, 4073, 6681, 4073, 777, 12 -dw -21, 12, 778, 4073, 6679, 4073, 778, 12 -dw -21, 12, 778, 4073, 6678, 4073, 778, 12 -dw -21, 12, 779, 4073, 6676, 4073, 779, 12 -dw -21, 12, 780, 4073, 6675, 4073, 780, 12 -dw -21, 12, 780, 4073, 6673, 4073, 780, 12 -dw -21, 13, 781, 4073, 6672, 4073, 781, 13 -dw -21, 13, 782, 4073, 6670, 4073, 782, 13 -dw -21, 13, 783, 4073, 6669, 4073, 783, 13 -dw -21, 13, 783, 4073, 6667, 4073, 783, 13 -dw -21, 13, 784, 4073, 6665, 4073, 784, 13 -dw -21, 13, 785, 4073, 6664, 4073, 785, 13 -dw -21, 13, 785, 4073, 6662, 4073, 785, 13 -dw -21, 13, 786, 4073, 6661, 4073, 786, 13 -dw -21, 13, 787, 4073, 6659, 4073, 787, 13 -dw -21, 13, 787, 4073, 6658, 4073, 787, 13 -dw -21, 13, 788, 4073, 6656, 4073, 788, 13 -dw -20, 13, 789, 4073, 6655, 4073, 789, 13 -dw -20, 14, 790, 4072, 6653, 4072, 790, 14 -dw -20, 14, 790, 4072, 6652, 4072, 790, 14 -dw -20, 14, 791, 4072, 6650, 4072, 791, 14 -dw -20, 14, 792, 4072, 6649, 4072, 792, 14 -dw -20, 14, 792, 4072, 6647, 4072, 792, 14 -dw -20, 14, 793, 4072, 6646, 4072, 793, 14 -dw -20, 14, 794, 4072, 6644, 4072, 794, 14 -dw -20, 14, 794, 4072, 6643, 4072, 794, 14 -dw -20, 14, 795, 4072, 6641, 4072, 795, 14 -dw -20, 14, 796, 4072, 6640, 4072, 796, 14 -dw -20, 14, 796, 4072, 6638, 4072, 796, 14 -dw -20, 15, 797, 4072, 6637, 4072, 797, 15 -dw -20, 15, 798, 4072, 6635, 4072, 798, 15 -dw -20, 15, 798, 4072, 6634, 4072, 798, 15 -dw -20, 15, 799, 4072, 6632, 4072, 799, 15 -dw -20, 15, 800, 4072, 6631, 4072, 800, 15 -dw -19, 15, 801, 4072, 6629, 4072, 801, 15 -dw -19, 15, 801, 4072, 6628, 4072, 801, 15 -dw -19, 15, 802, 4071, 6626, 4071, 802, 15 -dw -19, 15, 803, 4071, 6625, 4071, 803, 15 -dw -19, 15, 803, 4071, 6623, 4071, 803, 15 -dw -19, 15, 804, 4071, 6622, 4071, 804, 15 -dw -19, 16, 805, 4071, 6620, 4071, 805, 16 -dw -19, 16, 805, 4071, 6619, 4071, 805, 16 -dw -19, 16, 806, 4071, 6617, 4071, 806, 16 -dw -19, 16, 807, 4071, 6616, 4071, 807, 16 -dw -19, 16, 807, 4071, 6615, 4071, 807, 16 -dw -19, 16, 808, 4071, 6613, 4071, 808, 16 -dw -19, 16, 809, 4071, 6612, 4071, 809, 16 -dw -19, 16, 809, 4071, 6610, 4071, 809, 16 -dw -19, 16, 810, 4071, 6609, 4071, 810, 16 -dw -18, 16, 811, 4071, 6607, 4071, 811, 16 -dw -18, 16, 811, 4071, 6606, 4071, 811, 16 -dw -18, 17, 812, 4071, 6604, 4071, 812, 17 -dw -18, 17, 812, 4071, 6603, 4071, 812, 17 -dw -18, 17, 813, 4071, 6602, 4071, 813, 17 -dw -18, 17, 814, 4070, 6600, 4070, 814, 17 -dw -18, 17, 814, 4070, 6599, 4070, 814, 17 -dw -18, 17, 815, 4070, 6597, 4070, 815, 17 -dw -18, 17, 816, 4070, 6596, 4070, 816, 17 -dw -18, 17, 816, 4070, 6594, 4070, 816, 17 -dw -18, 17, 817, 4070, 6593, 4070, 817, 17 -dw -18, 17, 818, 4070, 6592, 4070, 818, 17 -dw -18, 17, 818, 4070, 6590, 4070, 818, 17 -dw -18, 17, 819, 4070, 6589, 4070, 819, 17 -dw -18, 18, 820, 4070, 6587, 4070, 820, 18 -dw -18, 18, 820, 4070, 6586, 4070, 820, 18 -dw -17, 18, 821, 4070, 6585, 4070, 821, 18 -dw -17, 18, 822, 4070, 6583, 4070, 822, 18 -dw -17, 18, 822, 4070, 6582, 4070, 822, 18 -dw -17, 18, 823, 4070, 6580, 4070, 823, 18 -dw -17, 18, 823, 4070, 6579, 4070, 823, 18 -dw -17, 18, 824, 4070, 6578, 4070, 824, 18 -dw -17, 18, 825, 4069, 6576, 4069, 825, 18 -dw -17, 18, 825, 4069, 6575, 4069, 825, 18 -dw -17, 18, 826, 4069, 6573, 4069, 826, 18 -dw -17, 19, 827, 4069, 6572, 4069, 827, 19 -dw -17, 19, 827, 4069, 6571, 4069, 827, 19 -dw -17, 19, 828, 4069, 6569, 4069, 828, 19 -dw -17, 19, 829, 4069, 6568, 4069, 829, 19 -dw -17, 19, 829, 4069, 6567, 4069, 829, 19 -dw -17, 19, 830, 4069, 6565, 4069, 830, 19 -dw -16, 19, 830, 4069, 6564, 4069, 830, 19 -dw -16, 19, 831, 4069, 6563, 4069, 831, 19 -dw -16, 19, 832, 4069, 6561, 4069, 832, 19 -dw -16, 19, 832, 4069, 6560, 4069, 832, 19 -dw -16, 19, 833, 4069, 6558, 4069, 833, 19 -dw -16, 19, 834, 4069, 6557, 4069, 834, 19 -dw -16, 20, 834, 4069, 6556, 4069, 834, 20 -dw -16, 20, 835, 4068, 6554, 4068, 835, 20 -dw -16, 20, 835, 4068, 6553, 4068, 835, 20 -dw -16, 20, 836, 4068, 6552, 4068, 836, 20 -dw -16, 20, 837, 4068, 6550, 4068, 837, 20 -dw -16, 20, 837, 4068, 6549, 4068, 837, 20 -dw -16, 20, 838, 4068, 6548, 4068, 838, 20 -dw -16, 20, 838, 4068, 6546, 4068, 838, 20 -dw -16, 20, 839, 4068, 6545, 4068, 839, 20 -dw -15, 20, 840, 4068, 6544, 4068, 840, 20 -dw -15, 20, 840, 4068, 6542, 4068, 840, 20 -dw -15, 20, 841, 4068, 6541, 4068, 841, 20 -dw -15, 21, 841, 4068, 6540, 4068, 841, 21 -dw -15, 21, 842, 4068, 6538, 4068, 842, 21 -dw -15, 21, 843, 4068, 6537, 4068, 843, 21 -dw -15, 21, 843, 4068, 6536, 4068, 843, 21 -dw -15, 21, 844, 4067, 6534, 4067, 844, 21 -dw -15, 21, 844, 4067, 6533, 4067, 844, 21 -dw -15, 21, 845, 4067, 6532, 4067, 845, 21 -dw -15, 21, 846, 4067, 6531, 4067, 846, 21 -dw -15, 21, 846, 4067, 6529, 4067, 846, 21 -dw -15, 21, 847, 4067, 6528, 4067, 847, 21 -dw -15, 21, 847, 4067, 6527, 4067, 847, 21 -dw -14, 21, 848, 4067, 6525, 4067, 848, 21 -dw -14, 22, 849, 4067, 6524, 4067, 849, 22 -dw -14, 22, 849, 4067, 6523, 4067, 849, 22 -dw -14, 22, 850, 4067, 6521, 4067, 850, 22 -dw -14, 22, 850, 4067, 6520, 4067, 850, 22 -dw -14, 22, 851, 4067, 6519, 4067, 851, 22 -dw -14, 22, 852, 4067, 6518, 4067, 852, 22 -dw -14, 22, 852, 4067, 6516, 4067, 852, 22 -dw -14, 22, 853, 4066, 6515, 4066, 853, 22 -dw -14, 22, 853, 4066, 6514, 4066, 853, 22 -dw -14, 22, 854, 4066, 6512, 4066, 854, 22 -dw -14, 22, 855, 4066, 6511, 4066, 855, 22 -dw -14, 22, 855, 4066, 6510, 4066, 855, 22 -dw -14, 23, 856, 4066, 6509, 4066, 856, 23 -dw -14, 23, 856, 4066, 6507, 4066, 856, 23 -dw -13, 23, 857, 4066, 6506, 4066, 857, 23 -dw -13, 23, 858, 4066, 6505, 4066, 858, 23 -dw -13, 23, 858, 4066, 6504, 4066, 858, 23 -dw -13, 23, 859, 4066, 6502, 4066, 859, 23 -dw -13, 23, 859, 4066, 6501, 4066, 859, 23 -dw -13, 23, 860, 4066, 6500, 4066, 860, 23 -dw -13, 23, 860, 4066, 6499, 4066, 860, 23 -dw -13, 23, 861, 4066, 6497, 4066, 861, 23 -dw -13, 23, 862, 4065, 6496, 4065, 862, 23 -dw -13, 23, 862, 4065, 6495, 4065, 862, 23 -dw -13, 24, 863, 4065, 6494, 4065, 863, 24 -dw -13, 24, 863, 4065, 6492, 4065, 863, 24 -dw -13, 24, 864, 4065, 6491, 4065, 864, 24 -dw -13, 24, 864, 4065, 6490, 4065, 864, 24 -dw -12, 24, 865, 4065, 6489, 4065, 865, 24 -dw -12, 24, 866, 4065, 6487, 4065, 866, 24 -dw -12, 24, 866, 4065, 6486, 4065, 866, 24 -dw -12, 24, 867, 4065, 6485, 4065, 867, 24 -dw -12, 24, 867, 4065, 6484, 4065, 867, 24 -dw -12, 24, 868, 4065, 6482, 4065, 868, 24 -dw -12, 24, 868, 4065, 6481, 4065, 868, 24 -dw -12, 24, 869, 4065, 6480, 4065, 869, 24 -dw -12, 25, 870, 4065, 6479, 4065, 870, 25 -dw -12, 25, 870, 4064, 6478, 4064, 870, 25 -dw -12, 25, 871, 4064, 6476, 4064, 871, 25 -dw -12, 25, 871, 4064, 6475, 4064, 871, 25 -dw -12, 25, 872, 4064, 6474, 4064, 872, 25 -dw -12, 25, 872, 4064, 6473, 4064, 872, 25 -dw -11, 25, 873, 4064, 6472, 4064, 873, 25 -dw -11, 25, 873, 4064, 6470, 4064, 873, 25 -dw -11, 25, 874, 4064, 6469, 4064, 874, 25 -dw -11, 25, 875, 4064, 6468, 4064, 875, 25 -dw -11, 25, 875, 4064, 6467, 4064, 875, 25 -dw -11, 25, 876, 4064, 6466, 4064, 876, 25 -dw -11, 25, 876, 4064, 6464, 4064, 876, 25 -dw -11, 26, 877, 4064, 6463, 4064, 877, 26 -dw -11, 26, 877, 4064, 6462, 4064, 877, 26 -dw -11, 26, 878, 4063, 6461, 4063, 878, 26 -dw -11, 26, 878, 4063, 6460, 4063, 878, 26 -dw -11, 26, 879, 4063, 6458, 4063, 879, 26 -dw -11, 26, 879, 4063, 6457, 4063, 879, 26 -dw -11, 26, 880, 4063, 6456, 4063, 880, 26 -dw -10, 26, 881, 4063, 6455, 4063, 881, 26 -dw -10, 26, 881, 4063, 6454, 4063, 881, 26 -dw -10, 26, 882, 4063, 6452, 4063, 882, 26 -dw -10, 26, 882, 4063, 6451, 4063, 882, 26 -dw -10, 26, 883, 4063, 6450, 4063, 883, 26 -dw -10, 27, 883, 4063, 6449, 4063, 883, 27 -dw -10, 27, 884, 4063, 6448, 4063, 884, 27 -dw -10, 27, 884, 4063, 6447, 4063, 884, 27 -dw -10, 27, 885, 4063, 6445, 4063, 885, 27 -dw -10, 27, 885, 4063, 6444, 4063, 885, 27 -dw -10, 27, 886, 4062, 6443, 4062, 886, 27 -dw -10, 27, 887, 4062, 6442, 4062, 887, 27 -dw -10, 27, 887, 4062, 6441, 4062, 887, 27 -dw -10, 27, 888, 4062, 6440, 4062, 888, 27 -dw -9, 27, 888, 4062, 6438, 4062, 888, 27 -dw -9, 27, 889, 4062, 6437, 4062, 889, 27 -dw -9, 27, 889, 4062, 6436, 4062, 889, 27 -dw -9, 27, 890, 4062, 6435, 4062, 890, 27 -dw -9, 28, 890, 4062, 6434, 4062, 890, 28 -dw -9, 28, 891, 4062, 6433, 4062, 891, 28 -dw -9, 28, 891, 4062, 6432, 4062, 891, 28 -dw -9, 28, 892, 4062, 6430, 4062, 892, 28 -dw -9, 28, 892, 4062, 6429, 4062, 892, 28 -dw -9, 28, 893, 4062, 6428, 4062, 893, 28 -dw -9, 28, 893, 4061, 6427, 4061, 893, 28 -dw -9, 28, 894, 4061, 6426, 4061, 894, 28 -dw -9, 28, 894, 4061, 6425, 4061, 894, 28 -dw -9, 28, 895, 4061, 6424, 4061, 895, 28 -dw -8, 28, 896, 4061, 6423, 4061, 896, 28 -dw -8, 28, 896, 4061, 6421, 4061, 896, 28 -dw -8, 28, 897, 4061, 6420, 4061, 897, 28 -dw -8, 29, 897, 4061, 6419, 4061, 897, 29 -dw -8, 29, 898, 4061, 6418, 4061, 898, 29 -dw -8, 29, 898, 4061, 6417, 4061, 898, 29 -dw -8, 29, 899, 4061, 6416, 4061, 899, 29 -dw -8, 29, 899, 4061, 6415, 4061, 899, 29 -dw -8, 29, 900, 4061, 6414, 4061, 900, 29 -dw -8, 29, 900, 4060, 6412, 4060, 900, 29 -dw -8, 29, 901, 4060, 6411, 4060, 901, 29 -dw -8, 29, 901, 4060, 6410, 4060, 901, 29 -dw -8, 29, 902, 4060, 6409, 4060, 902, 29 -dw -7, 29, 902, 4060, 6408, 4060, 902, 29 -dw -7, 29, 903, 4060, 6407, 4060, 903, 29 -dw -7, 29, 903, 4060, 6406, 4060, 903, 29 -dw -7, 30, 904, 4060, 6405, 4060, 904, 30 -dw -7, 30, 904, 4060, 6404, 4060, 904, 30 -dw -7, 30, 905, 4060, 6402, 4060, 905, 30 -dw -7, 30, 905, 4060, 6401, 4060, 905, 30 -dw -7, 30, 906, 4060, 6400, 4060, 906, 30 -dw -7, 30, 906, 4060, 6399, 4060, 906, 30 -dw -7, 30, 907, 4060, 6398, 4060, 907, 30 -dw -7, 30, 907, 4059, 6397, 4059, 907, 30 -dw -7, 30, 908, 4059, 6396, 4059, 908, 30 -dw -7, 30, 908, 4059, 6395, 4059, 908, 30 -dw -7, 30, 909, 4059, 6394, 4059, 909, 30 -dw -6, 30, 909, 4059, 6393, 4059, 909, 30 -dw -6, 30, 910, 4059, 6392, 4059, 910, 30 -dw -6, 31, 910, 4059, 6391, 4059, 910, 31 -dw -6, 31, 911, 4059, 6389, 4059, 911, 31 -dw -6, 31, 911, 4059, 6388, 4059, 911, 31 -dw -6, 31, 912, 4059, 6387, 4059, 912, 31 -dw -6, 31, 912, 4059, 6386, 4059, 912, 31 -dw -6, 31, 913, 4059, 6385, 4059, 913, 31 -dw -6, 31, 913, 4059, 6384, 4059, 913, 31 -dw -6, 31, 914, 4059, 6383, 4059, 914, 31 -dw -6, 31, 914, 4058, 6382, 4058, 914, 31 -dw -6, 31, 915, 4058, 6381, 4058, 915, 31 -dw -6, 31, 915, 4058, 6380, 4058, 915, 31 -dw -5, 31, 916, 4058, 6379, 4058, 916, 31 -dw -5, 31, 916, 4058, 6378, 4058, 916, 31 -dw -5, 32, 917, 4058, 6377, 4058, 917, 32 -dw -5, 32, 917, 4058, 6376, 4058, 917, 32 -dw -5, 32, 918, 4058, 6375, 4058, 918, 32 -dw -5, 32, 918, 4058, 6373, 4058, 918, 32 -dw -5, 32, 919, 4058, 6372, 4058, 919, 32 -dw -5, 32, 919, 4058, 6371, 4058, 919, 32 -dw -5, 32, 920, 4058, 6370, 4058, 920, 32 -dw -5, 32, 920, 4058, 6369, 4058, 920, 32 -dw -5, 32, 921, 4057, 6368, 4057, 921, 32 -dw -5, 32, 921, 4057, 6367, 4057, 921, 32 -dw -5, 32, 922, 4057, 6366, 4057, 922, 32 -dw -5, 32, 922, 4057, 6365, 4057, 922, 32 -dw -4, 32, 923, 4057, 6364, 4057, 923, 32 -dw -4, 32, 923, 4057, 6363, 4057, 923, 32 -dw -4, 33, 924, 4057, 6362, 4057, 924, 33 -dw -4, 33, 924, 4057, 6361, 4057, 924, 33 -dw -4, 33, 925, 4057, 6360, 4057, 925, 33 -dw -4, 33, 925, 4057, 6359, 4057, 925, 33 -dw -4, 33, 925, 4057, 6358, 4057, 925, 33 -dw -4, 33, 926, 4057, 6357, 4057, 926, 33 -dw -4, 33, 926, 4057, 6356, 4057, 926, 33 -dw -4, 33, 927, 4057, 6355, 4057, 927, 33 -dw -4, 33, 927, 4056, 6354, 4056, 927, 33 -dw -4, 33, 928, 4056, 6353, 4056, 928, 33 -dw -4, 33, 928, 4056, 6352, 4056, 928, 33 -dw -3, 33, 929, 4056, 6351, 4056, 929, 33 -dw -3, 33, 929, 4056, 6350, 4056, 929, 33 -dw -3, 34, 930, 4056, 6349, 4056, 930, 34 -dw -3, 34, 930, 4056, 6348, 4056, 930, 34 -dw -3, 34, 931, 4056, 6347, 4056, 931, 34 -dw -3, 34, 931, 4056, 6346, 4056, 931, 34 -dw -3, 34, 932, 4056, 6345, 4056, 932, 34 -dw -3, 34, 932, 4056, 6344, 4056, 932, 34 -dw -3, 34, 933, 4056, 6343, 4056, 933, 34 -dw -3, 34, 933, 4056, 6342, 4056, 933, 34 -dw -3, 34, 933, 4055, 6341, 4055, 933, 34 -dw -3, 34, 934, 4055, 6340, 4055, 934, 34 -dw -3, 34, 934, 4055, 6339, 4055, 934, 34 -dw -3, 34, 935, 4055, 6338, 4055, 935, 34 -dw -2, 34, 935, 4055, 6337, 4055, 935, 34 -dw -2, 34, 936, 4055, 6336, 4055, 936, 34 -dw -2, 35, 936, 4055, 6335, 4055, 936, 35 -dw -2, 35, 937, 4055, 6334, 4055, 937, 35 -dw -2, 35, 937, 4055, 6333, 4055, 937, 35 -dw -2, 35, 938, 4055, 6332, 4055, 938, 35 -dw -2, 35, 938, 4055, 6331, 4055, 938, 35 -dw -2, 35, 939, 4055, 6330, 4055, 939, 35 -dw -2, 35, 939, 4055, 6329, 4055, 939, 35 -dw -2, 35, 939, 4055, 6328, 4055, 939, 35 -dw -2, 35, 940, 4054, 6327, 4054, 940, 35 -dw -2, 35, 940, 4054, 6326, 4054, 940, 35 -dw -2, 35, 941, 4054, 6325, 4054, 941, 35 -dw -1, 35, 941, 4054, 6324, 4054, 941, 35 -dw -1, 35, 942, 4054, 6323, 4054, 942, 35 -dw -1, 35, 942, 4054, 6322, 4054, 942, 35 -dw -1, 36, 943, 4054, 6321, 4054, 943, 36 -dw -1, 36, 943, 4054, 6320, 4054, 943, 36 -dw -1, 36, 944, 4054, 6319, 4054, 944, 36 -dw -1, 36, 944, 4054, 6318, 4054, 944, 36 -dw -1, 36, 944, 4054, 6317, 4054, 944, 36 -dw -1, 36, 945, 4054, 6316, 4054, 945, 36 -dw -1, 36, 945, 4054, 6315, 4054, 945, 36 -dw -1, 36, 946, 4053, 6314, 4053, 946, 36 -dw -1, 36, 946, 4053, 6313, 4053, 946, 36 -dw -1, 36, 947, 4053, 6312, 4053, 947, 36 -dw 0, 36, 947, 4053, 6311, 4053, 947, 36 -dw 0, 36, 948, 4053, 6310, 4053, 948, 36 -dw 0, 36, 948, 4053, 6309, 4053, 948, 36 -dw 0, 36, 949, 4053, 6308, 4053, 949, 36 -dw 0, 37, 949, 4053, 6307, 4053, 949, 37 -dw 0, 37, 949, 4053, 6306, 4053, 949, 37 -dw 0, 37, 950, 4053, 6305, 4053, 950, 37 -dw 0, 37, 950, 4053, 6304, 4053, 950, 37 -dw 0, 37, 951, 4053, 6303, 4053, 951, 37 -dw 0, 37, 951, 4053, 6303, 4053, 951, 37 -dw 0, 37, 952, 4052, 6302, 4052, 952, 37 -dw 0, 37, 952, 4052, 6301, 4052, 952, 37 -dw 0, 37, 952, 4052, 6300, 4052, 952, 37 -dw 1, 37, 953, 4052, 6299, 4052, 953, 37 -dw 1, 37, 953, 4052, 6298, 4052, 953, 37 -dw 1, 37, 954, 4052, 6297, 4052, 954, 37 -dw 1, 37, 954, 4052, 6296, 4052, 954, 37 -dw 1, 37, 955, 4052, 6295, 4052, 955, 37 -dw 1, 38, 955, 4052, 6294, 4052, 955, 38 -dw 1, 38, 956, 4052, 6293, 4052, 956, 38 -dw 1, 38, 956, 4052, 6292, 4052, 956, 38 -dw 1, 38, 956, 4052, 6291, 4052, 956, 38 -dw 1, 38, 957, 4052, 6290, 4052, 957, 38 -dw 1, 38, 957, 4052, 6289, 4052, 957, 38 -dw 1, 38, 958, 4051, 6288, 4051, 958, 38 -dw 1, 38, 958, 4051, 6288, 4051, 958, 38 -dw 1, 38, 959, 4051, 6287, 4051, 959, 38 -dw 2, 38, 959, 4051, 6286, 4051, 959, 38 -dw 2, 38, 959, 4051, 6285, 4051, 959, 38 -dw 2, 38, 960, 4051, 6284, 4051, 960, 38 -dw 2, 38, 960, 4051, 6283, 4051, 960, 38 -dw 2, 38, 961, 4051, 6282, 4051, 961, 38 -dw 2, 38, 961, 4051, 6281, 4051, 961, 38 -dw 2, 39, 962, 4051, 6280, 4051, 962, 39 -dw 2, 39, 962, 4051, 6279, 4051, 962, 39 -dw 2, 39, 962, 4051, 6278, 4051, 962, 39 -dw 2, 39, 963, 4051, 6277, 4051, 963, 39 -dw 2, 39, 963, 4050, 6276, 4050, 963, 39 -dw 2, 39, 964, 4050, 6276, 4050, 964, 39 -dw 2, 39, 964, 4050, 6275, 4050, 964, 39 -dw 3, 39, 965, 4050, 6274, 4050, 965, 39 -dw 3, 39, 965, 4050, 6273, 4050, 965, 39 -dw 3, 39, 965, 4050, 6272, 4050, 965, 39 -dw 3, 39, 966, 4050, 6271, 4050, 966, 39 -dw 3, 39, 966, 4050, 6270, 4050, 966, 39 -dw 3, 39, 967, 4050, 6269, 4050, 967, 39 -dw 3, 39, 967, 4050, 6268, 4050, 967, 39 -dw 3, 40, 968, 4050, 6267, 4050, 968, 40 -dw 3, 40, 968, 4050, 6267, 4050, 968, 40 -dw 3, 40, 968, 4050, 6266, 4050, 968, 40 -dw 3, 40, 969, 4049, 6265, 4049, 969, 40 -dw 3, 40, 969, 4049, 6264, 4049, 969, 40 -dw 3, 40, 970, 4049, 6263, 4049, 970, 40 -dw 4, 40, 970, 4049, 6262, 4049, 970, 40 -dw 4, 40, 970, 4049, 6261, 4049, 970, 40 -dw 4, 40, 971, 4049, 6260, 4049, 971, 40 -dw 4, 40, 971, 4049, 6259, 4049, 971, 40 -dw 4, 40, 972, 4049, 6259, 4049, 972, 40 -dw 4, 40, 972, 4049, 6258, 4049, 972, 40 -dw 4, 40, 972, 4049, 6257, 4049, 972, 40 -dw 4, 40, 973, 4049, 6256, 4049, 973, 40 -dw 4, 40, 973, 4049, 6255, 4049, 973, 40 -dw 4, 41, 974, 4049, 6254, 4049, 974, 41 -dw 4, 41, 974, 4049, 6253, 4049, 974, 41 -dw 4, 41, 975, 4048, 6252, 4048, 975, 41 -dw 4, 41, 975, 4048, 6251, 4048, 975, 41 -dw 5, 41, 975, 4048, 6251, 4048, 975, 41 -dw 5, 41, 976, 4048, 6250, 4048, 976, 41 -dw 5, 41, 976, 4048, 6249, 4048, 976, 41 -dw 5, 41, 977, 4048, 6248, 4048, 977, 41 -dw 5, 41, 977, 4048, 6247, 4048, 977, 41 -dw 5, 41, 977, 4048, 6246, 4048, 977, 41 -dw 5, 41, 978, 4048, 6245, 4048, 978, 41 -dw 5, 41, 978, 4048, 6245, 4048, 978, 41 -dw 5, 41, 979, 4048, 6244, 4048, 979, 41 -dw 5, 41, 979, 4048, 6243, 4048, 979, 41 -dw 5, 41, 979, 4048, 6242, 4048, 979, 41 -dw 5, 42, 980, 4047, 6241, 4047, 980, 42 -dw 5, 42, 980, 4047, 6240, 4047, 980, 42 -dw 6, 42, 981, 4047, 6239, 4047, 981, 42 -dw 6, 42, 981, 4047, 6238, 4047, 981, 42 -dw 6, 42, 981, 4047, 6238, 4047, 981, 42 -dw 6, 42, 982, 4047, 6237, 4047, 982, 42 -dw 6, 42, 982, 4047, 6236, 4047, 982, 42 -dw 6, 42, 983, 4047, 6235, 4047, 983, 42 -dw 6, 42, 983, 4047, 6234, 4047, 983, 42 -dw 6, 42, 983, 4047, 6233, 4047, 983, 42 -dw 6, 42, 984, 4047, 6233, 4047, 984, 42 -dw 6, 42, 984, 4047, 6232, 4047, 984, 42 -dw 6, 42, 985, 4047, 6231, 4047, 985, 42 -dw 6, 42, 985, 4046, 6230, 4046, 985, 42 -dw 6, 42, 985, 4046, 6229, 4046, 985, 42 -dw 6, 43, 986, 4046, 6228, 4046, 986, 43 -dw 7, 43, 986, 4046, 6227, 4046, 986, 43 -dw 7, 43, 987, 4046, 6227, 4046, 987, 43 -dw 7, 43, 987, 4046, 6226, 4046, 987, 43 -dw 7, 43, 987, 4046, 6225, 4046, 987, 43 -dw 7, 43, 988, 4046, 6224, 4046, 988, 43 -dw 7, 43, 988, 4046, 6223, 4046, 988, 43 -dw 7, 43, 989, 4046, 6222, 4046, 989, 43 -dw 7, 43, 989, 4046, 6222, 4046, 989, 43 -dw 7, 43, 989, 4046, 6221, 4046, 989, 43 -dw 7, 43, 990, 4046, 6220, 4046, 990, 43 -dw 7, 43, 990, 4046, 6219, 4046, 990, 43 -dw 7, 43, 990, 4045, 6218, 4045, 990, 43 -dw 7, 43, 991, 4045, 6217, 4045, 991, 43 -dw 8, 43, 991, 4045, 6217, 4045, 991, 43 -dw 8, 43, 992, 4045, 6216, 4045, 992, 43 -dw 8, 44, 992, 4045, 6215, 4045, 992, 44 -dw 8, 44, 992, 4045, 6214, 4045, 992, 44 -dw 8, 44, 993, 4045, 6213, 4045, 993, 44 -dw 8, 44, 993, 4045, 6212, 4045, 993, 44 -dw 8, 44, 994, 4045, 6212, 4045, 994, 44 -dw 8, 44, 994, 4045, 6211, 4045, 994, 44 -dw 8, 44, 994, 4045, 6210, 4045, 994, 44 -dw 8, 44, 995, 4045, 6209, 4045, 995, 44 -dw 8, 44, 995, 4045, 6208, 4045, 995, 44 -dw 8, 44, 995, 4044, 6208, 4044, 995, 44 -dw 8, 44, 996, 4044, 6207, 4044, 996, 44 -dw 9, 44, 996, 4044, 6206, 4044, 996, 44 -dw 9, 44, 997, 4044, 6205, 4044, 997, 44 -dw 9, 44, 997, 4044, 6204, 4044, 997, 44 -dw 9, 44, 997, 4044, 6203, 4044, 997, 44 -dw 9, 45, 998, 4044, 6203, 4044, 998, 45 -dw 9, 45, 998, 4044, 6202, 4044, 998, 45 -dw 9, 45, 998, 4044, 6201, 4044, 998, 45 -dw 9, 45, 999, 4044, 6200, 4044, 999, 45 -dw 9, 45, 999, 4044, 6199, 4044, 999, 45 -dw 9, 45, 1000, 4044, 6199, 4044, 1000, 45 -dw 9, 45, 1000, 4044, 6198, 4044, 1000, 45 -dw 9, 45, 1000, 4043, 6197, 4043, 1000, 45 -dw 9, 45, 1001, 4043, 6196, 4043, 1001, 45 -dw 10, 45, 1001, 4043, 6195, 4043, 1001, 45 -dw 10, 45, 1001, 4043, 6195, 4043, 1001, 45 -dw 10, 45, 1002, 4043, 6194, 4043, 1002, 45 -dw 10, 45, 1002, 4043, 6193, 4043, 1002, 45 -dw 10, 45, 1003, 4043, 6192, 4043, 1003, 45 -dw 10, 45, 1003, 4043, 6191, 4043, 1003, 45 -dw 10, 45, 1003, 4043, 6191, 4043, 1003, 45 -dw 10, 46, 1004, 4043, 6190, 4043, 1004, 46 -dw 10, 46, 1004, 4043, 6189, 4043, 1004, 46 -dw 10, 46, 1004, 4043, 6188, 4043, 1004, 46 -dw 10, 46, 1005, 4043, 6187, 4043, 1005, 46 -dw 10, 46, 1005, 4043, 6187, 4043, 1005, 46 -dw 10, 46, 1006, 4042, 6186, 4042, 1006, 46 -dw 10, 46, 1006, 4042, 6185, 4042, 1006, 46 -dw 11, 46, 1006, 4042, 6184, 4042, 1006, 46 -dw 11, 46, 1007, 4042, 6184, 4042, 1007, 46 -dw 11, 46, 1007, 4042, 6183, 4042, 1007, 46 -dw 11, 46, 1007, 4042, 6182, 4042, 1007, 46 -dw 11, 46, 1008, 4042, 6181, 4042, 1008, 46 -dw 11, 46, 1008, 4042, 6180, 4042, 1008, 46 -dw 11, 46, 1008, 4042, 6180, 4042, 1008, 46 -dw 11, 46, 1009, 4042, 6179, 4042, 1009, 46 -dw 11, 46, 1009, 4042, 6178, 4042, 1009, 46 -dw 11, 47, 1010, 4042, 6177, 4042, 1010, 47 -dw 11, 47, 1010, 4042, 6177, 4042, 1010, 47 -dw 11, 47, 1010, 4041, 6176, 4041, 1010, 47 -dw 11, 47, 1011, 4041, 6175, 4041, 1011, 47 -dw 12, 47, 1011, 4041, 6174, 4041, 1011, 47 -dw 12, 47, 1011, 4041, 6173, 4041, 1011, 47 -dw 12, 47, 1012, 4041, 6173, 4041, 1012, 47 -dw 12, 47, 1012, 4041, 6172, 4041, 1012, 47 -dw 12, 47, 1012, 4041, 6171, 4041, 1012, 47 -dw 12, 47, 1013, 4041, 6170, 4041, 1013, 47 -dw 12, 47, 1013, 4041, 6170, 4041, 1013, 47 -dw 12, 47, 1014, 4041, 6169, 4041, 1014, 47 -dw 12, 47, 1014, 4041, 6168, 4041, 1014, 47 -dw 12, 47, 1014, 4041, 6167, 4041, 1014, 47 -dw 12, 47, 1015, 4041, 6167, 4041, 1015, 47 -dw 12, 47, 1015, 4041, 6166, 4041, 1015, 47 -dw 12, 48, 1015, 4040, 6165, 4040, 1015, 48 -dw 12, 48, 1016, 4040, 6164, 4040, 1016, 48 -dw 13, 48, 1016, 4040, 6164, 4040, 1016, 48 -dw 13, 48, 1016, 4040, 6163, 4040, 1016, 48 -dw 13, 48, 1017, 4040, 6162, 4040, 1017, 48 -dw 13, 48, 1017, 4040, 6161, 4040, 1017, 48 -dw 13, 48, 1017, 4040, 6161, 4040, 1017, 48 -dw 13, 48, 1018, 4040, 6160, 4040, 1018, 48 -dw 13, 48, 1018, 4040, 6159, 4040, 1018, 48 -dw 13, 48, 1018, 4040, 6158, 4040, 1018, 48 -dw 13, 48, 1019, 4040, 6157, 4040, 1019, 48 -dw 13, 48, 1019, 4040, 6157, 4040, 1019, 48 -dw 13, 48, 1020, 4040, 6156, 4040, 1020, 48 -dw 13, 48, 1020, 4039, 6155, 4039, 1020, 48 -dw 13, 48, 1020, 4039, 6155, 4039, 1020, 48 -dw 14, 48, 1021, 4039, 6154, 4039, 1021, 48 -dw 14, 48, 1021, 4039, 6153, 4039, 1021, 48 -dw 14, 49, 1021, 4039, 6152, 4039, 1021, 49 -dw 14, 49, 1022, 4039, 6152, 4039, 1022, 49 -dw 14, 49, 1022, 4039, 6151, 4039, 1022, 49 -dw 14, 49, 1022, 4039, 6150, 4039, 1022, 49 -dw 14, 49, 1023, 4039, 6149, 4039, 1023, 49 -dw 14, 49, 1023, 4039, 6149, 4039, 1023, 49 -dw 14, 49, 1023, 4039, 6148, 4039, 1023, 49 -dw 14, 49, 1024, 4039, 6147, 4039, 1024, 49 -dw 14, 49, 1024, 4039, 6146, 4039, 1024, 49 -dw 14, 49, 1024, 4039, 6146, 4039, 1024, 49 -dw 14, 49, 1025, 4038, 6145, 4038, 1025, 49 -dw 15, 49, 1025, 4038, 6144, 4038, 1025, 49 -dw 15, 49, 1025, 4038, 6143, 4038, 1025, 49 -dw 15, 49, 1026, 4038, 6143, 4038, 1026, 49 -dw 15, 49, 1026, 4038, 6142, 4038, 1026, 49 -dw 15, 49, 1026, 4038, 6141, 4038, 1026, 49 -dw 15, 49, 1027, 4038, 6141, 4038, 1027, 49 -dw 15, 50, 1027, 4038, 6140, 4038, 1027, 50 -dw 15, 50, 1027, 4038, 6139, 4038, 1027, 50 -dw 15, 50, 1028, 4038, 6138, 4038, 1028, 50 -dw 15, 50, 1028, 4038, 6138, 4038, 1028, 50 -dw 15, 50, 1028, 4038, 6137, 4038, 1028, 50 -dw 15, 50, 1029, 4038, 6136, 4038, 1029, 50 -dw 15, 50, 1029, 4038, 6135, 4038, 1029, 50 -dw 15, 50, 1029, 4037, 6135, 4037, 1029, 50 -dw 16, 50, 1030, 4037, 6134, 4037, 1030, 50 -dw 16, 50, 1030, 4037, 6133, 4037, 1030, 50 -dw 16, 50, 1030, 4037, 6133, 4037, 1030, 50 -dw 16, 50, 1031, 4037, 6132, 4037, 1031, 50 -dw 16, 50, 1031, 4037, 6131, 4037, 1031, 50 -dw 16, 50, 1032, 4037, 6130, 4037, 1032, 50 -dw 16, 50, 1032, 4037, 6130, 4037, 1032, 50 -dw 16, 50, 1032, 4037, 6129, 4037, 1032, 50 -dw 16, 50, 1033, 4037, 6128, 4037, 1033, 50 -dw 16, 51, 1033, 4037, 6128, 4037, 1033, 51 -dw 16, 51, 1033, 4037, 6127, 4037, 1033, 51 -dw 16, 51, 1034, 4037, 6126, 4037, 1034, 51 -dw 16, 51, 1034, 4036, 6125, 4036, 1034, 51 -dw 17, 51, 1034, 4036, 6125, 4036, 1034, 51 -dw 17, 51, 1034, 4036, 6124, 4036, 1034, 51 -dw 17, 51, 1035, 4036, 6123, 4036, 1035, 51 -dw 17, 51, 1035, 4036, 6123, 4036, 1035, 51 -dw 17, 51, 1035, 4036, 6122, 4036, 1035, 51 -dw 17, 51, 1036, 4036, 6121, 4036, 1036, 51 -dw 17, 51, 1036, 4036, 6121, 4036, 1036, 51 -dw 17, 51, 1036, 4036, 6120, 4036, 1036, 51 -dw 17, 51, 1037, 4036, 6119, 4036, 1037, 51 -dw 17, 51, 1037, 4036, 6118, 4036, 1037, 51 -dw 17, 51, 1037, 4036, 6118, 4036, 1037, 51 -dw 17, 51, 1038, 4036, 6117, 4036, 1038, 51 -dw 17, 51, 1038, 4036, 6116, 4036, 1038, 51 -dw 17, 52, 1038, 4035, 6116, 4035, 1038, 52 -dw 18, 52, 1039, 4035, 6115, 4035, 1039, 52 -dw 18, 52, 1039, 4035, 6114, 4035, 1039, 52 -dw 18, 52, 1039, 4035, 6114, 4035, 1039, 52 -dw 18, 52, 1040, 4035, 6113, 4035, 1040, 52 -dw 18, 52, 1040, 4035, 6112, 4035, 1040, 52 -dw 18, 52, 1040, 4035, 6111, 4035, 1040, 52 -dw 18, 52, 1041, 4035, 6111, 4035, 1041, 52 -dw 18, 52, 1041, 4035, 6110, 4035, 1041, 52 -dw 18, 52, 1041, 4035, 6109, 4035, 1041, 52 -dw 18, 52, 1042, 4035, 6109, 4035, 1042, 52 -dw 18, 52, 1042, 4035, 6108, 4035, 1042, 52 -dw 18, 52, 1042, 4035, 6107, 4035, 1042, 52 -dw 18, 52, 1043, 4035, 6107, 4035, 1043, 52 -dw 18, 52, 1043, 4034, 6106, 4034, 1043, 52 -dw 19, 52, 1043, 4034, 6105, 4034, 1043, 52 -dw 19, 52, 1044, 4034, 6105, 4034, 1044, 52 -dw 19, 53, 1044, 4034, 6104, 4034, 1044, 53 -dw 19, 53, 1044, 4034, 6103, 4034, 1044, 53 -dw 19, 53, 1045, 4034, 6103, 4034, 1045, 53 -dw 19, 53, 1045, 4034, 6102, 4034, 1045, 53 -dw 19, 53, 1045, 4034, 6101, 4034, 1045, 53 -dw 19, 53, 1046, 4034, 6101, 4034, 1046, 53 -dw 19, 53, 1046, 4034, 6100, 4034, 1046, 53 -dw 19, 53, 1046, 4034, 6099, 4034, 1046, 53 -dw 19, 53, 1046, 4034, 6099, 4034, 1046, 53 -dw 19, 53, 1047, 4034, 6098, 4034, 1047, 53 -dw 19, 53, 1047, 4034, 6097, 4034, 1047, 53 -dw 20, 53, 1047, 4033, 6096, 4033, 1047, 53 -dw 20, 53, 1048, 4033, 6096, 4033, 1048, 53 -dw 20, 53, 1048, 4033, 6095, 4033, 1048, 53 -dw 20, 53, 1048, 4033, 6094, 4033, 1048, 53 -dw 20, 53, 1049, 4033, 6094, 4033, 1049, 53 -dw 20, 53, 1049, 4033, 6093, 4033, 1049, 53 -dw 20, 53, 1049, 4033, 6092, 4033, 1049, 53 -dw 20, 54, 1050, 4033, 6092, 4033, 1050, 54 -dw 20, 54, 1050, 4033, 6091, 4033, 1050, 54 -dw 20, 54, 1050, 4033, 6090, 4033, 1050, 54 -dw 20, 54, 1051, 4033, 6090, 4033, 1051, 54 -dw 20, 54, 1051, 4033, 6089, 4033, 1051, 54 -dw 20, 54, 1051, 4033, 6089, 4033, 1051, 54 -dw 20, 54, 1051, 4033, 6088, 4033, 1051, 54 -dw 21, 54, 1052, 4032, 6087, 4032, 1052, 54 -dw 21, 54, 1052, 4032, 6087, 4032, 1052, 54 -dw 21, 54, 1052, 4032, 6086, 4032, 1052, 54 -dw 21, 54, 1053, 4032, 6085, 4032, 1053, 54 -dw 21, 54, 1053, 4032, 6085, 4032, 1053, 54 -dw 21, 54, 1053, 4032, 6084, 4032, 1053, 54 -dw 21, 54, 1054, 4032, 6083, 4032, 1054, 54 -dw 21, 54, 1054, 4032, 6083, 4032, 1054, 54 -dw 21, 54, 1054, 4032, 6082, 4032, 1054, 54 -dw 21, 54, 1055, 4032, 6081, 4032, 1055, 54 -dw 21, 54, 1055, 4032, 6081, 4032, 1055, 54 -dw 21, 55, 1055, 4032, 6080, 4032, 1055, 55 -dw 21, 55, 1055, 4032, 6079, 4032, 1055, 55 -dw 21, 55, 1056, 4032, 6079, 4032, 1056, 55 -dw 22, 55, 1056, 4031, 6078, 4031, 1056, 55 -dw 22, 55, 1056, 4031, 6077, 4031, 1056, 55 -dw 22, 55, 1057, 4031, 6077, 4031, 1057, 55 -dw 22, 55, 1057, 4031, 6076, 4031, 1057, 55 -dw 22, 55, 1057, 4031, 6075, 4031, 1057, 55 -dw 22, 55, 1058, 4031, 6075, 4031, 1058, 55 -dw 22, 55, 1058, 4031, 6074, 4031, 1058, 55 -dw 22, 55, 1058, 4031, 6074, 4031, 1058, 55 -dw 22, 55, 1058, 4031, 6073, 4031, 1058, 55 -dw 22, 55, 1059, 4031, 6072, 4031, 1059, 55 -dw 22, 55, 1059, 4031, 6072, 4031, 1059, 55 -dw 22, 55, 1059, 4031, 6071, 4031, 1059, 55 -dw 22, 55, 1060, 4031, 6070, 4031, 1060, 55 -dw 22, 55, 1060, 4031, 6070, 4031, 1060, 55 -dw 23, 55, 1060, 4030, 6069, 4030, 1060, 55 -dw 23, 55, 1061, 4030, 6068, 4030, 1061, 55 -dw 23, 56, 1061, 4030, 6068, 4030, 1061, 56 -dw 23, 56, 1061, 4030, 6067, 4030, 1061, 56 -dw 23, 56, 1061, 4030, 6066, 4030, 1061, 56 -dw 23, 56, 1062, 4030, 6066, 4030, 1062, 56 -dw 23, 56, 1062, 4030, 6065, 4030, 1062, 56 -dw 23, 56, 1062, 4030, 6065, 4030, 1062, 56 -dw 23, 56, 1063, 4030, 6064, 4030, 1063, 56 -dw 23, 56, 1063, 4030, 6063, 4030, 1063, 56 -dw 23, 56, 1063, 4030, 6063, 4030, 1063, 56 -dw 23, 56, 1064, 4030, 6062, 4030, 1064, 56 -dw 23, 56, 1064, 4030, 6061, 4030, 1064, 56 -dw 23, 56, 1064, 4030, 6061, 4030, 1064, 56 -dw 24, 56, 1064, 4030, 6060, 4030, 1064, 56 -dw 24, 56, 1065, 4029, 6060, 4029, 1065, 56 -dw 24, 56, 1065, 4029, 6059, 4029, 1065, 56 -dw 24, 56, 1065, 4029, 6058, 4029, 1065, 56 -dw 24, 56, 1066, 4029, 6058, 4029, 1066, 56 -dw 24, 56, 1066, 4029, 6057, 4029, 1066, 56 -dw 24, 57, 1066, 4029, 6056, 4029, 1066, 57 -dw 24, 57, 1066, 4029, 6056, 4029, 1066, 57 -dw 24, 57, 1067, 4029, 6055, 4029, 1067, 57 -dw 24, 57, 1067, 4029, 6055, 4029, 1067, 57 -dw 24, 57, 1067, 4029, 6054, 4029, 1067, 57 -dw 24, 57, 1068, 4029, 6053, 4029, 1068, 57 -dw 24, 57, 1068, 4029, 6053, 4029, 1068, 57 -dw 24, 57, 1068, 4029, 6052, 4029, 1068, 57 -dw 25, 57, 1068, 4029, 6051, 4029, 1068, 57 -dw 25, 57, 1069, 4028, 6051, 4028, 1069, 57 -dw 25, 57, 1069, 4028, 6050, 4028, 1069, 57 -dw 25, 57, 1069, 4028, 6050, 4028, 1069, 57 -dw 25, 57, 1070, 4028, 6049, 4028, 1070, 57 -dw 25, 57, 1070, 4028, 6048, 4028, 1070, 57 -dw 25, 57, 1070, 4028, 6048, 4028, 1070, 57 -dw 25, 57, 1071, 4028, 6047, 4028, 1071, 57 -dw 25, 57, 1071, 4028, 6047, 4028, 1071, 57 -dw 25, 57, 1071, 4028, 6046, 4028, 1071, 57 -dw 25, 57, 1071, 4028, 6045, 4028, 1071, 57 -dw 25, 58, 1072, 4028, 6045, 4028, 1072, 58 -dw 25, 58, 1072, 4028, 6044, 4028, 1072, 58 -dw 25, 58, 1072, 4028, 6044, 4028, 1072, 58 -dw 26, 58, 1073, 4028, 6043, 4028, 1073, 58 -dw 26, 58, 1073, 4028, 6042, 4028, 1073, 58 -dw 26, 58, 1073, 4027, 6042, 4027, 1073, 58 -dw 26, 58, 1073, 4027, 6041, 4027, 1073, 58 -dw 26, 58, 1074, 4027, 6041, 4027, 1074, 58 -dw 26, 58, 1074, 4027, 6040, 4027, 1074, 58 -dw 26, 58, 1074, 4027, 6039, 4027, 1074, 58 -dw 26, 58, 1074, 4027, 6039, 4027, 1074, 58 -dw 26, 58, 1075, 4027, 6038, 4027, 1075, 58 -dw 26, 58, 1075, 4027, 6038, 4027, 1075, 58 -dw 26, 58, 1075, 4027, 6037, 4027, 1075, 58 -dw 26, 58, 1076, 4027, 6036, 4027, 1076, 58 -dw 26, 58, 1076, 4027, 6036, 4027, 1076, 58 -dw 26, 58, 1076, 4027, 6035, 4027, 1076, 58 -dw 27, 58, 1076, 4027, 6035, 4027, 1076, 58 -dw 27, 58, 1077, 4027, 6034, 4027, 1077, 58 -dw 27, 58, 1077, 4026, 6033, 4026, 1077, 58 -dw 27, 59, 1077, 4026, 6033, 4026, 1077, 59 -dw 27, 59, 1078, 4026, 6032, 4026, 1078, 59 -dw 27, 59, 1078, 4026, 6032, 4026, 1078, 59 -dw 27, 59, 1078, 4026, 6031, 4026, 1078, 59 -dw 27, 59, 1078, 4026, 6030, 4026, 1078, 59 -dw 27, 59, 1079, 4026, 6030, 4026, 1079, 59 -dw 27, 59, 1079, 4026, 6029, 4026, 1079, 59 -dw 27, 59, 1079, 4026, 6029, 4026, 1079, 59 -dw 27, 59, 1080, 4026, 6028, 4026, 1080, 59 -dw 27, 59, 1080, 4026, 6027, 4026, 1080, 59 -dw 27, 59, 1080, 4026, 6027, 4026, 1080, 59 -dw 28, 59, 1080, 4026, 6026, 4026, 1080, 59 -dw 28, 59, 1081, 4026, 6026, 4026, 1081, 59 -dw 28, 59, 1081, 4026, 6025, 4026, 1081, 59 -dw 28, 59, 1081, 4025, 6025, 4025, 1081, 59 -dw 28, 59, 1081, 4025, 6024, 4025, 1081, 59 -dw 28, 59, 1082, 4025, 6023, 4025, 1082, 59 -dw 28, 59, 1082, 4025, 6023, 4025, 1082, 59 -dw 28, 59, 1082, 4025, 6022, 4025, 1082, 59 -dw 28, 60, 1083, 4025, 6022, 4025, 1083, 60 -dw 28, 60, 1083, 4025, 6021, 4025, 1083, 60 -dw 28, 60, 1083, 4025, 6020, 4025, 1083, 60 -dw 28, 60, 1083, 4025, 6020, 4025, 1083, 60 -dw 28, 60, 1084, 4025, 6019, 4025, 1084, 60 -dw 28, 60, 1084, 4025, 6019, 4025, 1084, 60 -dw 28, 60, 1084, 4025, 6018, 4025, 1084, 60 -dw 29, 60, 1084, 4025, 6018, 4025, 1084, 60 -dw 29, 60, 1085, 4025, 6017, 4025, 1085, 60 -dw 29, 60, 1085, 4025, 6016, 4025, 1085, 60 -dw 29, 60, 1085, 4024, 6016, 4024, 1085, 60 -dw 29, 60, 1085, 4024, 6015, 4024, 1085, 60 -dw 29, 60, 1086, 4024, 6015, 4024, 1086, 60 -dw 29, 60, 1086, 4024, 6014, 4024, 1086, 60 -dw 29, 60, 1086, 4024, 6014, 4024, 1086, 60 -dw 29, 60, 1087, 4024, 6013, 4024, 1087, 60 -dw 29, 60, 1087, 4024, 6012, 4024, 1087, 60 -dw 29, 60, 1087, 4024, 6012, 4024, 1087, 60 -dw 29, 60, 1087, 4024, 6011, 4024, 1087, 60 -dw 29, 60, 1088, 4024, 6011, 4024, 1088, 60 -dw 29, 61, 1088, 4024, 6010, 4024, 1088, 61 -dw 30, 61, 1088, 4024, 6010, 4024, 1088, 61 -dw 30, 61, 1088, 4024, 6009, 4024, 1088, 61 -dw 30, 61, 1089, 4024, 6008, 4024, 1089, 61 -dw 30, 61, 1089, 4024, 6008, 4024, 1089, 61 -dw 30, 61, 1089, 4023, 6007, 4023, 1089, 61 -dw 30, 61, 1089, 4023, 6007, 4023, 1089, 61 -dw 30, 61, 1090, 4023, 6006, 4023, 1090, 61 -dw 30, 61, 1090, 4023, 6006, 4023, 1090, 61 -dw 30, 61, 1090, 4023, 6005, 4023, 1090, 61 -dw 30, 61, 1091, 4023, 6005, 4023, 1091, 61 -dw 30, 61, 1091, 4023, 6004, 4023, 1091, 61 -dw 30, 61, 1091, 4023, 6003, 4023, 1091, 61 -dw 30, 61, 1091, 4023, 6003, 4023, 1091, 61 -dw 30, 61, 1092, 4023, 6002, 4023, 1092, 61 -dw 30, 61, 1092, 4023, 6002, 4023, 1092, 61 -dw 31, 61, 1092, 4023, 6001, 4023, 1092, 61 -dw 31, 61, 1092, 4023, 6001, 4023, 1092, 61 -dw 31, 61, 1093, 4023, 6000, 4023, 1093, 61 -dw 31, 61, 1093, 4023, 6000, 4023, 1093, 61 -dw 31, 62, 1093, 4022, 5999, 4022, 1093, 62 -dw 31, 62, 1093, 4022, 5998, 4022, 1093, 62 -dw 31, 62, 1094, 4022, 5998, 4022, 1094, 62 -dw 31, 62, 1094, 4022, 5997, 4022, 1094, 62 -dw 31, 62, 1094, 4022, 5997, 4022, 1094, 62 -dw 31, 62, 1094, 4022, 5996, 4022, 1094, 62 -dw 31, 62, 1095, 4022, 5996, 4022, 1095, 62 -dw 31, 62, 1095, 4022, 5995, 4022, 1095, 62 -dw 31, 62, 1095, 4022, 5995, 4022, 1095, 62 -dw 31, 62, 1095, 4022, 5994, 4022, 1095, 62 -dw 32, 62, 1096, 4022, 5993, 4022, 1096, 62 -dw 32, 62, 1096, 4022, 5993, 4022, 1096, 62 -dw 32, 62, 1096, 4022, 5992, 4022, 1096, 62 -dw 32, 62, 1096, 4022, 5992, 4022, 1096, 62 -dw 32, 62, 1097, 4022, 5991, 4022, 1097, 62 -dw 32, 62, 1097, 4021, 5991, 4021, 1097, 62 -dw 32, 62, 1097, 4021, 5990, 4021, 1097, 62 -dw 32, 62, 1098, 4021, 5990, 4021, 1098, 62 -dw 32, 62, 1098, 4021, 5989, 4021, 1098, 62 -dw 32, 62, 1098, 4021, 5989, 4021, 1098, 62 -dw 32, 62, 1098, 4021, 5988, 4021, 1098, 62 -dw 32, 63, 1099, 4021, 5987, 4021, 1099, 63 -dw 32, 63, 1099, 4021, 5987, 4021, 1099, 63 -dw 32, 63, 1099, 4021, 5986, 4021, 1099, 63 -dw 32, 63, 1099, 4021, 5986, 4021, 1099, 63 -dw 33, 63, 1100, 4021, 5985, 4021, 1100, 63 -dw 33, 63, 1100, 4021, 5985, 4021, 1100, 63 -dw 33, 63, 1100, 4021, 5984, 4021, 1100, 63 -dw 33, 63, 1100, 4021, 5984, 4021, 1100, 63 -dw 33, 63, 1101, 4021, 5983, 4021, 1101, 63 -dw 33, 63, 1101, 4020, 5983, 4020, 1101, 63 -dw 33, 63, 1101, 4020, 5982, 4020, 1101, 63 -dw 33, 63, 1101, 4020, 5982, 4020, 1101, 63 -dw 33, 63, 1102, 4020, 5981, 4020, 1102, 63 -dw 33, 63, 1102, 4020, 5981, 4020, 1102, 63 -dw 33, 63, 1102, 4020, 5980, 4020, 1102, 63 -dw 33, 63, 1102, 4020, 5979, 4020, 1102, 63 -dw 33, 63, 1103, 4020, 5979, 4020, 1103, 63 -dw 33, 63, 1103, 4020, 5978, 4020, 1103, 63 -dw 33, 63, 1103, 4020, 5978, 4020, 1103, 63 -dw 34, 63, 1103, 4020, 5977, 4020, 1103, 63 -dw 34, 63, 1104, 4020, 5977, 4020, 1104, 63 -dw 34, 64, 1104, 4020, 5976, 4020, 1104, 64 -dw 34, 64, 1104, 4020, 5976, 4020, 1104, 64 -dw 34, 64, 1104, 4020, 5975, 4020, 1104, 64 -dw 34, 64, 1105, 4020, 5975, 4020, 1105, 64 -dw 34, 64, 1105, 4019, 5974, 4019, 1105, 64 -dw 34, 64, 1105, 4019, 5974, 4019, 1105, 64 -dw 34, 64, 1105, 4019, 5973, 4019, 1105, 64 -dw 34, 64, 1106, 4019, 5973, 4019, 1106, 64 -dw 34, 64, 1106, 4019, 5972, 4019, 1106, 64 -dw 34, 64, 1106, 4019, 5972, 4019, 1106, 64 -dw 34, 64, 1106, 4019, 5971, 4019, 1106, 64 -dw 34, 64, 1106, 4019, 5971, 4019, 1106, 64 -dw 34, 64, 1107, 4019, 5970, 4019, 1107, 64 -dw 35, 64, 1107, 4019, 5969, 4019, 1107, 64 -dw 35, 64, 1107, 4019, 5969, 4019, 1107, 64 -dw 35, 64, 1107, 4019, 5968, 4019, 1107, 64 -dw 35, 64, 1108, 4019, 5968, 4019, 1108, 64 -dw 35, 64, 1108, 4019, 5967, 4019, 1108, 64 -dw 35, 64, 1108, 4019, 5967, 4019, 1108, 64 -dw 35, 64, 1108, 4018, 5966, 4018, 1108, 64 -dw 35, 64, 1109, 4018, 5966, 4018, 1109, 64 -dw 35, 64, 1109, 4018, 5965, 4018, 1109, 64 -dw 35, 65, 1109, 4018, 5965, 4018, 1109, 65 -dw 35, 65, 1109, 4018, 5964, 4018, 1109, 65 -dw 35, 65, 1110, 4018, 5964, 4018, 1110, 65 -dw 35, 65, 1110, 4018, 5963, 4018, 1110, 65 -dw 35, 65, 1110, 4018, 5963, 4018, 1110, 65 -dw 35, 65, 1110, 4018, 5962, 4018, 1110, 65 -dw 36, 65, 1111, 4018, 5962, 4018, 1111, 65 -dw 36, 65, 1111, 4018, 5961, 4018, 1111, 65 -dw 36, 65, 1111, 4018, 5961, 4018, 1111, 65 -dw 36, 65, 1111, 4018, 5960, 4018, 1111, 65 -dw 36, 65, 1112, 4018, 5960, 4018, 1112, 65 -dw 36, 65, 1112, 4018, 5959, 4018, 1112, 65 -dw 36, 65, 1112, 4018, 5959, 4018, 1112, 65 -dw 36, 65, 1112, 4017, 5958, 4017, 1112, 65 -dw 36, 65, 1113, 4017, 5958, 4017, 1113, 65 -dw 36, 65, 1113, 4017, 5957, 4017, 1113, 65 -dw 36, 65, 1113, 4017, 5957, 4017, 1113, 65 -dw 36, 65, 1113, 4017, 5956, 4017, 1113, 65 -dw 36, 65, 1113, 4017, 5956, 4017, 1113, 65 -dw 36, 65, 1114, 4017, 5955, 4017, 1114, 65 -dw 36, 65, 1114, 4017, 5955, 4017, 1114, 65 -dw 37, 65, 1114, 4017, 5954, 4017, 1114, 65 -dw 37, 66, 1114, 4017, 5954, 4017, 1114, 66 -dw 37, 66, 1115, 4017, 5953, 4017, 1115, 66 -dw 37, 66, 1115, 4017, 5953, 4017, 1115, 66 -dw 37, 66, 1115, 4017, 5952, 4017, 1115, 66 -dw 37, 66, 1115, 4017, 5952, 4017, 1115, 66 -dw 37, 66, 1116, 4017, 5951, 4017, 1116, 66 -dw 37, 66, 1116, 4017, 5951, 4017, 1116, 66 -dw 37, 66, 1116, 4016, 5950, 4016, 1116, 66 -dw 37, 66, 1116, 4016, 5950, 4016, 1116, 66 -dw 37, 66, 1117, 4016, 5949, 4016, 1117, 66 -dw 37, 66, 1117, 4016, 5949, 4016, 1117, 66 -dw 37, 66, 1117, 4016, 5948, 4016, 1117, 66 -dw 37, 66, 1117, 4016, 5948, 4016, 1117, 66 -dw 37, 66, 1117, 4016, 5947, 4016, 1117, 66 -dw 38, 66, 1118, 4016, 5947, 4016, 1118, 66 -dw 38, 66, 1118, 4016, 5946, 4016, 1118, 66 -dw 38, 66, 1118, 4016, 5946, 4016, 1118, 66 -dw 38, 66, 1118, 4016, 5945, 4016, 1118, 66 -dw 38, 66, 1119, 4016, 5945, 4016, 1119, 66 -dw 38, 66, 1119, 4016, 5944, 4016, 1119, 66 -dw 38, 66, 1119, 4016, 5944, 4016, 1119, 66 -dw 38, 66, 1119, 4016, 5943, 4016, 1119, 66 -dw 38, 67, 1120, 4016, 5943, 4016, 1120, 67 -dw 38, 67, 1120, 4015, 5942, 4015, 1120, 67 -dw 38, 67, 1120, 4015, 5942, 4015, 1120, 67 -dw 38, 67, 1120, 4015, 5941, 4015, 1120, 67 -dw 38, 67, 1120, 4015, 5941, 4015, 1120, 67 -dw 38, 67, 1121, 4015, 5940, 4015, 1121, 67 -dw 38, 67, 1121, 4015, 5940, 4015, 1121, 67 -dw 39, 67, 1121, 4015, 5939, 4015, 1121, 67 -dw 39, 67, 1121, 4015, 5939, 4015, 1121, 67 -dw 39, 67, 1122, 4015, 5938, 4015, 1122, 67 -dw 39, 67, 1122, 4015, 5938, 4015, 1122, 67 -dw 39, 67, 1122, 4015, 5937, 4015, 1122, 67 -dw 39, 67, 1122, 4015, 5937, 4015, 1122, 67 -dw 39, 67, 1122, 4015, 5937, 4015, 1122, 67 -dw 39, 67, 1123, 4015, 5936, 4015, 1123, 67 -dw 39, 67, 1123, 4015, 5936, 4015, 1123, 67 -dw 39, 67, 1123, 4015, 5935, 4015, 1123, 67 -dw 39, 67, 1123, 4014, 5935, 4014, 1123, 67 -dw 39, 67, 1124, 4014, 5934, 4014, 1124, 67 -dw 39, 67, 1124, 4014, 5934, 4014, 1124, 67 -dw 39, 67, 1124, 4014, 5933, 4014, 1124, 67 -dw 39, 67, 1124, 4014, 5933, 4014, 1124, 67 -dw 39, 67, 1124, 4014, 5932, 4014, 1124, 67 -dw 40, 68, 1125, 4014, 5932, 4014, 1125, 68 -dw 40, 68, 1125, 4014, 5931, 4014, 1125, 68 -dw 40, 68, 1125, 4014, 5931, 4014, 1125, 68 -dw 40, 68, 1125, 4014, 5930, 4014, 1125, 68 -dw 40, 68, 1126, 4014, 5930, 4014, 1126, 68 -dw 40, 68, 1126, 4014, 5929, 4014, 1126, 68 -dw 40, 68, 1126, 4014, 5929, 4014, 1126, 68 -dw 40, 68, 1126, 4014, 5928, 4014, 1126, 68 -dw 40, 68, 1126, 4014, 5928, 4014, 1126, 68 -dw 40, 68, 1127, 4014, 5927, 4014, 1127, 68 -dw 40, 68, 1127, 4014, 5927, 4014, 1127, 68 -dw 40, 68, 1127, 4013, 5927, 4013, 1127, 68 -dw 40, 68, 1127, 4013, 5926, 4013, 1127, 68 -dw 40, 68, 1128, 4013, 5926, 4013, 1128, 68 -dw 40, 68, 1128, 4013, 5925, 4013, 1128, 68 -dw 40, 68, 1128, 4013, 5925, 4013, 1128, 68 -dw 41, 68, 1128, 4013, 5924, 4013, 1128, 68 -dw 41, 68, 1128, 4013, 5924, 4013, 1128, 68 -dw 41, 68, 1129, 4013, 5923, 4013, 1129, 68 -dw 41, 68, 1129, 4013, 5923, 4013, 1129, 68 -dw 41, 68, 1129, 4013, 5922, 4013, 1129, 68 -dw 41, 68, 1129, 4013, 5922, 4013, 1129, 68 -dw 41, 68, 1130, 4013, 5921, 4013, 1130, 68 -dw 41, 69, 1130, 4013, 5921, 4013, 1130, 69 -dw 41, 69, 1130, 4013, 5920, 4013, 1130, 69 -dw 41, 69, 1130, 4013, 5920, 4013, 1130, 69 -dw 41, 69, 1130, 4013, 5920, 4013, 1130, 69 -dw 41, 69, 1131, 4012, 5919, 4012, 1131, 69 -dw 41, 69, 1131, 4012, 5919, 4012, 1131, 69 -dw 41, 69, 1131, 4012, 5918, 4012, 1131, 69 -dw 41, 69, 1131, 4012, 5918, 4012, 1131, 69 -dw 42, 69, 1132, 4012, 5917, 4012, 1132, 69 -dw 42, 69, 1132, 4012, 5917, 4012, 1132, 69 -dw 42, 69, 1132, 4012, 5916, 4012, 1132, 69 -dw 42, 69, 1132, 4012, 5916, 4012, 1132, 69 -dw 42, 69, 1132, 4012, 5915, 4012, 1132, 69 -dw 42, 69, 1133, 4012, 5915, 4012, 1133, 69 -dw 42, 69, 1133, 4012, 5914, 4012, 1133, 69 -dw 42, 69, 1133, 4012, 5914, 4012, 1133, 69 -dw 42, 69, 1133, 4012, 5914, 4012, 1133, 69 -dw 42, 69, 1133, 4012, 5913, 4012, 1133, 69 -dw 42, 69, 1134, 4012, 5913, 4012, 1134, 69 -dw 42, 69, 1134, 4012, 5912, 4012, 1134, 69 -dw 42, 69, 1134, 4012, 5912, 4012, 1134, 69 -dw 42, 69, 1134, 4011, 5911, 4011, 1134, 69 -dw 42, 69, 1135, 4011, 5911, 4011, 1135, 69 -dw 42, 69, 1135, 4011, 5910, 4011, 1135, 69 -dw 43, 70, 1135, 4011, 5910, 4011, 1135, 70 -dw 43, 70, 1135, 4011, 5910, 4011, 1135, 70 -dw 43, 70, 1135, 4011, 5909, 4011, 1135, 70 -dw 43, 70, 1136, 4011, 5909, 4011, 1136, 70 -dw 43, 70, 1136, 4011, 5908, 4011, 1136, 70 -dw 43, 70, 1136, 4011, 5908, 4011, 1136, 70 -dw 43, 70, 1136, 4011, 5907, 4011, 1136, 70 -dw 43, 70, 1136, 4011, 5907, 4011, 1136, 70 -dw 43, 70, 1137, 4011, 5906, 4011, 1137, 70 -dw 43, 70, 1137, 4011, 5906, 4011, 1137, 70 -dw 43, 70, 1137, 4011, 5905, 4011, 1137, 70 -dw 43, 70, 1137, 4011, 5905, 4011, 1137, 70 -dw 43, 70, 1137, 4011, 5905, 4011, 1137, 70 -dw 43, 70, 1138, 4011, 5904, 4011, 1138, 70 -dw 43, 70, 1138, 4010, 5904, 4010, 1138, 70 -dw 43, 70, 1138, 4010, 5903, 4010, 1138, 70 -dw 44, 70, 1138, 4010, 5903, 4010, 1138, 70 -dw 44, 70, 1139, 4010, 5902, 4010, 1139, 70 -dw 44, 70, 1139, 4010, 5902, 4010, 1139, 70 -dw 44, 70, 1139, 4010, 5901, 4010, 1139, 70 -dw 44, 70, 1139, 4010, 5901, 4010, 1139, 70 -dw 44, 70, 1139, 4010, 5901, 4010, 1139, 70 -dw 44, 70, 1140, 4010, 5900, 4010, 1140, 70 -dw 44, 70, 1140, 4010, 5900, 4010, 1140, 70 -dw 44, 71, 1140, 4010, 5899, 4010, 1140, 71 -dw 44, 71, 1140, 4010, 5899, 4010, 1140, 71 -dw 44, 71, 1140, 4010, 5898, 4010, 1140, 71 -dw 44, 71, 1141, 4010, 5898, 4010, 1141, 71 -dw 44, 71, 1141, 4010, 5898, 4010, 1141, 71 -dw 44, 71, 1141, 4010, 5897, 4010, 1141, 71 -dw 44, 71, 1141, 4010, 5897, 4010, 1141, 71 -dw 44, 71, 1141, 4009, 5896, 4009, 1141, 71 -dw 44, 71, 1142, 4009, 5896, 4009, 1142, 71 -dw 45, 71, 1142, 4009, 5895, 4009, 1142, 71 -dw 45, 71, 1142, 4009, 5895, 4009, 1142, 71 -dw 45, 71, 1142, 4009, 5894, 4009, 1142, 71 -dw 45, 71, 1142, 4009, 5894, 4009, 1142, 71 -dw 45, 71, 1143, 4009, 5894, 4009, 1143, 71 -dw 45, 71, 1143, 4009, 5893, 4009, 1143, 71 -dw 45, 71, 1143, 4009, 5893, 4009, 1143, 71 -dw 45, 71, 1143, 4009, 5892, 4009, 1143, 71 -dw 45, 71, 1143, 4009, 5892, 4009, 1143, 71 -dw 45, 71, 1144, 4009, 5891, 4009, 1144, 71 -dw 45, 71, 1144, 4009, 5891, 4009, 1144, 71 -dw 45, 71, 1144, 4009, 5891, 4009, 1144, 71 -dw 45, 71, 1144, 4009, 5890, 4009, 1144, 71 -dw 45, 71, 1144, 4009, 5890, 4009, 1144, 71 -dw 45, 71, 1145, 4009, 5889, 4009, 1145, 71 -dw 45, 71, 1145, 4008, 5889, 4008, 1145, 71 -dw 46, 72, 1145, 4008, 5888, 4008, 1145, 72 -dw 46, 72, 1145, 4008, 5888, 4008, 1145, 72 -dw 46, 72, 1145, 4008, 5888, 4008, 1145, 72 -dw 46, 72, 1146, 4008, 5887, 4008, 1146, 72 -dw 46, 72, 1146, 4008, 5887, 4008, 1146, 72 -dw 46, 72, 1146, 4008, 5886, 4008, 1146, 72 -dw 46, 72, 1146, 4008, 5886, 4008, 1146, 72 -dw 46, 72, 1146, 4008, 5885, 4008, 1146, 72 -dw 46, 72, 1147, 4008, 5885, 4008, 1147, 72 -dw 46, 72, 1147, 4008, 5885, 4008, 1147, 72 -dw 46, 72, 1147, 4008, 5884, 4008, 1147, 72 -dw 46, 72, 1147, 4008, 5884, 4008, 1147, 72 -dw 46, 72, 1147, 4008, 5883, 4008, 1147, 72 -dw 46, 72, 1148, 4008, 5883, 4008, 1148, 72 -dw 46, 72, 1148, 4008, 5883, 4008, 1148, 72 -dw 46, 72, 1148, 4008, 5882, 4008, 1148, 72 -dw 47, 72, 1148, 4008, 5882, 4008, 1148, 72 -dw 47, 72, 1148, 4007, 5881, 4007, 1148, 72 -dw 47, 72, 1149, 4007, 5881, 4007, 1149, 72 -dw 47, 72, 1149, 4007, 5880, 4007, 1149, 72 -dw 47, 72, 1149, 4007, 5880, 4007, 1149, 72 -dw 47, 72, 1149, 4007, 5880, 4007, 1149, 72 -dw 47, 72, 1149, 4007, 5879, 4007, 1149, 72 -dw 47, 72, 1150, 4007, 5879, 4007, 1150, 72 -dw 47, 72, 1150, 4007, 5878, 4007, 1150, 72 -dw 47, 73, 1150, 4007, 5878, 4007, 1150, 73 -dw 47, 73, 1150, 4007, 5877, 4007, 1150, 73 -dw 47, 73, 1150, 4007, 5877, 4007, 1150, 73 -dw 47, 73, 1151, 4007, 5877, 4007, 1151, 73 -dw 47, 73, 1151, 4007, 5876, 4007, 1151, 73 -dw 47, 73, 1151, 4007, 5876, 4007, 1151, 73 -dw 47, 73, 1151, 4007, 5875, 4007, 1151, 73 -dw 47, 73, 1151, 4007, 5875, 4007, 1151, 73 -dw 48, 73, 1152, 4007, 5875, 4007, 1152, 73 -dw 48, 73, 1152, 4007, 5874, 4007, 1152, 73 -dw 48, 73, 1152, 4006, 5874, 4006, 1152, 73 -dw 48, 73, 1152, 4006, 5873, 4006, 1152, 73 -dw 48, 73, 1152, 4006, 5873, 4006, 1152, 73 -dw 48, 73, 1153, 4006, 5873, 4006, 1153, 73 -dw 48, 73, 1153, 4006, 5872, 4006, 1153, 73 -dw 48, 73, 1153, 4006, 5872, 4006, 1153, 73 -dw 48, 73, 1153, 4006, 5871, 4006, 1153, 73 -dw 48, 73, 1153, 4006, 5871, 4006, 1153, 73 -dw 48, 73, 1153, 4006, 5870, 4006, 1153, 73 -dw 48, 73, 1154, 4006, 5870, 4006, 1154, 73 -dw 48, 73, 1154, 4006, 5870, 4006, 1154, 73 -dw 48, 73, 1154, 4006, 5869, 4006, 1154, 73 -dw 48, 73, 1154, 4006, 5869, 4006, 1154, 73 -dw 48, 73, 1154, 4006, 5868, 4006, 1154, 73 -dw 48, 73, 1155, 4006, 5868, 4006, 1155, 73 -dw 49, 73, 1155, 4006, 5868, 4006, 1155, 73 -dw 49, 74, 1155, 4006, 5867, 4006, 1155, 74 -dw 49, 74, 1155, 4006, 5867, 4006, 1155, 74 -dw 49, 74, 1155, 4005, 5866, 4005, 1155, 74 -dw 49, 74, 1156, 4005, 5866, 4005, 1156, 74 -dw 49, 74, 1156, 4005, 5866, 4005, 1156, 74 -dw 49, 74, 1156, 4005, 5865, 4005, 1156, 74 -dw 49, 74, 1156, 4005, 5865, 4005, 1156, 74 -dw 49, 74, 1156, 4005, 5864, 4005, 1156, 74 -dw 49, 74, 1157, 4005, 5864, 4005, 1157, 74 -dw 49, 74, 1157, 4005, 5864, 4005, 1157, 74 -dw 49, 74, 1157, 4005, 5863, 4005, 1157, 74 -dw 49, 74, 1157, 4005, 5863, 4005, 1157, 74 -dw 49, 74, 1157, 4005, 5862, 4005, 1157, 74 -dw 49, 74, 1157, 4005, 5862, 4005, 1157, 74 -dw 49, 74, 1158, 4005, 5862, 4005, 1158, 74 -dw 49, 74, 1158, 4005, 5861, 4005, 1158, 74 -dw 50, 74, 1158, 4005, 5861, 4005, 1158, 74 -dw 50, 74, 1158, 4005, 5860, 4005, 1158, 74 -dw 50, 74, 1158, 4005, 5860, 4005, 1158, 74 -dw 50, 74, 1159, 4005, 5860, 4005, 1159, 74 -dw 50, 74, 1159, 4004, 5859, 4004, 1159, 74 -dw 50, 74, 1159, 4004, 5859, 4004, 1159, 74 -dw 50, 74, 1159, 4004, 5858, 4004, 1159, 74 -dw 50, 74, 1159, 4004, 5858, 4004, 1159, 74 -dw 50, 74, 1160, 4004, 5858, 4004, 1160, 74 -dw 50, 74, 1160, 4004, 5857, 4004, 1160, 74 -dw 50, 74, 1160, 4004, 5857, 4004, 1160, 74 -dw 50, 75, 1160, 4004, 5857, 4004, 1160, 75 -dw 50, 75, 1160, 4004, 5856, 4004, 1160, 75 -dw 50, 75, 1160, 4004, 5856, 4004, 1160, 75 -dw 50, 75, 1161, 4004, 5855, 4004, 1161, 75 -dw 50, 75, 1161, 4004, 5855, 4004, 1161, 75 -dw 50, 75, 1161, 4004, 5855, 4004, 1161, 75 -dw 51, 75, 1161, 4004, 5854, 4004, 1161, 75 -dw 51, 75, 1161, 4004, 5854, 4004, 1161, 75 -dw 51, 75, 1162, 4004, 5853, 4004, 1162, 75 -dw 51, 75, 1162, 4004, 5853, 4004, 1162, 75 -dw 51, 75, 1162, 4004, 5853, 4004, 1162, 75 -dw 51, 75, 1162, 4003, 5852, 4003, 1162, 75 -dw 51, 75, 1162, 4003, 5852, 4003, 1162, 75 -dw 51, 75, 1162, 4003, 5851, 4003, 1162, 75 -dw 51, 75, 1163, 4003, 5851, 4003, 1163, 75 -dw 51, 75, 1163, 4003, 5851, 4003, 1163, 75 -dw 51, 75, 1163, 4003, 5850, 4003, 1163, 75 -dw 51, 75, 1163, 4003, 5850, 4003, 1163, 75 -dw 51, 75, 1163, 4003, 5850, 4003, 1163, 75 -dw 51, 75, 1164, 4003, 5849, 4003, 1164, 75 -dw 51, 75, 1164, 4003, 5849, 4003, 1164, 75 -dw 51, 75, 1164, 4003, 5848, 4003, 1164, 75 -dw 51, 75, 1164, 4003, 5848, 4003, 1164, 75 -dw 51, 75, 1164, 4003, 5848, 4003, 1164, 75 -dw 52, 75, 1164, 4003, 5847, 4003, 1164, 75 -dw 52, 75, 1165, 4003, 5847, 4003, 1165, 75 -dw 52, 75, 1165, 4003, 5846, 4003, 1165, 75 -dw 52, 76, 1165, 4003, 5846, 4003, 1165, 76 -dw 52, 76, 1165, 4003, 5846, 4003, 1165, 76 -dw 52, 76, 1165, 4003, 5845, 4003, 1165, 76 -dw 52, 76, 1165, 4002, 5845, 4002, 1165, 76 -dw 52, 76, 1166, 4002, 5845, 4002, 1166, 76 -dw 52, 76, 1166, 4002, 5844, 4002, 1166, 76 -dw 52, 76, 1166, 4002, 5844, 4002, 1166, 76 -dw 52, 76, 1166, 4002, 5843, 4002, 1166, 76 -dw 52, 76, 1166, 4002, 5843, 4002, 1166, 76 -dw 52, 76, 1167, 4002, 5843, 4002, 1167, 76 -dw 52, 76, 1167, 4002, 5842, 4002, 1167, 76 -dw 52, 76, 1167, 4002, 5842, 4002, 1167, 76 -dw 52, 76, 1167, 4002, 5842, 4002, 1167, 76 -dw 52, 76, 1167, 4002, 5841, 4002, 1167, 76 -dw 53, 76, 1167, 4002, 5841, 4002, 1167, 76 -dw 53, 76, 1168, 4002, 5840, 4002, 1168, 76 -dw 53, 76, 1168, 4002, 5840, 4002, 1168, 76 -dw 53, 76, 1168, 4002, 5840, 4002, 1168, 76 -dw 53, 76, 1168, 4002, 5839, 4002, 1168, 76 -dw 53, 76, 1168, 4002, 5839, 4002, 1168, 76 -dw 53, 76, 1169, 4002, 5839, 4002, 1169, 76 -dw 53, 76, 1169, 4002, 5838, 4002, 1169, 76 -dw 53, 76, 1169, 4001, 5838, 4001, 1169, 76 -dw 53, 76, 1169, 4001, 5837, 4001, 1169, 76 -dw 53, 76, 1169, 4001, 5837, 4001, 1169, 76 -dw 53, 76, 1169, 4001, 5837, 4001, 1169, 76 -dw 53, 76, 1170, 4001, 5836, 4001, 1170, 76 -dw 53, 76, 1170, 4001, 5836, 4001, 1170, 76 -dw 53, 77, 1170, 4001, 5836, 4001, 1170, 77 -dw 53, 77, 1170, 4001, 5835, 4001, 1170, 77 -dw 53, 77, 1170, 4001, 5835, 4001, 1170, 77 -dw 53, 77, 1170, 4001, 5834, 4001, 1170, 77 -dw 54, 77, 1171, 4001, 5834, 4001, 1171, 77 -dw 54, 77, 1171, 4001, 5834, 4001, 1171, 77 -dw 54, 77, 1171, 4001, 5833, 4001, 1171, 77 -dw 54, 77, 1171, 4001, 5833, 4001, 1171, 77 -dw 54, 77, 1171, 4001, 5833, 4001, 1171, 77 -dw 54, 77, 1171, 4001, 5832, 4001, 1171, 77 -dw 54, 77, 1172, 4001, 5832, 4001, 1172, 77 -dw 54, 77, 1172, 4001, 5832, 4001, 1172, 77 -dw 54, 77, 1172, 4001, 5831, 4001, 1172, 77 -dw 54, 77, 1172, 4000, 5831, 4000, 1172, 77 -dw 54, 77, 1172, 4000, 5830, 4000, 1172, 77 -dw 54, 77, 1172, 4000, 5830, 4000, 1172, 77 -dw 54, 77, 1173, 4000, 5830, 4000, 1173, 77 -dw 54, 77, 1173, 4000, 5829, 4000, 1173, 77 -dw 54, 77, 1173, 4000, 5829, 4000, 1173, 77 -dw 54, 77, 1173, 4000, 5829, 4000, 1173, 77 -dw 54, 77, 1173, 4000, 5828, 4000, 1173, 77 -dw 54, 77, 1174, 4000, 5828, 4000, 1174, 77 -dw 55, 77, 1174, 4000, 5828, 4000, 1174, 77 -dw 55, 77, 1174, 4000, 5827, 4000, 1174, 77 -dw 55, 77, 1174, 4000, 5827, 4000, 1174, 77 -dw 55, 77, 1174, 4000, 5826, 4000, 1174, 77 -dw 55, 77, 1174, 4000, 5826, 4000, 1174, 77 -dw 55, 77, 1175, 4000, 5826, 4000, 1175, 77 -dw 55, 78, 1175, 4000, 5825, 4000, 1175, 78 -dw 55, 78, 1175, 4000, 5825, 4000, 1175, 78 -dw 55, 78, 1175, 4000, 5825, 4000, 1175, 78 -dw 55, 78, 1175, 4000, 5824, 4000, 1175, 78 -dw 55, 78, 1175, 3999, 5824, 3999, 1175, 78 -dw 55, 78, 1176, 3999, 5824, 3999, 1176, 78 -dw 55, 78, 1176, 3999, 5823, 3999, 1176, 78 -dw 55, 78, 1176, 3999, 5823, 3999, 1176, 78 -dw 55, 78, 1176, 3999, 5822, 3999, 1176, 78 -dw 55, 78, 1176, 3999, 5822, 3999, 1176, 78 -dw 55, 78, 1176, 3999, 5822, 3999, 1176, 78 -dw 55, 78, 1177, 3999, 5821, 3999, 1177, 78 -dw 56, 78, 1177, 3999, 5821, 3999, 1177, 78 -dw 56, 78, 1177, 3999, 5821, 3999, 1177, 78 -dw 56, 78, 1177, 3999, 5820, 3999, 1177, 78 -dw 56, 78, 1177, 3999, 5820, 3999, 1177, 78 -dw 56, 78, 1177, 3999, 5820, 3999, 1177, 78 -dw 56, 78, 1178, 3999, 5819, 3999, 1178, 78 -dw 56, 78, 1178, 3999, 5819, 3999, 1178, 78 -dw 56, 78, 1178, 3999, 5819, 3999, 1178, 78 -dw 56, 78, 1178, 3999, 5818, 3999, 1178, 78 -dw 56, 78, 1178, 3999, 5818, 3999, 1178, 78 -dw 56, 78, 1178, 3999, 5818, 3999, 1178, 78 -dw 56, 78, 1179, 3999, 5817, 3999, 1179, 78 -dw 56, 78, 1179, 3998, 5817, 3998, 1179, 78 -dw 56, 78, 1179, 3998, 5817, 3998, 1179, 78 -dw 56, 78, 1179, 3998, 5816, 3998, 1179, 78 -dw 56, 78, 1179, 3998, 5816, 3998, 1179, 78 -dw 56, 78, 1179, 3998, 5815, 3998, 1179, 78 -dw 56, 78, 1180, 3998, 5815, 3998, 1180, 78 -dw 57, 79, 1180, 3998, 5815, 3998, 1180, 79 -dw 57, 79, 1180, 3998, 5814, 3998, 1180, 79 -dw 57, 79, 1180, 3998, 5814, 3998, 1180, 79 -dw 57, 79, 1180, 3998, 5814, 3998, 1180, 79 -dw 57, 79, 1180, 3998, 5813, 3998, 1180, 79 -dw 57, 79, 1180, 3998, 5813, 3998, 1180, 79 -dw 57, 79, 1181, 3998, 5813, 3998, 1181, 79 -dw 57, 79, 1181, 3998, 5812, 3998, 1181, 79 -dw 57, 79, 1181, 3998, 5812, 3998, 1181, 79 -dw 57, 79, 1181, 3998, 5812, 3998, 1181, 79 -dw 57, 79, 1181, 3998, 5811, 3998, 1181, 79 -dw 57, 79, 1181, 3998, 5811, 3998, 1181, 79 -dw 57, 79, 1182, 3998, 5811, 3998, 1182, 79 -dw 57, 79, 1182, 3998, 5810, 3998, 1182, 79 -dw 57, 79, 1182, 3997, 5810, 3997, 1182, 79 -dw 57, 79, 1182, 3997, 5810, 3997, 1182, 79 -dw 57, 79, 1182, 3997, 5809, 3997, 1182, 79 -dw 57, 79, 1182, 3997, 5809, 3997, 1182, 79 -dw 57, 79, 1183, 3997, 5809, 3997, 1183, 79 -dw 58, 79, 1183, 3997, 5808, 3997, 1183, 79 -dw 58, 79, 1183, 3997, 5808, 3997, 1183, 79 -dw 58, 79, 1183, 3997, 5808, 3997, 1183, 79 -dw 58, 79, 1183, 3997, 5807, 3997, 1183, 79 -dw 58, 79, 1183, 3997, 5807, 3997, 1183, 79 -dw 58, 79, 1184, 3997, 5807, 3997, 1184, 79 -dw 58, 79, 1184, 3997, 5806, 3997, 1184, 79 -dw 58, 79, 1184, 3997, 5806, 3997, 1184, 79 -dw 58, 79, 1184, 3997, 5806, 3997, 1184, 79 -dw 58, 79, 1184, 3997, 5805, 3997, 1184, 79 -dw 58, 79, 1184, 3997, 5805, 3997, 1184, 79 -dw 58, 80, 1184, 3997, 5805, 3997, 1184, 80 -dw 58, 80, 1185, 3997, 5804, 3997, 1185, 80 -dw 58, 80, 1185, 3997, 5804, 3997, 1185, 80 -dw 58, 80, 1185, 3997, 5803, 3997, 1185, 80 -dw 58, 80, 1185, 3996, 5803, 3996, 1185, 80 -dw 58, 80, 1185, 3996, 5803, 3996, 1185, 80 -dw 58, 80, 1185, 3996, 5802, 3996, 1185, 80 -dw 58, 80, 1186, 3996, 5802, 3996, 1186, 80 -dw 59, 80, 1186, 3996, 5802, 3996, 1186, 80 -dw 59, 80, 1186, 3996, 5801, 3996, 1186, 80 -dw 59, 80, 1186, 3996, 5801, 3996, 1186, 80 -dw 59, 80, 1186, 3996, 5801, 3996, 1186, 80 -dw 59, 80, 1186, 3996, 5800, 3996, 1186, 80 -dw 59, 80, 1187, 3996, 5800, 3996, 1187, 80 -dw 59, 80, 1187, 3996, 5800, 3996, 1187, 80 -dw 59, 80, 1187, 3996, 5799, 3996, 1187, 80 -dw 59, 80, 1187, 3996, 5799, 3996, 1187, 80 -dw 59, 80, 1187, 3996, 5799, 3996, 1187, 80 -dw 59, 80, 1187, 3996, 5799, 3996, 1187, 80 -dw 59, 80, 1187, 3996, 5798, 3996, 1187, 80 -dw 59, 80, 1188, 3996, 5798, 3996, 1188, 80 -dw 59, 80, 1188, 3996, 5798, 3996, 1188, 80 -dw 59, 80, 1188, 3996, 5797, 3996, 1188, 80 -dw 59, 80, 1188, 3996, 5797, 3996, 1188, 80 -dw 59, 80, 1188, 3996, 5797, 3996, 1188, 80 -dw 59, 80, 1188, 3995, 5796, 3995, 1188, 80 -dw 59, 80, 1189, 3995, 5796, 3995, 1189, 80 -dw 60, 80, 1189, 3995, 5796, 3995, 1189, 80 -dw 60, 80, 1189, 3995, 5795, 3995, 1189, 80 -dw 60, 80, 1189, 3995, 5795, 3995, 1189, 80 -dw 60, 80, 1189, 3995, 5795, 3995, 1189, 80 -dw 60, 81, 1189, 3995, 5794, 3995, 1189, 81 -dw 60, 81, 1189, 3995, 5794, 3995, 1189, 81 -dw 60, 81, 1190, 3995, 5794, 3995, 1190, 81 -dw 60, 81, 1190, 3995, 5793, 3995, 1190, 81 -dw 60, 81, 1190, 3995, 5793, 3995, 1190, 81 -dw 60, 81, 1190, 3995, 5793, 3995, 1190, 81 -dw 60, 81, 1190, 3995, 5792, 3995, 1190, 81 -dw 60, 81, 1190, 3995, 5792, 3995, 1190, 81 -dw 60, 81, 1191, 3995, 5792, 3995, 1191, 81 -dw 60, 81, 1191, 3995, 5791, 3995, 1191, 81 -dw 60, 81, 1191, 3995, 5791, 3995, 1191, 81 -dw 60, 81, 1191, 3995, 5791, 3995, 1191, 81 -dw 60, 81, 1191, 3995, 5790, 3995, 1191, 81 -dw 60, 81, 1191, 3995, 5790, 3995, 1191, 81 -dw 60, 81, 1191, 3995, 5790, 3995, 1191, 81 -dw 61, 81, 1192, 3994, 5789, 3994, 1192, 81 -dw 61, 81, 1192, 3994, 5789, 3994, 1192, 81 -dw 61, 81, 1192, 3994, 5789, 3994, 1192, 81 -dw 61, 81, 1192, 3994, 5788, 3994, 1192, 81 -dw 61, 81, 1192, 3994, 5788, 3994, 1192, 81 -dw 61, 81, 1192, 3994, 5788, 3994, 1192, 81 -dw 61, 81, 1192, 3994, 5787, 3994, 1192, 81 -dw 61, 81, 1193, 3994, 5787, 3994, 1193, 81 -dw 61, 81, 1193, 3994, 5787, 3994, 1193, 81 -dw 61, 81, 1193, 3994, 5787, 3994, 1193, 81 -dw 61, 81, 1193, 3994, 5786, 3994, 1193, 81 -dw 61, 81, 1193, 3994, 5786, 3994, 1193, 81 -dw 61, 81, 1193, 3994, 5786, 3994, 1193, 81 -dw 61, 81, 1194, 3994, 5785, 3994, 1194, 81 -dw 61, 81, 1194, 3994, 5785, 3994, 1194, 81 -dw 61, 81, 1194, 3994, 5785, 3994, 1194, 81 -dw 61, 81, 1194, 3994, 5784, 3994, 1194, 81 -dw 61, 82, 1194, 3994, 5784, 3994, 1194, 82 -dw 61, 82, 1194, 3994, 5784, 3994, 1194, 82 -dw 61, 82, 1194, 3994, 5783, 3994, 1194, 82 -dw 62, 82, 1195, 3994, 5783, 3994, 1195, 82 -dw 62, 82, 1195, 3993, 5783, 3993, 1195, 82 -dw 62, 82, 1195, 3993, 5782, 3993, 1195, 82 -dw 62, 82, 1195, 3993, 5782, 3993, 1195, 82 -dw 62, 82, 1195, 3993, 5782, 3993, 1195, 82 -dw 62, 82, 1195, 3993, 5781, 3993, 1195, 82 -dw 62, 82, 1195, 3993, 5781, 3993, 1195, 82 -dw 62, 82, 1196, 3993, 5781, 3993, 1196, 82 -dw 62, 82, 1196, 3993, 5781, 3993, 1196, 82 -dw 62, 82, 1196, 3993, 5780, 3993, 1196, 82 -dw 62, 82, 1196, 3993, 5780, 3993, 1196, 82 -dw 62, 82, 1196, 3993, 5780, 3993, 1196, 82 -dw 62, 82, 1196, 3993, 5779, 3993, 1196, 82 -dw 62, 82, 1196, 3993, 5779, 3993, 1196, 82 -dw 62, 82, 1197, 3993, 5779, 3993, 1197, 82 -dw 62, 82, 1197, 3993, 5778, 3993, 1197, 82 -dw 62, 82, 1197, 3993, 5778, 3993, 1197, 82 -dw 62, 82, 1197, 3993, 5778, 3993, 1197, 82 -dw 62, 82, 1197, 3993, 5777, 3993, 1197, 82 -dw 62, 82, 1197, 3993, 5777, 3993, 1197, 82 -dw 63, 82, 1197, 3993, 5777, 3993, 1197, 82 -dw 63, 82, 1198, 3993, 5777, 3993, 1198, 82 -dw 63, 82, 1198, 3993, 5776, 3993, 1198, 82 -dw 63, 82, 1198, 3992, 5776, 3992, 1198, 82 -dw 63, 82, 1198, 3992, 5776, 3992, 1198, 82 -dw 63, 82, 1198, 3992, 5775, 3992, 1198, 82 -dw 63, 82, 1198, 3992, 5775, 3992, 1198, 82 -dw 63, 82, 1198, 3992, 5775, 3992, 1198, 82 -dw 63, 82, 1199, 3992, 5774, 3992, 1199, 82 -dw 63, 83, 1199, 3992, 5774, 3992, 1199, 83 -dw 63, 83, 1199, 3992, 5774, 3992, 1199, 83 -dw 63, 83, 1199, 3992, 5773, 3992, 1199, 83 -dw 63, 83, 1199, 3992, 5773, 3992, 1199, 83 -dw 63, 83, 1199, 3992, 5773, 3992, 1199, 83 -dw 63, 83, 1199, 3992, 5773, 3992, 1199, 83 -dw 63, 83, 1200, 3992, 5772, 3992, 1200, 83 -dw 63, 83, 1200, 3992, 5772, 3992, 1200, 83 -dw 63, 83, 1200, 3992, 5772, 3992, 1200, 83 -dw 63, 83, 1200, 3992, 5771, 3992, 1200, 83 -dw 63, 83, 1200, 3992, 5771, 3992, 1200, 83 -dw 64, 83, 1200, 3992, 5771, 3992, 1200, 83 -dw 64, 83, 1200, 3992, 5770, 3992, 1200, 83 -dw 64, 83, 1201, 3992, 5770, 3992, 1201, 83 -dw 64, 83, 1201, 3992, 5770, 3992, 1201, 83 -dw 64, 83, 1201, 3992, 5770, 3992, 1201, 83 -dw 64, 83, 1201, 3991, 5769, 3991, 1201, 83 -dw 64, 83, 1201, 3991, 5769, 3991, 1201, 83 -dw 64, 83, 1201, 3991, 5769, 3991, 1201, 83 -dw 64, 83, 1201, 3991, 5768, 3991, 1201, 83 -dw 64, 83, 1202, 3991, 5768, 3991, 1202, 83 -dw 64, 83, 1202, 3991, 5768, 3991, 1202, 83 -dw 64, 83, 1202, 3991, 5767, 3991, 1202, 83 -dw 64, 83, 1202, 3991, 5767, 3991, 1202, 83 -dw 64, 83, 1202, 3991, 5767, 3991, 1202, 83 -dw 64, 83, 1202, 3991, 5767, 3991, 1202, 83 -dw 64, 83, 1202, 3991, 5766, 3991, 1202, 83 -dw 64, 83, 1203, 3991, 5766, 3991, 1203, 83 -dw 64, 83, 1203, 3991, 5766, 3991, 1203, 83 -dw 64, 83, 1203, 3991, 5765, 3991, 1203, 83 -dw 64, 83, 1203, 3991, 5765, 3991, 1203, 83 -dw 65, 83, 1203, 3991, 5765, 3991, 1203, 83 -dw 65, 83, 1203, 3991, 5765, 3991, 1203, 83 -dw 65, 83, 1203, 3991, 5764, 3991, 1203, 83 -dw 65, 84, 1204, 3991, 5764, 3991, 1204, 84 -dw 65, 84, 1204, 3991, 5764, 3991, 1204, 84 -dw 65, 84, 1204, 3991, 5763, 3991, 1204, 84 -dw 65, 84, 1204, 3991, 5763, 3991, 1204, 84 -dw 65, 84, 1204, 3990, 5763, 3990, 1204, 84 -dw 65, 84, 1204, 3990, 5762, 3990, 1204, 84 -dw 65, 84, 1204, 3990, 5762, 3990, 1204, 84 -dw 65, 84, 1205, 3990, 5762, 3990, 1205, 84 -dw 65, 84, 1205, 3990, 5762, 3990, 1205, 84 -dw 65, 84, 1205, 3990, 5761, 3990, 1205, 84 -dw 65, 84, 1205, 3990, 5761, 3990, 1205, 84 -dw 65, 84, 1205, 3990, 5761, 3990, 1205, 84 -dw 65, 84, 1205, 3990, 5760, 3990, 1205, 84 -dw 65, 84, 1205, 3990, 5760, 3990, 1205, 84 -dw 65, 84, 1205, 3990, 5760, 3990, 1205, 84 -dw 65, 84, 1206, 3990, 5760, 3990, 1206, 84 -dw 65, 84, 1206, 3990, 5759, 3990, 1206, 84 -dw 65, 84, 1206, 3990, 5759, 3990, 1206, 84 -dw 66, 84, 1206, 3990, 5759, 3990, 1206, 84 -dw 66, 84, 1206, 3990, 5758, 3990, 1206, 84 -dw 66, 84, 1206, 3990, 5758, 3990, 1206, 84 -dw 66, 84, 1206, 3990, 5758, 3990, 1206, 84 -dw 66, 84, 1207, 3990, 5758, 3990, 1207, 84 -dw 66, 84, 1207, 3990, 5757, 3990, 1207, 84 -dw 66, 84, 1207, 3990, 5757, 3990, 1207, 84 -dw 66, 84, 1207, 3990, 5757, 3990, 1207, 84 -dw 66, 84, 1207, 3990, 5756, 3990, 1207, 84 -dw 66, 84, 1207, 3989, 5756, 3989, 1207, 84 -dw 66, 84, 1207, 3989, 5756, 3989, 1207, 84 -dw 66, 84, 1207, 3989, 5756, 3989, 1207, 84 -dw 66, 84, 1208, 3989, 5755, 3989, 1208, 84 -dw 66, 84, 1208, 3989, 5755, 3989, 1208, 84 -dw 66, 84, 1208, 3989, 5755, 3989, 1208, 84 -dw 66, 84, 1208, 3989, 5754, 3989, 1208, 84 -dw 66, 84, 1208, 3989, 5754, 3989, 1208, 84 -dw 66, 85, 1208, 3989, 5754, 3989, 1208, 85 -dw 66, 85, 1208, 3989, 5754, 3989, 1208, 85 -dw 66, 85, 1209, 3989, 5753, 3989, 1209, 85 -dw 66, 85, 1209, 3989, 5753, 3989, 1209, 85 -dw 67, 85, 1209, 3989, 5753, 3989, 1209, 85 -dw 67, 85, 1209, 3989, 5752, 3989, 1209, 85 -dw 67, 85, 1209, 3989, 5752, 3989, 1209, 85 -dw 67, 85, 1209, 3989, 5752, 3989, 1209, 85 -dw 67, 85, 1209, 3989, 5752, 3989, 1209, 85 -dw 67, 85, 1209, 3989, 5751, 3989, 1209, 85 -dw 67, 85, 1210, 3989, 5751, 3989, 1210, 85 -dw 67, 85, 1210, 3989, 5751, 3989, 1210, 85 -dw 67, 85, 1210, 3989, 5750, 3989, 1210, 85 -dw 67, 85, 1210, 3989, 5750, 3989, 1210, 85 -dw 67, 85, 1210, 3989, 5750, 3989, 1210, 85 -dw 67, 85, 1210, 3988, 5750, 3988, 1210, 85 -dw 67, 85, 1210, 3988, 5749, 3988, 1210, 85 -dw 67, 85, 1211, 3988, 5749, 3988, 1211, 85 -dw 67, 85, 1211, 3988, 5749, 3988, 1211, 85 -dw 67, 85, 1211, 3988, 5749, 3988, 1211, 85 -dw 67, 85, 1211, 3988, 5748, 3988, 1211, 85 -dw 67, 85, 1211, 3988, 5748, 3988, 1211, 85 -dw 67, 85, 1211, 3988, 5748, 3988, 1211, 85 -dw 67, 85, 1211, 3988, 5747, 3988, 1211, 85 -dw 67, 85, 1211, 3988, 5747, 3988, 1211, 85 -dw 67, 85, 1212, 3988, 5747, 3988, 1212, 85 -dw 68, 85, 1212, 3988, 5747, 3988, 1212, 85 -dw 68, 85, 1212, 3988, 5746, 3988, 1212, 85 -dw 68, 85, 1212, 3988, 5746, 3988, 1212, 85 -dw 68, 85, 1212, 3988, 5746, 3988, 1212, 85 -dw 68, 85, 1212, 3988, 5745, 3988, 1212, 85 -dw 68, 85, 1212, 3988, 5745, 3988, 1212, 85 -dw 68, 85, 1212, 3988, 5745, 3988, 1212, 85 -dw 68, 85, 1213, 3988, 5745, 3988, 1213, 85 -dw 68, 85, 1213, 3988, 5744, 3988, 1213, 85 -dw 68, 85, 1213, 3988, 5744, 3988, 1213, 85 -dw 68, 86, 1213, 3988, 5744, 3988, 1213, 86 -dw 68, 86, 1213, 3988, 5744, 3988, 1213, 86 -dw 68, 86, 1213, 3988, 5743, 3988, 1213, 86 -dw 68, 86, 1213, 3987, 5743, 3987, 1213, 86 -dw 68, 86, 1213, 3987, 5743, 3987, 1213, 86 -dw 68, 86, 1214, 3987, 5742, 3987, 1214, 86 -dw 68, 86, 1214, 3987, 5742, 3987, 1214, 86 -dw 68, 86, 1214, 3987, 5742, 3987, 1214, 86 -dw 68, 86, 1214, 3987, 5742, 3987, 1214, 86 -dw 68, 86, 1214, 3987, 5741, 3987, 1214, 86 -dw 68, 86, 1214, 3987, 5741, 3987, 1214, 86 -dw 69, 86, 1214, 3987, 5741, 3987, 1214, 86 -dw 69, 86, 1214, 3987, 5741, 3987, 1214, 86 -dw 69, 86, 1215, 3987, 5740, 3987, 1215, 86 -dw 69, 86, 1215, 3987, 5740, 3987, 1215, 86 -dw 69, 86, 1215, 3987, 5740, 3987, 1215, 86 -dw 69, 86, 1215, 3987, 5740, 3987, 1215, 86 -dw 69, 86, 1215, 3987, 5739, 3987, 1215, 86 -dw 69, 86, 1215, 3987, 5739, 3987, 1215, 86 -dw 69, 86, 1215, 3987, 5739, 3987, 1215, 86 -dw 69, 86, 1215, 3987, 5738, 3987, 1215, 86 -dw 69, 86, 1216, 3987, 5738, 3987, 1216, 86 -dw 69, 86, 1216, 3987, 5738, 3987, 1216, 86 -dw 69, 86, 1216, 3987, 5738, 3987, 1216, 86 -dw 69, 86, 1216, 3987, 5737, 3987, 1216, 86 -dw 69, 86, 1216, 3987, 5737, 3987, 1216, 86 -dw 69, 86, 1216, 3987, 5737, 3987, 1216, 86 -dw 69, 86, 1216, 3986, 5737, 3986, 1216, 86 -dw 69, 86, 1216, 3986, 5736, 3986, 1216, 86 -dw 69, 86, 1217, 3986, 5736, 3986, 1217, 86 -dw 69, 86, 1217, 3986, 5736, 3986, 1217, 86 -dw 69, 86, 1217, 3986, 5736, 3986, 1217, 86 -dw 69, 86, 1217, 3986, 5735, 3986, 1217, 86 -dw 70, 86, 1217, 3986, 5735, 3986, 1217, 86 -dw 70, 86, 1217, 3986, 5735, 3986, 1217, 86 -dw 70, 86, 1217, 3986, 5734, 3986, 1217, 86 -dw 70, 86, 1217, 3986, 5734, 3986, 1217, 86 -dw 70, 87, 1218, 3986, 5734, 3986, 1218, 87 -dw 70, 87, 1218, 3986, 5734, 3986, 1218, 87 -dw 70, 87, 1218, 3986, 5733, 3986, 1218, 87 -dw 70, 87, 1218, 3986, 5733, 3986, 1218, 87 -dw 70, 87, 1218, 3986, 5733, 3986, 1218, 87 -dw 70, 87, 1218, 3986, 5733, 3986, 1218, 87 -dw 70, 87, 1218, 3986, 5732, 3986, 1218, 87 -dw 70, 87, 1218, 3986, 5732, 3986, 1218, 87 -dw 70, 87, 1219, 3986, 5732, 3986, 1219, 87 -dw 70, 87, 1219, 3986, 5732, 3986, 1219, 87 -dw 70, 87, 1219, 3986, 5731, 3986, 1219, 87 -dw 70, 87, 1219, 3986, 5731, 3986, 1219, 87 -dw 70, 87, 1219, 3986, 5731, 3986, 1219, 87 -dw 70, 87, 1219, 3986, 5731, 3986, 1219, 87 -dw 70, 87, 1219, 3985, 5730, 3985, 1219, 87 -dw 70, 87, 1219, 3985, 5730, 3985, 1219, 87 -dw 70, 87, 1220, 3985, 5730, 3985, 1220, 87 -dw 70, 87, 1220, 3985, 5730, 3985, 1220, 87 -dw 70, 87, 1220, 3985, 5729, 3985, 1220, 87 -dw 71, 87, 1220, 3985, 5729, 3985, 1220, 87 -dw 71, 87, 1220, 3985, 5729, 3985, 1220, 87 -dw 71, 87, 1220, 3985, 5729, 3985, 1220, 87 -dw 71, 87, 1220, 3985, 5728, 3985, 1220, 87 -dw 71, 87, 1220, 3985, 5728, 3985, 1220, 87 -dw 71, 87, 1221, 3985, 5728, 3985, 1221, 87 -dw 71, 87, 1221, 3985, 5728, 3985, 1221, 87 -dw 71, 87, 1221, 3985, 5727, 3985, 1221, 87 -dw 71, 87, 1221, 3985, 5727, 3985, 1221, 87 -dw 71, 87, 1221, 3985, 5727, 3985, 1221, 87 -dw 71, 87, 1221, 3985, 5726, 3985, 1221, 87 -dw 71, 87, 1221, 3985, 5726, 3985, 1221, 87 -dw 71, 87, 1221, 3985, 5726, 3985, 1221, 87 -dw 71, 87, 1221, 3985, 5726, 3985, 1221, 87 -dw 71, 87, 1222, 3985, 5725, 3985, 1222, 87 -dw 71, 87, 1222, 3985, 5725, 3985, 1222, 87 -dw 71, 87, 1222, 3985, 5725, 3985, 1222, 87 -dw 71, 87, 1222, 3985, 5725, 3985, 1222, 87 -dw 71, 87, 1222, 3985, 5724, 3985, 1222, 87 -dw 71, 87, 1222, 3985, 5724, 3985, 1222, 87 -dw 71, 88, 1222, 3984, 5724, 3984, 1222, 88 -dw 71, 88, 1222, 3984, 5724, 3984, 1222, 88 -dw 71, 88, 1223, 3984, 5723, 3984, 1223, 88 -dw 72, 88, 1223, 3984, 5723, 3984, 1223, 88 -dw 72, 88, 1223, 3984, 5723, 3984, 1223, 88 -dw 72, 88, 1223, 3984, 5723, 3984, 1223, 88 -dw 72, 88, 1223, 3984, 5722, 3984, 1223, 88 -dw 72, 88, 1223, 3984, 5722, 3984, 1223, 88 -dw 72, 88, 1223, 3984, 5722, 3984, 1223, 88 -dw 72, 88, 1223, 3984, 5722, 3984, 1223, 88 -dw 72, 88, 1223, 3984, 5721, 3984, 1223, 88 -dw 72, 88, 1224, 3984, 5721, 3984, 1224, 88 -dw 72, 88, 1224, 3984, 5721, 3984, 1224, 88 -dw 72, 88, 1224, 3984, 5721, 3984, 1224, 88 -dw 72, 88, 1224, 3984, 5720, 3984, 1224, 88 -dw 72, 88, 1224, 3984, 5720, 3984, 1224, 88 -dw 72, 88, 1224, 3984, 5720, 3984, 1224, 88 -dw 72, 88, 1224, 3984, 5720, 3984, 1224, 88 -dw 72, 88, 1224, 3984, 5719, 3984, 1224, 88 -dw 72, 88, 1225, 3984, 5719, 3984, 1225, 88 -dw 72, 88, 1225, 3984, 5719, 3984, 1225, 88 -dw 72, 88, 1225, 3984, 5719, 3984, 1225, 88 -dw 72, 88, 1225, 3984, 5718, 3984, 1225, 88 -dw 72, 88, 1225, 3984, 5718, 3984, 1225, 88 -dw 72, 88, 1225, 3984, 5718, 3984, 1225, 88 -dw 72, 88, 1225, 3984, 5718, 3984, 1225, 88 -dw 73, 88, 1225, 3983, 5718, 3983, 1225, 88 -dw 73, 88, 1225, 3983, 5717, 3983, 1225, 88 -dw 73, 88, 1226, 3983, 5717, 3983, 1226, 88 -dw 73, 88, 1226, 3983, 5717, 3983, 1226, 88 -dw 73, 88, 1226, 3983, 5717, 3983, 1226, 88 -dw 73, 88, 1226, 3983, 5716, 3983, 1226, 88 -dw 73, 88, 1226, 3983, 5716, 3983, 1226, 88 -dw 73, 88, 1226, 3983, 5716, 3983, 1226, 88 -dw 73, 88, 1226, 3983, 5716, 3983, 1226, 88 -dw 73, 88, 1226, 3983, 5715, 3983, 1226, 88 -dw 73, 88, 1226, 3983, 5715, 3983, 1226, 88 -dw 73, 88, 1227, 3983, 5715, 3983, 1227, 88 -dw 73, 88, 1227, 3983, 5715, 3983, 1227, 88 -dw 73, 88, 1227, 3983, 5714, 3983, 1227, 88 -dw 73, 89, 1227, 3983, 5714, 3983, 1227, 89 -dw 73, 89, 1227, 3983, 5714, 3983, 1227, 89 -dw 73, 89, 1227, 3983, 5714, 3983, 1227, 89 -dw 73, 89, 1227, 3983, 5713, 3983, 1227, 89 -dw 73, 89, 1227, 3983, 5713, 3983, 1227, 89 -dw 73, 89, 1227, 3983, 5713, 3983, 1227, 89 -dw 73, 89, 1228, 3983, 5713, 3983, 1228, 89 -dw 73, 89, 1228, 3983, 5712, 3983, 1228, 89 -dw 73, 89, 1228, 3983, 5712, 3983, 1228, 89 -dw 73, 89, 1228, 3983, 5712, 3983, 1228, 89 -dw 74, 89, 1228, 3983, 5712, 3983, 1228, 89 -dw 74, 89, 1228, 3983, 5711, 3983, 1228, 89 -dw 74, 89, 1228, 3982, 5711, 3982, 1228, 89 -dw 74, 89, 1228, 3982, 5711, 3982, 1228, 89 -dw 74, 89, 1229, 3982, 5711, 3982, 1229, 89 -dw 74, 89, 1229, 3982, 5711, 3982, 1229, 89 -dw 74, 89, 1229, 3982, 5710, 3982, 1229, 89 -dw 74, 89, 1229, 3982, 5710, 3982, 1229, 89 -dw 74, 89, 1229, 3982, 5710, 3982, 1229, 89 -dw 74, 89, 1229, 3982, 5710, 3982, 1229, 89 -dw 74, 89, 1229, 3982, 5709, 3982, 1229, 89 -dw 74, 89, 1229, 3982, 5709, 3982, 1229, 89 -dw 74, 89, 1229, 3982, 5709, 3982, 1229, 89 -dw 74, 89, 1230, 3982, 5709, 3982, 1230, 89 -dw 74, 89, 1230, 3982, 5708, 3982, 1230, 89 -dw 74, 89, 1230, 3982, 5708, 3982, 1230, 89 -dw 74, 89, 1230, 3982, 5708, 3982, 1230, 89 -dw 74, 89, 1230, 3982, 5708, 3982, 1230, 89 -dw 74, 89, 1230, 3982, 5707, 3982, 1230, 89 -dw 74, 89, 1230, 3982, 5707, 3982, 1230, 89 -dw 74, 89, 1230, 3982, 5707, 3982, 1230, 89 -dw 74, 89, 1230, 3982, 5707, 3982, 1230, 89 -dw 74, 89, 1230, 3982, 5707, 3982, 1230, 89 -dw 74, 89, 1231, 3982, 5706, 3982, 1231, 89 -dw 75, 89, 1231, 3982, 5706, 3982, 1231, 89 -dw 75, 89, 1231, 3982, 5706, 3982, 1231, 89 -dw 75, 89, 1231, 3982, 5706, 3982, 1231, 89 -dw 75, 89, 1231, 3982, 5705, 3982, 1231, 89 -dw 75, 89, 1231, 3982, 5705, 3982, 1231, 89 -dw 75, 89, 1231, 3981, 5705, 3981, 1231, 89 -dw 75, 89, 1231, 3981, 5705, 3981, 1231, 89 -dw 75, 90, 1231, 3981, 5704, 3981, 1231, 90 -dw 75, 90, 1232, 3981, 5704, 3981, 1232, 90 -dw 75, 90, 1232, 3981, 5704, 3981, 1232, 90 -dw 75, 90, 1232, 3981, 5704, 3981, 1232, 90 -dw 75, 90, 1232, 3981, 5704, 3981, 1232, 90 -dw 75, 90, 1232, 3981, 5703, 3981, 1232, 90 -dw 75, 90, 1232, 3981, 5703, 3981, 1232, 90 -dw 75, 90, 1232, 3981, 5703, 3981, 1232, 90 -dw 75, 90, 1232, 3981, 5703, 3981, 1232, 90 -dw 75, 90, 1232, 3981, 5702, 3981, 1232, 90 -dw 75, 90, 1233, 3981, 5702, 3981, 1233, 90 -dw 75, 90, 1233, 3981, 5702, 3981, 1233, 90 -dw 75, 90, 1233, 3981, 5702, 3981, 1233, 90 -dw 75, 90, 1233, 3981, 5701, 3981, 1233, 90 -dw 75, 90, 1233, 3981, 5701, 3981, 1233, 90 -dw 75, 90, 1233, 3981, 5701, 3981, 1233, 90 -dw 75, 90, 1233, 3981, 5701, 3981, 1233, 90 -dw 76, 90, 1233, 3981, 5701, 3981, 1233, 90 -dw 76, 90, 1233, 3981, 5700, 3981, 1233, 90 -dw 76, 90, 1234, 3981, 5700, 3981, 1234, 90 -dw 76, 90, 1234, 3981, 5700, 3981, 1234, 90 -dw 76, 90, 1234, 3981, 5700, 3981, 1234, 90 -dw 76, 90, 1234, 3981, 5699, 3981, 1234, 90 -dw 76, 90, 1234, 3981, 5699, 3981, 1234, 90 -dw 76, 90, 1234, 3981, 5699, 3981, 1234, 90 -dw 76, 90, 1234, 3980, 5699, 3980, 1234, 90 -dw 76, 90, 1234, 3980, 5699, 3980, 1234, 90 -dw 76, 90, 1234, 3980, 5698, 3980, 1234, 90 -dw 76, 90, 1234, 3980, 5698, 3980, 1234, 90 -dw 76, 90, 1235, 3980, 5698, 3980, 1235, 90 -dw 76, 90, 1235, 3980, 5698, 3980, 1235, 90 -dw 76, 90, 1235, 3980, 5697, 3980, 1235, 90 -dw 76, 90, 1235, 3980, 5697, 3980, 1235, 90 -dw 76, 90, 1235, 3980, 5697, 3980, 1235, 90 -dw 76, 90, 1235, 3980, 5697, 3980, 1235, 90 -dw 76, 90, 1235, 3980, 5696, 3980, 1235, 90 -dw 76, 90, 1235, 3980, 5696, 3980, 1235, 90 -dw 76, 90, 1235, 3980, 5696, 3980, 1235, 90 -dw 76, 90, 1236, 3980, 5696, 3980, 1236, 90 -dw 76, 90, 1236, 3980, 5696, 3980, 1236, 90 -dw 76, 90, 1236, 3980, 5695, 3980, 1236, 90 -dw 76, 90, 1236, 3980, 5695, 3980, 1236, 90 -dw 76, 90, 1236, 3980, 5695, 3980, 1236, 90 -dw 77, 91, 1236, 3980, 5695, 3980, 1236, 91 -dw 77, 91, 1236, 3980, 5694, 3980, 1236, 91 -dw 77, 91, 1236, 3980, 5694, 3980, 1236, 91 -dw 77, 91, 1236, 3980, 5694, 3980, 1236, 91 -dw 77, 91, 1236, 3980, 5694, 3980, 1236, 91 -dw 77, 91, 1237, 3980, 5694, 3980, 1237, 91 -dw 77, 91, 1237, 3980, 5693, 3980, 1237, 91 -dw 77, 91, 1237, 3980, 5693, 3980, 1237, 91 -dw 77, 91, 1237, 3980, 5693, 3980, 1237, 91 -dw 77, 91, 1237, 3980, 5693, 3980, 1237, 91 -dw 77, 91, 1237, 3979, 5693, 3979, 1237, 91 -dw 77, 91, 1237, 3979, 5692, 3979, 1237, 91 -dw 77, 91, 1237, 3979, 5692, 3979, 1237, 91 -dw 77, 91, 1237, 3979, 5692, 3979, 1237, 91 -dw 77, 91, 1237, 3979, 5692, 3979, 1237, 91 -dw 77, 91, 1238, 3979, 5691, 3979, 1238, 91 -dw 77, 91, 1238, 3979, 5691, 3979, 1238, 91 -dw 77, 91, 1238, 3979, 5691, 3979, 1238, 91 -dw 77, 91, 1238, 3979, 5691, 3979, 1238, 91 -dw 77, 91, 1238, 3979, 5691, 3979, 1238, 91 -dw 77, 91, 1238, 3979, 5690, 3979, 1238, 91 -dw 77, 91, 1238, 3979, 5690, 3979, 1238, 91 -dw 77, 91, 1238, 3979, 5690, 3979, 1238, 91 -dw 77, 91, 1238, 3979, 5690, 3979, 1238, 91 -dw 77, 91, 1238, 3979, 5689, 3979, 1238, 91 -dw 78, 91, 1239, 3979, 5689, 3979, 1239, 91 -dw 78, 91, 1239, 3979, 5689, 3979, 1239, 91 -dw 78, 91, 1239, 3979, 5689, 3979, 1239, 91 -dw 78, 91, 1239, 3979, 5689, 3979, 1239, 91 -dw 78, 91, 1239, 3979, 5688, 3979, 1239, 91 -dw 78, 91, 1239, 3979, 5688, 3979, 1239, 91 -dw 78, 91, 1239, 3979, 5688, 3979, 1239, 91 -dw 78, 91, 1239, 3979, 5688, 3979, 1239, 91 -dw 78, 91, 1239, 3979, 5688, 3979, 1239, 91 -dw 78, 91, 1239, 3979, 5687, 3979, 1239, 91 -dw 78, 91, 1240, 3979, 5687, 3979, 1240, 91 -dw 78, 91, 1240, 3979, 5687, 3979, 1240, 91 -dw 78, 91, 1240, 3979, 5687, 3979, 1240, 91 -dw 78, 91, 1240, 3979, 5686, 3979, 1240, 91 -dw 78, 91, 1240, 3978, 5686, 3978, 1240, 91 -dw 78, 91, 1240, 3978, 5686, 3978, 1240, 91 -dw 78, 91, 1240, 3978, 5686, 3978, 1240, 91 -dw 78, 91, 1240, 3978, 5686, 3978, 1240, 91 -dw 78, 91, 1240, 3978, 5685, 3978, 1240, 91 -dw 78, 91, 1240, 3978, 5685, 3978, 1240, 91 -dw 78, 91, 1241, 3978, 5685, 3978, 1241, 91 -dw 78, 92, 1241, 3978, 5685, 3978, 1241, 92 -dw 78, 92, 1241, 3978, 5685, 3978, 1241, 92 -dw 78, 92, 1241, 3978, 5684, 3978, 1241, 92 -dw 78, 92, 1241, 3978, 5684, 3978, 1241, 92 -dw 78, 92, 1241, 3978, 5684, 3978, 1241, 92 -dw 79, 92, 1241, 3978, 5684, 3978, 1241, 92 -dw 79, 92, 1241, 3978, 5684, 3978, 1241, 92 -dw 79, 92, 1241, 3978, 5683, 3978, 1241, 92 -dw 79, 92, 1241, 3978, 5683, 3978, 1241, 92 -dw 79, 92, 1242, 3978, 5683, 3978, 1242, 92 -dw 79, 92, 1242, 3978, 5683, 3978, 1242, 92 -dw 79, 92, 1242, 3978, 5683, 3978, 1242, 92 -dw 79, 92, 1242, 3978, 5682, 3978, 1242, 92 -dw 79, 92, 1242, 3978, 5682, 3978, 1242, 92 -dw 79, 92, 1242, 3978, 5682, 3978, 1242, 92 -dw 79, 92, 1242, 3978, 5682, 3978, 1242, 92 -dw 79, 92, 1242, 3978, 5681, 3978, 1242, 92 -dw 79, 92, 1242, 3978, 5681, 3978, 1242, 92 -dw 79, 92, 1242, 3978, 5681, 3978, 1242, 92 -dw 79, 92, 1243, 3978, 5681, 3978, 1243, 92 -dw 79, 92, 1243, 3978, 5681, 3978, 1243, 92 -dw 79, 92, 1243, 3978, 5680, 3978, 1243, 92 -dw 79, 92, 1243, 3977, 5680, 3977, 1243, 92 -dw 79, 92, 1243, 3977, 5680, 3977, 1243, 92 -dw 79, 92, 1243, 3977, 5680, 3977, 1243, 92 -dw 79, 92, 1243, 3977, 5680, 3977, 1243, 92 -dw 79, 92, 1243, 3977, 5679, 3977, 1243, 92 -dw 79, 92, 1243, 3977, 5679, 3977, 1243, 92 -dw 79, 92, 1243, 3977, 5679, 3977, 1243, 92 -dw 79, 92, 1243, 3977, 5679, 3977, 1243, 92 -dw 79, 92, 1244, 3977, 5679, 3977, 1244, 92 -dw 79, 92, 1244, 3977, 5678, 3977, 1244, 92 -dw 80, 92, 1244, 3977, 5678, 3977, 1244, 92 -dw 80, 92, 1244, 3977, 5678, 3977, 1244, 92 -dw 80, 92, 1244, 3977, 5678, 3977, 1244, 92 -dw 80, 92, 1244, 3977, 5678, 3977, 1244, 92 -dw 80, 92, 1244, 3977, 5677, 3977, 1244, 92 -dw 80, 92, 1244, 3977, 5677, 3977, 1244, 92 -dw 80, 92, 1244, 3977, 5677, 3977, 1244, 92 -dw 80, 92, 1244, 3977, 5677, 3977, 1244, 92 -dw 80, 92, 1245, 3977, 5677, 3977, 1245, 92 -dw 80, 92, 1245, 3977, 5676, 3977, 1245, 92 -dw 80, 92, 1245, 3977, 5676, 3977, 1245, 92 -dw 80, 92, 1245, 3977, 5676, 3977, 1245, 92 -dw 80, 92, 1245, 3977, 5676, 3977, 1245, 92 -dw 80, 92, 1245, 3977, 5676, 3977, 1245, 92 -dw 80, 92, 1245, 3977, 5675, 3977, 1245, 92 -dw 80, 93, 1245, 3977, 5675, 3977, 1245, 93 -dw 80, 93, 1245, 3977, 5675, 3977, 1245, 93 -dw 80, 93, 1245, 3977, 5675, 3977, 1245, 93 -dw 80, 93, 1245, 3977, 5675, 3977, 1245, 93 -dw 80, 93, 1246, 3977, 5674, 3977, 1246, 93 -dw 80, 93, 1246, 3977, 5674, 3977, 1246, 93 -dw 80, 93, 1246, 3976, 5674, 3976, 1246, 93 -dw 80, 93, 1246, 3976, 5674, 3976, 1246, 93 -dw 80, 93, 1246, 3976, 5674, 3976, 1246, 93 -dw 80, 93, 1246, 3976, 5673, 3976, 1246, 93 -dw 80, 93, 1246, 3976, 5673, 3976, 1246, 93 -dw 80, 93, 1246, 3976, 5673, 3976, 1246, 93 -dw 81, 93, 1246, 3976, 5673, 3976, 1246, 93 -dw 81, 93, 1246, 3976, 5673, 3976, 1246, 93 -dw 81, 93, 1247, 3976, 5672, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5672, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5672, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5672, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5672, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5671, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5671, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5671, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5671, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5671, 3976, 1247, 93 -dw 81, 93, 1247, 3976, 5670, 3976, 1247, 93 -dw 81, 93, 1248, 3976, 5670, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5670, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5670, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5670, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5669, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5669, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5669, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5669, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5669, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5668, 3976, 1248, 93 -dw 81, 93, 1248, 3976, 5668, 3976, 1248, 93 -dw 81, 93, 1249, 3976, 5668, 3976, 1249, 93 -dw 81, 93, 1249, 3975, 5668, 3975, 1249, 93 -dw 81, 93, 1249, 3975, 5668, 3975, 1249, 93 -dw 81, 93, 1249, 3975, 5668, 3975, 1249, 93 -dw 81, 93, 1249, 3975, 5667, 3975, 1249, 93 -dw 82, 93, 1249, 3975, 5667, 3975, 1249, 93 -dw 82, 93, 1249, 3975, 5667, 3975, 1249, 93 -dw 82, 93, 1249, 3975, 5667, 3975, 1249, 93 -dw 82, 93, 1249, 3975, 5667, 3975, 1249, 93 -dw 82, 93, 1249, 3975, 5666, 3975, 1249, 93 -dw 82, 93, 1249, 3975, 5666, 3975, 1249, 93 -dw 82, 93, 1250, 3975, 5666, 3975, 1250, 93 -dw 82, 93, 1250, 3975, 5666, 3975, 1250, 93 -dw 82, 94, 1250, 3975, 5666, 3975, 1250, 94 -dw 82, 94, 1250, 3975, 5665, 3975, 1250, 94 -dw 82, 94, 1250, 3975, 5665, 3975, 1250, 94 -dw 82, 94, 1250, 3975, 5665, 3975, 1250, 94 -dw 82, 94, 1250, 3975, 5665, 3975, 1250, 94 -dw 82, 94, 1250, 3975, 5665, 3975, 1250, 94 -dw 82, 94, 1250, 3975, 5664, 3975, 1250, 94 -dw 82, 94, 1250, 3975, 5664, 3975, 1250, 94 -dw 82, 94, 1250, 3975, 5664, 3975, 1250, 94 -dw 82, 94, 1250, 3975, 5664, 3975, 1250, 94 -dw 82, 94, 1251, 3975, 5664, 3975, 1251, 94 -dw 82, 94, 1251, 3975, 5664, 3975, 1251, 94 -dw 82, 94, 1251, 3975, 5663, 3975, 1251, 94 -dw 82, 94, 1251, 3975, 5663, 3975, 1251, 94 -dw 82, 94, 1251, 3975, 5663, 3975, 1251, 94 -dw 82, 94, 1251, 3975, 5663, 3975, 1251, 94 -dw 82, 94, 1251, 3975, 5663, 3975, 1251, 94 -dw 82, 94, 1251, 3975, 5662, 3975, 1251, 94 -dw 82, 94, 1251, 3975, 5662, 3975, 1251, 94 -dw 82, 94, 1251, 3975, 5662, 3975, 1251, 94 -dw 83, 94, 1251, 3974, 5662, 3974, 1251, 94 -dw 83, 94, 1252, 3974, 5662, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5661, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5661, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5661, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5661, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5661, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5661, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5660, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5660, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5660, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5660, 3974, 1252, 94 -dw 83, 94, 1252, 3974, 5660, 3974, 1252, 94 -dw 83, 94, 1253, 3974, 5659, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5659, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5659, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5659, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5659, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5659, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5658, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5658, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5658, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5658, 3974, 1253, 94 -dw 83, 94, 1253, 3974, 5658, 3974, 1253, 94 -dw 83, 94, 1254, 3974, 5657, 3974, 1254, 94 -dw 83, 94, 1254, 3974, 5657, 3974, 1254, 94 -dw 83, 94, 1254, 3974, 5657, 3974, 1254, 94 -dw 83, 94, 1254, 3974, 5657, 3974, 1254, 94 -dw 83, 94, 1254, 3974, 5657, 3974, 1254, 94 -dw 83, 94, 1254, 3974, 5657, 3974, 1254, 94 -dw 84, 94, 1254, 3974, 5656, 3974, 1254, 94 -dw 84, 94, 1254, 3974, 5656, 3974, 1254, 94 -dw 84, 95, 1254, 3974, 5656, 3974, 1254, 95 -dw 84, 95, 1254, 3973, 5656, 3973, 1254, 95 -dw 84, 95, 1254, 3973, 5656, 3973, 1254, 95 -dw 84, 95, 1254, 3973, 5655, 3973, 1254, 95 -dw 84, 95, 1255, 3973, 5655, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5655, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5655, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5655, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5655, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5654, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5654, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5654, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5654, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5654, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5654, 3973, 1255, 95 -dw 84, 95, 1255, 3973, 5653, 3973, 1255, 95 -dw 84, 95, 1256, 3973, 5653, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5653, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5653, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5653, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5652, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5652, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5652, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5652, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5652, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5652, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5651, 3973, 1256, 95 -dw 84, 95, 1256, 3973, 5651, 3973, 1256, 95 -dw 85, 95, 1257, 3973, 5651, 3973, 1257, 95 -dw 85, 95, 1257, 3973, 5651, 3973, 1257, 95 -dw 85, 95, 1257, 3973, 5651, 3973, 1257, 95 -dw 85, 95, 1257, 3973, 5651, 3973, 1257, 95 -dw 85, 95, 1257, 3973, 5650, 3973, 1257, 95 -dw 85, 95, 1257, 3973, 5650, 3973, 1257, 95 -dw 85, 95, 1257, 3973, 5650, 3973, 1257, 95 -dw 85, 95, 1257, 3972, 5650, 3972, 1257, 95 -dw 85, 95, 1257, 3972, 5650, 3972, 1257, 95 -dw 85, 95, 1257, 3972, 5650, 3972, 1257, 95 -dw 85, 95, 1257, 3972, 5649, 3972, 1257, 95 -dw 85, 95, 1257, 3972, 5649, 3972, 1257, 95 -dw 85, 95, 1257, 3972, 5649, 3972, 1257, 95 -dw 85, 95, 1258, 3972, 5649, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5649, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5648, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5648, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5648, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5648, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5648, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5648, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5647, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5647, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5647, 3972, 1258, 95 -dw 85, 95, 1258, 3972, 5647, 3972, 1258, 95 -dw 85, 95, 1259, 3972, 5647, 3972, 1259, 95 -dw 85, 95, 1259, 3972, 5647, 3972, 1259, 95 -dw 85, 96, 1259, 3972, 5646, 3972, 1259, 96 -dw 85, 96, 1259, 3972, 5646, 3972, 1259, 96 -dw 85, 96, 1259, 3972, 5646, 3972, 1259, 96 -dw 85, 96, 1259, 3972, 5646, 3972, 1259, 96 -dw 86, 96, 1259, 3972, 5646, 3972, 1259, 96 -dw 86, 96, 1259, 3972, 5646, 3972, 1259, 96 -dw 86, 96, 1259, 3972, 5645, 3972, 1259, 96 -dw 86, 96, 1259, 3972, 5645, 3972, 1259, 96 -dw 86, 96, 1259, 3972, 5645, 3972, 1259, 96 -dw 86, 96, 1259, 3972, 5645, 3972, 1259, 96 -dw 86, 96, 1259, 3972, 5645, 3972, 1259, 96 -dw 86, 96, 1260, 3972, 5645, 3972, 1260, 96 -dw 86, 96, 1260, 3972, 5644, 3972, 1260, 96 -dw 86, 96, 1260, 3972, 5644, 3972, 1260, 96 -dw 86, 96, 1260, 3972, 5644, 3972, 1260, 96 -dw 86, 96, 1260, 3971, 5644, 3971, 1260, 96 -dw 86, 96, 1260, 3971, 5644, 3971, 1260, 96 -dw 86, 96, 1260, 3971, 5644, 3971, 1260, 96 -dw 86, 96, 1260, 3971, 5643, 3971, 1260, 96 -dw 86, 96, 1260, 3971, 5643, 3971, 1260, 96 -dw 86, 96, 1260, 3971, 5643, 3971, 1260, 96 -dw 86, 96, 1260, 3971, 5643, 3971, 1260, 96 -dw 86, 96, 1260, 3971, 5643, 3971, 1260, 96 -dw 86, 96, 1260, 3971, 5643, 3971, 1260, 96 -dw 86, 96, 1261, 3971, 5642, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5642, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5642, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5642, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5642, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5642, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5641, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5641, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5641, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5641, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5641, 3971, 1261, 96 -dw 86, 96, 1261, 3971, 5641, 3971, 1261, 96 -dw 87, 96, 1261, 3971, 5640, 3971, 1261, 96 -dw 87, 96, 1262, 3971, 5640, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5640, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5640, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5640, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5640, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5639, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5639, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5639, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5639, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5639, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5639, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5639, 3971, 1262, 96 -dw 87, 96, 1262, 3971, 5638, 3971, 1262, 96 -dw 87, 96, 1263, 3971, 5638, 3971, 1263, 96 -dw 87, 96, 1263, 3970, 5638, 3970, 1263, 96 -dw 87, 96, 1263, 3970, 5638, 3970, 1263, 96 -dw 87, 96, 1263, 3970, 5638, 3970, 1263, 96 -dw 87, 96, 1263, 3970, 5638, 3970, 1263, 96 -dw 87, 96, 1263, 3970, 5637, 3970, 1263, 96 -dw 87, 96, 1263, 3970, 5637, 3970, 1263, 96 -dw 87, 96, 1263, 3970, 5637, 3970, 1263, 96 -dw 87, 97, 1263, 3970, 5637, 3970, 1263, 97 -dw 87, 97, 1263, 3970, 5637, 3970, 1263, 97 -dw 87, 97, 1263, 3970, 5637, 3970, 1263, 97 -dw 87, 97, 1263, 3970, 5636, 3970, 1263, 97 -dw 87, 97, 1263, 3970, 5636, 3970, 1263, 97 -dw 87, 97, 1263, 3970, 5636, 3970, 1263, 97 -dw 87, 97, 1264, 3970, 5636, 3970, 1264, 97 -dw 87, 97, 1264, 3970, 5636, 3970, 1264, 97 -dw 87, 97, 1264, 3970, 5636, 3970, 1264, 97 -dw 87, 97, 1264, 3970, 5636, 3970, 1264, 97 -dw 87, 97, 1264, 3970, 5635, 3970, 1264, 97 -dw 88, 97, 1264, 3970, 5635, 3970, 1264, 97 -dw 88, 97, 1264, 3970, 5635, 3970, 1264, 97 -dw 88, 97, 1264, 3970, 5635, 3970, 1264, 97 -dw 88, 97, 1264, 3970, 5635, 3970, 1264, 97 -dw 88, 97, 1264, 3970, 5635, 3970, 1264, 97 -dw 88, 97, 1264, 3970, 5634, 3970, 1264, 97 -dw 88, 97, 1264, 3970, 5634, 3970, 1264, 97 -dw 88, 97, 1264, 3970, 5634, 3970, 1264, 97 -dw 88, 97, 1265, 3970, 5634, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5634, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5634, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5633, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5633, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5633, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5633, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5633, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5633, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5633, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5632, 3970, 1265, 97 -dw 88, 97, 1265, 3970, 5632, 3970, 1265, 97 -dw 88, 97, 1265, 3969, 5632, 3969, 1265, 97 -dw 88, 97, 1265, 3969, 5632, 3969, 1265, 97 -dw 88, 97, 1266, 3969, 5632, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5632, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5631, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5631, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5631, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5631, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5631, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5631, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5631, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5630, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5630, 3969, 1266, 97 -dw 88, 97, 1266, 3969, 5630, 3969, 1266, 97 -dw 89, 97, 1266, 3969, 5630, 3969, 1266, 97 -dw 89, 97, 1266, 3969, 5630, 3969, 1266, 97 -dw 89, 97, 1267, 3969, 5630, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5630, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5629, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5629, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5629, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5629, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5629, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5629, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5628, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5628, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5628, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5628, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5628, 3969, 1267, 97 -dw 89, 97, 1267, 3969, 5628, 3969, 1267, 97 -dw 89, 98, 1268, 3969, 5628, 3969, 1268, 98 -dw 89, 98, 1268, 3969, 5627, 3969, 1268, 98 -dw 89, 98, 1268, 3969, 5627, 3969, 1268, 98 -dw 89, 98, 1268, 3969, 5627, 3969, 1268, 98 -dw 89, 98, 1268, 3969, 5627, 3969, 1268, 98 -dw 89, 98, 1268, 3969, 5627, 3969, 1268, 98 -dw 89, 98, 1268, 3969, 5627, 3969, 1268, 98 -dw 89, 98, 1268, 3969, 5627, 3969, 1268, 98 -dw 89, 98, 1268, 3969, 5626, 3969, 1268, 98 -dw 89, 98, 1268, 3968, 5626, 3968, 1268, 98 -dw 89, 98, 1268, 3968, 5626, 3968, 1268, 98 -dw 89, 98, 1268, 3968, 5626, 3968, 1268, 98 -dw 89, 98, 1268, 3968, 5626, 3968, 1268, 98 -dw 89, 98, 1268, 3968, 5626, 3968, 1268, 98 -dw 89, 98, 1268, 3968, 5626, 3968, 1268, 98 -dw 89, 98, 1269, 3968, 5625, 3968, 1269, 98 -dw 89, 98, 1269, 3968, 5625, 3968, 1269, 98 -dw 89, 98, 1269, 3968, 5625, 3968, 1269, 98 -dw 89, 98, 1269, 3968, 5625, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5625, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5625, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5624, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5624, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5624, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5624, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5624, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5624, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5624, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5623, 3968, 1269, 98 -dw 90, 98, 1269, 3968, 5623, 3968, 1269, 98 -dw 90, 98, 1270, 3968, 5623, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5623, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5623, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5623, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5623, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5622, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5622, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5622, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5622, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5622, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5622, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5622, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5621, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5621, 3968, 1270, 98 -dw 90, 98, 1270, 3968, 5621, 3968, 1270, 98 -dw 90, 98, 1271, 3968, 5621, 3968, 1271, 98 -dw 90, 98, 1271, 3968, 5621, 3968, 1271, 98 -dw 90, 98, 1271, 3968, 5621, 3968, 1271, 98 -dw 90, 98, 1271, 3968, 5621, 3968, 1271, 98 -dw 90, 98, 1271, 3968, 5620, 3968, 1271, 98 -dw 90, 98, 1271, 3967, 5620, 3967, 1271, 98 -dw 90, 98, 1271, 3967, 5620, 3967, 1271, 98 -dw 90, 98, 1271, 3967, 5620, 3967, 1271, 98 -dw 90, 98, 1271, 3967, 5620, 3967, 1271, 98 -dw 90, 98, 1271, 3967, 5620, 3967, 1271, 98 -dw 90, 98, 1271, 3967, 5620, 3967, 1271, 98 -dw 91, 98, 1271, 3967, 5620, 3967, 1271, 98 -dw 91, 98, 1271, 3967, 5619, 3967, 1271, 98 -dw 91, 98, 1271, 3967, 5619, 3967, 1271, 98 -dw 91, 98, 1271, 3967, 5619, 3967, 1271, 98 -dw 91, 98, 1272, 3967, 5619, 3967, 1272, 98 -dw 91, 98, 1272, 3967, 5619, 3967, 1272, 98 -dw 91, 98, 1272, 3967, 5619, 3967, 1272, 98 -dw 91, 98, 1272, 3967, 5619, 3967, 1272, 98 -dw 91, 98, 1272, 3967, 5618, 3967, 1272, 98 -dw 91, 98, 1272, 3967, 5618, 3967, 1272, 98 -dw 91, 99, 1272, 3967, 5618, 3967, 1272, 99 -dw 91, 99, 1272, 3967, 5618, 3967, 1272, 99 -dw 91, 99, 1272, 3967, 5618, 3967, 1272, 99 -dw 91, 99, 1272, 3967, 5618, 3967, 1272, 99 -dw 91, 99, 1272, 3967, 5618, 3967, 1272, 99 -dw 91, 99, 1272, 3967, 5617, 3967, 1272, 99 -dw 91, 99, 1272, 3967, 5617, 3967, 1272, 99 -dw 91, 99, 1272, 3967, 5617, 3967, 1272, 99 -dw 91, 99, 1272, 3967, 5617, 3967, 1272, 99 -dw 91, 99, 1273, 3967, 5617, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5617, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5617, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5616, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5616, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5616, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5616, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5616, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5616, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5616, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5616, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5615, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5615, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5615, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5615, 3967, 1273, 99 -dw 91, 99, 1273, 3967, 5615, 3967, 1273, 99 -dw 91, 99, 1274, 3967, 5615, 3967, 1274, 99 -dw 91, 99, 1274, 3966, 5615, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5614, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5614, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5614, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5614, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5614, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5614, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5614, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5614, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5613, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5613, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5613, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5613, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5613, 3966, 1274, 99 -dw 92, 99, 1274, 3966, 5613, 3966, 1274, 99 -dw 92, 99, 1275, 3966, 5613, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5612, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5612, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5612, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5612, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5612, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5612, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5612, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5612, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5611, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5611, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5611, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5611, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5611, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5611, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5611, 3966, 1275, 99 -dw 92, 99, 1275, 3966, 5611, 3966, 1275, 99 -dw 92, 99, 1276, 3966, 5610, 3966, 1276, 99 -dw 92, 99, 1276, 3966, 5610, 3966, 1276, 99 -dw 92, 99, 1276, 3966, 5610, 3966, 1276, 99 -dw 92, 99, 1276, 3966, 5610, 3966, 1276, 99 -dw 92, 99, 1276, 3966, 5610, 3966, 1276, 99 -dw 92, 99, 1276, 3966, 5610, 3966, 1276, 99 -dw 92, 99, 1276, 3966, 5610, 3966, 1276, 99 -dw 92, 99, 1276, 3966, 5610, 3966, 1276, 99 -dw 92, 99, 1276, 3966, 5609, 3966, 1276, 99 -dw 93, 99, 1276, 3966, 5609, 3966, 1276, 99 -dw 93, 99, 1276, 3966, 5609, 3966, 1276, 99 -dw 93, 99, 1276, 3966, 5609, 3966, 1276, 99 -dw 93, 99, 1276, 3966, 5609, 3966, 1276, 99 -dw 93, 100, 1276, 3965, 5609, 3965, 1276, 100 -dw 93, 100, 1276, 3965, 5609, 3965, 1276, 100 -dw 93, 100, 1276, 3965, 5608, 3965, 1276, 100 -dw 93, 100, 1277, 3965, 5608, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5608, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5608, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5608, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5608, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5608, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5608, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5607, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5607, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5607, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5607, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5607, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5607, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5607, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5607, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5606, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5606, 3965, 1277, 100 -dw 93, 100, 1277, 3965, 5606, 3965, 1277, 100 -dw 93, 100, 1278, 3965, 5606, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5606, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5606, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5606, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5606, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5606, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5605, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5605, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5605, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5605, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5605, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5605, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5605, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5605, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5604, 3965, 1278, 100 -dw 93, 100, 1278, 3965, 5604, 3965, 1278, 100 -dw 94, 100, 1278, 3965, 5604, 3965, 1278, 100 -dw 94, 100, 1279, 3965, 5604, 3965, 1279, 100 -dw 94, 100, 1279, 3965, 5604, 3965, 1279, 100 -dw 94, 100, 1279, 3965, 5604, 3965, 1279, 100 -dw 94, 100, 1279, 3965, 5604, 3965, 1279, 100 -dw 94, 100, 1279, 3965, 5604, 3965, 1279, 100 -dw 94, 100, 1279, 3965, 5603, 3965, 1279, 100 -dw 94, 100, 1279, 3965, 5603, 3965, 1279, 100 -dw 94, 100, 1279, 3965, 5603, 3965, 1279, 100 -dw 94, 100, 1279, 3965, 5603, 3965, 1279, 100 -dw 94, 100, 1279, 3964, 5603, 3964, 1279, 100 -dw 94, 100, 1279, 3964, 5603, 3964, 1279, 100 -dw 94, 100, 1279, 3964, 5603, 3964, 1279, 100 -dw 94, 100, 1279, 3964, 5603, 3964, 1279, 100 -dw 94, 100, 1279, 3964, 5602, 3964, 1279, 100 -dw 94, 100, 1279, 3964, 5602, 3964, 1279, 100 -dw 94, 100, 1279, 3964, 5602, 3964, 1279, 100 -dw 94, 100, 1279, 3964, 5602, 3964, 1279, 100 -dw 94, 100, 1279, 3964, 5602, 3964, 1279, 100 -dw 94, 100, 1280, 3964, 5602, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5602, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5602, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5602, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5601, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5601, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5601, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5601, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5601, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5601, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5601, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5601, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5600, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5600, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5600, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5600, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5600, 3964, 1280, 100 -dw 94, 100, 1280, 3964, 5600, 3964, 1280, 100 -dw 94, 100, 1281, 3964, 5600, 3964, 1281, 100 -dw 94, 100, 1281, 3964, 5600, 3964, 1281, 100 -dw 94, 100, 1281, 3964, 5600, 3964, 1281, 100 -dw 94, 101, 1281, 3964, 5599, 3964, 1281, 101 -dw 94, 101, 1281, 3964, 5599, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5599, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5599, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5599, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5599, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5599, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5599, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5598, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5598, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5598, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5598, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5598, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5598, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5598, 3964, 1281, 101 -dw 95, 101, 1281, 3964, 5598, 3964, 1281, 101 -dw 95, 101, 1282, 3964, 5598, 3964, 1282, 101 -dw 95, 101, 1282, 3964, 5597, 3964, 1282, 101 -dw 95, 101, 1282, 3964, 5597, 3964, 1282, 101 -dw 95, 101, 1282, 3963, 5597, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5597, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5597, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5597, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5597, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5597, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5597, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5596, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5596, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5596, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5596, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5596, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5596, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5596, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5596, 3963, 1282, 101 -dw 95, 101, 1282, 3963, 5596, 3963, 1282, 101 -dw 95, 101, 1283, 3963, 5595, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5595, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5595, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5595, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5595, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5595, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5595, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5595, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5595, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5594, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5594, 3963, 1283, 101 -dw 95, 101, 1283, 3963, 5594, 3963, 1283, 101 -dw 96, 101, 1283, 3963, 5594, 3963, 1283, 101 -dw 96, 101, 1283, 3963, 5594, 3963, 1283, 101 -dw 96, 101, 1283, 3963, 5594, 3963, 1283, 101 -dw 96, 101, 1283, 3963, 5594, 3963, 1283, 101 -dw 96, 101, 1283, 3963, 5594, 3963, 1283, 101 -dw 96, 101, 1283, 3963, 5594, 3963, 1283, 101 -dw 96, 101, 1283, 3963, 5593, 3963, 1283, 101 -dw 96, 101, 1284, 3963, 5593, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5593, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5593, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5593, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5593, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5593, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5593, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5593, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5593, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5592, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5592, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5592, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5592, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5592, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5592, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5592, 3963, 1284, 101 -dw 96, 101, 1284, 3963, 5592, 3963, 1284, 101 -dw 96, 101, 1284, 3962, 5592, 3962, 1284, 101 -dw 96, 101, 1284, 3962, 5591, 3962, 1284, 101 -dw 96, 101, 1284, 3962, 5591, 3962, 1284, 101 -dw 96, 101, 1285, 3962, 5591, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5591, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5591, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5591, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5591, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5591, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5591, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5590, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5590, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5590, 3962, 1285, 101 -dw 96, 101, 1285, 3962, 5590, 3962, 1285, 101 -dw 96, 102, 1285, 3962, 5590, 3962, 1285, 102 -dw 96, 102, 1285, 3962, 5590, 3962, 1285, 102 -dw 96, 102, 1285, 3962, 5590, 3962, 1285, 102 -dw 96, 102, 1285, 3962, 5590, 3962, 1285, 102 -dw 96, 102, 1285, 3962, 5590, 3962, 1285, 102 -dw 96, 102, 1285, 3962, 5590, 3962, 1285, 102 -dw 96, 102, 1285, 3962, 5589, 3962, 1285, 102 -dw 96, 102, 1285, 3962, 5589, 3962, 1285, 102 -dw 96, 102, 1285, 3962, 5589, 3962, 1285, 102 -dw 97, 102, 1286, 3962, 5589, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5589, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5589, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5589, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5589, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5589, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5589, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5588, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5587, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5587, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5587, 3962, 1286, 102 -dw 97, 102, 1286, 3962, 5587, 3962, 1286, 102 -dw 97, 102, 1287, 3962, 5587, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5587, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5587, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5587, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5587, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5586, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5586, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5586, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5586, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5586, 3962, 1287, 102 -dw 97, 102, 1287, 3962, 5586, 3962, 1287, 102 -dw 97, 102, 1287, 3961, 5586, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5586, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5586, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5586, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5586, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5585, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5585, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5585, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5585, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5585, 3961, 1287, 102 -dw 97, 102, 1287, 3961, 5585, 3961, 1287, 102 -dw 97, 102, 1288, 3961, 5585, 3961, 1288, 102 -dw 97, 102, 1288, 3961, 5585, 3961, 1288, 102 -dw 97, 102, 1288, 3961, 5585, 3961, 1288, 102 -dw 97, 102, 1288, 3961, 5585, 3961, 1288, 102 -dw 97, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 97, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 97, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5584, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5583, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5583, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5583, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5583, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5583, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5583, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5583, 3961, 1288, 102 -dw 98, 102, 1288, 3961, 5583, 3961, 1288, 102 -dw 98, 102, 1289, 3961, 5583, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5583, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5583, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5582, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5581, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5581, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5581, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5581, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5581, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5581, 3961, 1289, 102 -dw 98, 102, 1289, 3961, 5581, 3961, 1289, 102 -dw 98, 103, 1289, 3961, 5581, 3961, 1289, 103 -dw 98, 103, 1289, 3961, 5581, 3961, 1289, 103 -dw 98, 103, 1289, 3961, 5581, 3961, 1289, 103 -dw 98, 103, 1290, 3961, 5581, 3961, 1290, 103 -dw 98, 103, 1290, 3961, 5580, 3961, 1290, 103 -dw 98, 103, 1290, 3961, 5580, 3961, 1290, 103 -dw 98, 103, 1290, 3961, 5580, 3961, 1290, 103 -dw 98, 103, 1290, 3960, 5580, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5580, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5580, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5580, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5580, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5580, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5580, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5580, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 98, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 99, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 99, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 99, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 99, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 99, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 99, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 99, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 99, 103, 1290, 3960, 5579, 3960, 1290, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5578, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5577, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5576, 3960, 1291, 103 -dw 99, 103, 1291, 3960, 5576, 3960, 1291, 103 -dw 99, 103, 1292, 3960, 5576, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5576, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5576, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5576, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5576, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5576, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5576, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5576, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5576, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3960, 5575, 3960, 1292, 103 -dw 99, 103, 1292, 3959, 5575, 3959, 1292, 103 -dw 99, 103, 1292, 3959, 5574, 3959, 1292, 103 -dw 99, 103, 1292, 3959, 5574, 3959, 1292, 103 -dw 99, 103, 1292, 3959, 5574, 3959, 1292, 103 -dw 100, 103, 1292, 3959, 5574, 3959, 1292, 103 -dw 100, 103, 1293, 3959, 5574, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5574, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5574, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5574, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5574, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5574, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5574, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5574, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5573, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5572, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5572, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5572, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5572, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5572, 3959, 1293, 103 -dw 100, 103, 1293, 3959, 5572, 3959, 1293, 103 -dw 100, 103, 1294, 3959, 5572, 3959, 1294, 103 -dw 100, 103, 1294, 3959, 5572, 3959, 1294, 103 -dw 100, 103, 1294, 3959, 5572, 3959, 1294, 103 -dw 100, 103, 1294, 3959, 5572, 3959, 1294, 103 -dw 100, 103, 1294, 3959, 5572, 3959, 1294, 103 -dw 100, 104, 1294, 3959, 5572, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5572, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5571, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5570, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5570, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5570, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5570, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5570, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5570, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5570, 3959, 1294, 104 -dw 100, 104, 1294, 3959, 5570, 3959, 1294, 104 -dw 100, 104, 1295, 3959, 5570, 3959, 1295, 104 -dw 100, 104, 1295, 3959, 5570, 3959, 1295, 104 -dw 100, 104, 1295, 3959, 5570, 3959, 1295, 104 -dw 100, 104, 1295, 3959, 5570, 3959, 1295, 104 -dw 100, 104, 1295, 3959, 5570, 3959, 1295, 104 -dw 100, 104, 1295, 3959, 5569, 3959, 1295, 104 -dw 100, 104, 1295, 3959, 5569, 3959, 1295, 104 -dw 101, 104, 1295, 3959, 5569, 3959, 1295, 104 -dw 101, 104, 1295, 3959, 5569, 3959, 1295, 104 -dw 101, 104, 1295, 3959, 5569, 3959, 1295, 104 -dw 101, 104, 1295, 3959, 5569, 3959, 1295, 104 -dw 101, 104, 1295, 3959, 5569, 3959, 1295, 104 -dw 101, 104, 1295, 3958, 5569, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5569, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5569, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5569, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5569, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5569, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1295, 3958, 5568, 3958, 1295, 104 -dw 101, 104, 1296, 3958, 5568, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5568, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5568, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5568, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5567, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1296, 3958, 5566, 3958, 1296, 104 -dw 101, 104, 1297, 3958, 5566, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5566, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 101, 104, 1297, 3958, 5565, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1297, 3958, 5564, 3958, 1297, 104 -dw 102, 104, 1298, 3958, 5563, 3958, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5563, 3957, 1298, 104 -dw 102, 104, 1298, 3957, 5562, 3957, 1298, 104 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5562, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5561, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5561, 3957, 1298, 105 -dw 102, 105, 1298, 3957, 5561, 3957, 1298, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5561, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 102, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 103, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 103, 105, 1299, 3957, 5560, 3957, 1299, 105 -dw 103, 105, 1299, 3957, 5559, 3957, 1299, 105 -dw 103, 105, 1299, 3957, 5559, 3957, 1299, 105 -dw 103, 105, 1299, 3957, 5559, 3957, 1299, 105 -dw 103, 105, 1299, 3957, 5559, 3957, 1299, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5559, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3957, 5558, 3957, 1300, 105 -dw 103, 105, 1300, 3956, 5558, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5558, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5558, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5558, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5558, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5558, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5557, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5557, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5557, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5557, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5557, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5557, 3956, 1300, 105 -dw 103, 105, 1300, 3956, 5557, 3956, 1300, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5557, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5556, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1301, 3956, 5555, 3956, 1301, 105 -dw 103, 105, 1302, 3956, 5555, 3956, 1302, 105 -dw 103, 105, 1302, 3956, 5555, 3956, 1302, 105 -dw 103, 105, 1302, 3956, 5555, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5555, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5555, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5555, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5555, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5555, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5554, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5553, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5553, 3956, 1302, 105 -dw 104, 105, 1302, 3956, 5553, 3956, 1302, 105 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1302, 3956, 5553, 3956, 1302, 106 -dw 104, 106, 1303, 3956, 5553, 3956, 1303, 106 -dw 104, 106, 1303, 3956, 5553, 3956, 1303, 106 -dw 104, 106, 1303, 3956, 5553, 3956, 1303, 106 -dw 104, 106, 1303, 3956, 5553, 3956, 1303, 106 -dw 104, 106, 1303, 3956, 5553, 3956, 1303, 106 -dw 104, 106, 1303, 3956, 5553, 3956, 1303, 106 -dw 104, 106, 1303, 3956, 5552, 3956, 1303, 106 -dw 104, 106, 1303, 3956, 5552, 3956, 1303, 106 -dw 104, 106, 1303, 3956, 5552, 3956, 1303, 106 -dw 104, 106, 1303, 3956, 5552, 3956, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5552, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1303, 3955, 5551, 3955, 1303, 106 -dw 104, 106, 1304, 3955, 5551, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5551, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5551, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 104, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5550, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1304, 3955, 5549, 3955, 1304, 106 -dw 105, 106, 1305, 3955, 5549, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5548, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3955, 5547, 3955, 1305, 106 -dw 105, 106, 1305, 3954, 5547, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5547, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5547, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5547, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5547, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5547, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5547, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5547, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5546, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5546, 3954, 1305, 106 -dw 105, 106, 1305, 3954, 5546, 3954, 1305, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5546, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 105, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5545, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5544, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5544, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5544, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5544, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5544, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5544, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5544, 3954, 1306, 106 -dw 106, 106, 1306, 3954, 5544, 3954, 1306, 106 -dw 106, 106, 1307, 3954, 5544, 3954, 1307, 106 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5544, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5543, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1307, 3954, 5542, 3954, 1307, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5542, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5541, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5541, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5541, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5541, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5541, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5541, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5541, 3954, 1308, 107 -dw 106, 107, 1308, 3954, 5541, 3954, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5541, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 106, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1308, 3953, 5540, 3953, 1308, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5540, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5539, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1309, 3953, 5538, 3953, 1309, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5538, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5537, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 -dw 107, 107, 1310, 3953, 5536, 3953, 1310, 107 - diff --git a/tools/zsnes/src/cpu/irq.asm b/tools/zsnes/src/cpu/irq.asm deleted file mode 100644 index c1a90c5..0000000 --- a/tools/zsnes/src/cpu/irq.asm +++ /dev/null @@ -1,553 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%include "macros.mac" - -EXTSYM flagnz,flago,flagc,SfxSCMR,curnmi,execloop,initaddrl,nmiv,snesmap2 -EXTSYM snesmmap,stackand,stackor,xe,xirqb,xpb,xpc,xs,irqon,irqv,irqv8 -EXTSYM execloopdeb,nmiv8,membank0w8 - -; NMI Hardware 00FFFA,B 00FFEA,B 3 -> 000108 -; RES Hardware 00FFFC.D 00FFFC,D 1 -; BRK Software 00FFFE,F 00FFE6,7 N/A -; IRQ Hardware 00FFFE,F 00FFEE,F 4 -> 00010C - - -%macro makedl 0 - and dl,00111100b - test dword[flagnz],18000h - jz %%noneg - or dl,80h -%%noneg - test dword[flagnz],0FFFFh - jnz %%nozero - or dl,02h -%%nozero - test dword[flagc],0FFh - jz %%nocarry - or dl,01h -%%nocarry - test dword[flago],0FFh - jz %%nov - or dl,40h -%%nov -%endmacro - -SECTION .text - -;******************************************************* -; SwitchToNMI/VIRQ Calls NMI/VIRQ -;******************************************************* -NEWSYM switchtonmi - mov byte[curnmi],1 - sub dh,100 - test byte[xe],1 - jne near NMIemulmode - mov ebx,esi - sub ebx,[initaddrl] - mov [xpc],bx - - xor ebx,ebx - - mov cx,[xs] - mov al,[xpb] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc+1] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc] - 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 [xs],cx - - xor bh,bh - mov bl,[xirqb] - mov [xpb],bl - xor eax,eax - mov ax,[nmiv] - test byte[SfxSCMR],10h - jz .nosfxnmi -; mov ax,0108h -.nosfxnmi - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloop - -NEWSYM NMIemulmode - mov ebx,esi - sub ebx,[initaddrl] - mov [xpc],bx - - mov cx,[xs] - mov al,[xpc+1] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc] - 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 [xs],cx - - xor bh,bh - mov [xpb],bh - mov bl,[xpb] - xor eax,eax - mov ax,[nmiv8] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloop - -NEWSYM switchtovirq - mov byte[irqon],80h - sub dh,3 - test byte[xe],1 - jne near IRQemulmode - - mov ebx,esi - sub ebx,[initaddrl] - mov [xpc],bx - - mov cx,[xs] - mov al,[xpb] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc+1] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc] - 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 [xs],cx - - xor bh,bh - mov bl,[xirqb] - mov [xpb],bl - xor eax,eax - mov ax,[irqv] - test byte[SfxSCMR],10h - jz .nosfxnmi - mov ax,010Ch -.nosfxnmi - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloop - -NEWSYM switchtovirqret - mov byte[irqon],80h - test byte[xe],1 - jne near IRQemulmode - - mov ebx,esi - sub ebx,[initaddrl] - mov [xpc],bx - - mov cx,[xs] - mov al,[xpb] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc+1] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc] - 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 [xs],cx - - xor bh,bh - mov bl,[xirqb] - mov [xpb],bl - xor eax,eax - mov ax,[irqv] - test byte[SfxSCMR],10h - jz .nosfxnmi - mov ax,010Ch -.nosfxnmi - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - ret -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - ret - -NEWSYM IRQemulmode - mov ebx,esi - sub ebx,[initaddrl] - mov [xpc],bx - - mov cx,[xs] - mov al,[xpc+1] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc] - 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 [xs],cx - - xor bh,bh - mov [xpb],bh - mov bl,[xpb] - xor eax,eax - mov ax,[irqv8] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloop - - -NEWSYM switchtovirqdeb - mov byte[irqon],80h - test byte[xe],1 - jne near IRQemulmodedeb - - mov ebx,esi - sub ebx,[initaddrl] - mov [xpc],bx - - mov cx,[xs] - mov al,[xpb] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc+1] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc] - 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 [xs],cx - - xor bh,bh - mov bl,[xirqb] - mov [xpb],bl - xor eax,eax - mov ax,[irqv] - test byte[SfxSCMR],10h - jz .nosfxnmi - mov ax,010Ch -.nosfxnmi - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloopdeb -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloopdeb - -NEWSYM IRQemulmodedeb - mov ebx,esi - sub ebx,[initaddrl] - mov [xpc],bx - - mov cx,[xs] - mov al,[xpc+1] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc] - 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 [xs],cx - - xor bh,bh - mov [xpb],bh - mov bl,[xpb] - xor eax,eax - mov ax,[irqv8] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloopdeb -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloopdeb - -NEWSYM switchtonmideb - mov byte[curnmi],1 - test byte[xe],1 - jne near NMIemulmodedeb - mov ebx,esi - sub ebx,[initaddrl] - mov [xpc],bx - - mov cx,[xs] - mov al,[xpb] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc+1] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc] - 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 [xs],cx - - xor bh,bh - mov bl,[xirqb] - mov [xpb],bl - xor eax,eax - mov ax,[nmiv] - test byte[SfxSCMR],10h - jz .nosfxnmi - mov ax,0108h -.nosfxnmi - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloopdeb -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloopdeb - -NEWSYM NMIemulmodedeb - mov ebx,esi - sub ebx,[initaddrl] - mov [xpc],bx - - mov cx,[xs] - mov al,[xpc+1] - call membank0w8 - dec cx - and cx,word[stackand] - or cx,word[stackor] - - mov al,[xpc] - 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 [xs],cx - - xor bh,bh - mov [xpb],bh - mov bl,[xpb] - xor eax,eax - mov ax,[nmiv8] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloopdeb -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - jmp execloopdeb diff --git a/tools/zsnes/src/cpu/memory.asm b/tools/zsnes/src/cpu/memory.asm deleted file mode 100644 index 11f8f20..0000000 --- a/tools/zsnes/src/cpu/memory.asm +++ /dev/null @@ -1,2271 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 romdata,sramb4save,curromspace,SA1Overflow -EXTSYM SFXEnable,regptra,sfxramdata,snesmmap,wramdataa -EXTSYM DSP1Write8b,regptwa,writeon,DSP1Read16b -EXTSYM Bank0datr8,Bank0datw8,Bank0datr16,Bank0datw16,xd,SA1xd -EXTSYM DSP1Read8b,DSP1Type,SA1Enable,DSP1Write16b -EXTSYM ramsize,ramsizeand,sram,sram2,ram7fa -EXTSYM SA1Status,IRAM,CurBWPtr,SA1RAMArea -EXTSYM Sdd1Mode,Sdd1Bank,Sdd1Addr,Sdd1NewAddr,memtabler8,AddrNoIncr,SDD1BankA -EXTSYM SDD1_init,SDD1_get_byte,BWShift,SA1BWPtr - -;******************************************************* -; Register & Memory Access Banks (0 - 3F) / (80 - BF) -;******************************************************* -; enter : BL = bank number, CX = address location -; leave : AL = value read - -SECTION .text - -NEWSYM regaccessbankr8 - test ecx,8000h - jz .regacc - mov ebx,[snesmmap+ebx*4] - mov al,[ebx+ecx] - xor ebx,ebx - ret -.regacc - cmp ecx,2000h - jae .regs - mov al,[wramdataa+ecx] - ret -.regs - cmp ecx,48FFh - ja .invaccess - call dword near [regptra+ecx*4-8000h] - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .hiromsram - mov al,ch - ret -.hiromsram - cmp byte[SFXEnable],1 - je .sfxram - and ebx,7Fh - cmp bl,10h - jb .dsp1 - cmp bl,30h - jae .hiromsramok - xor al,al - xor ebx,ebx - ret -.dsp1 - xor al,al - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Read8b -.nodsp1 - xor ebx,ebx - ret -.hiromsramok - push ecx - sub ecx,6000h - and ecx,1fffh - sub bl,30h - shl ebx,13 - add ecx,ebx - and ecx,0FFFFh - call sramaccessbankr8b - pop ecx - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov al,[ebx+ecx] - xor ebx,ebx - pop ecx - ret - -NEWSYM regaccessbankr16 - test ecx,8000h - jz .regacc - mov ebx,[snesmmap+ebx*4] - mov ax,[ebx+ecx] - xor ebx,ebx - ret -.regacc - cmp ecx,2000h - jae .regs - mov ax,[wramdataa+ecx] - cmp ecx,1FFFh - jne .notopenbus - mov ah,al -.notopenbus - ret -.regs - cmp ecx,48FFh - ja .invaccess -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptr] -; call dword near [ebx] - call dword near [regptra+ecx*4-8000h] - inc ecx - mov ah,al -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptr] -; call dword near [ebx] - call dword near [regptra+ecx*4-8000h] - mov bl,al - dec ecx - mov al,ah - mov ah,bl - xor ebx,ebx - ret -.invaccess -; jmp regexiter - cmp ecx,6000h - jae .hiromsram - mov al,ch - mov ah,ch - ret -.hiromsram - cmp byte[SFXEnable],1 - je .sfxram - and ebx,7Fh - cmp bl,10h - jb .dsp1 - cmp bl,30h - jae .hiromsramok - xor ax,ax - xor ebx,ebx - ret -.dsp1 - xor ax,ax - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Read16b -.nodsp1 - xor ebx,ebx - ret -.hiromsramok - push ecx - sub ecx,6000h - and ecx,1fffh - sub bl,30h - shl ebx,13 - add ecx,ebx - and ecx,0FFFFh - call sramaccessbankr16b - pop ecx - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov ax,[ebx+ecx] - xor ebx,ebx - pop ecx - ret - -NEWSYM regaccessbankw8 - test ecx,8000h - jnz .romacc - cmp ecx,2000h - jae .regs - mov [wramdataa+ecx],al - ret -.romacc - cmp byte[writeon],0 - jne .modrom - ret -.modrom - mov ebx,[snesmmap+ebx*4] - mov [ebx+ecx],al - xor ebx,ebx - ret -.regs - cmp ecx,48FFh - ja .invaccess -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptw] -; call dword near [ebx] - call dword near [regptwa+ecx*4-8000h] - xor ebx,ebx - ret -.invaccess -; jmp regexiter - cmp ecx,6000h - jae .hiromsram - ret -.hiromsram - cmp byte[SFXEnable],1 - je .sfxram - and ebx,7Fh - cmp bl,10h - jb .dsp1 - cmp bl,30h - jae .hiromsramok - xor ebx,ebx - ret -.dsp1 - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Write8b -.nodsp1 - xor ebx,ebx - ret -.hiromsramok - push ecx - sub ecx,6000h - and ecx,1fffh - sub bl,30h - shl ebx,13 - add ecx,ebx - and ecx,0FFFFh - call sramaccessbankw8b - pop ecx - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov [ebx+ecx],al - xor ebx,ebx - pop ecx - ret - -NEWSYM regaccessbankw16 - test ecx,8000h - jnz .romacc - cmp ecx,2000h - jae .regs - cmp ecx,1FFFh - je .endwram - mov [wramdataa+ecx],ax - ret -.endwram - mov [wramdataa+ecx],al - ret -.romacc - cmp byte[writeon],0 - jne .modrom - ret -.modrom - mov ebx,[snesmmap+ebx*4] - mov [ebx+ecx],ax - xor ebx,ebx - ret -.regs - cmp cx,48FFh - ja .invaccess -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptw] -; call dword near [ebx] - call dword near [regptwa+ecx*4-8000h] - inc ecx - mov al,ah -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptw] -; call dword near [ebx] - call dword near [regptwa+ecx*4-8000h] - dec ecx - xor ebx,ebx - ret -.invaccess -; jmp regexiter - cmp ecx,6000h - jae .hiromsram - ret -.hiromsram - cmp byte[SFXEnable],1 - je .sfxram - and ebx,7Fh - cmp bl,10h - jb .dsp1 - cmp bl,30h - jae .hiromsramok - xor al,al - xor ebx,ebx - ret -.dsp1 - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Write16b -.nodsp1 - ret -.hiromsramok - push ecx - sub ecx,6000h - and ecx,1fffh - sub bl,30h - shl ebx,13 - add ecx,ebx - and ecx,0FFFFh - call sramaccessbankw16b - pop ecx - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov [ebx+ecx],ax - xor ebx,ebx - pop ecx - ret - -NEWSYM regaccessbankr8mp - ret - -;******************************************************* -; Register & Memory Bank (Bank 0) -;******************************************************* -; enter : BL = bank number, CX = address location -; leave : AL = value read - -%macro BWCheck 0 - cmp byte[BWShift],0 - jne near .shift -.nosa1 -%endmacro - -section .bss -NEWSYM BWUsed2, resb 1 -NEWSYM BWUsed, resb 1 -section .text - -%macro BWCheck2r8 0 -.shift - cmp byte[SA1Status],0 - je .nosa1 - ; value of 8Fh - test byte[SA1Overflow+1],80h - jnz .2bit - push ecx - push ebx - sub ecx,6000h - push eax - mov eax,ecx - and eax,01h - shl eax,2 - shr ecx,1 - mov ebx,ecx - mov cl,al - pop eax - mov al,0Fh - shl al,cl - add ebx,[SA1BWPtr] - and al,[ebx] - shr al,cl - pop ebx - pop ecx - ret -.2bit - push ecx - push ebx - sub ecx,6000h - push eax - mov eax,ecx - and eax,03h - shl eax,1 - shr ecx,2 - mov ebx,ecx - mov cl,al - pop eax - mov al,03h - shl al,cl - add ebx,[SA1BWPtr] - and al,[ebx] - shr al,cl - pop ebx - pop ecx - ret -%endmacro - -%macro BWCheck2r16 0 -.shift - cmp byte[SA1Status],0 - je .nosa1 - ; value of 8Fh - test byte[SA1Overflow+1],80h - jnz .2bit - push ecx - push ebx - sub ecx,6000h - push eax - mov eax,ecx - and eax,01h - shl eax,2 - shr ecx,1 - mov ebx,ecx - mov cl,al - pop eax - mov al,0Fh - shl al,cl - add ebx,[SA1BWPtr] - and al,[ebx] - shr al,cl - pop ebx - pop ecx - push ecx - push ebx - sub ecx,6000h - inc ecx - push eax - mov eax,ecx - and eax,01h - shl eax,2 - shr ecx,1 - mov ebx,ecx - mov cl,al - pop eax - mov ah,0Fh - shl ah,cl - add ebx,[SA1BWPtr] - and ah,[ebx] - shr ah,cl - pop ebx - pop ecx - ret -.2bit - push ecx - push ebx - sub ecx,6000h - push eax - mov eax,ecx - and eax,03h - shl eax,1 - shr ecx,2 - mov ebx,ecx - mov cl,al - pop eax - mov al,03h - shl al,cl - add ebx,[SA1BWPtr] - and al,[ebx] - shr al,cl - pop ebx - pop ecx - push ecx - push ebx - inc ecx - sub ecx,6000h - push eax - mov eax,ecx - and eax,03h - shl eax,1 - shr ecx,2 - mov ebx,ecx - mov cl,al - pop eax - mov ah,03h - shl ah,cl - add ebx,[SA1BWPtr] - and ah,[ebx] - shr ah,cl - pop ebx - pop ecx - ret -%endmacro - -%macro BWCheck2w8 0 -.shift - cmp byte[SA1Status],0 - je .nosa1 - test byte[SA1Overflow+1],80h - jnz .2bit - push ecx - push ebx - push edx - sub ecx,6000h - push eax - mov eax,ecx - and eax,01h - shl eax,2 - shr ecx,1 - mov ebx,ecx - mov cl,al - pop eax - mov dh,0Fh - shl dh,cl - xor dh,0FFh - and al,0Fh - shl al,cl - add ebx,[SA1BWPtr] - and byte[ebx],dh - or byte[ebx],al - pop edx - pop ebx - pop ecx - ret -.2bit - push ecx - push ebx - push edx - sub ecx,6000h - push eax - mov eax,ecx - and eax,03h - shl eax,1 - shr ecx,2 - mov ebx,ecx - mov cl,al - pop eax - mov dh,03h - shl dh,cl - xor dh,0FFh - and al,03h - shl al,cl - add ebx,[SA1BWPtr] - and byte[ebx],dh - or byte[ebx],al - pop edx - pop ebx - pop ecx - ret -%endmacro - -%macro BWCheck2w16 0 -.shift - cmp byte[SA1Status],0 - je .nosa1 - test byte[SA1Overflow+1],80h - jnz .2bit - push eax - push ecx - push ebx - push edx - sub ecx,6000h - push eax - mov eax,ecx - and eax,01h - shl eax,2 - shr ecx,1 - mov ebx,ecx - mov cl,al - pop eax - mov dh,0Fh - shl dh,cl - xor dh,0FFh - and al,0Fh - shl al,cl - add ebx,[SA1BWPtr] - and byte[ebx],dh - or byte[ebx],al - pop edx - pop ebx - pop ecx - pop eax - push ecx - push ebx - push edx - inc ecx - sub ecx,6000h - push eax - mov eax,ecx - and eax,01h - shl eax,2 - shr ecx,1 - mov ebx,ecx - mov cl,al - pop eax - mov dh,0Fh - shl dh,cl - xor dh,0FFh - and ah,0Fh - shl ah,cl - add ebx,[SA1BWPtr] - and byte[ebx],dh - or byte[ebx],ah - pop edx - pop ebx - pop ecx - ret -.2bit - push eax - push ecx - push ebx - push edx - sub ecx,6000h - push eax - mov eax,ecx - and eax,03h - shl eax,1 - shr ecx,2 - mov ebx,ecx - mov cl,al - pop eax - mov dh,03h - shl dh,cl - xor dh,0FFh - and al,03h - shl al,cl - add ebx,[SA1BWPtr] - and byte[ebx],dh - or byte[ebx],al - pop edx - pop ebx - pop ecx - pop eax - push ecx - push ebx - push edx - inc ecx - sub ecx,6000h - push eax - mov eax,ecx - and eax,03h - shl eax,1 - shr ecx,2 - mov ebx,ecx - mov cl,al - pop eax - mov dh,03h - shl dh,cl - xor dh,0FFh - and ah,03h - shl ah,cl - add ebx,[SA1BWPtr] - and byte[ebx],dh - or byte[ebx],ah - pop edx - pop ebx - pop ecx - ret -%endmacro - -%macro writetobank0table 2 - mov ebx,%1 - mov ecx,%2 -%%loop - mov [eax],ebx - add eax,4 - dec ecx - jnz %%loop -%endmacro - -section .bss -NEWSYM DPageR8, resd 1 -NEWSYM DPageR16, resd 1 -NEWSYM DPageW8, resd 1 -NEWSYM DPageW16, resd 1 -NEWSYM SA1DPageR8, resd 1 -NEWSYM SA1DPageR16, resd 1 -NEWSYM SA1DPageW8, resd 1 -NEWSYM SA1DPageW16, resd 1 -section .text - -NEWSYM UpdateDPage - push eax - movzx eax,byte[xd+1] - push ecx - mov ecx,[Bank0datr8+eax*4] - mov [DPageR8],ecx - mov ecx,[Bank0datr16+eax*4] - mov [DPageR16],ecx - mov ecx,[Bank0datw8+eax*4] - mov [DPageW8],ecx - mov ecx,[Bank0datw16+eax*4] - mov [DPageW16],ecx - pop ecx - pop eax - ret - -NEWSYM SA1UpdateDPage - push eax - movzx eax,byte[SA1xd+1] - push ecx - mov ecx,[Bank0datr8+eax*4] - mov [SA1DPageR8],ecx - mov ecx,[Bank0datr16+eax*4] - mov [SA1DPageR16],ecx - mov ecx,[Bank0datw8+eax*4] - mov [SA1DPageW8],ecx - mov ecx,[Bank0datw16+eax*4] - mov [SA1DPageW16],ecx - pop ecx - pop eax - ret - -; SA1 Stuff -NEWSYM membank0r8ramSA1 ; 0000-1FFF - cmp byte[SA1Status],0 - jne .nowram - mov al,[wramdataa+ecx+ebx] - ret -.nowram - cmp ecx,800h - jae .invaccess - mov al,[IRAM+ecx+ebx] - ret -.invaccess - xor al,al - ret -NEWSYM membank0r16ramSA1 ; 0000-1FFF - cmp byte[SA1Status],0 - jne .nowram - mov ax,[wramdataa+ecx+ebx] - ret -.nowram - cmp ecx,800h - jae .invaccess - mov ax,[IRAM+ecx+ebx] - ret -.invaccess - xor ax,ax - ret -NEWSYM membank0w8ramSA1 ; 0000-1FFF - cmp byte[SA1Status],0 - jne .nowram - mov [wramdataa+ecx+ebx],al - ret -.nowram - cmp ecx,800h - jae .invaccess - mov [IRAM+ecx+ebx],al -.invaccess - ret -NEWSYM membank0w16ramSA1 ; 0000-1FFF - cmp byte[SA1Status],0 - jne .nowram - mov [wramdataa+ecx+ebx],ax - ret -.nowram - cmp ecx,800h - jae .invaccess - mov [IRAM+ecx+ebx],ax -.invaccess - ret - -; --- 8 BIT READ STUFF --- -NEWSYM membank0r8ram ; 0000-1FFF - mov al,[wramdataa+ebx+ecx] - ret -NEWSYM membank0r8reg ; 2000-48FF - add ecx,ebx - call dword near [regptra+ecx*4-8000h] - xor ebx,ebx - ret -NEWSYM membank0r8inv ; 4800-5FFF - add ecx,ebx - mov al,ch - ret -NEWSYM membank0r8chip ; 6000-7FFF - add ecx,ebx - cmp byte[SFXEnable],1 - je .sfxram - cmp byte[SA1Enable],1 - je .sa1ram - xor al,al - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Read8b -.nodsp1 - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov al,[ebx+ecx] - xor ebx,ebx - pop ecx - ret -.sa1ram - BWCheck - mov ebx,[CurBWPtr] - mov al,[ebx+ecx] - xor ebx,ebx - ret - BWCheck2r8 - -NEWSYM membank0r8rom ; 8000-FFFF - add ebx,[snesmmap] - mov al,[ebx+ecx] - xor ebx,ebx - ret -NEWSYM membank0r8romram ; 0000-1FFF - add cx,bx - test cx,8000h - jnz .rom - mov al,[wramdataa+ecx] - ret -.rom - mov ebx,[snesmmap] - mov al,[ebx+ecx] - xor ebx,ebx - ret - -; --- 16 BIT READ STUFF --- -NEWSYM membank0r16ram ; 0000-1EFF - mov ax,[wramdataa+ebx+ecx] - ret -NEWSYM membank0r16ramh ; 1F00-1FFF - add ecx,ebx - cmp ecx,1FFFh - je .over - mov ax,[wramdataa+ecx] - ret -.over - mov al,[wramdataa+ecx] - mov ah,al ;open bus - ret -NEWSYM membank0r16reg ; 2000-48FF - add ecx,ebx - call dword near [regptra+ecx*4-8000h] - inc ecx - mov ah,al - call dword near [regptra+ecx*4-8000h] - mov bl,al - dec ecx - mov al,ah - mov ah,bl - xor ebx,ebx - ret -NEWSYM membank0r16inv ; 4800-5FFF - add ecx,ebx - mov al,ch - mov ah,ch - mov ax,8080h - ret -NEWSYM membank0r16chip ; 6000-FFFF - add ecx,ebx - cmp byte[SFXEnable],1 - je .sfxram - cmp byte[SA1Enable],1 - je .sa1ram - xor ax,ax - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Read16b -.nodsp1 - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov ax,[ebx+ecx] - xor ebx,ebx - pop ecx - ret -.sa1ram - BWCheck - mov ebx,[CurBWPtr] - mov ax,[ebx+ecx] - xor ebx,ebx - ret - BWCheck2r16 -NEWSYM membank0r16rom ; 8000-FFFF - add ebx,[snesmmap] - mov ax,[ebx+ecx] - xor ebx,ebx - ret -NEWSYM membank0r16romram ; 0000-1FFF - add cx,bx - test cx,8000h - jnz .rom - mov ax,[wramdataa+ecx] - ret -.rom - mov ebx,[snesmmap] - mov ax,[ebx+ecx] - xor ebx,ebx - ret - -; --- 8 BIT WRITE STUFF --- -NEWSYM membank0w8ram ; 0000-1FFF - mov [wramdataa+ebx+ecx],al - ret -NEWSYM membank0w8reg ; 2000-48FF - add ecx,ebx - call dword near [regptwa+ecx*4-8000h] - xor ebx,ebx - ret -NEWSYM membank0w8inv ; 4800-5FFF - ret -NEWSYM membank0w8chip ; 6000-FFFF - add ecx,ebx - cmp byte[SFXEnable],1 - je .sfxram - cmp byte[SA1Enable],1 - je .sa1ram - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Write8b -.nodsp1 - ret -.sfxram - push ecx - sub cx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov [ebx+ecx],al - xor ebx,ebx - pop ecx - ret -.sa1ram - BWCheck - mov ebx,[CurBWPtr] - mov [ebx+ecx],al - xor ebx,ebx - ret - BWCheck2w8 -NEWSYM membank0w8rom ; 8000-FFFF - ret -NEWSYM membank0w8romram ; 0000-1FFF - add cx,bx - test cx,8000h - jnz .rom - mov [wramdataa+ecx],al - ret -.rom - ret - -; --- 16 BIT WRITE STUFF --- -NEWSYM membank0w16ram ; 0000-1EFF - mov [wramdataa+ebx+ecx],ax - ret -NEWSYM membank0w16ramh ; 1F00-1FFF - add ecx,ebx - cmp ecx,1FFFh - je .over - mov [wramdataa+ecx],ax - ret -.over - mov [wramdataa+ecx],al - ret -NEWSYM membank0w16reg ; 2000-48FF - add ecx,ebx - call dword near [regptwa+ecx*4-8000h] - inc ecx - mov al,ah - call dword near [regptwa+ecx*4-8000h] - dec ecx - xor ebx,ebx - ret -NEWSYM membank0w16inv ; 4800-5FFF - ret -NEWSYM membank0w16chip ; 6000-FFFF - add ecx,ebx -NEWSYM membank0w16rom ; 8000-FFFF - cmp byte[SFXEnable],1 - je .sfxram - cmp byte[SA1Enable],1 - je .sa1ram - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Write16b -.nodsp1 - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov [ebx+ecx],ax - xor ebx,ebx - pop ecx - ret -.sa1ram - BWCheck - mov ebx,[CurBWPtr] - mov [ebx+ecx],ax - xor ebx,ebx - ret - BWCheck2w16 -NEWSYM membank0w16romram ; 0000-1FFF - add cx,bx - test cx,8000h - jnz .rom - mov [wramdataa+ecx],ax - ret -.rom - ret - -NEWSYM membank0r8 - and ecx,0FFFFh - cmp byte[SA1Enable],1 - je near membank0r8SA1 - cmp ecx,2000h - jae .regs - mov al,[wramdataa+ecx] - ret -.regs - test ecx,8000h - jz .regacc - mov ebx,[snesmmap] - mov al,[ebx+ecx] - xor ebx,ebx - ret -.regacc - cmp ecx,48FFh - ja .invaccess -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptr] -; call dword near [ebx] - call dword near [regptra+ecx*4-8000h] - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .dsp1 - mov al,ch - ret -.dsp1 - cmp byte[SFXEnable],1 - je .sfxram - xor al,al - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Read8b -.nodsp1 - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov al,[ebx+ecx] - xor ebx,ebx - pop ecx - ret - -NEWSYM membank0r16 - and ecx,0FFFFh - cmp byte[SA1Enable],1 - je near membank0r16SA1 - cmp ecx,2000h - jae .regs - mov ax,[wramdataa+ecx] - ret -.regs - test ecx,8000h - jz .regacc - mov ebx,[snesmmap] - mov ax,[ebx+ecx] - xor ebx,ebx - ret -.regacc - cmp ecx,48FFh - ja .invaccess -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptr] -; call dword near [ebx] - call dword near [regptra+ecx*4-8000h] - inc ecx - mov ah,al -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptr] -; call dword near [ebx] - call dword near [regptra+ecx*4-8000h] - mov bl,al - dec ecx - mov al,ah - mov ah,bl - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .dsp1 - xor ax,ax - ret -.dsp1 - cmp byte[SFXEnable],1 - je .sfxram - xor ax,ax - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Read16b -.nodsp1 - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov ax,[ebx+ecx] - xor ebx,ebx - pop ecx - ret - -NEWSYM membank0w8 - and ecx,0FFFFh - cmp byte[SA1Enable],1 - je near membank0w8SA1 - cmp ecx,2000h - jae .regs - mov [wramdataa+ecx],al - ret -.romacc - cmp byte[writeon],0 - jne .modrom - ret -.modrom - mov ebx,[snesmmap] - mov [ebx+ecx],al - xor ebx,ebx - ret -.regs - test ecx,8000h - jnz .romacc - cmp ecx,48FFh - ja .invaccess -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptw] -; call dword near [ebx] - call dword near [regptwa+ecx*4-8000h] - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .dsp1 - ret -.dsp1 - cmp byte[SFXEnable],1 - je .sfxram - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Write8b -.nodsp1 - ret -.sfxram - push ecx - sub cx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov [ebx+ecx],al - xor ebx,ebx - pop ecx - ret -NEWSYM membank0w16 - and ecx,0FFFFh - cmp byte[SA1Enable],1 - je near membank0w16SA1 - cmp ecx,2000h - jae .regs - mov [wramdataa+ecx],ax - ret -.romacc - cmp byte[writeon],0 - jne .modrom - ret -.modrom - mov ebx,[snesmmap] - mov [ebx+ecx],ax - xor ebx,ebx - ret -.regs - test ecx,8000h - jnz .romacc - cmp ecx,48FFh - ja .invaccess -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptw] -; call dword near [ebx] - call dword near [regptwa+ecx*4-8000h] - inc ecx - mov al,ah -; mov ebx,ecx -; shl ebx,2 -; add ebx,[regptw] -; call dword near [ebx] - call dword near [regptwa+ecx*4-8000h] - dec ecx - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .dsp1 - ret -.dsp1 - cmp byte[SFXEnable],1 - je .sfxram - cmp byte[DSP1Type],2 - jne .nodsp1 - call DSP1Write16b -.nodsp1 - ret -.sfxram - push ecx - sub ecx,6000h - and ecx,1fffh - mov ebx,[sfxramdata] - mov [ebx+ecx],ax - xor ebx,ebx - pop ecx - ret - -NEWSYM membank0r8SA1 - test ecx,8000h - jz .regacc - mov ebx,[snesmmap] - mov al,[ebx+ecx] - xor ebx,ebx - ret -.regacc - cmp ecx,2000h - jae .regs - cmp byte[SA1Status],0 - jne .nowram - mov al,[wramdataa+ecx] - ret -.nowram - cmp ecx,800h - jae .invaccess - mov al,[IRAM+ecx] - ret -.regs - cmp ecx,48FFh - ja .invaccess - call dword near [regptra+ecx*4-8000h] - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .bwram - xor al,al - ret -.bwram - BWCheck - mov ebx,[CurBWPtr] - mov al,[ebx+ecx] - xor ebx,ebx - ret - BWCheck2r8 - -NEWSYM membank0r16SA1 - test ecx,8000h - jz .regacc - mov ebx,[snesmmap] - mov ax,[ebx+ecx] - xor ebx,ebx - ret -.regacc - cmp ecx,2000h - jae .regs - cmp byte[SA1Status],0 - jne .nowram - mov ax,[wramdataa+ecx] - ret -.nowram - cmp ecx,800h - jae .invaccess - mov ax,[IRAM+ecx] - ret -.regs - cmp ecx,48FFh - ja .invaccess - call dword near [regptra+ecx*4-8000h] - inc ecx - mov ah,al - call dword near [regptra+ecx*4-8000h] - mov bl,al - dec ecx - mov al,ah - mov ah,bl - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .bwram - xor ax,ax - ret -.bwram - BWCheck - mov ebx,[CurBWPtr] - mov ax,[ebx+ecx] - xor ebx,ebx - ret - BWCheck2r16 - -NEWSYM membank0w8SA1 - test ecx,8000h - jnz .romacc - cmp ecx,2000h - jae .regs - cmp byte[SA1Status],0 - jne .nowram - mov [wramdataa+ecx],al - ret -.nowram - cmp ecx,800h - jae .invaccess - mov [IRAM+ecx],al - ret -.romacc - ret -.regs - cmp ecx,48FFh - ja .invaccess - call dword near [regptwa+ecx*4-8000h] - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .bwram - ret -.bwram - BWCheck - mov ebx,[CurBWPtr] - mov [ebx+ecx],al - xor ebx,ebx - ret - BWCheck2w8 - -NEWSYM membank0w16SA1 - test ecx,8000h - jnz .romacc - cmp ecx,2000h - jae .regs - cmp byte[SA1Status],0 - jne .nowram - mov [wramdataa+ecx],ax - ret -.nowram - cmp ecx,800h - jae .invaccess - mov [IRAM+ecx],ax - ret -.romacc - ret -.regs - cmp cx,48FFh - ja .invaccess - call dword near [regptwa+ecx*4-8000h] - inc ecx - mov al,ah - call dword near [regptwa+ecx*4-8000h] - dec ecx - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .bwram - ret -.bwram - BWCheck - mov ebx,[CurBWPtr] - mov [ebx+ecx],ax - xor ebx,ebx - ret - BWCheck2w16 - -;******************************************************* -; ROM Only Access Banks (40 - 6F) / (C0 - FF) -;******************************************************* - -NEWSYM memaccessbankr8 - mov ebx,[snesmmap+ebx*4] - mov al,[ebx+ecx] - xor ebx,ebx - ret - -NEWSYM memaccessbankr16 - mov ebx,[snesmmap+ebx*4] - mov ax,[ebx+ecx] - xor ebx,ebx - ret - -NEWSYM memaccessbankw8 - cmp byte[writeon],0 - jne .modrom - ret -.modrom - mov ebx,[snesmmap+ebx*4] - mov [ebx+ecx],al - xor ebx,ebx - ret - -NEWSYM memaccessbankw16 - cmp byte[writeon],0 - jne .modrom - ret -.modrom - mov ebx,[snesmmap+ebx*4] - mov [ebx+ecx],ax - xor ebx,ebx - ret - -;******************************************************* -; SRAM Access Bank (70h) -;******************************************************* - -%macro SRAMAccess 1 - cmp dword[curromspace],0x200000 - ja .large - cmp dword[ramsize],0x8000 - ja .large - jmp .notlarge -.large - test ecx,8000h - jnz %1 -.notlarge -%endmacro - -NEWSYM sramaccessbankr8 - SRAMAccess memaccessbankr8 - push ecx - and bl,7Fh - sub bl,70h - shl ebx,15 - add ecx,ebx - call sramaccessbankr8b - pop ecx - ret - -NEWSYM sramaccessbankr16 - SRAMAccess memaccessbankr16 - push ecx - and bl,7Fh - sub bl,70h - shl ebx,15 - add ecx,ebx - call sramaccessbankr16b - pop ecx - ret - -NEWSYM sramaccessbankw8 - SRAMAccess memaccessbankw8 - push ecx - and bl,7Fh - sub bl,70h - shl ebx,15 - add ecx,ebx - call sramaccessbankw8b - pop ecx - ret - -NEWSYM sramaccessbankw16 - SRAMAccess memaccessbankw16 - push ecx - and bl,7Fh - sub bl,70h - shl ebx,15 - add ecx,ebx - call sramaccessbankw16b - pop ecx - ret - - -NEWSYM sramaccessbankr8s - push ecx - sub bl,78h - shl ebx,15 - add ecx,ebx - call sramaccessbankr8b - pop ecx - ret -NEWSYM sramaccessbankr16s - push ecx - sub bl,78h - shl ebx,15 - add ecx,ebx - call sramaccessbankr16b - pop ecx - ret -NEWSYM sramaccessbankw8s - push ecx - sub bl,78h - shl ebx,15 - add ecx,ebx - call sramaccessbankw8b - pop ecx - ret -NEWSYM sramaccessbankw16s - push ecx - sub bl,78h - shl ebx,15 - add ecx,ebx - call sramaccessbankw16b - pop ecx - ret - -NEWSYM sramaccessbankr8b - cmp dword[ramsize],0 - je .noaccess - push ecx - and ecx,[ramsizeand] - mov ebx,[sram] - mov al,[ebx+ecx] - pop ecx - xor ebx,ebx - ret -.noaccess - xor al,al - xor ebx,ebx - ret - -NEWSYM sramaccessbankr16b - cmp dword[ramsize],0 - je .noaccess - mov ebx,[sram] - push ecx - and ecx,[ramsizeand] - mov al,[ebx+ecx] - inc ecx - and ecx,[ramsizeand] - mov ah,[ebx+ecx] - pop ecx - xor ebx,ebx - ret -.noaccess - xor ax,ax - xor ebx,ebx - ret - -NEWSYM sramaccessbankw8b - cmp dword[ramsize],0 - je .noaccess - mov ebx,[sram] - push ecx - and ecx,[ramsizeand] - mov [ebx+ecx],al - pop ecx - mov dword[sramb4save],5*60 -.noaccess - xor ebx,ebx - ret - -NEWSYM sramaccessbankw16b - cmp dword[ramsize],0 - je .noaccess - mov ebx,[sram] - push ecx - and ecx,[ramsizeand] - mov [ebx+ecx],al - inc ecx - and ecx,[ramsizeand] - mov [ebx+ecx],ah - pop ecx - mov dword[sramb4save],5*60 -.noaccess - xor ebx,ebx - ret - -%macro STsramaccess 1 - test ecx,8000h - jz %1 -%endmacro - -NEWSYM stsramr8 - STsramaccess memaccessbankr8 - push ecx - sub bl,60h - shl ebx,15 - add ecx,ebx - mov ebx,[sram] - and ecx,[ramsizeand] - mov al,[ebx+ecx] - pop ecx - xor ebx,ebx - ret - -NEWSYM stsramr16 - STsramaccess memaccessbankr16 - push ecx - sub bl,60h - shl ebx,15 - add ecx,ebx - mov ebx,[sram] - and ecx,[ramsizeand] - mov al,[ebx+ecx] - inc ecx - and ecx,[ramsizeand] - mov ah,[ebx+ecx] - pop ecx - xor ebx,ebx - ret - -NEWSYM stsramw8 - STsramaccess memaccessbankw8 - push ecx - sub bl,60h - shl ebx,15 - add ecx,ebx - mov ebx,[sram] - and ecx,[ramsizeand] - mov [ebx+ecx],al - pop ecx - mov dword[sramb4save],5*60 - xor ebx,ebx - ret - -NEWSYM stsramw16 - STsramaccess memaccessbankw16 - push ecx - sub bl,60h - shl ebx,15 - add ecx,ebx - mov ebx,[sram] - and ecx,[ramsizeand] - mov [ebx+ecx],al - inc ecx - and ecx,[ramsizeand] - mov [ebx+ecx],ah - pop ecx - mov dword[sramb4save],5*60 - xor ebx,ebx - ret - -NEWSYM stsramr8b - STsramaccess memaccessbankr8 - push ecx - sub bl,70h - shl ebx,15 - add ecx,ebx - mov ebx,[sram2] - and ecx,[ramsizeand] - mov al,[ebx+ecx] - pop ecx - xor ebx,ebx - ret - -NEWSYM stsramr16b - STsramaccess memaccessbankr16 - push ecx - sub bl,70h - shl ebx,15 - add ecx,ebx - mov ebx,[sram2] - and ecx,[ramsizeand] - mov al,[ebx+ecx] - inc ecx - and ecx,[ramsizeand] - mov ah,[ebx+ecx] - pop ecx - xor ebx,ebx - ret - -NEWSYM stsramw8b - STsramaccess memaccessbankw8 - push ecx - sub bl,70h - shl ebx,15 - add ecx,ebx - mov ebx,[sram2] - and ecx,[ramsizeand] - mov [ebx+ecx],al - pop ecx - mov dword[sramb4save],5*60 - xor ebx,ebx - ret - -NEWSYM stsramw16b - STsramaccess memaccessbankw16 - push ecx - sub bl,70h - shl ebx,15 - add ecx,ebx - mov ebx,[sram2] - and ecx,[ramsizeand] - mov [ebx+ecx],al - inc ecx - and ecx,[ramsizeand] - mov [ebx+ecx],ah - pop ecx - mov dword[sramb4save],5*60 - xor ebx,ebx - ret - -;******************************************************* -; WorkRAM/ExpandRAM Access Bank (7Eh) -;******************************************************* - -NEWSYM wramaccessbankr8 -; mov ebx,[wramdata] -; mov al,[ebx+ecx] -; xor ebx,ebx - mov al,[wramdataa+ecx] - ret - -NEWSYM wramaccessbankr16 -; mov ebx,[wramdata] -; mov ax,[ebx+ecx] -; xor ebx,ebx - mov ax,[wramdataa+ecx] - ret - -NEWSYM wramaccessbankw8 -; mov ebx,[wramdata] -; mov [ebx+ecx],al -; xor ebx,ebx - mov [wramdataa+ecx],al - ret - -NEWSYM wramaccessbankw16 -; mov ebx,[wramdata] -; mov [ebx+ecx],ax -; xor ebx,ebx - mov [wramdataa+ecx],ax - ret - -;******************************************************* -; ExpandRAM Access Bank (7Fh) -;******************************************************* -NEWSYM eramaccessbankr8 -; mov ebx,[ram7f] -; mov al,[ebx+ecx] -; xor ebx,ebx - mov al,[ram7fa+ecx] - ret - -NEWSYM eramaccessbankr16 -; mov ebx,[ram7f] -; mov ax,[ebx+ecx] -; xor ebx,ebx - mov ax,[ram7fa+ecx] - ret - -NEWSYM eramaccessbankw8 -; mov ebx,[ram7f] -; mov [ebx+ecx],al -; xor ebx,ebx - mov [ram7fa+ecx],al - ret - -NEWSYM eramaccessbankw16 -; mov ebx,[ram7f] -; mov [ebx+ecx],ax -; xor ebx,ebx - mov [ram7fa+ecx],ax - ret - -;******************************************************* -; SA-1 Bank Accesses -;******************************************************* - -NEWSYM regaccessbankr8SA1 - test ecx,8000h - jz .regacc - mov ebx,[snesmmap+ebx*4] - mov al,[ebx+ecx] - xor ebx,ebx - ret -.regacc - cmp ecx,2000h - jae .regs - cmp byte[SA1Status],0 - jne .nowram - mov al,[wramdataa+ecx] - ret -.nowram - cmp ecx,800h - jae .invaccess - mov al,[IRAM+ecx] - ret -.regs - cmp ecx,48FFh - ja .invaccess - call dword near [regptra+ecx*4-8000h] - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .bwram - xor al,al - ret -.bwram - BWCheck - mov ebx,[CurBWPtr] - mov al,[ebx+ecx] - xor ebx,ebx - ret - BWCheck2r8 - -NEWSYM regaccessbankr16SA1 - test ecx,8000h - jz .regacc - mov ebx,[snesmmap+ebx*4] - mov ax,[ebx+ecx] - xor ebx,ebx - ret -.regacc - cmp ecx,2000h - jae .regs - cmp byte[SA1Status],0 - jne .nowram - mov ax,[wramdataa+ecx] - ret -.nowram - cmp ecx,800h - jae .invaccess - mov ax,[IRAM+ecx] - ret -.regs - cmp ecx,48FFh - ja .invaccess - call dword near [regptra+ecx*4-8000h] - inc ecx - mov ah,al - call dword near [regptra+ecx*4-8000h] - mov bl,al - dec ecx - mov al,ah - mov ah,bl - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .bwram - xor ax,ax - ret -.bwram - BWCheck - mov ebx,[CurBWPtr] - mov ax,[ebx+ecx] - xor ebx,ebx - ret - BWCheck2r16 - -NEWSYM regaccessbankw8SA1 - test ecx,8000h - jnz .romacc - cmp ecx,2000h - jae .regs - cmp byte[SA1Status],0 - jne .nowram - mov [wramdataa+ecx],al - ret -.nowram - cmp ecx,800h - jae .invaccess - mov [IRAM+ecx],al - ret -.romacc - cmp byte[writeon],0 - jne .modrom - ret -.modrom - mov ebx,[snesmmap+ebx*4] - mov [ebx+ecx],al - xor ebx,ebx - ret -.regs - cmp ecx,48FFh - ja .invaccess - call dword near [regptwa+ecx*4-8000h] - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .bwram - ret -.bwram - BWCheck - mov ebx,[CurBWPtr] - mov [ebx+ecx],al - xor ebx,ebx - ret - BWCheck2w8 - -NEWSYM regaccessbankw16SA1 - test ecx,8000h - jnz .romacc - cmp ecx,2000h - jae .regs - cmp byte[SA1Status],0 - jne .nowram - mov [wramdataa+ecx],ax - ret -.nowram - cmp ecx,800h - jae .invaccess - mov [IRAM+ecx],ax - ret -.romacc - cmp byte[writeon],0 - jne .modrom - ret -.modrom - mov ebx,[snesmmap+ebx*4] - mov [ebx+ecx],ax - xor ebx,ebx - ret -.regs - cmp cx,48FFh - ja .invaccess - call dword near [regptwa+ecx*4-8000h] - inc ecx - mov al,ah - call dword near [regptwa+ecx*4-8000h] - dec ecx - xor ebx,ebx - ret -.invaccess - cmp ecx,6000h - jae .bwram - ret -.bwram - BWCheck - mov ebx,[CurBWPtr] - mov [ebx+ecx],ax - xor ebx,ebx - ret - BWCheck2w16 - -NEWSYM SA1RAMaccessbankr8 - and ebx,03h - shl ebx,16 - add ebx,[SA1RAMArea] - mov al,[ebx+ecx] - xor ebx,ebx - ret - -NEWSYM SA1RAMaccessbankr16 - and ebx,03h - shl ebx,16 - add ebx,[SA1RAMArea] - mov ax,[ebx+ecx] - xor ebx,ebx - ret - -NEWSYM SA1RAMaccessbankw8 - and ebx,03h - shl ebx,16 - add ebx,[SA1RAMArea] - mov [ebx+ecx],al - xor ebx,ebx - ret - -NEWSYM SA1RAMaccessbankw16 - and ebx,03h - shl ebx,16 - add ebx,[SA1RAMArea] - mov [ebx+ecx],ax - xor ebx,ebx - ret - - -NEWSYM SA1RAMaccessbankr8b - test byte[SA1Overflow+1],80h - jnz .2bit - and ebx,07h - shl ebx,15 - test ecx,1 - jnz .4bitb - shr ecx,1 - add ebx,[SA1RAMArea] - mov al,[ebx+ecx] - xor ebx,ebx - and al,0Fh - ret -.4bitb - shr ecx,1 - add ebx,[SA1RAMArea] - mov al,[ebx+ecx] - xor ebx,ebx - shr al,4 - ret -.2bit - and ebx,0Fh - shl ebx,14 - add ebx,[SA1RAMArea] - test ecx,2 - jnz .bit1 - test ecx,1 - jnz .bit0 - shr ecx,2 - mov al,[ebx+ecx] - and al,3 - xor ebx,ebx - ret -.bit0 - shr ecx,2 - mov al,[ebx+ecx] - shr al,2 - and al,3 - xor ebx,ebx - ret -.bit1 - test ecx,1 - jnz .bit0b - shr ecx,2 - mov al,[ebx+ecx] - shr al,4 - and al,3 - xor ebx,ebx - ret -.bit0b - shr ecx,2 - mov al,[ebx+ecx] - shr al,6 - xor ebx,ebx - ret - -NEWSYM SA1RAMaccessbankr16b - test byte[SA1Overflow+1],80h - jnz .2bit - and ebx,07h - shl ebx,15 - test ecx,1 - jnz .4bitb - shr ecx,1 - add ebx,[SA1RAMArea] - mov al,[ebx+ecx] - and al,0Fh - mov ah,[ebx+ecx] - shr ah,4 - xor ebx,ebx - ret -.4bitb - shr ecx,1 - add ebx,[SA1RAMArea] - mov ah,[ebx+ecx+1] - and ah,0Fh - mov al,[ebx+ecx] - shr al,4 - xor ebx,ebx - ret -.2bit - and ebx,0Fh - shl ebx,14 - add ebx,[SA1RAMArea] - test ecx,2 - jnz .bit1 - test ecx,1 - jnz .bit0 - shr ecx,2 - mov al,[ebx+ecx] - and al,3 - mov ah,[ebx+ecx] - shr ah,2 - and ah,3 - xor ebx,ebx - ret -.bit0 - shr ecx,2 - mov al,[ebx+ecx] - shr al,2 - and al,2 - mov ah,[ebx+ecx] - shr ah,4 - and ah,3 - xor ebx,ebx - ret -.bit1 - test ecx,1 - jnz .bit0b - shr ecx,2 - mov al,[ebx+ecx] - shr al,4 - and al,3 - mov ah,[ebx+ecx] - shr ah,6 - xor ebx,ebx - ret -.bit0b - shr ecx,2 - mov al,[ebx+ecx] - shr al,6 - mov ah,[ebx+ecx+1] - and ah,3 - xor ebx,ebx - ret - -NEWSYM SA1RAMaccessbankw8b - test byte[SA1Overflow+1],80h - jnz .2bit - and ebx,07h - shl ebx,15 - test ecx,1 - jnz .4bitb - shr ecx,1 - add ebx,[SA1RAMArea] - and al,0Fh - and byte[ebx+ecx],0F0h - or byte[ebx+ecx],al - xor ebx,ebx - ret -.4bitb - shr ecx,1 - add ebx,[SA1RAMArea] - and al,0Fh - shl al,4 - and byte[ebx+ecx],0Fh - or byte[ebx+ecx],al - xor ebx,ebx - ret -.2bit - and ebx,0Fh - shl ebx,14 - add ebx,[SA1RAMArea] - test ecx,2 - jnz .bit1 - test ecx,1 - jnz .bit0 - shr ecx,2 - and byte[ebx+ecx],0FCh - and al,3 - or byte[ebx+ecx],al - xor ebx,ebx - ret -.bit0 - shr ecx,2 - and byte[ebx+ecx],0F3h - and al,3 - shl al,2 - or byte[ebx+ecx],al - xor ebx,ebx - ret -.bit1 - test ecx,1 - jnz .bit0b - shr ecx,2 - and byte[ebx+ecx],0CFh - and al,3 - shl al,4 - or byte[ebx+ecx],al - xor ebx,ebx - ret -.bit0b - shr ecx,2 - and byte[ebx+ecx],03Fh - and al,3 - shl al,6 - or byte[ebx+ecx],al - xor ebx,ebx - ret - -NEWSYM SA1RAMaccessbankw16b - push ecx - push ebx - call SA1RAMaccessbankw8b - pop ebx - pop ecx - inc ecx - mov al,ah - call SA1RAMaccessbankw8b - ret - -SECTION .text - -%macro GetBankLog 1 - cmp bl,0C0h - jb %%illegal - cmp bl,0D0h - jb %%firstbank - cmp bl,0E0h - jb %%secondbank - cmp bl,0F0h - jb %%thirdbank - mov %1,[SDD1BankA+3] - jmp %%done -%%firstbank - mov %1,[SDD1BankA] - jmp %%done -%%secondbank - mov %1,[SDD1BankA+1] - jmp %%done -%%thirdbank - mov %1,[SDD1BankA+2] - jmp %%done -%%illegal - mov %1,0Fh -%%done -%endmacro - -SECTION .data -NEWSYM LatestBank, dd 0FFFFh -SECTION .text - -; Software decompression version -NEWSYM memaccessbankr8sdd1 - cmp byte[AddrNoIncr],0 - je near .failed - - cmp dword[Sdd1Mode],2 - je near .decompress - - mov [Sdd1Bank],ebx - mov [Sdd1Addr],ecx - mov [Sdd1NewAddr],ecx - - mov dword[Sdd1Mode],2 - push edx - push eax - push ecx - - and ecx,0FFFFh - xor eax,eax - GetBankLog al - shl eax, 20 - mov edx, [Sdd1Bank] - and edx, 0Fh - shl edx, 16 - add eax, edx - add eax, [romdata] - add eax, ecx - - pushad - push eax - call SDD1_init - pop eax - popad - - pop ecx - pop eax - pop edx - -.decompress - cmp [Sdd1Bank],ebx - jne .nomoredec - cmp [Sdd1Addr],ecx - je .yesdec -.nomoredec - mov ebx,[snesmmap+ebx*4] - mov al,[ebx+ecx] - push eax - mov eax,memtabler8+0C0h*4 - mov ebx,40h -.loopb - mov dword[eax],memaccessbankr8 - add eax,4 - dec ebx - jnz .loopb - pop eax - xor ebx,ebx - ret -.yesdec - pushad - call SDD1_get_byte - mov [.tmpbyte], al - popad - mov al, [.tmpbyte] - ret - -.failed - push ebx - call .nomoredec - pop ebx - jmp memaccessbankr8 -SECTION .bss -.tmpbyte resb 1 - - diff --git a/tools/zsnes/src/cpu/memtable.c b/tools/zsnes/src/cpu/memtable.c deleted file mode 100644 index fe04a0a..0000000 --- a/tools/zsnes/src/cpu/memtable.c +++ /dev/null @@ -1,365 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - - -#ifdef __UNIXSDL__ -#include "../gblhdr.h" -#define DIR_SLASH "/" -#else -#include -#include -#include -#include -#define DIR_SLASH "\\" -#endif -#include "memtable.h" -#include "../gblvars.h" - -extern unsigned int Curtableaddr, tableA[256]; - -void PrepareOffset() -{ - Curtableaddr -= (unsigned int)tableA; -} - -void ResetOffset() -{ - Curtableaddr += (unsigned int)tableA; -} - -extern unsigned int snesmmap[256], snesmap2[256]; - -void BankSwitchSDD1C (unsigned char bankval, unsigned int offset) -{ - unsigned int curbankval = bankval, i; - - curbankval &= 7; - curbankval <<= 20; - curbankval += (unsigned int)romdata; - - for (i=0; i<16 ; i++) - { - snesmap2[offset+i] = curbankval; - snesmmap[offset+i] = curbankval; - curbankval += 0x10000; - } -} - -extern unsigned char SDD1BankA, SDD1BankB, SDD1BankC, SDD1BankD; - -void UpdateBanksSDD1() -{ - if (SDD1BankA) - { - BankSwitchSDD1C(SDD1BankA, 0x0C0); - BankSwitchSDD1C(SDD1BankB, 0x0D0); - BankSwitchSDD1C(SDD1BankC, 0x0E0); - BankSwitchSDD1C(SDD1BankD, 0x0F0); - } -} - -extern void (*Bank0datr8[256])(), (*Bank0datr16[256])(), (*Bank0datw8[256])(), (*Bank0datw16[256])(); -extern void *DPageR8, *DPageR16, *DPageW8, *DPageW16; - -extern unsigned int xdb, xpb, xs, xx, xy, xd; -extern unsigned short oamaddrt, xat, xst, xdt, xxt, xyt; -extern unsigned char xdbt, xpbt; - -void UpdateDPageC() -{ - DPageR8 = Bank0datr8[(xd >> 8) & 0xFF]; - DPageR16 = Bank0datr16[(xd >> 8) & 0xFF]; - DPageW8 = Bank0datw8[(xd >> 8) & 0xFF]; - DPageW16 = Bank0datw16[(xd >> 8) & 0xFF]; -} - -extern unsigned int SA1xd; -extern void *SA1DPageR8, *SA1DPageR16, *SA1DPageW8, *SA1DPageW16; - -void SA1UpdateDPageC() -{ - SA1DPageR8 = Bank0datr8[(SA1xd >> 8) & 0xFF]; - SA1DPageR16 = Bank0datr16[(SA1xd >> 8) & 0xFF]; - SA1DPageW8 = Bank0datw8[(SA1xd >> 8) & 0xFF]; - SA1DPageW16 = Bank0datw16[(SA1xd >> 8) & 0xFF]; -} - -void unpackfunct() -{ - oamaddrt = (oamaddr & 0xFFFF); - xat = (xa & 0xFFFF); - xdbt = (xdb & 0xFF); - xpbt = (xpb & 0xFF); - xst = (xs & 0xFFFF); - xdt = (xd & 0xFFFF); - xxt = (xx & 0xFFFF); - xyt = (xy & 0xFFFF); -} - -#define bit_test(byte, checkbit) (byte & (1 << checkbit)) ? 1 : 0 - -extern unsigned int GlobalVL, GlobalVR, EchoVL, EchoVR, EchoRate[16], MaxEcho; -extern unsigned int EchoFB, NoiseSpeeds[32], dspPAdj, NoiseInc, bg1ptrx; -extern unsigned int bg1ptry, bg2ptrx, bg2ptry, bg3ptrx, bg3ptry, bg4ptrx; -extern unsigned int bg4ptry; -extern int FIRTAPVal0, FIRTAPVal1, FIRTAPVal2, FIRTAPVal3, FIRTAPVal4; -extern int FIRTAPVal5, FIRTAPVal6, FIRTAPVal7; -extern unsigned short VolumeConvTable[32768], bg1ptr, bg1ptrb, bg1ptrc; -extern unsigned short bg2ptr, bg2ptrb, bg2ptrc, bg3ptr, bg3ptrb, bg3ptrc; -extern unsigned short bg4ptr, bg4ptrb, bg4ptrc; -extern unsigned char VolumeTableb[256], MusicVol, Voice0Status; -extern unsigned char Voice1Status, Voice2Status, Voice3Status, Voice4Status; -extern unsigned char Voice5Status, Voice6Status, Voice7Status, Voice0Noise; -extern unsigned char Voice1Noise, Voice2Noise, Voice3Noise, Voice4Noise; -extern unsigned char Voice5Noise, Voice6Noise, Voice7Noise, bgtilesz; -extern unsigned char BG116x16t, BG216x16t, BG316x16t, BG416x16t, vramincby8on; -extern unsigned char vramincr; - -extern void (**regptw)(); -void reg2118(); -void reg2118inc(); -void reg2118inc8(); -void reg2118inc8inc(); -void reg2119(); -void reg2119inc(); -void reg2119inc8(); -void reg2119inc8inc(); - -void repackfunct() -{ - unsigned char block; - - // Global/Echo Volumes - GlobalVL = (VolumeConvTable[(MusicVol << 8) + VolumeTableb[DSPMem[0x0C]]] & 0xFF); - GlobalVR = (VolumeConvTable[(MusicVol << 8) + VolumeTableb[DSPMem[0x1C]]] & 0xFF); - EchoVL = (VolumeConvTable[(MusicVol << 8) + VolumeTableb[DSPMem[0x2C]]] & 0xFF); - EchoVR = (VolumeConvTable[(MusicVol << 8) + VolumeTableb[DSPMem[0x3C]]] & 0xFF); - - // Echo Values - MaxEcho = EchoRate[(DSPMem[0x7D] & 0xF)]; - EchoFB = VolumeTableb[DSPMem[0x0D]]; - - // FIR Filter Values - FIRTAPVal0 = (char)DSPMem[0x0F]; - FIRTAPVal1 = (char)DSPMem[0x1F]; - FIRTAPVal2 = (char)DSPMem[0x2F]; - FIRTAPVal3 = (char)DSPMem[0x3F]; - FIRTAPVal4 = (char)DSPMem[0x4F]; - FIRTAPVal5 = (char)DSPMem[0x5F]; - FIRTAPVal6 = (char)DSPMem[0x6F]; - FIRTAPVal7 = (char)DSPMem[0x7F]; - - // Noise - block = DSPMem[0x6C]; - DSPMem[0x6C] &= 0x7F; - - if (block & 0xC0) - { - Voice0Status = Voice1Status = Voice2Status = Voice3Status = 0; - Voice4Status = Voice5Status = Voice6Status = Voice7Status = 0; - } - - NoiseInc = (((NoiseSpeeds[(block & 0x1F)] * dspPAdj) >> 17) & 0xFFFFFFFF); - - Voice0Noise = bit_test(DSPMem[0x3D], 0); - Voice1Noise = bit_test(DSPMem[0x3D], 1); - Voice2Noise = bit_test(DSPMem[0x3D], 2); - Voice3Noise = bit_test(DSPMem[0x3D], 3); - Voice4Noise = bit_test(DSPMem[0x3D], 4); - Voice5Noise = bit_test(DSPMem[0x3D], 5); - Voice6Noise = bit_test(DSPMem[0x3D], 6); - Voice7Noise = bit_test(DSPMem[0x3D], 7); - - bg1ptrx = bg1ptrb - bg1ptr; - bg1ptry = bg1ptrc - bg1ptr; - bg2ptrx = bg2ptrb - bg2ptr; - bg2ptry = bg2ptrc - bg2ptr; - bg3ptrx = bg3ptrb - bg3ptr; - bg3ptry = bg3ptrc - bg3ptr; - bg4ptrx = bg4ptrb - bg4ptr; - bg4ptry = bg4ptrc - bg4ptr; - - // 16x16 tiles - BG116x16t = bit_test(bgtilesz, 0); - BG216x16t = bit_test(bgtilesz, 1); - BG316x16t = bit_test(bgtilesz, 2); - BG416x16t = bit_test(bgtilesz, 3); - - oamaddr = oamaddrt; - xa = xat; - xdb = xdbt; - xpb = xpbt; - xs = xst; - xd = xdt; - xx = xxt; - xy = xyt; - - if (vramincby8on == 1) - { - if (vramincr == 1) - { - regptw[0x2118] = reg2118inc8inc; - regptw[0x2119] = reg2119inc8; - } - else - { - regptw[0x2118] = reg2118inc8; - regptw[0x2119] = reg2119inc8inc; - } - } - else - { - if (vramincr == 1) - { - regptw[0x2118] = reg2118inc; - regptw[0x2119] = reg2119; - } - else - { - regptw[0x2118] = reg2118; - regptw[0x2119] = reg2119inc; - } - } -} - -void regaccessbankr8(), regaccessbankw8(), regaccessbankr16(), regaccessbankw16(); -void memaccessbankr8(), memaccessbankw8(), memaccessbankr16(), memaccessbankw16(); -void wramaccessbankr8(), wramaccessbankw8(), wramaccessbankr16(), wramaccessbankw16(); -void sramaccessbankr8(), sramaccessbankw8(), sramaccessbankr16(), sramaccessbankw16(); -void eramaccessbankr8(), eramaccessbankw8(), eramaccessbankr16(), eramaccessbankw16(); - -void regaccessbankr8SA1(), regaccessbankw8SA1(), regaccessbankr16SA1(), regaccessbankw16SA1(); -void SA1RAMaccessbankr8(), SA1RAMaccessbankw8(), SA1RAMaccessbankr16(), SA1RAMaccessbankw16(); -void SA1RAMaccessbankr8b(), SA1RAMaccessbankw8b(), SA1RAMaccessbankr16b(), SA1RAMaccessbankw16b(); - -void sramaccessbankr8s(), sramaccessbankw8s(), sramaccessbankr16s(), sramaccessbankw16s(); -void DSP1Read8b3F(), DSP1Write8b3F(), DSP1Read16b3F(), DSP1Write16b3F(); -void DSP2Read8b(), DSP2Write8b(), DSP2Read16b(), DSP2Write16b(); -void DSP3Read8b(), DSP3Write8b(), DSP3Read16b(), DSP3Write16b(); -void DSP4Read8b(), DSP4Write8b(), DSP4Read16b(), DSP4Write16b(); -void setaaccessbankr8(), setaaccessbankw8(), setaaccessbankr16(), setaaccessbankw16(); -void setaaccessbankr8a(), setaaccessbankw8a(), setaaccessbankr16a(), setaaccessbankw16a(); -void Seta11Read8_60(), Seta11Write8_60(), Seta11Read16_60(), Seta11Write16_60(); -void Seta11Read8_68(), Seta11Write8_68(), Seta11Read16_68(), Seta11Write16_68(); -void sfxaccessbankr8(), sfxaccessbankw8(), sfxaccessbankr16(), sfxaccessbankw16(); -void sfxaccessbankr8b(), sfxaccessbankw8b(), sfxaccessbankr16b(), sfxaccessbankw16b(); -void sfxaccessbankr8c(), sfxaccessbankw8c(), sfxaccessbankr16c(), sfxaccessbankw16c(); -void sfxaccessbankr8d(), sfxaccessbankw8d(), sfxaccessbankr16d(), sfxaccessbankw16d(); -void OBC1Read8b(), OBC1Write8b(), OBC1Read16b(), OBC1Write16b(); -void C4Read8b(), C4Write8b(), C4Read16b(), C4Write16b(); -void memaccessspc7110r8(), memaccessspc7110r16(), memaccessspc7110w8(), memaccessspc7110w16(); -void SPC7110ReadSRAM8b(), SPC7110ReadSRAM16b(), SPC7110WriteSRAM8b(), SPC7110WriteSRAM16b(); -void stsramr8(), stsramr16(), stsramw8(), stsramw16(); -void stsramr8b(), stsramr16b(), stsramw8b(), stsramw16b(); - -mrwp regbank = { regaccessbankr8, regaccessbankw8, regaccessbankr16, regaccessbankw16 }; -mrwp membank = { memaccessbankr8, memaccessbankw8, memaccessbankr16, memaccessbankw16 }; -mrwp wrambank = { wramaccessbankr8, wramaccessbankw8, wramaccessbankr16, wramaccessbankw16 }; -mrwp srambank = { sramaccessbankr8, sramaccessbankw8, sramaccessbankr16, sramaccessbankw16 }; -mrwp erambank = { eramaccessbankr8, eramaccessbankw8, eramaccessbankr16, eramaccessbankw16 }; - -mrwp sa1regbank = { regaccessbankr8SA1, regaccessbankw8SA1, regaccessbankr16SA1, regaccessbankw16SA1 }; -mrwp sa1rambank = { SA1RAMaccessbankr8, SA1RAMaccessbankw8, SA1RAMaccessbankr16, SA1RAMaccessbankw16 }; -mrwp sa1rambankb = { SA1RAMaccessbankr8b, SA1RAMaccessbankw8b, SA1RAMaccessbankr16b, SA1RAMaccessbankw16b }; - -mrwp sramsbank = { sramaccessbankr8s, sramaccessbankw8s, sramaccessbankr16s, sramaccessbankw16s }; -mrwp dsp1bank = { DSP1Read8b3F, DSP1Write8b3F, DSP1Read16b3F, DSP1Write16b3F }; -mrwp dsp2bank = { DSP2Read8b, DSP2Write8b, DSP2Read16b, DSP2Write16b }; -mrwp dsp3bank = { DSP3Read8b, DSP3Write8b, DSP3Read16b, DSP3Write16b }; -mrwp dsp4bank = { DSP4Read8b, DSP4Write8b, DSP4Read16b, DSP4Write16b }; -mrwp setabank = { setaaccessbankr8, setaaccessbankw8, setaaccessbankr16, setaaccessbankw16 }; -mrwp setabanka = { setaaccessbankr8a, setaaccessbankw8a, setaaccessbankr16a, setaaccessbankw16a }; -mrwp seta11bank = { Seta11Read8_68, Seta11Write8_68, Seta11Read16_68, Seta11Write16_68 }; -mrwp seta11banka = { Seta11Read8_60, Seta11Write8_60, Seta11Read16_60, Seta11Write16_60 }; -mrwp sfxbank = { sfxaccessbankr8, sfxaccessbankw8, sfxaccessbankr16, sfxaccessbankw16 }; -mrwp sfxbankb = { sfxaccessbankr8b, sfxaccessbankw8b, sfxaccessbankr16b, sfxaccessbankw16b }; -mrwp sfxbankc = { sfxaccessbankr8c, sfxaccessbankw8c, sfxaccessbankr16c, sfxaccessbankw16c }; -mrwp sfxbankd = { sfxaccessbankr8d, sfxaccessbankw8d, sfxaccessbankr16d, sfxaccessbankw16d }; -mrwp obc1bank = { OBC1Read8b, OBC1Write8b, OBC1Read16b, OBC1Write16b }; -mrwp c4bank = { C4Read8b, C4Write8b, C4Read16b, C4Write16b }; -mrwp SPC7110bank = { memaccessspc7110r8, memaccessspc7110w8, memaccessspc7110r16, memaccessspc7110w16 }; -mrwp SPC7110SRAMBank = { SPC7110ReadSRAM8b, SPC7110WriteSRAM8b, SPC7110ReadSRAM16b, SPC7110WriteSRAM16b }; -mrwp stbanka = { stsramr8, stsramw8, stsramr16, stsramw16 }; -mrwp stbankb = { stsramr8b, stsramw8b, stsramr16b, stsramw16b }; - - -void SetAddressingModes() -{ // Banks - map_mem(0x00, ®bank, 0x40); // 00 - 3F - map_mem(0x40, &membank, 0x3E); // 40 - 7D - map_mem(0x7E, &wrambank, 0x01); // 7E - map_mem(0x7F, &erambank, 0x01); // 7F - map_mem(0x80, ®bank, 0x40); // 80 - BF - map_mem(0xC0, &membank, 0x40); // C0 - FF -} - -void SetAddressingModesSA1() -{ - map_mem(0x00, &sa1regbank, 0x40); // 00 - 3F - map_mem(0x40, &sa1rambank, 0x20); // 40 - 5F - map_mem(0x60, &sa1rambankb, 0x10); // 60 - 6F - map_mem(0x70, &srambank, 0x08); // 70 - 77 - map_mem(0x78, &membank, 0x06); // 78 - 7D - map_mem(0x7E, &wrambank, 0x01); // 7E - map_mem(0x7F, &erambank, 0x01); // 7F - map_mem(0x80, &sa1regbank, 0x40); // 80 - BF - map_mem(0xC0, &membank, 0x40); // C0 - FF -} - -void membank0r8reg(), membank0w8reg(), membank0r16reg(), membank0w16reg(); -void membank0r8ram(), membank0w8ram(), membank0r16ram(), membank0w16ram(); -void membank0r8rom(), membank0w8rom(), membank0r16rom(), membank0w16rom(); -void membank0r8romram(), membank0w8romram(), membank0r16romram(), membank0w16romram(); -void membank0r8inv(), membank0w8inv(), membank0r16inv(), membank0w16inv(); -void membank0r8chip(), membank0w8chip(), membank0r16chip(), membank0w16chip(); -void membank0r8ramSA1(), membank0w8ramSA1(), membank0r16ramSA1(), membank0w16ramSA1(); - -mrwp regbank0 = { membank0r8reg, membank0w8reg, membank0r16reg, membank0w16reg }; -mrwp rambank0 = { membank0r8ram, membank0w8ram, membank0r16ram, membank0w16ram }; -mrwp rombank0 = { membank0r8rom, membank0w8rom, membank0r16rom, membank0w16rom }; -mrwp romrambank0 = { membank0r8romram, membank0w8romram, membank0r16romram, membank0w16romram }; -mrwp invbank0 = { membank0r8inv, membank0w8inv, membank0r16inv, membank0w16inv }; -mrwp chipbank0 = { membank0r8chip, membank0w8chip, membank0r16chip, membank0w16chip }; -mrwp sa1rambank0 = { membank0r8ramSA1, membank0w8ramSA1, membank0r16ramSA1, membank0w16ramSA1 }; - -static void map_bank0(size_t dest, mrwp *src, size_t num) -{ - rep_stosd(Bank0datr8+dest, src->memr8, num); - rep_stosd(Bank0datw8+dest, src->memw8, num); - rep_stosd(Bank0datr16+dest, src->memr16, num); - rep_stosd(Bank0datw16+dest, src->memw16, num); -} - -void GenerateBank0Table() -{ - map_bank0(0x00, &rambank0, 0x20); // 00 - 1F - map_bank0(0x20, ®bank0, 0x28); // 20 - 47 - map_bank0(0x48, &invbank0, 0x17); // 48 - 5E - map_bank0(0x5F, &chipbank0, 0x1F); // 5F - 7D - map_bank0(0x7E, &rombank0, 0x81); // 7E - FE - map_bank0(0xFF, &romrambank0, 0x01); // FF -} - -void GenerateBank0TableSA1() -{ - map_bank0(0x00, &sa1rambank0, 0x20); // 00 - 1F -} diff --git a/tools/zsnes/src/cpu/memtable.h b/tools/zsnes/src/cpu/memtable.h deleted file mode 100644 index e8b551c..0000000 --- a/tools/zsnes/src/cpu/memtable.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef MEMTABLE_H -#define MEMTABLE_H - -extern void (*memtabler8[256])(); -extern void (*memtablew8[256])(); -extern void (*memtabler16[256])(); -extern void (*memtablew16[256])(); - -typedef struct -{ - void (*memr8)(); - void (*memw8)(); - void (*memr16)(); - void (*memw16)(); -} mrwp; - -extern mrwp regbank, membank, wrambank, srambank, erambank, sramsbank; -extern mrwp sa1regbank, sa1rambank, sa1rambankb; -extern mrwp dsp1bank, dsp2bank, dsp3bank, dsp4bank; -extern mrwp setabank, setabanka, seta11bank, seta11banka; -extern mrwp sfxbank, sfxbankb, sfxbankc, sfxbankd; -extern mrwp obc1bank, c4bank, SPC7110bank, SPC7110SRAMBank; -extern mrwp stbanka, stbankb; - -/* -rep_stosd is my name for a 'copy times a function pointer into -a function pointer array ' function, in honour of the almighty asm -instruction rep stosd, which is able to do that (and much more). -Since ZSNES is just full of func pointer arrays, it'll probably come in handy. -*/ - -static void rep_stosd(void (**dest)(), void (*func_ptr), size_t num) -{ - while (num--) { dest[num] = func_ptr; } -} - -static void map_mem(size_t dest, mrwp *src, size_t num) -{ - rep_stosd(memtabler8+dest, src->memr8, num); - rep_stosd(memtablew8+dest, src->memw8, num); - rep_stosd(memtabler16+dest, src->memr16, num); - rep_stosd(memtablew16+dest, src->memw16, num); -} - -#endif diff --git a/tools/zsnes/src/cpu/regs.inc b/tools/zsnes/src/cpu/regs.inc deleted file mode 100644 index 625b1fb..0000000 --- a/tools/zsnes/src/cpu/regs.inc +++ /dev/null @@ -1,1260 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 SFXEnable,regptr,initsfxregsr,initSA1regs,SA1Enable,initSDD1regs -EXTSYM SPC7110Enable,initSPC7110regs,RTCEnable,RTCReset,curypos,cycpl -EXTSYM pdh,vram,romispal,reg1read,spcnumread,spcon,reg2read,reg3read -EXTSYM reg4read,JoyEOrig,JoyENow,device2,cycphb,joycontren,totlines - -%ifndef NO_DEBUGGER -EXTSYM debuggeron -%endif - -SECTION .text - -NEWSYM initregr - ; Fill register pointer with invalid register accesses - mov edi,[regptr] - add edi,8000h - mov ecx,3000h - mov eax,regINVALID -.loopa - mov [edi],eax - add edi,4 - dec ecx - jnz .loopa - ; Set all valid register accesses - setreg 2100h*4,reg2100r - setreg 2134h*4,reg2134r - setreg 2135h*4,reg2135r - setreg 2136h*4,reg2136r - setreg 2137h*4,reg2137r - setreg 2138h*4,reg2138r - setreg 2139h*4,reg2139r - setreg 213Ah*4,reg213Ar - setreg 213Bh*4,reg213Br - setreg 213Ch*4,reg213Cr - setreg 213Dh*4,reg213Dr - setreg 213Eh*4,reg213Er - setreg 213Fh*4,reg213Fr - setreg 2140h*4,reg2140r - setreg 2141h*4,reg2141r - setreg 2142h*4,reg2142r - setreg 2143h*4,reg2143r - setreg 2144h*4,reg2140r - setreg 2145h*4,reg2141r - setreg 2146h*4,reg2142r - setreg 2147h*4,reg2143r - setreg 2148h*4,reg2140r - setreg 2149h*4,reg2141r - setreg 214Ah*4,reg2142r - setreg 214Bh*4,reg2143r - setreg 214Ch*4,reg2140r - setreg 214Dh*4,reg2141r - setreg 214Eh*4,reg2142r - setreg 214Fh*4,reg2143r - setreg 2150h*4,reg2140r - setreg 2151h*4,reg2141r - setreg 2152h*4,reg2142r - setreg 2153h*4,reg2143r - setreg 2154h*4,reg2140r - setreg 2155h*4,reg2141r - setreg 2156h*4,reg2142r - setreg 2157h*4,reg2143r - setreg 2158h*4,reg2140r - setreg 2159h*4,reg2141r - setreg 215Ah*4,reg2142r - setreg 215Bh*4,reg2143r - setreg 215Ch*4,reg2140r - setreg 215Dh*4,reg2141r - setreg 215Eh*4,reg2142r - setreg 215Fh*4,reg2143r - setreg 2160h*4,reg2140r - setreg 2161h*4,reg2141r - setreg 2162h*4,reg2142r - setreg 2163h*4,reg2143r - setreg 2164h*4,reg2140r - setreg 2165h*4,reg2141r - setreg 2166h*4,reg2142r - setreg 2167h*4,reg2143r - setreg 2168h*4,reg2140r - setreg 2169h*4,reg2141r - setreg 216Ah*4,reg2142r - setreg 216Bh*4,reg2143r - setreg 216Ch*4,reg2140r - setreg 216Dh*4,reg2141r - setreg 216Eh*4,reg2142r - setreg 216Fh*4,reg2143r - setreg 2170h*4,reg2140r - setreg 2171h*4,reg2141r - setreg 2172h*4,reg2142r - setreg 2173h*4,reg2143r - setreg 2174h*4,reg2140r - setreg 2175h*4,reg2141r - setreg 2176h*4,reg2142r - setreg 2177h*4,reg2143r - setreg 2178h*4,reg2140r - setreg 2179h*4,reg2141r - setreg 217Ah*4,reg2142r - setreg 217Bh*4,reg2143r - setreg 217Ch*4,reg2140r - setreg 217Dh*4,reg2141r - setreg 217Eh*4,reg2142r - setreg 217Fh*4,reg2143r - setreg 2180h*4,reg2180r - setreg 21C2h*4,reg21C2r - setreg 21C3h*4,reg21C3r - - setreg 4016h*4,reg4016r - setreg 4017h*4,reg4017r - - setreg 4100h*4,reg4100r - - setreg 420Ah*4,reg420Ar - setreg 420Bh*4,reg420Br - setreg 420Ch*4,reg420Cr - setreg 420Dh*4,reg420Dr - setreg 420Eh*4,reg420Er - setreg 420Fh*4,reg420Fr - - setreg 4210h*4,reg4210r - setreg 4211h*4,reg4211r - setreg 4212h*4,reg4212r - setreg 4213h*4,reg4213r - setreg 4214h*4,reg4214r - setreg 4215h*4,reg4215r - setreg 4216h*4,reg4216r - setreg 4217h*4,reg4217r - setreg 4218h*4,reg4218r - setreg 4219h*4,reg4219r - setreg 421Ah*4,reg421Ar - setreg 421Bh*4,reg421Br - setreg 421Ch*4,reg421Cr - setreg 421Dh*4,reg421Dr - setreg 421Eh*4,reg421Er - setreg 421Fh*4,reg421Fr - - setreg 4300h*4,reg43XXr - setreg 4301h*4,reg43XXr - setreg 4302h*4,reg43XXr - setreg 4303h*4,reg43XXr - setreg 4304h*4,reg43XXr - setreg 4305h*4,reg43XXr - setreg 4306h*4,reg43XXr - setreg 4307h*4,reg43XXr - setreg 4308h*4,reg43XXr - setreg 4309h*4,reg43XXr - setreg 430Ah*4,reg43XXr - setreg 430Bh*4,reg43XXr - setreg 430Fh*4,reg43XXr - setreg 4310h*4,reg43XXr - setreg 4311h*4,reg43XXr - setreg 4312h*4,reg43XXr - setreg 4313h*4,reg43XXr - setreg 4314h*4,reg43XXr - setreg 4315h*4,reg43XXr - setreg 4316h*4,reg43XXr - setreg 4317h*4,reg43XXr - setreg 4318h*4,reg43XXr - setreg 4319h*4,reg43XXr - setreg 431Ah*4,reg43XXr - setreg 431Bh*4,reg43XXr - setreg 431Fh*4,reg43XXr - setreg 4320h*4,reg43XXr - setreg 4321h*4,reg43XXr - setreg 4322h*4,reg43XXr - setreg 4323h*4,reg43XXr - setreg 4324h*4,reg43XXr - setreg 4325h*4,reg43XXr - setreg 4326h*4,reg43XXr - setreg 4327h*4,reg43XXr - setreg 4328h*4,reg43XXr - setreg 4329h*4,reg43XXr - setreg 432Ah*4,reg43XXr - setreg 432Bh*4,reg43XXr - setreg 432Fh*4,reg43XXr - setreg 4330h*4,reg43XXr - setreg 4331h*4,reg43XXr - setreg 4332h*4,reg43XXr - setreg 4333h*4,reg43XXr - setreg 4334h*4,reg43XXr - setreg 4335h*4,reg43XXr - setreg 4336h*4,reg43XXr - setreg 4337h*4,reg43XXr - setreg 4338h*4,reg43XXr - setreg 4339h*4,reg43XXr - setreg 433Ah*4,reg43XXr - setreg 433Bh*4,reg43XXr - setreg 433Fh*4,reg43XXr - setreg 4340h*4,reg43XXr - setreg 4341h*4,reg43XXr - setreg 4342h*4,reg43XXr - setreg 4343h*4,reg43XXr - setreg 4344h*4,reg43XXr - setreg 4345h*4,reg43XXr - setreg 4346h*4,reg43XXr - setreg 4347h*4,reg43XXr - setreg 4348h*4,reg43XXr - setreg 4349h*4,reg43XXr - setreg 434Ah*4,reg43XXr - setreg 434Bh*4,reg43XXr - setreg 434Fh*4,reg43XXr - setreg 4350h*4,reg43XXr - setreg 4351h*4,reg43XXr - setreg 4352h*4,reg43XXr - setreg 4353h*4,reg43XXr - setreg 4354h*4,reg43XXr - setreg 4355h*4,reg43XXr - setreg 4356h*4,reg43XXr - setreg 4357h*4,reg43XXr - setreg 4358h*4,reg43XXr - setreg 4359h*4,reg43XXr - setreg 435Ah*4,reg43XXr - setreg 435Bh*4,reg43XXr - setreg 435Fh*4,reg43XXr - setreg 4360h*4,reg43XXr - setreg 4361h*4,reg43XXr - setreg 4362h*4,reg43XXr - setreg 4363h*4,reg43XXr - setreg 4364h*4,reg43XXr - setreg 4365h*4,reg43XXr - setreg 4366h*4,reg43XXr - setreg 4367h*4,reg43XXr - setreg 4368h*4,reg43XXr - setreg 4369h*4,reg43XXr - setreg 436Ah*4,reg43XXr - setreg 436Bh*4,reg43XXr - setreg 436Fh*4,reg43XXr - setreg 4370h*4,reg43XXr - setreg 4371h*4,reg43XXr - setreg 4372h*4,reg43XXr - setreg 4373h*4,reg43XXr - setreg 4374h*4,reg43XXr - setreg 4375h*4,reg43XXr - setreg 4376h*4,reg43XXr - setreg 4377h*4,reg43XXr - setreg 4378h*4,reg43XXr - setreg 4379h*4,reg43XXr - setreg 437Ah*4,reg43XXr - setreg 437Bh*4,reg43XXr - setreg 437Fh*4,reg43XXr - - cmp byte[SFXEnable],0 - je .nosfx - call initsfxregsr -.nosfx - cmp byte[SA1Enable],0 - je .nosa1 - call initSA1regs -.nosa1 - cmp byte[SDD1Enable],0 - je .nosdd1 - call initSDD1regs -.nosdd1 - cmp byte[SPC7110Enable],0 - je .nospc7110 - call initSPC7110regs -.nospc7110 - cmp byte[RTCEnable],0 - je .noRTC - call RTCReset -.noRTC - ret - -; global variables -SECTION .data -NEWSYM invreg, dw 0 -NEWSYM sndrot, db 0 ; rotates to use A,X or Y for sound skip -NEWSYM sndrot2, db 0 ; rotates a random value for sound skip -NEWSYM INTEnab, db 0 ; enables NMI(7)/VIRQ(5)/HIRQ(4)/JOY(0) -NEWSYM NMIEnab, db 1 ; controlled in e65816 loop. Sets to 81h -NEWSYM VIRQLoc, dw 0 ; VIRQ Y location -NEWSYM vidbright, db 0 ; screen brightness (0 .. 15) -NEWSYM previdbr, db 0 ; previous screen brightness -NEWSYM forceblnk, db 80h ; force blanking on/off ($80=on) -NEWSYM objptr, dd 0 ; pointer to object data in VRAM -NEWSYM objptrn, dd 0 ; pointer2 to object data in VRAM -NEWSYM objsize1, db 1 ; 1 = 8dot, 4=16 dot, 16=32 dot, 64=64dot -NEWSYM objsize2, db 4 ; large object size -NEWSYM objmovs1, db 2 ; number of bytes to move/paragraph -NEWSYM objadds1, dw 14 ; number of bytes to add/paragraph -NEWSYM objmovs2, db 2 ; number of bytes to move/paragraph -NEWSYM objadds2, dw 14 ; number of bytes to add/paragraph -NEWSYM oamaddrt, dw 0 ; oam address -NEWSYM oamaddrs, dw 0 ; oam address at beginning of vblank -NEWSYM objhipr, db 0 ; highest priority object # -NEWSYM bgmode, db 0 ; graphics mode ( 0 .. 7 ) -NEWSYM bg3highst, db 0 ; is 1 if background 3 has the highest priority -NEWSYM bgtilesz, db 0 ; 0 = 8x8, 1 = 16x16, bit 0=bg1,bit1=bg2,etc -NEWSYM mosaicon, db 0 ; mosaic on, bit 0=bg1,bit1=bg2, etc -NEWSYM mosaicsz, db 0 ; mosaic size in pixels -NEWSYM bg1ptr, dw 0 ; pointer to background1 -NEWSYM bg2ptr, dw 0 ; pointer to background2 -NEWSYM bg3ptr, dw 0 ; pointer to background3 -NEWSYM bg4ptr, dw 0 ; pointer to background4 -NEWSYM bg1ptrb, dw 0 ; pointer to background1 -NEWSYM bg2ptrb, dw 0 ; pointer to background2 -NEWSYM bg3ptrb, dw 0 ; pointer to background3 -NEWSYM bg4ptrb, dw 0 ; pointer to background4 -NEWSYM bg1ptrc, dw 0 ; pointer to background1 -NEWSYM bg2ptrc, dw 0 ; pointer to background2 -NEWSYM bg3ptrc, dw 0 ; pointer to background3 -NEWSYM bg4ptrc, dw 0 ; pointer to background4 -NEWSYM bg1ptrd, dw 0 ; pointer to background1 -NEWSYM bg2ptrd, dw 0 ; pointer to background2 -NEWSYM bg3ptrd, dw 0 ; pointer to background3 -NEWSYM bg4ptrd, dw 0 ; pointer to background4 -NEWSYM bg1scsize, db 0 ; bg #1 screen size (0=1x1,1=1x2,2=2x1,3=2x2) -NEWSYM bg2scsize, db 0 ; bg #2 screen size (0=1x1,1=1x2,2=2x1,3=2x2) -NEWSYM bg3scsize, db 0 ; bg #3 screen size (0=1x1,1=1x2,2=2x1,3=2x2) -NEWSYM bg4scsize, db 0 ; bg #4 screen size (0=1x1,1=1x2,2=2x1,3=2x2) -NEWSYM bg1objptr, dw 0 ; pointer to tiles in background1 -NEWSYM bg2objptr, dw 0 ; pointer to tiles in background2 -NEWSYM bg3objptr, dw 0 ; pointer to tiles in background3 -NEWSYM bg4objptr, dw 0 ; pointer to tiles in background4 -NEWSYM bg1scrolx, dw 0 ; background 1 x position -NEWSYM bg2scrolx, dw 0 ; background 2 x position -NEWSYM bg3scrolx, dw 0 ; background 3 x position -NEWSYM bg4scrolx, dw 0 ; background 4 x position -NEWSYM bg1sx, dw 0 ; Temporary Variable for Debugging purposes -NEWSYM bg1scroly, dw 0 ; background 1 y position -NEWSYM bg2scroly, dw 0 ; background 2 y position -NEWSYM bg3scroly, dw 0 ; background 3 y position -NEWSYM bg4scroly, dw 0 ; background 4 y position -NEWSYM addrincr, dw 2 ; vram increment (2,64,128,256) -NEWSYM vramincr, db 0 ; 0 = inrement at 2118/2139, 1 = 2119,213A -NEWSYM vramread, db 0 ; previous character for vram read -NEWSYM vramaddr, dd 0 ; vram address -NEWSYM cgaddr, dw 0 ; cg (palette) address -NEWSYM cgmod, db 0 ; if cgram is modified or not -NEWSYM scrnon, dw 0 ; main & sub screen on -NEWSYM scrndist, db 0 ; which background is disabled -NEWSYM resolutn, dw 224 ; screen resolution -NEWSYM multa, db 0 ; multiplier A -NEWSYM diva, dw 0 ; divisor C -NEWSYM divres, dw 0 ; quotent of divc/divb -NEWSYM multres, dw 0 ; result of multa * multb/remainder of divc/divb -NEWSYM latchx, dw 0 ; latched x value -NEWSYM latchy, dw 0 ; latched y value -NEWSYM latchxr, db 0 ; low or high byte read for x value -NEWSYM latchyr, db 0 ; low or high byte read for y value -NEWSYM frskipper, db 0 ; used to control frame skipping -NEWSYM winl1, db 0 ; window 1 left position -NEWSYM winr1, db 0 ; window 1 right position -NEWSYM winl2, db 0 ; window 2 left position -NEWSYM winr2, db 0 ; window 2 right position -NEWSYM winbg1en, db 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG1 -NEWSYM winbg2en, db 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG2 -NEWSYM winbg3en, db 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG3 -NEWSYM winbg4en, db 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG4 -NEWSYM winobjen, db 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on sprites -NEWSYM wincolen, db 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on backarea -NEWSYM winlogica, db 0 ; Window logic type for BG1 to 4 -NEWSYM winlogicb, db 0 ; Window logic type for Sprites and Backarea -NEWSYM winenabm, db 0 ; Window logic enable for main screen -NEWSYM winenabs, db 0 ; Window logic enable for sub screen -NEWSYM mode7set, db 0 ; mode 7 settings -NEWSYM mode7A, dw 0 ; A value for Mode 7 -NEWSYM mode7B, dw 0 ; B value for Mode 7 -NEWSYM mode7C, dw 0 ; C value for Mode 7 -NEWSYM mode7D, dw 0 ; D value for Mode 7 -NEWSYM mode7X0, dw 0 ; Center X for Mode 7 -NEWSYM mode7Y0, dw 0 ; Center Y for Mode 7 -NEWSYM JoyAPos, db 0 ; Old-Style Joystick Read Position for Joy 1 & 3 -NEWSYM JoyBPos, db 0 ; Old-Style Joystick Read Position for Joy 2 & 4 -NEWSYM compmult, dd 0 ; Complement Multiplication for Mode 7 -NEWSYM joyalt, db 0 ; temporary joystick alternation - -NEWSYM wramrwadr, dd 0 ; continuous read/write to wram address -NEWSYM dmadata, times 129 db 0FFh ; dma data (written from ports 43xx) -NEWSYM irqon, db 0 ; if IRQ has been called (80h) or not (0) -NEWSYM nexthdma, db 0 ; HDMA data to execute once vblank ends -NEWSYM curhdma, db 0 ; Currently executed hdma -NEWSYM hdmadata, times 8*19 db 0 ; 4 dword register addresses, # of bytes to - ; transfer/line, address increment (word) -NEWSYM hdmatype, db 0 ; if first time executing hdma or not -NEWSYM coladdr, db 0 ; red value of color to add -NEWSYM coladdg, db 0 ; green value of color to add -NEWSYM coladdb, db 0 ; blue value of color to add -NEWSYM colnull, db 0 ; keep this 0 (when accessing colors by dword) -NEWSYM scaddset, db 0 ; screen/fixed color addition settings -NEWSYM scaddtype, db 0 ; which screen to add/sub -NEWSYM Voice0Disabl2, db 1 ; Disable Voice 0 -NEWSYM Voice1Disabl2, db 1 ; Disable Voice 1 -NEWSYM Voice2Disabl2, db 1 ; Disable Voice 2 -NEWSYM Voice3Disabl2, db 1 ; Disable Voice 3 -NEWSYM Voice4Disabl2, db 1 ; Disable Voice 4 -NEWSYM Voice5Disabl2, db 1 ; Disable Voice 5 -NEWSYM Voice6Disabl2, db 1 ; Disable Voice 6 -NEWSYM Voice7Disabl2, db 1 ; Disable Voice 7 - -NEWSYM oamram, times 1024 db 0 ; OAMRAM (544 bytes) -NEWSYM cgram, times 512 db 0 ; CGRAM -NEWSYM pcgram, times 512 db 0 ; Previous CGRAM - -NEWSYM vraminctype, db 0 - -; New variables -NEWSYM vramincby8on, db 0 ; if increment by 8 is on -NEWSYM vramincby8left, db 0 ; how many left -NEWSYM vramincby8totl, db 0 ; how many in total (32,64,128) -NEWSYM vramincby8rowl, db 0 ; how many left in that row (start at 8) -NEWSYM vramincby8ptri, dw 0 ; increment by how many when rowl = 0 - -NEWSYM nexthprior, db 0 -NEWSYM doirqnext, db 0 - -NEWSYM vramincby8var, dw 0 -NEWSYM screstype, db 0 -NEWSYM extlatch, db 0 -NEWSYM cfield, db 0 -NEWSYM interlval, db 0 - -NEWSYM HIRQLoc, dw 0 ; HIRQ X location - -NEWSYM KeyOnStA, db 0 -NEWSYM KeyOnStB, db 0 - -NEWSYM SDD1BankA, db 0 -NEWSYM SDD1BankB, db 1 -NEWSYM SDD1BankC, db 2 -NEWSYM SDD1BankD, db 3 -NEWSYM vramread2, db 0 ; previous character for vram read -NEWSYM nosprincr, db 0 -NEWSYM poamaddrs, dw 0 -NEWSYM ioportval, db 255 -NEWSYM iohvlatch, db 0 -NEWSYM ppustatus, db 0 -NEWSYM hdmastartsc, db 0 -NEWSYM hdmarestart, db 0 -NEWSYM hdmadelay, db 0 -NEWSYM nohdmaframe, db 0 ; no hdma for current frame - -NEWSYM tempdat, times 474 db 0 ; expandable area - -num2writeppureg equ $-sndrot -; pharos equ hack *sigh* -NEWSYM PHnum2writeppureg, dd num2writeppureg - -NEWSYM scrndis, db 0 ; which background is disabled - -ALIGN32 -NEWSYM oamaddr, dd 0 ; oam address - -NEWSYM bg1ptrx, dd 0 ; pointer to background1 -NEWSYM bg2ptrx, dd 0 ; pointer to background2 -NEWSYM bg3ptrx, dd 0 ; pointer to background3 -NEWSYM bg4ptrx, dd 0 ; pointer to background4 - -NEWSYM bg1ptry, dd 0 ; pointer to background1 -NEWSYM bg2ptry, dd 0 ; pointer to background2 -NEWSYM bg3ptry, dd 0 ; pointer to background3 -NEWSYM bg4ptry, dd 0 ; pointer to background4 - -NEWSYM Voice0Disable, db 1 ; Disable Voice 0 -NEWSYM Voice1Disable, db 1 ; Disable Voice 1 -NEWSYM Voice2Disable, db 1 ; Disable Voice 2 -NEWSYM Voice3Disable, db 1 ; Disable Voice 3 -NEWSYM Voice4Disable, db 1 ; Disable Voice 4 -NEWSYM Voice5Disable, db 1 ; Disable Voice 5 -NEWSYM Voice6Disable, db 1 ; Disable Voice 6 -NEWSYM Voice7Disable, db 1 ; Disable Voice 7 - -NEWSYM BG116x16t, db 0 -NEWSYM BG216x16t, db 0 -NEWSYM BG316x16t, db 0 -NEWSYM BG416x16t, db 0 -NEWSYM SPC700read, dd 0 -NEWSYM SPC700write, dd 0 - -NEWSYM JoyCRead, db 0 - -NEWSYM nssdip1, db 0 -NEWSYM nssdip2, db 0 -NEWSYM nssdip3, db 0 -NEWSYM nssdip4, db 0 -NEWSYM nssdip5, db 0 -NEWSYM nssdip6, db 0 - -SECTION .text - -NEWSYM ClearRegs - mov word[VIRQLoc],0 - mov word[bg1ptr],0 - mov word[bg2ptr],0 - mov word[bg3ptr],0 - mov word[bg4ptr],0 - mov word[bg1ptrb],0 - mov word[bg2ptrb],0 - mov word[bg3ptrb],0 - mov word[bg4ptrb],0 - mov word[bg1ptrc],0 - mov word[bg2ptrc],0 - mov word[bg3ptrc],0 - mov word[bg4ptrc],0 - mov word[bg1ptrd],0 - mov word[bg2ptrd],0 - mov word[bg3ptrd],0 - mov word[bg4ptrd],0 - mov word[bg1objptr],0 - mov word[bg2objptr],0 - mov word[bg3objptr],0 - mov word[bg4objptr],0 - mov byte[ioportval],0FFh - mov byte[hdmastartsc],0 - mov byte[hdmarestart],0 - mov byte[nohdmaframe],0 - mov byte[hdmadelay],0 - ret - -reg2100r: - ;Should be Openbus - mov al,[vidbright] - or al,[forceblnk] - ret - -; Multiply Result Low -reg2134r: - checkmultchange - mov al,[compmult] - ret - -; Multiply Result Middle -reg2135r: - checkmultchange - mov al,[compmult+1] - ret - -; Multiply Result High -reg2136r: - checkmultchange - mov al,[compmult+2] - ret - -; Software latch for horizontal/vertical counter -reg2137r: -; mov byte[debstop3],1 -%ifndef NO_DEBUGGER - cmp byte[debuggeron],1 - je .debugger -%endif - cmp byte[iohvlatch],1 - je .dolatch - test byte[ioportval],80h - jz .nolatch -.dolatch - xor ebx,ebx - mov bl,[cycpl] - sub bl,dh - add bx,bx - mov [latchx],bx - mov bx,[curypos] - mov [latchy],bx - mov bl,[INTEnab] - and bl,30h - cmp bl,30h - jne .novhirq - cmp word[HIRQLoc],0F0h - ja .incry - cmp dh,30 - jae .noincly -.incry - inc word[latchy] -.novhirq -.noincly -.nolatch - xor al,al - mov byte[extlatch],0 - ret -.debugger -debblah: - cmp byte[iohvlatch],1 - je .dolatch2 - test byte[ioportval],80h - jz near .nolatch2 -.dolatch2 - xor ebx,ebx - mov bl,[cycpl] - sub bl,[pdh] - add bx,bx - mov [latchx],bx - mov bx,[curypos] - mov [latchy],bx - mov bl,[INTEnab] - and bl,30h - cmp bl,30h - jne .novhirq - cmp word[HIRQLoc],0F0h -; ja .incry - cmp word[latchx],80 -; jb .noincly -.incry - inc word[latchy] -.novhirq -.noincly - xor al,al - mov byte[extlatch],0 - ret - - push eax - push edx - xor eax,eax - xor ebx,ebx - mov al,[cycpl] - sub al,[pdh] - mov bx,339 - mul bx - xor ebx,ebx - mov bl,[cycpl] - div bx - mov [latchx],ax - pop edx - pop eax - mov bx,[curypos] - mov [latchy],bx - mov bl,[INTEnab] - and bl,30h - cmp bl,30h - jne .novhirq2 - cmp word[HIRQLoc],0F0h - ja .incry2 - cmp word[latchx],80 - jb .noincly2 -.incry2 - inc word[latchy] -.novhirq2 -.noincly2 -.nolatch2 - xor al,al - mov byte[extlatch],0 - ret - -; Read OAM Data (Low, High) -reg2138r: - xor ebx,ebx - mov bx,[oamaddr] - add ebx,oamram - mov al,[ebx] - inc word[oamaddr] - cmp word[oamaddr],543 - ja .wrapoam - ret -.wrapoam - mov word[oamaddr],0 - ret - -; Read VRAM Data (Low) -reg2139r: - mov al,[vramread] - - xor ebx,ebx - mov bx,[vramaddr] - add ebx,[vram] - mov bl,[ebx] - mov [vramread],bl - - cmp byte[vramincr],0 - je near .noincr - mov bx,[addrincr] - add [vramaddr],bx - cmp byte[vramincby8on],1 - jne .noincr - dec byte[vramincby8left] - jnz .noincr - - add word[vramaddr],2 - mov bl,[vramincby8totl] - mov [vramincby8left],bl - dec byte[vramincby8rowl] - jz .nextrow - mov bx,[vramincby8ptri] - sub [vramaddr],bx - jmp .noincr -.nextrow - mov byte[vramincby8rowl],8 - sub word[vramaddr],16 -.noincr - ret - -; Read VRAM Data (High) -reg213Ar: - mov al,[vramread2] - - xor ebx,ebx - mov bx,[vramaddr] - add ebx,[vram] - mov bl,[ebx+1] - mov [vramread2],bl - - cmp byte[vramincr],1 - je near .noincr - mov bx,[addrincr] - add [vramaddr],bx - cmp byte[vramincby8on],1 - jne .noincr - dec byte[vramincby8left] - jnz .noincr - - add word[vramaddr],2 - mov bl,[vramincby8totl] - mov [vramincby8left],bl - dec byte[vramincby8rowl] - jz .nextrow - mov bx,[vramincby8ptri] - sub [vramaddr],bx - jmp .noincr -.nextrow - mov byte[vramincby8rowl],8 - sub word[vramaddr],16 -.noincr - ret - -; Read CGRAM Data -reg213Br: - xor ebx,ebx - mov bx,[cgaddr] - mov al,[cgram+ebx] - inc word[cgaddr] - and word[cgaddr],01FFh - ret - -; H counter data by external or software latch -reg213Cr: - cmp byte[latchxr],1 - je .highv - mov al,[latchx] - mov byte[latchxr],1 - ret -.highv - mov al,[latchx] - and al,0FEh - or al,byte[latchx+1] - mov byte[latchxr],0 - ret - -; V counter data by external or software latch -reg213Dr: - cmp byte[latchyr],1 - je .highv - mov al,[latchy] - mov byte[latchyr],1 - ret -.highv - mov al,[latchy] - and al,0FEh - or al,byte[latchy+1] - mov byte[latchyr],0 - ret - -; PPU Status Flag & Version number (OBJ over flags) -reg213Er: - mov al,01h - ret - -; PPU Status Flag & Version number (NTSC/PAL/EXTRN Latch flag) -reg213Fr: -; mov byte[debstop3],1 - mov al,[romispal] - shl al,4 - or al,[ppustatus] - or al,[cfield] - mov byte[latchxr],0 - mov byte[latchyr],0 - or al,[extlatch] - ret - -; Sound Reg #1 -reg2140r: - cmp byte[spcon],0 - je .nosound - inc dword[SPC700read] - mov al,[reg1read] - mov byte[spcnumread],0 - ret -.nosound - ; Find for D0 - mov ebx,esi - cmp word[ebx],0FB10h - jne .noret - mov word[ebx],0EAEAh -.noret - mov al,5 -.tryagain - cmp byte[ebx],0D0h - je .foundit - inc ebx - dec al - jnz .tryagain - jmp .notfound -.foundit - mov byte[ebx],0EAh - mov byte[ebx+1],0EAh -.notfound - inc byte[sndrot2] - cmp byte[sndrot2],3 - jne .a - mov byte[sndrot2],0 -.a - xor al,al - test byte[sndrot2],01h - jz .n - mov al,[xa] -.n - ret - -; Sound Reg #2 -reg2141r: - cmp byte[spcon],0 - je .nosound - inc dword[SPC700read] - mov al,[reg2read] - mov byte[spcnumread],0 - ret -.nosound - ; Find for D0 - mov ebx,esi - mov al,3 -.tryagain - cmp byte[ebx],0D0h - je .foundit - inc ebx - dec al - jnz .tryagain - jmp .notfound -.foundit - mov byte[ebx],0EAh - mov byte[ebx+1],0EAh -.notfound - xor byte[sndrot],01h - mov al,[xa+1] - test byte[sndrot],01h - jz .n - mov al,[xa] -.n - ret - -; Sound Reg #3 -reg2142r: - cmp byte[spcon],0 - je .nosound - inc dword[SPC700read] - mov al,[reg3read] - mov byte[spcnumread],0 - ret -.nosound - ; Find for D0 - mov ebx,esi - mov al,3 -.tryagain - cmp byte[ebx],0D0h - je .foundit - inc ebx - dec al - jnz .tryagain - jmp .notfound -.foundit - mov byte[ebx],0EAh - mov byte[ebx+1],0EAh -.notfound - mov al,[xa] - test byte[sndrot],01h - jz .n - mov al,[xa+1] -.n - ret - -; Sound Reg #4 -reg2143r: - cmp byte[spcon],0 - je .nosound - inc dword[SPC700read] - mov al,[reg4read] - mov byte[spcnumread],0 - ret -.nosound - ; Find for D0 - mov ebx,esi - mov al,3 -.tryagain - cmp byte[ebx],0D0h - je .foundit - inc ebx - dec al - jnz .tryagain - jmp .notfound -.foundit - mov byte[ebx],0EAh - mov byte[ebx+1],0EAh -.notfound - mov al,[xa+1] - ret - -reg2144r: - xor al,al - ret - -; WRAM Read -reg2180r: - mov ebx,[wramrwadr] - add ebx,[wramdata] - mov al,[ebx] - inc dword[wramrwadr] - and dword[wramrwadr],01FFFFh - ret - -; Unknown register, used by test cart - -reg21C2r: -reg21C3r: - mov al,21h - ret - -; Joystick Data for controller 1 and 2 - -reg4016r: - xor al,al - test dword[JoyANow],80000000h - jz .noal - mov al,1 -.noal - rol dword[JoyANow],1 - ret - -SECTION .bss -NEWSYM MultiTap, resb 1 -SECTION .text - -; Joystick Data for controller 2 and 4 -reg4017r: - mov al,28 - cmp byte[device2],0 - jne .nomultitap - cmp byte[MultiTap],1 - je .multitap -.nomultitap -; cmp byte[device2],1 -; je .mouse2 -; test byte[JoyBNow],0FFh -; jnz .reset -;.mouse2 - test dword[JoyBNow],80000000h - jz .noal -;.reset - or al,1 -.noal - rol dword[JoyBNow],1 - ret -.multitap - test byte[MultiTapStat],1 - jz .no1 - or al,3 - ret -.no1 - test byte[MultiTapStat],80h - jz .contr45 - test dword[JoyBNow],80000000h - jz .nojb - or al,1 -.nojb - test dword[JoyCNow],80000000h - jz .nojc - or al,2 -.nojc - rol dword[JoyBNow],1 - rol dword[JoyCNow],1 - ret -.contr45 - test dword[JoyDNow],80000000h - jz .nojd - or al,1 -.nojd - test dword[JoyENow],80000000h - jz .noje - or al,2 -.noje - rol dword[JoyDNow],1 - rol dword[JoyENow],1 - ret - -reg4100r: - xor al,al - cmp byte[nssdip1],1 - jne .nodip1 - mov al,1 -.nodip1 - cmp byte[nssdip2],1 - jne .nodip2 - or al,02h -.nodip2 - cmp byte[nssdip3],1 - jne .nodip3 - or al,04h -.nodip3 - cmp byte[nssdip4],1 - jne .nodip4 - or al,08h -.nodip4 - cmp byte[nssdip5],1 - jne .nodip5 - or al,10h -.nodip5 - cmp byte[nssdip6],1 - jne .nodip6 - or al,20h -.nodip6 - ret - -reg420Ar: -reg420Br: -reg420Cr: -reg420Dr: -reg420Er: -reg420Fr: - ;Should be Openbus - xor al,al - ret - -; NMI Check Register -reg4210r: - mov al,[NMIEnab] - cmp byte[curnmi],0 - jne .nmi - mov byte[NMIEnab],01h -.nmi - mov byte[curnmi],0 - ret - -; Video IRQ Register -reg4211r: - mov al,[irqon] - mov byte[irqon],0 - cmp dh,[cycphb] - jae .nohblank - or al,40h -.nohblank - ret - -SECTION .bss -NEWSYM hblank, resb 1 -SECTION .text - -; H/V Blank Flag & Joystick Controller Enable Flag -; bit 7 = vblank, 0=out,1=in, bit 6 = hblank, 0=out,1=in, bit 0 = joystick on -reg4212r: - xor al,al - cmp byte[joycontren],25 - jb .nojoyc -.yesjoy - mov al,1 -.nojoyc - inc byte[joycontren] - cmp byte[joycontren],50 - jne .n - mov byte[joycontren],0 -.n -%ifndef NO_DEBUGGER - cmp byte[debuggeron],1 - je .debugger -%endif - mov bx,[resolutn] - cmp word[curypos],bx - jne .notres - cmp byte[nmistatus],2 - je .vblank -.notres - inc bx - cmp word[curypos],bx - jb .novbl - mov bx,[totlines] - dec bx - cmp word[curypos],bx - jae .novbl -.vblank - or al,80h -; jmp .nohblank -.novbl - mov byte[hblank],0 - cmp dh,[cycphb] - jae .nohblank - mov byte[hblank],1 - or al,40h -.nohblank - test byte[INTEnab],01h - jz .nojoy - mov bx,[resolutn] - add bx,2 - cmp word[curypos],bx - jne .nojoy - cmp dh,5 - ja .nojoy - ret -.nojoy - ret -.debugger -debblah2: - push edx - mov dh,[pdh] - mov bx,[resolutn] - cmp word[curypos],bx - jne .notres - cmp byte[nmistatus],2 - je .vblank -.notres - inc bx - cmp word[curypos],bx - jb .novbl - mov bx,[totlines] - dec bx - cmp word[curypos],bx - jae .novbl -.vblank - or al,80h -; jmp .nohblank -.novbl - cmp dh,[cycphb] - jae .nohblank - or al,40h -.nohblank - test byte[INTEnab],01h - jz .nojoy - mov bx,[resolutn] - add bx,2 - cmp word[curypos],bx - jne .nojoy - cmp dh,5 - ja .nojoy - pop edx - ret -.nojoy - pop edx - ret - - mov bx,[resolutn] - inc bx - cmp word[curypos],bx - jb .novbl2 - or al,80h - jmp .nohblank2 -.novbl2 - mov bl,[pdh] - cmp bl,[cycphb] - jae .nohblank2 - or al,40h -.nohblank2 - test byte[INTEnab],01h - jz .nojoy2 - mov bx,[resolutn] - add bx,2 - cmp word[curypos],bx - jne .nojoy2 - cmp byte[pdh],5 - ja .nojoy -; or al,01h - ret -.nojoy2 - ret - -; Programmable I/O port -reg4213r: - mov al,[ioportval] - ret - -; Quotent of Divide Result (Low) -reg4214r: - mov al,[divres] - ret - -; Quotent of Divide Result (High) -reg4215r: - mov al,[divres+1] - ret - -; Product of Multiplication Result or Remainder of Divide Result (Low) -reg4216r: - mov al,[multres] - ret - -; Product of Multiplication Result or Remainder of Divide Result (High) -reg4217r: - mov al,[multres+1] - ret - -; Joystick 1 Low -; bit7=X,bit6=Y,bit5=L,bit4=R -reg4218r: - mov al,[JoyAOrig+2] - ret - -; Joystick 1 High -; bit7=A,bit6=B,bit5=Sel,bit4=Start,bit3=up,bit2=down,bit1=left,bit0=right -reg4219r: - mov al,[JoyAOrig+3] - ret - -; Joystick 2 Low -reg421Ar: - mov al,[JoyBOrig+2] - ret - -; Joystick 2 High -reg421Br: - mov al,[JoyBOrig+3] - ret - -; Joystick 3 Low -reg421Cr: - mov al,[JoyDOrig+2] - ret - -; Joystick 3 High -reg421Dr: - mov al,[JoyDOrig+3] - ret - -; Joystick 4 Low -reg421Er: - mov al,[JoyCOrig+2] - ret - -; Joystick 4 High -reg421Fr: - mov al,[JoyCOrig+3] - ret - -; DMA Reader -reg43XXr: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov al,[dmadata+ebx] - ret - -regINVALID: ; Invalid Register - cmp cx,2100h - jb .cleared - mov al,ch - cmp byte[SPC7110Enable],0 - je .nospc7110 -.cleared - xor al,al -.nospc7110 -; mov byte[debstop3],1 - ret diff --git a/tools/zsnes/src/cpu/regs.mac b/tools/zsnes/src/cpu/regs.mac deleted file mode 100644 index 6a5eaa1..0000000 --- a/tools/zsnes/src/cpu/regs.mac +++ /dev/null @@ -1,57 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 diff --git a/tools/zsnes/src/cpu/regsw.inc b/tools/zsnes/src/cpu/regsw.inc deleted file mode 100644 index 29f8c57..0000000 --- a/tools/zsnes/src/cpu/regsw.inc +++ /dev/null @@ -1,1682 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 initsfxregsw,reg420Bw,reg420Cw,regptw,initSA1regsw,SDD1Reset -EXTSYM SPC7110Reset,RTCReset2,NextLineCache,vidmemch2,vidmemch4 -EXTSYM vidmemch8,vrama,nmirept,SPCRAM,HIRQCycNext,HIRQNextExe,tableadc -EXTSYM cycpb268,cycpb358,cycpbl,cycpblt,opexec268,opexec268cph,opexec358 -EXTSYM opexec358cph - -%ifndef NO_DEBUGGER -EXTSYM sndwrit,debstop -%endif - -SECTION .text - -NEWSYM initregw - ; Fill register pointer with invalid register accesses - mov edi,[regptw] - add edi,8000h - mov ecx,3000h - mov eax,regINVALIDw -.loopa - mov [edi],eax - add edi,4 - dec ecx - jnz .loopa - ; Set all valid register accesses - setregw 2100h*4,reg2100w - setregw 2101h*4,reg2101w - setregw 2102h*4,reg2102w - setregw 2103h*4,reg2103w - setregw 2104h*4,reg2104w - setregw 2105h*4,reg2105w - setregw 2106h*4,reg2106w - setregw 2107h*4,reg2107w - setregw 2108h*4,reg2108w - setregw 2109h*4,reg2109w - setregw 210Ah*4,reg210Aw - setregw 210Bh*4,reg210Bw - setregw 210Ch*4,reg210Cw - setregw 210Dh*4,reg210Dw - setregw 210Eh*4,reg210Ew - setregw 210Fh*4,reg210Fw - setregw 2110h*4,reg2110w - setregw 2111h*4,reg2111w - setregw 2112h*4,reg2112w - setregw 2113h*4,reg2113w - setregw 2114h*4,reg2114w - setregw 2115h*4,reg2115w - setregw 2116h*4,reg2116w - setregw 2117h*4,reg2117w - setregw 2118h*4,reg2118 - setregw 2119h*4,reg2119inc - setregw 211Ah*4,reg211Aw - setregw 211Bh*4,reg211Bw - setregw 211Ch*4,reg211Cw - setregw 211Dh*4,reg211Dw - setregw 211Eh*4,reg211Ew - setregw 211Fh*4,reg211Fw - setregw 2120h*4,reg2120w - setregw 2121h*4,reg2121w - setregw 2122h*4,reg2122w - setregw 2123h*4,reg2123w - setregw 2124h*4,reg2124w - setregw 2125h*4,reg2125w - setregw 2126h*4,reg2126w - setregw 2127h*4,reg2127w - setregw 2128h*4,reg2128w - setregw 2129h*4,reg2129w - setregw 212Ah*4,reg212Aw - setregw 212Bh*4,reg212Bw - setregw 212Ch*4,reg212Cw - setregw 212Dh*4,reg212Dw - setregw 212Eh*4,reg212Ew - setregw 212Fh*4,reg212Fw - setregw 2130h*4,reg2130w - setregw 2131h*4,reg2131w - setregw 2132h*4,reg2132w - setregw 2133h*4,reg2133w - setregw 2140h*4,reg2140w - setregw 2141h*4,reg2141w - setregw 2142h*4,reg2142w - setregw 2143h*4,reg2143w - setregw 2144h*4,reg2140w - setregw 2145h*4,reg2141w - setregw 2146h*4,reg2142w - setregw 2147h*4,reg2143w - setregw 2148h*4,reg2140w - setregw 2149h*4,reg2141w - setregw 214Ah*4,reg2142w - setregw 214Bh*4,reg2143w - setregw 214Ch*4,reg2140w - setregw 214Dh*4,reg2141w - setregw 214Eh*4,reg2142w - setregw 214Fh*4,reg2143w - setregw 2150h*4,reg2140w - setregw 2151h*4,reg2141w - setregw 2152h*4,reg2142w - setregw 2153h*4,reg2143w - setregw 2154h*4,reg2140w - setregw 2155h*4,reg2141w - setregw 2156h*4,reg2142w - setregw 2157h*4,reg2143w - setregw 2158h*4,reg2140w - setregw 2159h*4,reg2141w - setregw 215Ah*4,reg2142w - setregw 215Bh*4,reg2143w - setregw 215Ch*4,reg2140w - setregw 215Dh*4,reg2141w - setregw 215Eh*4,reg2142w - setregw 215Fh*4,reg2143w - setregw 2160h*4,reg2140w - setregw 2161h*4,reg2141w - setregw 2162h*4,reg2142w - setregw 2163h*4,reg2143w - setregw 2164h*4,reg2140w - setregw 2165h*4,reg2141w - setregw 2166h*4,reg2142w - setregw 2167h*4,reg2143w - setregw 2168h*4,reg2140w - setregw 2169h*4,reg2141w - setregw 216Ah*4,reg2142w - setregw 216Bh*4,reg2143w - setregw 216Ch*4,reg2140w - setregw 216Dh*4,reg2141w - setregw 216Eh*4,reg2142w - setregw 216Fh*4,reg2143w - setregw 2170h*4,reg2140w - setregw 2171h*4,reg2141w - setregw 2172h*4,reg2142w - setregw 2173h*4,reg2143w - setregw 2174h*4,reg2140w - setregw 2175h*4,reg2141w - setregw 2176h*4,reg2142w - setregw 2177h*4,reg2143w - setregw 2178h*4,reg2140w - setregw 2179h*4,reg2141w - setregw 217Ah*4,reg2142w - setregw 217Bh*4,reg2143w - setregw 217Ch*4,reg2140w - setregw 217Dh*4,reg2141w - setregw 217Eh*4,reg2142w - setregw 217Fh*4,reg2143w - setregw 2180h*4,reg2180w - setregw 2181h*4,reg2181w - setregw 2182h*4,reg2182w - setregw 2183h*4,reg2183w - setregw 4016h*4,reg4016w - setregw 4200h*4,reg4200w - setregw 4201h*4,reg4201w - setregw 4202h*4,reg4202w - setregw 4203h*4,reg4203w - setregw 4204h*4,reg4204w - setregw 4205h*4,reg4205w - setregw 4206h*4,reg4206w - setregw 4207h*4,reg4207w - setregw 4208h*4,reg4208w - setregw 4209h*4,reg4209w - setregw 420Ah*4,reg420Aw - setregw 420Bh*4,reg420Bw - setregw 420Ch*4,reg420Cw - setregw 420Dh*4,reg420Dw - setregw 4300h*4,reg43X0w - setregw 4301h*4,reg43X1w - setregw 4302h*4,reg43x2w - setregw 4303h*4,reg43x3w - setregw 4304h*4,reg43x4w - setregw 4305h*4,reg43x5w - setregw 4306h*4,reg43x6w - setregw 4307h*4,reg43x7w - setregw 4308h*4,reg43x8w - setregw 4309h*4,reg43x9w - setregw 430Ah*4,reg43XAw - setregw 430Bh*4,reg43XBw - setregw 430Fh*4,reg43XBw - setregw 4310h*4,reg43X0w - setregw 4311h*4,reg43X1w - setregw 4312h*4,reg43x2w - setregw 4313h*4,reg43x3w - setregw 4314h*4,reg43x4w - setregw 4315h*4,reg43x5w - setregw 4316h*4,reg43x6w - setregw 4317h*4,reg43x7w - setregw 4318h*4,reg43x8w - setregw 4319h*4,reg43x9w - setregw 431Ah*4,reg43XAw - setregw 431Bh*4,reg43XBw - setregw 431Fh*4,reg43XBw - setregw 4320h*4,reg43X0w - setregw 4321h*4,reg43X1w - setregw 4322h*4,reg43x2w - setregw 4323h*4,reg43x3w - setregw 4324h*4,reg43x4w - setregw 4325h*4,reg43x5w - setregw 4326h*4,reg43x6w - setregw 4327h*4,reg43x7w - setregw 4328h*4,reg43x8w - setregw 4329h*4,reg43x9w - setregw 432Ah*4,reg43XAw - setregw 432Bh*4,reg43XBw - setregw 432Fh*4,reg43XBw - setregw 4330h*4,reg43X0w - setregw 4331h*4,reg43X1w - setregw 4332h*4,reg43x2w - setregw 4333h*4,reg43x3w - setregw 4334h*4,reg43x4w - setregw 4335h*4,reg43x5w - setregw 4336h*4,reg43x6w - setregw 4337h*4,reg43x7w - setregw 4338h*4,reg43x8w - setregw 4339h*4,reg43x9w - setregw 433Ah*4,reg43XAw - setregw 433Bh*4,reg43XBw - setregw 433Fh*4,reg43XBw - setregw 4340h*4,reg43X0w - setregw 4341h*4,reg43X1w - setregw 4342h*4,reg43x2w - setregw 4343h*4,reg43x3w - setregw 4344h*4,reg43x4w - setregw 4345h*4,reg43x5w - setregw 4346h*4,reg43x6w - setregw 4347h*4,reg43x7w - setregw 4348h*4,reg43x8w - setregw 4349h*4,reg43x9w - setregw 434Ah*4,reg43XAw - setregw 434Bh*4,reg43XBw - setregw 434Fh*4,reg43XBw - setregw 4350h*4,reg43X0w - setregw 4351h*4,reg43X1w - setregw 4352h*4,reg43x2w - setregw 4353h*4,reg43x3w - setregw 4354h*4,reg43x4w - setregw 4355h*4,reg43x5w - setregw 4356h*4,reg43x6w - setregw 4357h*4,reg43x7w - setregw 4358h*4,reg43x8w - setregw 4359h*4,reg43x9w - setregw 435Ah*4,reg43XAw - setregw 435Bh*4,reg43XBw - setregw 435Fh*4,reg43XBw - setregw 4360h*4,reg43X0w - setregw 4361h*4,reg43X1w - setregw 4362h*4,reg43x2w - setregw 4363h*4,reg43x3w - setregw 4364h*4,reg43x4w - setregw 4365h*4,reg43x5w - setregw 4366h*4,reg43x6w - setregw 4367h*4,reg43x7w - setregw 4368h*4,reg43x8w - setregw 4369h*4,reg43x9w - setregw 436Ah*4,reg43XAw - setregw 436Bh*4,reg43XBw - setregw 436Fh*4,reg43XBw - setregw 4370h*4,reg43X0w - setregw 4371h*4,reg43X1w - setregw 4372h*4,reg43x2w - setregw 4373h*4,reg43x3w - setregw 4374h*4,reg43x4w - setregw 4375h*4,reg43x5w - setregw 4376h*4,reg43x6w - setregw 4377h*4,reg43x7w - setregw 4378h*4,reg43x8w - setregw 4379h*4,reg43x9w - setregw 437Ah*4,reg43XAw - setregw 437Bh*4,reg43XBw - setregw 437Fh*4,reg43XBw - cmp byte[SFXEnable],0 - je .nosfx - call initsfxregsw -.nosfx - cmp byte[SA1Enable],0 - je .nosa1 - call initSA1regsw -.nosa1 - cmp byte[SDD1Enable],0 - je .nosdd1 - call SDD1Reset -.nosdd1 - cmp byte[SPC7110Enable],0 - je .nospc7110 - call SPC7110Reset -.nospc7110 - cmp byte[RTCEnable],0 - je .nortc - call RTCReset2 -.nortc - ret - -; video memory change buffer for caching (65536/16=4096) -;vidmemch2, vidmemch4, vidmemch8. 4096 bytes each - -;******************************************************* -; Registers Note : restore AH, ECX, ESI, EDI, *S & DX -;******************************************************* - - -; Screen display register -reg2100w: - mov [vidbright],al - and byte[vidbright],0Fh - mov [forceblnk],al - and byte[forceblnk],80h - ret - -SECTION .bss -NEWSYM prevoamptr, resb 1 -SECTION .text - -; OAM size register -reg2101w: - cmp byte[prevoamptr],0FFh - je .noskip - cmp byte[prevoamptr],al - je near .noproc -.noskip - mov [prevoamptr],al - xor ebx,ebx - mov bl,al - and bl,03h - shl bx,14 - mov [objptr],bx - mov [objptrn],bx - xor ebx,ebx - mov bl,al - and bl,18h - shr bl,3 - shl bx,13 - add [objptrn],bx - xor ebx,ebx - mov bl,al - shr bl,5 - push eax - mov byte[NextLineCache],1 - mov al,[.objsize1+ebx] - mov [objsize1],al - mov al,[.objsize2+ebx] - mov [objsize2],al - mov al,[.objmovs1+ebx] - mov [objmovs1],al - mov al,[.objmovs2+ebx] - mov [objmovs2],al - mov ax,[.objadds1+ebx*2] - mov [objadds1],ax - mov ax,[.objadds2+ebx*2] - mov [objadds2],ax - pop eax -.noproc - ret - -SECTION .data -.objsize1 db 1,1,1,4,4,16,1,1 -.objsize2 db 4,16,64,16,64,64,4,4 -.objmovs1 db 2,2,2,2,2,4,2,2 -.objmovs2 db 2,4,8,4,8,8,2,2 -.objadds1 dw 14,14,14,14,14,12,14,14 -.objadds2 dw 14,12,8,12,8,8,14,14 - -SECTION .bss -NEWSYM oamlow, resb 1 -SECTION .text - -; OAM address register -reg2102w: - mov byte[oamlow],1 - mov word[oamaddr],0 - shr word[oamaddr],1 - mov [oamaddr],al - shl word[oamaddr],1 -; or al,al -; jz .skipstore - mov bx,[oamaddrs] - mov [poamaddrs],bx - mov bx,[oamaddr] - mov [oamaddrs],bx -.skipstore - cmp byte[nexthprior],1 - je .priorset - mov byte[objhipr],0 - jmp .cachespr -.priorset - mov bx,[oamaddr] - shr bx,2 - and bl,0x7F -; cmp bl,80h -; jae .noreset -; xor bl,bl -.noreset - mov [objhipr],bl -.cachespr - ret - -; OAM address register -reg2103w: - cmp byte[oamlow],1 - jne .afteroamlow - mov byte[oamlow],0 - mov bl,al - and bl,01h - shr word[oamaddr],1 - mov [oamaddr+1],bl - shl word[oamaddr],1 -.afteroamlow - cmp word[poamaddrs],200h - jbe .notinvptr - cmp word[oamaddr],200h - jne .notinvptr - mov bx,[poamaddrs] - mov [oamaddr],bx - mov byte[nosprincr],1 -.notinvptr - mov bx,[oamaddr] - mov [oamaddrs],bx - test al,80h - jnz .hipri - test bl,0FFh - jz .lowpri - mov byte[nexthprior],0 -.lowpri - mov byte[NextLineCache],1 - ret -.hipri - mov byte[nexthprior],1 - mov byte[NextLineCache],1 - ret - -; OAM data register -reg2104w: - mov byte[NextLineCache],1 - mov ebx,[oamaddr] - cmp byte[nosprincr],1 - je .noinc - inc dword[oamaddr] - cmp ebx,544 - jae .overflow -.noinc - mov [oamram+ebx],al - ret -.overflow - xor ebx,ebx - mov dword[oamaddr],1 - mov [oamram+ebx],al - ret - -; Screen mode register -reg2105w: - mov bl,al - and bl,00000111b - mov [bgmode],bl - mov bl,al - shr bl,3 - and bl,01h - mov [bg3highst],bl - mov bl,al - shr bl,4 - mov [bgtilesz],bl - mov bl,al - mov dword[BG116x16t],0 - add bl,bl - adc byte[BG416x16t],0 - add bl,bl - adc byte[BG316x16t],0 - add bl,bl - adc byte[BG216x16t],0 - add bl,bl - adc byte[BG116x16t],0 - ret - -; Screen pixelation register -reg2106w: - mov bl,al - and bl,0Fh - mov [mosaicon],bl - mov bl,al - shr bl,4 - mov [mosaicsz],bl - ret - -; BG1 VRAM location register -reg2107w: - xor ebx,ebx - mov bl,al - shr bl,2 - shl bx,11 - mov [bg1ptr],bx - mov [bg1ptrb],bx - mov [bg1ptrc],bx - mov [bg1ptrd],bx - mov dword[bg1ptrx],0 - mov dword[bg1ptry],0 - mov bl,al - and bl,00000011b - mov [bg1scsize],bl - cmp bl,1 - jne .skipa - add word[bg1ptrb],800h - add word[bg1ptrd],800h - mov dword[bg1ptrx],800h -.skipa - cmp bl,2 - jne .skipb - add word[bg1ptrc],800h - add word[bg1ptrd],800h - mov dword[bg1ptry],800h -.skipb - cmp bl,3 - jne .skipc - add word[bg1ptrb],800h - add word[bg1ptrc],1000h - add word[bg1ptrd],1800h - mov dword[bg1ptrx],800h - mov dword[bg1ptry],1000h -.skipc - ret - -; BG2 VRAM location register -reg2108w: - xor ebx,ebx - mov bl,al - shr bl,2 - shl bx,11 - mov [bg2ptr],bx - mov [bg2ptrb],bx - mov [bg2ptrc],bx - mov [bg2ptrd],bx - mov dword[bg2ptrx],0 - mov dword[bg2ptry],0 - mov bl,al - and bl,00000011b - mov [bg2scsize],bl - cmp bl,1 - jne .skipa - add word[bg2ptrb],800h - add word[bg2ptrd],800h - mov dword[bg2ptrx],800h -.skipa - cmp bl,2 - jne .skipb - add word[bg2ptrc],800h - add word[bg2ptrd],800h - mov dword[bg2ptry],800h -.skipb - cmp bl,3 - jne .skipc - add word[bg2ptrb],800h - add word[bg2ptrc],1000h - add word[bg2ptrd],1800h - mov dword[bg2ptrx],800h - mov dword[bg2ptry],1000h -.skipc - ret - -; BG3 VRAM location register -reg2109w: - xor ebx,ebx - mov bl,al - shr bl,2 - shl bx,11 - mov [bg3ptr],bx - mov [bg3ptrb],bx - mov [bg3ptrc],bx - mov [bg3ptrd],bx - mov dword[bg3ptrx],0 - mov dword[bg3ptry],0 - mov bl,al - and bl,00000011b - mov [bg3scsize],bl - cmp bl,1 - jne .skipa - add word[bg3ptrb],800h - add word[bg3ptrd],800h - mov dword[bg3ptrx],800h -.skipa - cmp bl,2 - jne .skipb - add word[bg3ptrc],800h - add word[bg3ptrd],800h - mov dword[bg3ptry],800h -.skipb - cmp bl,3 - jne .skipc - add word[bg3ptrb],800h - add word[bg3ptrc],1000h - add word[bg3ptrd],1800h - mov dword[bg3ptrx],800h - mov dword[bg3ptry],1000h -.skipc - ret - -; BG4 VRAM location register -reg210Aw: - xor ebx,ebx - mov bl,al - shr bl,2 - shl bx,11 - mov [bg4ptr],bx - mov [bg4ptrb],bx - mov [bg4ptrc],bx - mov [bg4ptrd],bx - mov dword[bg4ptrx],0 - mov dword[bg4ptry],0 - mov bl,al - and bl,00000011b - mov [bg4scsize],bl - cmp bl,1 - jne .skipa - add word[bg4ptrb],800h - add word[bg4ptrd],800h - mov dword[bg4ptrx],800h -.skipa - cmp bl,2 - jne .skipb - add word[bg4ptrc],800h - add word[bg4ptrd],800h - mov dword[bg4ptry],800h -.skipb - cmp bl,3 - jne .skipc - add word[bg4ptrb],800h - add word[bg4ptrc],1000h - add word[bg4ptrd],1800h - mov dword[bg4ptrx],800h - mov dword[bg4ptry],1000h -.skipc - ret - -; BG1 & BG2 VRAM location register -reg210Bw: - xor ebx,ebx - mov bl,al - and bl,0Fh - shl bx,13 - mov [bg1objptr],bx - mov bl,al - shr bl,4 - shl bx,13 - mov [bg2objptr],bx - ret - -; BG3 & BG4 VRAM location register -reg210Cw: - xor ebx,ebx - mov bl,al - and bl,0Fh - shl bx,13 - mov [bg3objptr],bx - mov bl,al - shr bl,4 - shl bx,13 - mov [bg4objptr],bx - ret - -section .data -NEWSYM bgscrolPrev, db 0 -NEWSYM bg1scrolx_m7, dw 0 -NEWSYM bg1scroly_m7, dw 0 - -section .text -%macro UpdateScrollRegX 1 - mov bh,al - mov bl,[bgscrolPrev] - mov [bgscrolPrev],al - shl ebx,13 - mov bh,[%1+1] - shl bh,5 - shr ebx,13 - mov [%1],bx -%endmacro - -%macro UpdateScrollRegY 1 - mov bl,[bgscrolPrev] - mov bh,al - mov [%1],bx - mov [bgscrolPrev],al -%endmacro - -; BG1 horizontal scroll register -reg210Dw: - UpdateScrollRegX bg1scrolx -; mov bl,[m7byte] - mov [bg1scrolx_m7],bx -; mov [m7byte],al - ret - -; BG1 vertical scroll register -reg210Ew: - UpdateScrollRegY bg1scroly -; mov bl,[m7byte] - mov [bg1scroly_m7],bx -; mov [m7byte],al - ret - -; BG2 horizontal scroll register -reg210Fw: - UpdateScrollRegX bg2scrolx - ret - -; BG2 vertical scroll register -reg2110w: - UpdateScrollRegY bg2scroly - ret - -; BG3 horizontal scroll register -reg2111w: - UpdateScrollRegX bg3scrolx - ret - -; BG3 vertical scroll register -reg2112w: - UpdateScrollRegY bg3scroly - ret - -; BG4 horizontal scroll register -reg2113w: - UpdateScrollRegX bg4scrolx - ret - -; BG4 vertical scroll register -reg2114w: - UpdateScrollRegY bg4scroly - ret - -; Video port control -reg2115w: - and al,11111111b - mov [vraminctype],al - mov bl,al - and bl,00000011b - cmp bl,0 - jne .skip1 - mov word[addrincr],2 -.skip1 - cmp bl,1 - jne .skip2 - mov word[addrincr],64 -.skip2 - cmp bl,2 - jne .skip3 - mov word[addrincr],256 -.skip3 - cmp bl,3 - jne .skip4 - mov word[addrincr],256 -.skip4 - mov bl,al - mov byte[vramincby8on],0 - and bl,00001100b - jz near .noincby8 - mov byte[vramincby8on],1 - cmp bl,4 - jne .nextinc8 - mov byte[vramincby8left],64-1 - mov byte[vramincby8totl],5 - mov word[vramincby8ptri],65535-511 - mov word[vramincby8var],256+128+64 -.nextinc8 - cmp bl,8 - jne .nextinc8b - mov byte[vramincby8left],128-1 - mov byte[vramincby8totl],6 - mov word[vramincby8ptri],65535-1023 - mov word[vramincby8var],512+256+128 -.nextinc8b - cmp bl,12 - jne .nextinc8c - mov byte[vramincby8left],256-1 - mov byte[vramincby8totl],7 - mov word[vramincby8ptri],65535-2047 - mov word[vramincby8var],1024+512+256 -.nextinc8c - mov ebx,[regptw] - test al,80h - jz .from2118 - mov dword[ebx+2118h*4],reg2118inc8 - mov dword[ebx+2119h*4],reg2119inc8inc - mov byte[vramincr],0 - jmp .from2119 -.from2118 - mov dword[ebx+2118h*4],reg2118inc8inc - mov dword[ebx+2119h*4],reg2119inc8 - mov byte[vramincr],1 -.from2119 - ret -.noincby8 - mov ebx,[regptw] - test al,80h - jz .from2118b - mov dword[ebx+2118h*4],reg2118 - mov dword[ebx+2119h*4],reg2119inc - mov byte[vramincr],0 - jmp .from2119b -.from2118b - mov dword[ebx+2118h*4],reg2118inc - mov dword[ebx+2119h*4],reg2119 - mov byte[vramincr],1 -.from2119b - ret - -; Video port address (Low) -reg2116w: - shr word[vramaddr],1 - mov [vramaddr],al - shl word[vramaddr],1 - mov byte[vramread],0 - ret - -; Video port address (High) -reg2117w: - shr word[vramaddr],1 - mov [vramaddr+1],al - shl word[vramaddr],1 - mov byte[vramread],0 - - movzx ebx,word[vramaddr] - add ebx,[vram] - mov bl,[ebx] - mov [vramread],bl - movzx ebx,word[vramaddr] - add ebx,[vram] - mov bl,[ebx+1] - mov [vramread2],bl - ret - -; Video port data (Low) -NEWSYM reg2118 - mov ebx,[vramaddr] - mov [vrama+ebx],al - shr ebx,4 - mov byte[vidmemch2+ebx],1 - mov byte[vidmemch4+ebx],1 - mov byte[vidmemch8+ebx],1 - ret - -NEWSYM reg2118inc - mov ebx,[vramaddr] - mov [vrama+ebx],al - shr ebx,4 - mov byte[vidmemch2+ebx],1 - mov byte[vidmemch4+ebx],1 - mov byte[vidmemch8+ebx],1 - mov ebx,[addrincr] - add [vramaddr],bx - ret - -NEWSYM reg2118inc8 - push ecx - mov ebx,[vramaddr] - movzx ecx,byte[vramincby8left] - and ebx,ecx - shl ebx,3 - push eax - mov eax,[vramaddr] - and ax,[vramincby8var] - mov cl,[vramincby8totl] - shr eax,cl - add ebx,eax - mov eax,[vramaddr] - and ax,[vramincby8ptri] - add ebx,eax - pop eax - pop ecx - add ebx,[vram] -; cmp [ebx],al -; je .nochange2 - mov [ebx],al - sub ebx,[vram] - shr ebx,4 - mov byte[vidmemch2+ebx],1 - mov byte[vidmemch4+ebx],1 - mov byte[vidmemch8+ebx],1 -.nochange2 - ret - -NEWSYM reg2118inc8inc - push ecx - mov ebx,[vramaddr] - movzx ecx,byte[vramincby8left] - and ebx,ecx - shl ebx,3 - push eax - mov eax,[vramaddr] - and ax,[vramincby8var] - mov cl,[vramincby8totl] - shr eax,cl - add ebx,eax - mov eax,[vramaddr] - and ax,[vramincby8ptri] - add ebx,eax - pop eax - pop ecx - add ebx,[vram] -; cmp [ebx],al -; je .nochange2 - mov [ebx],al - sub ebx,[vram] - shr ebx,4 - mov byte[vidmemch2+ebx],1 - mov byte[vidmemch4+ebx],1 - mov byte[vidmemch8+ebx],1 -.nochange2 - mov ebx,[addrincr] - add [vramaddr],bx - ret - -NEWSYM reg2119 - cmp dword[vramaddr],0E000h - jb .skip -%ifndef NO_DEBUGGER - mov byte[debstop],1 -%endif -.skip - mov ebx,[vramaddr] -; cmp [vrama+ebx+1],al -; je .nochange - mov [vrama+ebx+1],al - shr ebx,4 - mov byte[vidmemch2+ebx],1 - mov byte[vidmemch4+ebx],1 - mov byte[vidmemch8+ebx],1 -.nochange - ret - -NEWSYM reg2119inc - mov ebx,[vramaddr] -; cmp [vrama+ebx+1],al -; je .nochange - mov [vrama+ebx+1],al - shr ebx,4 - mov byte[vidmemch2+ebx],1 - mov byte[vidmemch4+ebx],1 - mov byte[vidmemch8+ebx],1 -.nochange - mov ebx,[addrincr] - add [vramaddr],bx - ret - -NEWSYM reg2119inc8 - push ecx - mov ebx,[vramaddr] - movzx ecx,byte[vramincby8left] - and ebx,ecx - shl ebx,3 - push eax - mov eax,[vramaddr] - and ax,[vramincby8var] - mov cl,[vramincby8totl] - shr eax,cl - add ebx,eax - mov eax,[vramaddr] - and ax,[vramincby8ptri] - add ebx,eax - pop eax - pop ecx -; cmp [vrama+ebx+1],al -; je .nochange2 - mov [vrama+ebx+1],al - shr ebx,4 - mov byte[vidmemch2+ebx],1 - mov byte[vidmemch4+ebx],1 - mov byte[vidmemch8+ebx],1 -.nochange2 - ret - -NEWSYM reg2119inc8inc - push ecx - mov ebx,[vramaddr] - movzx ecx,byte[vramincby8left] - and ebx,ecx - shl ebx,3 - push eax - mov eax,[vramaddr] - and ax,[vramincby8var] - mov cl,[vramincby8totl] - shr eax,cl - add ebx,eax - mov eax,[vramaddr] - and ax,[vramincby8ptri] - add ebx,eax - pop eax - pop ecx -; cmp [vrama+ebx+1],al -; je .nochange2 - mov [vrama+ebx+1],al - shr ebx,4 - mov byte[vidmemch2+ebx],1 - mov byte[vidmemch4+ebx],1 - mov byte[vidmemch8+ebx],1 -.nochange2 - mov ebx,[addrincr] - add [vramaddr],bx - ret - -; MODE7 settings register -reg211Aw: - mov [mode7set],al - ret - -SECTION .data -NEWSYM multchange, db 1 -NEWSYM m7byte, db 0 -SECTION .text - -%macro Mode7Regs 1 - mov bl,[%1+1] - ;mov bl,[m7byte] - mov [%1],bl - mov [%1+1],al - ;mov [m7byte],al -%endmacro - -; COS (COSINE) rotate angle / X Expansion -reg211Bw: - Mode7Regs mode7A - mov byte[multchange],1 - ret - -; SIN (SIN) rotate angle / X Expansion & Complement Multiplication Start -reg211Cw: - Mode7Regs mode7B - mov byte[multchange],1 - ret - -; SIN (SIN) rotate angle / Y Expansion -reg211Dw: - Mode7Regs mode7C - ret - -; COS (COSINE) rotate angle / Y Expansion -reg211Ew: - Mode7Regs mode7D - ret - -; Center position X (13-bit data only) -reg211Fw: - Mode7Regs mode7X0 - ret - -; Center position Y (13-bit data only) -reg2120w: - Mode7Regs mode7Y0 - ret - -; Colour # (or palette) selection register -reg2121w: - xor bh,bh - mov bl,al - shl bx,1 - mov [cgaddr],bx - and word[cgaddr],01FFh - ret - -; Colour data register -reg2122w: - movzx ebx,word[cgaddr] - cmp [cgram+ebx],al - je .nomod - mov [cgram+ebx],al - mov byte[cgmod],1 -.nomod - inc word[cgaddr] - and word[cgaddr],01FFh - ret - -; Window mask settings register [W12SEL] -reg2123w: - mov bl,al - and bl,0Fh - test bl,0Ah - jnz .nen1 -; or bl,02h -.nen1 - mov [winbg1en],bl - mov bl,al - shr bl,4 - test bl,0Ah - jnz .nen2 -; or bl,02h -.nen2 - mov [winbg2en],bl - ret - -; Window mask settings register [W34SEL] -reg2124w: - mov bl,al - and bl,0Fh - test bl,0Ah - jnz .nen1 -; or bl,02h -.nen1 - mov [winbg3en],bl - mov bl,al - shr bl,4 - test bl,0Ah - jnz .nen2 -; or bl,02h -.nen2 - mov [winbg4en],bl - ret - -; Window mask settings register [WOBJSEL] -reg2125w: - mov bl,al - and bl,0Fh - mov [winobjen],bl - mov bl,al - shr bl,4 - mov [wincolen],bl - ret - -; Window 1 left position register -reg2126w: - mov [winl1],al - ret - -; Window 1 right position register -reg2127w: - mov [winr1],al - ret - -; Window 2 left position register -reg2128w: - mov [winl2],al - ret - -; Window 2 right position register -reg2129w: - mov [winr2],al - ret - -; Mask logic settings for Window 1 & 2 per screen -reg212Aw: - mov [winlogica],al - ret - -; Mask logic settings for Colour Windows & OBJ Windows -reg212Bw: - mov [winlogicb],al - ret - -; Main screen designation -reg212Cw: - mov [scrnon],al - ret - -; Sub-screen designation -reg212Dw: - mov [scrnon+1],al - ret - -; Window mask main screen designation register -reg212Ew: - mov [winenabm],al - ret - -; Window mask sub screen designation register -reg212Fw: - mov [winenabs],al - ret - -; Fixed color addition or screen addition register -reg2130w: - mov [scaddset],al - ret - -; Addition/subtraction for screens, BGs, & OBJs -reg2131w: - mov [scaddtype],al - ret - -; Fixed colour data for fixed colour +/- -reg2132w: - mov bl,al - and bl,1Fh - test al,20h - jz .nored - mov [coladdr],bl -.nored - test al,40h - jz .nogreen - mov [coladdg],bl -.nogreen - test al,80h - jz .noblue - mov [coladdb],bl -.noblue - ret - -; Screen mode/video select register -reg2133w: - mov [interlval],al - and byte[interlval],41h - test al,04h - jnz .line239 - mov word[resolutn],224 - ret -.line239 - mov word[resolutn],239 - ret - -; Sound Register #1 -reg2140w: -%ifndef NO_DEBUGGER - mov byte[sndwrit],1 -%endif - cmp byte[nmistatus],2 - jne .n - mov byte[nmirept],0 -.n - mov [SPCRAM+0F4h],al - inc dword[SPC700write] - reenablespc - ret -; cmp dword[cycpbl],0FFFFh -; ja .spcreset -; ret -;.spcreset -; mov dword[cycpbl],100 -; ret - -; Sound Register #2 -reg2141w: -%ifndef NO_DEBUGGER - mov byte[sndwrit],1 -%endif - mov [SPCRAM+0F5h],al - inc dword[SPC700write] - reenablespc - ret -; cmp dword[cycpbl],0FFFFh -; ja .spcreset -; ret -;.spcreset -; mov dword[cycpbl],100 -; ret - -; Sound Register #3 -reg2142w: -%ifndef NO_DEBUGGER - mov byte[sndwrit],1 -%endif - mov [SPCRAM+0F6h],al - inc dword[SPC700write] - reenablespc - ret -; cmp dword[cycpbl],0FFFFh -; ja .spcreset -; ret -;.spcreset -; mov dword[cycpbl],100 -; ret - -; Sound Register #4 -reg2143w: -%ifndef NO_DEBUGGER - mov byte[sndwrit],1 -%endif - mov [SPCRAM+0F7h],al - inc dword[SPC700write] - reenablespc - ret -; cmp dword[cycpbl],0FFFFh -; ja .spcreset -; ret -;.spcreset -; mov dword[cycpbl],100 -; ret - -; Read/write WRAM register -reg2180w: - mov ebx,[wramrwadr] - add ebx,[wramdata] - mov [ebx],al - inc dword[wramrwadr] - and dword[wramrwadr],01FFFFh - ret - -; WRAM data register (low byte) -reg2181w: - mov [wramrwadr],al - ret - -; WRAM data register (middle byte) -reg2182w: - mov [wramrwadr+1],al - ret - -; WRAM data register (high byte) -reg2183w: - mov bl,al - and bl,01h - mov [wramrwadr+2],bl - ret - -; Joystick 1 & 2 status bytes -SECTION .bss -NEWSYM MultiTapStat, resb 1 -SECTION .text - -reg4016w: - test byte[INTEnab],1 - jnz .nointenab - mov ebx,[JoyAOrig] - or ebx,0FFFFh - mov [JoyANow],ebx - mov ebx,[JoyBOrig] - or ebx,0FFFFh - mov [JoyBNow],ebx - mov ebx,[JoyCOrig] - or ebx,0FFFFh - mov [JoyCNow],ebx - mov ebx,[JoyDOrig] - or ebx,0FFFFh - mov [JoyDNow],ebx - mov ebx,[JoyEOrig] - or ebx,0FFFFh - mov [JoyENow],ebx - cmp al,01h - jne .noreset - or byte[MultiTapStat],1 - ret -.noreset - and byte[MultiTapStat],0FEh - ret -.nointenab - cmp al,01h - jne .noone - or byte[MultiTapStat],1 - or byte[JoyCRead],2 - ret -.noone - and byte[MultiTapStat],0FEh - cmp al,0 - jne near .nozero - or byte[JoyCRead],1 - cmp byte[JoyCRead],3 - jne near .nozero -.resetports - mov ebx,[JoyAOrig] - or ebx,0FFFFh - mov [JoyANow],ebx - or ebx,0FFFFh - mov ebx,[JoyBOrig] - or ebx,0FFFFh - mov [JoyBNow],ebx - or ebx,0FFFFh - mov ebx,[JoyCOrig] - or ebx,0FFFFh - mov [JoyCNow],ebx - or ebx,0FFFFh - mov ebx,[JoyDOrig] - or ebx,0FFFFh - mov [JoyDNow],ebx - or ebx,0FFFFh - mov ebx,[JoyEOrig] - or ebx,0FFFFh - mov [JoyENow],ebx -.nozero - ret - -; Counter enable -reg4200w: - mov [INTEnab],al - ret - -; Programmable I/O port (out-port) -reg4201w: - cmp byte[iohvlatch],1 - jne .noiohvlatch - test al,80h - jnz .noiohvlatch - mov byte[iohvlatch],0 -.noiohvlatch - test byte[ioportval],80h - jnz .nolatch - test al,80h - jz .nolatch - mov byte[iohvlatch],1 -.nolatch - mov [ioportval],al - mov bl,al - and bl,80h - and byte[MultiTapStat],07Fh - or byte[MultiTapStat],bl - ret - -; Multiplicand 'A' -reg4202w: - mov [multa],al - ret - -; Multiplier 'B' -reg4203w: - push edx - push eax - xor ah,ah - xor bh,bh - mov bl,[multa] - mul bx - mov [multres],ax - pop eax - pop edx - ret - -; Dividend C (Low) -reg4204w: - mov [diva],al - ret - -; Dividend C (High) -reg4205w: - mov [diva+1],al - ret - -; Divisor B -reg4206w: - cmp al,0 - je .divby0 - push eax - push edx - xor edx,edx - movzx ebx,al - mov ax,[diva] - div bx - mov [divres],ax - mov [multres],dx - pop edx - pop eax - ret -.divby0 - push eax - mov word[divres],0FFFFh - mov ax,[diva] - mov [multres],ax - pop eax - ret - - -DetermineHIRQExec - add dh,[HIRQCycNext] - mov byte[HIRQCycNext],0 - mov byte[HIRQNextExe],0 - push eax - push ecx - push edx - mov ax,[HIRQLoc] - movzx ecx,byte[cycpl] - mul cx - mov cx,340 - div cx - mov cl,[cycpl] - sub cl,al - pop edx - cmp dh,cl - ja .hirqokay -.notokay - pop ecx - pop eax - ret -.hirqokay - sub dh,cl - add dh,30 - add cl,16 - mov [HIRQCycNext],cl - mov byte[HIRQNextExe],1 - pop ecx - pop eax - ret - -; Video horizontal IRQ beam position/pointer (Low) -reg4207w: - cmp [HIRQLoc],al - je .nohirqc - mov [HIRQLoc],al - mov bx,[curypos] - cmp bx,[VIRQLoc] - je near DetermineHIRQExec -.nohirqc - ret - -; Video horizontal IRQ beam position/pointer (High) -reg4208w: - cmp [HIRQLoc+1],al - je .nohirqc - mov [HIRQLoc+1],al - mov bx,[curypos] - cmp bx,[VIRQLoc] - je near DetermineHIRQExec -.nohirqc - ret - -; Video vertical IRQ beam position/pointer (Low) -reg4209w: - mov [VIRQLoc],al -; mov bx,[curypos] - cmp byte[HIRQNextExe],1 - je .nohirq - ret -.nohirq - mov bx,[curypos] - cmp bx,[VIRQLoc] - je .nocancelhirq - add dh,[HIRQCycNext] - mov byte[HIRQCycNext],0 - mov byte[HIRQNextExe],0 -.nocancelhirq - ret - -; Video vertical IRQ beam position/pointer (High) -reg420Aw: - and al,01h - mov [VIRQLoc+1],al - mov bx,[totlines] - sub bx,1 - cmp word[VIRQLoc],bx - jb .okvirqpos - mov word[VIRQLoc],07FFFh -.okvirqpos - cmp byte[HIRQNextExe],1 - je .nohirq - ret -.nohirq - mov bx,[curypos] - cmp bx,[VIRQLoc] - je .nocancelhirq - add dh,[HIRQCycNext] - mov byte[HIRQCycNext],0 - mov byte[HIRQNextExe],0 -.nocancelhirq - ret - -; Cycle speed register -reg420Dw: - test al,01h - jnz .speed358 - ; 2.68 Mhz - mov al,[opexec268] - mov [cycpl],al ; 2.68 Mhz - mov al,[opexec268cph] - mov [cycphb],al ; 2.68 Mhz - and byte[xirqb],00h - mov bl,[cycpb268] - mov [cycpblt],bl ; percentage of CPU/SPC to run - ret -.speed358 - ; 3.58 Mhz - mov al,[opexec358] - mov [cycpl],al ; 3.58 Mhz - mov al,[opexec358cph] - mov [cycphb],al ; 3.58 Mhz - or byte[xirqb],80h - mov bl,[cycpb358] - mov [cycpblt],bl ; percentage of CPU/SPC to run - ret - -; DMA Control register -reg43X0w: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - mov byte[hdmarestart],1 - ret - -; DMA Destination register -reg43X1w: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - mov byte[hdmarestart],1 - ret - -; Source address (Low) -reg43x2w: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al -; mov [dmadata+ebx+6],al - ret - -; Source address (High) -reg43x3w: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al -; mov [dmadata+ebx+6],al - ret - -; Source bank address -reg43x4w - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - ret - -; DMA transfer size & HDMA address register (Low) -reg43x5w: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - ret - -; DMA transfer size & HDMA address register (High) -reg43x6w: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - ret - -; DMA transfer size & HDMA address register (Bank) -reg43x7w: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - ret - -; Table Address of A-BUS by DMA < A2 Table Address (Low) -reg43x8w: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - ret - -; Table Address of A-BUS by DMA < A2 Table Address (High) -reg43x9w: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - ret - -; Number of lines for HDMA transfer -reg43XAw: - mov byte[nohdmaframe],0 - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - mov bx,[resolutn] - cmp word[curypos],bx - jb .nodma - cmp al,0 - je .nodma - mov byte[nohdmaframe],1 - inc byte[hdmadelay] -.nodma - ret - -; Unknown DMA byte -reg43XBw: - xor ebx,ebx - mov bx,cx - sub bx,4300h - mov [dmadata+ebx],al - ret - -regINVALIDw: ; Invalid Register - ret diff --git a/tools/zsnes/src/cpu/regsw.mac b/tools/zsnes/src/cpu/regsw.mac deleted file mode 100644 index 973803b..0000000 --- a/tools/zsnes/src/cpu/regsw.mac +++ /dev/null @@ -1,46 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -;******************************************************* -; 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 diff --git a/tools/zsnes/src/cpu/s65816d.inc b/tools/zsnes/src/cpu/s65816d.inc deleted file mode 100644 index dbe935c..0000000 --- a/tools/zsnes/src/cpu/s65816d.inc +++ /dev/null @@ -1,1574 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 Sflagnz,Sflago,Sflagc,dmadata,IRAM -%ifndef NO_DEBUGGER -EXTSYM debuggeron -%endif - -;******************************************************* -; Flag Setting Macros -;******************************************************* - -%macro endloop 0 -; call sa1debug - mov bl,[esi] - inc esi - sub dh,[cpucycle+ebx] - jc %%cpuover - jmp dword near [edi+ebx*4] -%%cpuover - ret -%endmacro - -%macro restoredl 0 - mov dword[Sflagnz],0 - test dl,80h - jz %%noneg - or dword[Sflagnz],10000h -%%noneg - test dl,2h - jnz %%zero - or dword[Sflagnz],1 -%%zero - mov dword[Sflagc],0 - test dl,01h - jz %%nocarry - mov dword[Sflagc],0FFh -%%nocarry - mov dword[Sflago],0 - test dl,40h - jz %%nov - mov dword[Sflago],0FFh -%%nov -%endmacro - -%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 - -SECTION .text - -NEWSYM Ssplitflags - restoredl - ret - -NEWSYM Sjoinflags - makedl - ret - -; Sets flags n and z according to al -%macro flagsetnz8b 0 - mov dword[Sflagnz],0 - mov [Sflagnz+1],al - endloop -%endmacro - -; Sets flags n and z according to ax -%macro flagsetnz16b 0 - mov cx,ax - mov [Sflagnz],ecx - endloop -%endmacro - -; Sets flags n and z according to al -%macro flagsetnz8bnel 0 - mov dword[Sflagnz],0 - mov [Sflagnz+1],al -%endmacro - -; Sets flags n and z according to ax -%macro flagsetnz16bnel 0 - mov cx,ax - mov [Sflagnz],ecx -%endmacro - -; Sets flags N V . . . . Z C according to flags -%macro flagsetnvzc8b 0 - mov dword[Sflagnz],0 - mov al,[SA1xa] - seto byte[Sflago] - mov [Sflagnz+1],al - jc .carry - mov dword[Sflagc],0h - endloop -.carry - mov dword[Sflagc],0FFh - endloop -%endmacro - -%macro flagsetnvzc16b 0 - mov cx,[SA1xa] - seto byte[Sflago] - mov [Sflagnz],ecx - jc .carry - mov dword[Sflagc],0h - endloop -.carry - mov dword[Sflagc],0FFh - endloop -%endmacro - -; Sets flags N V . . . . Z C according to flags -%macro flagsetnvzcs8b 0 - mov dword[Sflagnz],0 - mov al,[SA1xa] - seto byte[Sflago] - mov [Sflagnz+1],al - jc .carry - mov dword[Sflagc],0FFh - endloop -.carry - mov dword[Sflagc],0h - endloop -%endmacro - -%macro flagsetnvzcs16b 0 - mov cx,[SA1xa] - seto byte[Sflago] - mov [Sflagnz],ecx - jc .carry - mov dword[Sflagc],0FFh - endloop -.carry - mov dword[Sflagc],0h - endloop -%endmacro - -; Sets flags N V . . . . Z C for 16-bit decimal mode only -%macro flagsetnvzcd 0 - mov cx,[SA1xa] - seto byte[Sflago] - mov [Sflagnz],ecx - jc .carry - mov dword[Sflagc],0h - endloop -.carry - mov dword[Sflagc],0FFh - endloop -%endmacro - -; Sets flags N . . . . . Z C according to flags and don't jump to execloop -%macro flagsetnzc8b 0 - mov dword[Sflagnz],0 - mov dword[Sflagc],0h - mov [Sflagnz+1],al - jnc .carry - mov dword[Sflagc],0FFh -.carry -%endmacro - -; Sets flags N . . . . . Z C according to flags and don't jump to execloop -%macro flagsetnzc 0 - mov cx,ax - mov dword[Sflagc],0h - mov [Sflagnz],ecx - jnc .carry - mov dword[Sflagc],0FFh -.carry -%endmacro - -; Sets flags N . . . . . Z C according to flags and jump to execloop -%macro flagsetnzcel8b 0 - mov dword[Sflagnz],0h - jc .carry - mov [Sflagnz+1],cl - mov dword[Sflagc],0FFh - endloop -.carry - mov [Sflagnz+1],cl - mov dword[Sflagc],0h - endloop -%endmacro - -%macro flagsetnzcel16b 0 - jc .carry - mov [Sflagnz],ecx - mov dword[Sflagc],0FFh - endloop -.carry - mov [Sflagnz],ecx - mov dword[Sflagc],0h - endloop -%endmacro - -;******************************************************* -; Opcode Instructions -;******************************************************* - -%macro ADCMacro8bnd 0 - mov cl,[Sflagc] - add cl,cl - adc [SA1xa],al - flagsetnvzc8b -%endmacro - -%macro ADCMacro16bnd 0 - mov cl,[Sflagc] - add cl,cl - adc [SA1xa],ax - flagsetnvzc16b -%endmacro - -%macro ADCMacro8bd 0 - mov cl,[Sflagc] - add cl,cl - mov cl,al - mov al,[SA1xa] - adc al,cl - daa - mov [SA1xa],al - flagsetnvzc8b - endloop -%endmacro - -%macro ADCMacro16bd 0 - mov cl,[Sflagc] - add cl,cl - mov cx,ax - mov al,[SA1xa] - adc al,cl - daa - mov [SA1xa],al - mov al,[SA1xa+1] - adc al,ch - daa - mov [SA1xa+1],al - flagsetnvzcd -%endmacro - -%macro ANDMacro8b 0 - and al,[SA1xa] - mov dword[Sflagnz],0 - mov [SA1xa],al - mov [Sflagnz+1],al - endloop -%endmacro - -%macro ANDMacro16b 0 - and eax,[SA1xa] - mov [SA1xa],ax - flagsetnz16b -%endmacro - -%macro ASLMacro8b 0 - add al,al - flagsetnzc8b -%endmacro - -%macro ASLMacro16b 0 - add ax,ax - flagsetnzc -%endmacro - -%macro JumpMacro 0 - movsx eax,byte[esi] - add esi,eax -.skip - inc esi - endloop -%endmacro - -%macro BITMacroim8b 0 - mov al,[esi] - test dword[Sflagnz],18000h - jz .notSflagnz - or dword[Sflagnz],10000h -.notSflagnz - inc esi - test [SA1xa],al - jz .zero - mov word[Sflagnz],1 - endloop -.zero - mov word[Sflagnz],0 - endloop -%endmacro - -%macro BITMacroim16b 0 - mov ax,[esi] - test dword[Sflagnz],18000h - jz .notSflagnz - or dword[Sflagnz],10000h -.notSflagnz - add esi,2 - test [SA1xa],ax - jz .zero - mov word[Sflagnz],1 - endloop -.zero - mov word[Sflagnz],0 - endloop -%endmacro - -%macro BITMacro8b 0 - mov dword[Sflagnz],10000h - test al,80h - jnz .flagn - mov dword[Sflagnz],0 -.flagn - mov dword[Sflago],1 - test al,40h - jnz .Sflago - mov dword[Sflago],0 -.Sflago - test [SA1xa],al - jz .zero - mov word[Sflagnz],1 - endloop -.zero - mov word[Sflagnz],0 - endloop -%endmacro - -%macro BITMacro16b 0 - mov dword[Sflagnz],10000h - test ax,8000h - jnz .flagn - mov dword[Sflagnz],0 -.flagn - mov dword[Sflago],1 - test ax,4000h - jnz .Sflago - mov dword[Sflago],0 -.Sflago - test [SA1xa],ax - jz .zero - mov word[Sflagnz],1 - endloop -.zero - mov word[Sflagnz],0 - endloop -%endmacro - -%macro BRKMacro 0 - inc esi - test byte[xe],1 - jne near BRKemulmode - mov bl,[SA1xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - mov bx,[SA1xs] - mov cl,[SA1xpb] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [SA1xs],bx - xor bh,bh - mov bl,[xirqb] - mov [SA1xpb],bl - xor eax,eax - mov ax,[brkv] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -BRKemulmode - mov bl,[SA1xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - mov bx,[SA1xs] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [SA1xs],bx - xor bh,bh - mov bl,[SA1xpb] - xor eax,eax - mov ax,[brkv8] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro BRLMacro 0 - mov ebx,esi - sub ebx,[initaddrl] - add bx,2 - xor eax,eax - add bx,[esi] - mov ax,bx - xor ebx,ebx - mov [xpc],ax - mov bl,[SA1xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro CMPMacro8b 0 - mov cl,[SA1xa] - sub cl,al - flagsetnzcel8b -%endmacro - -%macro CMPMacro16b 0 - mov cx,[SA1xa] - sub cx,ax - flagsetnzcel16b -%endmacro - -%macro COPMacro 0 - inc esi - test byte[xe],1 - jne near COPemulmode - mov bl,[SA1xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - - mov cx,[SA1xs] - mov al,[SA1xpb] - call membank0w8 - dec cx - mov al,[xpc+1] - call membank0w8 - dec cx - or cx,word[stackor] - - mov al,[xpc] - call membank0w8 - dec cx - or cx,word[stackor] - - makedl - mov al,dl - call membank0w8 - dec cx - or cx,word[stackor] - - mov [SA1xs],cx - - xor bh,bh - mov bl,[xirqb] - mov [SA1xpb],bl - xor eax,eax - mov ax,[copv] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -COPemulmode - mov bl,[SA1xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov eax,[wramdata] - mov bx,[SA1xs] - mov cl,[xpc+1] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov cl,[xpc] - mov [eax+ebx],cl - dec bx - and bx,word[stackand] - or bx,word[stackor] - makedl - mov [eax+ebx],dl - dec bx - and bx,word[stackand] - or bx,word[stackor] - mov [SA1xs],bx - xor bh,bh - mov bl,[SA1xpb] - xor eax,eax - mov ax,[copv8] - mov [xpc],ax - and dl,11110011b - or dl,00000100b - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro CPXMacro8b 0 - mov cl,[SA1xx] - sub cl,al - flagsetnzcel8b -%endmacro - -%macro CPXMacro16b 0 - mov cx,[SA1xx] - sub cx,ax - flagsetnzcel16b -%endmacro - -%macro CPYMacro8b 0 - mov cl,[SA1xy] - sub cl,al - flagsetnzcel8b -%endmacro - -%macro CPYMacro16b 0 - mov cx,[SA1xy] - sub cx,ax - flagsetnzcel16b -%endmacro - -%macro EORMacro8b 0 - xor al,[SA1xa] - mov dword[Sflagnz],0 - mov [SA1xa],al - mov [Sflagnz+1],al - endloop -%endmacro - -%macro EORMacro16b 0 - xor eax,[SA1xa] - mov [SA1xa],ax - flagsetnz16b -%endmacro - -%macro JMLMacro 0 - mov cx,[esi] - xor eax,eax - call membank0r16 - add cx,2 - push eax - call membank0r8 - mov bl,al - pop eax - mov [xpc],ax - mov [SA1xpb],bl - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro4C 0 - xor eax,eax - mov ax,[esi] - mov bl,[SA1xpb] - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr -; mov esi,[snesmap2+ebx*4] -; mov [initaddrl],esi -; add esi,eax - mov esi,[snesmap2+ebx*4] - cmp eax,4300h - jae .upperlower - mov [initaddrl],esi - add esi,eax - endloop -.upperlower - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro6C 0 - mov cx,[esi] - xor eax,eax - call membank0r16 - mov [xpc],ax - mov bl,[SA1xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro7C 0 - mov cx,[esi] - xor eax,eax - add cx,[SA1xx] - mov bl,[SA1xpb] - call dword near [memtabler16+ebx*4] - mov [xpc],ax - mov bl,[SA1xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JMPMacro5C 0 - xor eax,eax - mov bl,[esi+2] - mov ax,[esi] - mov [SA1xpb],bl - mov [xpc],ax - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JSLMacro 0 - mov ebx,esi - sub ebx,[initaddrl] - add bx,2 - mov [xpc],bx - - mov cx,[SA1xs] - mov al,[SA1xpb] - call membank0w8 - dec cx - mov al,[xpc+1] - call membank0w8 - dec cx - or cx,word[stackor] - mov al,[xpc] - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - - xor eax,eax - xor bh,bh - mov ax,[esi] - mov bl,[esi+2] - mov [xpc],ax - mov [SA1xpb],bl - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - cmp ebx,0 - jne .notupper - cmp eax,2000h - ja .upperbank -.notupper - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.upperbank - mov esi,IRAM - sub esi,3000h - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JSRMacro20 0 - mov ebx,esi - sub ebx,[initaddrl] - inc bx - mov [xpc],bx - - mov cx,[SA1xs] - mov al,[xpc+1] - call membank0w8 - dec cx - or cx,word[stackor] - mov al,[xpc] - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - - xor eax,eax - mov ax,[esi] - xor bh,bh - mov [xpc],ax - mov bl,[SA1xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - cmp eax,4300h - jae .upperlower - mov [initaddrl],esi - add esi,eax - endloop -.upperlower - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro JSRMacroFC 0 - mov ebx,esi - sub ebx,[initaddrl] - inc bx - mov [xpc],bx - - mov cx,[SA1xs] - mov al,[xpc+1] - call membank0w8 - dec cx - or cx,word[stackor] - mov al,[xpc] - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - - xor eax,eax - xor bh,bh - mov cx,[esi] - mov bl,[SA1xpb] - add cx,[SA1xx] - call dword near [memtabler16+ebx*4] - mov [xpc],ax - mov bl,[SA1xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro LDAMacro8b 0 - mov dword[Sflagnz],0 - mov [SA1xa],al - mov [Sflagnz+1],al - endloop -%endmacro - -%macro LDAMacro16b 0 - mov [SA1xa],ax - flagsetnz16b - endloop -%endmacro - -%macro LDXMacro8b 0 - mov dword[Sflagnz],0 - mov [SA1xx],al - mov [Sflagnz+1],al - endloop -%endmacro - -%macro LDXMacro16b 0 - mov [SA1xx],ax - flagsetnz16b - endloop -%endmacro - -%macro LDYMacro8b 0 - mov dword[Sflagnz],0 - mov [SA1xy],al - mov [Sflagnz+1],al - endloop -%endmacro - -%macro LDYMacro16b 0 - mov [SA1xy],ax - flagsetnz16b - endloop -%endmacro - -%macro LSRMacro8b 0 - shr al,1 - flagsetnzc8b -%endmacro - -%macro LSRMacro16b 0 - shr ax,1 - flagsetnzc -%endmacro - -%macro MVNMacro 0 - mov ax,[esi] - mov [SA1xdb],al - mov bl,ah - mov cx,[SA1xx] - call dword near [memtabler8+ebx*4] - mov bl,[SA1xdb] - mov cx,[SA1xy] - call dword near [memtablew8+ebx*4] - test dl,10h - jnz .pagezero - inc word[SA1xx] - inc word[SA1xy] - dec word[SA1xa] - cmp word[SA1xa],0FFFFh - je .endmove - dec esi - endloop -.endmove - add esi,2 - endloop -.pagezero - inc byte[SA1xx] - inc byte[SA1xy] - dec word[SA1xa] - cmp word[SA1xa],0FFFFh - je .endmove - dec esi - endloop -%endmacro - -%macro MVPMacro 0 - mov ax,[esi] - mov [SA1xdb],al - mov bl,ah - mov cx,[SA1xx] - call dword near [memtabler8+ebx*4] - mov bl,[SA1xdb] - mov cx,[SA1xy] - call dword near [memtablew8+ebx*4] - test dl,10h - jnz .pagezero - dec word[SA1xx] - dec word[SA1xy] - dec word[SA1xa] - cmp word[SA1xa],0FFFFh - je .endmove - dec esi - endloop -.endmove - add esi,2 - endloop -.pagezero - dec byte[SA1xx] - dec byte[SA1xy] - dec word[SA1xa] - cmp word[SA1xa],0FFFFh - je .endmove - dec esi - endloop -%endmacro - -%macro ORAMacro8b 0 - or al,[SA1xa] - mov dword[Sflagnz],0 - mov [SA1xa],al - mov [Sflagnz+1],al - endloop -%endmacro - -%macro ORAMacro16b 0 - or ax,[SA1xa] - mov [SA1xa],ax - flagsetnz16b -%endmacro - -%macro PUSHMacro8b 1 - mov eax,[wramdata] - mov cx,[SA1xs] - mov al,%1 - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - endloop -%endmacro - -%macro PUSHMacro8bp 0 - mov eax,[wramdata] - makedl - mov cx,[SA1xs] - mov al,dl - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - endloop -%endmacro - -%macro PUSHMacro16b 2 - mov cx,[SA1xs] - mov al,%2 - call membank0w8 - dec cx - or cx,word[stackor] - mov al,%1 - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - endloop -%endmacro - -%macro PEAMacro 0 - mov cx,[SA1xs] - mov al,[esi+1] - call membank0w8 - dec cx - or cx,word[stackor] - mov al,[esi] - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - add esi,2 - endloop -%endmacro - -%macro PEIMacro 0 - xor ah,ah - mov al,[esi] - mov cx,[SA1xd] - inc esi - add cx,ax - call membank0r16 - mov cx,[SA1xs] - push eax - mov al,ah - call membank0w8 - pop eax - dec cx - or cx,word[stackor] - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - endloop -%endmacro - -%macro PERMacro 0 - mov bl,[SA1xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr - mov eax,[snesmmap+ebx*4] - mov ebx,esi - sub ebx,eax - add bx,[esi] - mov ax,bx - add esi,2 - add ax,2 - mov cx,[SA1xs] - push eax - mov al,ah - call membank0w8 - pop eax - dec cx - or cx,word[stackor] - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - xor ebx,ebx - endloop -.loweraddr - mov eax,[snesmap2+ebx*4] - mov ebx,esi - sub ebx,eax - add bx,[esi] - mov ax,bx - add esi,2 - add ax,2 - mov cx,[SA1xs] - push eax - mov al,ah - call membank0w8 - pop eax - dec cx - or cx,word[stackor] - call membank0w8 - dec cx - or cx,word[stackor] - mov [SA1xs],cx - xor ebx,ebx - endloop -%endmacro - -%macro POPMacro8b 1 - mov eax,[wramdata] - mov cx,[SA1xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [SA1xs],cx - mov %1,al - flagsetnz8b - endloop -%endmacro - -%macro POPMacro16b 2 - mov eax,[wramdata] - mov cx,[SA1xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov %1,al - mov [SA1xs],cx - inc cx - and cx,word[stackand] - call membank0r8 - mov %2,al - mov [SA1xs],cx - mov ah,al - mov al,%1 - flagsetnz16b -%endmacro - -%macro POPMacro16bd 2 - mov eax,[wramdata] - mov cx,[SA1xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov %1,al - mov [SA1xs],cx - inc cx - and cx,word[stackand] - call membank0r8 - mov %2,al - call SA1UpdateDPage - mov [SA1xs],cx - mov ah,al - mov al,%1 - flagsetnz16b -%endmacro - -%macro POPMacroP 0 - mov cx,[SA1xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [SA1xs],cx - mov dl,al - restoredl - test byte[xe],01h - jnz .emul - mov bl,dl - mov edi,[SA1tablead+ebx*4] - test dl,00010000b - jnz .setx - endloop -.setx - mov byte[SA1xx+1],0 - mov byte[SA1xy+1],0 - endloop -.emul - or dl,00110000b - mov bl,dl - mov edi,[SA1tablead+ebx*4] - endloop -%endmacro - -%macro REPMacro 0 - mov al,[esi] - inc esi - test al,11000011b - jnz .extraflags - not al - and dl,al - test byte[xe],01h - jnz .emul - mov bl,dl - mov edi,[SA1tablead+ebx*4] - endloop -.emul - or dl,00110000b - mov bl,dl - mov edi,[SA1tablead+ebx*4] - endloop - -.extraflags - not al - makedl - and dl,al - restoredl - test byte[xe],01h - jnz .emul2 - mov bl,dl - mov edi,[SA1tablead+ebx*4] - endloop -.emul2 - or dl,00110000b - mov bl,dl - mov edi,[SA1tablead+ebx*4] - endloop -%endmacro - -%macro ROLMacro8b 0 - mov cl,[Sflagc] - add cl,cl - rcl al,1 - flagsetnzc8b -%endmacro - -%macro ROLMacro16b 0 - mov cl,[Sflagc] - add cl,cl - rcl ax,1 - flagsetnzc -%endmacro - -%macro RORMacro8b 0 - mov cl,[Sflagc] - add cl,cl - rcr al,1 - flagsetnzc8b -%endmacro - -%macro RORMacro16b 0 - mov cl,[Sflagc] - add cl,cl - rcr ax,1 - flagsetnzc -%endmacro - -%macro RTIMacro 0 - cmp byte[curexecstate],0 - jne .nn - xor dh,dh -.nn -.nodis658162 - mov byte[curnmi],0 - - mov cx,[SA1xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov dl,al - restoredl - - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc],al - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc+1],al - inc cx - and cx,word[stackand] - call membank0r8 - mov [SA1xpb],al - mov [SA1xs],cx - - xor bh,bh - xor eax,eax - mov bl,dl - mov edi,[SA1tablead+ebx*4] - mov bl,[SA1xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - test dl,00010000b - jnz .setx - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - cmp eax,4300h - jae .upperlower - mov [initaddrl],esi - add esi,eax - test dl,00010000b - jnz .setx - endloop -.setx - mov byte[SA1xx+1],0 - mov byte[SA1xy+1],0 - endloop -.upperlower - cmp dword[memtabler8+ebx*4],regaccessbankr8 - je .dma - mov [initaddrl],esi - add esi,eax - test dl,00010000b - jnz .setx - endloop -.dma - mov esi,dmadata-4300h - mov [initaddrl],esi - add esi,eax - test dl,00010000b - jnz .setx - endloop -%endmacro - -%macro RTLMacro 0 - mov cx,[SA1xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc],al - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc+1],al - inc cx - and cx,word[stackand] - call membank0r8 - mov [SA1xpb],al - mov [SA1xs],cx - - xor bh,bh - xor eax,eax - inc word[xpc] - mov bl,[SA1xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro RTSMacro 0 - mov cx,[SA1xs] - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc],al - inc cx - and cx,word[stackand] - call membank0r8 - mov [xpc+1],al - mov [SA1xs],cx - - xor bh,bh - inc word[xpc] - xor eax,eax - mov ax,[xpc] - mov bl,[SA1xpb] - test eax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -.loweraddr - mov esi,[snesmap2+ebx*4] - mov [initaddrl],esi - add esi,eax - endloop -%endmacro - -%macro SBCMacro8bnd 0 - mov cl,[Sflagc] - sub cl,1 - sbb [SA1xa],al - flagsetnvzcs8b - endloop -%endmacro - -%macro SBCMacro16bnd 0 - mov cl,[Sflagc] - sub cl,1 - sbb [SA1xa],ax - flagsetnvzcs16b - endloop -%endmacro - -%macro SBCMacro8bd 0 - mov cl,[Sflagc] - sub cl,1 - mov cl,al - mov al,[SA1xa] - sbb al,cl - das - mov [SA1xa],al - flagsetnvzcs8b - endloop -%endmacro - -%macro SBCMacro16bd 0 - mov cl,[Sflagc] - sub cl,1 - mov cx,ax - mov al,[SA1xa] - sbb al,cl - das - mov [SA1xa],al - mov al,[SA1xa+1] - sbb al,ch - das - mov [SA1xa+1],al - cmc - flagsetnvzcd - endloop -%endmacro - -%macro SEPMacro 0 - mov al,[esi] - inc esi - test al,11000011b - jnz .extraflags - or dl,al - mov bl,dl - mov edi,[SA1tablead+ebx*4] - test dl,00010000b - jnz .setx - endloop -.setx - mov byte[SA1xx+1],0 - mov byte[SA1xy+1],0 - endloop -.extraflags - makedl - or dl,al - restoredl - mov bl,dl - mov edi,[SA1tablead+ebx*4] - test dl,00010000b - jnz .setx2 - endloop -.setx2 - mov byte[SA1xx+1],0 - mov byte[SA1xy+1],0 - endloop -%endmacro - -%macro STAMacro8b 0 - mov al,[SA1xa] -%endmacro - -%macro STAMacro16b 0 - mov eax,[SA1xa] -%endmacro - -%macro STXMacro8b 0 - mov al,[SA1xx] -%endmacro - -%macro STXMacro16b 0 - mov eax,[SA1xx] -%endmacro - -%macro STYMacro8b 0 - mov al,[SA1xy] -%endmacro - -%macro STYMacro16b 0 - mov eax,[SA1xy] -%endmacro - -%macro WAIMacro 0 - cmp byte[intrset],1 - jne .notws - dec esi - endloop -.notws - test byte[intrset],0FFh - jz .waitstate - cmp byte[intrset],2 - je .stopint - dec esi - endloop -.waitstate - mov byte[intrset],1 - dec esi - endloop -.stopint - mov byte[intrset],0 - endloop -%endmacro - -%macro XCEMacro 0 - mov al,[Sflagc] - mov dword[Sflagc],0 - and al,00000001b - test byte[xe],0FFh - jz .noemul - mov dword[Sflagc],0FFh -.noemul - mov [xe],al - test byte[xe],01h - jnz .emul - or dl,00100000b - mov word[stackand],0FFFFh - mov word[stackor],0000h - endloop -.emul - or dl,00110000b - mov bl,dl - mov edi,[SA1tablead+ebx*4] - mov byte[SA1xx+1],0 - mov byte[SA1xy+1],0 - mov byte[SA1xs+1],1 - mov word[stackand],01FFh - mov word[stackor],0100h - endloop -%endmacro diff --git a/tools/zsnes/src/cpu/saddress.inc b/tools/zsnes/src/cpu/saddress.inc deleted file mode 100644 index cc90ed6..0000000 --- a/tools/zsnes/src/cpu/saddress.inc +++ /dev/null @@ -1,811 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -EXTSYM SA1DPageR8,SA1DPageR16,SA1DPageW8,SA1DPageW16 - - -;******************************************************* -; Address Modes -;******************************************************* - -; 1. Immediate Addressing -- # - DONE IN PROGRAM - -%macro addr_I_8br 0 - mov al,[esi] - inc esi -%endmacro - -%macro addr_I_16br 0 - mov eax,[esi] - add esi,2 -%endmacro - -; 2. Absolute -- a (TESTED) - -%macro addr_a_8br 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_a_16br 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_a_8bw 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_a_16bw 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - call dword near [memtablew16+ebx*4] -%endmacro - -; 3. Absolute Long -- al - -%macro addr_al_8br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_al_16br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_al_8bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_al_16bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - call dword near [memtablew16+ebx*4] -%endmacro - -; 4. Direct -- d (TESTED) - -%macro addr_d_8br 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR8] -%endmacro - -%macro addr_d_16br 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR16] -%endmacro - -%macro addr_d_8bw 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageW8] -%endmacro - -%macro addr_d_16bw 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageW16] -%endmacro - -; 5. Accumulator -- A - -%macro addr_A_8br 0 - mov al,[SA1xa] -%endmacro - -%macro addr_A_16br 0 - mov eax,[SA1xa] -%endmacro - -%macro addr_A_8bw 0 - mov [SA1xa],al -%endmacro - -%macro addr_A_16bw 0 - mov [SA1xa],ax -%endmacro - -; 7. Direct Indirect Indexed -- (d),y - -%macro addr_BdBCy_8br 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR16] - mov cx,ax - mov bl,[SA1xdb] - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdBCy_16br 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR16] - mov cx,ax - mov bl,[SA1xdb] - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdBCy_8bw 0 - push ax - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR16] - mov cx,ax - mov bl,[SA1xdb] - add cx,[SA1xy] - jnc .np - inc bl -.np - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdBCy_16bw 0 - push ax - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR16] - mov cx,ax - mov bl,[SA1xdb] - add cx,[SA1xy] - jnc .np - inc bl -.np - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 8. Direct Indirect Indexed Long -- [d],y - -%macro addr_LdLCy_8br 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_LdLCy_16br 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_LdLCy_8bw 0 - push ax - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - add cx,[SA1xy] - pop ax - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_LdLCy_16bw 0 - push ax - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - push cx - call membank0r16 - pop cx - add cx,2 - xor bl,bl - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - add cx,[SA1xy] - pop ax - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 9. Direct Indexed Indirect -- (d,x) - -%macro addr_BdCxB_8br 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xx] - call membank0r16 - mov cx,ax - mov bl,[SA1xdb] - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdCxB_16br 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xx] - call membank0r16 - mov cx,ax - mov bl,[SA1xdb] - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdCxB_8bw 0 - push ax - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xx] - call membank0r16 - mov cx,ax - mov bl,[SA1xdb] - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdCxB_16bw 0 - push ax - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xx] - call membank0r16 - mov cx,ax - mov bl,[SA1xdb] - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 10. Direct Indexed With X -- d,x - -%macro addr_dCx_8br 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xx] - call membank0r8 -%endmacro - -%macro addr_dCx_16br 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xx] - call membank0r16 -%endmacro - -%macro addr_dCx_8bw 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xx] - call membank0w8 -%endmacro - -%macro addr_dCx_16bw 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xx] - call membank0w16 -%endmacro - -; 11. Direct Indexed With Y -- d,y - -%macro addr_dCy_8br 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xy] - call membank0r8 -%endmacro - -%macro addr_dCy_16br 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xy] - call membank0r16 -%endmacro - -%macro addr_dCy_8bw 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xy] - call membank0w8 -%endmacro - -%macro addr_dCy_16bw 0 - mov ecx,[SA1xd] - mov bl,[esi] - add cx,bx - inc esi - add cx,[SA1xy] - call membank0w16 -%endmacro - -; 12. Absolute Indexed With X -- a,x - -%macro addr_aCx_8br 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - add cx,[SA1xx] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_aCx_16br 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - add cx,[SA1xx] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_aCx_8bw 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - add cx,[SA1xx] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_aCx_16bw 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - add cx,[SA1xx] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 13. Absolute Indexed With Y -- a,y - -%macro addr_aCy_8br 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_aCy_16br 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_aCy_8bw 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_aCy_16bw 0 - mov cx,[esi] - mov bl,[SA1xdb] - add esi,2 - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 14. Absolute Long Indexed With X -- al,x - -%macro addr_alCx_8br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[SA1xx] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_alCx_16br 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[SA1xx] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_alCx_8bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[SA1xx] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_alCx_16bw 0 - mov cx,[esi] - mov bl,[esi+2] - add esi,3 - add cx,[SA1xx] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - -; 18. Direct Indirect -- (d) -; ___________________ -; Instruction: | opcode | offset | -; ~~~~~~~~~~~~~~~~~~~ -; | Direct Register | -; + | offset | -; --------------------- -; | 00 | direct address | -; then: -; | 00 | (direct address) | -; + | DB | -; ------------------------------- -; Address: | effective address | - -%macro addr_BdB_8br 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR16] - mov cx,ax - mov bl,[SA1xdb] - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdB_16br 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR16] - mov cx,ax - mov bl,[SA1xdb] - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdB_8bw 0 - push ax - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR16] - mov cx,ax - mov bl,[SA1xdb] - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdB_16bw 0 - push ax - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - call dword near [SA1DPageR16] - mov cx,ax - mov bl,[SA1xdb] - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 19. Direct Indirect Long -- [d] -; ___________________ -; Instruction: | opcode | offset | -; ~~~~~~~~~~~~~~~~~~~ -; | Direct Register | -; + | offset | -; --------------------- -; | 00 | direct address | -; then: -; ------------------------------- -; Address: | (direct address) | - -%macro addr_LdL_8br 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - add cx,bx - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_LdL_16br 0 - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - add cx,bx - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_LdL_8bw 0 - push ax - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - add cx,bx - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - pop ax - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_LdL_16bw 0 - push ax - mov bl,[esi] - mov ecx,[SA1xd] - inc esi - add cx,bx - push cx - call membank0r16 - pop cx - add cx,2 - push ax - call membank0r8 - mov bl,al - pop ax - mov cx,ax - pop ax - call dword near [memtablew16+ebx*4] -%endmacro - -; 22. Stack Relative -- d,s - -%macro addr_dCs_8br 0 - mov bl,[esi] - mov cx,[SA1xs] - inc esi - add cx,bx - call membank0r8 -%endmacro - -%macro addr_dCs_16br 0 - mov bl,[esi] - mov cx,[SA1xs] - inc esi - add cx,bx - call membank0r16 -%endmacro - -%macro addr_dCs_8bw 0 - mov bl,[esi] - mov cx,[SA1xs] - inc esi - add cx,bx - call membank0w8 -%endmacro - -%macro addr_dCs_16bw 0 - mov bl,[esi] - mov cx,[SA1xs] - inc esi - add cx,bx - call membank0w16 -%endmacro - -; 23. Stack Relative Indirect Indexed -- (d,s),y (TESTED) - -%macro addr_BdCsBCy_8br 0 - mov bl,[esi] - mov cx,[SA1xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[SA1xdb] - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtabler8+ebx*4] -%endmacro - -%macro addr_BdCsBCy_16br 0 - mov bl,[esi] - mov cx,[SA1xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[SA1xdb] - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtabler16+ebx*4] -%endmacro - -%macro addr_BdCsBCy_8bw 0 - push ax - mov bl,[esi] - mov cx,[SA1xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[SA1xdb] - pop ax - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtablew8+ebx*4] -%endmacro - -%macro addr_BdCsBCy_16bw 0 - push ax - mov bl,[esi] - mov cx,[SA1xs] - inc esi - add cx,bx - call membank0r16 - mov cx,ax - mov bl,[SA1xdb] - pop ax - add cx,[SA1xy] - jnc .np - inc bl -.np - call dword near [memtablew16+ebx*4] -%endmacro - - diff --git a/tools/zsnes/src/cpu/saddrni.inc b/tools/zsnes/src/cpu/saddrni.inc deleted file mode 100644 index 70ca3e5..0000000 --- a/tools/zsnes/src/cpu/saddrni.inc +++ /dev/null @@ -1,407 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 - - - diff --git a/tools/zsnes/src/cpu/se65816.inc b/tools/zsnes/src/cpu/se65816.inc deleted file mode 100644 index 58c12a5..0000000 --- a/tools/zsnes/src/cpu/se65816.inc +++ /dev/null @@ -1,2027 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 brkv,brkv8,copv,copv8,curexecstate,curnmi,initaddrl -EXTSYM membank0r16,membank0r8,membank0w16,membank0w8 -EXTSYM memtabler16,memtabler8,memtablew16,memtablew8 -EXTSYM regaccessbankr8,snesmap2,snesmmap,stackand,stackor -EXTSYM wramdata,SA1xa,SA1xd,SA1xdb,xe,xirqb,SA1xpb,xpc,SA1xs,SA1xx,SA1xy -EXTSYM SA1RegP -%ifndef NO_DEBUGGER -EXTSYM debstop4,nextopcode,debugsa1,skipdebugsa1 -%endif - - -SECTION .text - -sa1debug: -%ifndef NO_DEBUGGER - cmp byte[debuggeron],0 - je .nodebugger - cmp byte[skipdebugsa1],1 - je .nodebugger - pushad - mov bl,[SA1xpb] - mov ax,[xpc] - test eax,8000h - jz .loweraddr2 - mov eax,[snesmmap+ebx*4] - jmp .nextaddr -.loweraddr2 - mov eax,[snesmap2+ebx*4] -.nextaddr - mov ebx,esi - sub ebx,eax - mov [xpc],bx - mov [SA1RegP],dl - mov byte[debugsa1],1 - call nextopcode - popad -.nodebugger -%endif - ret - - - - -; B = ( or ) -; C = , -; L = [ or ] -; I = # - - -SA1COp61m8nd: ; ADC(d,x) - addr_BdCxB_8br - ADCMacro8bnd -SA1COp61m16nd: ; ADC(d,x) - addr_BdCxB_16br - ADCMacro16bnd -SA1COp61m8d: ; ADC(d,x) - addr_BdCxB_8br - ADCMacro8bd -SA1COp61m16d: ; ADC(d,x) - addr_BdCxB_16br - ADCMacro16bd -SA1COp63m8nd: ; ADC d,s - addr_dCs_8br - ADCMacro8bnd -SA1COp63m16nd: ; ADC d,s - addr_dCs_16br - ADCMacro16bnd -SA1COp63m8d: ; ADC d,s - addr_dCs_8br - ADCMacro8bd -SA1COp63m16d: ; ADC d,s - addr_dCs_16br - ADCMacro16bd -SA1COp65m8nd: ; ADC d - addr_d_8br - ADCMacro8bnd -SA1COp65m16nd: ; ADC d - addr_d_16br - ADCMacro16bnd -SA1COp65m8d: ; ADC d - addr_d_8br - ADCMacro8bd -SA1COp65m16d: ; ADC d - addr_d_16br - ADCMacro16bd -SA1COp67m8nd: ; ADC [d] - addr_LdL_8br - ADCMacro8bnd -SA1COp67m16nd: ; ADC [d] - addr_LdL_16br - ADCMacro16bnd -SA1COp67m8d: ; ADC [d] - addr_LdL_8br - ADCMacro8bd -SA1COp67m16d: ; ADC [d] - addr_LdL_16br - ADCMacro16bd -SA1COp69m8nd: ; ADC # - addr_I_8br - ADCMacro8bnd -SA1COp69m16nd: ; ADC # - addr_I_16br - ADCMacro16bnd -SA1COp69m8d: ; ADC # - addr_I_8br - ADCMacro8bd -SA1COp69m16d: ; ADC # - addr_I_16br - ADCMacro16bd -SA1COp6Dm8nd: ; ADC a - addr_a_8br - ADCMacro8bnd -SA1COp6Dm16nd: ; ADC a - addr_a_16br - ADCMacro16bnd -SA1COp6Dm8d: ; ADC a - addr_a_8br - ADCMacro8bd -SA1COp6Dm16d: ; ADC a - addr_a_16br - ADCMacro16bd -SA1COp6Fm8nd: ; ADC al - addr_al_8br - ADCMacro8bnd -SA1COp6Fm16nd: ; ADC al - addr_al_16br - ADCMacro16bnd -SA1COp6Fm8d: ; ADC al - addr_al_8br - ADCMacro8bd -SA1COp6Fm16d: ; ADC al - addr_al_16br - ADCMacro16bd -SA1COp71m8nd: ; ADC(d),y - addr_BdBCy_8br - ADCMacro8bnd -SA1COp71m16nd: ; ADC(d),y - addr_BdBCy_16br - ADCMacro16bnd -SA1COp71m8d: ; ADC(d),y - addr_BdBCy_8br - ADCMacro8bd -SA1COp71m16d: ; ADC(d),y - addr_BdBCy_16br - ADCMacro16bd -SA1COp72m8nd: ; ADC (d) - addr_BdB_8br - ADCMacro8bnd -SA1COp72m16nd: ; ADC (d) - addr_BdB_16br - ADCMacro16bnd -SA1COp72m8d: ; ADC (d) - addr_BdB_8br - ADCMacro8bd -SA1COp72m16d: ; ADC (d) - addr_BdB_16br - ADCMacro16bd -SA1COp73m8nd: ; ADC(d,s),y - addr_BdCsBCy_8br - ADCMacro8bnd -SA1COp73m16nd: ; ADC(d,s),y - addr_BdCsBCy_16br - ADCMacro16bnd -SA1COp73m8d: ; ADC(d,s),y - addr_BdCsBCy_8br - ADCMacro8bd -SA1COp73m16d: ; ADC(d,s),y - addr_BdCsBCy_16br - ADCMacro16bd -SA1COp75m8nd: ; ADC d,x - addr_dCx_8br - ADCMacro8bnd -SA1COp75m16nd: ; ADC d,x - addr_dCx_16br - ADCMacro16bnd -SA1COp75m8d: ; ADC d,x - addr_dCx_8br - ADCMacro8bd -SA1COp75m16d: ; ADC d,x - addr_dCx_16br - ADCMacro16bd -SA1COp77m8nd: ; ADC [d],y - addr_LdLCy_8br - ADCMacro8bnd -SA1COp77m16nd: ; ADC [d],y - addr_LdLCy_16br - ADCMacro16bnd -SA1COp77m8d: ; ADC [d],y - addr_LdLCy_8br - ADCMacro8bd -SA1COp77m16d: ; ADC [d],y - addr_LdLCy_16br - ADCMacro16bd -SA1COp79m8nd: ; ADC a,y - addr_aCy_8br - ADCMacro8bnd -SA1COp79m16nd: ; ADC a,y - addr_aCy_16br - ADCMacro16bnd -SA1COp79m8d: ; ADC a,y - addr_aCy_8br - ADCMacro8bd -SA1COp79m16d: ; ADC a,y - addr_aCy_16br - ADCMacro16bd -SA1COp7Dm8nd: ; ADC a,x - addr_aCx_8br - ADCMacro8bnd -SA1COp7Dm16nd: ; ADC a,x - addr_aCx_16br - ADCMacro16bnd -SA1COp7Dm8d: ; ADC a,x - addr_aCx_8br - ADCMacro8bd -SA1COp7Dm16d: ; ADC a,x - addr_aCx_16br - ADCMacro16bd -SA1COp7Fm8nd: ; ADC al,x - addr_alCx_8br - ADCMacro8bnd -SA1COp7Fm16nd: ; ADC al,x - addr_alCx_16br - ADCMacro16bnd -SA1COp7Fm8d: ; ADC al,x - addr_alCx_8br - ADCMacro8bd -SA1COp7Fm16d: ; ADC al,x - addr_alCx_16br - ADCMacro16bd - -SA1COp21m8: ; AND(d,x) - addr_BdCxB_8br - ANDMacro8b -SA1COp21m16:; AND(d,x) - addr_BdCxB_16br - ANDMacro16b -SA1COp23m8: ; AND d,s - addr_dCs_8br - ANDMacro8b -SA1COp23m16:; AND d,s - addr_dCs_16br - ANDMacro16b -SA1COp25m8: ; AND d - addr_d_8br - ANDMacro8b -SA1COp25m16:; AND d - addr_d_16br - ANDMacro16b -SA1COp27m8: ; AND [d] - addr_LdL_8br - ANDMacro8b -SA1COp27m16:; AND [d] - addr_LdL_16br - ANDMacro16b -SA1COp29m8: ; AND # - addr_I_8br - ANDMacro8b -SA1COp29m16:; AND # - addr_I_16br - ANDMacro16b -SA1COp2Dm8: ; AND a - addr_a_8br - ANDMacro8b -SA1COp2Dm16:; AND a - addr_a_16br - ANDMacro16b -SA1COp2Fm8: ; AND al - addr_al_8br - ANDMacro8b -SA1COp2Fm16:; AND al - addr_al_16br - ANDMacro16b -SA1COp31m8: ; AND(d),y - addr_BdBCy_8br - ANDMacro8b -SA1COp31m16:; AND(d),y - addr_BdBCy_16br - ANDMacro16b -SA1COp32m8: ; AND (d) - addr_BdB_8br - ANDMacro8b -SA1COp32m16:; AND (d) - addr_BdB_16br - ANDMacro16b -SA1COp33m8: ; AND(d,s),y - addr_BdCsBCy_8br - ANDMacro8b -SA1COp33m16:; AND(d,s),y - addr_BdCsBCy_16br - ANDMacro16b -SA1COp35m8: ; AND d,x - addr_dCx_8br - ANDMacro8b -SA1COp35m16:; AND d,x - addr_dCx_16br - ANDMacro16b -SA1COp37m8: ; AND [d],y - addr_LdLCy_8br - ANDMacro8b -SA1COp37m16:; AND [d],y - addr_LdLCy_16br - ANDMacro16b -SA1COp39m8: ; AND a,y - addr_aCy_8br - ANDMacro8b -SA1COp39m16:; AND a,y - addr_aCy_16br - ANDMacro16b -SA1COp3Dm8: ; AND a,x - addr_aCx_8br - ANDMacro8b -SA1COp3Dm16:; AND a,x - addr_aCx_16br - ANDMacro16b -SA1COp3Fm8: ; AND al,x - addr_alCx_8br - ANDMacro8b -SA1COp3Fm16:; AND al,x - addr_alCx_16br - ANDMacro16b - -SA1COp06m8: ; ASL d - addr_d_8brni - ASLMacro8b - addr_d_8bw - endloop -SA1COp06m16:; ASL d - addr_d_16brni - ASLMacro16b - addr_d_16bw - endloop -SA1COp0Am8: ; ASL A - addr_A_8brni - ASLMacro8b - addr_A_8bw - endloop -SA1COp0Am16:; ASL A - addr_A_16brni - ASLMacro16b - addr_A_16bw - endloop -SA1COp0Em8: ; ASL a - addr_a_8brni - ASLMacro8b - addr_a_8bw - endloop -SA1COp0Em16:; ASL a - addr_a_16brni - ASLMacro16b - addr_a_16bw - endloop -SA1COp16m8: ; ASL d,x - addr_dCx_8brni - ASLMacro8b - addr_dCx_8bw - endloop -SA1COp16m16:; ASL d,x - addr_dCx_16brni - ASLMacro16b - addr_dCx_16bw - endloop -SA1COp1Em8: ; ASL a,x - addr_aCx_8brni - ASLMacro8b - addr_aCx_8bw - endloop -SA1COp1Em16:; ASL a,x - addr_aCx_16brni - ASLMacro16b - addr_aCx_16bw - endloop - -SA1COp90: ; BCC r - test byte[Sflagc],01h - jnz .skip - JumpMacro -SA1COpB0: ; BCS r - test byte[Sflagc],01h - jz .skip - JumpMacro -SA1COpF0: ; BEQ r - test dword[Sflagnz],0FFFFh - jnz .skip - JumpMacro -SA1COp30: ; BMI r - test dword[Sflagnz],018000h - jz .skip - JumpMacro -SA1COpD0: ; BNE r - test dword[Sflagnz],0FFFFh - jz .skip - JumpMacro -SA1COp10: ; BPL r - test dword[Sflagnz],018000h - jnz .skip - JumpMacro -SA1COp80: ; BRA r - movsx eax,byte[esi] - inc esi - add esi,eax - endloop -SA1COp50: ; BVC r - test dword[Sflago],0FFh - jnz .skip - JumpMacro -SA1COp70: ; BVS r - test dword[Sflago],0FFh - jz .skip - JumpMacro - -; BIT instruction does not affect N and V flags when using immediate -; addressing mode. When using other addressing modes, the N and V flags - -SA1COp89m8: ; BIT # - BITMacroim8b -SA1COp89m16:; BIT # - BITMacroim16b - -SA1COp24m8: ; BIT d - addr_d_8br - BITMacro8b -SA1COp24m16:; BIT d - addr_d_16br - BITMacro16b -SA1COp2Cm8: ; BIT a - addr_a_8br - BITMacro8b -SA1COp2Cm16:; BIT a - addr_a_16br - BITMacro16b -SA1COp34m8: ; BIT d,x - addr_dCx_8br - BITMacro8b -SA1COp34m16:; BIT d,x - addr_dCx_16br - BITMacro16b -SA1COp3Cm8: ; BIT a,x - addr_aCx_8br - BITMacro8b -SA1COp3Cm16:; BIT a,x - addr_aCx_16br - BITMacro16b - -SA1COp00: ; BRK s -%ifndef NO_DEBUGGER - mov byte[debstop4],1 -%endif - dec esi - endloop - BRKMacro - -SA1COp82: ; BRL rl - BRLMacro - -SA1COp18: ; CLC i - mov dword[Sflagc],0 - endloop -SA1COpD8: ; CLD i - and dl,0F7h - mov bl,dl - mov edi,[SA1tablead+ebx*4] - endloop -SA1COp58: ; CLI i - and dl,0FBh - endloop -SA1COpB8: ; CLV i - mov dword[Sflago],0 - endloop - -SA1COpC1m8: ; CMP(d,x) - addr_BdCxB_8br - CMPMacro8b -SA1COpC1m16:; CMP(d,x) - addr_BdCxB_16br - CMPMacro16b -SA1COpC3m8: ; CMP d,s - addr_dCs_8br - CMPMacro8b -SA1COpC3m16:; CMP d,s - addr_dCs_16br - CMPMacro16b -SA1COpC5m8: ; CMP d - addr_d_8br - CMPMacro8b -SA1COpC5m16:; CMP d - addr_d_16br - CMPMacro16b -SA1COpC7m8: ; CMP [d] - addr_LdL_8br - CMPMacro8b -SA1COpC7m16:; CMP [d] - addr_LdL_16br - CMPMacro16b -SA1COpC9m8: ; CMP # - addr_I_8br - CMPMacro8b -SA1COpC9m16:; CMP # - addr_I_16br - CMPMacro16b -SA1COpCDm8: ; CMP a - addr_a_8br - CMPMacro8b -SA1COpCDm16:; CMP a - addr_a_16br - CMPMacro16b -SA1COpCFm8: ; CMP al - addr_al_8br - CMPMacro8b -SA1COpCFm16:; CMP al - addr_al_16br - CMPMacro16b -SA1COpD1m8: ; CMP(d),y - addr_BdBCy_8br - CMPMacro8b -SA1COpD1m16:; CMP(d),y - addr_BdBCy_16br - CMPMacro16b -SA1COpD2m8: ; CMP (d) - addr_BdB_8br - CMPMacro8b -SA1COpD2m16:; CMP (d) - addr_BdB_16br - CMPMacro16b -SA1COpD3m8: ; CMP(d,s),y - addr_BdCsBCy_8br - CMPMacro8b -SA1COpD3m16:; CMP(d,s),y - addr_BdCsBCy_16br - CMPMacro16b -SA1COpD5m8: ; CMP d,x - addr_dCx_8br - CMPMacro8b -SA1COpD5m16:; CMP d,x - addr_dCx_16br - CMPMacro16b -SA1COpD7m8: ; CMP [d],y - addr_LdLCy_8br - CMPMacro8b -SA1COpD7m16:; CMP [d],y - addr_LdLCy_16br - CMPMacro16b -SA1COpD9m8: ; CMP a,y - addr_aCy_8br - CMPMacro8b -SA1COpD9m16:; CMP a,y - addr_aCy_16br - CMPMacro16b -SA1COpDDm8: ; CMP a,x - addr_aCx_8br - CMPMacro8b -SA1COpDDm16:; CMP a,x - addr_aCx_16br - CMPMacro16b -SA1COpDFm8: ; CMP al,x - addr_alCx_8br - CMPMacro8b -SA1COpDFm16:; CMP al,x - addr_alCx_16br - CMPMacro16b - -SA1COp02: ; SA1COp s - COPMacro - -SA1COpE0x8: ; CPX # - addr_I_8br - CPXMacro8b -SA1COpE0x16:; CPX # - addr_I_16br - CPXMacro16b -SA1COpE4x8: ; CPX d - addr_d_8br - CPXMacro8b -SA1COpE4x16:; CPX d - addr_d_16br - CPXMacro16b -SA1COpECx8: ; CPX a - addr_a_8br - CPXMacro8b -SA1COpECx16:; CPX a - addr_a_16br - CPXMacro16b - -SA1COpC0x8: ; CPY # - addr_I_8br - CPYMacro8b -SA1COpC0x16:; CPY # - addr_I_16br - CPYMacro16b -SA1COpC4x8: ; CPY d - addr_d_8br - CPYMacro8b -SA1COpC4x16:; CPY d - addr_d_16br - CPYMacro16b -SA1COpCCx8: ; CPY a - addr_a_8br - CPYMacro8b -SA1COpCCx16:; CPY a - addr_a_16br - CPYMacro16b - -SA1COp3Am8: ; DEC A - addr_A_8brni - dec al - flagsetnz8bnel - addr_A_8bw - endloop -SA1COp3Am16:; DEC A - addr_A_16brni - dec ax - flagsetnz16bnel - addr_A_16bw - endloop -SA1COpCEm8: ; DEC a - addr_a_8brni - dec al - flagsetnz8bnel - addr_a_8bw - endloop -SA1COpCEm16:; DEC a - addr_a_16brni - dec ax - flagsetnz16bnel - addr_a_16bw - endloop -SA1COpC6m8: ; DEC d - addr_d_8brni - dec al - flagsetnz8bnel - addr_d_8bw - endloop -SA1COpC6m16:; DEC d - addr_d_16brni - dec ax - flagsetnz16bnel - addr_d_16bw - endloop -SA1COpD6m8: ; DEC d,x - addr_dCx_16brni - dec al - flagsetnz8bnel - addr_dCx_16bw - endloop -SA1COpD6m16:; DEC d,x - addr_dCx_16brni - dec ax - flagsetnz16bnel - addr_dCx_16bw - endloop -SA1COpDEm8: ; DEC a,x - addr_aCx_8brni - dec al - flagsetnz8bnel - addr_aCx_8bw - endloop -SA1COpDEm16:; DEC a,x - addr_aCx_16brni - dec ax - flagsetnz16bnel - addr_aCx_16bw - endloop - -SA1COpCAx8: ; DEX i - dec byte[SA1xx] - mov al,[SA1xx] - flagsetnz8b - endloop -SA1COpCAx16:; DEX i - dec word[SA1xx] - mov ax,[SA1xx] - flagsetnz16b - endloop -SA1COp88x8: ; DEY i - dec byte[SA1xy] - mov al,[SA1xy] - flagsetnz8b - endloop -SA1COp88x16:; DEY i - dec word[SA1xy] - mov ax,[SA1xy] - flagsetnz16b - endloop - -SA1COp41m8: ; EOR(d,x) - addr_BdCxB_8br - EORMacro8b -SA1COp41m16:; EOR(d,x) - addr_BdCxB_16br - EORMacro16b -SA1COp43m8: ; EOR d,s - addr_dCs_8br - EORMacro8b -SA1COp43m16:; EOR d,s - addr_dCs_16br - EORMacro16b -SA1COp45m8: ; EOR d - addr_d_8br - EORMacro8b -SA1COp45m16:; EOR d - addr_d_16br - EORMacro16b -SA1COp47m8: ; EOR [d] - addr_LdL_8br - EORMacro8b -SA1COp47m16:; EOR [d] - addr_LdL_16br - EORMacro16b -SA1COp49m8: ; EOR # - addr_I_8br - EORMacro8b -SA1COp49m16:; EOR # - addr_I_16br - EORMacro16b -SA1COp4Dm8: ; EOR a - addr_a_8br - EORMacro8b -SA1COp4Dm16:; EOR a - addr_a_16br - EORMacro16b -SA1COp4Fm8: ; EOR al - addr_al_8br - EORMacro8b -SA1COp4Fm16:; EOR al - addr_al_16br - EORMacro16b -SA1COp51m8: ; EOR(d),y - addr_BdBCy_8br - EORMacro8b -SA1COp51m16:; EOR(d),y - addr_BdBCy_16br - EORMacro16b -SA1COp52m8: ; EOR (d) - addr_BdB_8br - EORMacro8b -SA1COp52m16:; EOR (d) - addr_BdB_16br - EORMacro16b -SA1COp53m8: ; EOR(d,s),y - addr_BdCsBCy_8br - EORMacro8b -SA1COp53m16:; EOR(d,s),y - addr_BdCsBCy_16br - EORMacro16b -SA1COp55m8: ; EOR d,x - addr_dCx_8br - EORMacro8b -SA1COp55m16:; EOR d,x - addr_dCx_16br - EORMacro16b -SA1COp57m8: ; EOR [d],y - addr_LdLCy_8br - EORMacro8b -SA1COp57m16:; EOR [d],y - addr_LdLCy_16br - EORMacro16b -SA1COp59m8: ; EOR a,y - addr_aCy_8br - EORMacro8b -SA1COp59m16:; EOR a,y - addr_aCy_16br - EORMacro16b -SA1COp5Dm8: ; EORa,x - addr_aCx_8br - EORMacro8b -SA1COp5Dm16:; EORa,x - addr_aCx_16br - EORMacro16b -SA1COp5Fm8: ; EOR al,x - addr_alCx_8br - EORMacro8b -SA1COp5Fm16:; EOR al,x - addr_alCx_16br - EORMacro16b - - -SA1COp1Am8: ; INC A - addr_A_8brni - inc al - flagsetnz8bnel - addr_A_8bw - endloop -SA1COp1Am16:; INC A - addr_A_16brni - inc ax - flagsetnz16bnel - addr_A_16bw - endloop -SA1COpEEm8: ; INC a - addr_a_8brni - inc al - flagsetnz8bnel - addr_a_8bw - endloop -SA1COpEEm16:; INC a - addr_a_16brni - inc ax - flagsetnz16bnel - addr_a_16bw - endloop -SA1COpE6m8: ; INC d - addr_d_8brni - inc al - flagsetnz8bnel - addr_d_8bw - endloop -SA1COpE6m16:; INC d - addr_d_16brni - inc ax - flagsetnz16bnel - addr_d_16bw - endloop -SA1COpF6m8: ; INC d,x - addr_dCx_8brni - inc al - flagsetnz8bnel - addr_dCx_8bw - endloop -SA1COpF6m16:; INC d,x - addr_dCx_16brni - inc ax - flagsetnz16bnel - addr_dCx_16bw - endloop -SA1COpFEm8: ; INC a,x - addr_aCx_8brni - inc al - flagsetnz8bnel - addr_aCx_8bw - endloop -SA1COpFEm16:; INC a,x - addr_aCx_16brni - inc ax - flagsetnz16bnel - addr_aCx_16bw - endloop - - -SA1COpE8x8: ; INX i - inc byte[SA1xx] - mov al,[SA1xx] - flagsetnz8b - endloop -SA1COpE8x16:; INX i - inc word[SA1xx] - mov ax,[SA1xx] - flagsetnz16b - endloop -SA1COpC8x8: ; INY i - inc byte[SA1xy] - mov al,[SA1xy] - flagsetnz8b - endloop -SA1COpC8x16:; INY i - inc word[SA1xy] - mov ax,[SA1xy] - flagsetnz16b - endloop - -SA1COpDC: ; JML (a) - JMLMacro -SA1COp4C: ; JMP a - JMPMacro4C -SA1COp6C: ; JMP (a) - JMPMacro6C -SA1COp7C: ; JMP(a,x) - JMPMacro7C -SA1COp5C: ; JMP al - JMPMacro5C - -SA1COp22: ; JSL al - JSLMacro -SA1COp20: ; JSR a - JSRMacro20 -SA1COpFC: ; JSR(a,x) - JSRMacroFC - -SA1COpA1m8: ; LDA(d,x) - addr_BdCxB_8br - LDAMacro8b -SA1COpA1m16:; LDA(d,x) - addr_BdCxB_16br - LDAMacro16b -SA1COpA3m8: ; LDA d,s - addr_dCs_8br - LDAMacro8b -SA1COpA3m16:; LDA d,s - addr_dCs_16br - LDAMacro16b -SA1COpA5m8: ; LDA d - addr_d_8br - LDAMacro8b -SA1COpA5m16:; LDA d - addr_d_16br - LDAMacro16b -SA1COpA7m8: ; LDA [d] - addr_LdL_8br - LDAMacro8b -SA1COpA7m16:; LDA [d] - addr_LdL_16br - LDAMacro16b -SA1COpA9m8: ; LDA # - addr_I_8br - LDAMacro8b -SA1COpA9m16:; LDA # - addr_I_16br - LDAMacro16b -SA1COpADm8: ; LDA a - addr_a_8br - LDAMacro8b -SA1COpADm16:; LDA a - addr_a_16br - LDAMacro16b -SA1COpAFm8: ; LDA al - addr_al_8br - LDAMacro8b -SA1COpAFm16:; LDA al - addr_al_16br - LDAMacro16b -SA1COpB1m8: ; LDA(d),y - addr_BdBCy_8br - LDAMacro8b -SA1COpB1m16:; LDA(d),y - addr_BdBCy_16br - LDAMacro16b -SA1COpB2m8: ; LDA (d) - addr_BdB_8br - LDAMacro8b -SA1COpB2m16:; LDA (d) - addr_BdB_16br - LDAMacro16b -SA1COpB3m8: ; LDA(d,s),y - addr_BdCsBCy_8br - LDAMacro8b -SA1COpB3m16:; LDA(d,s),y - addr_BdCsBCy_16br - LDAMacro16b -SA1COpB5m8: ; LDA d,x - addr_dCx_8br - LDAMacro8b -SA1COpB5m16:; LDA d,x - addr_dCx_16br - LDAMacro16b -SA1COpB7m8: ; LDA [d],y - addr_LdLCy_8br - LDAMacro8b -SA1COpB7m16:; LDA [d],y - addr_LdLCy_16br - LDAMacro16b -SA1COpB9m8: ; LDA a,y - addr_aCy_8br - LDAMacro8b -SA1COpB9m16:; LDA a,y - addr_aCy_16br - LDAMacro16b -SA1COpBDm8: ; LDA a,x - addr_aCx_8br - LDAMacro8b -SA1COpBDm16:; LDA a,x - addr_aCx_16br - LDAMacro16b -SA1COpBFm8: ; LDA al,x - addr_alCx_8br - LDAMacro8b -SA1COpBFm16:; LDA al,x - addr_alCx_16br - LDAMacro16b - -SA1COpA2x8: ; LDX # - addr_I_8br - LDXMacro8b -SA1COpA2x16:; LDX # - addr_I_16br - LDXMacro16b -SA1COpA6x8: ; LDX d - addr_d_8br - LDXMacro8b -SA1COpA6x16:; LDX d - addr_d_16br - LDXMacro16b -SA1COpAEx8: ; LDX a - addr_a_8br - LDXMacro8b -SA1COpAEx16:; LDX a - addr_a_16br - LDXMacro16b -SA1COpB6x8: ; LDX d,y - addr_dCy_8br - LDXMacro8b -SA1COpB6x16:; LDX d,y - addr_dCy_16br - LDXMacro16b -SA1COpBEx8: ; LDX a,y - addr_aCy_8br - LDXMacro8b -SA1COpBEx16:; LDX a,y - addr_aCy_16br - LDXMacro16b - -SA1COpA0x8: ; LDY # - addr_I_8br - LDYMacro8b -SA1COpA0x16:; LDY # - addr_I_16br - LDYMacro16b -SA1COpA4x8: ; LDY d - addr_d_8br - LDYMacro8b -SA1COpA4x16:; LDY d - addr_d_16br - LDYMacro16b -SA1COpACx8: ; LDY a - addr_a_8br - LDYMacro8b -SA1COpACx16:; LDY a - addr_a_16br - LDYMacro16b -SA1COpB4x8: ; LDY d,x - addr_dCx_8br - LDYMacro8b -SA1COpB4x16:; LDY d,x - addr_dCx_16br - LDYMacro16b -SA1COpBCx8: ; LDY a,x - addr_aCx_8br - LDYMacro8b -SA1COpBCx16:; LDY a,x - addr_aCx_16br - LDYMacro16b - -SA1COp46m8: ; LSR d - addr_d_8brni - LSRMacro8b - addr_d_8bw - endloop -SA1COp46m16:; LSR d - addr_d_16brni - LSRMacro16b - addr_d_16bw - endloop -SA1COp4Am8: ; LSR A - addr_A_8brni - LSRMacro8b - addr_A_8bw - endloop -SA1COp4Am16:; LSR A - addr_A_16brni - LSRMacro16b - addr_A_16bw - endloop -SA1COp4Em8: ; LSR a - addr_a_8brni - LSRMacro8b - addr_a_8bw - endloop -SA1COp4Em16:; LSR a - addr_a_16brni - LSRMacro16b - addr_a_16bw - endloop -SA1COp56m8: ; LSR d,x - addr_dCx_8brni - LSRMacro8b - addr_dCx_8bw - endloop -SA1COp56m16:; LSR d,x - addr_dCx_16brni - LSRMacro16b - addr_dCx_16bw - endloop -SA1COp5Em8: ; LSRa,x - addr_aCx_8brni - LSRMacro8b - addr_aCx_8bw - endloop -SA1COp5Em16:; LSRa,x - addr_aCx_16brni - LSRMacro16b - addr_aCx_16bw - endloop - -SA1COp54: ; MVN SA1xya - MVNMacro -SA1COp44: ; MVP SA1xya - MVPMacro - -SA1COpEA: ; NOP i - endloop - -SA1COp01m8: ; ORA(d,x) - addr_BdCxB_8br - ORAMacro8b -SA1COp01m16:; ORA(d,x) - addr_BdCxB_16br - ORAMacro16b -SA1COp03m8: ; ORA d,s - addr_dCs_8br - ORAMacro8b -SA1COp03m16:; ORA d,s - addr_dCs_16br - ORAMacro16b -SA1COp05m8: ; ORA d - addr_d_8br - ORAMacro8b -SA1COp05m16:; ORA d - addr_d_16br - ORAMacro16b -SA1COp07m8: ; ORA [d] - addr_LdL_8br - ORAMacro8b -SA1COp07m16:; ORA [d] - addr_LdL_16br - ORAMacro16b -SA1COp09m8: ; ORA # - addr_I_8br - ORAMacro8b -SA1COp09m16:; ORA # - addr_I_16br - ORAMacro16b -SA1COp0Dm8: ; ORA a - addr_a_8br - ORAMacro8b -SA1COp0Dm16:; ORA a - addr_a_16br - ORAMacro16b -SA1COp0Fm8: ; ORA al - addr_al_8br - ORAMacro8b -SA1COp0Fm16:; ORA al - addr_al_16br - ORAMacro16b -SA1COp11m8: ; ORA(d),y - addr_BdBCy_8br - ORAMacro8b -SA1COp11m16:; ORA(d),y - addr_BdBCy_16br - ORAMacro16b -SA1COp12m8: ; ORA(d) - addr_BdB_8br - ORAMacro8b -SA1COp12m16:; ORA(d) - addr_BdB_16br - ORAMacro16b -SA1COp13m8: ; ORA(d,s),y - addr_BdCsBCy_8br - ORAMacro8b -SA1COp13m16:; ORA(d,s),y - addr_BdCsBCy_16br - ORAMacro16b -SA1COp15m8: ; ORA d,x - addr_dCx_8br - ORAMacro8b -SA1COp15m16:; ORA d,x - addr_dCx_16br - ORAMacro16b -SA1COp17m8: ; ORA [d],y - addr_LdLCy_8br - ORAMacro8b -SA1COp17m16:; ORA [d],y - addr_LdLCy_16br - ORAMacro16b -SA1COp19m8: ; ORA a,y - addr_aCy_8br - ORAMacro8b -SA1COp19m16:; ORA a,y - addr_aCy_16br - ORAMacro16b -SA1COp1Dm8: ; ORA a,x - addr_aCx_8br - ORAMacro8b -SA1COp1Dm16:; ORA a,x - addr_aCx_16br - ORAMacro16b -SA1COp1Fm8: ; ORA al,x - addr_alCx_8br - ORAMacro8b -SA1COp1Fm16:; ORA al,x - addr_alCx_16br - ORAMacro16b - -SA1COpF4: ; PEA s - PEAMacro -SA1COpD4: ; PEI s - PEIMacro -SA1COp62: ; PER s - PERMacro - -SA1COp48m8: ; PHA s - PUSHMacro8b [SA1xa] -SA1COp48m16:; PHA s - PUSHMacro16b [SA1xa], [SA1xa+1] -SA1COp8B: ; PHB s - PUSHMacro8b [SA1xdb] -SA1COp0B: ; PHD s - PUSHMacro16b [SA1xd], [SA1xd+1] -SA1COp4B: ; PHK s - PUSHMacro8b [SA1xpb] -SA1COp08: ; PHP s - PUSHMacro8bp -SA1COpDAx8: ; PHX s - PUSHMacro8b [SA1xx] -SA1COpDAx16:; PHX s - PUSHMacro16b [SA1xx], [SA1xx+1] -SA1COp5Ax8: ; PHY s - PUSHMacro8b [SA1xy] -SA1COp5Ax16:; PHY s - PUSHMacro16b [SA1xy], [SA1xy+1] - -SA1COp68m8: ; PLA s - POPMacro8b [SA1xa] -SA1COp68m16:; PLA s - POPMacro16b [SA1xa], [SA1xa+1] -SA1COpAB: ; PLB s - POPMacro8b [SA1xdb] -SA1COp2B: ; PLD s - POPMacro16bd [SA1xd], [SA1xd+1] -SA1COp28: ; PLP s - POPMacroP -SA1COpFAx8: ; PLX s - POPMacro8b [SA1xx] -SA1COpFAx16:; PLX s - POPMacro16b [SA1xx], [SA1xx+1] -SA1COp7Ax8: ; PLY s - POPMacro8b [SA1xy] -SA1COp7Ax16:; PLY s - POPMacro16b [SA1xy], [SA1xy+1] - -SA1COpC2: ; REP # - REPMacro - -SA1COp26m8: ; ROL d - addr_d_8brni - ROLMacro8b - addr_d_8bw - endloop -SA1COp26m16:; ROL d - addr_d_16brni - ROLMacro16b - addr_d_16bw - endloop -SA1COp2Am8: ; ROL A - addr_A_8brni - ROLMacro8b - addr_A_8bw - endloop -SA1COp2Am16:; ROL A - addr_A_16brni - ROLMacro16b - addr_A_16bw - endloop -SA1COp2Em8: ; ROL a - addr_a_8brni - ROLMacro8b - addr_a_8bw - endloop -SA1COp2Em16:; ROL a - addr_a_16brni - ROLMacro16b - addr_a_16bw - endloop -SA1COp36m8: ; ROL d,x - addr_dCx_8brni - ROLMacro8b - addr_dCx_8bw - endloop -SA1COp36m16:; ROL d,x - addr_dCx_16brni - ROLMacro16b - addr_dCx_16bw - endloop -SA1COp3Em8: ; ROL a,x - addr_aCx_8brni - ROLMacro8b - addr_aCx_8bw - endloop -SA1COp3Em16:; ROL a,x - addr_aCx_16brni - ROLMacro16b - addr_aCx_16bw - endloop - -SA1COp66m8: ; ROR d - addr_d_8brni - RORMacro8b - addr_d_8bw - endloop -SA1COp66m16:; ROR d - addr_d_16brni - RORMacro16b - addr_d_16bw - endloop -SA1COp6Am8: ; ROR A - addr_A_8brni - RORMacro8b - addr_A_8bw - endloop -SA1COp6Am16:; ROR A - addr_A_16brni - RORMacro16b - addr_A_16bw - endloop -SA1COp6Em8: ; ROR a - addr_a_8brni - RORMacro8b - addr_a_8bw - endloop -SA1COp6Em16:; ROR a - addr_a_16brni - RORMacro16b - addr_a_16bw - endloop -SA1COp76m8: ; ROR d,x - addr_dCx_8brni - RORMacro8b - addr_dCx_8bw - endloop -SA1COp76m16:; ROR d,x - addr_dCx_16brni - RORMacro16b - addr_dCx_16bw - endloop -SA1COp7Em8: ; ROR a,x - addr_aCx_8brni - RORMacro8b - addr_aCx_8bw - endloop -SA1COp7Em16:; ROR a,x - addr_aCx_16brni - RORMacro16b - addr_aCx_16bw - endloop - -SA1COp40: ; RTI s - mov byte[intrset],2 - RTIMacro -SA1COp6B: ; RTL s - RTLMacro -SA1COp60: ; RTS s - RTSMacro - -SA1COpE1m8nd: ; SBC(d,x) - addr_BdCxB_8br - SBCMacro8bnd -SA1COpE1m16nd: ; SBC(d,x) - addr_BdCxB_16br - SBCMacro16bnd -SA1COpE1m8d: ; SBC(d,x) - addr_BdCxB_8br - SBCMacro8bd -SA1COpE1m16d: ; SBC(d,x) - addr_BdCxB_16br - SBCMacro16bd -SA1COpE3m8nd: ; SBC d,s - addr_dCs_8br - SBCMacro8bnd -SA1COpE3m16nd: ; SBC d,s - addr_dCs_16br - SBCMacro16bnd -SA1COpE3m8d: ; SBC d,s - addr_dCs_8br - SBCMacro8bd -SA1COpE3m16d: ; SBC d,s - addr_dCs_16br - SBCMacro16bd -SA1COpE5m8nd: ; SBC d - addr_d_8br - SBCMacro8bnd -SA1COpE5m16nd: ; SBC d - addr_d_16br - SBCMacro16bnd -SA1COpE5m8d: ; SBC d - addr_d_8br - SBCMacro8bd -SA1COpE5m16d: ; SBC d - addr_d_16br - SBCMacro16bd -SA1COpE7m8nd: ; SBC [d] - addr_LdL_8br - SBCMacro8bnd -SA1COpE7m16nd: ; SBC [d] - addr_LdL_16br - SBCMacro16bnd -SA1COpE7m8d: ; SBC [d] - addr_LdL_8br - SBCMacro8bd -SA1COpE7m16d: ; SBC [d] - addr_LdL_16br - SBCMacro16bd -SA1COpE9m8nd: ; SBC # - addr_I_8br - SBCMacro8bnd -SA1COpE9m16nd: ; SBC # - addr_I_16br - SBCMacro16bnd -SA1COpE9m8d: ; SBC # - addr_I_8br - SBCMacro8bd -SA1COpE9m16d: ; SBC # - addr_I_16br - SBCMacro16bd -SA1COpEDm8nd: ; SBC a - addr_a_8br - SBCMacro8bnd -SA1COpEDm16nd: ; SBC a - addr_a_16br - SBCMacro16bnd -SA1COpEDm8d: ; SBC a - addr_a_8br - SBCMacro8bd -SA1COpEDm16d: ; SBC a - addr_a_16br - SBCMacro16bd -SA1COpEFm8nd: ; SBC al - addr_al_8br - SBCMacro8bnd -SA1COpEFm16nd: ; SBC al - addr_al_16br - SBCMacro16bnd -SA1COpEFm8d: ; SBC al - addr_al_8br - SBCMacro8bd -SA1COpEFm16d: ; SBC al - addr_al_16br - SBCMacro16bd -SA1COpF1m8nd: ; SBC(d),y - addr_BdBCy_8br - SBCMacro8bnd -SA1COpF1m16nd: ; SBC(d),y - addr_BdBCy_16br - SBCMacro16bnd -SA1COpF1m8d: ; SBC(d),y - addr_BdBCy_8br - SBCMacro8bd -SA1COpF1m16d: ; SBC(d),y - addr_BdBCy_16br - SBCMacro16bd -SA1COpF2m8nd: ; SBC (d) - addr_BdB_8br - SBCMacro8bnd -SA1COpF2m16nd: ; SBC (d) - addr_BdB_16br - SBCMacro16bnd -SA1COpF2m8d: ; SBC (d) - addr_BdB_8br - SBCMacro8bd -SA1COpF2m16d: ; SBC (d) - addr_BdB_16br - SBCMacro16bd -SA1COpF3m8nd: ; SBC(d,s),y - addr_BdCsBCy_8br - SBCMacro8bnd -SA1COpF3m16nd: ; SBC(d,s),y - addr_BdCsBCy_16br - SBCMacro16bnd -SA1COpF3m8d: ; SBC(d,s),y - addr_BdCsBCy_8br - SBCMacro8bd -SA1COpF3m16d: ; SBC(d,s),y - addr_BdCsBCy_16br - SBCMacro16bd -SA1COpF5m8nd: ; SBC d,x - addr_dCx_8br - SBCMacro8bnd -SA1COpF5m16nd: ; SBC d,x - addr_dCx_16br - SBCMacro16bnd -SA1COpF5m8d: ; SBC d,x - addr_dCx_8br - SBCMacro8bd -SA1COpF5m16d: ; SBC d,x - addr_dCx_16br - SBCMacro16bd -SA1COpF7m8nd: ; SBC [d],y - addr_LdLCy_8br - SBCMacro8bnd -SA1COpF7m16nd: ; SBC [d],y - addr_LdLCy_16br - SBCMacro16bnd -SA1COpF7m8d: ; SBC [d],y - addr_LdLCy_8br - SBCMacro8bd -SA1COpF7m16d: ; SBC [d],y - addr_LdLCy_16br - SBCMacro16bd -SA1COpF9m8nd: ; SBC a,y - addr_aCy_8br - SBCMacro8bnd -SA1COpF9m16nd: ; SBC a,y - addr_aCy_16br - SBCMacro16bnd -SA1COpF9m8d: ; SBC a,y - addr_aCy_8br - SBCMacro8bd -SA1COpF9m16d: ; SBC a,y - addr_aCy_16br - SBCMacro16bd -SA1COpFDm8nd: ; SBC a,x - addr_aCx_8br - SBCMacro8bnd -SA1COpFDm16nd: ; SBC a,x - addr_aCx_16br - SBCMacro16bnd -SA1COpFDm8d: ; SBC a,x - addr_aCx_8br - SBCMacro8bd -SA1COpFDm16d: ; SBC a,x - addr_aCx_16br - SBCMacro16bd -SA1COpFFm8nd: ; SBC al,x - addr_alCx_8br - SBCMacro8bnd -SA1COpFFm16nd: ; SBC al,x - addr_alCx_16br - SBCMacro16bnd -SA1COpFFm8d: ; SBC al,x - addr_alCx_8br - SBCMacro8bd -SA1COpFFm16d: ; SBC al,x - addr_alCx_16br - SBCMacro16bd - -SA1COp38: ; SEC i - mov dword[Sflagc],0FFh - endloop -SA1COpF8: ; SED i - or dl,08h - mov bl,dl - mov edi,[SA1tablead+ebx*4] - endloop -SA1COp78: ; SEI i - or dl,04h - endloop - -SA1COpE2: ; SEP # - SEPMacro - -SA1COp81m8: ; STA(d,x) - STAMacro8b - addr_BdCxB_8bw - endloop -SA1COp81m16:; STA(d,x) - STAMacro16b - addr_BdCxB_16bw - endloop -SA1COp83m8: ; STA d,s - STAMacro8b - addr_dCs_8bw - endloop -SA1COp83m16:; STA d,s - STAMacro16b - addr_dCs_16bw - endloop -SA1COp85m8: ; STA d - STAMacro8b - addr_d_8bw - endloop -SA1COp85m16:; STA d - STAMacro16b - addr_d_16bw - endloop -SA1COp87m8: ; STA [d] - STAMacro8b - addr_LdL_8bw - endloop -SA1COp87m16:; STA [d] - STAMacro16b - addr_LdL_16bw - endloop -SA1COp8Dm8: ; STA a - STAMacro8b - addr_a_8bw - endloop -SA1COp8Dm16:; STA a - STAMacro16b - addr_a_16bw - endloop -SA1COp8Fm8: ; STA al - STAMacro8b - addr_al_8bw - endloop -SA1COp8Fm16:; STA al - STAMacro16b - addr_al_16bw - endloop -SA1COp91m8: ; STA(d),y - STAMacro8b - addr_BdBCy_8bw - endloop -SA1COp91m16:; STA(d),y - STAMacro16b - addr_BdBCy_16bw - endloop -SA1COp92m8: ; STA (d) - STAMacro8b - addr_BdB_8bw - endloop -SA1COp92m16:; STA (d) - STAMacro16b - addr_BdB_16bw - endloop -SA1COp93m8: ; STA(d,s),y - STAMacro8b - addr_BdCsBCy_8bw - endloop -SA1COp93m16:; STA(d,s),y - STAMacro16b - addr_BdCsBCy_16bw - endloop -SA1COp95m8: ; STA d,x - STAMacro8b - addr_dCx_8bw - endloop -SA1COp95m16:; STA d,x - STAMacro16b - addr_dCx_16bw - endloop -SA1COp97m8: ; STA [d],y - STAMacro8b - addr_LdLCy_8bw - endloop -SA1COp97m16:; STA [d],y - STAMacro16b - addr_LdLCy_16bw - endloop -SA1COp99m8: ; STA a,y - STAMacro8b - addr_aCy_8bw - endloop -SA1COp99m16:; STA a,y - STAMacro16b - addr_aCy_16bw - endloop -SA1COp9Dm8: ; STA a,x - STAMacro8b - addr_aCx_8bw - endloop -SA1COp9Dm16:; STA a,x - STAMacro16b - addr_aCx_16bw - endloop -SA1COp9Fm8: ; STA al,x - STAMacro8b - addr_alCx_8bw - endloop -SA1COp9Fm16:; STA al,x - STAMacro16b - addr_alCx_16bw - endloop - -SA1COp86x8: ; STX d - STXMacro8b - addr_d_8bw - endloop -SA1COp86x16:; STX d - STXMacro16b - addr_d_16bw - endloop -SA1COp8Ex8: ; STX a - STXMacro8b - addr_a_8bw - endloop -SA1COp8Ex16:; STX a - STXMacro16b - addr_a_16bw - endloop -SA1COp96x8: ; STX d,y - STXMacro8b - addr_dCy_8bw - endloop -SA1COp96x16:; STX d,y - STXMacro16b - addr_dCy_16bw - endloop - -SA1COp84x8: ; STY d - STYMacro8b - addr_d_8bw - endloop -SA1COp84x16:; STY d - STYMacro16b - addr_d_16bw - endloop -SA1COp8Cx8: ; STY a - STYMacro8b - addr_a_8bw - endloop -SA1COp8Cx16:; STY a - STYMacro16b - addr_a_16bw - endloop -SA1COp94x8: ; STYd,x - STYMacro8b - addr_dCx_8bw - endloop -SA1COp94x16:; STYd,x - STYMacro16b - addr_dCx_16bw - endloop - -SA1COpDB: ; STP i - dec esi - endloop - -SA1COp64m8: ; STZ d - xor al,al - addr_d_8bw - endloop -SA1COp64m16:; STZ d - xor eax,eax - addr_d_16bw - endloop -SA1COp74m8: ; STZ d,x - xor al,al - addr_dCx_8bw - endloop -SA1COp74m16:; STZ d,x - xor eax,eax - addr_dCx_16bw - endloop -SA1COp9Cm8: ; STZ a - xor al,al - addr_a_8bw - endloop -SA1COp9Cm16:; STZ a - xor eax,eax - addr_a_16bw - endloop -SA1COp9Em8: ; STZ a,x - xor al,al - addr_aCx_8bw - endloop -SA1COp9Em16:; STZ a,x - xor eax,eax - addr_aCx_16bw - endloop - -SA1COp14m8: ; TRB d - addr_d_8brni - mov cl,[SA1xa] - test dword[Sflagnz],18000h - jz .notflags - or dword[Sflagnz],10000h -.notflags - test cl,al - jz .zero - mov word[Sflagnz],1 - not cl - and al,cl - addr_d_8bw - endloop -.zero - mov word[Sflagnz],0 - not cl - and al,cl - addr_d_8bw - endloop -SA1COp14m16:; TRB d - addr_d_16brni - mov cx,[SA1xa] - test dword[Sflagnz],18000h - jz .notflags - or dword[Sflagnz],10000h -.notflags - test cx,ax - jz .zero - mov word[Sflagnz],1 - not cx - and ax,cx - addr_d_16bw - endloop -.zero - mov word[Sflagnz],0 - not cx - and ax,cx - addr_d_16bw - endloop -SA1COp1Cm8: ; TRB a - addr_a_8brni - mov cl,[SA1xa] - test dword[Sflagnz],18000h - jz .notflags - or dword[Sflagnz],10000h -.notflags - test cl,al - jz .zero - mov word[Sflagnz],1 - not cl - and al,cl - addr_a_8bw - endloop -.zero - mov word[Sflagnz],0 - not cl - and al,cl - addr_a_8bw - endloop -SA1COp1Cm16:; TRB a - addr_a_16brni - mov cx,[SA1xa] - test dword[Sflagnz],18000h - jz .notflags - or dword[Sflagnz],10000h -.notflags - test cx,ax - jz .zero - mov word[Sflagnz],1 - not cx - and ax,cx - addr_a_16bw - endloop -.zero - mov word[Sflagnz],0 - not cx - and ax,cx - addr_a_16bw - endloop - -SA1COp04m8: ; TSB d - addr_d_8brni - mov cl,[SA1xa] - test dword[Sflagnz],18000h - jz .notflags - or dword[Sflagnz],10000h -.notflags - test al,cl - jz .zero - mov word[Sflagnz],1 - or al,cl - addr_d_8bw - endloop -.zero - mov word[Sflagnz],0 - or al,cl - addr_d_8bw - endloop -SA1COp04m16:; TSB d - addr_d_16brni - mov cx,[SA1xa] - test dword[Sflagnz],18000h - jz .notflags - or dword[Sflagnz],10000h -.notflags - test ax,cx - jz .zero - mov word[Sflagnz],1 - or ax,cx - addr_d_16bw - endloop -.zero - mov word[Sflagnz],0 - or ax,cx - addr_d_16bw - endloop -SA1COp0Cm8: ; TSB a - addr_a_8brni - mov cl,[SA1xa] - test dword[Sflagnz],18000h - jz .notflags - or dword[Sflagnz],10000h -.notflags - test al,cl - jz .zero - mov word[Sflagnz],1 - or al,cl - addr_a_8bw - endloop -.zero - mov word[Sflagnz],0 - or al,cl - addr_a_8bw - endloop -SA1COp0Cm16:; TSB a - addr_a_16brni - mov cx,[SA1xa] - test dword[Sflagnz],18000h - jz .notflags - or dword[Sflagnz],10000h -.notflags - test ax,cx - jz .zero - mov word[Sflagnz],1 - or ax,cx - addr_a_16bw - endloop -.zero - mov word[Sflagnz],0 - or ax,cx - addr_a_16bw - endloop - -SA1COpAAx8: ; TAX i - mov al,[SA1xa] - mov [SA1xx],al - flagsetnz8b - endloop -SA1COpAAx16:; TAX i - mov ax,[SA1xa] - mov [SA1xx],ax - flagsetnz16b - endloop -SA1COpA8x8: ; TAY i - mov al,[SA1xa] - mov [SA1xy],al - flagsetnz8b - endloop -SA1COpA8x16:; TAY i - mov ax,[SA1xa] - mov [SA1xy],ax - flagsetnz16b - endloop -SA1COp5B: ; TCD i - mov ax,[SA1xa] - mov [SA1xd],ax - call SA1UpdateDPage - flagsetnz16b - endloop -SA1COp1B: ; TCS i - mov ax,[SA1xa] - mov [SA1xs],ax - endloop -SA1COp7B: ; TDC i - mov ax,[SA1xd] - mov [SA1xa],ax - flagsetnz16b - endloop -SA1COp3B: ; TSC i - mov ax,[SA1xs] - mov [SA1xa],ax - flagsetnz16b - endloop -SA1COpBAx8: ; TSX i - mov al,[SA1xs] - mov [SA1xx],al - flagsetnz8b - endloop -SA1COpBAx16:; TSX i - mov ax,[SA1xs] - mov [SA1xx],ax - flagsetnz16b - endloop -SA1COp8Am8: ; TSA1xa i - mov al,[SA1xx] - mov [SA1xa],al - flagsetnz8b - endloop -SA1COp8Am16:; TXA i - mov ax,[SA1xx] - mov [SA1xa],ax - flagsetnz16b - endloop -SA1COp9A: ; TXS i - mov ax,[SA1xx] - mov [SA1xs],ax - test byte[xe],1 - jnz .emul - endloop -.emul - mov byte[SA1xs+1],1 - endloop -SA1COp9Bx8: ; TSA1xy i - mov al,[SA1xx] - mov [SA1xy],al - flagsetnz8b - endloop -SA1COp9Bx16:; TSA1xy i - mov ax,[SA1xx] - mov [SA1xy],ax - flagsetnz16b - endloop -SA1COp98m8: ; TYA i - mov al,[SA1xy] - mov [SA1xa],al - flagsetnz8b - endloop -SA1COp98m16:; TYA i - mov ax,[SA1xy] - mov [SA1xa],ax - flagsetnz16b - endloop -SA1COpBBx8: ; TYX i - mov al,[SA1xy] - mov [SA1xx],al - flagsetnz8b - endloop -SA1COpBBx16:; TYX i - mov ax,[SA1xy] - mov [SA1xx],ax - flagsetnz16b - endloop - -SA1COpCB: ; WAI i - WAIMacro - -SA1COpEB: ; XBA i - mov ah,[SA1xa] - mov al,[SA1xa+1] - mov [SA1xa],ax - flagsetnz8b - endloop - -SA1COpFB: ; XCE i - XCEMacro - -SA1COp42: ; WDM - inc esi - endloop - - diff --git a/tools/zsnes/src/cpu/spc700.asm b/tools/zsnes/src/cpu/spc700.asm deleted file mode 100644 index 4926b76..0000000 --- a/tools/zsnes/src/cpu/spc700.asm +++ /dev/null @@ -1,2649 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 DSPMem,spcWptr,disablespcclr,SPCSkipXtraROM,cycpbl,spcRptr -EXTSYM spc700read,dspWptr,curexecstate,tableadc - -%include "cpu/regsw.mac" -%include "cpu/spcdef.inc" -%include "cpu/spcaddr.inc" - -; SPC 700 Emulation by _Demo_ -; Version 2.0 - -; Little info on functions : -; Write byte : write al at [ebx] -; Read byte : read al from [ebx] -; update timer : update the timers, called every scanline - -SECTION .data - -ALIGN32 - -;spcBuffer times 65536*4 db 0 ; The buffer of brr blocks... 4 bits -> 16 bits -;spcPrevbf times 65536 db 0 ; SPC PrevX compare buffer -NEWSYM SPCRAM, times 65472 db 0FFh ; Pointer to the SPC's RAM -; copy #1 -; THE SPC ROM :) - db 0CDh,0EFh,0BDh,0E8h,000h,0C6h,01Dh,0D0h,0FCh,08Fh,0AAh,0F4h,08Fh,0BBh,0F5h,078h - db 0CCh,0F4h,0D0h,0FBh,02Fh,019h,0EBh,0F4h,0D0h,0FCh,07Eh,0F4h,0D0h,00Bh,0E4h,0F5h - db 0CBh,0F4h,0D7h,000h,0FCh,0D0h,0F3h,0ABh,001h,010h,0EFh,07Eh,0F4h,010h,0EBh,0BAh - db 0F6h,0DAh,000h,0BAh,0F4h,0C4h,0F4h,0DDh,05Dh,0D0h,0DBh,01Fh,000h,000h,0C0h,0FFh - db 0AAh,0BBh,0CCh,0DDh,0EEh,0FFh,000h,011h,022h,033h,044h,055h,066h,077h,088h,099h - -NEWSYM spcPCRam, - dd 0 ; Program Counter (with SPCRAM added) -NEWSYM spcA, - db 0 ; The A register (general purpose) - db 0 - db 0 - db 0 -NEWSYM spcX, - db 0 ; The X register (general purpose) - db 0 - db 0 - db 0 -NEWSYM spcY, - db 0 ; The Y register (general purpose) - db 0 - db 0 - db 0 -NEWSYM spcP, - db 0 ; The processor status byte (Removed for each flags) - db 0 ; NZ are not always processed... - db 0 - db 0 -NEWSYM spcNZ, - db 0 ; The processor NZ flag (little speed up hack :) ) - db 0 - db 0 - db 0 - - -;spcNF db 0 ; The Negative Flag 128 or 127 -;spcOF db 0 ; The Overflow Flag 64 or 191 -;spcDPF db 0 ; Direct Page Flag 32 or 223 -;spcUF db 0 ; The Unused Flag ? 16 or 239 -;spcHCF db 0 ; The Half Carry Flag 8 or 247 -;spcIF db 0 ; The interrupt flag 4 or 251 -;spcZF db 0 ; The Zero Flag 2 or 253 -;spcCF db 0 ; The Carry Flag 1 or 254 - -NEWSYM spcS, dd 1FFh ; The stack pointer (always from 100 to 1FF) (added Ram) -NEWSYM spcRamDP, dd 0 ; The direct page pointer -NEWSYM spcCycle, dd 0 ; The Cycle Counter -NEWSYM reg1read, db 0 ; read from 65816 -NEWSYM reg2read, db 0 ; read from 65816 -NEWSYM reg3read, db 0 ; read from 65816 -NEWSYM reg4read, db 0 ; read from 65816 -NEWSYM timeron, db 0 ; timer0 on -NEWSYM timincr0, db 0 ; # of ticks before incrementing -NEWSYM timincr1, db 0 ; # of ticks before incrementing -NEWSYM timincr2, db 0 ; # of ticks before incrementing -NEWSYM timinl0, db 0 ; ticks left before incrementing -NEWSYM timinl1, db 0 ; ticks left before incrementing -NEWSYM timinl2, db 0 ; ticks left before incrementing -NEWSYM timrcall, db 0 ; alternating bit 0 to correctly timer timer1 & 2 to 8000hz - -NEWSYM spcextraram, times 64 db 0 ; extra ram, used for tcall - -NEWSYM FutureExpandS, times 256-64 db 0 - -spcsave equ $-SPCRAM -; pharos equ hack *sigh* -NEWSYM PHspcsave, dd spcsave - -; copy #2 -NEWSYM SPCROM - db 0CDh,0EFh,0BDh,0E8h,000h,0C6h,01Dh,0D0h,0FCh,08Fh,0AAh,0F4h,08Fh,0BBh,0F5h,078h - db 0CCh,0F4h,0D0h,0FBh,02Fh,019h,0EBh,0F4h,0D0h,0FCh,07Eh,0F4h,0D0h,00Bh,0E4h,0F5h - db 0CBh,0F4h,0D7h,000h,0FCh,0D0h,0F3h,0ABh,001h,010h,0EFh,07Eh,0F4h,010h,0EBh,0BAh - db 0F6h,0DAh,000h,0BAh,0F4h,0C4h,0F4h,0DDh,05Dh,0D0h,0DBh,01Fh,000h,000h,0C0h,0FFh - -SECTION .text - -%macro WriteByte 0 - cmp ebx,0ffh+SPCRAM - ja %%extramem - cmp ebx,0f0h+SPCRAM - jb %%normalmem - sub ebx,SPCRAM - call dword near [spcWptr+ebx*4-0f0h*4] - jmp %%finished -%%extramem - cmp ebx,0ffc0h+SPCRAM - jb %%normalmem - mov [spcextraram+ebx-0FFC0h-SPCRAM],al - test byte[SPCRAM+0F1h],80h - jnz %%finished -; push ecx -; mov cl,[DSPMem+06Ch] -; test cl,20h -; pop ecx -; jz .finished -%%normalmem - mov [ebx],al -%%finished -%endmacro - -%macro ReadByte 0 - cmp ebx,0f0h+SPCRAM - jb %%normalmem2 - cmp ebx,0ffh+SPCRAM - ja %%normalmem - sub ebx,SPCRAM - call dword near [spcRptr+ebx*4-0f0h*4] - jmp %%finished -%%normalmem -; cmp ebx,0ffc0h+SPCRAM -; jb .rnormalmem2 -; test byte[DSPMem+6Ch],10h -; jz .rnormalmem2 -; mov al,[spcextraram+ebx-0FFC0h-SPCRAM] -; jmp .rfinished -%%normalmem2 - mov al,[ebx] -%%finished -%endmacro - -%macro ReadByte2 0 - cmp ebx,0f0h+SPCRAM - jb %%normalmem2 - cmp ebx,0ffh+SPCRAM - ja %%normalmem - sub ebx,SPCRAM - call dword near [spcRptr+ebx*4-0f0h*4] - add ebx,SPCRAM - jmp %%finished -%%normalmem -; cmp ebx,0ffc0h+SPCRAM -; jb .rnormalmem2 -; test byte[DSPMem+6Ch],10h -; jz .rnormalmem2 -; mov al,[spcextraram+ebx-0FFC0h-SPCRAM] -; jmp .rfinished -%%normalmem2 - mov al,[ebx] -%%finished -%endmacro - -SECTION .data -NEWSYM timer2upd, dd 0 -SECTION .text - -; This function is called every scanline (262*60 times/sec) -; Make it call 0.9825 times (393/400) (skip when divisible by 64) -; 2 8khz, 1 64khz - -NEWSYM updatetimer -; inc dword[timer2upd] -; cmp dword[timer2upd],400 -; jne .nowrap -; mov dword[timer2upd],0 -;.nowrap -;.again -; mov eax,dword[timer2upd] -; shr eax,6 -; shl eax,6 -; cmp eax,dword[timer2upd] -; je near .noin2d - - -.another - xor byte[timrcall],01h - test byte[timrcall],01h - jz near .notimer - test byte[timeron],1 - jz .noin0 - dec byte[timinl0] - jnz .noin0 - inc byte[SPCRAM+0FDh] - mov al,[timincr0] - mov [timinl0],al - cmp byte[SPCRAM+0FDh],1 - jne .noin0 - reenablespc - mov dword[cycpbl],0 -.noin0 - test byte[timeron],2 - jz .noin1 - dec byte[timinl1] - jnz .noin1 - inc byte[SPCRAM+0FEh] - mov al,[timincr1] - mov [timinl1],al - cmp byte[SPCRAM+0FEh],1 - jne .noin1 - reenablespc - mov dword[cycpbl],0 -.noin1 -.notimer - test byte[timeron],4 - jz near .noin2d2 - dec byte[timinl2] - jnz .noin2 - inc byte[SPCRAM+0FFh] - mov al,[timincr2] - mov [timinl2],al - cmp byte[SPCRAM+0FFh],1 - jne .noin2 - reenablespc - mov dword[cycpbl],0 -.noin2 - dec byte[timinl2] - jnz .noin2b - inc byte[SPCRAM+0FFh] - mov al,[timincr2] - mov [timinl2],al - cmp byte[SPCRAM+0FFh],1 - jne .noin2b - reenablespc - mov dword[cycpbl],0 -.noin2b - dec byte[timinl2] - jnz .noin2c - inc byte[SPCRAM+0FFh] - mov al,[timincr2] - mov [timinl2],al - cmp byte[SPCRAM+0FFh],1 - jne .noin2c - reenablespc - mov dword[cycpbl],0 -.noin2c - dec byte[timinl2] - jnz .noin2d - inc byte[SPCRAM+0FFh] - mov al,[timincr2] - mov [timinl2],al - cmp byte[SPCRAM+0FFh],1 - jne .noin2d - reenablespc - mov dword[cycpbl],0 -.noin2d -.noin2d2 -; inc dword[timer2upd] -; cmp dword[timer2upd],31 -; jne .nowrap -; mov dword[timer2upd],0 -; jmp .again -;.nowrap - - inc dword[timer2upd] - cmp dword[timer2upd],60 - jne .noanother - mov dword[timer2upd],0 - jmp .another -.noanother - - ret - - -; SPC Write Registers -; DO NOT MODIFY DX OR ECX! -NEWSYM SPCRegF0 - mov [SPCRAM+0F0h],al - ret -NEWSYM SPCRegF1 - cmp byte[disablespcclr],1 - je .No23Clear - test al,10h - jz .No01Clear - mov byte[SPCRAM+0F4h],0 - mov byte[SPCRAM+0F5h],0 -.No01Clear - test al,20h - jz .No23Clear - mov byte[SPCRAM+0F6h],0 - mov byte[SPCRAM+0F7h],0 -.No23Clear - cmp byte[SPCSkipXtraROM],1 - je near .AfterNoROM - test al,80h - jz .NoROM - push eax - push ebx - xor eax,eax -.loopa - mov bl,[SPCROM+eax] - mov [SPCRAM+0FFC0h+eax],bl - inc eax - cmp eax,040h - jne .loopa - pop ebx - pop eax - jmp .AfterNoROM -.NoROM - push eax - push ebx - xor eax,eax -.loopb - mov bl,[spcextraram+eax] - mov [SPCRAM+0FFC0h+eax],bl - inc eax - cmp eax,040h - jne .loopb - pop ebx - pop eax -.AfterNoROM - mov [SPCRAM+0F1h],al - and al,0Fh - mov [timeron],al - ret -NEWSYM SPCRegF2 - mov [SPCRAM+0F2h],al - push eax - push ebx - xor eax,eax - mov al,[SPCRAM+0F2h] - mov bl,[DSPMem+eax] - mov [SPCRAM+0F3h],bl - pop ebx - pop eax - ret -NEWSYM SPCRegF3 - push ebx - xor ebx,ebx - mov bl,[SPCRAM+0F2h] - and bl,07fh - call dword near [dspWptr+ebx*4] - pop ebx - mov [SPCRAM+ebx],al - ret -NEWSYM SPCRegF4 - mov [reg1read],al - inc dword[spc700read] - ret -NEWSYM SPCRegF5 - mov [reg2read],al - inc dword[spc700read] - ret -NEWSYM SPCRegF6 - mov [reg3read],al - inc dword[spc700read] - ret -NEWSYM SPCRegF7 - mov [reg4read],al - inc dword[spc700read] - ret -NEWSYM SPCRegF8 - mov [SPCRAM+ebx],al - ret -NEWSYM SPCRegF9 - mov [SPCRAM+ebx],al - ret -NEWSYM SPCRegFA - mov [timincr0],al - test byte[timinl0],0FFh - jne .nowrite - mov [timinl0],al -.nowrite - mov [SPCRAM+ebx],al - ret -NEWSYM SPCRegFB - mov [timincr1],al - test byte[timinl1],0FFh - jne .nowrite - mov [timinl1],al -.nowrite - mov [SPCRAM+ebx],al - ret -NEWSYM SPCRegFC - mov [timincr2],al - test byte[timinl2],0FFh - jne .nowrite - mov [timinl2],al -.nowrite - mov [SPCRAM+ebx],al - ret -NEWSYM SPCRegFD - ret -NEWSYM SPCRegFE - ret -NEWSYM SPCRegFF - ret - -; SPC Read Registers -; DO NOT MODIFY ANY REG! -; return data true al -NEWSYM RSPCRegF0 - mov al,[SPCRAM+0f0h] - ret -NEWSYM RSPCRegF1 - mov al,[SPCRAM+0f1h] - ret -NEWSYM RSPCRegF2 - mov al,[SPCRAM+0f2h] - ret -NEWSYM RSPCRegF3 - mov al,[SPCRAM+0f3h] - ret -NEWSYM RSPCRegF4 - mov al,[SPCRAM+0f4h] - ret -NEWSYM RSPCRegF5 - mov al,[SPCRAM+0f5h] - ret -NEWSYM RSPCRegF6 - mov al,[SPCRAM+0f6h] - ret -NEWSYM RSPCRegF7 - mov al,[SPCRAM+0f7h] - ret -NEWSYM RSPCRegF8 - mov al,0 ;[SPCRAM+0f8h] - ret -NEWSYM RSPCRegF9 - mov al,0 ;[SPCRAM+0f9h] - ret -NEWSYM RSPCRegFA - mov al,[SPCRAM+0fah] - ret -NEWSYM RSPCRegFB - mov al,[SPCRAM+0fbh] - ret -NEWSYM RSPCRegFC - mov al,[SPCRAM+0fch] - ret - -NEWSYM RSPCRegFD - mov al,[SPCRAM+0fdh] - and al,0Fh - mov byte[SPCRAM+0fdh],0 - mov byte[spcnumread],0 - ret - -NEWSYM RSPCRegFE - mov al,[SPCRAM+0feh] - and al,0Fh - mov byte[SPCRAM+0feh],0 - mov byte[spcnumread],0 - ret - -NEWSYM RSPCRegFF - mov al,[SPCRAM+0ffh] - and al,0Fh - mov byte[SPCRAM+0ffh],0 - mov byte[spcnumread],0 - ret - -SECTION .data -NEWSYM spcnumread, db 0 -SECTION .text - -%macro SPCSetFlagnzc 0 - js .setsignflag - jz .setzeroflag - mov byte[spcNZ],1 - jc .setcarryflag - and byte[spcP],0FEh - ret -.setsignflag - mov byte[spcNZ],80h - jc .setcarryflag - and byte[spcP],0FEh - ret -.setzeroflag - mov byte[spcNZ],0 - jc .setcarryflag - and byte[spcP],0FEh - ret -.setcarryflag - or byte[spcP],1 - ret -%endmacro - -%macro SPCSetFlagnzcnoret 0 - js .setsignflag - jz .setzeroflag - mov byte[spcNZ],1 - jc .setcarryflag - and byte[spcP],0FEh - jmp .skipflags -.setsignflag - mov byte[spcNZ],80h - jc .setcarryflag - and byte[spcP],0FEh - jmp .skipflags -.setzeroflag - mov byte[spcNZ],0 - jc .setcarryflag - and byte[spcP],0FEh - jmp .skipflags -.setcarryflag - or byte[spcP],1 -.skipflags -%endmacro - -%macro SPCSetFlagnvhzc 0 - lahf - js .setsignflag - jz .setzeroflag - mov byte[spcNZ],1 - jo .setoverflowflag - and byte[spcP],0BFh - jmp .skipflags -.setsignflag - mov byte[spcNZ],80h - jo .setoverflowflag - and byte[spcP],0BFh - jmp .skipflags -.setzeroflag - mov byte[spcNZ],0 - jo .setoverflowflag - and byte[spcP],0BFh - jmp .skipflags -.setoverflowflag - or byte[spcP],40h -.skipflags - and byte[spcP],0F6h - test ah,01h - jz .noCarry - or byte[spcP],1 -.noCarry - test ah,10h - jz .nohf - or byte[spcP],8 -.nohf - ret -%endmacro - -%macro SPCSetFlagnvhzcnoret 0 - lahf - js .setsignflag - jz .setzeroflag - mov byte[spcNZ],1 - jo .setoverflowflag - and byte[spcP],0BFh - jmp .skipflags -.setsignflag - mov byte[spcNZ],80h - jo .setoverflowflag - and byte[spcP],0BFh - jmp .skipflags -.setzeroflag - mov byte[spcNZ],0 - jo .setoverflowflag - and byte[spcP],0BFh - jmp .skipflags -.setoverflowflag - or byte[spcP],40h -.skipflags - and byte[spcP],0F6h - test ah,01h - jz .noCarry - or byte[spcP],1 -.noCarry - test ah,10h - jz .nohf - or byte[spcP],8 -.nohf -%endmacro - -;************************************************ -; Misc Opcodes -;************************************************ -NEWSYM Op00 ; NOP - ret -NEWSYM OpEF ; SLEEP standby SLEEP mode ......... - dec ebp - ret -NEWSYM OpFF ; STOP standby STOP mode ......... - inc dword[spc700read] - dec ebp - ret -NEWSYM Op9F ; XCN A A(7-4) <-> A(3-0) N......Z. - ror byte[spcA],4 - mov al,[spcA] - mov [spcNZ],al - ret - -;************************************************ -; Branch Stuff -;************************************************ -NEWSYM Op10 ; BPL Branch on N=0 - test byte[spcNZ],128 - jz .branch - spcbrancher -NEWSYM Op30 ; BMI Branch on N=1 - test byte[spcNZ],128 - jnz .branch - spcbrancher -NEWSYM Op50 ; BVC Branch on V=0 - test byte[spcP],64 - jz .branch - spcbrancher -NEWSYM Op70 ; BVS Branch on V=1 - test byte[spcP],64 - jnz .branch - spcbrancher -NEWSYM Op90 ; BCC Branc on c=0 - test byte[spcP],1 - jz .branch - spcbrancher -NEWSYM OpB0 ; BCS Branch on C=1 - test byte[spcP],1 - jnz .branch - spcbrancher -NEWSYM OpD0 ; BNE branch on Z=0 - test byte[spcNZ],255 - jnz .branch - spcbrancher -NEWSYM OpF0 ; BEQ Branch on Z=1 - test byte[spcNZ],0FFh - jz .branch - spcbrancher -NEWSYM Op2F ; BRA rel branch always ... - movsx ebx,byte[ebp] - inc ebp - add ebp,ebx - ret - - -;************************************************ -; Clear/Set Flag bits -;************************************************ -; CLRP 20 1 2 clear direct page flag ..0..... -NEWSYM Op20 ; CLRP Clear direct page flag - and byte[spcP],11011111b - mov dword[spcRamDP],SPCRAM - ret -; SETP 40 1 2 set dorect page flag ..1..0.. -NEWSYM Op40 ; SETP Set Direct Page Flag (Also clear interupt flag?) - or byte[spcP],00100000b - and byte[spcP],11111011b - mov dword[spcRamDP],SPCRAM - add dword[spcRamDP],100h - ret -; CLRC 60 1 2 clear carry flag .......0 -NEWSYM Op60 ; CLRC Clear carry flag - and byte[spcP],11111110b - ret -; SETC 80 1 2 set carry flag .......1 -NEWSYM Op80 ; SETC Set carry flag - or byte[spcP],00000001b - ret -; EI A0 1 3 set interrup enable flag .....1.. -NEWSYM OpA0 ; EI set interrupt flag - or byte[spcP],00000100b - ret -; DI C0 1 3 clear interrup enable flag .....0.. -NEWSYM OpC0 ; DI clear interrupt flag - and byte[spcP],11111011b - ret -; CLRV E0 1 2 clear V and H .0..0... -NEWSYM OpE0 ; CLRV clear V and H - and byte[spcP],10110111b - ret -; NOTC ED 1 3 complement carry flag .......C -NEWSYM OpED ; NOTC complement carry flag .......C - xor byte[spcP],00000001b - ret - -;************************************************ -; TCALL instructions (Verified) -;************************************************ -NEWSYM Op01 ; TCALL 0 - spctcall 30 -NEWSYM Op11 ; TCALL 1 - spctcall 28 -NEWSYM Op21 ; TCALL 2 - spctcall 26 -NEWSYM Op31 ; TCALL 3 - spctcall 24 -NEWSYM Op41 ; TCALL 4 - spctcall 22 -NEWSYM Op51 ; TCALL 5 - spctcall 20 -NEWSYM Op61 ; TCALL 6 - spctcall 18 -NEWSYM Op71 ; TCALL 7 - spctcall 16 -NEWSYM Op81 ; TCALL 8 - spctcall 14 -NEWSYM Op91 ; TCALL 9 - spctcall 12 -NEWSYM OpA1 ; TCALL A - spctcall 10 -NEWSYM OpB1 ; TCALL B - spctcall 08 -NEWSYM OpC1 ; TCALL C - spctcall 06 -NEWSYM OpD1 ; TCALL D - spctcall 04 -NEWSYM OpE1 ; TCALL E - spctcall 02 -NEWSYM OpF1 ; TCALL F - spctcall 00 - -;************************************************ -; SET1 instructions (Verified) -;************************************************ -NEWSYM Op02 ; SET1 direct page bit 0 - set1 1 -NEWSYM Op22 ; SET1 direct page bit 1 - set1 2 -NEWSYM Op42 ; SET1 direct page bit 2 - set1 4 -NEWSYM Op62 ; SET1 direct page bit 3 - set1 8 -NEWSYM Op82 ; SET1 direct page bit 4 - set1 16 -NEWSYM OpA2 ; SET1 direct page bit 5 - set1 32 -NEWSYM OpC2 ; SET1 direct page bit 6 - set1 64 -NEWSYM OpE2 ; SET1 direct page bit 7 - set1 128 - -;************************************************ -; CLR1 instructions (Verified) -;************************************************ -NEWSYM Op12 ; CLR1 direct page bit 0 - clr1 255-1 -NEWSYM Op32 ; CLR1 direct page bit 1 - clr1 255-2 -NEWSYM Op52 ; CLR1 direct page bit 2 - clr1 255-4 -NEWSYM Op72 ; CLR1 direct page bit 3 - clr1 255-8 -NEWSYM Op92 ; CLR1 direct page bit 4 - clr1 255-16 -NEWSYM OpB2 ; CLR1 direct page bit 5 - clr1 255-32 -NEWSYM OpD2 ; CLR1 direct page bit 6 - clr1 255-64 -NEWSYM OpF2 ; CLR1 direct page bit 7 - clr1 255-128 - -;************************************************ -; BBS instructions (Verified) -;************************************************ -NEWSYM Op03 ; BBS direct page bit 0 - bbs 1 -NEWSYM Op23 ; BBS direct page bit 1 - bbs 2 -NEWSYM Op43 ; BBS direct page bit 2 - bbs 4 -NEWSYM Op63 ; BBS direct page bit 3 - bbs 8 -NEWSYM Op83 ; BBS direct page bit 4 - bbs 16 -NEWSYM OpA3 ; BBS direct page bit 5 - bbs 32 -NEWSYM OpC3 ; BBS direct page bit 6 - bbs 64 -NEWSYM OpE3 ; BBS direct page bit 7 - bbs 128 - -;************************************************ -; BBC instructions (Verified) -;************************************************ -NEWSYM Op13 ; BBC direct page bit 0 - bbc 1 -NEWSYM Op33 ; BBC direct page bit 1 - bbc 2 -NEWSYM Op53 ; BBC direct page bit 2 - bbc 4 -NEWSYM Op73 ; BBC direct page bit 3 - bbc 8 -NEWSYM Op93 ; BBC direct page bit 4 - bbc 16 -NEWSYM OpB3 ; BBC direct page bit 5 - bbc 32 -NEWSYM OpD3 ; BBC direct page bit 6 - bbc 64 -NEWSYM OpF3 ; BBC direct page bit 7 - bbc 128 - -;************************************************ -; OR A,instructions -;************************************************ -NEWSYM Op04 ; OR A,dp A <- A OR (dp) N.....Z. - SPCaddr_DP - SPC_OR_A -NEWSYM Op14 ; OR A,dp+X A <- A OR (dp+X) N.....Z. - SPCaddr_DP_X - SPC_OR_A -NEWSYM Op05 ; OR A,labs A <- A OR (abs) N.....Z. - SPCaddr_LABS - SPC_OR_A -NEWSYM Op15 ; OR A,labs+x A <- A OR (abs+X) N.....Z. - SPCaddr_LABS_X - SPC_OR_A -NEWSYM Op06 ; OR A,(X) A <- A OR (X) N.....Z. - SPCaddr__X_ - SPC_OR_A -NEWSYM Op16 ; OR A,labs+Y A <- A OR (abs+Y) N......Z. - SPCaddr_LABS_Y - SPC_OR_A -NEWSYM Op07 ; OR A,(dp+X) A <- A OR ((dp+X+1)(dp+X)) N......Z. - SPCaddr_bDP_Xb - SPC_OR_A -NEWSYM Op17 ; OR A,(dp)+Y A <- A OR ((dp+1)(dp)+Y) N......Z. - SPCaddr_bDPb_Y - SPC_OR_A -NEWSYM Op08 ; OR A,#inm A <- A OR inm N......Z. - mov al,[ebp] - inc ebp - SPC_OR_A - -;************************************************ -; AND A, instructions -;************************************************ -NEWSYM Op24 ; AND A,dp A <- A AND (dp) N.....Z. - SPCaddr_DP - SPC_AND_A -NEWSYM Op34 ; AND A,dp+x A <- A AND (dp+X) N.....Z. - SPCaddr_DP_X - SPC_AND_A -NEWSYM Op25 ; AND A,labs A <- A AND (abs) N.....Z. - SPCaddr_LABS - SPC_AND_A -NEWSYM Op35 ; AND A,labs+X A <- A AND (abs+X) N.....Z. - SPCaddr_LABS_X - SPC_AND_A -NEWSYM Op26 ; AND A,(X) A <- A AND (X) N......Z. - SPCaddr__X_ - SPC_AND_A -NEWSYM Op36 ; AND A,labs+Y A <- A AND (abs+Y) N......Z. - SPCaddr_LABS_Y - SPC_AND_A -NEWSYM Op27 ; AND A,(dp+X) A <- A AND ((dp+X+1)(dp+X)) N......Z. - SPCaddr_bDP_Xb - SPC_AND_A -NEWSYM Op37 ; AND A,(dp)+Y A <- A AND ((dp+1)(dp)+Y) N......Z. - SPCaddr_bDPb_Y - SPC_AND_A -NEWSYM Op28 ; AND A,#inm A <- A AND inm N......Z. - mov al,[ebp] - inc ebp - SPC_AND_A - -;************************************************ -; EOR A, instructions -;************************************************ -NEWSYM Op44 ; EOR A,dp A <- A EOR (dp) N.....Z. - SPCaddr_DP - SPC_EOR_A -NEWSYM Op54 ; EOR A,dp+x A <- A EOR (dp+X) N.....Z. - SPCaddr_DP_X - SPC_EOR_A -NEWSYM Op45 ; EOR A,labs A <- A EOR (abs) N.....Z. - SPCaddr_LABS - SPC_EOR_A -NEWSYM Op55 ; EOR A,labs+X A <- A EOR (abs+X) N.....Z. - SPCaddr_LABS_X - SPC_EOR_A -NEWSYM Op46 ; EOR A,(X) A <- A EOR (X) N......Z. - SPCaddr__X_ - SPC_EOR_A -NEWSYM Op56 ; EOR A,labs+Y A <- A EOR (abs+Y) N......Z. - SPCaddr_LABS_Y - SPC_EOR_A -NEWSYM Op47 ; EOR A,(dp+X) A <- A EOR ((dp+X+1)(dp+X)) N......Z. - SPCaddr_bDP_Xb - SPC_EOR_A -NEWSYM Op57 ; EOR A,(dp)+Y A <- A EOR ((dp+1)(dp)+Y) N......Z. - SPCaddr_bDPb_Y - SPC_EOR_A -NEWSYM Op48 ; EOR A,#inm A <- A EOR inm N......Z. - mov al,[ebp] - inc ebp - SPC_EOR_A - -;************************************************ -; CMP A, instructions -;************************************************ -NEWSYM Op64 ; CMP A,dp A-(dp) N.....ZC - SPCaddr_DP - SPC_CMP_A -NEWSYM Op74 ; CMP A,dp+x A-(dp+X) N.....ZC - SPCaddr_DP_X - SPC_CMP_A -NEWSYM Op65 ; CMP A,labs A-(abs) N.....ZC - SPCaddr_LABS - SPC_CMP_A -NEWSYM Op75 ; CMP A,labs+X A-(abs+X) N.....ZC - SPCaddr_LABS_X - SPC_CMP_A -NEWSYM Op66 ; CMP A,(X) A-(X) N......ZC - SPCaddr__X_ - SPC_CMP_A -NEWSYM Op76 ; CMP A,labs+Y A-(abs+Y) N......ZC - SPCaddr_LABS_Y - SPC_CMP_A -NEWSYM Op67 ; CMP A,(dp+X) A-((dp+X+1)(dp+X)) N......ZC - SPCaddr_bDP_Xb - SPC_CMP_A -NEWSYM Op77 ; CMP A,(dp)+Y A-((dp+1)(dp)+Y) N......ZC - SPCaddr_bDPb_Y - SPC_CMP_A -NEWSYM Op68 ; CMP A,#inm A-inm N......ZC - mov al,[ebp] - inc ebp - SPC_CMP_A - -;************************************************ -; ADC A, instructions -;************************************************ -NEWSYM Op84 ; ADC A,dp A <- A+(dp)+C NV..H.ZC - SPCaddr_DP - SPC_ADC_A -NEWSYM Op94 ; ADC A,dp+x A <- A+(dp+X)+C NV..H.ZC - SPCaddr_DP_X - SPC_ADC_A -NEWSYM Op85 ; ADC A,labs A <- A+(abs)+C NV..H.ZC - SPCaddr_LABS - SPC_ADC_A -NEWSYM Op95 ; ADC A,labs+X A <- A+(abs+X)+C NV..H.ZC - SPCaddr_LABS_X - SPC_ADC_A -NEWSYM Op86 ; ADC A,(X) A <- A+(X)+C NV..H..ZC - SPCaddr__X_ - SPC_ADC_A -NEWSYM Op96 ; ADC A,labs+Y A <- A+(abs+Y)+C NV..H..ZC - SPCaddr_LABS_Y - SPC_ADC_A -NEWSYM Op87 ; ADC A,(dp+X) A <- A+((dp+X+1)(dp+X)) NV..H..ZC - SPCaddr_bDP_Xb - SPC_ADC_A -NEWSYM Op97 ; ADC A,(dp)+Y A <- A+((dp+1)(dp)+Y) NV..H..ZC - SPCaddr_bDPb_Y - SPC_ADC_A -NEWSYM Op88 ; ADC A,#inm A <- A+inm+C NV..H..ZC - mov al,[ebp] - inc ebp - SPC_ADC_A - -;************************************************ -; SBC A, instructions -;************************************************ -NEWSYM OpA4 ; SBC A,dp A <- A-(dp)-!C NV..H.ZC - SPCaddr_DP - SPC_SBC_A -NEWSYM OpB4 ; SBC A,dp+x A <- A-(dp+X)-!C NV..H.ZC - SPCaddr_DP_X - SPC_SBC_A -NEWSYM OpA5 ; SBC A,labs A <- A-(abs)-!C NV..H.ZC - SPCaddr_LABS - SPC_SBC_A -NEWSYM OpB5 ; SBC A,labs+x A <- A-(abs+X)-!C NV..H.ZC - SPCaddr_LABS_X - SPC_SBC_A -NEWSYM OpA6 ; SBC A,(X) A <- A-(X)-!C NV..H..ZC - SPCaddr__X_ - SPC_SBC_A -NEWSYM OpB6 ; SBC A,labs+Y A <- A-(abs+Y)-!C NV..H..ZC - SPCaddr_LABS_Y - SPC_SBC_A -NEWSYM OpA7 ; SBC A,(dp+X) A <- A-((dp+X+1)(dp+X))-!C NV..H..ZC - SPCaddr_bDP_Xb - SPC_SBC_A -NEWSYM OpB7 ; SBC A,(dp)+Y A <- A-((dp+1)(dp)+Y)-!C NV..H..ZC - SPCaddr_bDPb_Y - SPC_SBC_A -NEWSYM OpA8 ; SBC A,#inm A <- A-inm-!C NV..H..ZC - mov al,[ebp] - inc ebp - SPC_SBC_A - -;************************************************ -; MOV A, instructions -;************************************************ -NEWSYM OpE4 ; MOV A,dp A <- (dp) N......Z - SPCaddr_DP - SPC_MOV_A -NEWSYM OpF4 ; MOV A,dp+x A <- (dp+X) N......Z - SPCaddr_DP_X - SPC_MOV_A -NEWSYM OpE5 ; MOV A,labs A <- (abs) N......Z - SPCaddr_LABS - SPC_MOV_A -NEWSYM OpF5 ; MOV A,labs+X A <- (abs+X) N......Z - SPCaddr_LABS_X - SPC_MOV_A -NEWSYM OpE6 ; MOV A,(X) A <- (X) N......Z - SPCaddr__X_ - SPC_MOV_A -NEWSYM OpF6 ; MOV A,labs+Y A <- (abs+Y) N......Z - SPCaddr_LABS_Y - SPC_MOV_A -NEWSYM OpE7 ; MOV A,(dp+X) A <- ((dp+X+1)(dp+X)) N......Z - SPCaddr_bDP_Xb - SPC_MOV_A -NEWSYM OpF7 ; MOV A,(dp)+Y A <- ((dp+1)(dp)+Y) N......Z - SPCaddr_bDPb_Y - SPC_MOV_A -NEWSYM OpE8 ; MOV A,#inm A <- inm N......Z - mov al,[ebp] - inc ebp - SPC_MOV_A - -;************************************************ -; DP,#imm instructions -;************************************************ - -%macro spcgetdp_imm 0 - mov bl,[ebp+1] - mov ah,[ebp] - add ebx,[spcRamDP] - ReadByte2 - add ebp,2 -%endmacro - -NEWSYM OpB8 ; SBC dp,#inm (dp) <- (dp)-inm-!C NV..H..ZC - spcgetdp_imm ; bl<-[ebp+1], ah<-[ebp], ebx+[spcRamDP],Readbyte,ebp+2 - mov cl,[spcP] - xor cl,1 - shr cl,1 - sbb al,ah - cmc - SPCSetFlagnvhzcnoret - WriteByte - ret - -NEWSYM Op98 ; ADC dp,#inm (dp) <- (dp)+inm+C NV..H..ZC - spcgetdp_imm ; bl<-[ebp+1], ah<-[ebp], ebx+[spcRamDP],Readbyte,ebp+2 - mov cl,[spcP] - shr cl,1 - adc al,ah - SPCSetFlagnvhzcnoret - WriteByte - ret - -NEWSYM Op78 ; CMP dp,#inm (dp)-inm N......ZC - mov bl,[ebp+1] - mov ah,[ebp] - add ebx,[spcRamDP] - ReadByte - add ebp,2 - cmp al,ah - cmc - SPCSetFlagnzcnoret - ret - -NEWSYM Op58 ; EOR dp,#inm (dp) <- (dp) EOR inm N......Z. - spcgetdp_imm ; bl<-[ebp+1], ah<-[ebp], ebx+[spcRamDP],Readbyte,ebp+2 - xor al,ah - mov [spcNZ], al - WriteByte - ret - -NEWSYM Op38 ; AND dp,#inm (dp) <- (dp) AND inm N......Z. - spcgetdp_imm ; bl<-[ebp+1], ah<-[ebp], ebx+[spcRamDP],Readbyte,ebp+2 - and al,ah - mov [spcNZ], al - WriteByte - ret - -NEWSYM Op18 ; OR dp,#inm (dp) <- (dp) OR inm N......Z. - spcgetdp_imm ; bl<-[ebp+1], ah<-[ebp], ebx+[spcRamDP],Readbyte,ebp+2 - or al,ah - mov [spcNZ],al - WriteByte - ret - -;************************************************ -; DP(D),DP(S) instructions -;************************************************ -%macro spcaddrDPbDb_DPbSb 1 - xor ecx,ecx - mov bl,[ebp+1] - mov cl,[ebp] - add ebx,[spcRamDP] - add ebp,2 - add ecx,[spcRamDP] - push ebx - ReadByte - mov ebx,ecx - mov cl,al -%1 - ReadByte - mov ah,al - mov al,cl - pop ebx -%endmacro - -NEWSYM Op09 ; OR dp(d),dp(s) (dp(d))<-(dp(d)) OR (dp(s)) N......Z. - spcaddrDPbDb_DPbSb Op09b: - or al,ah - mov [spcNZ], al - WriteByte - xor ecx,ecx - ret - -NEWSYM Op29 ; AND dp(d),dp(s) (dp(d))<-(dp(d)) AND (dp(s)) N......Z. - spcaddrDPbDb_DPbSb Op29b: - and al,ah - mov [spcNZ], al - WriteByte - xor ecx,ecx - ret - -NEWSYM Op49 ; EOR dp(d),dp(s) (dp(d))<-(dp(d)) EOR (dp(s)) N......Z. - spcaddrDPbDb_DPbSb Op49b: - xor al,ah - mov [spcNZ], al - WriteByte - xor ecx,ecx - ret - -NEWSYM Op69 ; CMP dp(d),dp(s) (dp(d))-(dp(s)) N......ZC - spcaddrDPbDb_DPbSb Op69b: - cmp al,ah - cmc - SPCSetFlagnzcnoret - xor ecx,ecx - ret - -NEWSYM Op89 ; ADC dp(d),dp(s) (dp(d))<-(dp(d))+(dp(s))+C NV..H..ZC - spcaddrDPbDb_DPbSb Op89b - mov cl,[spcP] - shr cl,1 - adc al,ah - SPCSetFlagnvhzcnoret - WriteByte - xor ecx,ecx - ret - -NEWSYM OpA9 ; SBC dp(d),dp(s) (dp(d))<-(dp(d))-(dp(s))-!C NV..H..ZC - spcaddrDPbDb_DPbSb OpA9b - mov cl,[spcP] - xor cl,1 - shr cl,1 - sbb al,ah - cmc - SPCSetFlagnvhzcnoret - WriteByte - xor ecx,ecx - ret - -NEWSYM OpFA ; MOV dp(d),dp(s) (dp(d)) <- (dp(s)) ........ - xor ecx,ecx - mov bl,[ebp+1] - mov cl,[ebp] - add ebx,[spcRamDP] - add ecx,[spcRamDP] - add ebp,2 - push ebx - mov ebx,ecx - ReadByte - pop ebx - WriteByte - xor ecx,ecx - ret - -;************************************************ -; (X),(Y) instructions -;************************************************ -%macro spcaddrDPbXb_bYb 1 - mov bl,[spcY] - add ebx,[spcRamDP] - ReadByte - xor ebx,ebx - mov ah,al - mov bl,[spcX] - add ebx,[spcRamDP] -%1 - ReadByte -%endmacro - -NEWSYM Op19 ; OR (X),(Y) (X) <- (X) OR (Y) N......Z. - spcaddrDPbXb_bYb Op19b: - or al, ah - mov [spcNZ],al - WriteByte - ret - -NEWSYM Op39 ; AND (X),(Y) (X) <- (X) AND (Y) N......Z. - spcaddrDPbXb_bYb Op39b: - and al, ah - mov [spcNZ],al - WriteByte - ret - - -NEWSYM Op59 ; EOR (X),(Y) (X) <- (X) EOR (Y) N......Z. - spcaddrDPbXb_bYb Op59b: - xor al, ah - mov [spcNZ],al - WriteByte - ret - -NEWSYM Op79 ; CMP (X),(Y) (X)-(Y) N......ZC - spcaddrDPbXb_bYb Op79b: - cmp al, ah - cmc - SPCSetFlagnzc - -NEWSYM Op99 ; ADC (X),(Y) (X) <- (X)+(Y)+C NV..H..ZC - spcaddrDPbXb_bYb Op99b: - mov cl,[spcP] - shr cl,1 - adc al,ah - SPCSetFlagnvhzcnoret - WriteByte - ret - -NEWSYM OpB9 ; SBC (X),(Y) (X) <- (X)-(Y)-!C NV..H..ZC - spcaddrDPbXb_bYb OpB9b: - mov cl,[spcP] - xor cl,1 - shr cl,1 - sbb al,ah - cmc - SPCSetFlagnvhzcnoret - WriteByte - ret - -;************************************************ -; MOV ,A instructions (Verified) -;************************************************ - -NEWSYM OpC4 ; MOV dp,A A -> (dp) ........ - mov bl,[ebp] - mov al, [spcA] - add ebx,[spcRamDP] - inc ebp - WriteByte - ret - -NEWSYM OpD4 ; MOV dp+x,A A -> (dp+X) ........ - mov bl,[ebp] - add bl,[spcX] - mov al, [spcA] - add ebx,[spcRamDP] - inc ebp - WriteByte - ret - -NEWSYM OpC5 ; MOV labs,A A -> (abs) ........ - mov bx,[ebp] - mov al, [spcA] - add ebp,2 - add ebx,SPCRAM - WriteByte - ret - -NEWSYM OpD5 ; MOV labs+X,A A -> (abs+X) ........ - mov bl,[spcX] - add bx,[ebp] - mov al, [spcA] - add ebp,2 - add ebx,SPCRAM - WriteByte - ret - -NEWSYM OpC6 ; MOV (X),A A -> (X) ........ - mov bl,[spcX] - add ebx,[spcRamDP] - mov al, [spcA] - WriteByte - ret - -NEWSYM OpD6 ; MOV labs+Y,A A -> (abs+Y) ........ - mov bl,[spcY] - mov al, [spcA] - add bx,[ebp] - add ebp,2 - add ebx,SPCRAM - WriteByte - ret - -NEWSYM OpC7 ; MOV (dp+X),A A -> ((dp+X+1)(dp+X)) ........ - mov bl,[ebp] - add bl,[spcX] - xor eax,eax - add ebx,[spcRamDP] - inc ebp - mov ax, [ebx] - mov ebx,eax - add ebx,SPCRAM - mov al, [spcA] - WriteByte - ret - -NEWSYM OpD7 ; MOV (dp)+Y,A A -> ((dp+1)(dp)+Y) ........ - mov bl,[ebp] - xor eax,eax - add ebx,[spcRamDP] - inc ebp - mov ax, [ebx] - add ax,[spcY] - mov ebx,eax - add ebx,SPCRAM - mov al, [spcA] - WriteByte - ret - -;************************************************ -; MOV instructions (Verified) -;************************************************ - -NEWSYM OpD8 ; MOV dp,X X -> (dp) ........ - mov bl,[ebp] - mov al, [spcX] - add ebx,[spcRamDP] - inc ebp - WriteByte - ret - -NEWSYM OpF8 ; MOV X,dp X <- (dp) N......Z - mov bl,[ebp] - inc ebp - add ebx,[spcRamDP] - ReadByte - mov [spcX], al - mov [spcNZ],al - ret - -NEWSYM OpC9 ; MOV labs,X X -> (abs) ........ - mov bx,[ebp] - mov al, [spcX] - add ebp,2 - add ebx,SPCRAM - WriteByte - ret - -NEWSYM OpE9 ; MOV X,labs X <- (abs) N......Z - mov bx,[ebp] - add ebx,SPCRAM - ReadByte - add ebp,2 - mov [spcX], al - mov [spcNZ],al - ret - -NEWSYM OpD9 ; MOV dp+Y,X X -> (dp+Y) ........ - mov bl,[ebp] - mov al, [spcX] - add bl,[spcY] - inc ebp - add ebx,[spcRamDP] - WriteByte - ret - -NEWSYM OpF9 ; MOV X,dp+Y X <- (dp+Y) N......Z - mov bl,[ebp] - add bl,[spcY] - inc ebp - add ebx,[spcRamDP] - ReadByte - mov [spcX], al - mov [spcNZ],al - ret - -NEWSYM OpCB ; MOV dp,Y Y -> (dp) ........ - mov bl,[ebp] - mov al, [spcY] - add ebx,[spcRamDP] - inc ebp - WriteByte - ret - -NEWSYM OpEB ; MOV Y,dp Y <- (dp) N......Z - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - ReadByte - mov [spcY], al - mov [spcNZ],al - ret - -NEWSYM OpDB ; MOV dp+X,Y X -> (dp+X) ........ - mov bl,[ebp] - add bl,[spcX] - mov al, [spcY] - add ebx,[spcRamDP] - inc ebp - WriteByte - ret - -NEWSYM OpFB ; MOV Y,dp+X Y <- (dp+X) N......Z - mov bl,[ebp] - add bl,[spcX] - inc ebp - add ebx,[spcRamDP] - ReadByte - mov [spcY], al - mov [spcNZ],al - ret - -NEWSYM OpCC ; MOV labs,Y Y -> (abs) ........ - mov bx,[ebp] - mov al, [spcY] - add ebp,2 - add ebx,SPCRAM - WriteByte - ret - -NEWSYM OpEC ; MOV Y,labs Y <- (abs) N......Z - mov bx,[ebp] - add ebx,SPCRAM - ReadByte - add ebp,2 - mov [spcY],al - mov [spcNZ],al - ret - -NEWSYM Op5D ; MOV X,A X <- A N......Z - mov al,[spcA] - mov [spcX],al - mov [spcNZ],al - ret - -NEWSYM Op7D ; MOV A,X A <- X N......Z - mov al,[spcX] - mov [spcA],al - mov [spcNZ],al - ret - -NEWSYM Op8D ; MOV Y,#inm Y <- inm N......Z - mov bl,[ebp] - mov [spcY],bl - inc ebp - mov [spcNZ],bl - ret - -NEWSYM OpCD ; MOV X,#inm X <- inm N......Z - mov bl,[ebp] - mov [spcX],bl - inc ebp - mov [spcNZ],bl - ret - -NEWSYM Op8F ; MOV dp,#inm (dp) <- inm ........ - mov bl,[ebp+1] - mov al,[ebp] - add ebx,[spcRamDP] - add ebp,2 - WriteByte - ret - -NEWSYM Op9D ; MOV X,SP X <- SP N......Z - mov al,[spcS] - mov [spcX],al - mov [spcNZ],al - ret - -NEWSYM OpBD ; MOV SP,X SP <- X ........ - mov al,[spcX] - mov [spcS],al - ret - -NEWSYM OpDD ; MOV A,Y A <- Y N......Z - mov al,[spcY] - mov [spcA],al - mov [spcNZ],al - ret - - -NEWSYM OpFD ; MOV Y,A Y <- A N......Z - mov al,[spcA] - mov [spcY],al - mov [spcNZ],al - ret - -NEWSYM OpAF ; MOV (X)+,A A -> (X) with auto inc ........ - mov bl,[spcX] - add ebx,[spcRamDP] - mov al, [spcA] - inc byte[spcX] - WriteByte - ret - -NEWSYM OpBF ; MOV A,(X)+ A <- (X) with auto inc N......Z - mov bl,[spcX] - add ebx,[spcRamDP] - ReadByte - inc byte[spcX] - mov [spcA],al - mov [spcNZ],al - ret - - -;************************************************ -; CMP instructions (Verified) -;************************************************ - -NEWSYM OpC8 ; CMP X,#inm X-inm N......ZC - mov bl,[ebp] - inc ebp - cmp [spcX],bl - cmc - SPCSetFlagnzc - -NEWSYM OpAD ; CMP Y,#inm Y-inm N......ZC - mov bl,[ebp] - inc ebp - cmp [spcY],bl - cmc - SPCSetFlagnzc - -NEWSYM Op1E ; CMP X,labs X-(abs) N......ZC - mov bx,[ebp] - add ebp,2 - add ebx,SPCRAM - ReadByte - cmp byte[spcX], al - cmc - SPCSetFlagnzc - -NEWSYM Op3E ; CMP X,dp X-(dp) N......ZC - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - ReadByte - cmp byte[spcX], al - cmc - SPCSetFlagnzc - -NEWSYM Op5E ; CMP Y,labs Y-(abs) N......ZC - mov bx,[ebp] - add ebx,SPCRAM - ReadByte - add ebp,2 - cmp byte[spcY], al - cmc - SPCSetFlagnzc - -NEWSYM Op7E ; CMP Y,dp Y-(dp) N......ZC - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - ReadByte - cmp byte[spcY], al - cmc - SPCSetFlagnzc - -;************************************************ -; Word Instructions (Verified) -;************************************************ - -NEWSYM Op1A ; DECW dp Decrement dp memory pair N......Z. - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - inc ebx - ReadByte2 - mov ah,al - dec ebx -NEWSYM Op1AB - ReadByte2 - dec ax - test ax,8000h - jnz .YesNeg - cmp ax,0000h - je .YesZero - mov byte[spcNZ],1 - jmp .SkipFlag -.YesNeg - mov byte[spcNZ],80h - jmp .SkipFlag -.YesZero - mov byte[spcNZ],0 -.SkipFlag - push ebx - WriteByte - pop ebx -NEWSYM Op1Ab - inc ebx - mov al,ah - WriteByte - ret - -NEWSYM Op3A ; INCW dp Increment dp memory pair N......Z. - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - inc ebx - ReadByte2 - mov ah,al - dec ebx -NEWSYM Op3AB - ReadByte2 - inc ax - test ax,8000h - jnz .YesNeg - cmp ax,0000h - je .YesZero - mov byte[spcNZ],1 - jmp .SkipFlag -.YesNeg - mov byte[spcNZ],80h - jmp .SkipFlag -.YesZero - mov byte[spcNZ],0 -.SkipFlag - push ebx - WriteByte - pop ebx -NEWSYM Op3Ab - inc ebx - mov al,ah - WriteByte - ret - -; looks like there is the Carry flag checked in op5a.. - -NEWSYM Op5A ; CMPW YA,dp YA - (dp+1)(dp) N......ZC - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - inc ebx - ReadByte2 - mov ah,al - dec ebx -NEWSYM Op5AB - ReadByte - mov bl,[spcA] - mov bh,[spcY] - cmp bx,ax - cmc - SPCSetFlagnzc - -NEWSYM Op7A ; ADDW YA,dp YA <- YA + (dp+1)(dp) NV..H..ZC - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - inc ebx - ReadByte2 - mov ah,al - dec ebx -NEWSYM Op7AB - ReadByte - mov bl,[spcA] - mov bh,[spcY] - add bx,ax - mov [spcA],bl - mov [spcY],bh - SPCSetFlagnvhzc - -NEWSYM Op9A ; SUBW YA,dp YA <- YA - (dp+1)(dp) NV..H..ZC - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - inc ebx - ReadByte2 - mov ah,al - dec ebx -NEWSYM Op9AB - ReadByte - mov bl,[spcA] - mov bh,[spcY] - sub bx,ax - cmc - mov [spcA],bl - mov [spcY],bh - SPCSetFlagnvhzc - -NEWSYM OpBA ; MOVW YA,dp YA - (dp+1)(dp) N......Z. - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - inc ebx - ReadByte2 - mov ah,al - dec ebx -NEWSYM OpBAb - ReadByte - mov [spcA],al - mov [spcY],ah - test ax,8000h - jnz .YesNeg - cmp ax,0000h - je .YesZero - mov byte[spcNZ],1 - ret -.YesNeg - mov byte[spcNZ],80h - ret -.YesZero - mov byte[spcNZ],0 - ret - -NEWSYM OpDA ; MOVW dp,YA (dp+1)(dp) - YA ......... - mov bl,[ebp] - mov al,[spcA] - add ebx,[spcRamDP] - inc ebp - push ebx - WriteByte - pop ebx - inc ebx - mov al,[spcY] -NEWSYM OpDAb - WriteByte - ret - -;************************************************ -; mem.bit instructions (Verified) -;************************************************ - -%macro spcaddrmembit 0 - mov bx,[ebp] - - mov cl,bh - add ebp,2 - shr cl,5 - and bx,1FFFh - -; mov cl,bl -; add ebp,2 -; shr bx,3 -; and cl,00000111b - - add ebx,SPCRAM - ReadByte - shr al,cl - and al,01h -%endmacro - -NEWSYM Op0A ; OR1 C,mem.bit C <- C OR (mem.bit) ........C - spcaddrmembit - or [spcP],al - ret - -NEWSYM Op2A ; OR1 C,/mem.bit C <- C OR !(mem.bit) ........C - spcaddrmembit - xor al,01h - or [spcP],al - ret - -NEWSYM Op4A ; AND1 C,mem.bit C <- C AND (mem.bit) ........C - mov bx,[ebp] - - mov cl,bh - add ebp,2 - shr cl,5 - and bx,1FFFh - -; mov cl,bl -; add ebp,2 -; shr bx,3 -; and cl,00000111b - - add ebx,SPCRAM - ReadByte - shr al,cl - or al,0FEh - and [spcP],al - ret - -NEWSYM Op6A ; AND1 C,/mem.bit C <- C AND !(mem.bit) ........C - mov bx,[ebp] - - mov cl,bh - add ebp,2 - shr cl,5 - and bx,1FFFh - -; mov cl,bl -; add ebp,2 -; shr bx,3 -; and cl,00000111b - - add ebx,SPCRAM - ReadByte - shr al,cl - or al,0FEh - xor al,01h - and [spcP],al - ret - -NEWSYM Op8A ; EOR1 C,mem.bit C <- C EOR (mem.bit) ........C - spcaddrmembit - xor [spcP],al - ret - -NEWSYM OpAA ; MOV1 C,mem.bit C <- (mem.bit) - spcaddrmembit - and byte[spcP],0FEh - or [spcP],al - ret - -NEWSYM OpCA ; MOV1 mem.bit,C C -> (mem.bit) ......... - mov bx,[ebp] - mov al,[spcP] - - mov cl,bh - mov ah,01h - shr cl,5 - and bx,1FFFh - -; mov cl,bl -; mov ah,01h -; and cl,00000111b -; shr bx,3 - - shl ah,cl - and al,01h - add ebp,2 - shl al,cl - add ebx,SPCRAM - ; al = carry flag positioned in correct location, ah = 1 positioned - mov cl,al - xor ah,0FFh - ReadByte2 - and al,ah - or al,cl - WriteByte - ret - -NEWSYM OpEA ; NOT1 mem.bit complement (mem.bit) ......... - mov bx,[ebp] - - mov cl,bh - mov ah,01h - shr cl,5 - and bx,1FFFh - -; mov cl,bl -; mov ah,01h -; and cl,00000111b -; shr bx,3 - - shl ah,cl - add ebp,2 - add ebx,SPCRAM - ReadByte2 - xor al,ah - WriteByte - ret - -;************************************************ -; Shift Instructions (Verified) -;************************************************ - -NEWSYM Op0B ; ASL dp C << (dp) <<0 N......ZC - mov bl,[ebp] - add ebx,[spcRamDP] - inc ebp - ReadByte2 - shl al,1 - SPCSetFlagnzcnoret - WriteByte - ret - -NEWSYM Op4B ; LSR dp 0 >> (dp) <> (dp+X) <> (abs) <> A <> (dp) <> (dp+X) <> (abs) <> A < -#include -#ifndef NCURSES -#include -#else -#include -#endif -#include "zpath.h" - -#ifdef __MSDOS__ -#include -#endif // __MSDOS__ - -#include "asm_call.h" - -// All of these should be in headers, people! - -extern unsigned char oamram[1024], SPCRAM[65472], DSPMem[256]; - -extern unsigned char curblank; -extern unsigned char curcyc; -extern unsigned char curypos; -extern unsigned char CurrentCPU; - -extern unsigned char soundon; -extern unsigned int cycpbl; - -extern unsigned short xpc, xa, xx, xy, xs, xd; -extern unsigned char xpb, xdb, xp, xe; - -extern void *snesmmap[256]; -extern void *snesmap2[256]; -extern char dmadata[]; - -extern unsigned char debuggeron; - -extern void (*memtabler8[256])(); - - -// SPC stuff - -extern unsigned char *spcPCRam; -extern unsigned char spcA, spcX, spcY, spcS, spcNZ, spcP; - - -// these really shouldn't be written in ASM... (they are in debugasm.asm) -extern unsigned char memtabler8_wrapper(unsigned char, unsigned short); -extern void memtablew8_wrapper(unsigned char, unsigned short, unsigned char); -extern void breakops_wrapper(void); - -extern void regaccessbankr8(); -extern void start65816(); -extern void endprog(); - -// should be in "zstate.h" -void debugloadstate(); -void statesaver(); - -char *ocname; -unsigned char addrmode[]; -char *spcnametab[]; -char *AddressTable[]; -unsigned char ArgumentTable[]; - - -/* -unsigned short debugh = 0; // debug head -unsigned short debugt = 0; // debug tail -unsigned short debugv = 0; // debug view -*/ -unsigned char debugds = 0; // debug disable (bit 0 = 65816, bit 1 = SPC) -unsigned int numinst = 0; // # of instructions - -unsigned char wx = 0, wy = 0, wx2 = 0, wy2 = 0; -unsigned char execut = 0; -unsigned char debstop = 0, debstop2 = 0, debstop3 = 0, debstop4 = 0; - -char debugsa1 = 0; -char skipdebugsa1 = 1; - -#define CP(n) (A_BOLD | COLOR_PAIR(n)) - -enum color_pair { - cp_white = 1, cp_magenta, cp_red, cp_cyan, cp_green, cp_yellow, - cp_white_on_blue, -}; - -WINDOW *debugwin; - -// can't get this to work right... -//#define CHECK (COLOR_PAIR(cp_white) | A_DIM | ACS_CKBOARD) -#define CHECK (CP(cp_white) | ' ') - -void debugloop(); - -void startdisplay(); -void nextopcode(); -void cleardisplay(); -void nextspcopcode(); -void SaveOAMRamLog(); -void debugdump(); -void out65816(); -void execnextop(); - -void traceops(unsigned count); -void SPCbreakops(unsigned short addr); - -unsigned char *findop(); -unsigned char *findoppage(); - -void startdebugger() { - static int firsttime = 1; - - curblank = 0x40; - debuggeron = 1; - -#ifdef __MSDOS__ - __dpmi_regs regs; - regs.x.ax = 0x0003; - __dpmi_int(0x10, ®s); -#endif // __MSDOS__ - - if (firsttime) { - initscr(); cbreak(); noecho(); - intrflush(stdscr, FALSE); - keypad(stdscr, TRUE); - - /* set up colors */ - start_color(); - init_pair(cp_white, COLOR_WHITE, COLOR_BLACK); - init_pair(cp_magenta, COLOR_MAGENTA, COLOR_BLACK); - init_pair(cp_red, COLOR_RED, COLOR_BLACK); - init_pair(cp_cyan, COLOR_CYAN, COLOR_BLACK); - init_pair(cp_green, COLOR_GREEN, COLOR_BLACK); - init_pair(cp_yellow, COLOR_YELLOW, COLOR_BLACK); - init_pair(cp_white_on_blue, COLOR_WHITE, COLOR_BLUE); - } - - execut = 0; - - if (firsttime) { - startdisplay(); - - debugwin = newwin(20, 77, 2, 1); - - wbkgd(debugwin, CP(cp_white_on_blue) | ' '); - // wattrset(debugwin, CP(cp_white_on_blue)); - - scrollok(debugwin, TRUE); - idlok(debugwin, TRUE); - - firsttime = 0; - } else { - touchwin(stdscr); - touchwin(debugwin); - refresh(); - wrefresh(debugwin); - } - - debugloop(); - cleardisplay(); - - // "pushad / call LastLog / ... / popad" elided - SaveOAMRamLog(); - - - if (execut == 1) { - start65816(); return; - } - endprog(); return; -} - -// Called from ASM - -int my_getch_ret; -void my_getch() { - my_getch_ret = getch(); -} - - -WINDOW *openwindow(int nlines, int ncols, int begin_y, int begin_x, - char *message) { - WINDOW *w = newwin(nlines, ncols, begin_y, begin_x); - wbkgd(w, CP(cp_white_on_blue|' ')); - // wattrset(w, CP(cp_white_on_blue)); - - mvwprintw(w, 1, 1, "%s", message); - wclrtoeol(w); - box(w, 0, 0); - - return w; -} - -void closewindow(WINDOW *w) { - delwin(w); - touchwin(debugwin); - wrefresh(debugwin); -} - -//******************************************************* -// Debug Loop -//******************************************************* - -unsigned short PrevBreakPt_offset; -unsigned char PrevBreakPt_page; - -void debugloop() { - int key; - a: - if (!(debugds & 2)) - nextopcode(); - if (!(debugds & 1)) - nextspcopcode(); - - b: - // redrawing the display is always a good idea - refresh(); - wrefresh(debugwin); - - key = getch(); - if (key >= 0 && key < 256) - key = toupper(key); - - switch (key) { - case KEY_F(1): // run - execut = 1; - return; - - case KEY_F(2): // debugsavestate - statesaver(); - goto b; - - case KEY_F(4): // debugloadstate - debugloadstate(); - goto a; - - case 27: // exit - return; - - case '\n': // step - goto e; - - - /* Ported this but couldn't bring myself to commit it. - pagefault said to remove it. - case '-': // skip opcode - */ - - case 'C': // clear - numinst = 0; - goto a; - - case 'M': // modify - { - WINDOW *w; - unsigned addr, value, n; - - w = openwindow(7, 33, 11, 24, " Enter Address : "); - mvwaddstr(w, 3, 1, " Previous Value: "); - mvwaddstr(w, 5, 1, " Enter Value : "); - - wrefresh(w); - - echo(); - n = mvwscanw(w, 1, 21, "%x", &addr); - noecho(); - - if (n == 1) { - mvwprintw(w, 3, 21, "%02x", memtabler8_wrapper(addr >> 16, addr)); - wrefresh(w); - - echo(); - n = mvwscanw(w, 5, 21, "%x", &value); - noecho(); - - if (n == 1) { - memtablew8_wrapper(addr >> 16, addr, value); - }} - - closewindow(w); - goto b; - } - - case 'B': // breakpoint - { - WINDOW *w = openwindow(3, 33, 11, 24, " Enter Address : "); - unsigned addr, n; - - wrefresh(w); - - echo(); - n = wscanw(w, "%x", &addr); - noecho(); - - closewindow(w); - - if (n == 1) { - w = openwindow(3, 52, 11, 14, - " Locating Breakpoint ... Press ESC to stop. "); - wrefresh(w); - nodelay(stdscr, 1); - - PrevBreakPt_page = addr >> 16; - PrevBreakPt_offset = addr; - breakops_wrapper(); - - nodelay(stdscr, 0); - closewindow(w); - - goto a; - } - - goto b; - } - - case 'R': // repeat breakpoint - breakops_wrapper(); - goto a; - - case 'S': // SPC breakpoint - { - WINDOW *w; - unsigned addr, n; - - w = openwindow(3, 33, 11, 24, " Enter Address : "); - wrefresh(w); - - echo(); - n = mvwscanw(w, 1, 22, "%x", &addr); - noecho(); - - closewindow(w); - - if (n == 1) { - SPCbreakops(addr); - goto a; - } - goto b; - } - - case 'A': // SPC modify - { - WINDOW *w; - unsigned addr, value, n; - - w = openwindow(7, 33, 11, 24, " Enter Address : "); - mvwaddstr(w, 3, 1, " Previous Value: "); - mvwaddstr(w, 5, 1, " Enter Value : "); - - wrefresh(w); - - echo(); - n = mvwscanw(w, 1, 22, "%x", &addr); - noecho(); - - addr &= 0xFFFF; - - if (n == 1) { - mvwprintw(w, 3, 22, "%02x", SPCRAM[addr]); - wrefresh(w); - - echo(); - n = mvwscanw(w, 5, 22, "%x", &value); - noecho(); - - if (n == 1) { - SPCRAM[addr] = value; - }} - - closewindow(w); - goto b; - } - - case 'T': // trace - { - WINDOW *w; - unsigned n, instrs; - - w = openwindow(3,52,11,14, " Enter # of Instructions to Trace : "); - wrefresh(w); - - echo(); - n = wscanw(w, "%d", &instrs); - noecho(); - - closewindow(w); - if (n == 1) { - traceops(instrs); - goto a; - } - - goto b; - } - - case 'D': // debug dump - debugdump(); - goto b; - - case 'W': // break at signal (breakatsign) - { - WINDOW *w; - - w = openwindow(3,52,11,14, - " Waiting for Signal .... Press ESC to stop."); - wrefresh(w); - - debstop3 = 0; - nodelay(w, TRUE); - do { - asm_call(execnextop); - } while ( (! ((++numinst % 256) && (wgetch(w) == 27))) - && (debstop3 != 1) ); - debstop3 = 0; - nodelay(w, FALSE); - - closewindow(w); - goto a; - } - - case 'L': // break at signal & log (breakatsignlog) - { - FILE *fp; - WINDOW *w, *real_debugwin; - - w = openwindow(3,52,11,14, - " Waiting for Signal .... Press ESC to stop."); - wrefresh(w); - - // Open output file - fp = fopen_dir(ZStartPath, "debug.log","w"); - - real_debugwin = debugwin; - debugwin = newpad(2, 77); - scrollok(debugwin, TRUE); - - debstop3 = 0; - nodelay(w, TRUE); - do { - char buf[78]; - // log instruction - move(0,0); - out65816(); - - mvwinnstr(debugwin, 0, 0, buf, 77); - buf[77] = 0; - fprintf(fp, "%s\n", buf); - fflush(fp); - - asm_call(execnextop); - } while ( (! ((++numinst % 256) && (wgetch(w) == 27))) - && (debstop3 != 1) ); - debstop3 = 0; - nodelay(w, FALSE); - - fclose(fp); - delwin(debugwin); - debugwin = real_debugwin; - - closewindow(w); - goto a; - } - - - case '1': // toggle SPC - debugds ^= 1; - break; - - case '2': // toggle 65816 - debugds ^= 2; - break; - - default: - wprintw(debugwin, "Unknown key code: %d\n", key); - goto b; - } - - e: - skipdebugsa1 = 0; - asm_call(execnextop); - skipdebugsa1 = 1; - if (soundon && (debugds & 2) && (cycpbl >= 55)) - goto e; - goto a; - -} - -//******************************************************* -// BreakatSignC Breaks whenever sndwrit = 1 -//******************************************************* - -unsigned char sndwrit; - -/* void breakatsignc() {} */ - - -//******************************************************* -// BreakOps Breaks at Breakpoint -//******************************************************* - -/* in ASM still, but not identical to other version -void breakops(unsigned char page, unsigned short offset) { - -} -*/ - -void traceops(unsigned count) { - WINDOW *w; - - w = openwindow(3,52,11,14, " Tracing. Press ESC to stop."); - wrefresh(w); - - nodelay(w, TRUE); - while (count-- && (wgetch(w) != 27)) { - asm_call(execnextop); - } - - closewindow(w); -} - -void SPCbreakops(unsigned short addr) { - WINDOW *w; - unsigned char *breakarea; - - breakarea = SPCRAM+addr; - - w = openwindow(3,52,11,14, "Locating Breakpoint ... Press ESC to stop."); - wrefresh(w); - - nodelay(w, TRUE); - do { - asm_call(execnextop); - } while ((!((++numinst % 256) - && (wgetch(w) == 27))) - && (spcPCRam != breakarea)); - nodelay(w, FALSE); - - closewindow(w); -} - - -void printinfo(char *s) { - while (s[0]) { - if (s[0] == '@') { - int colors[] = { - 0, 0, cp_green, cp_cyan, - cp_red, cp_magenta, cp_yellow, cp_white - }; - attrset(COLOR_PAIR(colors[s[1]-'0'])); - s += 2; - } else { - addch(s[0]); - s += 1; - } - } -} - -/* Won't port too well - stuck it in debugasm.asm for now */ -/* void execnextop() { */ -/* char *page = findoppage(); */ -/* initaddrl = page; */ -/* char *address = page+xpc; */ -/* } */ - -//******************************************************* -// Start Display -//******************************************************* -void startdisplay() { - int i; - - // Clear the screen - bkgd(CP(cp_white) | ' '); - clear(); - - // Draw to screen - - // ASM for some reason puts the same thing in the upper left corner again? - - move(1, 0); attrset(CP(cp_white_on_blue)); - addch(CurrentCPU+'0'); - for (i = 15; i; i--) - addch(ACS_HLINE); - printw(" CC: Y: "); - for (i = 19; i; i--) - addch(ACS_HLINE); - addch(' '); - for (i = 11; i; i--) - addch(' '); - addch(' '); - for (i = 16; i; i--) - addch(ACS_HLINE); - addch(ACS_URCORNER); - - for (i = 2; i < 22; i++) { - mvaddch(i, 0, ACS_VLINE); - hline(' ', 77); - mvaddch(i, 78, ACS_VLINE); - mvaddch(i, 79, CHECK); - } - - mvaddch(22, 0, ACS_LLCORNER); - for(i = 77; i; i--) - addch(ACS_HLINE); - mvaddch(22, 78, ACS_LRCORNER); - mvaddch(22, 79, CHECK); - - move(23, 1); - for(i = 79; i; i--) - addch(CHECK); - - // Print debugger information - - move(0, 2); attrset(CP(cp_white)); - printinfo("- @5Z@4S@3N@2E@6S@7 debugger -"); - - move(1, 4); attrset(CP(cp_white_on_blue)); - printinfo(" 65816 "); - - // HACK ALERT! this should really be on the bottom line, but - // xterms default to being one line shorter than 80x25, so this - // won't be on the bottom line on DOS! - // Also, we are printing on top of the (currently invisible) drop shadow!" - move(23, 0); - printinfo("@4(@6T@4)@7race for @4(@6B@4)@7reakpoint " - "@4(@6Enter@4)@7 Next " - "@4(@6M@4)@7odify @4(@6F9@4)@7 Signal @4(@6F1@4)@7 Run"); - - // ... - move(0, 0); - refresh(); -} - - -//******************************************************* -// Next Opcode Writes the next opcode & regs -//******************************************************* -// 008000 STZ $123456,x A:0000 X:0000 Y:0000 S:01FF DB:00 D:0000 P:33 E+ - -/* -void addtail() { - debugt++; - if (debugt == 100) - debugt = 0; - if (debugt == debugh) - debugh++; - if (debugh == 100) - debugh = 0; -} -*/ - - -// I'm going to have to completely rip out byuu's effective address -// stuff, it is just plain *WRONG*, besides being unsafe... - -// For next time, http://www.zophar.net/tech/files/65c816.txt seems -// like a good reference for effective address calculation; also, use -// 24-bit addresses for all calculations (so completely rip out -// memtabler8_wrapper, too). Also, preferably read memory in a -// non-destructive way. - -// This whole instr[1] thing probably isn't quite right either, but it -// seems unlikely that instructions would be stored discontiguously -// than that data would span 64kb boundaries. - -void out65816_addrmode (unsigned char *instr) { - char *padding = ""; - - #define GETXB() ((ocname[4*instr[0]] != 'J') ? xdb : xpb) - - #define INDEX_RIGHT(addr, index) \ - ((xp & 0x10) \ - ? (((addr) & ~0xff) | (((addr) + (index)) & 0xff)) \ - : (((addr) & ~0xffff) | (((addr) + (index)) & 0xffff))) - - - // each mode must output 19 characters - switch (addrmode[instr[0]]) { - - case 0: - case 6: - case 21: - // nothing to show - - wprintw(debugwin, "%19s", padding); - break; - - case 1: // #$12,#$1234 (M-flag) - wprintw(debugwin, "#$"); - if (xp != 0x20) { - wprintw(debugwin, "%02x", instr[1]); - wprintw(debugwin, "%15s", padding); - } else { - wprintw(debugwin, "%04x", *(unsigned short *)(instr+1)); - wprintw(debugwin, "%13s", padding); - } - break; - - case 2: // $1234 : db+$1234 - wprintw(debugwin, "$%04x", *(unsigned short *)(instr+1)); - wprintw(debugwin, "%5s[%02x%04x] ", padding, GETXB(), - *(unsigned short *)(instr+1)); - break; - - case 3: // $123456 - wprintw(debugwin, "$%02x%04x", instr[3], *(unsigned short*)(instr+1)); - wprintw(debugwin, "%12s", padding); - break; - - case 4: // $12 : $12+d - wprintw(debugwin, "$%02x%7s[%02x%04x] ", instr[1], padding, 0, - instr[1]+xd); - break; - - case 5: // A - wprintw(debugwin, "A%18s", padding); - break; - - case 7: // ($12),y - { - wprintw(debugwin, "($%02x),Y ", instr[1]); - wprintw(debugwin, "[nnnnnn] "); - break; - } - - case 8: // [$12],y - { - unsigned short addr; - unsigned int t; - - wprintw(debugwin, "[$%02x],Y ", instr[1]); - - addr = instr[1] + xd; - t = memtabler8_wrapper(0, addr); - t |= memtabler8_wrapper(0, addr+1) << 8; - t |= memtabler8_wrapper(0, addr+2) << 16; - t = INDEX_RIGHT(t, xy); - wprintw(debugwin, "[%06x] ", t); - - break; - } - - case 9: // ($12,x) - { - wprintw(debugwin, "($%02x,X) ", instr[1]); - wprintw(debugwin, "[nnnnnn] "); - break; - } - - case 10: // $12,x : $12+d+x - { - wprintw(debugwin, "$%02x,X%5s", instr[1], padding); - wprintw(debugwin, "[%06x] ", INDEX_RIGHT(instr[1] + xd, xx)); - break; - } - - case 11: // $12,y - { - wprintw(debugwin, "$%02x,Y%5s", instr[1], padding); - wprintw(debugwin, "[%06x] ", INDEX_RIGHT(instr[1] + xd, xy)); - break; - } - - case 12: // $1234,x : dbr+$1234+x - { - unsigned int t = instr[1] | (instr[2] << 8); - wprintw(debugwin, "$%04x,X ", t); - t = INDEX_RIGHT(t, xx); - wprintw(debugwin, "[%02x%04x] ", xdb, t); - - break; - } - - case 13: // $1234,y : dbr+$1234+y - { - unsigned int t = instr[1] | (instr[2] << 8); - wprintw(debugwin, "$%04x,Y ", t); - t = INDEX_RIGHT(t, xy); - wprintw(debugwin, "[%02x%04x] ", xdb, t); - - break; - } - - case 14: // $123456,x : $123456+x - { - unsigned int t = instr[1] | (instr[2] << 8) | (instr[3] << 16); - wprintw(debugwin, "$%06x,X ", t); - t = INDEX_RIGHT(t, xx); - wprintw(debugwin, "[%06x] ", t); - - break; - } - - case 15: // +-$12 / $1234 - { - signed char c = instr[1]; - unsigned short t = c + xpc + 2; - - wprintw(debugwin, "$%04x%4s [%02x%04x] ", t, padding, xpb, t); - - break; - } - - case 16: // +-$1234 / $1234 - { - unsigned short s = instr[1] | (instr[2] << 8); - unsigned short t = s + xpc + 3; - - wprintw(debugwin, "$%04x%4s [%02x%04x] ", t, padding, xpb, t); - - break; - } - - case 17: // ($1234) - { - wprintw(debugwin, "($%04x) ", instr[1]); - wprintw(debugwin, "[nnnnnn] "); - break; - } - - case 18: // ($12) - { - unsigned short addr1, addr2; - wprintw(debugwin, "($%02x)%5s", instr[1], padding); - - addr1 = instr[1] + xd; - - addr2 = memtabler8_wrapper(00, addr1); - addr2 |= memtabler8_wrapper(00, addr1+1) << 8; - - wprintw(debugwin, "[%02x%04x] ", xdb, addr2); - - break; - } - - case 19: // [$12] - { - // unsigned short addr1; - // unsigned int addr2; - - wprintw(debugwin, "[$%02x]%5s", instr[1], padding); - - /* - addr1 = instr[1] + xd; - - addr2 = memtabler8_wrapper(0, addr1); - addr2 |= memtabler8_wrapper( - */ - - wprintw(debugwin, "[nnnnnn] "); - - break; - } - - case 20: // ($1234,x) - { - unsigned short cx = *(unsigned short*)(instr+1); - unsigned short x; - - wprintw(debugwin, "($%04x,X) [%02x", cx, xpb); - if (xp & 0x10) - cx = (cx & 0xFF00) | ((cx + xx) & 0xFF); - else - cx += xx; - // .out20n - x = memtabler8_wrapper(xpb, cx); - x += memtabler8_wrapper(xpb, cx+1) << 8; - wprintw(debugwin, "%04x] ", x); - - break; - } - - case 22: // d,s - wprintw(debugwin, "$%02x,S%5s", instr[1], padding); - wprintw(debugwin, "[nnnnnn] "); - break; - - case 23: // (d,s),y - wprintw(debugwin, "($%02x,S),Y ", instr[1]); - wprintw(debugwin, "[nnnnnn] "); - break; - - case 24: // xyc - $1234 - wprintw(debugwin, "$%02x%02x%14s", instr[2], instr[1], padding); - break; - - case 25: // #$12 (Flag Operations) - wprintw(debugwin, "#$%02x%15s", instr[1], padding); - break; - - case 26: // #$12,#$1234 (X-flag) - if (xp & 0x10) { - wprintw(debugwin, "#$%02x%15s", instr[1], padding); - } else { - wprintw(debugwin, "#$%04x%13s", - *(unsigned short*)(instr+1), padding); - } - break; - - case 27: // [$1234] - wprintw(debugwin, "[$%02x%02x] ", instr[2], instr[1]); - break; - - default: - wprintw(debugwin, "%15s %02d ", "bad addr mode", addrmode[instr[0]]); - } -} - -unsigned char *findoppage() { - if (xpc & 0x8000) { - return snesmmap[xpb]; - } else { - // lower address - if ((xpc < 0x4300) || (memtabler8[xpb] != regaccessbankr8)) { - // lower memory - return snesmap2[xpb]; - } else { - // dma - return (unsigned char*)(dmadata-0x4300); - } - } -} - -/* grinvader's version -- kept incase I didn't get mine to match -unsigned char *findoppage() -{ - if (xpc & 0x8000) { return(snesmmap[xpb]); } - else - { // lower address - if (xpc < 0x4300 || memtabler8[xpb] != regaccessbankr8) - { return(snesmap2[xpb]); } - // dma - return(dmadata - 0x4300); // or maybe (&dmadata - 0x4300) - } -} -*/ - -unsigned char *findop() { - unsigned char *address = findoppage()+xpc; - return address; -} - -// print out a 65816 instruction -void out65816() { - unsigned char *address, opcode; - char opname[5] = "FOO "; - - wprintw(debugwin, "%02x%04x ", xpb, xpc); - - // is this safe? - address = findop(); - opcode = *address; - - memcpy(opname, &ocname[opcode*4], 4); - wprintw(debugwin, "%s", opname); - - out65816_addrmode(address); - - wprintw(debugwin, "A:%04x X:%04x Y:%04x S:%04x DB:%02x D:%04x P:%02x %c", - xa, xx, xy, xs, xdb, xd, xp, (xe == 1) ? 'E' : 'e'); -} - -void outsa1() { - // stub! -} - - -void nextopcode() { - attrset(CP(cp_white_on_blue)); - - move(1,50); printw("%11d", numinst); - move(1,20); printw("%3d", curcyc); - move(1,26); printw("%3d", curypos); - - // I don't understand the buffering scheme here... I'm just going - // to hope it isn't really all that important. - - //if (debugsa1 != 1) - out65816(); - //else - // outputbuffersa1(); -} - - -void cleardisplay() { - move(0, 0); /* clear(); refresh(); */ endwin(); -} - -//******************************************************* -// Next SPC Opcode Writes the next opcode & regs -//******************************************************* -// 008000 STZ $123456,x A:0000 X:0000 Y:0000 S:01FF DB:00 D:0000 P:33 E+ - -void outspc_addrmode() { - unsigned char mode; - char *format; - char buf[16] = " "; - char *p; - -#define HEX8(val) do { p += sprintf(p, "%02x", val); *p = ' '; } while (0) -#define HEX16(val) do { p += sprintf(p, "%04x", val); *p = ' '; } while (0) - - mode = ArgumentTable[spcPCRam[0]]; - format = AddressTable[mode]; - - // memset(buf, ' ', 15); buf[15] = 0; - - p = buf; - while (*format) { - if (*format != '%') { - *p++ = *format++; - continue; - } - - format++; - switch (*format++) { - - case '1': // first byte - HEX8(spcPCRam[1]); - break; - - case '2': // second byte - HEX8(spcPCRam[2]); - break; - - case '3': // hinib - *p++ = (spcPCRam[0] >> 4) + '0'; - *p++ = ' '; - break; - - case '4': // hinib2 - *p++ = (spcPCRam[0] >> 5) + '0'; - *p++ = ' '; - break; - - case '5': // rela2pc2 - { - signed char off; - off = *(signed char*)(spcPCRam+1); - HEX16(off + 2 + (spcPCRam - SPCRAM)); - // format += 3; - break; - } - - case '6': // dp - { - *p++ = '$'; - - if (spcP & 0x20) { - *p++ = '1'; - } else { - *p++ = '0'; - } - - break; - } - - case '8': // memorybit - HEX16((*(unsigned short*)(spcPCRam+1)) >> 3); - // format += 2; - break; - - case '9': // memorybitlow - *p++ = ','; - *p++ = (spcPCRam[1] & 0x7) + '0'; - break; - - case 'A': // rela2pc1 - { - signed char off; - off = *(signed char*)(spcPCRam+1); - HEX16(off + 2 + spcPCRam - SPCRAM); - // format += 2; - break; - } - - case 'B': // rela2pc2at2 - { - signed char off; - off = *(signed char*)(spcPCRam+2); - HEX16(off + 2 + spcPCRam - SPCRAM); - // format += 2; - break; - } - - } - - } - - buf[15] = 0; - waddstr(debugwin, buf); -} - -void nextspcopcode() { - if (!soundon) - return; - if (cycpbl >= 55) - return; - - // output spc pc & opcode # - wprintw(debugwin, " %04x/%02x ", spcPCRam - SPCRAM, spcPCRam[0]); - - - // output instruction - wprintw(debugwin, "%-6s", spcnametab[spcPCRam[0]]); - outspc_addrmode(); - - // output registers - wprintw(debugwin, "A:%02x X:%02x Y:%02x S:%02x ", spcA, spcX, spcY, spcS); - wprintw(debugwin, "N%cO%cD%c?%cH%cI%cZ%cC%c", - (spcNZ & 0x80) ? '+' : '-', - (spcP & 0x40) ? '+' : '-', - (spcP & 0x20) ? '+' : '-', - (spcP & 0x10) ? '+' : '-', - (spcP & 0x08) ? '+' : '-', - (spcP & 0x04) ? '+' : '-', - (spcP & 0x02) ? '+' : '-', - (spcP & 0x01) ? '+' : '-'); - - wprintw(debugwin, "\n"); - -} - - -//******************************************************* -// Debugger OpCode Information -//******************************************************* - -// Yes, I know, not very C style, but I really really really didn't -// want to type all those quote marks and commas. --SamB -char *ocname = -"BRK ORA COP ORA TSB ORA ASL ORA PHP ORA ASL PHD TSB ORA ASL ORA " -"BPL ORA ORA ORA TRB ORA ASL ORA CLC ORA INC TCS TRB ORA ASL ORA " -"JSR AND JSL AND BIT AND ROL AND PLP AND ROL PLD BIT AND ROL AND " -"BMI AND AND AND BIT AND ROL AND SEC AND DEC TSC BIT AND ROL AND " -"RTI EOR WDM EOR MVP EOR LSR EOR PHA EOR LSR PHK JMP EOR LSR EOR " -"BVC EOR EOR EOR MVN EOR LSR EOR CLI EOR PHY TCD JMP EOR LSR EOR " -"RTS ADC PER ADC STZ ADC ROR ADC PLA ADC ROR RTL JMP ADC ROR ADC " -"BVS ADC ADC ADC STZ ADC ROR ADC SEI ADC PLY TDC JMP ADC ROR ADC " -"BRA STA BRL STA STY STA STX STA DEY BIT TXA PHB STY STA STX STA " -"BCC STA STA STA STY STA STX STA TYA STA TXS TXY STZ STA STZ STA " -"LDY LDA LDX LDA LDY LDA LDX LDA TAY LDA TAX PLB LDY LDA LDX LDA " -"BCS LDA LDA LDA LDY LDA LDX LDA CLV LDA TSX TYX LDY LDA LDX LDA " -"CPY CMP REP CMP CPY CMP DEC CMP INY CMP DEX WAI CPY CMP DEC CMP " -"BNE CMP CMP CMP PEI CMP DEC CMP CLD CMP PHX STP JML CMP DEC CMP " -"CPX SBC SEP SBC CPX SBC INC SBC INX SBC NOP XBA CPX SBC INC SBC " -"BEQ SBC SBC SBC PEA SBC INC SBC SED SBC PLX XCE JSR SBC INC SBC "; - - -// Immediate Addressing Modes : -// 09 - ORA-M, 29 - AND-M, 49 - EOR-M, 69 - ADC-M, 89 - BIT-M, -// A0 - LDY-X, A2 - LDX-X, A9 - LDA-M, C0 - CPY-X, C2 - REP-B, -// C9 - CMP-M, E0 - CPX-X, E2 - SEP-B, E9 - SBC-M -// Extra Addressing Mode Values : B(1-byte only) = 25, X(by X flag) = 26 - -unsigned char addrmode[256] = { - 25, 9,25,22, 4, 4, 4,19,21, 1, 5,21, 2, 2, 2, 3, - 15, 7,18,23, 4,10,10, 8, 6,13, 5, 6, 2,12,12,14, - 2, 9, 3,22, 4, 4, 4,19,21, 1, 5,21, 2, 2, 2, 3, - 15, 7,18,23,10,10,10, 8, 6,13, 5, 6,12,12,12,14, - 21, 9, 0,22,24, 4, 4,19,21, 1, 5,21, 2, 2, 2, 3, - 15, 7,18,23,24,10,10, 8, 6,13,21, 6, 3,12,12,14, - 21, 9, 2,22, 4, 4, 4,19,21, 1, 5,21,17, 2, 2, 3, - 15, 7,18,23,10,10,10, 8, 6,13,21, 6,20,12,12,14, - 15, 9,16,22, 4, 4, 4,19, 6, 1, 6,21, 2, 2, 2, 3, - 15, 7,18,23,10,10,11, 8, 6,13, 6, 6, 2,12,12,14, - 26, 9,26,22, 4, 4, 4,19, 6, 1, 6,21, 2, 2, 2, 3, - 15, 7,18,23,10,10,11, 8, 6,13, 6, 6,12,12,13,14, - 26, 9,25,22, 4, 4, 4,19, 6, 1, 6, 6, 2, 2, 2, 3, - 15, 7,18,23,18,10,10, 8, 6,13,21, 6,27,12,12,14, - 26, 9,25,22, 4, 4, 4,19, 6, 1, 6, 6, 2, 2, 2, 3, - 15, 7,18,23, 2,10,10, 8, 6,13,21, 6,20,12,12,14 -}; - - -char *spcnametab[256] = { - "NOP", "TCALL", "SET1", "BBS", - "OR", "OR", "OR", "OR", - "OR", "OR", "OR1", "ASL", - "ASL", "PUSH", "TSET1", "BRK", - - "BPL", "TCALL", "CLR1", "BBC", - "OR", "OR", "OR", "OR", - "OR", "OR", "DECW", "ASL", - "ASL", "DEC", "CMP", "JMP", - - "CLRP", "TCALL", "SET1", "BBS", - "AND", "AND", "AND", "AND", - "AND", "AND", "OR1", "ROL", - "ROL", "PUSH", "CBNE", "BRA", - - "BMI", "TCALL", "CLR1", "BBC", - "AND", "AND", "AND", "AND", - "AND", "AND", "INCW", "ROL", - "ROL", "INC", "CMP", "CALL", - - - "SETP", "TCALL", "SET1", "BBS", - "EOR", "EOR", "EOR", "EOR", - "EOR", "EOR", "AND1", "LSR", - "LSR", "PUSH", "TCLR1", "PCALL", - - "BVC", "TCALL", "CLR1", "BBC", - "EOR", "EOR", "EOR", "EOR", - "EOR", "EOR", "CMPW", "LSR", - "LSR", "MOV", "CMP", "JMP", - - "CLRC", "TCALL", "SET1", "BBS", - "CMP", "CMP", "CMP", "CMP", - "CMP", "CMP", "AND1", "ROR", - "ROR", "PUSH", "DMNZ", "RET", - - "BVS", "TCALL", "CLR1", "BBC", - "CMP", "CMP", "CMP", "CMP", - "CMP", "CMP", "ADDW", "ROR", - "ROR", "MOV", "CMP", "RET1", - - - "SETC", "TCALL", "SET1", "BBS", - "ADC", "ADC", "ADC", "ADC", - "ADC", "ADC", "EOR1", "DEC", - "DEC", "MOV", "POP", "MOV", - - "BCC", "TCALL", "CLR1", "BBC", - "ADC", "ADC", "ADC", "ADC", - "ADC", "ADC", "SUBW", "DEC", - "DEC", "MOV", "DIV", "XCN", - - "EI", "TCALL", "SET1", "BBS", - "SBC", "SBC", "SBC", "SBC", - "SBC", "SBC", "MOV1", "INC", - "INC", "CMP", "POP", "MOV", - - "BCS", "TCALL", "CLR1", "BBC", - "SBC", "SBC", "SBC", "SBC", - "SBC", "SBC", "MOVW", "INC", - "INC", "MOV", "DAS", "MOV", - - - "DI", "TCALL", "SET1", "BBS", - "MOV", "MOV", "MOV", "MOV", - "CMP", "MOV", "MOV1", "MOV", - "MOV", "MOV", "POP", "MUL", - - "BNE", "TCALL", "CLR1", "BBC", - "MOV", "MOV", "MOV", "MOV", - "MOV", "MOV", "MOVW", "MOV", - "DEC", "MOV", "CBNE", "DAA", - - "CLRV", "TCALL", "SET1", "BBS", - "MOV", "MOV", "MOV", "MOV", - "MOV", "MOV", "NOT1", "MOV", - "MOV", "NOTC", "POP", "SLEEP", - - "BEQ", "TCALL", "CLR1", "BBC", - "MOV", "MOV", "MOV", "MOV", - "MOV", "MOV", "MOV", "MOV", - "INC", "MOV", "DBNZ", "STOP" -}; -// need... air... badly...! - - -// %1 = Byte, %2 = Second Byte, %3 = high nibble of opcode #, -// %4 = high nibble of opcode # and 07h, %5 = relative to PC+2 -// %6 = dp ($0/$1) -// %7 = memory SHR 3 Low, %8 = memory SHR 3 High, %9 = ,memory AND 7h -// %A = relative to PC+1, %B = relative to PC+1 at second byte -char *AddressTable[68] = { -// 1 1 1 -"", "%3", "%6%1,%4", "B%4 %6%1,$%B+1", -// 0 : nothing -// 1 : the high nibble -// 2 : the high nibble first 3 bit (and 0111000 then shift) -// 3 : 2 + relative -"A,%6%1", "A,$%2%1", "A,(X)", "A,(%6%1+x)", -// 4 : A,dp -// 5 : A,labs -// 6 : A,(X) -// 7 : A,(dp+X) -"A,#$%1", "(%6%2),(%6%1)", "CF,mbit%8%7%9", "%6%1", -// 8 : A,#inm -// 9 : dp(d),dp(s) (two dp) -// 10 : Carry flag, memory bit (can only access from 0 to 1fff) -// 11 : dp -"$%2%1", "PSW", "$%A", "A,%6%1+X", -// 12 : labs -// 13 : PSW -// 14 : rel -// 15 : A,dp+X -"A,$%2%1+X", "A,$%2%1+Y", "A,(%6%1)+Y", "%6%2,#$%1", -// 16 : A,labs+X -// 17 : A,labs+Y -// 18 : A,(dp)+Y -// 19 : dp,#inm -"(X),(Y)", "%6%1+X", "A", "X", -// 20 : (X),(Y) -// 21 : dp+X -// 22 : A -// 23 : X -"X,%2%1", "($%2%1+X)", "CF,/(mb%8%7%9)", "%6%1", -// 24 : X,labs -// 25 : (labs+X) -// 26 : C,/mem.bit -// 27 : upage (same as dp but for a call) -"YA,%6%1", "X,A", "Y,$%2%1", "Y", -// 28 : YA,dp -// 29 : X,A -// 30 : Y,labs -// 31 : Y -"Y,%6%1", "Y,#$%1", "%6%1,$%B", "X,%6%1", -// 32 : Y,dp -// 33 : Y,#inm -// 34 : dp,rel -// 35 : X,dp -"A,X", "%6%2,#$%1", "X,SP", "YA,X", -// 36 : A,X -// 37 : dp,#inm -// 38 : X,SP -// 39 : YA,X -"(X)+,A", "SP,X", "A,(X)+", "%6%1,A", -// 40 : (X)+,A -// 41 : SP,X -// 42 : A,(X)+ -// 43 : dp,A -"$%2%1,A", "(X),A", "%6%1+X,A", "X,#$%1", -// 44 : labs,A -// 45 : (X),A -// 46 : (dp+X),A -// 47 : X,#inm -"$%2%1,X", "mb%8%7%9,CF", "%6%1,Y", "$%2%1,Y", -// 48 : labs,X -// 49 : mem.bit,C -// 50 : dp,Y -// 51 : labs,Y -"YA", "%6%1+X,A", "$%2%1+X,A", "$%2%1+Y,A", -// 52 : YA -// 53 : dp+X,A -// 54 : labs+X,A -// 55 : labs+Y,A -"(%6%1)+Y,A", "%6%1,X", "%6%1+Y,X", "%6%1,YA", -// 56 : (dp)+Y,A -// 57 : dp,X -// 58 : dp+Y,X -// 59 : dp,YA -"%6%1+X,Y", "A,Y", "%6%2+X,$%A", "mb%8%7%9,CF", -// 60 : dp+X,Y -// 61 : A,Y -// 62 : dp+X,rel -// 63 : mem.bit -"X,%6%1+Y", "Y,%6%1+X", "Y,A", "Y,$%A", -// 64 : X,dp+Y -// 65 : Y,dp+X -// 66 : Y,A -// 67 : Y,rel - -}; - -unsigned char ArgumentTable[256] = { -// 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,12, 0, -// 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 14, 1, 2, 3,15,16,17,18,19,20,11,21,22,23,24,25, -// 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,26,11,12,22,34,14, -// 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 14, 1, 2, 3,15,16,17,18,19,20,11,21,22,23,35,12, -// 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,23,12,27, -// 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 14, 1, 2, 3,15,16,17,18,19,20,28,21,22,29,30,12, -// 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,26,11,12,31,34, 0, -// 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 14, 1, 2, 3,15,16,17,18,19,20,28,21,22,36,32, 0, -// 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,33,13,37, -// 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - 14, 1, 2, 3,15,16,17,18,19,20,28,21,22,38,39,22, -// A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,33,22,40, -// B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 14, 1, 2, 3,15,16,17,18,19,20,28,21,22,41,22,42, -// C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - 0, 1, 2, 3,43,44,45,46,47,48,49,50,51,47,23,52, -// D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - 14, 1, 2, 3,53,54,55,56,57,58,59,60,31,61,62,22, -// E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - 0, 1, 2, 3, 4, 5, 6, 7, 8,24,63,32,30, 0,31, 0, -// F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - 14, 1, 2, 3,15,16,17,18,35,64, 9,65,31,66,67, 0 -}; - - -// Jonas Quinn's file functions - -void SaveOAMRamLog() { - FILE *fp = 0; - - if ((fp = fopen_dir(ZCfgPath,"vram.dat","wb"))) { - fwrite(oamram,1,544,fp); - fclose(fp); - } -} - -void debugdump() { - FILE *fp = 0; - - if ((fp = fopen_dir(ZCfgPath,"SPCRAM.dmp","wb"))) { - fwrite(SPCRAM,1,65536,fp); - fclose(fp); - } - - if ((fp = fopen_dir(ZCfgPath,"DSP.dmp","wb"))) { - fwrite(DSPMem,1,256,fp); - fclose(fp); - } -} diff --git a/tools/zsnes/src/dos/dosintrf.asm b/tools/zsnes/src/dos/dosintrf.asm deleted file mode 100644 index de9f6a4..0000000 --- a/tools/zsnes/src/dos/dosintrf.asm +++ /dev/null @@ -1,935 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 selcA000,selcB800,selc0040,previdmode,DosExit, -EXTSYM V8Mode,getblaster,Force8b,SBHDMA -EXTSYM oldhand9s,oldhand9o,interror,oldhand8s,oldhand8o,oldhandSBs,oldhandSBo -EXTSYM NoSoundReinit,soundon,DSPDisable,SBInt,PICMaskP,SBIrq,SBHandler,InitSB -EXTSYM handler8h,handler9h,init60hz,Interror,init18_2hz,DeInitSPC,GUIinit36_4hz -EXTSYM GUIoldhand9s,GUIoldhand9o,GUIoldhand8s,GUIoldhand8o,GUIhandler9h -EXTSYM GUIhandler8h,GUIinit18_2hz,dosinitvideo -EXTSYM DosDrawScreen,cvidmode,vidbuffer,GUICPC,DosDrawScreenB -EXTSYM DosUpdateDevices,DOSJoyRead,pl1contrl,pl2contrl,pl3contrl,pl4contrl -EXTSYM pl5contrl,GrayscaleMode -EXTSYM pl1upk,pl1downk,pl1leftk,pl1rightk,pl1startk,pl1selk -EXTSYM pl1Ak,pl1Bk,pl1Xk,pl1Yk,pl1Lk,pl1Rk -EXTSYM pl2upk,pl2downk,pl2leftk,pl2rightk,pl2startk,pl2selk -EXTSYM pl2Ak,pl2Bk,pl2Xk,pl2Yk,pl2Lk,pl2Rk -EXTSYM pl3upk,pl3downk,pl3leftk,pl3rightk,pl3startk,pl3selk -EXTSYM pl3Ak,pl3Bk,pl3Xk,pl3Yk,pl3Lk,pl3Rk -EXTSYM pl4upk,pl4downk,pl4leftk,pl4rightk,pl4startk,pl4selk -EXTSYM pl4Ak,pl4Bk,pl4Xk,pl4Yk,pl4Lk,pl4Rk -EXTSYM pl5upk,pl5downk,pl5leftk,pl5rightk,pl5startk,pl5selk -EXTSYM pl5Ak,pl5Bk,pl5Xk,pl5Yk,pl5Lk,pl5Rk - -; NOTE: For timing, Game60hzcall should be called at 50hz or 60hz (depending -; on romispal) after a call to InitPreGame and before DeInitPostGame are -; made. GUI36hzcall should be called at 36hz after a call GUIInit and -; before GUIDeInit. - -SECTION .data -NEWSYM dssel, dw 0 -SECTION .text - -NEWSYM StartUp - mov ax,901h ;enable interrupts - int 31h - mov ax,ds - mov [dssel],ax - mov bx,0A000h - call findselec - mov [selcA000],ax - mov bx,0B800h - call findselec - mov [selcB800],ax - mov bx,0040h - call findselec - mov [selc0040],ax - ; get previous video mode - xor ecx,ecx - push es - mov ax,[selc0040] - mov es,ax - mov al,[es:49h] - mov [previdmode],al - pop es - - ; Get base address - mov ax,ds - mov bx,ax - mov eax,0006h - int 31h - jc .FatalError - mov [ZSNESBase+2],cx ; These variables are used for - mov [ZSNESBase],dx ; memory allocation so they can be -.FatalError ; ignored for non-DOS ports - ret - -; SystemInit - Initialize all Joystick stuff, load in all configuration data, -; parse commandline data, obtain current directory (One time initialization) -NEWSYM SystemInit - ; Be sure to set SBHDMA to a value other than 0 if 16bit sound exists - push es - - call getblaster ; get set blaster environment - cmp byte[Force8b],1 - jne .noforce8b - mov byte[SBHDMA],0 -.noforce8b - pop es - ret - -; Find Selector - DOS only -findselec: - mov ax, 2 - int 31h - jnc .proceed - mov edx, .noselector - call PrintStr - jmp DosExit -.proceed - ret -SECTION .data -.noselector db 'Cannot find selector!',10,13,0 -SECTION .text - -NEWSYM PrintChar - ; print character at dl, push all modified registers - push eax - mov ah,02h - int 21h - pop eax - ret - -NEWSYM PrintStr ; Print ASCIIZ string -.next - mov al,[edx] - or al,al - jz .finish - push edx - mov dl,al - mov ah,02h - int 21h - pop edx - inc edx - jmp .next -.finish - ret - -NEWSYM WaitForKey ; Wait for a key to be pressed - mov ah,7 - int 21h - ; return key in al - ret - -%macro PressConv 3 - cmp byte[pressed+%1],0 - je %%nopr - test byte[prval],%2 - jnz %%prskip - or byte[prval],%2 - mov byte[prres],%3 -; mov al,0FFh - jmp .done - jmp %%prskip -%%nopr - and byte[prval],%2^0FFh -%%prskip -%endmacro - -NEWSYM Check_Key -; xor al,al -; PressConv 75,01h,75 -; PressConv 77,02h,77 -; PressConv 80,04h,80 -; PressConv 72,08h,72 -; PressConv 1,80h,27 -;.done -; ret - ; returns 0 if there are no keys in the keyboard buffer, 0xFF otherwise - mov ah,0Bh - int 21h - ret - -NEWSYM Get_Key -; mov al,[prres] -; ret - ; wait if there are no keys in buffer, then return key in al - ; for extended keys, return a 0, then the extended key afterwards - mov ah,07h - int 21h - ret - -NEWSYM Get_Memfree - mov ax,0500h - mov edi,edx - int 31h - ret - -NEWSYM Output_Text ; Output character (ah=02h) or string (ah=09h) - ; This function usually displays an error message on-screen - cmp ah,02h - je .char - cmp ah,09h - je .string - ret -.char - int 21h ; print dl - ret -.string - pushad - call PrintStr ; print edx - popad - ret - -; Delay for CX/65536 of a second - -NEWSYM delay - in al,61h - and al,10h - mov ah,al -.loopa - in al,61h - and al,10h - cmp al,ah - jz .loopa - mov ah,al - dec cx - jnz .loopa - ret - -NEWSYM InitPreGame ; Executes before starting/continuing a game - ; set up interrupt handler - ; get old handler pmode mode address - ; Process stuff such as sound init, interrupt initialization - cli - mov ax,204h - mov bl,09h - int 31h - jc near interror - mov [oldhand9s],cx - mov [oldhand9o],edx - mov ax,204h - mov bl,08h - int 31h - jc near interror - mov [oldhand8s],cx - mov [oldhand8o],edx - - mov al,[GrayscaleMode] - cmp al,[V8Mode] - je .nochangemode - xor byte[V8Mode],1 - xor al,al -.nochangemode - -.nofs - cmp byte[NoSoundReinit],1 - je .nosound - cmp byte[soundon],0 - je .nosound - cmp byte[DSPDisable],1 - je .nosound - mov ax,204h - mov bl,[SBInt] - int 31h - jc near Interror - mov [oldhandSBs],cx - mov [oldhandSBo],edx -.nosound - sti - ret - -NEWSYM SetupPreGame ; Executes after pre-game init, can execute multiple - ; times after a single InitPreGame - ; set new handler - cmp byte[soundon],0 - je near .nosound2 - cmp byte[DSPDisable],1 - je near .nosound2 - - ; Turn off IRQ through controller - cli - xor dh,dh - mov dl,[PICMaskP] - mov cl,[SBIrq] - and cl,07h - mov al,01h - shl al,cl - mov bl,al - in al,dx - or al,bl - out dx,al - - mov ax,205h - mov bl,[SBInt] - mov cx,cs - mov edx,SBHandler - int 31h - jc near interror - - ; Turn on IRQ through controller - xor dh,dh - mov dl,[PICMaskP] - mov cl,[SBIrq] - and cl,07h - mov al,01h - shl al,cl - not al - mov bl,al - in al,dx - and al,bl - out dx,al - - call InitSB - sti -.nosound2 - cli - mov ax,205h - mov bl,09h - mov cx,cs ; Requires CS rather than DS - mov edx,handler9h - int 31h - jc near interror - - mov ax,205h - mov bl,08h - mov cx,cs ; Requires CS rather than DS - mov edx,handler8h - int 31h - jc near interror - call init60hz ; Set timer to 60/50Hz -.nofs2 - sti - ret - -NEWSYM DeInitPostGame ; Called after game is ended - ; de-init interrupt handler - cli - mov cx,[oldhand9s] - mov edx,[oldhand9o] - mov ax,205h - mov bl,09h - int 31h - jc near interror - - mov cx,[oldhand8s] - mov edx,[oldhand8o] - mov ax,205h - mov bl,08h - int 31h - jc near interror - call init18_2hz ; Set timer to 18.2Hz -.nofs3 - sti - - ; DeINITSPC - cmp byte[soundon],0 - je .nosoundb - cmp byte[DSPDisable],1 - je .nosoundb - call DeInitSPC - mov cx,[oldhandSBs] - mov edx,[oldhandSBo] - mov ax,205h - mov bl,[SBInt] - int 31h - jc near interror -.nosoundb - ret - -NEWSYM GUIInit - mov ax,204h - mov bl,09h - int 31h - mov [GUIoldhand9s],cx - mov [GUIoldhand9o],edx - mov ax,204h - mov bl,08h - int 31h - mov [GUIoldhand8s],cx - mov [GUIoldhand8o],edx - mov ax,205h - mov bl,09h - mov cx,cs - mov edx,GUIhandler9h - int 31h - mov ax,205h - mov bl,08h - mov cx,cs - mov edx,GUIhandler8h - int 31h - call GUIinit36_4hz - ret - -NEWSYM GUIDeInit - mov cx,[GUIoldhand9s] - mov edx,[GUIoldhand9o] - mov ax,205h - mov bl,09h - int 31h - mov cx,[GUIoldhand8s] - mov edx,[GUIoldhand8o] - mov ax,205h - mov bl,08h - int 31h - call GUIinit18_2hz - ret - -; **************************** -; Video Stuff -; **************************** - -; ** Palette Functions ** -NEWSYM displayfpspal - mov al,128 - mov dx,03C8h - out dx,al - inc dx - mov al,63 - out dx,al - out dx,al - out dx,al - mov al,128+64 - mov dx,03C8h - out dx,al - inc dx - mov al,0 - out dx,al - out dx,al - out dx,al - ret -NEWSYM superscopepal - mov al,128+16 - mov dx,03C8h - out dx,al - inc dx - mov al,63 - out dx,al - xor al,al - out dx,al - out dx,al - ret -NEWSYM saveselectpal - ; set palette of colors 128,144, and 160 to white, blue, and red - mov al,128 - mov dx,03C8h - out dx,al - inc dx - mov al,63 - out dx,al - out dx,al - out dx,al - mov al,144 - mov dx,03C8h - out dx,al - inc dx - xor al,al - out dx,al - out dx,al - mov al,50 - out dx,al - mov al,160 - mov dx,03C8h - out dx,al - inc dx - mov al,45 - out dx,al - xor al,al - out dx,al - out dx,al - mov al,176 - mov dx,03C8h - out dx,al - inc dx - mov al,47 - out dx,al - xor al,al - out dx,al - out dx,al - mov al,208 - mov dx,03C8h - out dx,al - inc dx - mov al,50 - out dx,al - mov al,25 - out dx,al - xor al,al - out dx,al - ret - -; ** init video mode functions ** -NEWSYM initvideo ; Returns 1 in videotroub if trouble occurs - jmp dosinitvideo - -NEWSYM deinitvideo - mov al,[previdmode] - mov ah,0 - int 10h - ret - -; ** copy video mode functions ** -NEWSYM DrawScreen ; In-game screen render w/ triple buffer check - jmp DosDrawScreen - -NEWSYM vidpastecopyscr ; GUI screen render -; jmp dosvidpastecopyscr - pushad - movzx eax,byte[cvidmode] - cmp byte[GUI16VID+eax],1 - jne .no16bconv - mov eax,[vidbuffer] - mov ecx,224*288 - mov edx,ecx - sub ecx,288 - dec edx -.loop - movzx ebx,byte[eax+edx] - mov bx,[GUICPC+ebx*2] - mov [eax+edx*2],bx - dec edx - dec ecx - jnz .loop -.no16bconv - popad - jmp DosDrawScreenB - -; ** Video Mode Variables ** -SECTION .data - -; Total Number of Video Modes -NEWSYM NumVideoModes, dd 19 - -; GUI Video Mode Names - Make sure that all names are of the same length -; and end with a NULL terminator -NEWSYM GUIVideoModeNames -db '256x224x8B MODEQ',0 ; 0 -db '256x240x8B MODEQ',0 ; 1 -db '256x256x8B MODEQ',0 ; 2 -db '320x224x8B MODEX',0 ; 3 -db '320x240x8B MODEX',0 ; 4 -db '320x256x8B MODEX',0 ; 5 -db '640x480x16B VESA1',0 ; 6 -db '320x240x8B VESA2',0 ; 7 -db '320x240x16B VESA2',0 ; 8 -db '320x480x8B VESA2',0 ; 9 -db '320x480x16B VESA2',0 ; 10 -db '512x384x8B VESA2',0 ; 11 -db '512x384x16B VESA2',0 ; 12 -db '640x400x8B VESA2',0 ; 13 -db '640x400x16B VESA2',0 ; 14 -db '640x480x8B VESA2',0 ; 15 -db '640x480x16B VESA2',0 ; 16 -db '800x600x8B VESA2',0 ; 17 -db '800x600x16B VESA2',0 ; 18 - -; Video Mode Feature Availability (1 = Available, 0 = Not Available) -; Left side starts with Video Mode 0 -; 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 -NEWSYM GUI16VID, db 0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1 ; 16-bit mode -NEWSYM GUISLVID, db 0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,1,1 ; Scanlines -NEWSYM GUIHSVID, db 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0 ; Half/Quarter Scanlines -NEWSYM GUII2VID, db 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1 ; DOS Interpolation -NEWSYM GUIEAVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 ; DOS Eagle -NEWSYM GUITBVID, db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1 ; DOS Triple Buffering -NEWSYM GUIFSVID, db 0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,0,0 ; DOS Fullscreen -NEWSYM GUIWSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0 ; DOS Widescreen -NEWSYM GUISSVID, db 0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,1 ; DOS Smallscreen -NEWSYM GUI2xVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 ; 2xSaI/Super Engines -NEWSYM GUIM7VID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 ; Hires Mode 7 -NEWSYM GUIHQ2X, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Hq2x Filter) -NEWSYM GUINTVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (NTSC Filter) - -SECTION .text - -; **************************** -; Input Device Stuff -; **************************** - -; Variables related to Input Device Routines: -; pl1selk,pl1startk,pl1upk,pl1downk,pl1leftk,pl1rightk,pl1Xk, -; pl1Ak,pl1Lk,pl1Yk,pl1Bk,pl1Rk -; (Change 1 to 2,3,4 for other players) -; Each of these variables contains the corresponding key pressed value -; for the key data -; pressed[] -; - This is an array of pressed/released data (bytes) where the -; corresponding key pressed value is used as the index. The value -; for each entry is 0 for released and 1 for pressed. Also, when -; writing keyboard data to this array, be sure to first check if -; the value of the array entry is 2 or not. If it is 2, do not write 1 -; to that array entry. (however, you can write 0 to it) -; As an example, to access Player 1 L button press data, it is -; done like : pressed[pl1Lk] -; The 3 character key description of that array entry is accessed by the -; GUI through ScanCodeListing[pl1Lk*3] - -; Note: When storing the input device configuration of a dynamic input -; device system (ie. Win9x) rather than a static system (ie. Dos), it -; is best to store in the name of the device and relative button -; assignments in the configuration file, then convert it to ZSNES' -; numerical corresponding key format after reading from it. And then -; convert it back when writing to it back. - -NEWSYM UpdateDevices ; One-time input device init - call DosUpdateDevices - ret - -NEWSYM JoyRead - call DOSJoyRead - ret - -%macro SetDefaultKey2 13 - mov dword[%1upk],%4 ; Up - mov dword[%1downk],%5 ; Down - mov dword[%1leftk],%6 ; Left - mov dword[%1rightk],%7 ; Right - mov dword[%1startk],%3 ; Start - mov dword[%1selk],%2 ; Select - mov dword[%1Ak],%9 ; A - mov dword[%1Bk],%12 ; B - mov dword[%1Xk],%8 ; X - mov dword[%1Yk],%11 ; Y - mov dword[%1Lk],%10 ; L - mov dword[%1Rk],%13 ; R -%endmacro - -%macro SetDefaultKey 12 - cmp bh,0 - jne %%nopl1 - SetDefaultKey2 pl1,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl1 - cmp bh,1 - jne %%nopl2 - SetDefaultKey2 pl2,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl2 - cmp bh,2 - jne %%nopl3 - SetDefaultKey2 pl3,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl3 - cmp bh,3 - jne %%nopl4 - SetDefaultKey2 pl4,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl4 - cmp bh,4 - jne %%nopl5 - SetDefaultKey2 pl5,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl5 -%endmacro - -NEWSYM SetInputDevice - ; bl = device #, bh = player # (0-4) - ; Sets keys according to input device selected - cmp bl,0 - jne near .nozero - SetDefaultKey 0,0,0,0,0,0,0,0,0,0,0,0 - ret -.nozero - cmp bl,1 - jne near .nokeyb - cmp bh,1 - ja near .exit - cmp bh,1 - je near .input2 - SetDefaultKey 54,28,72,80,75,77,31,45,32,30,44,46 - ret -.input2 - SetDefaultKey 56,29,36,50,49,51,82,71,73,83,79,81 - ret -.nokeyb - cmp bl,2 - jne near .no2buttons - xor bl,bl - cmp byte[pl1contrl],2 - jne .nopl2a - inc bl -.nopl2a - cmp byte[pl2contrl],2 - jne .nopl2b - inc bl -.nopl2b - cmp byte[pl3contrl],2 - jne .nopl2c - inc bl -.nopl2c - cmp byte[pl4contrl],2 - jne .nopl2d - inc bl -.nopl2d - cmp byte[pl5contrl],2 - jne .nopl2e - inc bl -.nopl2e - cmp bl,2 - jae .2ndjoyst - SetDefaultKey 0,0,0CCh,0CDh,0CEh,0CFh,0,0,0,82h,83h,0 - ret -.2ndjoyst - SetDefaultKey 0,0,0E8h,0E9h,0EAh,0EBh,0,0,0,84h,85h,0 - ret -.no2buttons - cmp bl,3 - jne near .no4buttons - SetDefaultKey 0,0,0CCh,0CDh,0CEh,0CFh,84h,85h,0,82h,83h,0 - ret -.no4buttons - cmp bl,4 - jne near .no6buttons - SetDefaultKey 0,0,0CCh,0CDh,0CEh,0CFh,84h,85h,86h,82h,83h,87h - ret -.no6buttons - cmp bl,5 - jne near .skip8b - SetDefaultKey 081h,080h,0CCh,0CDh,0CEh,0CFh,84h,85h,87h,82h,83h,86h - ret -.skip8b - cmp bl,6 - jne near .nosw1 - SetDefaultKey 0C9h,0C8h,0D4h,0D5h,0D6h,0D7h,08Ch,089h,08Eh,08Bh,088h,08Fh - ret -.nosw1 - cmp bl,7 - jne near .nosw2 - SetDefaultKey 0C9h+8,0C8h+8,0D4h+8,0D5h+8,0D6h+8,0D7h+8,08Ch+8,089h+8,08Eh+8,08Bh+8,088h+8,08Fh+8 - ret -.nosw2 - cmp bl,8 - jne near .nosw3 - SetDefaultKey 0C9h+8*2,0C8h+8*2,0D4h+8*2,0D5h+8*2,0D6h+8*2,0D7h+8*2,08Ch+8*2,089h+8*2,08Eh+8*2,08Bh+8*2,088h+8*2,08Fh+8*2 - ret -.nosw3 - cmp bl,9 - jne near .nosw4 - SetDefaultKey 0C9h+8*3,0C8h+8*3,0D4h+8*3,0D5h+8*3,0D6h+8*3,0D7h+8*3,08Ch+8*3,089h+8*3,08Eh+8*3,08Bh+8*3,088h+8*3,08Fh+8*3 - ret -.nosw4 - cmp bl,10 - jne near .nogrip0 - SetDefaultKey 0CAh,0CBh,0F0h,0F1h,0F2h,0F3h,0A9h,0ABh,0ACh,0A8h,0AAh,0AEh - ret -.nogrip0 - cmp bl,11 - jne near .nogrip1 - SetDefaultKey 0CAh+8,0CBh+8,0F0h+4,0F1h+4,0F2h+4,0F3h+4,0A9h+8,0ABh+8,0ACh+8,0A8h+8,0AAh+8,0AEh+8 - ret -.nogrip1 - cmp bl,12 - jne near .nopp1 - SetDefaultKey 182h,183h,184h,185h,186h,187h,189h,188h,18Ah,181h,180h,18Bh - ret -.nopp1 - cmp bl,13 - jne near .nopp2 - SetDefaultKey 192h,193h,194h,195h,196h,197h,199h,198h,19Ah,191h,190h,19Bh - ret -.nopp2 - cmp bl,14 - jne near .nopp3 - SetDefaultKey 1A2h,1A3h,1A4h,1A5h,1A6h,1A7h,1A9h,1A8h,1AAh,1A1h,1A0h,1ABh - ret -.nopp3 - cmp bl,15 - jne near .nopp4 - SetDefaultKey 1B2h,1B3h,1B4h,1B5h,1B6h,1B7h,1B9h,1B8h,1BAh,1B1h,1B0h,1BBh - ret -.nopp4 - cmp bl,16 - jne near .nopp5 - SetDefaultKey 1C2h,1C3h,1C4h,1C5h,1C6h,1C7h,1C9h,1C8h,1CAh,1C1h,1C0h,1CBh - ret -.nopp5 -.exit - ret - -SECTION .data - -; Total Number of Input Devices -NEWSYM NumInputDevices, dd 17 - -; Input Device Names -NEWSYM GUIInputNames -db 'NONE ',0 -db 'KEYBOARD ',0 -db '2BUTTONJOYSTICK ',0 -db '4BUTTONJOYSTICK ',0 -db '6BUTTONJOYSTICK ',0 -db '8BUTTONJOYSTICK ',0 -db 'SIDEWINDERPAD1 ',0 -db 'SIDEWINDERPAD2 ',0 -db 'SIDEWINDERPAD3 ',0 -db 'SIDEWINDERPAD4 ',0 -db 'GAMEPAD PRO P0 ',0 -db 'GAMEPAD PRO P1 ',0 -db 'PARALLEL LPT1 P1',0 -db 'PARALLEL LPT1 P2',0 -db 'PARALLEL LPT1 P3',0 -db 'PARALLEL LPT1 P4',0 -db 'PARALLEL LPT1 P5',0 - -; GUI Description codes for each corresponding key pressed value -NEWSYM ScanCodeListing - db '---','ESC',' 1 ',' 2 ',' 3 ',' 4 ',' 5 ',' 6 ' - db ' 7 ',' 8 ',' 9 ',' 0 ',' - ',' = ','BKS','TAB' - db ' Q ',' W ',' E ',' R ',' T ',' Y ',' U ',' I ' - db ' O ',' P ',' [ ',' ] ','RET','CTL',' A ',' S ' - db ' D ',' F ',' G ',' H ',' J ',' K ',' L ',' : ' - db ' " ',' ~ ','LSH',' \ ',' Z ',' X ',' C ',' V ' - db ' B ',' N ',' M ',' , ',' . ',' / ','RSH',' * ' - db 'ALT','SPC','CAP','F1 ','F2 ','F3 ','F4 ','F5 ' - db 'F6 ','F7 ','F8 ','F9 ','F10','NUM','SCR','HOM' - db 'UP ','PGU',' - ','LFT',' 5 ','RGT',' + ','END' - db 'DWN','PGD','INS','DEL',' ',' ',' ','F11' - db 'F12',' ',' ',' ',' ',' ',' ',' ' - db ' ',' ',' ',' ',' ',' ',' ',' ' - db ' ',' ',' ',' ',' ',' ',' ',' ' - db ' ',' ',' ',' ',' ',' ',' ',' ' - db ' ',' ',' ',' ',' ',' ',' ',' ' - ; Joystick Stuff, Port 201h (80h) - db 'JB7','JB8','JB1','JB2','JB3','JB4','JB5','JB6' - db 'SWA','SWB','SWC','SWX','SWY','SWZ','SWL','SWR' - db 'S2A','S2B','S2C','S2X','S2Y','S2Z','S2L','S2R' - db 'S3A','S3B','S3C','S3X','S3Y','S3Z','S3L','S3R' - db 'S4A','S4B','S4C','S4X','S4Y','S4Z','S4L','S4R' - db 'GRR','GRB','GRY','GRG','GL1','GL2','GR1','GR2' - db 'G2R','G2B','G2Y','G2G','2L1','2L2','2R1','2R2' - db 'G3R','G3B','G3Y','G3G','3L1','3L2','3R1','3R2' - db 'G4R','G4B','G4Y','G4G','4L1','4L2','4R1','4R2' - db 'SWS','SWM','GSL','GST','JUP','JDN','JLF','JRG' - db 'S2S','S2M','2SL','2ST','SWU','SWD','SWL','SWR' - db 'S3S','S3M','3SL','3ST','S2U','S2D','S2L','S2R' - db 'S4S','S4M','4SL','4ST','S3U','S3D','S3L','S3R' - db 'J2U','J2D','J2L','J2R','S4U','S4D','S4L','S4R' - db 'GRU','GRD','GRL','GRR','G2U','G2D','G2L','G2R' - db 'G3U','G3D','G3L','G3R','G4U','G4D','G4L','G4R' - ; Joystick Stuff, Port 209h (100h) - db 'JB7','JB8','JB1','JB2','JB3','JB4','JB5','JB6' - db 'SWA','SWB','SWC','SWX','SWY','SWZ','SWL','SWR' - db 'S2A','S2B','S2C','S2X','S2Y','S2Z','S2L','S2R' - db 'S3A','S3B','S3C','S3X','S3Y','S3Z','S3L','S3R' - db 'S4A','S4B','S4C','S4X','S4Y','S4Z','S4L','S4R' - db 'GRR','GRB','GRY','GRG','GL1','GL2','GR1','GR2' - db 'G2R','G2B','G2Y','G2G','2L1','2L2','2R1','2R2' - db 'G3R','G3B','G3Y','G3G','3L1','3L2','3R1','3R2' - db 'G4R','G4B','G4Y','G4G','4L1','4L2','4R1','4R2' - db 'SWS','SWM','GSL','GST','JUP','JDN','JLF','JRG' - db 'S2S','S2M','2SL','2ST','SWU','SWD','SWL','SWR' - db 'S3S','S3M','3SL','3ST','S2U','S2D','S2L','S2R' - db 'S4S','S4M','4SL','4ST','S3U','S3D','S3L','S3R' - db 'J2U','J2D','J2L','J2R','S4U','S4D','S4L','S4R' - db 'GRU','GRD','GRL','GRR','G2U','G2D','G2L','G2R' - db 'G3U','G3D','G3L','G3R','G4U','G4D','G4L','G4R' - ; Extra Stuff (180h) (Parallel Port) - db 'PPB','PPY','PSL','PST','PUP','PDN','PLT','PRT' - db 'PPA','PPX','PPL','PPR',' ',' ',' ',' ' - db 'P2B','P2Y','P2S','P2T','P2U','P2D','P2L','P2R' - db 'P2A','P2X','P2L','P2R',' ',' ',' ',' ' - db 'P3B','P3Y','P3S','P3T','P3U','P3D','P3L','P3R' - db 'P3A','P3X','P3L','P3R',' ',' ',' ',' ' - db 'P4B','P4Y','P4S','P4T','P4U','P4D','P4L','P4R' - db 'P4A','P4X','P4L','P4R',' ',' ',' ',' ' - db 'P5B','P5Y','P5S','P5T','P5U','P5D','P5L','P5R' - db 'P5A','P5X','P5L','P5R',' ',' ',' ',' ' - -SECTION .bss - -NEWSYM ZSNESBase, resd 1 -TempVarSeek resd 1 - - -SECTION .text - -; **************************** -; Mouse Stuff -; **************************** - -NEWSYM Init_Mouse - ; return non-zero if successful - mov eax,00h - int 33h - cmp ax,0 - je .nomouse - mov eax,07h - mov ecx,0 - mov edx,255 - int 33h - mov eax,08h - mov ecx,0 - mov edx,223 - int 33h - mov eax,0Fh - mov ecx,8 - mov edx,8 - int 33h - mov eax,04h - mov ecx,0 - mov edx,0 - int 33h - mov ax,1 -.nomouse - ret - -NEWSYM Get_MouseData ; Returns both pressed and coordinates - mov eax,03h - int 33h - ; bx : bit 0 = left button, bit 1 = right button - ; cx = Mouse X Position, dx = Mouse Y Position - ret - -NEWSYM Set_MouseXMax ; Sets the X boundaries (ecx = left, edx = right) - mov eax,07h - int 33h - ret - -NEWSYM Set_MouseYMax ; Sets the Y boundaries (ecx = left, edx = right) - mov eax,08h - int 33h - ret - -NEWSYM Set_MousePosition ; Sets Mouse Position (x:cx,y:dx) - mov eax,04h - int 33h - ret - -NEWSYM Get_MousePositionDisplacement - ; returns x,y displacement in pixel in cx,dx - mov eax,0Bh - int 33h - ret - -NEWSYM MouseWindow - ret - -; **************************** -; Sound Stuff -; **************************** - -NEWSYM StopSound - ret - -NEWSYM StartSound - ret - -NEWSYM Check60hz - ; Call the timer update function here - ret diff --git a/tools/zsnes/src/dos/gppro.asm b/tools/zsnes/src/dos/gppro.asm deleted file mode 100644 index 9102acf..0000000 --- a/tools/zsnes/src/dos/gppro.asm +++ /dev/null @@ -1,159 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 - - diff --git a/tools/zsnes/src/dos/initvid.asm b/tools/zsnes/src/dos/initvid.asm deleted file mode 100644 index f0d9e21..0000000 --- a/tools/zsnes/src/dos/initvid.asm +++ /dev/null @@ -1,551 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 InitVesa2,cbitmode,cvidmode,dosmakepal,scanlines,selcA000,vesa2_bits -EXTSYM vesa2_x,vesa2_y,vesa2selec,InitVesa12,videotroub,cscopymodeq,cscopymodex -EXTSYM res640,res480 - - -SECTION .text -NEWSYM initvideo2 - cmp byte[cvidmode],2 - jne .nomodeq - jmp dosinitvideo.initmodeq256 -.nomodeq - cmp byte[cvidmode],5 - jne .nomodex - jmp dosinitvideo.initmodex256 -.nomodex - -;******************************************************* -; InitVideo -;******************************************************* -NEWSYM dosinitvideo - mov byte[cbitmode],0 - mov byte[res640],0 - mov byte[res480],0 - cmp byte[cvidmode],0 - je near .initmodeq224 - cmp byte[cvidmode],1 - je near .initmodeq240 - cmp byte[cvidmode],2 - je near .initmodeq256 - cmp byte[cvidmode],3 - je near .initmodex224 - cmp byte[cvidmode],4 - je near .initmodex240 - cmp byte[cvidmode],5 - je near .initmodex256 - cmp byte[cvidmode],6 - je near .initvesa12640x480x16 - cmp byte[cvidmode],7 - je near .initvesa2320x240x8 - cmp byte[cvidmode],8 - je near .initvesa2320x240x16 - cmp byte[cvidmode],9 - je near .initvesa2320x480x8 - cmp byte[cvidmode],10 - je near .initvesa2320x480x16 - cmp byte[cvidmode],11 - je near .initvesa2512x384x8 - cmp byte[cvidmode],12 - je near .initvesa2512x384x16 - cmp byte[cvidmode],13 - je near .initvesa2640x400x8 - cmp byte[cvidmode],14 - je near .initvesa2640x400x16 - cmp byte[cvidmode],15 - je near .initvesa2640x480x8 - cmp byte[cvidmode],16 - je near .initvesa2640x480x16 - cmp byte[cvidmode],17 - je near .initvesa2800x600x8 - cmp byte[cvidmode],18 - je near .initvesa2800x600x16 - ret - -%include "dos/vga.inc" - - -;******************************************************* -; InitModeQ 224 Sets up 256x224 chained mode -;******************************************************* - -.initmodeq224 - SetVGAMode .Mode256x224c - call cscopymodeq - call dosmakepal - ret - -;******************************************************* -; InitModeQ 240 Sets up 256x240 chained mode -;******************************************************* - -.initmodeq240 - SetVGAMode .Mode256x240c - call cscopymodeq - call dosmakepal - ret - -;******************************************************* -; InitModeQ 256 Sets up 256x256 chained mode -;******************************************************* - -.initmodeq256 - cmp byte[scanlines],1 - je near .scanlines - SetVGAMode .Mode256x256c - jmp .done -.scanlines - SetVGAMode .Mode256x256cs - jmp .done -.done - call cscopymodeq - call dosmakepal - ret - - -;******************************************************* -; InitModeX 224 Sets up 320x224 unchained mode -;******************************************************* - -.initmodex224 - SetVGAMode .Mode320x224 - call cscopymodex - call dosmakepal - ret - -;******************************************************* -; InitModeX 240 Sets up 320x240 unchained mode -;******************************************************* - -.initmodex240 - SetVGAMode .Mode320x240 - call cscopymodex - call dosmakepal - ret - -;******************************************************* -; InitModeX 256 Sets up 320x256 unchained mode -;******************************************************* - -.initmodex256 - cmp byte[scanlines],1 - je near .scanlines2 - SetVGAMode .Mode320x256 - jmp .done2 -.scanlines2 - SetVGAMode .Mode320x256s - jmp .done2 -.done2 - call cscopymodex - call dosmakepal - ret - - -;******************************************************* -; InitVESA2 320x240x8 Set up Linear 320x240x8b -;******************************************************* - -.initvesa2320x240x8 - mov byte[cbitmode],0 - mov word[vesa2_x],320 - mov word[vesa2_y],240 - mov byte[vesa2_bits],8 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble - ret -.notrouble - call dosmakepal - ; clear screen (320*240 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,320*240 -.loop - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loop - pop es - ret - -;******************************************************* -; InitVESA2 320x240x16 Set up Linear 320x240x16b -;******************************************************* - -.initvesa2320x240x16 - mov byte[cbitmode],1 - mov word[vesa2_x],320 - mov word[vesa2_y],240 - mov byte[vesa2_bits],16 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble2 - ret -.notrouble2 - ; clear screen (320*240*2 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,320*240*2 -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -;******************************************************* -; InitVESA2 640x480x8 Set up Linear 640x480x8b -;******************************************************* - -.initvesa2640x480x8 - mov byte[res640],1 - mov byte[res480],1 - mov word[vesa2_x],640 - mov word[vesa2_y],480 - mov byte[vesa2_bits],8 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble3 - ret -.notrouble3 - call dosmakepal - ; clear screen (640*480 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,640*480 -.loopc3 - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopc3 - pop es - ret - -;******************************************************* -; InitVESA2 640x480x16 Set up Linear 640x480x16b -;******************************************************* - -.initvesa2640x480x16 - mov byte[res640],1 - mov byte[res480],1 - mov byte[cbitmode],1 - mov word[vesa2_x],640 - mov word[vesa2_y],480 - mov byte[vesa2_bits],16 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble4 - ret -.notrouble4 - ; clear screen (640*480*2 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,640*480*2 -.loopd3 - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopd3 - pop es - ret - -;******************************************************* -; InitVESA2 800x600x8 Set up Linear 800x600x8b -;******************************************************* - -.initvesa2800x600x8 - mov byte[res640],1 - mov byte[res480],1 - mov word[vesa2_x],800 - mov word[vesa2_y],600 - mov byte[vesa2_bits],8 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble11 - ret -.notrouble11 - call dosmakepal - ; clear screen (800*600 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,800*600 -.looph2 - mov byte[es:edi],0 - inc edi - dec ecx - jnz .looph2 - pop es - ret - -;******************************************************* -; InitVESA2 800x600x16 Set up Linear 800x600x16b -;******************************************************* - -.initvesa2800x600x16 - mov byte[res640],1 - mov byte[res480],1 - mov byte[cbitmode],1 - mov word[vesa2_x],800 - mov word[vesa2_y],600 - mov byte[vesa2_bits],16 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble12 - ret -.notrouble12 - ; clear screen (800*600*2 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,800*600*2 -.looph3 - mov byte[es:edi],0 - inc edi - dec ecx - jnz .looph3 - pop es - ret - -;******************************************************* -; InitVESA2 320x480x8 Set up Linear 320x480x8b -;******************************************************* - -.initvesa2320x480x8 - mov byte[res480],1 - mov word[vesa2_x],320 - mov word[vesa2_y],480 - mov byte[vesa2_bits],8 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble5 - ret -.notrouble5 - call dosmakepal - ; clear screen (320*480 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,320*480 -.loopc - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopc - pop es - ret - -;******************************************************* -; InitVESA2 320x480x16 Set up Linear 320x480x16b -;******************************************************* - -.initvesa2320x480x16 - mov byte[res480],1 - mov byte[cbitmode],1 - mov word[vesa2_x],320 - mov word[vesa2_y],480 - mov byte[vesa2_bits],16 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble6 - ret -.notrouble6 - ; clear screen (320*480*2 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,320*480*2 -.loopd - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopd - pop es - ret - -;******************************************************* -; InitVESA2 512x384x8 Set up Linear 512x384x8b -;******************************************************* - -.initvesa2512x384x8 - mov byte[res640],2 - mov byte[cbitmode],0 - mov word[vesa2_x],512 - mov word[vesa2_y],384 - mov byte[vesa2_bits],8 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble7 - ret -.notrouble7 - call dosmakepal - ; clear screen (512*384 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,512*384 -.loope - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loope - pop es - ret - -;******************************************************* -; InitVESA2 512x384x16 Set up Linear 512x384x16b -;******************************************************* - -.initvesa2512x384x16 - mov byte[res640],2 - mov byte[cbitmode],1 - mov word[vesa2_x],512 - mov word[vesa2_y],384 - mov byte[vesa2_bits],16 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble8 - ret -.notrouble8 - ; clear screen (512*384*2 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,512*384*2 -.loopf - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopf - pop es - ret - -;******************************************************* -; InitVESA2 640x400x8 Set up Linear 640x400x8b -;******************************************************* - -.initvesa2640x400x8 - mov byte[res640],2 - mov word[vesa2_x],640 - mov word[vesa2_y],400 - mov byte[vesa2_bits],8 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble9 - ret -.notrouble9 - call dosmakepal - ; clear screen (640*400 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,640*400 -.loopg - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopg - pop es - ret - -;******************************************************* -; InitVESA2 640x400x16 Set up Linear 640x400x16b -;******************************************************* - -.initvesa2640x400x16 - mov byte[res640],2 - mov byte[cbitmode],1 - mov word[vesa2_x],640 - mov word[vesa2_y],400 - mov byte[vesa2_bits],16 - call InitVesa2 - cmp byte[videotroub],1 - jne .notrouble10 - ret -.notrouble10 - ; clear screen (640*400*2 bytes) - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,0 - mov ecx,640*400*2 -.looph - mov byte[es:edi],0 - inc edi - dec ecx - jnz .looph - pop es - ret - -;******************************************************* -; InitVESA1.2 640x480x16 Set up 640x480x16b -;******************************************************* - -.initvesa12640x480x16 - mov byte[res640],1 - mov byte[cbitmode],1 - mov word[vesa2_x],640 - mov word[vesa2_y],480 - mov byte[vesa2_bits],16 - call InitVesa12 - ret - - ; clear screen (640*480*2 bytes) - push es - mov ax,[selcA000] - mov es,ax - mov ebx,9 - xor edx,edx -.loopbanks - - xor edi,edi - mov ecx,16384 -.loopi - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopi - dec ebx - jnz .loopbanks - - mov ecx,6144 - pop es - ret diff --git a/tools/zsnes/src/dos/joy.asm b/tools/zsnes/src/dos/joy.asm deleted file mode 100644 index 57b4068..0000000 --- a/tools/zsnes/src/dos/joy.asm +++ /dev/null @@ -1,1417 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 pl1contrl,pl2contrl,pl3contrl,pl4contrl,pl5contrl -EXTSYM pressed,CalibXmin,CalibYmin,CalibXmax,CalibYmax -EXTSYM CalibXmin209,CalibYmin209,CalibXmax209,CalibYmax209 -EXTSYM read_gpp,_readSideWinder,_SW1,_SW2,_SW3,_SW4,_SWCount -EXTSYM pl1p209,pl2p209,pl3p209,pl4p209,pl5p209,WhichSW,delay -EXTSYM pl1upk,pl1downk,pl1leftk,pl1rightk,pl1startk,pl1selk -EXTSYM pl1Ak,pl1Bk,pl1Xk,pl1Yk,pl1Lk,pl1Rk -EXTSYM pl2upk,pl2downk,pl2leftk,pl2rightk,pl2startk,pl2selk -EXTSYM pl2Ak,pl2Bk,pl2Xk,pl2Yk,pl2Lk,pl2Rk -EXTSYM pl3upk,pl3downk,pl3leftk,pl3rightk,pl3startk,pl3selk -EXTSYM pl3Ak,pl3Bk,pl3Xk,pl3Yk,pl3Lk,pl3Rk -EXTSYM pl4upk,pl4downk,pl4leftk,pl4rightk,pl4startk,pl4selk -EXTSYM pl4Ak,pl4Bk,pl4Xk,pl4Yk,pl4Lk,pl4Rk -EXTSYM pl5upk,pl5downk,pl5leftk,pl5rightk,pl5startk,pl5selk -EXTSYM pl5Ak,pl5Bk,pl5Xk,pl5Yk,pl5Lk,pl5Rk -EXTSYM JoyX,JoyY,JoyX2,JoyY2,JoyMaxX,JoyMaxY,JoyMinX,JoyMinY -EXTSYM JoyExists,JoyExists2,GetCoords,GetCoords3 - -SECTION .data -NEWSYM JoyAltrn2, db 2 -SECTION .bss - -NEWSYM joy4218, resb 1 -NEWSYM joy4219, resb 1 -NEWSYM joy4218j, resb 1 -NEWSYM joy4219j, resb 1 -NEWSYM joy421A, resb 1 -NEWSYM joy421B, resb 1 -NEWSYM joy421Aj, resb 1 -NEWSYM joy421Bj, resb 1 - -NEWSYM JoyCenterX, resd 1 -NEWSYM JoyCenterY, resd 1 -NEWSYM JoyCenterX2, resd 1 -NEWSYM JoyCenterY2, resd 1 -NEWSYM JoyMaxX2, resd 1 -NEWSYM JoyMaxY2, resd 1 -NEWSYM JoyMinX2, resd 1 -NEWSYM JoyMinY2, resd 1 -NEWSYM JoyAltrn, resb 1 -NEWSYM JoyCenterX209, resd 1 -NEWSYM JoyCenterY209, resd 1 -NEWSYM JoyMaxX209, resd 1 -NEWSYM JoyMaxY209, resd 1 -NEWSYM JoyMinX209, resd 1 -NEWSYM JoyMinY209, resd 1 -NEWSYM JoyCenterX2209, resd 1 -NEWSYM JoyCenterY2209, resd 1 -NEWSYM JoyMaxX2209, resd 1 -NEWSYM JoyMaxY2209, resd 1 -NEWSYM JoyMinX2209, resd 1 -NEWSYM JoyMinY2209, resd 1 - -JoyQuant resb 1 -JoyBQuant resb 1 -NumSWs resb 1 -NumGRiPs resb 1 -PPad resb 1 ; b0 = pp0, b1 = pp1 - -JoyQuant209 resb 1 -JoyBQuant209 resb 1 -NumSWs209 resb 1 -NumGRiPs209 resb 1 -Buttons6 resb 1 -Buttons6209 resb 1 - -SECTION .text - -NEWSYM DosUpdateDevices - mov byte[PPad],0 - mov byte[JoyQuant],0 - mov byte[JoyBQuant],0 - mov byte[NumSWs],0 - mov byte[NumGRiPs],0 - mov byte[JoyQuant209],0 - mov byte[JoyBQuant209],0 - mov byte[NumSWs209],0 - mov byte[NumGRiPs209],0 - mov byte[Buttons6],0 - mov byte[Buttons6209],0 - ; Check for button #'s, joystick types, etc. - mov al,[pl1contrl] - mov ah,[pl1p209] - call .checkdevice - mov al,[pl2contrl] - mov ah,[pl2p209] - call .checkdevice - mov al,[pl3contrl] - mov ah,[pl3p209] - call .checkdevice - mov al,[pl4contrl] - mov ah,[pl4p209] - call .checkdevice - mov al,[pl5contrl] - mov ah,[pl5p209] - call .checkdevice - ; Auto-Calibrate the joysticks - cmp byte[JoyQuant],2 - jne .no2joyst - mov dx,201h - mov byte[JoyExists2],1 - call GetCoords3 - mov ecx,1000 - call delay - cmp byte[JoyExists2],0 - jne .no2joyst - mov byte[JoyQuant],1 -.no2joyst - cmp byte[JoyQuant],1 - jne .no1joyst - mov dx,201h - mov byte[JoyExists],1 - call GetCoords - mov ecx,1000 - call delay - cmp byte[JoyExists],0 - jne .no1joyst - mov byte[JoyQuant],0 -.no1joyst - ; set max & mins - mov ecx,[JoyX2] - mov [JoyCenterX2], ecx - mov eax,ecx - shr ecx,1 - sub eax,ecx - mov [JoyMinX2],eax - add eax,ecx - add eax,ecx - mov [JoyMaxX2],eax - mov ecx,[JoyY2] - mov [JoyCenterY2], ecx - mov eax,ecx - shr ecx,1 - sub eax,ecx - mov [JoyMinY2],eax - add eax,ecx - add eax,ecx - mov [JoyMaxY2],eax - mov ecx,[JoyX] - mov [JoyCenterX], ecx - mov eax,ecx - shr ecx,1 - sub eax,ecx - mov [JoyMinX],eax - add eax,ecx - add eax,ecx - mov [JoyMaxX],eax - mov ecx,[JoyY] - mov [JoyCenterY], ecx - mov eax,ecx - shr ecx,1 - sub eax,ecx - mov [JoyMinY],eax - add eax,ecx - add eax,ecx - mov [JoyMaxY],eax - ; Port 209 - ; Auto-Calibrate the joysticks - cmp byte[JoyQuant209],2 - jne .no2joyst2 - mov dx,209h - mov byte[JoyExists2],1 - call GetCoords3 - mov ecx,1000 - call delay - cmp byte[JoyExists2],0 - jne .no2joyst2 - mov byte[JoyQuant209],1 -.no2joyst2 - cmp byte[JoyQuant209],1 - jne .no1joyst2 - mov dx,209h - mov byte[JoyExists],1 - call GetCoords - mov ecx,1000 - call delay - cmp byte[JoyExists],0 - jne .no1joyst2 - mov byte[JoyQuant209],0 -.no1joyst2 - ; set max & mins - mov ecx,[JoyX2] - mov [JoyCenterX2209], ecx - mov eax,ecx - shr ecx,1 - sub eax,ecx - mov [JoyMinX2209],eax - add eax,ecx - add eax,ecx - mov [JoyMaxX2209],eax - mov ecx,[JoyY2] - mov [JoyCenterY2209], ecx - mov eax,ecx - shr ecx,1 - sub eax,ecx - mov [JoyMinY2209],eax - add eax,ecx - add eax,ecx - mov [JoyMaxY2209],eax - mov ecx,[JoyX] - mov [JoyCenterX209], ecx - mov eax,ecx - shr ecx,1 - sub eax,ecx - mov [JoyMinX209],eax - add eax,ecx - add eax,ecx - mov [JoyMaxX209],eax - mov ecx,[JoyY] - mov [JoyCenterY209], ecx - mov eax,ecx - shr ecx,1 - sub eax,ecx - mov [JoyMinY209],eax - add eax,ecx - add eax,ecx - mov [JoyMaxY209],eax - cmp dword[CalibXmin],0 - je .nocalib - mov eax,[CalibXmin] - mov [JoyMinX],eax - mov eax,[CalibYmin] - mov [JoyMinY],eax - mov eax,[CalibXmax] - mov [JoyMaxX],eax - mov eax,[CalibYmax] - mov [JoyMaxY],eax -.nocalib - cmp dword[CalibXmin209],0 - je .nocalib209 - mov eax,[CalibXmin209] - mov [JoyMinX209],eax - mov eax,[CalibYmin209] - mov [JoyMinY209],eax - mov eax,[CalibXmax209] - mov [JoyMaxX209],eax - mov eax,[CalibYmax209] - mov [JoyMaxY209],eax -.nocalib209 - ret -.checkdevice - ; 1 = keyboard, 2 = 2b joystick, 3 = 4b joystick, 4 = 6b joystick, 5 = 8b joystick - ; 6 = Sidewinder1, 7 = Sidewinder2, 8 = Sidewinder3, 9 = Sidewinder4 - ; 10 = Grip0, 11 = Grip1, N/A = Grip2, N/A = Grip3, 12 = Parallel pad0 - ; 13 = Parallel pad1, 14 = Parallel pad2, 15 = Parallel pad3, 16 = Parallel pad4 - - cmp al,1 - ja .joyokay - ret -.joyokay - cmp al,12 - jne .nopp0 - or byte[PPad],1 - ret -.nopp0 - cmp al,13 - jne .nopp1 - or byte[PPad],2 - ret -.nopp1 - cmp al,14 - jne .nopp2 - or byte[PPad],4 - ret -.nopp2 - cmp al,15 - jne .nopp3 - or byte[PPad],8 - ret -.nopp3 - cmp al,16 - jne .nopp4 - or byte[PPad],16 - ret -.nopp4 - cmp ah,0 - jne near .port209 - cmp al,2 - jne .nojoy2b - inc byte[JoyQuant] - add byte[JoyBQuant],2 - ret -.nojoy2b - cmp al,3 - jne .nojoy4b - mov byte[JoyQuant],1 - mov byte[JoyBQuant],4 - ret -.nojoy4b - cmp al,4 - jne .nojoy6b - mov byte[JoyQuant],2 - mov byte[JoyBQuant],6 - mov byte[Buttons6],1 - ret -.nojoy6b - cmp al,5 - jne .nojoy8b - mov byte[JoyQuant],2 - mov byte[JoyBQuant],8 - mov byte[Buttons6],2 - ret -.nojoy8b - cmp al,9 - ja .grip - sub al,5 - cmp byte[NumSWs],al - ja .skipswc - mov [NumSWs],al -.skipswc - ret -.grip - cmp al,11 - ja .none - sub al,9 - cmp byte[NumGRiPs],al - ja .skipgripc - mov [NumGRiPs],al -.skipgripc -.none - ret -.port209 - cmp al,2 - jne .nojoy2b2 - inc byte[JoyQuant209] - add byte[JoyBQuant209],2 - ret -.nojoy2b2 - cmp al,3 - jne .nojoy4b2 -.joy4b2 - mov byte[JoyQuant209],1 - mov byte[JoyBQuant209],4 - ret -.nojoy4b2 - cmp al,4 - jne .nojoy6b2 - mov byte[JoyQuant209],2 - mov byte[JoyBQuant209],6 - mov byte[Buttons6209],1 - ret -.nojoy6b2 - cmp al,5 - jne .nojoy8b2 - mov byte[JoyQuant209],2 - mov byte[JoyBQuant209],8 - mov byte[Buttons6209],2 - ret -.nojoy8b2 - cmp al,9 - ja .grip2 - sub al,5 - cmp byte[NumSWs209],al - ja .skipswc2 - mov [NumSWs209],al -.skipswc2 - ret -.grip2 - cmp al,11 - ja .none2 - sub al,9 - cmp byte[NumGRiPs209],al - ja .skipgripc2 - mov [NumGRiPs209],al -.skipgripc2 -.none2 - ret - -JoyRead209: - cmp byte[JoyAltrn],1 - jne near .noanalog - - ; Clear Joystick buttons and movements - mov word[pressed+100h],0 ; B7-8 - mov word[pressed+106h],0 ; B5-6 - mov dword[pressed+14Ch],0 ; Up,Down,Left,Right, pl1 - mov dword[pressed+168h],0 ; Up,Down,Left,Right, pl2 - - ; Process Joystick(s) - cmp byte[JoyQuant209],2 - jne near .no2joyst - mov dx,209h - call GetCoords3 - - ; Set button 5-6 + 2player Control - cmp byte[Buttons6209],0 - jne near .6button - mov eax,[JoyX2] - cmp eax,[JoyMinX2209] - jae .noleft2 - mov byte[pressed+16Ah],1 -.noleft2 - mov eax,[JoyX2] - cmp eax,[JoyMaxX2209] - jbe .noright2 - mov byte[pressed+16Bh],1 -.noright2 - mov eax,[JoyY2] - cmp eax,[JoyMinY2209] - jae .noup2 - mov byte[pressed+168h],1 -.noup2 - mov eax,[JoyY2] - cmp eax,[JoyMaxY2209] - jbe .nodown2 - mov byte[pressed+169h],1 -.nodown2 - jmp .1pcoord -.6button - mov eax,[JoyY2] - cmp eax,[JoyMinY2209] - jae .nob5 - mov byte[pressed+106h],1 -.nob5 - mov eax,[JoyX2] - cmp eax,[JoyMinX2209] - jae .nob6 - mov byte[pressed+107h],1 -.nob6 - cmp byte[Buttons6209],2 - jne .no8b - mov eax,[JoyY2] - cmp eax,[JoyMaxY2209] - jbe .nob7 - mov byte[pressed+100h],1 -.nob7 - mov eax,[JoyX2] - cmp eax,[JoyMaxX2209] - jbe .nob8 - mov byte[pressed+101h],1 -.nob8 -.no8b - jmp .1pcoord -.no2joyst - - ; Set 1 player control - cmp byte[JoyQuant209],1 - jne near .no1joyst - mov dx,209h - call GetCoords -.1pcoord - mov eax,[JoyX] - cmp eax,[JoyMinX209] - jae .noleft - mov byte[pressed+14Eh],1 -.noleft - mov eax,[JoyX] - cmp eax,[JoyMaxX209] - jbe .noright - mov byte[pressed+14Fh],1 -.noright - mov eax,[JoyY] - cmp eax,[JoyMinY209] - jae .noup - mov byte[pressed+14Ch],1 -.noup - mov eax,[JoyY] - cmp eax,[JoyMaxY209] - jbe .nodown - mov byte[pressed+14Dh],1 -.nodown -.no1joyst -.noanalog - test byte[JoyAltrn],1 - jne near .joynotexist - mov dword[pressed+102h],0 ; B1-4 - cmp byte[JoyQuant209],0 - je .joynotexist - ; Set buttons 1-4 - mov dx, 0209h - xor al,al - out dx, al - in al, dx - not al - test al,10h - jz .nob1 - mov byte[pressed+102h],1 -.nob1 - test al,20h - jz .nob2 - mov byte[pressed+103h],1 -.nob2 - cmp byte[JoyBQuant209],2 - je .joynotexist - test al,40h - jz .nob3 - mov byte[pressed+104h],1 -.nob3 - test al,80h - jz .nob4 - mov byte[pressed+105h],1 -.nob4 -.joynotexist - ret - -NEWSYM DOSJoyRead - push edx - push ebx - push ecx - - inc byte[JoyAltrn] - and byte[JoyAltrn],3 - - cmp byte[JoyAltrn],0 - jne near .noanalog - - ; Clear Joystick buttons and movements - mov word[pressed+86h],0 ; B5-6 - mov word[pressed+80h],0 ; B7-8 - mov dword[pressed+0CCh],0 ; Up,Down,Left,Right, pl1 - mov dword[pressed+0E8h],0 ; Up,Down,Left,Right, pl2 - - ; Process Joystick(s) - cmp byte[JoyQuant],2 - jne near .no2joyst - mov dx,201h - call GetCoords3 - - ; Set button 5-6 + 2player Control - cmp byte[Buttons6],0 - jne near .6button - mov eax,[JoyX2] - cmp eax,[JoyMinX2] - jae .noleft2 - mov byte[pressed+0EAh],1 -.noleft2 - mov eax,[JoyX2] - cmp eax,[JoyMaxX2] - jbe .noright2 - mov byte[pressed+0EBh],1 -.noright2 - mov eax,[JoyY2] - cmp eax,[JoyMinY2] - jae .noup2 - mov byte[pressed+0E8h],1 -.noup2 - mov eax,[JoyY2] - cmp eax,[JoyMaxY2] - jbe .nodown2 - mov byte[pressed+0E9h],1 -.nodown2 - jmp .1pcoord -.6button - mov eax,[JoyY2] - cmp eax,[JoyMinY2] - jae .nob5 - mov byte[pressed+086h],1 -.nob5 - mov eax,[JoyX2] - cmp eax,[JoyMinX2] - jae .nob6 - mov byte[pressed+087h],1 -.nob6 - cmp byte[Buttons6],2 - jne .no8b - mov eax,[JoyY2] - cmp eax,[JoyMaxY2] - jbe .nob7 - mov byte[pressed+80h],1 -.nob7 - mov eax,[JoyX2] - cmp eax,[JoyMaxX2] - jbe .nob8 - mov byte[pressed+81h],1 -.nob8 -.no8b - jmp .1pcoord -.no2joyst - - ; Set 1 player control - cmp byte[JoyQuant],1 - jne near .no1joyst - mov dx,201h - call GetCoords -.1pcoord - mov eax,[JoyX] - cmp eax,[JoyMinX] - jae .noleft - mov byte[pressed+0CEh],1 -.noleft - mov eax,[JoyX] - cmp eax,[JoyMaxX] - jbe .noright - mov byte[pressed+0CFh],1 -.noright - mov eax,[JoyY] - cmp eax,[JoyMinY] - jae .noup - mov byte[pressed+0CCh],1 -.noup - mov eax,[JoyY] - cmp eax,[JoyMaxY] - jbe .nodown - mov byte[pressed+0CDh],1 -.nodown -.no1joyst -.noanalog - test byte[JoyAltrn],1 - jz .joynotexist - mov dword[pressed+82h],0 ; B1-4 - cmp byte[JoyQuant],0 - je .joynotexist - ; Set buttons 1-4 - mov dx, 0201h - xor al,al - out dx, al - in al, dx - not al - test al,10h - jz .nob1 - mov byte[pressed+82h],1 -.nob1 - test al,20h - jz .nob2 - mov byte[pressed+83h],1 -.nob2 - cmp byte[JoyBQuant],2 - je .joynotexist - test al,40h - jz .nob3 - mov byte[pressed+84h],1 -.nob3 - test al,80h - jz .nob4 - mov byte[pressed+85h],1 -.nob4 -.joynotexist - ; Process Joystick Buttons - cmp byte[JoyQuant209],0 - je .no209 - call JoyRead209 -.no209 - test byte[JoyAltrn],1 - jz near .noport4 - cmp byte[NumSWs],0 - je .nosw - call SideWinder -.nosw - cmp byte[NumSWs209],0 - je .nosw209 - call SideWinder209 -.nosw209 - test byte[JoyAltrn],2 - jz .nogrip209 - cmp byte[NumGRiPs],0 - je .nogrip - call GamePadPro -.nogrip - cmp byte[NumGRiPs209],0 - je .nogrip209 - call GamePadPro209 -.nogrip209 - test byte[PPad],1 - jz .noport1 - call GetParallelPlayer1 -.noport1 - test byte[PPad],2 - jz .noport2 - call GetParallelPlayer2 -.noport2 - test byte[PPad],4 - jz .noport3 - call GetParallelPlayer3 -.noport3 - test byte[PPad],8 - jz .noport4 - call GetParallelPlayer4 -.noport4 - test byte[PPad],16 - jz .noport5 - call GetParallelPlayer5 -.noport5 - cmp byte[JoyAltrn],0 - je .nogpp2209 - cmp byte[NumGRiPs],2 - jne .nogpp2 - call GamePadPro2 -.nogpp2 - cmp byte[NumGRiPs209],2 - jne .nogpp2209 - call GamePadPro2209 -.nogpp2209 - pop ecx - pop ebx - pop edx - ret - -;bit 1 - left,2 - right,3 - down,4 - up,5 - r1,6 - l1,7 - red,8 - yellow -; 9 - green,10 - l2,11 - blue,12 - r2,13 - start,14 - select - -%macro GPProHelp 2 - test eax,%1 - jz %%nope - mov byte[pressed+ebx+%2],1 -%%nope -%endmacro - -;A8=buttons, CA=select/start, F0=movement (inc by 4) -GamePadPro: - mov al,0 - mov dx,201h - call read_gpp - cmp eax,1 - je near .error - xor ebx,ebx - mov byte[pressed+ebx+0F0h],0 - mov byte[pressed+ebx+0F1h],0 - mov byte[pressed+ebx+0F2h],0 - mov byte[pressed+ebx+0F3h],0 - mov byte[pressed+ebx+0A8h],0 - mov byte[pressed+ebx+0A9h],0 - mov byte[pressed+ebx+0AAh],0 - mov byte[pressed+ebx+0ABh],0 - mov byte[pressed+ebx+0ACh],0 - mov byte[pressed+ebx+0ADh],0 - mov byte[pressed+ebx+0AEh],0 - mov byte[pressed+ebx+0AFh],0 - mov byte[pressed+ebx+0CAh],0 - mov byte[pressed+ebx+0CBh],0 - GPProHelp 0002h,0F2h ; left - GPProHelp 0004h,0F3h ; right - GPProHelp 0008h,0F1h ; down - GPProHelp 0010h,0F0h ; up - GPProHelp 0020h,0AEh ; r1 - GPProHelp 0040h,0ACh ; l1 - GPProHelp 0080h,0A8h ; red - GPProHelp 0100h,0AAh ; yellow - GPProHelp 0200h,0ABh ; green - GPProHelp 0400h,0ADh ; l2 - GPProHelp 0800h,0A9h ; blue - GPProHelp 1000h,0AFh ; r2 - GPProHelp 2000h,0CBh ; start - GPProHelp 4000h,0CAh ; select -.error - ret - -GamePadPro2: - mov al,1 - mov dx,201h - call read_gpp - cmp eax,1 - je near .error - mov ebx,4 - mov byte[pressed+ebx+0F0h],0 - mov byte[pressed+ebx+0F1h],0 - mov byte[pressed+ebx+0F2h],0 - mov byte[pressed+ebx+0F3h],0 - mov ebx,8 - mov byte[pressed+ebx+0A8h],0 - mov byte[pressed+ebx+0A9h],0 - mov byte[pressed+ebx+0AAh],0 - mov byte[pressed+ebx+0ABh],0 - mov byte[pressed+ebx+0ACh],0 - mov byte[pressed+ebx+0ADh],0 - mov byte[pressed+ebx+0AEh],0 - mov byte[pressed+ebx+0AFh],0 - mov byte[pressed+ebx+0CAh],0 - mov byte[pressed+ebx+0CBh],0 - mov ebx,4 - GPProHelp 0002h,0F2h ; left - GPProHelp 0004h,0F3h ; right - GPProHelp 0008h,0F1h ; down - GPProHelp 0010h,0F0h ; up - mov ebx,8 - GPProHelp 0020h,0AEh ; r1 - GPProHelp 0040h,0ACh ; l1 - GPProHelp 0080h,0A8h ; red - GPProHelp 0100h,0AAh ; yellow - GPProHelp 0200h,0ABh ; green - GPProHelp 0400h,0ADh ; l2 - GPProHelp 0800h,0A9h ; blue - GPProHelp 1000h,0AFh ; r2 - GPProHelp 2000h,0CBh ; start - GPProHelp 4000h,0CAh ; select -.error - ret - -SideWinder: - mov al,[NumSWs] - mov [_SWCount],al - mov dx,201h - call _readSideWinder - ;bit 0=error 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 - ;k....L=L, R=R, start=start, M=select, X=y, Y=x, B=a, A=b - ;sidewinder=snes -.loop - mov eax,[_SW1] - xor ebx,ebx - cmp byte[WhichSW],2 - jne .noSW2 - mov eax,[_SW2] - mov ebx,08h -.noSW2 - cmp byte[WhichSW],3 - jne .noSW3 - mov eax,[_SW3] - mov ebx,10h -.noSW3 - cmp byte[WhichSW],4 - jne .noSW4 - mov eax,[_SW4] - mov ebx,18h -.noSW4 - inc byte[WhichSW] - mov byte[pressed+ebx+0D4h],0 - mov byte[pressed+ebx+0D5h],0 - mov byte[pressed+ebx+0D6h],0 - mov byte[pressed+ebx+0D7h],0 - mov byte[pressed+ebx+088h],0 - mov byte[pressed+ebx+089h],0 - mov byte[pressed+ebx+08Ah],0 - mov byte[pressed+ebx+08Bh],0 - mov byte[pressed+ebx+08Ch],0 - mov byte[pressed+ebx+08Dh],0 - mov byte[pressed+ebx+08Eh],0 - mov byte[pressed+ebx+08Fh],0 - mov byte[pressed+ebx+0C8h],0 - mov byte[pressed+ebx+0C9h],0 - test ax,02h ; up - jz .noup - mov byte[pressed+ebx+0D4h],1 -.noup - test ax,04h ; down - jz .nodown - mov byte[pressed+ebx+0D5h],1 -.nodown - test ax,08h ; right - jz .noright - mov byte[pressed+ebx+0D7h],1 -.noright - test ax,10h ; left - jz .noleft - mov byte[pressed+ebx+0D6h],1 -.noleft - test ax,20h ; A - jz .noa - mov byte[pressed+ebx+088h],1 -.noa - test ax,40h ; B - jz .nob - mov byte[pressed+ebx+089h],1 -.nob - test ax,80h ; C - jz .noc - mov byte[pressed+ebx+08Ah],1 -.noc - test ax,100h ; X - jz .nox - mov byte[pressed+ebx+08Bh],1 -.nox - test ax,200h ; Y - jz .noy - mov byte[pressed+ebx+08Ch],1 -.noy - test ax,400h ; Z - jz .noz - mov byte[pressed+ebx+08Dh],1 -.noz - test ax,800h ; L - jz .nol - mov byte[pressed+ebx+08Eh],1 -.nol - test ax,1000h ; R - jz .nor - mov byte[pressed+ebx+08Fh],1 -.nor - test ax,2000h ; start - jz .nostart - mov byte[pressed+ebx+0C8h],1 -.nostart - test ax,4000h ; M - jz .noselect - mov byte[pressed+ebx+0C9h],1 -.noselect - mov al,[WhichSW] - cmp al,[NumSWs] - jbe near .loop - ret ;return to calling procedure - -;A8=buttons, CA=select/start, F0=movement (inc by 4) -GamePadPro209: - mov al,0 - mov dx,209h - call read_gpp - cmp eax,1 - je near .error - xor ebx,ebx - mov byte[pressed+ebx+170h],0 - mov byte[pressed+ebx+171h],0 - mov byte[pressed+ebx+172h],0 - mov byte[pressed+ebx+173h],0 - mov byte[pressed+ebx+128h],0 - mov byte[pressed+ebx+129h],0 - mov byte[pressed+ebx+12Ah],0 - mov byte[pressed+ebx+12Bh],0 - mov byte[pressed+ebx+12Ch],0 - mov byte[pressed+ebx+12Dh],0 - mov byte[pressed+ebx+12Eh],0 - mov byte[pressed+ebx+12Fh],0 - mov byte[pressed+ebx+14Ah],0 - mov byte[pressed+ebx+14Bh],0 - GPProHelp 0002h,1F2h ; left - GPProHelp 0004h,1F3h ; right - GPProHelp 0008h,1F1h ; down - GPProHelp 0010h,1F0h ; up - GPProHelp 0020h,1AEh ; r1 - GPProHelp 0040h,1ACh ; l1 - GPProHelp 0080h,1A8h ; red - GPProHelp 0100h,1AAh ; yellow - GPProHelp 0200h,1ABh ; green - GPProHelp 0400h,1ADh ; l2 - GPProHelp 0800h,1A9h ; blue - GPProHelp 1000h,1AFh ; r2 - GPProHelp 2000h,1CBh ; start - GPProHelp 4000h,1CAh ; select -.error - ret - -GamePadPro2209: - mov al,1 - mov dx,209h - call read_gpp - cmp eax,1 - je near .error - mov ebx,4 - mov byte[pressed+ebx+170h],0 - mov byte[pressed+ebx+171h],0 - mov byte[pressed+ebx+172h],0 - mov byte[pressed+ebx+173h],0 - mov ebx,8 - mov byte[pressed+ebx+128h],0 - mov byte[pressed+ebx+129h],0 - mov byte[pressed+ebx+12Ah],0 - mov byte[pressed+ebx+12Bh],0 - mov byte[pressed+ebx+12Ch],0 - mov byte[pressed+ebx+12Dh],0 - mov byte[pressed+ebx+12Eh],0 - mov byte[pressed+ebx+12Fh],0 - mov byte[pressed+ebx+14Ah],0 - mov byte[pressed+ebx+14Bh],0 - mov ebx,4 - GPProHelp 0002h,1F2h ; left - GPProHelp 0004h,1F3h ; right - GPProHelp 0008h,1F1h ; down - GPProHelp 0010h,1F0h ; up - mov ebx,8 - GPProHelp 0020h,1AEh ; r1 - GPProHelp 0040h,1ACh ; l1 - GPProHelp 0080h,1A8h ; red - GPProHelp 0100h,1AAh ; yellow - GPProHelp 0200h,1ABh ; green - GPProHelp 0400h,1ADh ; l2 - GPProHelp 0800h,1A9h ; blue - GPProHelp 1000h,1AFh ; r2 - GPProHelp 2000h,1CBh ; start - GPProHelp 4000h,1CAh ; select -.error - ret - -SideWinder209: - mov al,[NumSWs209] - mov [_SWCount],al - mov dx,209h - call _readSideWinder - ;bit 0=error 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 - ;k....L=L, R=R, start=start, M=select, X=y, Y=x, B=a, A=b - ;sidewinder=snes -.loop - mov eax,[_SW1] - xor ebx,ebx - cmp byte[WhichSW],2 - jne .noSW2 - mov eax,[_SW2] - mov ebx,08h -.noSW2 - cmp byte[WhichSW],3 - jne .noSW3 - mov eax,[_SW3] - mov ebx,10h -.noSW3 - cmp byte[WhichSW],4 - jne .noSW4 - mov eax,[_SW4] - mov ebx,18h -.noSW4 - inc byte[WhichSW] - mov byte[pressed+ebx+154h],0 - mov byte[pressed+ebx+155h],0 - mov byte[pressed+ebx+156h],0 - mov byte[pressed+ebx+157h],0 - mov byte[pressed+ebx+108h],0 - mov byte[pressed+ebx+109h],0 - mov byte[pressed+ebx+10Ah],0 - mov byte[pressed+ebx+10Bh],0 - mov byte[pressed+ebx+10Ch],0 - mov byte[pressed+ebx+10Dh],0 - mov byte[pressed+ebx+10Eh],0 - mov byte[pressed+ebx+10Fh],0 - mov byte[pressed+ebx+148h],0 - mov byte[pressed+ebx+149h],0 - test ax,02h ; up - jz .noup - mov byte[pressed+ebx+154h],1 -.noup - test ax,04h ; down - jz .nodown - mov byte[pressed+ebx+155h],1 -.nodown - test ax,08h ; right - jz .noright - mov byte[pressed+ebx+157h],1 -.noright - test ax,10h ; left - jz .noleft - mov byte[pressed+ebx+156h],1 -.noleft - test ax,20h ; A - jz .noa - mov byte[pressed+ebx+108h],1 -.noa - test ax,40h ; B - jz .nob - mov byte[pressed+ebx+109h],1 -.nob - test ax,80h ; C - jz .noc - mov byte[pressed+ebx+10Ah],1 -.noc - test ax,100h ; X - jz .nox - mov byte[pressed+ebx+10Bh],1 -.nox - test ax,200h ; Y - jz .noy - mov byte[pressed+ebx+10Ch],1 -.noy - test ax,400h ; Z - jz .noz - mov byte[pressed+ebx+10Dh],1 -.noz - test ax,800h ; L - jz .nol - mov byte[pressed+ebx+10Eh],1 -.nol - test ax,1000h ; R - jz .nor - mov byte[pressed+ebx+10Fh],1 -.nor - test ax,2000h ; start - jz .nostart - mov byte[pressed+ebx+148h],1 -.nostart - test ax,4000h ; M - jz .noselect - mov byte[pressed+ebx+149h],1 -.noselect - mov al,[WhichSW] - cmp al,[NumSWs209] - jbe near .loop - ret ;return to calling procedure - -; Parallel SNES pad reader routines by Karl Stenerud -; Original design by Benji York: -; - -%macro PPortHelp 3 - mov al, %1 - out dx, al - mov al, 0F8h - out dx, al - inc dx - in al, dx - dec dx - and ax, %2 - jnz %%nobutton - mov byte[pressed+%3], 1 -%%nobutton -%endmacro - -%macro PPortHelpInv 3 ;needed for the pad 5 - mov al, %1 - out dx, al - mov al, 0F8h - out dx, al - inc dx - in al, dx - dec dx - and ax, %2 - jz %%nobutton ;pad 5 is on pin 11, which is hardware inverted... - mov byte[pressed+%3], 1 -%%nobutton -%endmacro - -GetParallelPlayer1: - mov dx, 0378h - mov byte[pressed+180h],0 - mov byte[pressed+181h],0 - mov byte[pressed+182h],0 - mov byte[pressed+183h],0 - mov byte[pressed+184h],0 - mov byte[pressed+185h],0 - mov byte[pressed+186h],0 - mov byte[pressed+187h],0 - mov byte[pressed+188h],0 - mov byte[pressed+189h],0 - mov byte[pressed+18Ah],0 - mov byte[pressed+18Bh],0 - PPortHelp 0FAh, 40h, 180h ;Mask 40h (pin 10 of lpt : data for pad 1) - PPortHelp 0F9h, 40h, 181h - PPortHelp 0F9h, 40h, 182h - PPortHelp 0F9h, 40h, 183h - PPortHelp 0F9h, 40h, 184h - PPortHelp 0F9h, 40h, 185h - PPortHelp 0F9h, 40h, 186h - PPortHelp 0F9h, 40h, 187h - PPortHelp 0F9h, 40h, 188h - PPortHelp 0F9h, 40h, 189h - PPortHelp 0F9h, 40h, 18Ah - PPortHelp 0F9h, 40h, 18Bh - ret - -GetParallelPlayer2: - mov dx, 0378h - mov byte[pressed+190h],0 - mov byte[pressed+191h],0 - mov byte[pressed+192h],0 - mov byte[pressed+193h],0 - mov byte[pressed+194h],0 - mov byte[pressed+195h],0 - mov byte[pressed+196h],0 - mov byte[pressed+197h],0 - mov byte[pressed+198h],0 - mov byte[pressed+199h],0 - mov byte[pressed+19Ah],0 - mov byte[pressed+19Bh],0 - PPortHelp 0FAh, 20h, 190h ;Mask 20h (pin 12 of lpt : data for pad 2) - PPortHelp 0F9h, 20h, 191h - PPortHelp 0F9h, 20h, 192h - PPortHelp 0F9h, 20h, 193h - PPortHelp 0F9h, 20h, 194h - PPortHelp 0F9h, 20h, 195h - PPortHelp 0F9h, 20h, 196h - PPortHelp 0F9h, 20h, 197h - PPortHelp 0F9h, 20h, 198h - PPortHelp 0F9h, 20h, 199h - PPortHelp 0F9h, 20h, 19Ah - PPortHelp 0F9h, 20h, 19Bh - ret - -GetParallelPlayer3: - mov dx, 0378h - mov byte[pressed+1A0h],0 - mov byte[pressed+1A1h],0 - mov byte[pressed+1A2h],0 - mov byte[pressed+1A3h],0 - mov byte[pressed+1A4h],0 - mov byte[pressed+1A5h],0 - mov byte[pressed+1A6h],0 - mov byte[pressed+1A7h],0 - mov byte[pressed+1A8h],0 - mov byte[pressed+1A9h],0 - mov byte[pressed+1AAh],0 - mov byte[pressed+1ABh],0 - PPortHelp 0FAh, 10h, 1A0h ;Mask 10h (pin 13 of lpt : data for pad 3) - PPortHelp 0F9h, 10h, 1A1h - PPortHelp 0F9h, 10h, 1A2h - PPortHelp 0F9h, 10h, 1A3h - PPortHelp 0F9h, 10h, 1A4h - PPortHelp 0F9h, 10h, 1A5h - PPortHelp 0F9h, 10h, 1A6h - PPortHelp 0F9h, 10h, 1A7h - PPortHelp 0F9h, 10h, 1A8h - PPortHelp 0F9h, 10h, 1A9h - PPortHelp 0F9h, 10h, 1AAh - PPortHelp 0F9h, 10h, 1ABh - ret - -GetParallelPlayer4: - mov dx, 0378h - mov byte[pressed+1B0h],0 - mov byte[pressed+1B1h],0 - mov byte[pressed+1B2h],0 - mov byte[pressed+1B3h],0 - mov byte[pressed+1B4h],0 - mov byte[pressed+1B5h],0 - mov byte[pressed+1B6h],0 - mov byte[pressed+1B7h],0 - mov byte[pressed+1B8h],0 - mov byte[pressed+1B9h],0 - mov byte[pressed+1BAh],0 - mov byte[pressed+1BBh],0 - PPortHelp 0FAh, 08h, 1B0h - PPortHelp 0F9h, 08h, 1B1h ;Mask 08h (pin 15 of lpt : data for pad 4) - PPortHelp 0F9h, 08h, 1B2h - PPortHelp 0F9h, 08h, 1B3h - PPortHelp 0F9h, 08h, 1B4h - PPortHelp 0F9h, 08h, 1B5h - PPortHelp 0F9h, 08h, 1B6h - PPortHelp 0F9h, 08h, 1B7h - PPortHelp 0F9h, 08h, 1B8h - PPortHelp 0F9h, 08h, 1B9h - PPortHelp 0F9h, 08h, 1BAh - PPortHelp 0F9h, 08h, 1BBh - ret - -GetParallelPlayer5: - mov dx, 0378h - mov byte[pressed+1c0h],0 - mov byte[pressed+1c1h],0 - mov byte[pressed+1c2h],0 - mov byte[pressed+1c3h],0 - mov byte[pressed+1c4h],0 - mov byte[pressed+1c5h],0 - mov byte[pressed+1c6h],0 - mov byte[pressed+1c7h],0 - mov byte[pressed+1c8h],0 - mov byte[pressed+1c9h],0 - mov byte[pressed+1cAh],0 - mov byte[pressed+1cBh],0 - PPortHelpInv 0FAh, 80h, 1c0h - PPortHelpInv 0F9h, 80h, 1c1h ;Mask 80h (pin 11 of lpt : data for pad 5) - PPortHelpInv 0F9h, 80h, 1c2h - PPortHelpInv 0F9h, 80h, 1c3h - PPortHelpInv 0F9h, 80h, 1c4h - PPortHelpInv 0F9h, 80h, 1c5h - PPortHelpInv 0F9h, 80h, 1c6h - PPortHelpInv 0F9h, 80h, 1c7h - PPortHelpInv 0F9h, 80h, 1c8h - PPortHelpInv 0F9h, 80h, 1c9h - PPortHelpInv 0F9h, 80h, 1cAh - PPortHelpInv 0F9h, 80h, 1cBh - ret - -%macro SetDefaultKey2 13 - mov dword[%1upk],%4 ; Up - mov dword[%1downk],%5 ; Down - mov dword[%1leftk],%6 ; Left - mov dword[%1rightk],%7 ; Right - mov dword[%1startk],%3 ; Start - mov dword[%1selk],%2 ; Select - mov dword[%1Ak],%9 ; A - mov dword[%1Bk],%12 ; B - mov dword[%1Xk],%8 ; X - mov dword[%1Yk],%11 ; Y - mov dword[%1Lk],%10 ; L - mov dword[%1Rk],%13 ; R -%endmacro - -%macro SetDefaultKey 12 - cmp bh,0 - jne %%nopl1 - SetDefaultKey2 pl1,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl1 - cmp bh,1 - jne %%nopl2 - SetDefaultKey2 pl2,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl2 - cmp bh,2 - jne %%nopl3 - SetDefaultKey2 pl3,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl3 - cmp bh,3 - jne %%nopl4 - SetDefaultKey2 pl4,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl4 - cmp bh,4 - jne %%nopl5 - SetDefaultKey2 pl5,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl5 -%endmacro - -NEWSYM SetInputDevice209 - ; bl = device #, bh = player # (0-4) - ; Sets keys according to input device selected - cmp bl,0 - jne near .nozero - SetDefaultKey 0,0,0,0,0,0,0,0,0,0,0,0 - ret -.nozero - cmp bl,1 - jne near .nokeyb - cmp bh,1 - ja near .exit - cmp bh,1 - je near .input2 - SetDefaultKey 54,28,72,80,75,77,31,45,32,30,44,46 - ret -.input2 - SetDefaultKey 56,29,37,50,49,51,82,71,73,83,79,81 - ret -.nokeyb - cmp bl,2 - jne near .no2buttons - xor bl,bl - cmp byte[pl1contrl],2 - jne .nopl2a - inc bl -.nopl2a - cmp byte[pl2contrl],2 - jne .nopl2b - inc bl -.nopl2b - cmp byte[pl3contrl],2 - jne .nopl2c - inc bl -.nopl2c - cmp byte[pl4contrl],2 - jne .nopl2d - inc bl -.nopl2d - cmp byte[pl5contrl],2 - jne .nopl2e - inc bl -.nopl2e - cmp bl,2 - jae .2ndjoyst - SetDefaultKey 0,0,14Ch,14Dh,14Eh,14Fh,0,0,0,102h,103h,0 - ret -.2ndjoyst - SetDefaultKey 0,0,168h,169h,16Ah,16Bh,0,0,0,104h,105h,0 - ret -.no2buttons - cmp bl,3 - jne near .no4buttons - SetDefaultKey 0,0,14Ch,14Dh,14Eh,14Fh,104h,105h,0,102h,103h,0 - ret -.no4buttons - cmp bl,4 - jne near .no6buttons - SetDefaultKey 0,0,14Ch,14Dh,14Eh,14Fh,104h,105h,106h,102h,103h,107h - ret -.no6buttons - cmp bl,5 - jne near .skip8b - SetDefaultKey 101h,100h,14Ch,14Dh,14Eh,14Fh,104h,105h,107h,102h,103h,106h - ret -.skip8b - cmp bl,6 - jne near .nosw1 - SetDefaultKey 149h,148h,154h,155h,156h,157h,10Ch,109h,10Eh,10Bh,108h,10Fh - ret -.nosw1 - cmp bl,7 - jne near .nosw2 - SetDefaultKey 149h+8,148h+8,154h+8,155h+8,156h+8,157h+8,10Ch+8,109h+8,10Eh+8,10Bh+8,108h+8,10Fh+8 - ret -.nosw2 - cmp bl,8 - jne near .nosw3 - SetDefaultKey 149h+8*2,148h+8*2,154h+8*2,155h+8*2,156h+8*2,157h+8*2,10Ch+8*2,109h+8*2,10Eh+8*2,10Bh+8*2,108h+8*2,10Fh+8*2 - ret -.nosw3 - cmp bl,9 - jne near .nosw4 - SetDefaultKey 149h+8*3,148h+8*3,154h+8*3,155h+8*3,156h+8*3,157h+8*3,10Ch+8*3,109h+8*3,10Eh+8*3,10Bh+8*3,108h+8*3,10Fh+8*3 - ret -.nosw4 - cmp bl,10 - jne near .nogrip0 - SetDefaultKey 14Ah,14Bh,170h,171h,172h,173h,129h,12Bh,12Ch,128h,12Ah,12Eh - ret -.nogrip0 - cmp bl,11 - jne near .nogrip1 - SetDefaultKey 14Ah+8,14Bh+8,170h+4,171h+4,172h+4,173h+4,129h+8,12Bh+8,12Ch+8,128h+8,12Ah+8,12Eh+8 - ret -.nogrip1 - cmp bl,12 - jne near .nopp1 - SetDefaultKey 182h,183h,184h,185h,186h,187h,189h,188h,18Ah,181h,180h,18Bh - ret -.nopp1 - cmp bl,13 - jne near .nopp2 - SetDefaultKey 192h,193h,194h,195h,196h,197h,199h,198h,19Ah,191h,190h,19Bh - ret -.nopp2 - cmp bl,14 - jne near .nopp3 - SetDefaultKey 1A2h,1A3h,1A4h,1A5h,1A6h,1A7h,1A9h,1A8h,1AAh,1A1h,1A0h,1ABh - ret -.nopp3 - cmp bl,15 - jne near .nopp4 - SetDefaultKey 1B2h,1B3h,1B4h,1B5h,1B6h,1B7h,1B9h,1B8h,1BAh,1B1h,1B0h,1BBh - ret -.nopp4 - cmp bl,16 - jne near .nopp5 - SetDefaultKey 1C2h,1C3h,1C4h,1C5h,1C6h,1C7h,1C9h,1C8h,1CAh,1C1h,1C0h,1CBh - ret -.nopp5 -.exit - ret diff --git a/tools/zsnes/src/dos/lib.c b/tools/zsnes/src/dos/lib.c deleted file mode 100644 index 08eb74f..0000000 --- a/tools/zsnes/src/dos/lib.c +++ /dev/null @@ -1,185 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//C++ style code in C -#define bool unsigned char -#define true 1 -#define false 0 - -#define BIT(X) (1 << (X)) - - -//This file contains library functions that can be found on other OSs - - -//Return realpath in 8.3 or LFN format for any given filename -//Based on code from DJGPP website, here was the notice for that code: - -/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -/* - * This is file TRUENAME.C - * - * Copyright (c) 1994, 1995 Eli Zaretskii - * - * This software may be used freely so long as this copyright notice is - * left intact. There is no warranty on this software. - * - */ - -static char *realpath_internal(const char *file, char *buf, bool LFN) -{ - __dpmi_regs regs; - unsigned short dos_mem_selector = _dos_ds; - unsigned short our_mem_selector = _my_ds(); - char true_name[FILENAME_MAX]; - char file_name[FILENAME_MAX], *name_end; - - if (!file || !*file) - { - errno = EINVAL; - buf = 0; - } - else - { - strncpy(file_name, file, FILENAME_MAX); - file_name[FILENAME_MAX - 1] = 0; - - for (name_end = file_name + strlen(file_name) - 1; name_end >= file_name && isspace((unsigned char)*name_end); ) - { - *name_end-- = 0; - } - - if ((strlen(file_name) == 2) && (file_name[1] == ':')) - { - strcat(name_end, "\\."); - } - else if ((*name_end == '\\') && (name_end-file_name < FILENAME_MAX-2)) - { - strcat(name_end, "."); - } - - _put_path(file_name); - - regs.x.ax = _USE_LFN ? 0x7160 : 0x6000; - regs.x.cx = LFN+1; - regs.x.ds = regs.x.es = __tb_segment; - regs.x.si = __tb_offset; - regs.x.di = __tb_offset + FILENAME_MAX; - __dpmi_int(0x21, ®s); - - movedata(dos_mem_selector, __tb + FILENAME_MAX, our_mem_selector, (unsigned int)true_name, FILENAME_MAX); - - if (regs.x.flags & 1) - { - errno = __doserr_to_errno(regs.x.ax); - buf = 0; - } - else - { - if (!buf) - { - buf = (char *)malloc(strlen(true_name)+1); - } - - if (buf) - { - strcpy(buf, true_name); - } - else - { - errno = ENOMEM; - } - } - } - return(buf); -} - -char *realpath_sfn(const char *file, char *buf) -{ - return(realpath_internal(file, buf, false)); -} - -char *realpath_lfn(const char *file, char *buf) -{ - return(realpath_internal(file, buf, true)); -} - -//We tested this with Hard Disks, Floppies, CD/DVD-ROM, Network drives, no issues. -//It should also be tested with RAM drives and on more versions of DOS (DR-DOS, MS-DOS 5.0, etc...) -static bool _is_drive(unsigned char drive) //A == 1, B == 2, etc... -{ - __dpmi_regs regs; - - regs.x.ax = 0x4409; - regs.x.bx = drive; - __dpmi_int(0x21, ®s); - - if (regs.x.flags & 1) - { - errno = __doserr_to_errno(regs.x.ax); - } - else if (((regs.x.dx & (BIT(9)|BIT(12))) == BIT(12)) || (regs.x.dx == 0x800)) - { - return(true); - } - - regs.x.ax = 0x4408; - regs.x.bx = drive; - __dpmi_int(0x21, ®s); - - if (regs.x.flags & 1) - { - errno = __doserr_to_errno(regs.x.ax); - return(false); - } - return(true); -} - -//Return bitmask of available drives, A = BIT(0), B = BIT(1), etc... -unsigned int GetLogicalDrives() -{ - unsigned int drives = 0; - int i; - for (i = 0; i < 26; i++) - { - if (_is_drive(i+1)) - { - drives |= BIT(i); - } - } - return(drives); -} diff --git a/tools/zsnes/src/dos/lib.h b/tools/zsnes/src/dos/lib.h deleted file mode 100644 index b6a9dc0..0000000 --- a/tools/zsnes/src/dos/lib.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef LIB_H -#define LIB_H - -char *realpath_sfn(const char *file, char *buf); -char *realpath_lfn(const char *file, char *buf); - -//Only beta versions of DJGPP currently have this function -#if (__DJGPP__ < 3) && (__DJGPP_MINOR__ < 4) -#define realpath(path, resolved_path) realpath_sfn(path, resolved_path) -#endif - -unsigned int GetLogicalDrives(); - -#endif diff --git a/tools/zsnes/src/dos/sound.asm b/tools/zsnes/src/dos/sound.asm deleted file mode 100644 index 853a87b..0000000 --- a/tools/zsnes/src/dos/sound.asm +++ /dev/null @@ -1,1421 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 ProcessSoundBuffer,DosExit,getenv,PrintStr,printhex,WaitForKey -EXTSYM SBHDMA,soundon,csounddisable,DisplayS,SPCRAM,DSPMem -EXTSYM StereoSound,SoundQuality,SoundSpeeds,SBToSPCSpeeds2 -EXTSYM SoundSpeedt,DSPBuffer,BufferSize,BufferSizes,BufferSizeB -EXTSYM BufferSizeW,dssel,PrintChar - -SECTION .text - -printnum: - ; process through each digit - push edx - push eax - push ebx - push cx - xor edx,edx ; clear high byte - xor cx,cx ; clear counter variable - mov ebx,10 -.loopa - div ebx ; get quotent and remainder - push edx ; store number to stack - inc cl - xor edx,edx - test eax,0FFFFFFFFh - jnz .loopa -.loopb - pop edx ; get number back from stack - add dl,30h ; adjust to ASCII value - call PrintChar - dec cl - jnz .loopb - pop cx - pop ebx - pop eax - pop edx - ret - -NEWSYM SB_alloc_dma - - mov ax,0100h ; Allocate DOS memory - mov bx,16384/16 ; Allocate 16384 bytes - int 31h - ; To delocate this, use ax=0101h, dx=selector of block/int 31h - jc near .error - ; Check which 8192 byte boundary doesn't cross a page - mov word[memoryloc+2],0 - mov dword[memoryloc],0 - mov [memoryloc],ax - mov [sbselec],dx - shl dword[memoryloc],4 - mov edx,[memoryloc] - shr edx,16 - mov al,dl - mov edx,[memoryloc] - add edx,8192 - shr edx,16 - mov dword[sbpmofs],0 - cmp al,dl - je .nonextarea - mov dword[sbpmofs],8192 - add dword[memoryloc],8192 -.nonextarea - mov edi,[sbpmofs] - mov [SBBufferLoc],edi - mov dword[SBBufferMov],1 - mov dword[SBBufferInc],4 - ; clear dos memory - push es - mov es,[sbselec] - mov edi,[sbpmofs] - mov ecx,2048 - mov eax,0 - rep stosd - pop es - ret - -.error - mov edx,.nohand ;use extended - mov ah,9 ;DOS- API - int 21h ;to print a string - call DosExit - -SECTION .data -.nohand db 'Unable to allocate conventional memory!',13,10,'$' -SECTION .text - - -NEWSYM DeInitSPC - cmp byte[SBDeinitType],0 - je .nodoublereset - call SB_dsp_reset - call SB_dsp_reset -.nodoublereset - ; Turn off speakers - mov al,0d3h - call SB_dsp_write - -; k) Perform Halt DMA Operation, 8-bit command (0D0h - for virtual speaker) - mov al,0d0h - call SB_dsp_write -; l) Perform Exit Auto-Initialize DMA Operation, 8-bit command (0DAh) - cmp byte[SBHDMA],0 - je .8b - mov al,0d9h - call SB_dsp_write - jmp .16b -.8b - mov al,0dAh - call SB_dsp_write -.16b -; m) Perform Halt DMA Operation, 8-bit command (0D0h - for virtual speaker) - mov al,0d0h - call SB_dsp_write - ; Disable DMA - mov al,4 - add al,[SBDMA] - mov dx,0ah - out dx,al - ret - -section .data - -;SoundBlaster DSP Ports -NEWSYM SBPort, dw 220 -NEWSYM SBInt, db 5+8 -NEWSYM SBIrq, db 5 -NEWSYM SBDMA, db 1 -NEWSYM SBDMAPage, db 83 -;NEWSYM SBHDMA, db 0 -NEWSYM SBHDMAPage, db 0 -NEWSYM vibracard, db 0 - -NEWSYM SBBufferLoc, dd 0 -NEWSYM SBBufferMov, dd 0 -NEWSYM SBBufferInc, dd 0 -NEWSYM SoundInterrupt, dd 0 - - -; ViBRA16X fixes! -EXTSYM MsgCount ; points to counter -EXTSYM MessageOn ; points to "message" delay counter -EXTSYM Msgptr ; points to the message to be displayed -NEWSYM vibmsg, db 'VIBRA16X MODE ENABLED', 0 - -section .text - -NEWSYM SB_dsp_reset - mov dx,[SBPort] - add dl,06h - mov al,01h - out dx,al - in al,dx - in al,dx - in al,dx - in al,dx - mov al,00h - out dx,al - - mov si,200 - mov dx,[SBPort] - add dl,0Eh -.readloop - - ; wait until port[SBDSPRdStat] AND 80h = 80h - mov cx,20000 -.tryagain - in al,dx - dec cx - jz .cardfailed - or al,al - jns .tryagain - sub dx,4 - in al,dx - cmp al,0AAh - jne .tryagain2 - ret -.tryagain2 - add dx,4 - dec si - jnz .readloop -.cardfailed - mov ax,0003h - int 10h - mov edx,initfailed ;use extended - mov ah,9 ;DOS- API - int 21h ;to print a string - jmp DosExit - -section .data -NEWSYM initfailed, db 'Sound card failed to initialize!',13,10,'$' -section .text - -; Write AL into DSP port -NEWSYM SB_dsp_write - mov dx,[SBPort] - add dl,0Ch - mov bl,al -.tryagain - in al,dx - test al,80h - jnz .tryagain - mov al,bl - out dx,al - ret - -; Read DSP port into AL -NEWSYM SB_dsp_read - mov dx,[SBPort] - add dl,0Eh - mov bl,al -.tryagain - in al,dx - test al,80h - jz .tryagain - mov dx,[SBPort] - add dl,0Ah - mov al,bl - in al,dx - ret - -;**************************************************** -; Sound Blaster Interrupt Stuff -;**************************************************** - -NEWSYM Interror - sti - mov edx,.nohand ;use extended - mov ah,9 ;DOS- API - int 21h ;to print a string - call DosExit - -section .data -.nohand db 'Cannot process interrupt handler!',13,10,'$' - -section .bss - -NEWSYM oldhandSBs, resw 1 -NEWSYM oldhandSBo, resd 1 -NEWSYM SBswitch, resb 1 ; which block to process next - -section .text - -NEWSYM SBHandler - cli - push ds - push eax - - -NEWSYM handlersbseg - mov ax,[cs:dssel] - mov ds,ax - - cmp byte[SBHDMA],0 - jne near SBHandler16 - - ; code added by peter santing - cmp byte[vibracard], 1 - je near SBHandler16 - - push ebx - push ecx - push edx - push edi - push esi - push es - - call GetCDMAPos - - cmp byte[csounddisable],1 - je near stopsbsound - test byte[DSPMem+6Ch],11000000b - jnz near stopsbsound - - ; Process the sound :I - - mov es,[sbselec] - cmp byte[SBswitch],0 - jne .2ndblock - mov edi,[sbpmofs] - jmp .startblockcopy -.2ndblock - ; copy to 2nd block - ; clear memory - mov edi,[sbpmofs] - add edi,[BufferSizeB] -.startblockcopy - - mov esi,DSPBuffer - mov ecx,[BufferSizeB] -.loopb - mov eax,[esi] - cmp eax,-32768 - jge .noneg3 - mov eax,-32768 -.noneg3 - cmp eax,32767 - jle .noneg4 - mov eax,32767 -.noneg4 - xor ah,80h - mov [es:edi],ah - add esi,4 - inc edi - dec ecx - jnz .loopb - jmp .sbend -.sbend - xor byte[SBswitch],1 - - ; move the good data at SPCRAM+0f3h - xor eax,eax - mov al,[SPCRAM+0F2h] - mov bl,[DSPMem+eax] - mov [SPCRAM+0F3h],bl - ; acknowledge SB for IRQing - mov dx,[SBPort] - add dl,0Eh - in al,dx - mov al,20h - out 20h,al - cmp byte[SBIrq],7 - jbe .nohighirq - mov al,20h - out 0A0h,al -.nohighirq - sti - jmp Startprocsbdata - -NEWSYM stopsbsound -; 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 ax,ds - mov es,ax - mov edi,DSPBuffer - mov ecx,[BufferSizeB] - xor eax,eax - rep stosd - - cmp byte[SBswitch],0 - jne near .2ndblock - - ; clear block - mov es,[sbselec] - mov edi,[sbpmofs] - mov ecx,[BufferSizeB] - shr ecx,2 -.loopa - mov dword[es:edi],80808080h - add edi,4 - dec ecx - jnz .loopa - jmp .sbend -.2ndblock - ; copy to 2nd block - ; clear memory - mov es,[sbselec] - mov edi,[sbpmofs] - add edi,[BufferSizeB] - mov ecx,[BufferSizeB] - shr ecx,2 -.loopb - mov dword[es:edi],80808080h - add edi,4 - dec ecx - jnz .loopb -.sbend - xor byte[SBswitch],1 - - ; acknowledge SB for IRQing - mov dx,[SBPort] - add dl,0Eh - in al,dx - mov al,20h - out 20h,al - cmp byte[SBIrq],7 - jbe .nohighirq - mov al,20h - out 0A0h,al -.nohighirq - - pop es - pop esi - pop edi - pop edx - pop ecx - pop ebx - pop eax - pop ds - sti - iretd - -section .bss -NEWSYM sbhandexec, resd 1 -section .text - -; Process 20 blocks * 8 voices (no pitch yet) -NEWSYM SBHandler16 - push ebx - push ecx - push edx - push edi - push esi - push es - inc dword[sbhandexec] - - cmp byte[vibracard], 1 - je .donotcallcmdapos - call GetCDMAPos -.donotcallcmdapos - - cmp byte[csounddisable],1 - je near stopsbsound16 - test byte[DSPMem+6Ch],11000000b - jnz near stopsbsound16 - - mov es,[sbselec] - - cmp byte[SBswitch],0 - jne near .2ndblock - mov edi,[sbpmofs] - jmp .doneblock -.2ndblock - ; copy to 2nd block - ; clear memory - mov edi,[sbpmofs] - add edi,[BufferSizeW] -.doneblock - mov esi,DSPBuffer - mov ecx,[BufferSizeB] -.loopb - mov eax,[esi] - cmp eax,-32768 - jge .noneg5 - mov eax,-32768 -.noneg5 - cmp eax,32767 - jle .noneg6 - mov eax,32767 -.noneg6 - mov [es:edi],ax - add esi,4 - add edi,2 - dec ecx - jnz .loopb - jmp .sbend -.sbend - xor byte[SBswitch],1 - - ; acknowledge SB for IRQing - mov dx,[SBPort] - add dl,0Fh - in al,dx - mov al,20h - out 20h,al - cmp byte[SBIrq],7 - jbe .nohighirq - mov al,20h - out 0A0h,al -.nohighirq - sti - - -Startprocsbdata: - push ebp - call ProcessSoundBuffer - pop ebp - pop es - pop esi - pop edi - pop edx - pop ecx - pop ebx - pop eax - pop ds - iretd - -NEWSYM stopsbsound16 -; 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 ax,ds - mov es,ax - mov edi,DSPBuffer - mov ecx,[BufferSizeB] - xor eax,eax - rep stosd - - cmp byte[SBswitch],0 - jne near .2ndblock - - ; clear block - mov es,[sbselec] - mov edi,[sbpmofs] - mov ecx,[BufferSizeB] - shr ecx,1 -.loopa - mov dword[es:edi],00000000h - add edi,4 - dec ecx - jnz .loopa - jmp .sbend -.2ndblock - ; copy to 2nd block - ; clear memory - mov es,[sbselec] - mov edi,[sbpmofs] - add edi,[BufferSizeW] - mov ecx,[BufferSizeB] - shr ecx,1 -.loopb - mov dword[es:edi],00000000h - add edi,4 - dec ecx - jnz .loopb -.sbend - xor byte[SBswitch],1 - - ; acknowledge SB for IRQing - mov dx,[SBPort] - add dl,0Fh - in al,dx - mov al,20h - out 20h,al - cmp byte[SBIrq],7 - jbe .nohighirq - mov al,20h - out 0A0h,al -.nohighirq - - pop es - pop esi - pop edi - pop edx - pop ecx - pop ebx - pop eax - pop ds - sti - iretd - -;**************************************************** -; Sound Blaster Initialization Stuff -;**************************************************** - -section .bss -NEWSYM memoryloc, resd 1 ; Memory offset in conventional memory -NEWSYM memoryloc2, resd 1 ; Memory offset in conventional memory -NEWSYM sbselec, resw 1 ; Selector of Memory location -NEWSYM sbpmofs, resd 1 ; offset of Memory location -SBDeinitType resb 1 -section .text - -NEWSYM InitSB - mov eax,[SoundQuality] - cmp byte[StereoSound],1 - jne .nostereobuf - mov ax,[BufferSizes+eax*2] - jmp .skipstereobuf -.nostereobuf - mov ax,[BufferSize+eax*2] -.skipstereobuf - - mov [BufferSizeB],ax - add ax,ax - mov [BufferSizeW],ax - - mov byte[SBswitch],0 - ; Allocate pointer - ; Set up SB - call SB_dsp_reset - - ; code added by peter santing - cmp byte[vibracard], 1 - je near .vibrafix2 - - cmp byte[SBHDMA],0 - je .no16bit - cmp byte[SBHDMA],4 - jb near .init16bitlowhdma - jmp .init16bit -.no16bit - - ; Determine Version # - mov al,0E1h - call SB_dsp_write - call SB_dsp_read - mov [.Versionnum],al - call SB_dsp_read - mov [.Versionnum+1],al - - ; Turn on speakers - mov al,0D1h - call SB_dsp_write - - ; Set Time-Constant Data ( = 256 - (1000000/sampling rate) ) - ; 8000=131, 22050=210, 44100=233, 11025=165 - mov al,40h - call SB_dsp_write - - cmp byte[StereoSound],1 - jne .nostereo8b -.surround8b - mov eax,[SoundQuality] - cmp eax,4 - je .okay - cmp eax,2 - jbe .okay - mov eax,2 -.okay - mov al,[SoundSpeedt+eax] - call SB_dsp_write - ; Set Stereo - mov dx, [SBPort] - add dx, 04h - mov al,0Eh - out dx,al - inc dx - in al,dx - or al,022h - out dx,al - jmp .donestereo -.nostereo8b - mov eax,[SoundQuality] - mov al,[SoundSpeeds+eax] - call SB_dsp_write -.donestereo - - cmp byte[StereoSound],1 - je .highmode - mov eax,[SoundQuality] - cmp byte[SoundSpeeds+eax],211 - ja .highmode - mov byte[.Versionnum],1 -.highmode - ; Setup DMA - ; Select DMA channel - mov al,[SBDMA] - add al,4 - mov dx,000Ah - out dx,al - ; Clear DMA - mov al,00h - mov dx,000Ch - out dx,al - ; Set autoinit/write (set as DAC) - mov al,58h - add al,[SBDMA] - mov dx,000Bh - out dx,al - ; Send Offset Address - mov al,[memoryloc] - mov dl,[SBDMA] - shl dl,1 - out dx,al - mov al,[memoryloc+1] - out dx,al - ; Send length of entire block - mov ax,[BufferSizeW] - dec ax - inc dx - out dx,al - mov al,ah - out dx,al - ; Send page # (address/65536) - mov al,[memoryloc+2] - mov dl,[SBDMAPage] - out dx,al - ; turn on DMA - mov al,[SBDMA] - mov dx,000Ah - out dx,al - - ; Prepare SB for the first block - ; 8-bit auto-init, mono, unsigned - mov al,048h ; Sb 2.0 version... - call SB_dsp_write - - ; Send Length-1 to DSP port - mov ax,[BufferSizeB] - dec ax - call SB_dsp_write - mov al,ah - call SB_dsp_write - mov byte[SBDeinitType],1 - mov al,090h ; Sb 2.0 version... - cmp byte[.Versionnum],2 - jne .noversion2 - cmp byte[.Versionnum+1],0 - je .slowspeed -.noversion2 - cmp byte[.Versionnum],1 - ja .notversion1 -.slowspeed - mov byte[SBDeinitType],0 - mov al,1Ch -.notversion1 - call SB_dsp_write - jmp .fixsurround - -SECTION .bss -.Versionnum resw 1 -SECTION .text - -; ***************************************** -; **** alternate ViBRA16X SB init code **** by Peter Santing -; ***************************************** copied portions of original code -; and modified it. - -.vibrafix2 - ; notify user that we're in ViBRA16x mode.. - push eax - mov dword[Msgptr], vibmsg - mov eax, [MsgCount] - mov [MessageOn], eax - pop eax - - ; Set Time-Constant Data ( = 256 - (1000000/sampling rate) ) - ; 8000=131, 22050=210, 44100=233, 11025=165 - - ; Setup DMA - ; Select DMA channel - mov al,[SBDMA] - add al,4 - mov dx,000Ah - out dx,al - ; Clear DMA - mov al,00h - mov dx,000Ch - out dx,al - ; Set autoinit/write (set as DAC) - mov al,58h - add al,[SBDMA] - mov dx,000Bh - out dx,al - ; Send Offset Address - mov al,[memoryloc] - mov dl,[SBDMA] - shl dl,1 - out dx,al - mov al,[memoryloc+1] - out dx,al - ; Send length of entire block - mov ax,[BufferSizeW] - shl ax, 1 - dec ax - inc dx - out dx,al - mov al,ah - out dx,al - ; Send page # (address/65536) - mov al,[memoryloc+2] - mov dh, 0 - mov dl,[SBDMAPage] - out dx,al - ; turn on DMA - mov al,[SBDMA] - mov dx,000Ah - out dx,al - - mov al,41h - call SB_dsp_write - push ecx - mov ecx,[SoundQuality] - mov al,[SBToSPCSpeeds2+ecx*4+1] - pop ecx - call SB_dsp_write - push ecx - mov ecx,[SoundQuality] - mov al,[SBToSPCSpeeds2+ecx*4] - pop ecx - call SB_dsp_write - - ; Prepare SB for the first block - ; 16-bit auto-init, mono, unsigned - mov al,0B6h ; Sb 16 version (DSP 4) - call SB_dsp_write - cmp byte[StereoSound],1 - jne ._Mono -._surround - mov al,30h ; stereo/signed - call SB_dsp_write - jmp ._AfterStereo -._Mono - mov al,10h ; mono/signed - call SB_dsp_write -._AfterStereo - - ; Send Length-1 to DSP port - mov ax,[BufferSizeB] - dec ax - call SB_dsp_write - mov al,ah - call SB_dsp_write - - ; Turn on speakers - mov al,0D1h - call SB_dsp_write - - jmp .fixsurround - -; ******* end of alternate SB init code for ViBRA ******** - -.init16bitlowhdma - ; Set Time-Constant Data ( = 256 - (1000000/sampling rate) ) - ; 8000=131, 22050=210, 44100=233, 11025=165 - mov al,40h - call SB_dsp_write - - push ecx - mov ecx,[SoundQuality] - mov al,[SoundSpeeds+ecx] - pop ecx - call SB_dsp_write - - mov edx,[memoryloc] - shr edx,1 - mov [memoryloc2],edx - - ; Setup DMA - - ; turn off DMA -; mov al,[SBHDMA] -; and al,03h -; or al,04h -; mov dx,00D4h -; out dx,al - - ; Setup DMA - ; Select DMA channel - mov al,[SBHDMA] - and al,03h - or al,04h - mov dx,000Ah - out dx,al - - ; clear flip-flop - mov dx,00D8h - xor al,al - out dx,al - - ; Set autoinit/write (set as DAC) - mov al,[SBHDMA] - and al,3 - add al,58h - mov dx,00D6h - out dx,al - - ; Send Offset Address -; mov al,[memoryloc2] -; mov dl,[SBHDMA] -; and dl,3 -; shl dl,2 -; add dl,0C0h -; out dx,al -; mov al,[memoryloc2+1] -; out dx,al - - ; Send Offset Address - mov al,[memoryloc] - mov dl,[SBDMA] - shl dl,1 - out dx,al - mov al,[memoryloc+1] - out dx,al - - ; Send length of entire block - mov ax,[BufferSizeW] - dec ax - add dx,2 - out dx,al - mov al,ah - out dx,al - - ; Send page # (address/65536) - mov al,[memoryloc+2] - mov dl,[SBHDMAPage] - out dx,al - - ; Prepare SB for the first block - ; 16-bit auto-init, mono, unsigned - mov al,0B6h ; Sb 16 version (DSP 4) - call SB_dsp_write - cmp byte[StereoSound],1 - jne .Monol -.surroundl - mov al,30h ; stereo/signed - call SB_dsp_write - jmp .AfterStereol -.Monol - mov al,10h ; mono/signed - call SB_dsp_write -.AfterStereol - - ; Send Length-1 to DSP port - mov ax,[BufferSizeB] - dec ax - call SB_dsp_write - mov al,ah - call SB_dsp_write - - ; turn on DMA -; mov al,[SBHDMA] -; and al,03h -; mov dx,00D4h -; out dx,al - - ; Setup DMA - ; Select DMA channel - mov al,[SBHDMA] - and al,03h - mov dx,000Ah - out dx,al - - ; Turn on speakers - mov al,0D1h - call SB_dsp_write - jmp .fixsurround - -.init16bit - ; Set Time-Constant Data ( = 256 - (1000000/sampling rate) ) - ; 8000=131, 22050=210, 44100=233, 11025=165 - mov al,41h - call SB_dsp_write - push ecx - mov ecx,[SoundQuality] - mov al,[SBToSPCSpeeds2+ecx*4+1] - pop ecx - call SB_dsp_write - push ecx - mov ecx,[SoundQuality] - mov al,[SBToSPCSpeeds2+ecx*4] - pop ecx - call SB_dsp_write - - mov edx,[memoryloc] - shr edx,1 - mov [memoryloc2],edx - - ; Setup DMA - - ; turn off DMA - mov al,[SBHDMA] - and al,03h - or al,04h - mov dx,00D4h - out dx,al - - ; clear flip-flop - mov dx,00D8h - xor al,al - out dx,al - - ; Set autoinit/write (set as DAC) - mov al,[SBHDMA] - and al,3 - add al,58h - mov dx,00D6h - out dx,al - - ; Send Offset Address - mov al,[memoryloc2] - mov dl,[SBHDMA] - and dl,3 - shl dl,2 - add dl,0C0h - out dx,al - mov al,[memoryloc2+1] - out dx,al - - ; Send length of entire block - mov ax,[BufferSizeW] - dec ax - add dx,2 - out dx,al - mov al,ah - out dx,al - - ; Send page # (address/65536) - mov al,[memoryloc+2] - mov dl,[SBHDMAPage] - and al,0FEh - out dx,al - - ; Prepare SB for the first block - ; 16-bit auto-init, mono, unsigned - mov al,0B6h ; Sb 16 version (DSP 4) - call SB_dsp_write - cmp byte[StereoSound],1 - jne .Mono -.surround - mov al,30h ; stereo/signed - call SB_dsp_write - jmp .AfterStereo -.Mono - mov al,10h ; mono/signed - call SB_dsp_write -.AfterStereo - - ; Send Length-1 to DSP port - mov ax,[BufferSizeB] - dec ax - call SB_dsp_write - mov al,ah - call SB_dsp_write - - ; Turn on speakers - mov al,0D1h - call SB_dsp_write - - ; turn on DMA - mov al,[SBHDMA] - and al,03h - mov dx,00D4h - out dx,al - -.fixsurround - ret - - -GetCDMAPos: - ; clear flipflop - xor ebx,ebx - mov bl,[SBDMA] - cmp byte[SBHDMA],4 - jb .nohdma - mov bl,[SBHDMA] - mov dx,0Ch -.nohdma - mov dx,0D8h - xor al,al - out dx,al - nop - nop - nop - nop - mov dx,[.wordcountport+ebx*2] - - in al,dx - nop - nop - mov bl,al - in al,dx - nop - nop - nop - nop - mov bh,al - cmp byte[SBHDMA],4 - jb .ldma2 - add bx,bx -.ldma2 - ; value returned = bx, # of bytes left for transfer - mov cx,[BufferSizeB] - mov dx,cx - add cx,cx - cmp byte[SBHDMA],4 - jb .ldmab - add cx,cx - add dx,dx -.ldmab - sub cx,bx - mov byte[SBswitch],1 - cmp cx,dx - jb .parta - mov byte[SBswitch],0 -.parta - ret -SECTION .data -.wordcountport dw 1,3,5,7,0C2h,0C6h,0CAh,0CEh -SECTION .text - -; old routines, doesn't work w/ sb live! - jmp .fin - -.loop - in al,dx - nop - nop - mov cl,al - in al,dx - nop - nop - nop - nop - mov ch,al - in al,dx - nop - nop - mov bl,al - in al,dx - mov bh,al - sub cx,bx - test cx,8000h - jz .notneg - neg cx -.notneg - cmp byte[SBHDMA],4 - jb .ldma - add cx,cx - add bx,bx -.ldma - cmp cx,4 - ja .loop - -.fin - -NEWSYM SB_quality_limiter - cmp byte[StereoSound],1 - jne .nostereo8b - cmp byte[SBHDMA],0 - jne .nostereo8b - - ; ***************************************** - ; *** ViBRA16X support by Peter Santing *** - ; ***************************************** - ; before REALLY switching back to 8-bit sucky mono mode - ; check that we're dealing with a ViBRA16X Creative Labs Card - cmp byte[vibracard], 1 - je .nostereo8b - - cmp dword[SoundQuality],2 - jbe .nostereo8b - cmp dword[SoundQuality],4 - je .nostereo8b - mov dword[SoundQuality],2 -.nostereo8b - ret - -NEWSYM SB_blank - push es - mov es,[sbselec] - mov edi,[sbpmofs] - mov ecx,320 -.loopa - mov dword[es:edi],0 - add edi,4 - dec ecx - jnz .loopa - pop es - ret - -;******************************************************* -; Get Blaster Locates SET BLASTER environment -;******************************************************* -NEWSYM getblaster - mov edx,.string2s - push edx - call getenv - pop edx - cmp eax,0 - je near .nfound - - mov esi,eax - mov byte[.cursetting],0 -.a - mov dl,[esi] - cmp dl,'a' - jb .nocap - cmp dl,'z' - ja .nocap - sub dl,'a'-'A' -.nocap - inc esi - mov byte[.blfound],1 - cmp dl,'A' - jne .afound - mov byte[.cursetting],1 - mov word[SBPort],0 - jmp .src -.afound - cmp dl,'I' - jne .ifound - mov byte[.cursetting],2 - mov byte[SBIrq],0 - jmp .src -.ifound - cmp dl,'D' - jne .dfound - mov byte[.cursetting],3 - mov byte[SBDMA],0 - jmp .src -.dfound - cmp dl,'H' - jne .hfound - mov byte[.cursetting],4 - mov byte[SBHDMA],0 - jmp .src -.hfound - cmp dl,' ' - je .src2 - cmp dl,0 - je .src2 - jmp .src3 -.src2 - mov byte[.cursetting],0 - jmp .src -.src3 - cmp byte[.cursetting],1 - jne .nproca - shl word[SBPort],4 - sub dl,48 - add byte[SBPort],dl - add dl,48 -.nproca - cmp byte[.cursetting],2 - jne .nproci - cmp byte[SBIrq],1 - jne .no1 - mov byte[SBIrq],10 -.no1 - sub dl,48 - add [SBIrq],dl - add dl,48 -.nproci - cmp byte[.cursetting],3 - jne .nprocd - sub dl,48 - mov [SBDMA],dl - add dl,48 -.nprocd - cmp byte[.cursetting],4 - jne .nproch - sub dl,48 - mov [SBHDMA],dl - add dl,48 -.nproch -.src - cmp dl,0 - jne near .a - cmp byte[.blfound],0 - je near .nfound - cmp byte[SBIrq],2 - jne .noirq9 - mov byte[SBIrq],9 -.noirq9 - mov al,[SBIrq] - add al,08h - cmp byte[SBIrq],7 - jbe .nohighirq - add al,60h - add byte[PICRotateP],80h - add byte[PICMaskP],80h -.nohighirq - mov [SBInt],al - cmp byte[SBDMA],0 - jne .dma0 - mov byte[SBDMAPage],87h -.dma0 - cmp byte[SBDMA],1 - jne .dma1 - mov byte[SBDMAPage],83h -.dma1 - cmp byte[SBDMA],2 - jne .dma2 - mov byte[SBDMAPage],81h -.dma2 - cmp byte[SBDMA],3 - jne .dma3 - mov byte[SBDMAPage],82h -.dma3 -; ****************************************************** -; **** this piece of code is added by Peter Santing **** -; **** it will enable ZSNES to use the full STEREO **** -; **** capability of the ViBRA16X line of creative **** -; **** instead of playing 8-bit MONOURAL sound **** -; ****************************************************** -; cmp byte[SBHDMA], 0 -; jne .vibradma0 -; mov byte[SBDMAPage], 87h -; mov byte[vibracard], 1 ; set ViBRA16X mode -.vibradma0 - cmp byte[SBHDMA], 1 - jne .vibradma1 - mov byte[SBDMAPage], 83h - mov byte[vibracard], 1 ; set ViBRA16X mode -.vibradma1 - cmp byte[SBHDMA], 2 - jne .vibradma2 - mov byte[SBDMAPage], 81h - mov byte[vibracard], 1 ; set ViBRA16X mode -.vibradma2 - cmp byte[SBHDMA], 3 - jne .vibradma3 - mov byte[SBDMAPage], 82h - mov byte[vibracard], 1 ; set ViBRA16X mode -.vibradma3 - cmp byte[vibracard], 1 - jne .vibrafix - push ax - mov al, [SBHDMA] - mov [SBDMA], al - pop ax -.vibrafix - cmp byte[SBHDMA],4 - jae .hdma - ; vibra implementation (make sure that zSNES doesn't go back - ; to eight-bit-mode mono) - mov byte[SBHDMA],0 - cmp byte[vibracard], 1 - jne .hdma - push edx - mov edx, vibradetect - call PrintStr - ;call WaitForKey - pop edx - -; ********** END OF ViBRA16X implementation code ********** -.hdma - cmp byte[SBHDMA],4 - jne .hdma4 - mov byte[SBHDMAPage],8Fh -.hdma4 - cmp byte[SBHDMA],5 - jne .hdma5 - mov byte[SBHDMAPage],8Bh -.hdma5 - cmp byte[SBHDMA],6 - jne .hdma6 - mov byte[SBHDMAPage],89h -.hdma6 - cmp byte[SBHDMA],7 - jne .hdma7 - mov byte[SBHDMAPage],8Ah -.hdma7 - cmp byte[DisplayS],1 - je .displaysoundstuff - ret -.nfound - cmp byte[soundon],0 - je .nosound - mov byte[soundon],0 - mov edx, .blasterstr - call PrintStr - call WaitForKey -.nosound - ret -.displaysoundstuff - mov edx,.blasterinfo - call PrintStr - xor eax,eax - mov ax,[SBPort] - call printhex - mov edx,.blinfob - call PrintStr - xor eax,eax - mov al,[SBIrq] - call printnum - mov edx,.blinfoc - call PrintStr - xor eax,eax - mov al,[SBDMA] - call printnum - mov edx,.blinfod - call PrintStr - xor eax,eax - mov al,[SBHDMA] - call printnum - mov edx,.blasterstr2b - call PrintStr - call WaitForKey - ret - -SECTION .bss -.blfound resb 1 -.cursetting resb 1 - -SECTION .data -.string2s db 'BLASTER',0 -.blasterstr db 'ERROR : SET BLASTER environment NOT found!',10,13 -.blasterstr2 db 'Unable to enable sound.' -.blasterstr2b db 10,13,10,13 -.blasterstr3 db 'Press any key to continue.',0 -.blasterinfo db 'Sound Blaster Detection Values : ',10,13,10,13 -.blinfoa db 'PORT : ',0 -.blinfob db 13,10,'IRQ : ',0 -.blinfoc db 13,10,'DMA : ',0 -.blinfod db 13,10,'HDMA : ',0 - -NEWSYM PICRotateP, db 20h -NEWSYM PICMaskP, db 21h - -; Line added by Peter Santing -NEWSYM vibradetect - db 'Creative ViBRA16X PnP card detected (support coded by Peter Santing)', 13, 10 - db 'High-DMA is below dma #4', 13, 10 - db 13,10, 'you have now full 16-bit stereo sound with the surround option!', 13, 10, 0 - - diff --git a/tools/zsnes/src/dos/sw.asm b/tools/zsnes/src/dos/sw.asm deleted file mode 100644 index d3168b1..0000000 --- a/tools/zsnes/src/dos/sw.asm +++ /dev/null @@ -1,224 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 - - diff --git a/tools/zsnes/src/dos/sw32.asm b/tools/zsnes/src/dos/sw32.asm deleted file mode 100644 index 8a06b09..0000000 --- a/tools/zsnes/src/dos/sw32.asm +++ /dev/null @@ -1,334 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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+ - -SECTION .data -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) -SECTION .text - -;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 - - - - diff --git a/tools/zsnes/src/dos/vesa12.asm b/tools/zsnes/src/dos/vesa12.asm deleted file mode 100644 index dbd621e..0000000 --- a/tools/zsnes/src/dos/vesa12.asm +++ /dev/null @@ -1,532 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%include "macros.mac" - -EXTSYM vesa2_usbit,vesa2_clbit,vesa2_clbitng,vesa2_clbitng2,vesa2_clbitng3 -EXTSYM vesa2_x,vesa2_y,vesa2_bits,vesa2_rpos,vesa2_gpos,vesa2_bpos,vesa2_rposng -EXTSYM vesa2_gposng,vesa2_bposng,vesa2_rtrcl,vesa2_rtrcla,vesa2_rfull -EXTSYM vesa2_gtrcl,vesa2_gtrcla,vesa2_gfull,vesa2_btrcl,vesa2_btrcla,vesa2_bfull -EXTSYM vesa2red10,videotroub,genfulladdtab,DosExit,noblocks -EXTSYM bytesperscanline,vesamode,VESAmodelist - -; add 0214h video mode - -SECTION .bss -NEWSYM granularity, resw 1 -NEWSYM granadd, resd 1 -SECTION .text - -NEWSYM VESA12EXITTODOS - mov ax,0003h - int 10h - push edx - mov edx,.exitfromvesa12 - mov ah,9 - int 21h - pop edx - mov ah,9 - int 21h - mov edx,.return - mov ah,9 - int 21h - - mov byte[videotroub],1 - jmp DosExit - - -SECTION .data -.exitfromvesa12 db 'Unable to Initialize VESA1.2 $' -.return db 10,13,'$' -SECTION .text - -;******************************************************* -; Set up Vesa 2 -;******************************************************* - -NEWSYM InitVesa12 -;-------------------------------------------------; -; First - allocate some bytes in DOS memory for ; -; communication with VBE ; -;-------------------------------------------------; - - mov eax,0100h - mov ebx,512/16 ; 512 bytes - int 31h ; Function 31h,100h - Allocate DOS memory (512 bytes) - jnc .gotmem - mov edx,.nomemmessage - jmp VESA12EXITTODOS -.gotmem - mov fs,dx ; FS now points to the DOS buffer - - - ;--------------------------------------------------; - ; Now, get information about the video card into ; - ; a data structure ; - ;--------------------------------------------------; - - mov edi,RMREGS - mov dword[fs:0],'VBE1' ; Request VBE 2.0 info - mov dword[RMREGS.eax],4f00h - mov [RMREGS.es],ax ; Real mode segment of DOS buffer - mov dword[RMREGS.edi],0 - - push es - push ds - pop es - mov eax,300h - mov ebx,10h - xor ecx,ecx - int 31h ; Simulate real mode interrupt - pop es - - jnc .int1ok - mov edx,.noint1message - jmp VESA12EXITTODOS - -.int1ok ; Real mode int successful!!! - mov eax,[RMREGS.eax] - cmp al,4fh ; Check vbe interrupt went OK - jz .vbedetected - mov edx,.novbemessage - jmp VESA12EXITTODOS - -.vbedetected - cmp dword[fs:0000],'VESA' - jz .vesadetected ; Check for presence of vesa - mov edx,.novesamessage - jmp VESA12EXITTODOS - - -.vesadetected - cmp word[fs:0004],102h - jae .vesa12detected ; Check we've got VESA 1.2 or greater - mov edx,.novesa2message - jmp VESA12EXITTODOS - - - ;-----------------------------------------------------; - ; OK - vesa 2.0 or greater has been detected. Copy ; - ; mode information into VESAmodelist ; - ;-----------------------------------------------------; - -.vesa12detected - mov ax,[fs:12h] ; Get no. of 64k blocks - mov [noblocks],ax - mov ax, 2 - mov bx,[fs:10h] - int 31h - - jnc .wegottheselector - mov edx, .oopsnoselector - jmp VESA12EXITTODOS - -.wegottheselector - - mov gs,ax - xor eax,eax - mov ebp,VESAmodelist - mov ecx,512 - mov ax,[fs:0eh] - -.loopcopymodes - mov bx,[gs:eax] - mov [ebp],bx - cmp bx,0ffffh - jz .copiedmodes - add ebp,2 - add eax,2 - dec ecx - jz .outofmodelistspace - jmp .loopcopymodes - -.outofmodelistspace - mov edx,.outofmodelistspacemessage - jmp VESA12EXITTODOS - - ;----------------------------------------------; - ; OK - Scan the mode list to find a matching ; - ; mode for vesa2_x, vesa2_y and vesa2_depth ; - ;----------------------------------------------; - -.copiedmodes - - mov ebp,VESAmodelist - xor ecx,ecx - -.loopcheckmodes - mov cx, [ebp] - cmp cx, 0ffffh - jnz .notendoflist - - mov edx,.endoflist - jmp VESA12EXITTODOS - -.notendoflist - - mov edi, RMREGS - mov dword[RMREGS.eax],4f01h - mov dword[RMREGS.ebx],0 - mov [RMREGS.ecx],ecx - mov dword[RMREGS.edi],0 - - push es - push ds - pop es - mov eax,300h - mov ebx,10h - xor ecx,ecx - int 31h ; Simulate real mode interrupt - pop es - jnc .modecheckok - mov edx,.modecheckfail - jmp VESA12EXITTODOS - -.modecheckok - add ebp,2 - - test word[fs:0000h],1b - jz near .loopcheckmodes ; If mode is not available - -; -; xor eax,eax -; mov ax,[fs:12h] -; call printnum -; mov ah,02h -; mov dl,'x' -; int 21h -; mov ax,[fs:14h] -; call printnum -; mov ah,02h -; mov dl,'x' -; int 21h -; xor ah,ah -; mov al,[fs:19h] -; call printnum -; mov ah,02h -; mov dl,13 -; int 21h -; mov dl,10 -; int 21h - - mov eax,[vesa2_x] - cmp [fs:12h],ax ; Check that the height matches - jnz near .loopcheckmodes - mov eax,[vesa2_y] - cmp [fs:14h],ax ; Check that the width matches - jnz near .loopcheckmodes - mov al,[vesa2_bits] - cmp [fs:19h],al ; Check bits/pixel for match - jnz near .loopcheckmodes - -; mov ah,07h -; int 21h - -; D0 = Window supported -; 0 = Window is not supported -; 1 = Window is supported -; D1 = Window readable -; 0 = Window is not readable -; 1 = Window is readable -; D2 = Window writeable -; 0 = Window is not writeable -; 1 = Window is writeable -; D3-D7 = Reserved - - mov byte[.whichwin],0 - mov al,[fs:2] ; Get window A attributes - and al,0100b - cmp al,0100b - je .foundwin ; Mode supported - mov al,[fs:3] ; Get window B attributes - and al,0100b - cmp al,0100b - jne .foundwin ; Mode not supported - mov byte[.whichwin],1 -.foundwin - - ; Success - a match has been found!! - - sub ebp,2 - mov ax,[ebp] - mov [vesamode],ax ; Store vesa 1.2 mode number -; and eax,0FFFFh -; push eax -; mov ax,0003h -; int 10h -; pop eax -; call printnum -; jmp DosExit - - mov ax,[fs:10h] - mov byte[vesa2red10],0 - mov byte[vesa2_rposng],11 - mov byte[vesa2_gposng],6 - mov byte[vesa2_bposng],0 - mov dword[vesa2_clbitng],1111011111011110b - mov dword[vesa2_clbitng2],11110111110111101111011111011110b - mov dword[vesa2_clbitng2+4],11110111110111101111011111011110b - mov dword[vesa2_clbitng3],0111101111101111b - mov [bytesperscanline],ax ; Store bytes per scan line - cmp byte[fs:20h],10 - jne .nored10 - mov byte[fs:20h],11 - mov byte[vesa2red10],1 - mov byte[vesa2_rposng],10 - mov byte[vesa2_gposng],5 - mov dword[vesa2_clbitng],0111101111011110b - mov dword[vesa2_clbitng2],01111011110111100111101111011110b - mov dword[vesa2_clbitng2+4],01111011110111100111101111011110b - mov dword[vesa2_clbitng3],0011110111101111b -.nored10 - ; fix up bit lengths - mov al,16 - sub al,[fs:20h] - mov ah,[fs:22h] - sub ah,[fs:20h] - mov bl,[fs:24h] - sub bl,[fs:20h] - mov bh,al - cmp bh,ah - jb .scheck1 - mov bh,ah -.scheck1 - cmp bh,bl - jb .scheck2 - mov bh,bl -.scheck2 - mov byte[fs:19h],5 - - mov al,16 - sub al,[fs:22h] - mov ah,[fs:20h] - sub ah,[fs:22h] - mov bl,[fs:24h] - sub bl,[fs:22h] - mov bh,al - cmp bh,ah - jb .scheck1b - mov bh,ah -.scheck1b - cmp bh,bl - jb .scheck2b - mov bh,bl -.scheck2b - mov [fs:21h],bh - - mov al,16 - sub al,[fs:24h] - mov ah,[fs:20h] - sub ah,[fs:24h] - mov bl,[fs:22h] - sub bl,[fs:24h] - mov bh,al - cmp bh,ah - jb .scheck1c - mov bh,ah -.scheck1c - cmp bh,bl - jb .scheck2c - mov bh,bl -.scheck2c - mov [fs:23h],bh - - mov word[vesa2_clbit],0 - - cmp byte[fs:20h],10 - jne .nottopbit - mov word[vesa2_usbit],8000h -.nottopbit - - ; Process Red Stuff - mov al,[fs:20h] ; bit sizes = [fs:19h,21h,23h] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[fs:19h],6 - jne .no6bit - mov [vesa2_usbit],bx - inc al -.no6bit - or [vesa2_clbit],bx - mov [vesa2_rpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrr - shl bx,cl - jmp .shlr -.shrr - shr bx,1 -.shlr - mov [vesa2_rfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_rtrcl],bx - xor bx,0FFFFh - mov [vesa2_rtrcla],bx - - ; Process Green Stuff - mov al,[fs:22h] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[fs:21h],6 - jne .no6bitb - mov [vesa2_usbit],bx - inc al -.no6bitb - or [vesa2_clbit],bx - mov [vesa2_gpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrg - shl bx,cl - jmp .shlg -.shrg - shr bx,1 -.shlg - mov [vesa2_gfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_gtrcl],bx - xor bx,0FFFFh - mov [vesa2_gtrcla],bx - - ; Process Blue Stuff - mov al,[fs:24h] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[fs:23h],6 - jne .no6bitc - mov [vesa2_usbit],bx - inc al -.no6bitc - or [vesa2_clbit],bx - mov [vesa2_bpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrb - shl bx,cl - jmp .shlb -.shrb - shr bx,1 -.shlb - mov [vesa2_bfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_btrcl],bx - xor bx,0FFFFh - mov [vesa2_btrcla],bx - - xor word[vesa2_clbit],0FFFFh - - mov ax,[fs:4] - mov [granularity],ax - xor edx,edx - mov ax,64 - mov bx,[granularity] - div bx - mov [granadd],ax - - call genfulladdtab - - xor ecx,ecx - xor edx,edx - mov eax,4f02h - movzx ebx,word[vesamode] - int 10h ; Set the vesa mode - cmp ax,004fh - jz .modesetok - mov edx,.unableset - jmp VESA12EXITTODOS ; Failure!!! - -.modesetok -;******************************* EXTRA BIT **************************** - - ret - - ; Check logical scanline length - mov eax,4f06h - mov ebx,1 - int 10h - cmp cx,[vesa2_x] - je .correctwidth - - mov eax,4f06h ; VBE Set/Get logical scan line length - mov ebx,0 ; Set scan line length in pixels - mov ecx, [vesa2_x] ; Desired screen width - int 10h - cmp ax,04fh - jz .correctwidth - mov edx, .unablescan - jmp VESA12EXITTODOS ; Failure!!! - -.correctwidth - - ret - -SECTION .data -.nomemmessage db ': Unable to locate DOS memory.$' -.noint1message db ': Simulated real mode interrupt failed.$' -.oopsnoselector db ': Failed to allocate vesa display selector!$' -.novesa2message db ': VESA 1.2 or greater required!$' -.novbemessage db ': VBE not detected!!$' -.novesamessage db ': VESA not detected!$' -.outofmodelistspacemessage db ': Out of VESA mode list space!$' -.endoflist db ': VESA 1.2 mode does not work on your video card/driver.$' -.whichwin db 0 -.modecheckfail db ': Real mode interrupt failure while checking vesa mode$' -.unableset db 'Unable to initialize video mode.$' -.unablescan db 'Unable to set scan line length.$' -SECTION .bss - -RMREGS -.edi resd 1 -.esi resd 1 -.ebp resd 1 -.esp resd 1 -.ebx resd 1 -.edx resd 1 -.ecx resd 1 -.eax resd 1 -.flags resw 1 -.es resw 1 -.ds resw 1 -.fs resw 1 -.gs resw 1 -.ip resw 1 -.cs resw 1 -.sp resw 1 -.ss resw 1 -.spare times 20 resd 1 diff --git a/tools/zsnes/src/dos/vesa2.asm b/tools/zsnes/src/dos/vesa2.asm deleted file mode 100644 index 1900dde..0000000 --- a/tools/zsnes/src/dos/vesa2.asm +++ /dev/null @@ -1,654 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 DosExit,PrintStr,HalfTransB,HalfTransC,Init_2xSaIMMX,ZSNESBase -EXTSYM UnusedBit,HalfTrans,UnusedBitXor,ngrposng,nggposng,ngbposng -EXTSYM videotroub,ExitFromGUI,ErrorPointer,vesa2_x,vesa2_y,vesa2_bits,TripBufAvail,vesa2red10 -EXTSYM vesa2_rposng,vesa2_gposng,vesa2_bposng,vesa2_clbitng,vesa2_clbitng2,vesa2_clbitng3 -EXTSYM vesa2_clbit,vesa2_usbit,vesa2_rpos,vesa2_rfull,vesa2_rtrcl,vesa2_rtrcla,genfulladdtab -EXTSYM vesa2_gpos,vesa2_gfull,vesa2_gtrcl,vesa2_gtrcla,vesa2_bpos,vesa2_bfull,vesa2_btrcl,vesa2_btrcla - -SECTION .data -; add 0214h video mode -anticrash times 10 db 0 - -ALIGN32 -NEWSYM vesa2selec, dd 0 ; VESA2 Selector Location -NEWSYM vesa3en, dd 0 -NEWSYM VESAAddr, dd 0 - -SECTION .bss - -SECTION .text - -NEWSYM VESA2EXITTODOS - mov byte[videotroub],1 - cmp byte[ExitFromGUI],0 - je .nogui - mov [ErrorPointer],edx - ret -.nogui - mov ax,0003h - int 10h - push edx - mov edx,.exitfromvesa2 - call PrintStr - pop edx - call PrintStr - mov edx,.return - call PrintStr - - jmp DosExit - -SECTION .data -.exitfromvesa2 db 'Unable to Initialize VESA2 : ',0 -.return db 10,13,0 -SECTION .text - -;******************************************************* -; Set up Vesa 2 -;******************************************************* - -NEWSYM InitVesa2 - ;-------------------------------------------------; - ; First - allocate some bytes in DOS memory for ; - ; communication with VBE ; - ;-------------------------------------------------; - - mov eax,0100h - mov ebx,512/16 ; 512 bytes - int 31h ; Function 31h,100h - Allocate - ; DOS memory (512 bytes) - jnc .gotmem - mov edx,.nomemmessage - jmp VESA2EXITTODOS - -.gotmem - mov fs,dx ; FS now points to the DOS buffer - - ;--------------------------------------------------; - ; Now, get information about the video card into ; - ; a data structure ; - ;--------------------------------------------------; - - mov edi,RMREGS - mov dword[fs:0],'VBE2' ; Request VBE 2.0 info - mov dword[RMREGS.eax],4f00h - mov [RMREGS.es],ax ; Real mode segment of DOS buffer - mov dword[RMREGS.edi],0 - - push es - push ds - pop es - mov eax,300h - mov ebx,10h - xor ecx,ecx - int 31h ; Simulate real mode interrupt - pop es - - jnc .int1ok - mov edx,.noint1message - jmp VESA2EXITTODOS - - -.int1ok ; Real mode int successful!!! - mov eax,[RMREGS.eax] - cmp al,4fh ; Check vbe interrupt went OK - jz .vbedetected - mov edx,.novbemessage - jmp VESA2EXITTODOS - -.vbedetected - cmp dword[fs:0000],'VESA' - jz .vesadetected ; Check for presence of vesa - mov edx,.novesamessage - jmp VESA2EXITTODOS - - -.vesadetected - cmp word[fs:0004],200h - jae .vesa2detected ; Check we've got VESA 2.0 or greater - mov edx,.novesa2message - jmp VESA2EXITTODOS - - - ;-----------------------------------------------------; - ; OK - vesa 2.0 or greater has been detected. Copy ; - ; mode information into VESAmodelist ; - ;-----------------------------------------------------; - -.vesa2detected - mov dword[vesa3en],0 - cmp word[fs:004],300h - jb .notvbe3 - mov dword[vesa3en],1 -.notvbe3 - mov ax,[fs:12h] ; Get no. of 64k blocks - mov [noblocks],ax - mov ax, 2 - mov bx,[fs:10h] - int 31h - - jnc .wegottheselector - mov edx, .oopsnoselector - jmp VESA2EXITTODOS - -.wegottheselector - - mov gs,ax - xor eax,eax - mov ebp,VESAmodelist - mov ecx,512 - mov ax,[fs:0eh] - -.loopcopymodes - mov bx,[gs:eax] - mov [ebp],bx - cmp bx,0ffffh - jz .copiedmodes - add ebp,2 - add eax,2 - dec ecx - jz .outofmodelistspace - jmp .loopcopymodes - -.outofmodelistspace - mov edx,.outofmodelistspacemessage - jmp VESA2EXITTODOS - - ;----------------------------------------------; - ; OK - Scan the mode list to find a matching ; - ; mode for vesa2_x, vesa2_y and vesa2_depth ; - ;----------------------------------------------; - -.copiedmodes - - mov ebp,VESAmodelist - xor ecx,ecx - -.loopcheckmodes - mov cx, [ebp] - cmp cx, 0ffffh - jnz .notendoflist - - mov edx,.endoflist - jmp VESA2EXITTODOS - -.notendoflist - - mov edi, RMREGS - mov dword[RMREGS.eax],4f01h - mov dword[RMREGS.ebx],0 - mov [RMREGS.ecx],ecx - mov dword[RMREGS.edi],0 - - push es - push ds - pop es - mov eax,300h - mov ebx,10h - xor ecx,ecx - int 31h ; Simulate real mode interrupt - pop es - jnc .modecheckok - mov edx,.modecheckfail - jmp VESA2EXITTODOS - -.modecheckok - add ebp,2 - - test word[fs:0000h],1b - jz near .loopcheckmodes ; If mode is not available - - mov eax,[vesa2_x] - cmp [fs:12h],ax ; Check that the height matches - jnz near .loopcheckmodes - mov eax,[vesa2_y] - cmp [fs:14h],ax ; Check that the width matches - jnz near .loopcheckmodes - mov al,[vesa2_bits] - cmp [fs:19h],al ; Check bits/pixel for match - jnz near .loopcheckmodes - - mov byte[TripBufAvail],1 - test word[fs:0000h],400h - jz .notbuf - mov byte[TripBufAvail],1 -.notbuf -.notvesa3 - -; D0 = Window supported -; 0 = Window is not supported -; 1 = Window is supported -; D1 = Window readable -; 0 = Window is not readable -; 1 = Window is readable -; D2 = Window writeable -; 0 = Window is not writeable -; 1 = Window is writeable -; D3-D7 = Reserved - - mov byte[.whichwin],0 - mov al,[fs:2] ; Get window A attributes - and al,0100b - cmp al,0100b - je .foundwin ; Mode supported - mov al,[fs:3] ; Get window B attributes - and al,0100b - cmp al,0100b - jne .foundwin ; Mode not supported - mov byte[.whichwin],1 -.foundwin - - ; Success - a match has been found!! - - sub ebp,2 - mov ax,[ebp] - mov [vesamode],ax ; Store vesa 2 mode number - - mov ax,[fs:10h] - mov byte[vesa2red10],0 - mov byte[vesa2_rposng],11 - mov byte[vesa2_gposng],6 - mov byte[vesa2_bposng],0 - mov dword[vesa2_clbitng],1111011111011110b - mov dword[vesa2_clbitng2],11110111110111101111011111011110b - mov dword[vesa2_clbitng2+4],11110111110111101111011111011110b - mov dword[vesa2_clbitng3],0111101111101111b - mov [bytesperscanline],ax ; Store bytes per scan line - cmp byte[fs:20h],10 - jne near .nored10 - mov byte[fs:20h],11 - mov byte[vesa2red10],1 - mov byte[vesa2_rposng],10 - mov byte[vesa2_gposng],5 - mov dword[vesa2_clbitng],0111101111011110b - mov dword[vesa2_clbitng2],01111011110111100111101111011110b - mov dword[vesa2_clbitng2+4],01111011110111100111101111011110b - mov dword[vesa2_clbitng3],0011110111101111b - mov dword[UnusedBit], 10000000000000001000000000000000b - mov dword[HalfTrans], 01111011110111100111101111011110b - mov dword[UnusedBitXor], 01111111111111110111111111111111b - mov dword[UnusedBit+4], 10000000000000001000000000000000b - mov dword[HalfTrans+4], 01111011110111100111101111011110b - mov dword[UnusedBitXor+4],01111111111111110111111111111111b - mov dword[HalfTransB], 00000100001000010000010000100001b - mov dword[HalfTransB+4], 00000100001000010000010000100001b - mov dword[HalfTransC], 01111011110111100111101111011110b - mov dword[HalfTransC+4], 01111011110111100111101111011110b - mov dword[ngrposng],10 - mov dword[nggposng],5 - mov dword[ngbposng],0 - -.nored10 - ; fix up bit lengths - mov al,16 - sub al,[fs:20h] - mov ah,[fs:22h] - sub ah,[fs:20h] - mov bl,[fs:24h] - sub bl,[fs:20h] - mov bh,al - cmp bh,ah - jb .scheck1 - mov bh,ah -.scheck1 - cmp bh,bl - jb .scheck2 - mov bh,bl -.scheck2 - mov byte[fs:19h],5 - - mov al,16 - sub al,[fs:22h] - mov ah,[fs:20h] - sub ah,[fs:22h] - mov bl,[fs:24h] - sub bl,[fs:22h] - mov bh,al - cmp bh,ah - jb .scheck1b - mov bh,ah -.scheck1b - cmp bh,bl - jb .scheck2b - mov bh,bl -.scheck2b - mov [fs:21h],bh - - mov al,16 - sub al,[fs:24h] - mov ah,[fs:20h] - sub ah,[fs:24h] - mov bl,[fs:22h] - sub bl,[fs:24h] - mov bh,al - cmp bh,ah - jb .scheck1c - mov bh,ah -.scheck1c - cmp bh,bl - jb .scheck2c - mov bh,bl -.scheck2c - mov [fs:23h],bh - - mov word[vesa2_clbit],0 - - cmp byte[fs:20h],10 - jne .nottopbit - mov word[vesa2_usbit],8000h -.nottopbit - - ; Process Red Stuff - mov al,[fs:20h] ; bit sizes = [fs:19h,21h,23h] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[fs:19h],6 - jne .no6bit - mov [vesa2_usbit],bx - inc al -.no6bit - or [vesa2_clbit],bx - mov [vesa2_rpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrr - shl bx,cl - jmp .shlr -.shrr - shr bx,1 -.shlr - mov [vesa2_rfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_rtrcl],bx - xor bx,0FFFFh - mov [vesa2_rtrcla],bx - -; mov ax,03h -; int 10h -; mov ax,[vesa2_rfull] -; call printhex -; jmp DosExit - - ; Process Green Stuff - mov al,[fs:22h] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[fs:21h],6 - jne .no6bitb - mov [vesa2_usbit],bx - inc al -.no6bitb - or [vesa2_clbit],bx - mov [vesa2_gpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrg - shl bx,cl - jmp .shlg -.shrg - shr bx,1 -.shlg - mov [vesa2_gfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_gtrcl],bx - xor bx,0FFFFh - mov [vesa2_gtrcla],bx - - ; Process Blue Stuff - mov al,[fs:24h] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[fs:23h],6 - jne .no6bitc - mov [vesa2_usbit],bx - inc al -.no6bitc - or [vesa2_clbit],bx - mov [vesa2_bpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrb - shl bx,cl - jmp .shlb -.shrb - shr bx,1 -.shlb - mov [vesa2_bfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_btrcl],bx - xor bx,0FFFFh - mov [vesa2_btrcla],bx - - xor word[vesa2_clbit],0FFFFh - - call genfulladdtab - - test word[fs:0h],10000000b ; Check if linear available - jnz .linearavailable - mov edx,.nolframebuffer - jmp VESA2EXITTODOS ; None available - - ;---------------------------------------------; - ; OK - now set the vesa 2 mode based on the ; - ; information gleaned... ; - ;---------------------------------------------; - - .linearavailable - or word[vesamode],4000h ; Convert mode to its LFB equivalent - mov ebx,[fs:28h] ; Read in physical base ptr - - mov cx,bx - shr ebx,16 - mov si,[noblocks] - xor edi,edi ; Since noblocks = number of 64k blocks, - ; these lines leave si:di holding byte size - mov eax,800h - int 31h - jnc .mappedphysicalarea - mov edx,.unablemap - jmp VESA2EXITTODOS ; Failure!!! - -.mappedphysicalarea - shl ebx,16 - mov bx,cx - mov [LFBpointer],ebx - mov eax,ebx - sub eax,[ZSNESBase] - mov [VESAAddr],eax - - xor ecx,ecx - xor edx,edx - mov eax,4f02h - movzx ebx,word[vesamode] - int 10h ; Set the vesa mode - cmp ax,004fh - jz .modesetok - mov edx,.unableset - jmp VESA2EXITTODOS ; Failure!!! - -.modesetok -;******************************* EXTRA BIT **************************** - -; cmp byte[.whichwin],1 ; Check if Write is at Window B -; jne .nowinB -; -; mov ax,4F05h -; mov bx,1 -; mov dx,0 -; int 10h -; -;.nowinB - - ; Check logical scanline length - mov eax,4f06h - mov ebx,1 - int 10h - cmp cx,[vesa2_x] - je .correctwidth - - mov eax,4f06h ; VBE Set/Get logical scan line length - mov ebx,0 ; Set scan line length in pixels - mov ecx, [vesa2_x] ; Desired screen width - int 10h - cmp ax,04fh - jz .correctwidth - mov edx, .unablescan - jmp VESA2EXITTODOS ; Failure!!! - -.correctwidth - -;*************************** END OF EXTRA BIT ************************* - - xor eax,eax - mov ecx,1 - int 31h ; Allocate a descriptor - - mov bx,ax ; Move our selector into bx - - mov ecx,[LFBpointer] - mov dx,cx - shr ecx,16 - mov eax,7 - int 31h ; Set our selector to LFB - jnc .selectornowset - mov edx,.unablelfb - jmp VESA2EXITTODOS ; Failure!!! - -.selectornowset - - movzx ecx,word[noblocks] - shl ecx,16 ; Multiply by 65536 - dec ecx ; Necessary!!! - mov dx,cx - shr ecx,16 ; CX:DX size of screen - mov eax,8 - int 31h ; Set size of selector - jnc .ok - mov edx,.unablesets - jmp VESA2EXITTODOS ; Failure!!! - -.ok - lar ecx,ebx - shr ecx,8 - and cl,60h - or cl,93h - and ch,0c0h ; Keep granularity bit - mov ax,9 - int 31h ; Set selector access rights - jnc .accessrightsset - mov edx,.unablesetar - jmp VESA2EXITTODOS - -.accessrightsset - mov [vesa2selec],bx - - cmp byte[vesa2red10],1 - je .red10 - mov eax,565 - jmp .red11 -.red10 - mov eax,555 -.red11 - push eax - call Init_2xSaIMMX - pop eax - ret - - -SECTION .data -.nomemmessage db 'Unable to locate DOS memory.',0 -.noint1message db 'Simulated real mode interrupt failed.',0 -.novbemessage db 'VBE not detected!!',0 -.novesamessage db 'VESA not detected!',0 -.novesa2message db 'VESA 2.0 or greater required!',0 -.oopsnoselector db 'Failed to allocate vesa display selector!',0 -.outofmodelistspacemessage db 'Out of VESA2 mode list space!',0 -.endoflist db 'This VESA2 mode does not work on your video card / driver.',0 -.whichwin db 0 -.modecheckfail db 'Real mode interrupt failure while checking vesa mode',0 -.nolframebuffer db 'Linear Frame Buffer not Detected.',0 -.unablemap db 'Unable to map physical area.',0 -.unableset db 'Unable to initialize video mode.',0 -.unablescan db 'Unable to set scan line length.',0 -.unablelfb db 'Unable to set selector to LFB.',0 -.unablesets db 'Unable to set size of selector.',0 -.unablesetar db 'Unable to set selector access rights.',0 - -NEWSYM LFBpointer - dd 0 -NEWSYM noblocks - dw 0 -NEWSYM bytesperscanline - dw 0 -NEWSYM vesamode - dw 0 -;---------------------------------------------------------------------- -;NEWSYM VESAmodelist -; times 512 dw 0 -;---------------------------------------------------------------------- - - -SECTION .bss - -NEWSYM VESAmodelist, times 512 resw 1 -NEWSYM RMREGS -.edi resd 1 -.esi resd 1 -.ebp resd 1 -.esp resd 1 -.ebx resd 1 -.edx resd 1 -.ecx resd 1 -.eax resd 1 - -.flags resw 1 -.es resw 1 -.ds resw 1 -.fs resw 1 -.gs resw 1 -.ip resw 1 -.cs resw 1 -.sp resw 1 -.ss resw 1 -.spare times 20 resd 1 -;---------------------------------------------------------------------- diff --git a/tools/zsnes/src/dos/vga.inc b/tools/zsnes/src/dos/vga.inc deleted file mode 100644 index 1b3e736..0000000 --- a/tools/zsnes/src/dos/vga.inc +++ /dev/null @@ -1,152 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -; by kode54, stainless - -%macro SetVGAMode 1 - mov byte[cbitmode],0 - - mov ax,0013h - int 10h - - mov dx,03d4h - mov ax,0011h - out dx,ax - inc edx - in al,dx - and al,07fh - mov ah,al - mov al,11h - dec edx - out dx,ax - - xor ecx,ecx - jmp %%start - -%%loop - add ecx,4 - -%%start - mov eax,[%1+ecx] - or eax,eax - jz %%end - - cmp ax,03c0h - je %%3c0 - cmp ax,03c2h - je %%3c2 - cmp ax,03c3h - je %%3c2 - jmp %%default - -%%3c0 - mov dx,03dah - in al,dx - mov dl,0c0h - shr eax,16 - or al,20h - out dx,al - shr eax,8 - out dx,al - jmp %%loop - -%%3c2 - mov dx,ax - rol eax,8 - out dx,al - jmp %%loop - -%%default - mov dx,ax - shr eax,16 - out dx,ax - jmp %%loop - -%%end -%endmacro - - -SECTION .data - -.Mode256x224c: - dw 03c2h,0e300h,03d4h,05f00h,03d4h,03f01h,03d4h,04002h,03d4h,08203h - dw 03d4h,04a04h,03d4h,09a05h,03d4h,00b06h,03d4h,03e07h,03d4h,00008h - dw 03d4h,06109h,03d4h,0da10h,03d4h,0ac11h,03d4h,0bf12h,03d4h,02013h - dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h - dw 03c4h,00e04h,03cEh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h - dd 0 - -.Mode256x240c: - dw 03c2h,0e300h,03d4h,05f00h,03d4h,03f01h,03d4h,04002h,03d4h,08203h - dw 03d4h,04a04h,03d4h,09a05h,03d4h,00d06h,03d4h,03e07h,03d4h,00008h - dw 03d4h,04109h,03d4h,0ea10h,03d4h,0ac11h,03d4h,0df12h,03d4h,02013h - dw 03d4h,04014h,03d4h,0e715h,03d4h,00616h,03d4h,0a317h,03c4h,00101h - dw 03c4h,00e04h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h - dd 0 - -.Mode256x256c: - dw 03c2h,0e300h,03d4h,05f00h,03d4h,03f01h,03d4h,04002h,03d4h,08203h - dw 03d4h,04a04h,03d4h,09a05h,03d4h,02306h,03d4h,0b207h,03d4h,00008h - dw 03d4h,06109h,03d4h,00a10h,03d4h,0ac11h,03d4h,0FF12h,03d4h,02013h - dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h - dw 03c4h,00e04h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h - dd 0 - -.Mode256x256cs: - dw 03c2h,0e300h,03d4h,05f00h,03d4h,03f01h,03d4h,04002h,03d4h,08203h - dw 03d4h,04a04h,03d4h,09a05h,03d4h,02306h,03d4h,01d07h,03d4h,00008h - dw 03d4h,06009h,03d4h,00a10h,03d4h,0ac11h,03d4h,0ff12h,03d4h,02013h - dw 03d4h,04014h,03d4h,00715h,03d4h,01a16h,03d4h,0a317h,03c4h,00101h - dw 03c4h,00e04h,03ceh,04005h,03cEh,00506h,03c0h,04110h,03c0h,00013h - dd 0 - -.Mode320x224: - dw 03c2h,0e300h,03d4h,05f00h,03d4h,04f01h,03d4h,05002h,03d4h,08203h - dw 03d4h,05404h,03d4h,08005h,03d4h,00b06h,03d4h,03e07h,03d4h,00008h - dw 03d4h,04109h,03d4h,0da10h,03d4h,09c11h,03d4h,0c012h,03d4h,02813h - dw 03d4h,00014h,03d4h,0c715h,03d4h,00416h,03d4h,0e317h,03c4h,00101h - dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h - dd 0 - -.Mode320x240: - dw 03c2h,0e300h,03d4h,05f00h,03d4h,04f01h,03d4h,05002h,03d4h,08203h - dw 03d4h,05404h,03d4h,08005h,03d4h,00d06h,03d4h,03e07h,03d4h,00008h - dw 03d4h,04109h,03d4h,0ea10h,03d4h,0ac11h,03d4h,0df12h,03d4h,02813h - dw 03d4h,00014h,03d4h,0e715h,03d4h,00616h,03d4h,0e317h,03c4h,00101h - dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h - dd 0 - -.Mode320x256: - dw 03c2h,0e300h,03d4h,05f00h,03d4h,04f01h,03d4h,05002h,03d4h,08203h - dw 03d4h,05404h,03d4h,08005h,03d4h,02306h,03d4h,0b207h,03d4h,00008h - dw 03d4h,06109h,03d4h,00a10h,03d4h,0ac11h,03d4h,0ff12h,03d4h,02813h - dw 03d4h,00014h,03d4h,00715h,03d4h,01a16h,03d4h,0e317h,03c4h,00101h - dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h - dd 0 - -.Mode320x256s: - dw 03c2h,0e300h,03d4h,05f00h,03d4h,04f01h,03d4h,05002h,03d4h,08203h - dw 03d4h,05404h,03d4h,08005h,03d4h,02306h,03d4h,01d07h,03d4h,00008h - dw 03d4h,06009h,03d4h,00a10h,03d4h,0ac11h,03d4h,0ff12h,03d4h,02813h - dw 03d4h,00014h,03d4h,00715h,03d4h,01a16h,03d4h,0e317h,03c4h,00101h - dw 03c4h,00604h,03ceh,04005h,03ceh,00506h,03c0h,04110h,03c0h,00013h - dd 0 - - -SECTION .text diff --git a/tools/zsnes/src/effects/burn.c b/tools/zsnes/src/effects/burn.c deleted file mode 100644 index 23e503a..0000000 --- a/tools/zsnes/src/effects/burn.c +++ /dev/null @@ -1,197 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -/* - Fire effects implementation by Frank Jan Sorensen, Joachim Fenkes, - Stefan Goehler, Jonas Quinn, et al. -*/ - -#include -#include -#include -#include - -#ifndef M_PI -#ifndef PI -#define M_PI 3.1415926535897932384626433832795 -#else -#define M_PI PI -#endif -#endif - -#define BUF_WIDTH 288 -#define BUF_HEIGHT 224 - -const int rootrand = 20; /* Max/Min decrease of the root of the flames */ -const int decay = 5; /* How far should the flames go up on the screen? This MUST be positive - JF */ -const int miny = 1; /* Starting line of the flame routine. (should be adjusted along with MinY above) */ -const int smooth = 1; /* How discrete can the flames be? */ -const int minfire = 50; /* limit between the "starting to burn" and the "is burning" routines */ -const int xstart = 0; /* Starting position on the screen, should be divisible by 4 without remainder! */ -const int xend = 287; /* Guess! */ -const int width = 1 + 287; -const int maxcolor = 110; /* Constant for the MakePal procedure */ -const int fireincrease = 3; /* 3 = Wood, 90 = Gasoline */ - -typedef struct colorvalue -{ - unsigned char r, g, b; -} colorvalue; -typedef colorvalue vgapalettetype[256]; - -/* Converts (Hue, Saturation, Intensity) -> (RGB) */ -void hsi2rgb(double h, double s, double i, struct colorvalue *c) -{ - double t; - double rv, gv, bv; - - t = h; - rv = 1 + s * sin(t - 2 * M_PI / 3); - gv = 1 + s * sin(t); - bv = 1 + s * sin(t + 2 * M_PI / 3); - t = 255.999 * i / 2; - c->r = (unsigned char) floor(rv * t); - c->g = (unsigned char) floor(gv * t); - c->b = (unsigned char) floor(bv * t); -} - -void genpal() -{ - int i; - vgapalettetype pal; - - memset(pal, 0, 3); - for( i=1; i <= maxcolor; i ++) - { - hsi2rgb(4.6-1.5*i/maxcolor,(double)(i)/maxcolor,(double)(i)/maxcolor,&pal[i]); - } - for( i=maxcolor; i <= 255; i ++) - { - pal[i]=pal[i-1]; - { - struct colorvalue *with = &pal[i]; - - if (with->r<255) with->r += 1; - if (with->r<255) with->r += 1; - if ((~i & 1) && (with->g<215)) with->g += 1; - if ((~i & 1) && (with->b<255)) with->b += 1; - } - } - -} - -int started = 0; - -#define Randomize() -#define randint(a) (rand() % (a)) -#define randreal() (((double)rand()) / ((double)RAND_MAX)) -#define rand1(a) ((randint(a*2+1))-a) - -unsigned char flamearray[BUF_WIDTH]; -int morefire; -extern unsigned char *vidbuffer; - -/* damn, this seems like such a waste */ -static unsigned char pt[BUF_WIDTH * BUF_HEIGHT]; - -void DrawBurn() -{ - int i,j; - int x,p; - int v; - - if (!started) - { - started = 1; - - for( i=xstart; i <= xend; i++) - { - flamearray[i]=0; - } - - Randomize(); - morefire=1; - memset(pt, 0, BUF_HEIGHT * BUF_WIDTH); - } - - /* Put the values from FlameArray on the bottom line of the screen */ - memcpy(pt+((BUF_HEIGHT-1)*BUF_WIDTH)+xstart,flamearray, width); - - /* This loop makes the actual flames */ - - for( i=xstart; i <= xend; i++) - { - for( j=miny; j <= (BUF_HEIGHT-1); j ++) - { - v = pt[j*BUF_WIDTH + i]; - if ((v==0) || - (v=xend)) - pt[(j-1)*BUF_WIDTH + i] = 0; - else - pt[((j-1)*BUF_WIDTH) + (i-(randint(3)-1))] = v - randint(decay); - } - } - - /* Match? */ - if (randint(150)==0) - { - memset(flamearray + xstart + randint(xend-xstart-5),255,5); - } - - /* This loop controls the "root" of the - flames, i.e. the values in FlameArray. */ - for( i=xstart; i <= xend; i++) - { - x=flamearray[i]; - - if (x10) x += randint(fireincrease); - } - else - /* Otherwise randomize and increase by intensity (is burning) */ - x += rand1(rootrand)+morefire; - if (x>255) x=255; /* X Too large? */ - flamearray[i]=x; - } - - /* Smoothen the values of FrameArray to avoid "discrete" flames */ - p=0; - for( i=xstart+smooth; i <= xend-smooth; i++) - { - x=0; - for( j=-smooth; j <= smooth; j++) x += flamearray[i+j]; - flamearray[i] = x / ((smooth << 1) + 1); - } - - for (x=0; x < BUF_WIDTH*BUF_HEIGHT; x++) - { - i = vidbuffer[x]; - j = pt[x] >> 3; - - if (j > i) { vidbuffer[x] = j; } - else { vidbuffer[x] = ((i + j) >> 1) + 1; } - } -} - diff --git a/tools/zsnes/src/effects/fixsin.h b/tools/zsnes/src/effects/fixsin.h deleted file mode 100644 index 3bb1cdc..0000000 --- a/tools/zsnes/src/effects/fixsin.h +++ /dev/null @@ -1,418 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 FSINMAX 2047 -#define FSin(x) FSinTab[(x)&FSINMAX] -#define FCos(x) FCosTab[(x)&FSINMAX] - -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 -}; - diff --git a/tools/zsnes/src/effects/smoke.c b/tools/zsnes/src/effects/smoke.c deleted file mode 100644 index 067678d..0000000 --- a/tools/zsnes/src/effects/smoke.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -/* Smoke effects implementation by Stainless et al. */ - -#include -#include - -#define MIN(x, y) \ - (((x) < (y)) ? (x) : (y)) - -#define ABS(x) \ - (((x) >= 0) ? (x) : ( - (x))) - -#define FIRE_HOTSPOTS 80 - -static int fire_hotspot [FIRE_HOTSPOTS]; -extern char * vidbuffer; - -#define SCRW 288 -#define SCRH 224 - -static unsigned char fire_line [SCRW]; -static unsigned char fire_buffer [SCRW * SCRH]; - -static int fire_init_flag; - -static void draw_bottom_line_of_fire (void) -{ - int count, count2; - - memset ((& fire_line), 0, SCRW); - - for (count = 0; count < FIRE_HOTSPOTS; count ++) - { - for (count2 = (fire_hotspot [count] - 20); - count2 < (fire_hotspot [count] + 20); count2 ++) - { - if ((count2 >= 0) && (count2 < SCRW)) - { - fire_line [count2] = - MIN ((fire_line [count2] + 20) - - ABS (fire_hotspot [count] - count2), 256); - } - } - - fire_hotspot [count] += ((rand () & 7) - 3); - - if (fire_hotspot [count] < 0) - { - fire_hotspot [count] += SCRW; - } - else if (fire_hotspot [count] >= SCRW) - { - fire_hotspot [count] -= SCRW; - } - } - - for (count = 0; count < SCRW; count ++) - { - fire_buffer [((SCRH - 1) * - (SCRW)) + count] = fire_line [count]; - } -} - - -static void init_fire (void) -{ - int x, y, pixel, count; - - for (count = 0; count < FIRE_HOTSPOTS; count ++) - { - fire_hotspot [count] = (rand () % SCRW); - } - - - for (count = 0; count < SCRH; count ++) - { - draw_bottom_line_of_fire (); - - for (y = 0; y < (SCRH - 1); y ++) - { - for (x = 0; x < SCRW; x ++) - { - pixel = fire_buffer [((y + 1) * SCRW) + x]; - - if (pixel > 0) - { - pixel --; - } - - fire_buffer [(y * SCRW) + x] = pixel; - } - } - } - - fire_init_flag = 1; -} - -void DrawSmoke (void) -{ - int x, y, pixel, pixel2; - - if (! fire_init_flag) - { - init_fire (); - } - - draw_bottom_line_of_fire (); - - for (y = 0; y < (SCRH - 1); y ++) - { - for (x = 0; x < SCRW; x ++) - { - pixel = fire_buffer [((y + 1) * SCRW) + x]; - - if (pixel > 0) - { - pixel --; - } - - fire_buffer [(y * SCRW) + x] = pixel; - } - } - - for (y = 0; y < SCRH; y ++) - { - for (x = 0; x < SCRW; x ++) - { - pixel = vidbuffer [(y * SCRW) + x]; - pixel2 = (fire_buffer [(y * SCRW) + x] / 8); - - if (pixel2 > pixel) - { - vidbuffer [(y * SCRW) + x] = pixel2; - } - else - { - vidbuffer [(y * SCRW) + x] = - (((pixel + pixel2) / 2) + 1); - } - } - } -} diff --git a/tools/zsnes/src/effects/water.c b/tools/zsnes/src/effects/water.c deleted file mode 100644 index 794511b..0000000 --- a/tools/zsnes/src/effects/water.c +++ /dev/null @@ -1,248 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -/* Water effects implementation by Pharos, Nach, et al. */ - -#ifdef __UNIXSDL__ -#include "../gblhdr.h" -#else -#include -#include -#include -#include -#include -#include -#endif - -#include "fixsin.h" - -extern char *vidbuffer; - -#define SCRW 288 -#define SCRH 224 - -static unsigned char vscr[SCRW*SCRH]; - - -static int Height[2][SCRW*SCRH]; - -extern char NetPlayNoMore; - -static void DrawWaterWithLight(int *ptr,int light); -static void SineBlob(int x, int y, int radius, int height, int page); -static void CalcWater(int *nptr,int *optr,int density); - -static int ox=80,oy=60; -static int xang,yang; -static int density=5; -static int Hpage=0; -static int mode=0x0001; -static int offset; -static int pheight=400; -static int radius=30; - -extern char GUIEffect; - -void DrawWater(void) -{ - DrawWaterWithLight(Height[Hpage],1); - - if (GUIEffect==2) { mode=0x0001; } - else { mode = 0x0004; } - - if(mode&2) - { - int x,y; - x=rand()%(SCRW-2)+1; - y=rand()%(SCRH-2)+1; - Height[Hpage][y*SCRW+x]=rand()%(pheight<<2); - } - - /* the surfer */ - if(mode&1) - { - int x,y; - x = (SCRW/2) - + ((((FSin( (xang* 65) >>8) >>8) - * (FSin( (xang*349) >>8) >>8)) - * ((SCRW-8)/2)) >> 16); - - y = (SCRH/2) - + ((((FSin( (yang*377) >>8) >>8) - *(FSin( (yang* 84) >>8) >>8)) - * ((SCRH-8)/2)) >> 16); - xang += 13; - yang += 12; - - if(mode & 0x4000) - { - offset = (oy+y)/2*SCRW + (ox+x)/2; - Height[Hpage][offset] = pheight; - Height[Hpage][offset + 1] = - Height[Hpage][offset - 1] = - Height[Hpage][offset + SCRW] = - Height[Hpage][offset - SCRW] = pheight >> 1; - - offset = y*SCRW + x; - Height[Hpage][offset] = pheight<<1; - Height[Hpage][offset + 1] = - Height[Hpage][offset - 1] = - Height[Hpage][offset + SCRW] = - Height[Hpage][offset - SCRW] = pheight; - } - else - { - SineBlob((ox+x)/2, (oy+y)/2, 3, -1200, Hpage); - SineBlob(x, y, 4, -2000, Hpage); - - } - - ox = x; - oy = y; - - } - - if(mode&4) - { - int x,y; - if(rand()%14 == 7) - { - x=rand()%(SCRW-2)+1; - y=rand()%(SCRH-2)+1; - SineBlob(x, y, radius, -pheight*6, Hpage); - } - } - CalcWater(Height[Hpage^1], Height[Hpage], density); - Hpage ^= 1; /* flip flop */ - -} - -void DrawWaterWithLight(int *ptr,int light) -{ - int dx,dy; - int x,y; - int c; - int p; - - int offset = SCRW+1; - if(ptr == NULL) - { - return; - } - - for(y=((SCRH-1)*SCRW); offset < y; offset+=2) - { - for(x = offset+SCRW-2;offset>3)+(dx>>3); - if (p>(SCRH*SCRW)) p = (p % SCRW) + ((SCRH-((p - (SCRH*SCRW)) / SCRW)) * SCRW); - if (p<0) p = (SCRW + (p % SCRW)) + abs(p / SCRW) * SCRW; - c=vidbuffer[p]; - c-=(dx>>light); - (c<1) ? c=1 : (c > 31) ? c=31 : 0; - vscr[offset]=c; - offset++; - dx=ptr[offset]-ptr[offset+1]; - dy=ptr[offset]-ptr[offset+SCRW]; - p=offset+SCRW*(dy>>3)+(dx>>3); - if (p>(SCRH*SCRW)) p = (p % SCRW) + ((SCRH-((p - (SCRH*SCRW)) / SCRW)) * SCRW); - if (p<0) p = (SCRW + (p % SCRW)) + abs(p / SCRW) * SCRW; - c=vidbuffer[p]; - - c-=(dx>>light); - (c<1) ? c=1 : (c > 31) ? c=31 : 0; - vscr[offset]=c; - } - } - - memcpy( vidbuffer,vscr,SCRW*SCRH); -} - -void CalcWater(int *nptr,int *optr,int density) -{ - int newh; - int count = SCRW+1; - int x,y; - - for(y = (SCRH-1) * SCRW;count> 2) - - nptr[count]; - - nptr[count] = newh - (newh >> density); - } - } - -} - -void SineBlob(int x, int y, int radius, int height, int page) -{ - int cx, cy; - int left,top,right,bottom; - int square, dist; - int radsquare = radius * radius; - float length = (1024.0f/(float)radius)*(1024.0f/(float)radius); - - if(x<0) x = 1+radius+ rand()%(SCRW-2*radius-1); - if(y<0) y = 1+radius+ rand()%(SCRH-2*radius-1); - - radsquare = (radius*radius); - - height /= 8; - - left=-radius; right = radius; - top=-radius; bottom = radius; - - - // Perform edge clipping... - if(x - radius < 1) left -= (x-radius-1); - if(y - radius < 1) top -= (y-radius-1); - if(x + radius > SCRW-1) right -= (x+radius-SCRW+1); - if(y + radius > SCRH-1) bottom-= (y+radius-SCRH+1); - - for(cy = top; cy < bottom; cy++) - { - for(cx = left; cx < right; cx++) - { - square = cy*cy + cx*cx; - if(square < radsquare) - { - dist = (int) sqrt(square*length); - Height[page][SCRW*(cy+y) + cx+x] - += (int)((FCos(dist)+0xffff)*(height)) >> 19; - } - } - } -} - diff --git a/tools/zsnes/src/endmem.asm b/tools/zsnes/src/endmem.asm deleted file mode 100644 index 117885f..0000000 --- a/tools/zsnes/src/endmem.asm +++ /dev/null @@ -1,250 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 .bss -NEWSYM wramdataa, resb 65536 -NEWSYM ram7fa, resb 65536 -NEWSYM Inbetweendat, resd 4 -NEWSYM opcjmptab, resd 256 - -NEWSYM Bank0datr8 , resd 256 -NEWSYM Bank0datr16, resd 256 -NEWSYM Bank0datw8 , resd 256 -NEWSYM Bank0datw16, resd 256 - -NEWSYM tableA, resd 256 -NEWSYM tableB, resd 256 -NEWSYM tableC, resd 256 -NEWSYM tableD, resd 256 -NEWSYM tableE, resd 256 -NEWSYM tableF, resd 256 -NEWSYM tableG, resd 256 -NEWSYM tableH, resd 256 - -NEWSYM tableAb, resd 256 -NEWSYM tableBb, resd 256 -NEWSYM tableCb, resd 256 -NEWSYM tableDb, resd 256 -NEWSYM tableEb, resd 256 -NEWSYM tableFb, resd 256 -NEWSYM tableGb, resd 256 -NEWSYM tableHb, resd 256 - -NEWSYM tableAc, resd 256 -NEWSYM tableBc, resd 256 -NEWSYM tableCc, resd 256 -NEWSYM tableDc, resd 256 -NEWSYM tableEc, resd 256 -NEWSYM tableFc, resd 256 -NEWSYM tableGc, resd 256 -NEWSYM tableHc, resd 256 - -NEWSYM SA1tableA, resd 256 -NEWSYM SA1tableB, resd 256 -NEWSYM SA1tableC, resd 256 -NEWSYM SA1tableD, resd 256 -NEWSYM SA1tableE, resd 256 -NEWSYM SA1tableF, resd 256 -NEWSYM SA1tableG, resd 256 -NEWSYM SA1tableH, resd 256 - -NEWSYM tablead, resd 256 -NEWSYM tableadb, resd 256 -NEWSYM tableadc, resd 256 -NEWSYM SA1tablead, resd 256 - -NEWSYM memtabler8, resd 256 -NEWSYM memtablew8, resd 256 -NEWSYM memtabler16, resd 256 -NEWSYM memtablew16, resd 256 -NEWSYM vidmemch2, resb 4096 -NEWSYM vidmemch4, resb 4096 -NEWSYM vidmemch8, resb 4096 -NEWSYM snesmmap, resd 256 -NEWSYM snesmap2, resd 256 -NEWSYM cachebg1, resb 64 -NEWSYM cachebg2, resb 64 -NEWSYM cachebg3, resb 64 -NEWSYM cachebg4, resb 64 -NEWSYM sprlefttot, resb 256 -NEWSYM sprleftpr, resb 256 -NEWSYM sprleftpr1, resb 256 -NEWSYM sprleftpr2, resb 256 -NEWSYM sprleftpr3, resb 256 -NEWSYM sprpriodata, resb 288 -NEWSYM sprprtabc, resb 64 -NEWSYM sprprtabu, resb 64 -NEWSYM prevpal, resw 256 ; previous palette buffer -NEWSYM winbgdata, resb 288 ; window buffer for backgrounds -NEWSYM winspdata, resb 288 ; window buffer for sprites -NEWSYM FxTable, resd 256 -NEWSYM FxTableA1, resd 256 -NEWSYM FxTableA2, resd 256 -NEWSYM FxTableA3, resd 256 -NEWSYM FxTableb, resd 256 -NEWSYM FxTablebA1, resd 256 -NEWSYM FxTablebA2, resd 256 -NEWSYM FxTablebA3, resd 256 -NEWSYM FxTablec, resd 256 -NEWSYM FxTablecA1, resd 256 -NEWSYM FxTablecA2, resd 256 -NEWSYM FxTablecA3, resd 256 -NEWSYM FxTabled, resd 256 -NEWSYM FxTabledA1, resd 256 -NEWSYM FxTabledA2, resd 256 -NEWSYM FxTabledA3, resd 256 -NEWSYM SfxMemTable, resd 256 -NEWSYM fxxand, resd 256 -NEWSYM fxbit01, resd 256 -NEWSYM fxbit23, resd 256 -NEWSYM fxbit45, resd 256 -NEWSYM fxbit67, resd 256 -NEWSYM PLOTJmpa, resd 64 -NEWSYM PLOTJmpb, resd 64 - -NEWSYM pal16b, resd 256 -NEWSYM pal16bcl, resd 256 -NEWSYM pal16bclha, resd 256 -NEWSYM pal16bxcl, resd 256 -NEWSYM xtravbuf, resb 576 -NEWSYM BG1SXl, resw 256 -NEWSYM BG2SXl, resw 256 -NEWSYM BG3SXl, resw 256 -NEWSYM BG4SXl, resw 256 -NEWSYM BG1SYl, resw 256 -NEWSYM BG2SYl, resw 256 -NEWSYM BG3SYl, resw 256 -NEWSYM BG4SYl, resw 256 -NEWSYM BGMA, resb 256 -NEWSYM BGFB, resb 256 -NEWSYM BG3PRI, resb 256 -NEWSYM BGOPT1, resw 256 -NEWSYM BGOPT2, resw 256 -NEWSYM BGOPT3, resw 256 -NEWSYM BGOPT4, resw 256 -NEWSYM BGPT1, resw 256 -NEWSYM BGPT2, resw 256 -NEWSYM BGPT3, resw 256 -NEWSYM BGPT4, resw 256 -NEWSYM BGPT1X, resw 256 -NEWSYM BGPT2X, resw 256 -NEWSYM BGPT3X, resw 256 -NEWSYM BGPT4X, resw 256 -NEWSYM BGPT1Y, resw 256 -NEWSYM BGPT2Y, resw 256 -NEWSYM BGPT3Y, resw 256 -NEWSYM BGPT4Y, resw 256 -NEWSYM BGMS1, resw 1024 -NEWSYM prdata, resb 256 -NEWSYM prdatb, resb 256 -NEWSYM prdatc, resb 256 -NEWSYM ngpalcon2b, resd 20h -NEWSYM ngpalcon4b, resd 20h -NEWSYM ngpalcon8b, resd 20h -NEWSYM tltype2b, resb 4096 -NEWSYM tltype4b, resb 2048 -NEWSYM tltype8b, resb 1024 - -NEWSYM ngptrdat, resd 1024 -NEWSYM ngceax, resd 1024 -NEWSYM ngcedi, resd 1024 -NEWSYM bgtxad, resw 1024 -NEWSYM sprtbng, resd 256 -NEWSYM sprtlng, resb 256 -NEWSYM mosszng, resb 256 -NEWSYM mosenng, resb 256 - -SECTION .data -ALIGN32 - -NEWSYM vidmemch2s, times 4096 db 0FFh -NEWSYM vidmemch4s, times 2048 db 0FFh -NEWSYM vidmemch8s, times 1024 db 0FFh - -SECTION .bss - -NEWSYM mode7ab, resd 256 -NEWSYM mode7cd, resd 256 -NEWSYM mode7xy, resd 256 -NEWSYM mode7st, resb 256 - -NEWSYM t16x161, resb 256 -NEWSYM t16x162, resb 256 -NEWSYM t16x163, resb 256 -NEWSYM t16x164, resb 256 - -NEWSYM intrlng, resb 256 -NEWSYM mode7hr, resb 256 - -NEWSYM scadsng, resb 256 -NEWSYM scadtng, resb 256 - -NEWSYM scbcong, resw 256 - -NEWSYM cpalval, resd 256 -NEWSYM cgfxmod, resb 256 - -NEWSYM winboundary, resd 256 -NEWSYM winbg1enval, resb 256 -NEWSYM winbg2enval, resb 256 -NEWSYM winbg3enval, resb 256 -NEWSYM winbg4enval, resb 256 -NEWSYM winbgobjenval, resb 256 -NEWSYM winbgbackenval, resb 256 -NEWSYM winlogicaval, resw 256 - -NEWSYM winbg1envals, resb 256 -NEWSYM winbg2envals, resb 256 -NEWSYM winbg3envals, resb 256 -NEWSYM winbg4envals, resb 256 -NEWSYM winbgobjenvals, resb 256 -NEWSYM winbgbackenvals, resb 256 -NEWSYM winbg1envalm, resb 256 -NEWSYM winbg2envalm, resb 256 -NEWSYM winbg3envalm, resb 256 -NEWSYM winbg4envalm, resb 256 -NEWSYM winbgobjenvalm, resb 256 -NEWSYM winbgbackenvalm, resb 256 - -NEWSYM FillSubScr, resb 256 - -NEWSYM objclineptr, resd 256 ; l1,r1,l2,r2,en,log,ptr - -SECTION .data -ALIGN32 - -NEWSYM objwlrpos , times 256 dd 0FFFFFFFFh -NEWSYM objwen , times 256 dw 0FFFFh ; en,log - -SECTION .bss - -NEWSYM SpecialLine, resb 256 - -NEWSYM bgallchange, resb 256 -NEWSYM bg1change, resb 256 -NEWSYM bg2change, resb 256 -NEWSYM bg3change, resb 256 -NEWSYM bg4change, resb 256 -NEWSYM bgwinchange, resb 256 - -NEWSYM PrevPicture, resb 64*56*2 diff --git a/tools/zsnes/src/gblhdr.h b/tools/zsnes/src/gblhdr.h deleted file mode 100644 index e17a770..0000000 --- a/tools/zsnes/src/gblhdr.h +++ /dev/null @@ -1,130 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef GBLHDR_H -#define GBLHDR_H - -/*************************************\ -* Global Definitions and Headers File * -\*************************************/ - -// Standard stuff - -#include -#include -#include "fcntl.h" -#include -#include - -#include "config.h" -// General time.h checking - -#if TIME_WITH_SYS_TIME -#include -#include -#else -# if HAVE_SYS_TIME_H -#include -# else -#include -# endif -#endif - -// General dirent.h stuff - -#if HAVE_DIRENT_H -#include -#else -# if HAVE_SYS_NDIR_H -#include -# endif -# if HAVE_SYS_DIR_H -#include -# endif -# if HAVE_NDIR_H -#include -# endif -#endif - -// more standard stuff - -#include -#include -#include - -// unistd.h stuff - -//#if HAVE_UNISTD_H -//Small hack for now -#if unix -#include -#include -#endif - -// opengl stuff - -#ifdef __OPENGL__ -#ifndef __MACOSX__ -#include -#else -#include -#endif -#endif - -// os specific stuff - -#ifdef __QNXNTO__ -/* QNX6 has getpagesize() commented out in unistd.h, -however it's a static value that we can just define */ -#define getpagesize() 4096 -#endif - -#ifdef __UNIXSDL__ -#include "SDL.h" -#include -#ifndef __BEOS__ -#include -#include -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef NO_PNG -#include -#endif -#endif - -#ifdef __UNIXSDL__ -#ifdef linux -#include -#else -#include -#endif -#endif - - -#endif diff --git a/tools/zsnes/src/gblvars.h b/tools/zsnes/src/gblvars.h deleted file mode 100644 index e063796..0000000 --- a/tools/zsnes/src/gblvars.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -//C++ style code in C -#define bool unsigned char -#define true 1 -#define false 0 - -extern unsigned int cycpbl; -extern unsigned int *wramdata, *vram, PHspcsave, PHdspsave, *C4Ram, *sfxramdata; -extern unsigned int PHnum2writesa1reg, SA1Mode, prevedi, SA1xpc, sa1dmaptr; -extern unsigned int soundcycleft, spc700read, timer2upd, xa, PHnum2writesfxreg; -extern unsigned int opcd, HIRQCycNext, oamaddr, curexecstate, nmiprevaddrl; -extern unsigned int nmirept, nmiprevline, nmistatus, joycontren; -extern unsigned int SfxR0, *setaramdata, ramsize, *sram, nmiprevaddrh; -extern unsigned int tempesi, tempedi, tempedx, tempebp; -extern unsigned int SPCMultA, PHnum2writespc7110reg, PHdspsave2; -extern unsigned char sndrot, SPCRAM[65472], DSPMem[256], SA1Status, *SA1RAMArea; -extern unsigned char DSP1Enable, DSP1COp, prevoamptr, BRRBuffer[32], *romdata; -extern unsigned char curcyc, echoon0, spcnumread, NextLineCache, HIRQNextExe; -extern unsigned char vidmemch4[4096], vidmemch8[4096], vidmemch2[4096]; - -extern bool C4Enable, SFXEnable, SA1Enable, SPC7110Enable, SETAEnable, DSP4Enable, spcon; - -extern short C4WFXVal, C41FXVal, Op00Multiplicand, Op04Angle, Op08X, Op18X; -extern short Op28X, Op0CA, Op02FX, Op0AVS, Op06X, Op01m, Op0DX, Op03F, Op14Zr; -extern short Op0EH, Op10Coefficient; diff --git a/tools/zsnes/src/gui/gui.asm b/tools/zsnes/src/gui/gui.asm deleted file mode 100644 index 9394c91..0000000 --- a/tools/zsnes/src/gui/gui.asm +++ /dev/null @@ -1,3768 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -; Sorry. The GUI code is a total mess. One problem I encountered is that -; there seems to be a bug in nasm with using math calculations combined -; with macros within macros, so in some macro definitions, I had to -; add/subtract extra values in certain macros to get the GUI to align -; correctly. -; The GUI is drawn is mostly manually. What I mean is such as -; coding 5 boxes to represent a shaded box for each box. Although that -; can be simplified using macros to draw 5 boxes, that unknown bug in nasm -; showed up which prevented me from using macros extensively. I was -; thinking of changing it to an object-based GUI for easier coding, -; but that was decided far into the development of the GUI itself -; and that I also never expected this code to become open-source, so I -; decided not to proceed with it. - -; Routine StartGUI is the function called to start the GUI and also -; contains the execution main loop of the GUI. If you want to completely -; replace the GUI, just add a function call from that function, then -; jump to endprog to exit ZSNES or continueprog to continue with the -; gameplay. Do not replace StartGUI with a function since it is not -; a function, but rather a label that is being jumped to. - -%include "macros.mac" - -EXTSYM curblank,vidpastecopyscr,frameskip,newengen,cvidmode,antienab -EXTSYM soundon,StereoSound,SoundQuality,MusicRelVol,endprog -EXTSYM continueprog,spcBuffera,cbitmode,t1cc -EXTSYM romloadskip,romdata,init65816,current_zst -EXTSYM procexecloop,SPCRAM,spcPCRam,spcS,spcRamDP,spcA,spcX,spcY,spcP,spcNZ -EXTSYM Voice0Status,Voice1Status,Voice2Status,Voice3Status,Voice4Status -EXTSYM Voice5Status,Voice6Status,Voice7Status,statesaver,loadstate2 -EXTSYM vidbuffer,ASCII2Font,hirestiledat,showallext,scanlines -EXTSYM sprlefttot,spritetablea,KeyRTRCycle -EXTSYM cgram,tempco0,prevbright,maxbr,prevpal,coladdr,coladdg -EXTSYM coladdb,scaddtype,initvideo,pressed,UpdateDevices,memtabler8 -EXTSYM memtablew8,writeon,JoyRead,SetInputDevice,delay,FPSOn,RevStereo,WDSPReg0C -EXTSYM WDSPReg1C,pl12s34,resolutn,Makemode7Table,vidbufferofsb,wramdata,bgfixer -EXTSYM videotroub,CheatCodeSave,CheatCodeLoad,LoadCheatSearchFile -EXTSYM SaveCheatSearchFile,Get_Date,Check_Key,Get_Key,sram -EXTSYM TripBufAvail,ResetTripleBuf,ScanCodeListing -EXTSYM AdjustFrequency,GUISaveVars,Init_Mouse,Get_MouseData,Set_MouseXMax -EXTSYM Set_MouseYMax,Set_MousePosition,Get_MousePositionDisplacement,GUIInit -EXTSYM GUIDeInit,SpecialLine,DrawWater,DrawBurn,DrawSmoke -EXTSYM GetDate,horizon_get,ErrorPointer,MessageOn,GetTime -EXTSYM GetScreen,Clear2xSaIBuffer,MouseWindow,ExitFromGUI -EXTSYM newgfx16b,NumVideoModes,MusicVol,DSPMem,NumInputDevices -EXTSYM GUIInputNames,GUIVideoModeNames,GameSpecificInput,device1,device2,TwelveHourClock -EXTSYM GUIM7VID,GUINTVID,GUIHQ2X,RawDumpInProgress -EXTSYM MultiTap,SFXEnable,RestoreSystemVars -EXTSYM nssdip1,nssdip2,nssdip3,nssdip4,nssdip5,nssdip6 -EXTSYM SkipMovie,MovieStop,MoviePlay,MovieRecord -EXTSYM MovieInsertChapter,MovieSeekAhead,MovieSeekBehind,ResetDuringMovie -EXTSYM MovieDumpRaw,MovieAppend,AutoLoadCht,GUIQuickLoadUpdate,GUILoadData - -EXTSYM GUIwinposx,GUIwinposy,maxskip,GUIEffect,hqFilter,En2xSaI,NTSCFilter -EXTSYM NTSCBlend,NTSCHue,NTSCSat,NTSCCont,NTSCBright,NTSCSharp,NTSCRef -EXTSYM NTSCGamma,NTSCRes,NTSCArt,NTSCFringe,NTSCBleed,NTSCWarp -EXTSYM LowPassFilterType,MovieStartMethod,MovieDisplayFrame,savewinpos -EXTSYM SnapPath,SPCPath,BSXPath,SGPath,STPath,GNextPath,FEOEZPath,SJNSPath -EXTSYM MDHPath,SPL4Path,SRAMPath,CheatSrcByteSize,prevloadfnamel -EXTSYM prevloadiname,prevloaddnamel,prevlfreeze,FirstTimeData,MMXSupport -EXTSYM GUIRAdd,GUIGAdd,GUIBAdd,GUITRAdd,GUITGAdd,GUITBAdd,GUIWRAdd -EXTSYM GUIWGAdd,GUIWBAdd,GUIloadfntype,SoundInterpType -EXTSYM CheatSrcByteBase,CheatSrcSearchType,CheatUpperByteOnly,GUIComboGameSpec -EXTSYM KeyStateSlc0,KeyStateSlc1,KeyStateSlc2,KeyStateSlc3,KeyStateSlc4 -EXTSYM KeyStateSlc5,KeyStateSlc6,KeyStateSlc7,KeyStateSlc8,KeyStateSlc9 -EXTSYM RewindStates,RewindFrames,PauseRewind,PauseLoad,SRAMState,AutoState -EXTSYM LatestSave,SRAMSave5Sec,AutoIncSaveSlot,KeyUsePlayer1234 -EXTSYM pl1contrl,pl1selk,pl1startk,pl1upk,pl1downk,pl1leftk,pl1rightk,pl1Xk -EXTSYM pl1Ak,pl1Lk,pl1Yk,pl1Bk,pl1Rk,pl1Xtk,pl1Ytk,pl1Atk,pl1Btk,pl1Ltk,pl1Rtk -EXTSYM pl1ULk,pl1URk,pl1DLk,pl1DRk,pl2contrl,pl2selk,pl2startk,pl2upk,pl2downk -EXTSYM pl2leftk,pl2rightk,pl2Xk,pl2Ak,pl2Lk,pl2Yk,pl2Bk,pl2Rk,pl2Xtk,pl2Ytk -EXTSYM pl2Atk,pl2Btk,pl2Ltk,pl2Rtk,pl2ULk,pl2URk,pl2DLk,pl2DRk,pl3contrl,pl3selk -EXTSYM pl3startk,pl3upk,pl3downk,pl3leftk,pl3rightk,pl3Xk,pl3Ak,pl3Lk,pl3Yk -EXTSYM pl3Bk,pl3Rk,pl3Xtk,pl3Ytk,pl3Atk,pl3Btk,pl3Ltk,pl3Rtk,pl3ULk,pl3URk -EXTSYM pl3DLk,pl3DRk,pl4contrl,pl4selk,pl4startk,pl4upk,pl4downk,pl4leftk -EXTSYM pl4rightk,pl4Xk,pl4Ak,pl4Lk,pl4Yk,pl4Bk,pl4Rk,pl4Xtk,pl4Ytk,pl4Atk,pl4Btk -EXTSYM pl4Ltk,pl4Rtk,pl4ULk,pl4URk,pl4DLk,pl4DRk,pl5contrl,pl5selk,pl5startk -EXTSYM pl5upk,pl5downk,pl5leftk,pl5rightk,pl5Xk,pl5Ak,pl5Lk,pl5Yk,pl5Bk,pl5Rk -EXTSYM pl5Xtk,pl5Ytk,pl5Atk,pl5Btk,pl5Ltk,pl5Rtk,pl5ULk,pl5URk,pl5DLk,pl5DRk -EXTSYM KeyResetAll,KeyExtraEnab1,KeyExtraEnab2,KeyVolDown,KeyVolUp -EXTSYM KeyBGDisble0,KeyBGDisble1,KeyBGDisble2,KeyBGDisble3,KeySprDisble -EXTSYM KeyDisableSC0,KeyDisableSC1,KeyDisableSC2,KeyDisableSC3,KeyQuickSnapShot -EXTSYM KeyDisableSC4,KeyDisableSC5,KeyDisableSC6,KeyDisableSC7,KeyQuickSaveSPC -EXTSYM KeyQuickLoad,KeyQuickRst,KeyQuickExit,KeyQuickClock,KeyQuickChat -EXTSYM KeyInsrtChap,KeyPrevChap,KeyNextChap,KeyDisplayFPS,KeyNewGfxSwt -EXTSYM KeyIncStateSlot,KeyDecStateSlot,KeySaveState,KeyLoadState,KeyStateSelct -EXTSYM KeyRewind,KeyEmuSpeedUp,KeyEmuSpeedDown,KeyFRateUp,KeyFRateDown -EXTSYM KeyFastFrwrd,KeySlowDown,KeyResetSpeed,EMUPauseKey,INCRFrameKey -EXTSYM KeyWinDisble,KeyOffsetMSw,JoyPad1Move,init_save_paths,loadquickfname -EXTSYM mousewrap,GUIRClick,SaveSramData,SwapMouseButtons -EXTSYM FPSAtStart,Turbo30hz,TimerEnable,SmallMsgText,mouse1lh,mouse2lh -EXTSYM AutoPatch,RomInfo,AllowUDLR,GrayscaleMode,GUIMovieForcedText -EXTSYM Mode7HiRes16b,FFRatio,SDRatio,EmuSpeed,mouseshad,MovieForcedLengthEnabled -EXTSYM esctomenu,GUILoadKeysJumpTo,lhguimouse,MZTForceRTR,GetMovieForcedLength -EXTSYM GUIEnableTransp,FilteredGUI,Surround,SPCDisable,nosaveSRAM -EXTSYM FastFwdToggle,gui_key,gui_key_extended,GUILoadKeysNavigate -EXTSYM KeyDisplayBatt,KeyIncreaseGamma,KeyDecreaseGamma -EXTSYM MovieVideoMode,MovieAudio,MovieVideoAudio,MovieAudioCompress,newfont -EXTSYM d_names,selected_names,GUIfileentries,GUIdirentries,GUIcurrentdirviewloc -EXTSYM GUIcurrentfilewin,GUIcurrentcursloc,GUIcurrentviewloc,SetMovieForcedLength -EXTSYM GUIcurrentdircursloc,GetLoadData,ZRomPath,SaveSecondState,ClockBox,DisplayInfo -EXTSYM GUIJT_currentviewloc,GUIJT_currentcursloc,GUIJT_entries,ScreenShotFormat -EXTSYM GUIJT_offset,GUIJT_viewable,GUIGenericJumpTo,SSAutoFire,SSPause - -%ifdef __UNIXSDL__ -EXTSYM numlockptr -%elifdef __WIN32__ -EXTSYM initDirectDraw,reInitSound,CheckAlwaysOnTop,CheckPriority,AlwaysOnTop -EXTSYM CheckScreenSaver,MouseWheel,TrapMouseCursor,AllowMultipleInst,TripleBufferWin -EXTSYM HighPriority,DisableScreenSaver,SaveMainWindowPos,PrimaryBuffer -EXTSYM CBBuffer,CBLength,PasteClipBoard,ctrlptr,PauseFocusChange -%elifdef __MSDOS__ -EXTSYM dssel,SetInputDevice209,initvideo2,Force8b,SBHDMA,vibracard,smallscreenon -EXTSYM pl1p209,pl2p209,pl3p209,pl4p209,pl5p209,SidewinderFix,Triplebufen,ScreenScale -EXTSYM GUIEAVID,GUIFSVID,GUIWSVID,GUISSVID,GUITBVID,GUISLVID,GUIHSVID,GUI2xVID -EXTSYM JoyMinX209,JoyMaxX209,JoyMinY209,JoyMaxY209,DOSClearScreen,dosmakepal -%endif - -%ifndef __MSDOS__ -EXTSYM ZsnesPage,DocsPage,GUICustomX,GUICustomY,GetCustomXY,SetCustomXY,initwinvideo -EXTSYM Keep4_3Ratio,PrevFSMode,PrevWinMode,NTSCFilterInit,hqFilterlevel -EXTSYM GUIWFVID,GUIDSIZE,GUIHQ3X,GUIHQ4X,GUIKEEP43,Keep43Check,changeRes -%endif - -%ifndef __WIN32__ -EXTSYM GUII2VID -%endif - -%ifndef __UNIXSDL__ -EXTSYM vsyncon -%endif - -%ifdef __OPENGL__ -EXTSYM BilinearFilter,GUIBIFIL,drawscreenwin,blinit -%endif - -%include "gui/guitools.inc" -%include "gui/guimisc.inc" -%include "gui/guimouse.inc" -%include "gui/guiwindp.inc" -%include "gui/guikeys.inc" -%include "gui/guicheat.inc" -%include "gui/guicombo.inc" - -; Things to do : -; -; .checkmenuboxclick -; gray scale = 32 .. 63 -; shadow = 96 .. 127 -; blue scale = 148 .. 167, 168 .. 187 -; gray scale = 189 .. 220 (32+137) - -; | Game Config Cheat MultiPlay Misc -;------------------------------------------------------- -; Load Input Add Code Modem Misc Keys -; Run ----- Browse IPX GUI Opts -; Reset Devices Search Movie Opt -; ----- Chip Cfg Key Comb. -; Save State ----- Save Cfg -; Load State Options ----- -; Pick State Video About -; ----- Sound -; Quit Paths -; Saves -; Speed - -; NetPlay only has "Internet" for Windows/Linux - -; Windows : 1 = Load -; 2 = Chose State -; 3 = Input Device Window -; 4 = Options -; 5 = Video -; 6 = Sound -; 7 = Cheat -; 8 = Net Options -; 9 = Game Options -; 10 = GUI Options -; 11 = About -; 12 = Reset Confirmation -; 13 = Cheat Search -; 14 = SaveState Confirmation -; 15 = Movies -; 16 = Key Combo -; 17 = Devices -; 18 = Chip Config -; 19 = Paths -; 20 = Saves -; 21 = Speed - -SECTION .data - -;The first byte is the number of fields on the right not including the seperators -MenuDat1 db 12, 3,1,1,1,1,1,1,1,1,1,0,1,2,0 -MenuDat2 db 8, 3,1,1,0,1,1,1,0,2,0 -MenuDat3 db 10, 3,0,1,1,0,1,1,1,1,1,2,0 -MenuDat4 db 2, 3,1,2,0 -%ifndef __MSDOS__ -MenuDat5 db 0, 2,0,0 -%else -MenuDat5 db 1, 3,2,0 -%endif -MenuDat6 db 6, 3,1,1,1,1,0,2,0 - -NEWSYM GUIPrevMenuData, - db 1,'1. ',0 - db 1,'2. ',0 - db 1,'3. ',0 - db 1,'4. ',0 - db 1,'5. ',0 - db 1,'6. ',0 - db 1,'7. ',0 - db 1,'8. ',0 - db 1,'9. ',0 - db 1,'0. ',0 - db 0,'------------',0 - db 1,'FREEZE DATA: OFF ',0 - db 1,'CLEAR ALL DATA ',0 -GUIGameMenuData: - db 1,'LOAD ',0 - db 1,'RUN [ESC] ',0 - db 1,'RESET ',0 - db 0,'------------',0 - db 1,'SAVE STATE ',0 - db 1,'OPEN STATE ',0 - db 1,'PICK STATE ',0 - db 0,'------------',0 - db 1,'QUIT ',0 -GUIConfigMenuData: - db 1,'INPUT ',0 - db 0,'------------',0 - db 1,'DEVICES ',0 - db 1,'CHIP CFG ',0 - db 0,'------------',0 - db 1,'OPTIONS ',0 - db 1,'VIDEO ',0 - db 1,'SOUND ',0 - db 1,'PATHS ',0 - db 1,'SAVES ',0 - db 1,'SPEED ',0 -GUICheatMenuData: - db 1,'ADD CODE ',0 - db 1,'BROWSE ',0 - db 1,'SEARCH ',0 -GUINetPlayMenuData: -%ifndef __MSDOS__ - db 1,'INTERNET ',0 - db 0,'------------',0 -%else - db 1,'MODEM ',0 - db 1,'IPX ',0 -%endif -GUIMiscMenuData: - db 1,'MISC KEYS ',0 - db 1,'GUI OPTS ',0 - db 1,'MOVIE OPT ',0 - db 1,'KEY COMB. ',0 - db 1,'SAVE CFG ',0 - db 0,'------------',0 - db 1,'ABOUT ',0 - -; Window sizes and positions -; LOAD STAT INPT OPT VID SND CHT NET GMKEY GUIOP ABT RSET SRC STCN MOVE CMBO ADDO CHIP PATH SAVE SPED -GUIwinposxo dd 0,6 ,65 ,33 ,42 ,5 ,34 ,6 ,64 ,8 ,5 ,33 ,56 ,64 ,56 ,5 ,3 ,28 ,48 ,6 ,28 ,53 -GUIwinposyo dd 0,20 ,70 ,20 ,20 ,20 ,20 ,20 ,30 ,30 ,20 ,20 ,60 ,30 ,60 ,20 ,20 ,60 ,60 ,20 ,30 ,20 -GUIwinsizex dd 0,244 ,126 ,205 ,180 ,245 ,188 ,244 ,128 ,240 ,245 ,190 ,144 ,128 ,144 ,246 ,250 ,200 ,160 ,244 ,200 ,150 -GUIwinsizey dd 0,190 ,68 ,192 ,190 ,190 ,188 ,191 ,40 ,170 ,150 ,190 ,42 ,40 ,42 ,190 ,190 ,120 ,100 ,190 ,168 ,180 -NEWSYM GUIwinptr, db 0 - -NEWSYM WaterOn, db 1 -NEWSYM ForceROMTiming, db 0 -NEWSYM ForceHiLoROM, db 0 -NEWSYM CalibXmin, dd 0 -NEWSYM CalibXmax, dd 0 -NEWSYM CalibYmin, dd 0 -NEWSYM CalibYmax, dd 0 -NEWSYM CalibXmin209, dd 0 -NEWSYM CalibXmax209, dd 0 -NEWSYM CalibYmin209, dd 0 -NEWSYM CalibYmax209, dd 0 - -EEgg db 0 -RestoreValues db 0 -NEWSYM numdrives, dd 26 -SubPalTable times 256 db 1 ; Corresponding Gray Scale Color - -SECTION .bss -NEWSYM CombinDataGlob, resb 3300 ; 20-name, 42-combo, 2-key#, 1-P#, 1-ff -NEWSYM CombinDataLocl, resb 3300 - -NEWSYM GUIwinorder, resb 22 -GUIwinpos resb 22 -NEWSYM GUIwinactiv, resb 22 -ViewBuffer resb 50*32 - -GUItextcolor resb 5 -NEWSYM GUIcmenupos, resb 1 -GUIescpress resb 1 -GUIcwinpress resb 1 -NEWSYM GUIpmenupos, resb 1 -GUIcrowpos resd 1 -GUIpclicked resb 1 -GUImouseposx resd 1 -GUImouseposy resd 1 -GUICYLocPtr resd 1 -GUIMenuL resd 1 -GUIMenuR resd 1 -GUIMenuD resd 1 -GUIOnMenuItm resb 1 -NEWSYM GUIQuit, resb 1 -GUIHold resb 1 -GUIHoldx resd 1 -GUIHoldy resd 1 -GUIHoldxm resd 1 -GUIHoldym resd 1 -GUIcolscaleval resd 1 -cwindrawn resb 1 -GUIWincol resd 1 -GUIWincoladd resd 1 -GUITemp resd 1 -GUIHoldXlimL resd 1 -GUIHoldXlimR resd 1 -GUIHoldYlim resd 1 -GUIHoldYlimR resd 1 -cloadnpos resd 1 -cloadnposb resd 1 -cloadmaxlen resd 1 -cloadnleft resd 1 -cplayernum resb 1 -vbuflimtop resd 1 -vbuflimbot resd 1 -GUIScrolTim1 resd 1 -GUIScrolTim2 resd 1 -BlankVar resb 1 -GUICHold resd 1 -NEWSYM GUICBHold, resd 1 -GUICBHold2 resd 1 -GUIDClickTL resd 1 -GUIDClCWin resd 1 -GUIDClCEntry resd 1 -GUICResetPos resd 1 -GUICStatePos resd 1 -GUICCFlash resb 1 -GUILDFlash resb 1 -GUIPalConv resd 1 -PrevResoln resw 1 -SnowMover resd 1 -keycontrolval resd 1 -NEWSYM CheatBDoor, resb 1 -NEWSYM ShowTimer, resb 1 -NEWSYM MousePRClick, resb 1 -NEWSYM MouseDis, resb 1 - -NEWSYM CheatOn, resd 1 -NEWSYM NumCheats, resd 1 -NEWSYM cheatdataprev, resb 28 ; leave contents blank -NEWSYM cheatdata, resb 28*255+56 ; toggle, value, address, pvalue, name(22) - -curgsval resb 1 - -NEWSYM GUICMessage, resd 1 -NEWSYM GUICTimer, resd 1 -NEWSYM GUIOn, resb 1 -NEWSYM GUIOn2, resb 1 -NEWSYM GUIReset, resb 1 -NEWSYM CurPalSelect, resb 1 -NEWSYM MotionBlur, resb 1 - -NEWSYM StartLL, resd 1 -NEWSYM StartLR, resd 1 - -NEWSYM TRVal, resw 1 -NEWSYM TGVal, resw 1 -NEWSYM TBVal, resw 1 -NEWSYM TRVali, resw 1 -NEWSYM TGVali, resw 1 -NEWSYM TBVali, resw 1 -NEWSYM TRVal2, resw 1 -NEWSYM TGVal2, resw 1 -NEWSYM TBVal2, resw 1 - -SECTION .data -NEWSYM ComboHeader, db 'Key Combination File',26,1,0 -NEWSYM ComboBlHeader, times 23 db 0 - -SECTION .text -%macro GUIInitIRQs 0 - call GUIInit - mov esi,pressed - mov ecx,256 - mov al,0 -.loopa - mov [esi],al - inc esi - dec ecx - jnz .loopa -%endmacro - -%macro GUIDeInitIRQs 0 - call GUIDeInit -%endmacro - -SECTION .data -NEWSYM GUIoldhand9o, dd 0 -NEWSYM GUIoldhand9s, dw 0 -NEWSYM GUIoldhand8o, dd 0 -NEWSYM GUIoldhand8s, dw 0 -GUIt1cc dd 0 -GUIt1ccSwap db 0 -GUIskipnextkey42 db 0 - -SECTION .text -NEWSYM GUIinit18_2hz - mov al,00110110b - out 43h,al - mov ax,0 - out 40h,al - mov al,ah - out 40h,al - ret - -NEWSYM GUIinit36_4hz - mov al,00110110b - out 43h,al - mov ax,32768 - out 40h,al - mov al,ah - out 40h,al - ret - -NEWSYM GUI36hzcall - inc dword[GUIt1cc] - inc dword[SnowMover] - cmp dword[GUIEditStringLTxt],0 - je .nodec - dec dword[GUIEditStringLTxt] -.nodec - cmp dword[GUIScrolTim1],0 - je .nodec4 - dec dword[GUIScrolTim1] -.nodec4 - cmp dword[GUIDClickTL],0 - je .nodec2 - dec dword[GUIDClickTL] -.nodec2 - cmp dword[GUIkeydelay],0 - je .nodec3 - dec dword[GUIkeydelay] -.nodec3 - cmp dword[GUIkeydelay2],0 - je .nodec3b - dec dword[GUIkeydelay2] -.nodec3b - cmp dword[GUICTimer],0 - je .nodec6 - dec dword[GUICTimer] -.nodec6 - inc byte[GUICCFlash] - and byte[GUICCFlash],0Fh - inc byte[GUILDFlash] - and byte[GUILDFlash],0Fh - ret - -%ifdef __MSDOS__ -NEWSYM GUIhandler8h - cli - push ds - push eax - mov ax,[cs:dssel] - mov ds,ax - call GUI36hzcall - xor byte[GUIt1ccSwap],1 - cmp byte[GUIt1ccSwap],0 - je .nocall - pushf - call far [GUIoldhand8o] -.nocall - mov al,20h - out 20h,al - pop eax - pop ds - sti - iretd - -NEWSYM GUIhandler9h - cli - push ds - push eax - push ebx - mov ax,[cs:dssel] - mov ds,ax - - xor ebx,ebx - in al,60h ; get keyboard scan code - cmp al,42 - jne .no42 - cmp byte[GUIskipnextkey42],0 - je .no42 - mov byte[GUIskipnextkey42],0 - jmp .skipkeyrel -.no42 - cmp al,0E0h - jne .noE0 - mov byte[GUIskipnextkey42],1 - jmp .skipkeyrel -.noE0 - mov byte[GUIskipnextkey42],0 - mov bl,al - xor bh,bh - test bl,80h ; check if bit 7 is on (key released) - jnz .keyrel - cmp byte[pressed+ebx],0 - jne .skipa - mov byte[pressed+ebx],1 ; if not, set key to pressed -.skipa - jmp .skipkeyrel -.keyrel - and bl,7Fh - mov byte[pressed+ebx],0 ; if not, set key to pressed -.skipkeyrel - mov byte[pressed],0 - - pushf - call far [GUIoldhand9o] - mov al,20h - out 20h,al - pop ebx - pop eax - pop ds - sti - iretd -%endif - -%macro loadmenuopen 1 - mov al,[GUIcmenupos] - mov [GUIpmenupos],al - mov byte[GUIcmenupos],0 - cmp byte[GUIwinactiv+%1],1 - je %%menuontop - xor eax,eax - mov al,[GUIwinptr] - inc byte[GUIwinptr] - mov byte[GUIwinorder+eax],%1 - mov byte[GUIwinactiv+%1],1 - cmp byte[savewinpos],0 - jne %%nomenuitem - mov eax,[GUIwinposxo+%1*4] - mov [GUIwinposx+%1*4],eax - mov eax,[GUIwinposyo+%1*4] - mov [GUIwinposy+%1*4],eax - jmp %%nomenuitem -%%menuontop - xor eax,eax - ; look for match -%%notfoundyet - mov bl,[GUIwinorder+eax] - cmp bl,%1 - je %%nextfind - inc eax - jmp %%notfoundyet -%%nextfind - inc eax - cmp al,[GUIwinptr] - je %%foundend - mov cl,[GUIwinorder+eax] - mov [GUIwinorder+eax-1],cl - jmp %%nextfind -%%foundend - mov byte[GUIpclicked],0 - mov [GUIwinorder+eax-1],bl -%%nomenuitem -%endmacro - -loadnetopen: - loadmenuopen 8 - ret - -SECTION .bss -MouseInitOkay resb 1 -SECTION .text - -LoadDetermine: - mov byte[GUIGameMenuData+14],1 - mov byte[GUIGameMenuData+14*2],1 - mov byte[GUIGameMenuData+14*4],1 - mov byte[GUIGameMenuData+14*5],1 - mov byte[GUIGameMenuData+14*6],1 - mov byte[GUICheatMenuData],1 - mov byte[GUICheatMenuData+14],1 - mov byte[GUICheatMenuData+14*2],1 - mov byte[GUIMiscMenuData+14*2],1 - mov byte[GUINetPlayMenuData],2 ; Gray out Netplay options -%ifdef __MSDOS__ - mov byte[GUINetPlayMenuData+14],2 -%endif - cmp byte[romloadskip],0 - je .noromloaded - mov byte[GUIGameMenuData+14],2 - mov byte[GUIGameMenuData+14*2],2 - mov byte[GUIGameMenuData+14*4],2 - mov byte[GUIGameMenuData+14*5],2 - mov byte[GUIGameMenuData+14*6],2 - mov byte[GUICheatMenuData],2 - mov byte[GUICheatMenuData+14],2 - mov byte[GUICheatMenuData+14*2],2 - mov byte[GUIMiscMenuData+14*2],2 -.noromloaded - ret - -SECTION .data -SantaData: -db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -db 0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0 -db 0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0 -db 1,0,0,1,0,0,1,0,0,0,1,1,1,0,1,1 -db 1,1,0,1,1,0,1,1,0,1,0,1,1,1,1,1 -db 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1 -db 1,1,0,1,1,0,1,1,0,0,1,1,1,1,1,1 - -SantaPos dd 272 -SantaNextT dd 36*15 -NEWSYM NumSnow, dd 0 -NEWSYM SnowTimer, dd 36*30 -MsgGiftLeft dd 0 -SECTION .text - -DrawSnow: - cmp byte[OkaySC],0 - je near .nosanta - cmp dword[MsgGiftLeft],0 - je .nodec - mov edx,20 - mov ebx,210 - mov byte[GUItextcolor],228 - GUIOuttextwin .giftmsg -.nodec - mov esi,[vidbuffer] - add esi,[SantaPos] - add esi,60*288 - mov edx,SantaData - mov ebx,8 -.sloop2 - mov ecx,16 -.sloop - cmp byte[edx],0 - je .transp - mov byte[esi],0 -.transp - inc esi - inc edx - dec ecx - jnz .sloop - add esi,272 - dec ebx - jnz .sloop2 -.nosanta - mov esi,[vidbuffer] - mov ecx,200 - xor edx,edx -.loop - xor eax,eax - mov al,[SnowData+edx*4+3] - mov ebx,eax - shl eax,8 - shl ebx,5 - add eax,ebx - xor ebx,ebx - mov bl,[SnowData+edx*4+1] - add eax,ebx - add eax,16 - mov bl,[SnowVelDist+edx*2] - and bl,03h - add bl,228 - test byte[SnowVelDist+edx*2],8 - jz .nosnow - mov [esi+eax],bl -.nosnow - inc edx - dec ecx - jnz .loop - ; Change Snow Displacement Values -.next - cmp dword[SnowMover],0 - je .nomore - call ProcessSnowVelocity - dec dword[SnowMover] - jmp .next -.nomore - ret - -SECTION .data -.giftmsg db 'A GIFT TO YOU IN THE OPTIONS!',0 -SECTION .text - -ProcessSnowVelocity: - cmp dword[MsgGiftLeft],0 - je .nodec - dec dword[MsgGiftLeft] -.nodec - cmp dword[NumSnow],200 - jne .snowincr - cmp dword[SantaNextT],0 - je .skip - dec dword[SantaNextT] - jmp .notsreset -.skip - dec dword[SantaPos] - cmp dword[SantaPos],0 - jne .notsreset - mov dword[SantaPos],272 - mov dword[SantaNextT],36*60 - jmp .notsreset -.snowincr - dec dword[SnowTimer] - jnz .notsreset - inc dword[NumSnow] - mov dword[SnowTimer],18 -.notsreset - - mov ecx,[NumSnow] - cmp ecx,0 - jne .okay - ret -.okay - xor edx,edx -.loop - xor eax,eax - mov al,[SnowVelDist+edx*2] - mov ebx,100 - sub bl,[MusicRelVol] - add bx,bx - add ax,bx - add ax,bx - add word[SnowData+edx*4],ax - xor eax,eax - mov al,[SnowVelDist+edx*2+1] - add ax,256 - add word[SnowData+edx*4+2],ax - cmp word[SnowData+edx*4+2],200h - ja .nosdata - or byte[SnowVelDist+edx*2],8 -.nosdata - inc edx - dec ecx - jnz .loop - ret - -SECTION .bss -OkaySC resb 1 - -%macro ProcessOneDigit 1 - cmp dl,9 - jbe %%notover - add dl,65-48-10 -%%notover - add dl,48 - mov [.message+%1],dl - xor edx,edx - div ebx -%endmacro - -SECTION .data -.message db 0,0,0,0,' ',0,0,0,0,0,0,0 -SECTION .text - -NEWSYM StartGUI -%ifdef __OPENGL__ - cmp byte[BilinearFilter],1 - jne near .skipbl - mov byte[blinit],1 -.skipbl -%endif - mov byte[GUILoadPos],0 - cmp byte[TripBufAvail],0 - jne .notexttb -%ifdef __MSDOS__ - mov byte[Triplebufen],0 -%endif -.notexttb - cmp byte[MMXSupport],1 - jne .2xSaIdis - cmp byte[newgfx16b],0 - je .2xSaIdis - jmp .no2xSaIdis -.2xSaIdis - mov byte[En2xSaI],0 - mov byte[hqFilter],0 -.no2xSaIdis - cmp byte[En2xSaI],0 - je .no2xsaien -%ifdef __MSDOS__ - mov byte[Triplebufen],0 -%endif - mov byte[hqFilter],0 - mov byte[scanlines],0 - mov byte[antienab],0 -.no2xsaien - cmp byte[hqFilter],0 - je .nohqen - mov byte[En2xSaI],0 - mov byte[scanlines],0 - mov byte[antienab],0 -.nohqen - - mov ecx,64 - mov eax,SpecialLine -.slloop - mov dword[eax],0 - add eax,4 - dec ecx - jnz .slloop -.okayow - - mov byte[GUIOn],1 - mov byte[GUIOn2],1 - mov eax,[NumComboLocl] - cmp byte[GUIComboGameSpec],0 - jne .local - mov eax,[NumComboGlob] -.local - mov [NumCombo],eax - call ResetTripleBuf - - cmp dword[GUIwinposx+16*4],0 - jne .notzero - mov dword[GUIwinposx+16*4],3 - mov dword[GUIwinposy+16*4],22 -.notzero - - mov dword[GUICTimer],0 - ; Initialize volume - xor eax,eax - xor edx,edx - mov al,[MusicRelVol] - shl eax,7 - mov ebx,100 - div ebx - cmp al,127 - jb .noofb - mov al,127 -.noofb - mov [MusicVol],al - mov byte[CheatSearchStatus],0 - cmp byte[newgfx16b],0 - je .nong - mov ecx,256*144 - mov eax,[vidbufferofsb] -.loop - mov dword[eax],0 - add eax,4 - dec ecx - jnz .loop -.nong - mov byte[ShowTimer],1 - call Get_Date - cmp dh,12 - jne .noxmas - cmp dl,25 - jne .noxmas - mov byte[OkaySC],1 -.noxmas - mov byte[lastmouseholded],1 - cmp dword[GUIwinposx+15*4],0 - jne .nomoviemenufix - mov dword[GUIwinposx+15*4],50 - mov dword[GUIwinposy+15*4],50 -.nomoviemenufix - mov ax,[resolutn] - mov [PrevResoln],ax - mov word[resolutn],224 - - mov byte[GUIPalConv],0 - mov byte[MousePRClick],1 - - pushad - cmp byte[MouseInitOkay],1 - je near .mousedone - mov byte[MouseInitOkay],1 - cmp byte[MouseDis],1 - je .mousedone - call Init_Mouse - cmp ax,0 - jne .mousedone - mov byte[MouseDis],1 -.mousedone - popad - - mov eax,[KeyQuickLoad] - test byte[pressed+eax],1 - jz near .noquickload - mov byte[GUIcmenupos],0 - loadmenuopen 1 -.noquickload - mov esi,pressed - mov ecx,64+32+8 -.pclear - mov dword[esi],0 - add esi,4 - dec ecx - jnz .pclear - mov byte[pressed+1],2 - mov byte[GUIescpress],1 - - ; set Video cursor location - xor eax,eax - mov al,[cvidmode] - mov [GUIcurrentvideocursloc],eax - mov ebx,[NumVideoModes] - cmp ebx,20 - ja .viewloc - mov dword[GUIcurrentvideoviewloc],0 - jmp .skip -.viewloc - sub ebx,20 - cmp eax,ebx - jbe .noof - mov eax,ebx -.noof - mov [GUIcurrentvideoviewloc],eax -.skip - - pushad - call SaveSramData - call GUIQuickLoadUpdate - popad - - call LoadDetermine - - cmp byte[AutoState],0 - je .noautostate - cmp byte[romloadskip],0 - jne .noautostate - pushad - call SaveSecondState - popad -.noautostate - - GUIInitIRQs - - cmp byte[GUIwinptr],0 - jne .nomenuopen - cmp byte[esctomenu],0 - je .nomenuchange - mov byte[GUIcmenupos],2 - mov byte[GUIcrowpos],0 - mov dword[GUICYLocPtr],MenuDat2 - cmp byte[esctomenu],1 - je .nomenuchange -.nomenuopen - mov byte[GUIcmenupos],0 -.nomenuchange - cmp byte[GUIwinactiv+1],0 - je .noloadrefresh - mov dword[GUIcurrentfilewin],0 - call GetLoadData -.noloadrefresh - mov byte[GUIHold],0 - ; clear 256 bytes from hirestiledat - mov esi,hirestiledat - mov ecx,256 -.loophires - mov byte[esi],0 - inc esi - dec ecx - jnz .loophires - mov byte[curblank],00h - call InitGUI - - cmp byte[CheatWinMode],0 - je near .csskip - - ; Load Cheat Search File - pushad - call LoadCheatSearchFile - popad - -.csskip - - mov byte[GUIQuit],0 -.nokey - cmp byte[GUIQuit],2 - je near .exit - cmp byte[GUIQuit],1 - je near .exitgui - mov byte[GUIQuit],0 - cmp byte[MouseDis],1 - je .mousedis2 - call ProcessMouse - cmp byte[videotroub],1 - jne .notrouble - ret -.notrouble -.mousedis2 - call GUIUnBuffer - cmp byte[GUIEffect],1 - jne .nosnow - call DrawSnow -.nosnow - cmp byte[GUIEffect],2 - jne .nowater - call DrawWater -.nowater - cmp byte[GUIEffect],3 - jne .nowater2 - call DrawWater -.nowater2 - cmp byte[GUIEffect],4 - jne .noburn - call DrawBurn -.noburn - cmp byte[GUIEffect],5 - jne .nosmoke - call DrawSmoke -.nosmoke - - cmp dword[GUIEditStringcWin],0 - je .noblink - cmp dword[GUIEditStringcLen],0 - je .noblink - mov eax,[GUIEditStringcLen] - cmp dword[GUIEditStringLTxt],8 - jb .noblinka - mov byte[eax],'_' - mov byte[eax+1],0 - mov dword[GUIEditStringLstb],1 -.noblinka - cmp dword[GUIEditStringLTxt],0 - jne .noblink - mov dword[GUIEditStringLTxt],16 -.noblink - - call DisplayBoxes - - cmp dword[GUIEditStringLstb],1 - jne .notblinked - mov dword[GUIEditStringLstb],0 - mov eax,[GUIEditStringcLen] - mov byte[eax],0 -.notblinked - - call DisplayMenu - cmp byte[MouseDis],1 - je .mousedis3 - call DrawMouse -.mousedis3 - cmp byte[FirstTimeData],0 - jne .nofirsttime - call guifirsttimemsg - mov byte[FirstTimeData],1 -.nofirsttime - cmp byte[guimsgptr],0 - jne .nohorizon - pushad - call GetDate - cmp ax,1025 - popad - jne .nohorizon - pushad - call GetTime - push eax - call horizon_get - mov [guimsgptr],eax - popad - call horizonfixmsg -.nohorizon - cmp dword[GUICTimer],0 - je .notimer - GUIOuttext 21,211,[GUICMessage],50 - GUIOuttext 20,210,[GUICMessage],63 -.notimer - call vidpastecopyscr - call GUIgetcurrentinput - jmp .nokey -.exitgui - GUIDeInitIRQs - - mov ax,[PrevResoln] - mov [resolutn],ax - jmp endprog -.exit - mov edi,[spcBuffera] - mov ecx,65536 - xor eax,eax - rep stosd - GUIDeInitIRQs -%ifdef __MSDOS__ - call DOSClearScreen - cmp byte[cbitmode],0 - jne .nomakepal - call dosmakepal -.nomakepal -%endif - mov word[t1cc],1 - - pushad - call GUISaveVars - popad - - mov byte[MousePRClick],1 - mov byte[prevbright],0 - mov ax,[PrevResoln] - mov [resolutn],ax - - mov byte[CheatOn],0 - cmp dword[NumCheats],0 - je .nocheats - mov byte[CheatOn],1 -.nocheats - - cmp byte[CopyRamToggle],1 - jne .nocopyram - mov byte[CopyRamToggle],0 - mov eax,[vidbuffer] - add eax,129600 - ; copy 128k ram - mov ebx,[wramdata] - mov ecx,32768 -.loopcr - mov edx,[ebx] - mov [eax],edx - add ebx,4 - add eax,4 - dec ecx - jnz .loopcr -.nocopyram - - cmp byte[CheatWinMode],2 - jne .notview - mov byte[CheatWinMode],1 -.notview - - cmp byte[CheatWinMode],0 - je .csskip2 - ;Save Cheat Search File - pushad - call SaveCheatSearchFile - popad - .csskip2 - - mov edi,[vidbuffer] - mov ecx,288*120 - xor eax,eax - rep stosd - - mov ecx,256*144 - mov eax,[vidbufferofsb] -.loopcl - mov dword[eax],0 - add eax,4 - dec ecx - jnz .loopcl - - call AdjustFrequency - mov byte[GUIOn],0 - mov byte[GUIOn2],0 - mov byte[GUIReset],0 - mov dword[StartLL],0 - mov dword[StartLR],0 - jmp continueprog - -guimencodermsg: - xor ebx,ebx - mov ecx,256 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .a - mov byte[pressed+2Ch],0 -.again - GUIBox 43,75,213,163,160 - GUIBox 43,75,213,75,162 - GUIBox 43,75,43,163,161 - GUIBox 213,75,213,163,159 - GUIBox 43,163,213,163,158 - GUIOuttext 52,96,guimencodert1,220-15 - GUIOuttext 51,95,guimencodert1,220 - GUIOuttext 52,134,guimencodert2,220-15 - GUIOuttext 51,133,guimencodert2,220 - call vidpastecopyscr - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - call JoyRead - cmp byte[pressed+39h],0 - jne .pressedokay - jmp .again -.pressedokay - ret - -guilamemsg: - xor ebx,ebx - mov ecx,256 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .a - mov byte[pressed+2Ch],0 -.again - GUIBox 43,75,213,163,160 - GUIBox 43,75,213,75,162 - GUIBox 43,75,43,163,161 - GUIBox 213,75,213,163,159 - GUIBox 43,163,213,163,158 - GUIOuttext 52,96,guilamet1,220-15 - GUIOuttext 51,95,guilamet1,220 - GUIOuttext 52,134,guilamet2,220-15 - GUIOuttext 51,133,guilamet2,220 - call vidpastecopyscr - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - call JoyRead - cmp byte[pressed+39h],0 - jne .pressedokay - jmp .again -.pressedokay - ret - -SECTION .data -guimencodert1 db ' MENCODER IS MISSING: ',0 -guimencodert2 db 'PRESS SPACE TO PROCEED',0 -guilamet1 db ' LAME IS MISSING: ',0 -guilamet2 db 'PRESS SPACE TO PROCEED',0 - -SECTION .text - -guifirsttimemsg: - xor ebx,ebx - mov ecx,256 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .a - mov byte[pressed+2Ch],0 -.again - GUIBox 43,75,213,163,160 - GUIBox 43,75,213,75,162 - GUIBox 43,75,43,163,161 - GUIBox 213,75,213,163,159 - GUIBox 43,163,213,163,158 - GUIOuttext 52,81,guiftimemsg1,220-15 - GUIOuttext 51,80,guiftimemsg1,220 - GUIOuttext 52,96,guiftimemsg2,220-15 - GUIOuttext 51,95,guiftimemsg2,220 - GUIOuttext 52,104,guiftimemsg3,220-15 - GUIOuttext 51,103,guiftimemsg3,220 - GUIOuttext 52,112,guiftimemsg4,220-15 - GUIOuttext 51,111,guiftimemsg4,220 - GUIOuttext 52,120,guiftimemsg5,220-15 - GUIOuttext 51,119,guiftimemsg5,220 - GUIOuttext 52,128,guiftimemsg6,220-15 - GUIOuttext 51,127,guiftimemsg6,220 - GUIOuttext 52,136,guiftimemsg7,220-15 - GUIOuttext 51,135,guiftimemsg7,220 - GUIOuttext 52,151,guiftimemsg8,220-15 - GUIOuttext 51,150,guiftimemsg8,220 - call vidpastecopyscr - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - call JoyRead - cmp byte[pressed+39h],0 - jne .pressedokay - jmp .again -.pressedokay - ret - -SECTION .data -guiftimemsg1 db ' ONE-TIME USER REMINDER : ',0 -guiftimemsg2 db ' PLEASE BE SURE TO READ ',0 -guiftimemsg3 db 'THE DOCUMENTATION INCLUDED',0 -guiftimemsg4 db ' WITH ZSNES FOR IMPORTANT',0 -guiftimemsg5 db ' INFORMATION AND ANSWERS',0 -guiftimemsg6 db ' TO COMMON PROBLEMS',0 -guiftimemsg7 db ' AND QUESTIONS.',0 -guiftimemsg8 db 'PRESS SPACEBAR TO PROCEED.',0 -SECTION .text - -horizonfixmsg: - xor ebx,ebx - mov ecx,256 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .a - mov byte[pressed+2Ch],0 -.again - GUIBox 43,75,213,163,160 - GUIBox 43,75,213,75,162 - GUIBox 43,75,43,163,161 - GUIBox 213,75,213,163,159 - GUIBox 43,163,213,163,158 - GUIOuttext 52,81,guimsgmsg,220-15 - GUIOuttext 51,80,guimsgmsg,220 - GUIOuttext 52,96,[guimsgptr],220-15 - GUIOuttext 51,95,[guimsgptr],220 - add dword[guimsgptr],32 - GUIOuttext 52,104,[guimsgptr],220-15 - GUIOuttext 51,103,[guimsgptr],220 - add dword[guimsgptr],32 - GUIOuttext 52,112,[guimsgptr],220-15 - GUIOuttext 51,111,[guimsgptr],220 - add dword[guimsgptr],32 - GUIOuttext 52,120,[guimsgptr],220-15 - GUIOuttext 51,119,[guimsgptr],220 - sub dword[guimsgptr],96 - GUIOuttext 52,151,guiftimemsg8,220-15 - GUIOuttext 51,150,guiftimemsg8,220 - call vidpastecopyscr - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - call JoyRead - cmp byte[pressed+39h],0 - jne .pressedokay - jmp .again -.pressedokay - ret - -SECTION .data -guimsgptr dd 0 -guimsgmsg db ' WELCOME TO ZSNES',0 -SECTION .text - -guiprevideo: - xor ebx,ebx - mov ecx,256 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .a - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - GUIBox 43,90,213,163,160 - GUIBox 43,90,213,90,162 - GUIBox 43,90,43,163,161 - GUIBox 213,90,213,163,159 - GUIBox 43,163,213,163,158 - GUIOuttext 56,96,guiprevidmsg1,220-15 - GUIOuttext 55,95,guiprevidmsg1,220 - GUIOuttext 56,104,guiprevidmsg2,220-15 - GUIOuttext 55,103,guiprevidmsg2,220 - GUIOuttext 56,112,guiprevidmsg3,220-15 - GUIOuttext 55,111,guiprevidmsg3,220 - GUIOuttext 56,120,guiprevidmsg4,220-15 - GUIOuttext 55,119,guiprevidmsg4,220 - GUIOuttext 56,128,guiprevidmsg5,220-15 - GUIOuttext 55,127,guiprevidmsg5,220 - GUIOuttext 56,136,guiprevidmsg6,220-15 - GUIOuttext 55,135,guiprevidmsg6,220 - GUIOuttext 56,151,guiprevidmsg7,220-15 - GUIOuttext 55,150,guiprevidmsg7,220 - call vidpastecopyscr - mov byte[pressed+2Ch],0 -.again - call JoyRead - xor ebx,ebx - mov ecx,256+128+64 -.b - cmp byte[pressed+ebx],0 - jne .pressedkey - inc ebx - dec ecx - jnz .b - cmp byte[MouseDis],1 - je .again - call Get_MouseData - cmp byte[lhguimouse],1 - jne .notlefthanded - call SwapMouseButtons -.notlefthanded - test bx,01h - jnz .pressedokay - jmp .again -.pressedkey - mov byte[pressed+ebx],0 -.pressedokay - ret - -SECTION .data -guiprevidmsg1 db 'ZSNES WILL NOW ATTEMPT',0 -guiprevidmsg2 db ' TO CHANGE YOUR VIDEO',0 -guiprevidmsg3 db ' MODE. IF THE CHANGE',0 -guiprevidmsg4 db 'IS UNSUCCESSFUL, WAIT',0 -guiprevidmsg5 db ' 10 SECONDS AND VIDEO',0 -guiprevidmsg6 db 'MODE WILL BE RESTORED.',0 -guiprevidmsg7 db ' PRESS ANY KEY.',0 -SECTION .text - -guipostvideo: - mov ecx,256*144 - mov eax,[vidbufferofsb] -.loop - mov dword[eax],0FFFFFFFFh - add eax,4 - dec ecx - jnz .loop - - mov dword[GUIkeydelay],36*10 - -.pressedfail - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - GUIBox 43,90,213,163,160 - GUIBox 43,90,213,90,162 - GUIBox 43,90,43,163,161 - GUIBox 213,90,213,163,159 - GUIBox 43,163,213,163,158 - GUIOuttext 56,96,guipostvidmsg1,220-15 - GUIOuttext 55,95,guipostvidmsg1,220 - GUIOuttext 56,151,guipostvidmsg2,220-15 - GUIOuttext 55,150,guipostvidmsg2,220 - call vidpastecopyscr - ; Wait for all mouse and input data to be 0 - - cmp dword[GUIkeydelay],0 - je .pressedokay - - ;This is to make all ports not register space bar from being pressed earlier - mov byte[pressed+2Ch],0 - - call JoyRead - - cmp byte[pressed+39h],0 - jne .pressedokay - jmp .pressedfail -.pressedokay - mov byte[GUIpclicked],1 - ret - -SECTION .data -guipostvidmsg1 db 'VIDEO MODE CHANGED.',0 -guipostvidmsg2 db ' PRESS SPACEBAR.',0 -SECTION .text - -guipostvideofail: - mov dword[guipostvidptr],guipostvidmsg3b - mov byte[guipostvidmsg3b],0 - mov byte[guipostvidmsg4b],0 - mov byte[guipostvidmsg5b],0 - mov eax,[ErrorPointer] - mov ebx,eax -.loop - cmp byte[ebx],0 - je .found - cmp byte[ebx],'$' - je .found - inc ebx - jmp .loop -.found - mov edx,ebx - sub edx,eax -.detnext - or edx,edx - jz .notext - cmp edx,25 - jbe .copytext -.nospace - dec edx - cmp byte[eax+edx],32 - jne .nospace - jmp .detnext -.copytext - push ebx - mov ecx,[guipostvidptr] -.copytextloop - mov bl,[eax] - cmp bl,'$' - jne .notdol - mov bl,0 -.notdol - mov [ecx],bl - inc eax - inc ecx - dec edx - jnz .copytextloop - mov byte[ecx],0 - pop ebx - add dword[guipostvidptr],26 - cmp byte[eax],0 - je .notext - cmp byte[eax],'$' - je .notext - inc eax - jmp .found -.notext - - xor ebx,ebx - mov ecx,256 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .a - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - GUIBox 43,90,213,163,160 - GUIBox 43,90,213,90,162 - GUIBox 43,90,43,163,161 - GUIBox 213,90,213,163,159 - GUIBox 43,163,213,163,158 - GUIOuttext 56,96,guipostvidmsg1b,220-15 - GUIOuttext 55,95,guipostvidmsg1b,220 - GUIOuttext 56,108,guipostvidmsg2b,220-15 - GUIOuttext 55,107,guipostvidmsg2b,220 - GUIOuttext 56,119,guipostvidmsg3b,220-15 - GUIOuttext 55,118,guipostvidmsg3b,220 - GUIOuttext 56,129,guipostvidmsg4b,220-15 - GUIOuttext 55,128,guipostvidmsg4b,220 - GUIOuttext 56,139,guipostvidmsg5b,220-15 - GUIOuttext 55,138,guipostvidmsg5b,220 - GUIOuttext 56,152,guipostvidmsg8b,220-15 - GUIOuttext 55,151,guipostvidmsg8b,220 - call vidpastecopyscr - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu -%ifndef __UNIXSDL__ - mov dword[GUIkeydelay],0FFFFFFFFh -%else - mov dword[GUIkeydelay],0x0 -%endif - jmp guipostvideo.pressedfail - -SECTION .data -guipostvidmsg1b db 'VIDEO MODE CHANGE FAILED.',0 -guipostvidmsg2b db 'UNABLE TO INIT VESA2:',0 -guipostvidmsg3b db 'AAAAAAAAAAAAAAAAAAAAAAAAA',0 -guipostvidmsg4b db 'AAAAAAAAAAAAAAAAAAAAAAAAA',0 -guipostvidmsg5b db 'AAAAAAAAAAAAAAAAAAAAAAAAA',0 -guipostvidmsg8b db 'PRESS ANY KEY',0 -SECTION .bss -guipostvidptr resd 1 -SECTION .text - -NEWSYM guicheaterror - xor ebx,ebx - mov ecx,256+128+64 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .a -.again - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - GUIBox 75,95,192,143,160 - GUIBox 75,95,192,95,162 - GUIBox 75,95,75,143,161 - GUIBox 192,95,192,143,159 - GUIBox 75,143,192,143,158 - GUIOuttext 81,101,guicheaterror1,220-15 - GUIOuttext 80,100,guicheaterror1,220 - GUIOuttext 81,109,guicheaterror2,220-15 - GUIOuttext 80,108,guicheaterror2,220 - GUIOuttext 81,117,guicheaterror3,220-15 - GUIOuttext 80,116,guicheaterror3,220 - GUIOuttext 81,125,guicheaterror4,220-15 - GUIOuttext 80,124,guicheaterror4,220 - GUIOuttext 81,135,guicheaterror5,220-15 - GUIOuttext 80,134,guicheaterror5,220 - call vidpastecopyscr - call JoyRead - xor ebx,ebx - mov ecx,256+128+64 -.b - cmp byte[pressed+ebx],0 - jne .pressedokay - inc ebx - dec ecx - jnz .b - cmp byte[MouseDis],1 - je .mousedis - call Get_MouseData - cmp byte[lhguimouse],1 - jne .notlefthanded - call SwapMouseButtons -.notlefthanded - test bx,01h - jnz .pressedokay -.mousedis - jmp .again -.pressedokay -.again2 - call Check_Key - or al,al - jz .nokey - call Get_Key - jmp .again2 -.nokey - cmp byte[MouseDis],1 - je .mousedis2 - push ebx -; mov eax,0Bh -; int 33h - pop ebx -.mousedis2 - mov dword[GUIcurrentcheatwin],1 - mov byte[GUIpclicked],1 - ret - -SECTION .data -guicheaterror1 db 'INVALID CODE! YOU',0 -guicheaterror2 db 'MUST ENTER A VALID',0 -guicheaterror3 db 'GAME GENIE,PAR, OR',0 -guicheaterror4 db 'GOLD FINGER CODE.',0 -guicheaterror5 db 'PRESS ANY KEY.',0 -SECTION .text - -SECTION .bss -ManualCPtr resd 1 -ManualStatus resb 1 -NEWSYM Totalbyteloaded, resd 1 -NEWSYM sramsavedis, resb 1 - -SECTION .data - -SECTION .text - -CheckMenuItemHelp: - mov al,[GUIcmenupos] - mov [GUIpmenupos],al - mov byte[GUIcmenupos],0 - cmp byte[GUIwinactiv+edx],1 - je .menuontop - xor eax,eax - mov al,[GUIwinptr] - inc byte[GUIwinptr] - mov [GUIwinorder+eax],dl - mov byte[GUIwinactiv+edx],1 - cmp byte[savewinpos],0 - jne .nomenuitem - mov eax,[GUIwinposxo+edx*4] - mov [GUIwinposx+edx*4],eax - mov eax,[GUIwinposyo+edx*4] - mov [GUIwinposy+edx*4],eax - jmp .nomenuitem -.menuontop - xor eax,eax - ; look for match -.notfoundyet - mov bl,[GUIwinorder+eax] - cmp bl,dl - je .nextfind - inc eax - jmp .notfoundyet -.nextfind - inc eax - cmp al,[GUIwinptr] - je .foundend - mov cl,[GUIwinorder+eax] - mov [GUIwinorder+eax-1],cl - jmp .nextfind -.foundend - mov byte[GUIpclicked],0 - mov [GUIwinorder+eax-1],bl -.nomenuitem - ret - -%macro GUICheckMenuItem 2 - mov edx,%1 - cmp byte[GUIcrowpos],%2 - jne near %%nomenuitem - call CheckMenuItemHelp -%%nomenuitem -%endmacro - -%macro checkqloadvalue 1 - cmp byte[GUIcrowpos],%1 - jne %%skip - pushad - push %1 - call loadquickfname - pop eax - popad - ret -%%skip -%endmacro - -GUITryMenuItem: ; Defines which menu item calls what window number - cmp byte[GUIcmenupos],1 - jne near .noquickload - checkqloadvalue 0 - checkqloadvalue 1 - checkqloadvalue 2 - checkqloadvalue 3 - checkqloadvalue 4 - checkqloadvalue 5 - checkqloadvalue 6 - checkqloadvalue 7 - checkqloadvalue 8 - checkqloadvalue 9 - cmp byte[GUIcrowpos],11 - jne .skipswitch - xor byte[prevlfreeze],1 - cmp byte[prevlfreeze],0 - je .off - mov dword[GUIPrevMenuData+347],' ON ' - jmp .on -.off - mov dword[GUIPrevMenuData+347],' OFF' -.on -.skipswitch - cmp byte[GUIcrowpos],12 - jne .skipclear - cmp byte[prevlfreeze],0 - jne .skipclear - mov edi,prevloadiname - mov eax,20202020h - mov ecx,70 - rep stosd - mov edi,prevloaddnamel - xor eax,eax - mov ecx,1280 - rep stosd - mov edi,prevloadfnamel - mov ecx,1280 - rep stosd - pushad - call GUIQuickLoadUpdate - popad - ret -.skipclear -.noquickload - cmp byte[GUIcmenupos],2 - jne near .nomain - GUICheckMenuItem 1, 0 ; Load - cmp byte[GUIcrowpos],0 - jne .noloadrefresh - mov dword[GUIcurrentfilewin],0 - jmp GetLoadData -.noloadrefresh - cmp byte[romloadskip],0 - jne near .noromloaded - cmp byte[GUIcrowpos],1 ; Run - jne .norun - cmp byte[romloadskip],0 - jne .dontquit - mov byte[GUIQuit],2 -.dontquit - ret -.norun - GUICheckMenuItem 12, 2 ; Reset - cmp byte[GUIcrowpos],2 - jne .noreset - mov byte[GUICResetPos],1 -.noreset - cmp byte[GUIcrowpos],4 - jne .nosavestate - mov byte[GUIStatesText5],0 - mov byte[GUICStatePos],1 -.nosavestate - cmp byte[GUIcrowpos],5 - jne .noloadstate - mov byte[GUIStatesText5],1 - mov byte[GUICStatePos],1 -.noloadstate - GUICheckMenuItem 14, 4 ; Save State - GUICheckMenuItem 14, 5 ; Load State - GUICheckMenuItem 2, 6 ; Select State -.noromloaded - cmp byte[GUIcrowpos],8 - jne .noquit - mov byte[GUIQuit],1 -.noquit -.nomain - cmp byte[GUIcmenupos],3 - jne near .noconfig - ;The number on the left is the window to open - ;the number on the right is where in the drop down box we are - GUICheckMenuItem 3,0 ; Input #1-5 - GUICheckMenuItem 17,2 ; Devices - GUICheckMenuItem 18,3 ; Chip Config - GUICheckMenuItem 4,5 ; Options - cmp byte[GUIcrowpos],6 ; Video - jne near .novideo - ; set Video cursor location - xor eax,eax - mov al,[cvidmode] - mov [GUIcurrentvideocursloc],eax - mov edx,[NumVideoModes] - cmp edx,20 - ja .viewloc - mov dword[GUIcurrentvideoviewloc],0 - jmp .skip -.viewloc - sub edx,20 - cmp eax,edx - jbe .noof - mov eax,edx -.noof - mov [GUIcurrentvideoviewloc],eax -.skip - mov edx,5 - call CheckMenuItemHelp -.novideo - GUICheckMenuItem 6,7 ; Sound - GUICheckMenuItem 19,8 ; Paths - GUICheckMenuItem 20,9 ; Saves - GUICheckMenuItem 21,10 ; Speed -.noconfig - cmp byte[romloadskip],0 - jne near .nocheat - cmp byte[GUIcmenupos],4 - jne near .nocheat - GUICheckMenuItem 7, 0 - GUICheckMenuItem 7, 1 - GUICheckMenuItem 13, 2 - cmp byte[GUIcrowpos],0 - jne .noaddc - mov dword[GUIcurrentcheatwin],1 -.noaddc - cmp byte[GUIcrowpos],1 - jne .nobrowsec - mov dword[GUIcurrentcheatwin],0 -.nobrowsec -.nocheat - cmp byte[GUIcmenupos],5 - jne near .nonet -%ifdef __MSDOS__ -; GUICheckMenuItem 8, 0 ; Disable DOS Netplay Options -; GUICheckMenuItem 8, 1 -%endif -; GUICheckMenuItem 8, 0 ; Disable WIN/SDL Internet Option - cmp byte[GUIcrowpos],0 - jne near .nonet -.nonet - cmp byte[GUIcmenupos],6 - jne near .nomisc - GUICheckMenuItem 9, 0 - GUICheckMenuItem 10, 1 - cmp byte[romloadskip],0 - jne near .nomovie - GUICheckMenuItem 15, 2 - cmp byte[GUIcrowpos],2 - jne .nomovie - mov byte[MovieRecordWinVal],0 -.nomovie - GUICheckMenuItem 16, 3 ; Save Config - cmp byte[GUIcrowpos],4 - jne .nosavestuff - - mov byte[savecfgforce],1 - pushad - call GUISaveVars - popad - mov byte[savecfgforce],0 - - call Makemode7Table - mov dword[GUICMessage],.message1 - mov dword[GUICTimer],50 -.nosavestuff - GUICheckMenuItem 11, 6 -.nomisc - ret - -SECTION .data -.message1 db 'CONFIGURATION FILES SAVED.',0 -NEWSYM savecfgforce, db 0 -SECTION .text - -DisplayBoxes: ; Displays window when item is clicked - xor esi,esi -.next2 - mov al,[GUIwinorder+esi] - cmp al,0 - je .done - inc esi - jmp .next2 -.done - mov eax,esi - dec eax - mov [cwindrawn],al - xor eax,eax - xor esi,esi -.next - mov al,[GUIwinorder+esi] - cmp al,0 - je near .nomore - push esi - cmp al,1 - jne .noguiconfirm - cmp byte[GUIReset],1 - je near .finstuff - call DisplayGUILoad - jmp .finstuff -.noguiconfirm - cmp al,2 - jne .noguichosesave - call DisplayGUIChoseSave - jmp .finstuff -.noguichosesave - cmp al,3 - jne .noguiinput - call DisplayGUIInput - jmp .finstuff -.noguiinput - cmp al,4 - jne .noguioption - call DisplayGUIOption - jmp .finstuff -.noguioption - cmp al,5 - jne .noguivideo - call DisplayGUIVideo - jmp .finstuff -.noguivideo - cmp al,6 - jne .noguisound - call DisplayGUISound - jmp .finstuff -.noguisound - cmp al,7 - jne .noguicheat - call DisplayGUICheat - jmp .finstuff -.noguicheat - cmp al,8 - jne .noguinet - call DisplayNetOptns - jmp .finstuff -.noguinet - cmp al,9 - jne .noguigameop - call DisplayGameOptns - jmp .finstuff -.noguigameop - cmp al,10 - jne .noguiconf - call DisplayGUIOptns -%ifdef __WIN32__ - pushad - call CheckAlwaysOnTop - popad -%endif - jmp .finstuff -.noguiconf - cmp al,11 - jne .noguiconf2 - call DisplayGUIAbout - jmp .finstuff -.noguiconf2 - cmp al,12 - jne .noguireset - call DisplayGUIReset - jmp .finstuff -.noguireset - cmp al,13 - jne .noguisearch - call DisplayGUISearch - jmp .finstuff -.noguisearch - cmp al,14 - jne .noguistates - call DisplayGUIStates - jmp .finstuff -.noguistates - cmp al,15 - jne .noguimovies - call DisplayGUIMovies - jmp .finstuff -.noguimovies - cmp al,16 - jne .noguicombo - call DisplayGUICombo - jmp .finstuff -.noguicombo - cmp al,17 - jne .noaddon - call DisplayGUIAddOns - jmp .finstuff -.noaddon - cmp al,18 - jne .nochipconfig - call DisplayGUIChipConfig - jmp .finstuff -.nochipconfig - cmp al,19 - jne .nopaths - call DisplayGUIPaths - jmp .finstuff -.nopaths - cmp al,20 - jne .nosave - call DisplayGUISave - jmp .finstuff -.nosave - cmp al,21 - jne .nospeed - call DisplayGUISpeed - jmp .finstuff -.nospeed -.finstuff - pop esi - inc esi - dec byte[cwindrawn] - jmp .next -.nomore - ret - -GUIProcStates: - xor eax,eax - mov al,[GUIwinptr] - dec eax - mov byte[GUIwinactiv+14],0 - mov byte[GUIwinorder+eax],0 - dec byte[GUIwinptr] - cmp byte[GUICBHold],10 - je .yesstate - mov byte[GUICBHold],0 - ret -.yesstate - mov byte[GUICBHold],0 - cmp byte[GUIStatesText5],1 - je .loadstate - pushad - call statesaver - popad - jmp .changedir -.loadstate - pushad - call loadstate2 - popad -.changedir - ret - -GUIProcReset: - cmp byte[GUICBHold],2 - jne .noreset - pushad - mov byte[GUIReset],1 - cmp byte[MovieProcessing],2 ;Recording - jne .nomovierecording - call ResetDuringMovie - jmp .movieendif -.nomovierecording - call GUIDoReset -.movieendif - popad -.noreset - mov byte[GUICBHold],0 - xor eax,eax - mov al,[GUIwinptr] - dec eax - mov byte[GUIwinactiv+12],0 - mov byte[GUIwinorder+eax],0 - dec byte[GUIwinptr] - ret - -%macro GUIDMHelp 4 - mov byte[GUItextcolor],46 - mov byte[GUItextcolor+1],42 - mov byte[GUItextcolor+2],38 - mov byte[GUItextcolor+3],44 - mov byte[GUItextcolor+4],40 - cmp byte[GUIcmenupos],%4 - jne %%nohighlight - mov byte[GUItextcolor],38 - mov byte[GUItextcolor+1],40 - mov byte[GUItextcolor+2],46 - mov byte[GUItextcolor+3],40 - mov byte[GUItextcolor+4],44 -%%nohighlight - GUIBox %1,3,%2,3,[GUItextcolor] - GUIBox %1,4,%2,12,[GUItextcolor+1] - GUIBox %1,13,%2,13,[GUItextcolor+2] - GUIBox %1,3,%1,12,[GUItextcolor+3] - GUIBox %2,4,%2,13,[GUItextcolor+4] - GUIOuttext %1+5,7,%3,44 - GUIOuttext %1+4,6,%3,62 -%endmacro - -%macro GUIDMHelpB 4 - mov byte[GUItextcolor],46 - mov byte[GUItextcolor+1],42 - mov byte[GUItextcolor+2],38 - mov byte[GUItextcolor+3],44 - mov byte[GUItextcolor+4],40 - cmp byte[GUIcwinpress],%4 - jne %%nohighlight - mov byte[GUItextcolor],38 - mov byte[GUItextcolor+1],40 - mov byte[GUItextcolor+2],46 - mov byte[GUItextcolor+3],40 - mov byte[GUItextcolor+4],44 -%%nohighlight - GUIBox %1,3,%2,3,[GUItextcolor] - GUIBox %1,4,%2,13,[GUItextcolor+1] - GUIBox %1,14,%2,14,[GUItextcolor+2] - GUIBox %1,3,%1,13,[GUItextcolor+3] - GUIBox %2,4,%2,14,[GUItextcolor+4] - GUIOuttext %1+3,7,%3,44 - GUIOuttext %1+2,6,%3,62 -%endmacro - -%macro GUIDMHelpB2 4 - mov byte[GUItextcolor],46 - mov byte[GUItextcolor+1],42 - mov byte[GUItextcolor+2],38 - mov byte[GUItextcolor+3],44 - mov byte[GUItextcolor+4],40 - cmp byte[GUIcwinpress],%4 - jne %%nohighlight - mov byte[GUItextcolor],38 - mov byte[GUItextcolor+1],40 - mov byte[GUItextcolor+2],46 - mov byte[GUItextcolor+3],40 - mov byte[GUItextcolor+4],44 -%%nohighlight - GUIBox %1,3,%2,3,[GUItextcolor] - GUIBox %1,4,%2,6,[GUItextcolor+1] - GUIBox %1,7,%2,7,[GUItextcolor+2] - GUIBox %1,3,%1,6,[GUItextcolor+3] - GUIBox %2,4,%2,7,[GUItextcolor+4] - GUIOuttext %1+3,5,%3,44 - GUIOuttext %1+2,4,%3,62 -%endmacro - -%macro GUIDMHelpB3 4 - mov byte[GUItextcolor],46 - mov byte[GUItextcolor+1],42 - mov byte[GUItextcolor+2],38 - mov byte[GUItextcolor+3],44 - mov byte[GUItextcolor+4],40 - cmp byte[GUIcwinpress],%4 - jne %%nohighlight - mov byte[GUItextcolor],38 - mov byte[GUItextcolor+1],40 - mov byte[GUItextcolor+2],46 - mov byte[GUItextcolor+3],40 - mov byte[GUItextcolor+4],44 -%%nohighlight - GUIBox %1,9,%2,9,[GUItextcolor] - GUIBox %1,10,%2,12,[GUItextcolor+1] - GUIBox %1,13,%2,13,[GUItextcolor+2] - GUIBox %1,9,%1,12,[GUItextcolor+3] - GUIBox %2,10,%2,13,[GUItextcolor+4] - GUIOuttext %1+3,11,%3,44 - GUIOuttext %1+2,10,%3,62 -%endmacro - -%macro GUIDrawMenuM 10 - GUIShadow %7,%8,%7+4+%3*6,%8+3+%4*10 - GUIBox %1,%2,%1+4+%3*6,%2+3+%4*10,43 - - mov edi,[GUIcrowpos] - mov ecx,edi - shl edi,8 - shl ecx,5 - add edi,ecx - lea edi,[edi*5] - shl edi,1 - add edi,[vidbuffer] - add edi,%1+17+18*288 - mov ecx,6*%3+3 - mov edx,1 - mov al,73 - push edi - call GUIDrawBox - pop edi - add edi,288 - mov ecx,6*%3+3 - mov edx,7 - mov al,72 - push edi - call GUIDrawBox - pop edi - add edi,288*7 - mov ecx,6*%3+3 - mov edx,1 - mov al,73 - call GUIDrawBox - - GUIBox %1+%10,%2,%1+4+%3*6,%2,47 - GUIBox %1,%2,%1,%9,45 - GUIBox %1,%9,%1+4+%3*6,%9,39 - GUIBox %1+4+%3*6,1+%2,%1+4+%3*6,%9,41 - mov edi,%5 - mov esi,[vidbuffer] - add esi,16+%6+20*288 - mov ecx,%4 - mov edx,6*%3 - call GUIMenuDisplay - - mov dword[GUIMenuL],%1+1 - mov dword[GUIMenuR],%1+6*%3+3 - mov dword[GUIMenuD],18+%4*10 -%endmacro - -DisplayMenu: - ; Draw Shadow - GUIShadow 5,7,235,21 - ; Display Top Border - GUIBox 0,1,229,1,71 - GUIBox 0,2,229,2,70 - GUIBox 0,3,229,3,69 - GUIBox 0,4,229,4,68 - GUIBox 0,5,229,5,67 - GUIBox 0,6,229,6,66 - GUIBox 0,7,229,7,65 - GUIBox 0,8,229,8,64 - GUIBox 0,9,229,9,65 - GUIBox 0,10,229,10,66 - GUIBox 0,11,229,11,67 - GUIBox 0,12,229,12,68 - GUIBox 0,13,229,13,69 - GUIBox 0,14,229,14,70 - GUIBox 0,15,229,15,71 - -%ifdef __UNIXSDL__ - GUIShadow 238,9,247,20 - GUIShadow 249,9,257,20 -%endif -%ifdef __WIN32__ - GUIShadow 238,9,247,14 - GUIShadow 238,16,247,20 - GUIShadow 249,9,257,20 -%endif -.notwinpressa - -%ifdef __UNIXSDL__ - mov byte[GUIMenuItem+36],247 - GUIDMHelpB 233,242,GUIMenuItem+36,1 - mov byte[GUIMenuItem+36],'x' - GUIDMHelpB 244,253,GUIMenuItem+36,2 -%endif - -%ifdef __WIN32__ - mov byte[GUIMenuItem+36],249 - GUIDMHelpB2 233,242,GUIMenuItem+36,1 - mov byte[GUIMenuItem+36],248 - GUIDMHelpB3 233,242,GUIMenuItem+36,3 - mov byte[GUIMenuItem+36],'x' - GUIDMHelpB 244,253,GUIMenuItem+36,2 -%endif -.notwinpressb - - ; Display upper-left box - mov byte[GUIMenuItem+36],25 - GUIDMHelp 4,12,GUIMenuItem+6,1 - GUIOuttext 4+3,7,GUIMenuItem+36,44 - GUIOuttext 4+2,6,GUIMenuItem+36,62 - ; Display boxes - GUIDMHelp 17,47,GUIMenuItem,2 - GUIDMHelp 52,94,GUIMenuItem+7,3 - GUIDMHelp 99,135,GUIMenuItem+14,4 - GUIDMHelp 140,188,GUIMenuItem+21,5 - GUIDMHelp 193,223,GUIMenuItem+29,6 - - mov dword[GUIMenuL],0 - mov dword[GUIMenuR],0 - mov dword[GUIMenuD],0 - - ; format : x pos, y pos, #charx, #chary, name, xpos+2, xpos+5,22, - ; 19+#chary*10, length of top menu box - cmp byte[GUIcmenupos],1 - jne near .nomenu1 - GUIDrawMenuM 4,16,30,13,GUIPrevMenuData,6,9,22,149,8 ;19+13*10 - mov dword[GUICYLocPtr],MenuDat1 -.nomenu1 - cmp byte[GUIcmenupos],2 - jne near .nomenu2 - GUIDrawMenuM 17,16,10,9,GUIGameMenuData,19,22,22,109,30 ;19+9*10 - mov dword[GUICYLocPtr],MenuDat2 -.nomenu2 - cmp byte[GUIcmenupos],3 - jne near .nomenu3 - GUIDrawMenuM 52,16,8,11,GUIConfigMenuData,54,57,22,129,42 ;19+11*10 - mov dword[GUICYLocPtr],MenuDat3 -.nomenu3 - cmp byte[GUIcmenupos],4 - jne near .nomenu4 - GUIDrawMenuM 99,16,8,3,GUICheatMenuData,101,104,22,49,36 ;19+3*10 - mov dword[GUICYLocPtr],MenuDat4 -.nomenu4 - cmp byte[GUIcmenupos],5 - jne near .nomenu5 -%ifdef __MSDOS__ - GUIDrawMenuM 140,16,10,2,GUINetPlayMenuData,142,145,22,39,48 ;19+2*10 -%else - GUIDrawMenuM 140,16,10,1,GUINetPlayMenuData,142,145,22,29,48 ;19+1*10 -%endif - mov dword[GUICYLocPtr],MenuDat5 -.nomenu5 - cmp byte[GUIcmenupos],6 - jne near .nomenu6 - GUIDrawMenuM 193,16,9,7,GUIMiscMenuData,195,198,22,89,30 ;19+5*10 - mov dword[GUICYLocPtr],MenuDat6 -.nomenu6 - ret - -GUIMenuDisplay: - xor ebx,ebx -.next - mov al,[edi] - push ebx - push ecx - push esi - cmp al,0 - je near .notext - cmp al,2 - je .darktext - inc edi - mov byte[GUItextcolor],44 - cmp byte[GUIcrowpos],bl - je .nodrawshadow - push edi - push esi - add esi,289 - call GUIOutputString - pop esi - pop edi -.nodrawshadow - mov byte[GUItextcolor],63 - call GUIOutputString - inc edi - jmp .text -.darktext - inc edi - mov byte[GUItextcolor],42 - cmp byte[GUIcrowpos],bl - je .nodrawshadow2 - push edi - push esi - add esi,289 - call GUIOutputString - pop esi - pop edi -.nodrawshadow2 - mov byte[GUItextcolor],57 - call GUIOutputString - inc edi - jmp .text -.notext - add esi,4*288 - mov ecx,edx -.loop - mov byte[esi],45 - mov byte[esi-289],40 - mov byte[esi+289],42 - inc esi - dec ecx - jnz .loop - add edi,14 -.text - pop esi - pop ecx - pop ebx - add esi,10*288 - inc ebx - dec ecx - jnz near .next - ret - -InitGUI: - cmp byte[newengen],0 - je .nong16b - cmp byte[cbitmode],0 - je .nong16b - call GetScreen -.nong16b -%ifdef __MSDOS__ - call DOSClearScreen -%endif - pushad - call Clear2xSaIBuffer - popad - call GUISetPal - call GUIBufferData - ret - -GUISetPal: - cmp byte[cbitmode],1 - je near GUISetPal16 - ; set palette - ; Fixed Color Scale = 0 .. 31 - mov dx,03C8h - mov al,0 - out dx,al - inc dx - out dx,al - out dx,al - out dx,al - - inc al - mov dx,03C8h - mov bl,1 - out dx,al - inc dx -.loopd - mov al,bl - add al,[GUIRAdd] - out dx,al - mov al,bl - add al,[GUIGAdd] - out dx,al - mov al,bl - add al,[GUIBAdd] - out dx,al - inc bl - cmp bl,32 - jne .loopd - ; gray scale = 32 .. 63 - mov dx,03C8h - mov bl,32 - mov al,32 - out dx,al - inc dx -.loopc - mov al,bl - add al,al - out dx,al - out dx,al - out dx,al - inc bl - cmp bl,64 - jne .loopc - ; shadow = 96 .. 127 - inc al - mov al,96 - mov dx,03C8h - mov bl,0 - out dx,al - inc dx -.loope - mov al,bl - add al,[GUIRAdd] - mov ah,al - add al,al - add al,ah - shr al,2 - out dx,al - mov al,bl - add al,[GUIGAdd] - mov ah,al - add al,al - add al,ah - shr al,2 - out dx,al - mov al,bl - add al,[GUIBAdd] - mov ah,al - add al,al - add al,ah - shr al,2 - out dx,al - inc bl - cmp bl,32 - jne .loope - - ; 0,10,31 - mov al,[GUITRAdd] - mov [TRVal],al - mov al,[GUITGAdd] - mov [TGVal],al - mov al,[GUITBAdd] - mov [TBVal],al - mov ax,[TRVal] - inc ax - shr ax,3 - mov [TRVali],ax - shl ax,3 - add [TRVal],ax - mov ax,[TGVal] - inc ax - shr ax,3 - mov [TGVali],ax - shl ax,3 - add [TGVal],ax - mov ax,[TBVal] - inc ax - shr ax,3 - mov [TBVali],ax - shl ax,3 - add [TBVal],ax - - GUIPal 64,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 65,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 66,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 67,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 68,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 69,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 70,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 71,[TRVal],[TGVal],[TBVal] - - GUIPal 72,40,0,20 - GUIPal 73,34,0,21 - - GUIPal 80,0,10,28 - GUIPal 81,0,10,27 - GUIPal 82,0,10,25 - GUIPal 83,0,09,24 - GUIPal 84,0,08,22 - GUIPal 85,0,07,20 - GUIPal 86,0,06,18 - GUIPal 87,0,05,15 - GUIPal 88,20,0,10 - GUIPal 89,17,0,10 - - ; Orange Scale - mov dx,03C8h - mov al,128 - mov cl,20 - out dx,al - mov bh,0 - mov ah,0 - inc dx -.loopf - add bh,2 - inc ah - mov al,63 - out dx,al - mov al,bh - out dx,al - mov al,ah - out dx,al - dec cl - jnz .loopf - - ; Blue scale = 148 .. 167 - mov al,[GUIWRAdd] - add al,al - mov [TRVal],al - mov al,[GUIWGAdd] - add al,al - mov [TGVal],al - mov al,[GUIWBAdd] - add al,al - mov [TBVal],al - mov byte[TRVali],4 - mov byte[TGVali],4 - mov byte[TBVali],4 - - GUIPal 152,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 151,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 150,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 149,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 148,[TRVal],[TGVal],[TBVal] - - mov al,[GUIWRAdd] - add al,al - mov [TRVal],al - mov al,[GUIWGAdd] - add al,al - mov [TGVal],al - mov al,[GUIWBAdd] - add al,al - mov [TBVal],al - mov byte[TRVali],4 - mov byte[TGVali],4 - mov byte[TBVali],4 - call DecPalVal - call DecPalVal - - GUIPal 157,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 156,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 155,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 154,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 153,[TRVal],[TGVal],[TBVal] - - mov al,[GUIWRAdd] - add al,al - mov [TRVal],al - mov al,[GUIWGAdd] - add al,al - mov [TGVal],al - mov al,[GUIWBAdd] - add al,al - mov [TBVal],al - mov byte[TRVali],4 - mov byte[TGVali],4 - mov byte[TBVali],4 - call DecPalVal - call DecPalVal - call DecPalVal - call DecPalVal - - GUIPal 162,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 161,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 160,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 159,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 158,[TRVal],[TGVal],[TBVal] - - GUIPal 163,40,40,00 - GUIPal 164,30,30,00 - GUIPal 165,50,00,00 - GUIPal 166,35,00,00 - GUIPal 167,00,00,00 - - ; Blue scale shadow - mov al,[GUIWRAdd] - mov [TRVal],al - mov al,[GUIWGAdd] - mov [TGVal],al - mov al,[GUIWBAdd] - mov [TBVal],al - mov byte[TRVali],2 - mov byte[TGVali],2 - mov byte[TBVali],2 - - GUIPal 172,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 171,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 170,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 169,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 168,[TRVal],[TGVal],[TBVal] - - mov al,[GUIWRAdd] - mov [TRVal],al - mov al,[GUIWGAdd] - mov [TGVal],al - mov al,[GUIWBAdd] - mov [TBVal],al - mov byte[TRVali],2 - mov byte[TGVali],2 - mov byte[TBVali],2 - call DecPalVal - call DecPalVal - - GUIPal 177,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 176,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 175,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 174,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 173,[TRVal],[TGVal],[TBVal] - - mov al,[GUIWRAdd] - mov [TRVal],al - mov al,[GUIWGAdd] - mov [TGVal],al - mov al,[GUIWBAdd] - mov [TBVal],al - mov byte[TRVali],2 - mov byte[TGVali],2 - mov byte[TBVali],2 - call DecPalVal - call DecPalVal - call DecPalVal - call DecPalVal - - GUIPal 182,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 181,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 180,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 179,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal 178,[TRVal],[TGVal],[TBVal] - - GUIPal 183,20,20,00 - GUIPal 184,15,15,00 - GUIPal 185,25,00,00 - GUIPal 186,17,00,00 - GUIPal 187,00,00,00 - - ; gray scale2 = 189 .. 220 - mov dx,03C8h - mov al,189 - mov bl,0 - out dx,al - inc dx -.loopi - mov al,bl - add al,al - mov ah,bl - shr ah,1 - sub al,ah - out dx,al - out dx,al - add al,ah - out dx,al - inc bl - cmp bl,64 - jne .loopi - - GUIPal 221,00,55,00 - GUIPal 222,00,45,00 - GUIPal 223,00,25,00 - - GUIPal 224,40,0,20 - GUIPal 225,32,0,15 - - GUIPal 226,20,0,10 - GUIPal 227,16,0,07 - - GUIPal 228,45,45,50 - GUIPal 229,40,40,45 - GUIPal 230,35,35,40 - GUIPal 231,30,30,35 - - GUIPal 232,35,15,15 - - GUIPal 233,50,12,60 - GUIPal 234,30,14,60 - - cmp byte[GUIPalConv],0 - je .convert - ret -.convert - mov byte[GUIPalConv],1 - - ; Convert Image data to Gray Scale - ; Create Palette Table - call GUIconvpal - ; Convert Current Image in Buffer - mov esi,[vidbuffer] - mov ecx,288*240 - xor eax,eax -.next - mov al,[esi] - mov bl,[SubPalTable+eax] - mov [esi],bl - inc esi - dec ecx - jnz .next - ret - -SECTION .bss -NEWSYM GUICPC, resw 256 -SECTION .text - -%macro GUIPal16b 4 - mov ax,%2 - shr ax,1 - shl ax,11 - mov bx,%3 - shl bx,5 - or ax,bx - mov bx,%4 - shr bx,1 - or ax,bx - mov [GUICPC+%1*2],ax -%endmacro - -DecPalVal: - mov ax,[TRVali] - sub word[TRVal],ax - mov ax,[TGVali] - sub word[TGVal],ax - mov ax,[TBVali] - sub word[TBVal],ax - test word[TRVal],8000h - jz .notnegr - mov word[TRVal],0 -.notnegr - test word[TGVal],8000h - jz .notnegg - mov word[TGVal],0 -.notnegg - test word[TBVal],8000h - jz .notnegb - mov word[TBVal],0 -.notnegb - ret - -GUISetPal16: - ; set palette - ; Fixed Color Scale = 0 .. 31 - mov word[GUICPC],0 - inc al - xor ebx,ebx - mov bl,1 -.loopd - xor ecx,ecx - mov cl,bl - add cl,[GUIRAdd] - shr cl,1 - shl ecx,11 - xor eax,eax - mov al,bl - add al,[GUIGAdd] - shl eax,5 - or ecx,eax - xor eax,eax - mov al,bl - add al,[GUIBAdd] - shr eax,1 - or ecx,eax - mov [GUICPC+ebx*2],cx - inc bl - cmp bl,32 - jne .loopd - - ; gray scale = 32 .. 63 - mov bl,32 - mov al,32 -.loopc - mov al,bl - add al,al - xor ecx,ecx - mov cl,al - shr ecx,1 - shl ecx,11 - xor edx,edx - mov dl,al - shl edx,5 - or ecx,edx - xor edx,edx - mov dl,al - shr edx,1 - or ecx,edx - mov [GUICPC+ebx*2],cx - inc bl - cmp bl,64 - jne .loopc - - ; shadow = 96 .. 127 - xor ebx,ebx -.loope - xor ecx,ecx - mov al,bl - add al,[GUIRAdd] - mov ah,al - add al,al - add al,ah - shr al,2 - shr al,1 - or cl,al - shl ecx,6 - mov al,bl - add al,[GUIGAdd] - mov ah,al - add al,al - add al,ah - shr al,2 - or cl,al - shl ecx,5 - mov al,bl - add al,[GUIBAdd] - mov ah,al - add al,al - add al,ah - shr al,2 - shr al,1 - or cl,al - mov [GUICPC+ebx*2+96*2],cx - inc bl - cmp bl,32 - jne .loope - - ; 0,10,31 - mov al,[GUITRAdd] - mov [TRVal],al - mov al,[GUITGAdd] - mov [TGVal],al - mov al,[GUITBAdd] - mov [TBVal],al - mov ax,[TRVal] - inc ax - shr ax,3 - mov [TRVali],ax - shl ax,3 - add [TRVal],ax - mov ax,[TGVal] - inc ax - shr ax,3 - mov [TGVali],ax - shl ax,3 - add [TGVal],ax - mov ax,[TBVal] - inc ax - shr ax,3 - mov [TBVali],ax - shl ax,3 - add [TBVal],ax - - GUIPal16b 64,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 65,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 66,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 67,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 68,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 69,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 70,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 71,[TRVal],[TGVal],[TBVal] - - GUIPal16b 72,40,0,20 - GUIPal16b 73,34,0,21 - - GUIPal16b 80,0,10,28 - GUIPal16b 81,0,10,27 - GUIPal16b 82,0,10,25 - GUIPal16b 83,0,09,24 - GUIPal16b 84,0,08,22 - GUIPal16b 85,0,07,20 - GUIPal16b 86,0,06,18 - GUIPal16b 87,0,05,15 - GUIPal16b 88,20,0,10 - GUIPal16b 89,17,0,10 - - ; Orange Scale - mov cl,20 - mov bh,0 - mov ah,0 - inc dx - mov esi,128 -.loopf - add bh,2 - inc ah - mov edx,1Fh << 6 - or dl,bh - shl edx,5 - mov al,ah - shr al,1 - or dl,al - mov [GUICPC+esi*2],dx - inc esi - dec cl - jnz .loopf - - ; Blue scale = 148 .. 167 - mov al,[GUIWRAdd] - add al,al - mov [TRVal],al - mov al,[GUIWGAdd] - add al,al - mov [TGVal],al - mov al,[GUIWBAdd] - add al,al - mov [TBVal],al - mov byte[TRVali],4 - mov byte[TGVali],4 - mov byte[TBVali],4 - - GUIPal16b 152,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 151,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 150,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 149,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 148,[TRVal],[TGVal],[TBVal] - - mov al,[GUIWRAdd] - add al,al - mov [TRVal],al - mov al,[GUIWGAdd] - add al,al - mov [TGVal],al - mov al,[GUIWBAdd] - add al,al - mov [TBVal],al - mov byte[TRVali],4 - mov byte[TGVali],4 - mov byte[TBVali],4 - mov al,[TRVal] - shr al,2 - sub [TRVal],al - mov al,[TGVal] - shr al,2 - sub [TGVal],al - mov al,[TBVal] - shr al,2 - sub [TBVal],al - - GUIPal16b 157,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 156,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 155,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 154,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 153,[TRVal],[TGVal],[TBVal] - - mov al,[GUIWRAdd] - add al,al - mov [TRVal],al - mov al,[GUIWGAdd] - add al,al - mov [TGVal],al - mov al,[GUIWBAdd] - add al,al - mov [TBVal],al - mov byte[TRVali],4 - mov byte[TGVali],4 - mov byte[TBVali],4 - mov al,[TRVal] - shr al,1 - sub [TRVal],al - mov al,[TGVal] - shr al,1 - sub [TGVal],al - mov al,[TBVal] - shr al,1 - sub [TBVal],al - - GUIPal16b 162,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 161,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 160,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 159,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 158,[TRVal],[TGVal],[TBVal] - - GUIPal16b 163,40,40,00 - GUIPal16b 164,30,30,00 - GUIPal16b 165,50,00,00 - GUIPal16b 166,35,00,00 - GUIPal16b 167,00,00,00 - - ; Blue scale shadow - mov al,[GUIWRAdd] - mov [TRVal],al - mov al,[GUIWGAdd] - mov [TGVal],al - mov al,[GUIWBAdd] - mov [TBVal],al - mov byte[TRVali],2 - mov byte[TGVali],2 - mov byte[TBVali],2 - - GUIPal16b 172,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 171,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 170,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 169,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 168,[TRVal],[TGVal],[TBVal] - - mov al,[GUIWRAdd] - mov [TRVal],al - mov al,[GUIWGAdd] - mov [TGVal],al - mov al,[GUIWBAdd] - mov [TBVal],al - mov byte[TRVali],2 - mov byte[TGVali],2 - mov byte[TBVali],2 - call DecPalVal - call DecPalVal - - GUIPal16b 177,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 176,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 175,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 174,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 173,[TRVal],[TGVal],[TBVal] - - mov al,[GUIWRAdd] - mov [TRVal],al - mov al,[GUIWGAdd] - mov [TGVal],al - mov al,[GUIWBAdd] - mov [TBVal],al - mov byte[TRVali],2 - mov byte[TGVali],2 - mov byte[TBVali],2 - call DecPalVal - call DecPalVal - call DecPalVal - call DecPalVal - - GUIPal16b 182,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 181,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 180,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 179,[TRVal],[TGVal],[TBVal] - call DecPalVal - GUIPal16b 178,[TRVal],[TGVal],[TBVal] - - GUIPal16b 183,20,20,00 - GUIPal16b 184,15,15,00 - GUIPal16b 185,25,00,00 - GUIPal16b 186,17,00,00 - GUIPal16b 187,00,00,00 - - ; gray scale2 = 189 .. 220 - mov bl,0 - mov esi,189 -.loopi - xor edx,edx - mov al,bl - add al,al - mov ah,bl - shr ah,1 - sub al,ah - mov dl,al - shr dl,1 - shl edx,6 - or dl,al - shl edx,5 - add al,ah - shr al,1 - or dl,al - mov [GUICPC+esi*2],dx - inc esi - inc bl - cmp bl,64 - jne .loopi - - GUIPal16b 221,00,55,00 - GUIPal16b 222,00,45,00 - GUIPal16b 223,00,25,00 - - GUIPal16b 224,40,0,20 - GUIPal16b 225,32,0,15 - - GUIPal16b 226,20,0,10 - GUIPal16b 227,16,0,07 - - GUIPal16b 228,45,45,50 - GUIPal16b 229,40,40,45 - GUIPal16b 230,35,35,40 - GUIPal16b 231,30,30,35 - - GUIPal16b 232,35,15,15 - - GUIPal16b 233,50,12,60 - GUIPal16b 234,30,14,60 - GUIPal16b 235,12,60,25 - GUIPal16b 236,14,42,25 - GUIPal16b 237,60,20,25 - GUIPal16b 238,42,20,25 - - cmp byte[GUIPalConv],0 - je .convert - ret -.convert - mov byte[GUIPalConv],1 - mov esi,[vidbuffer] - mov edi,288*240 - xor ebx,ebx -.next - mov ax,[esi+ebx*2] - mov ecx,eax - shr ecx,11 - and ecx,1Fh - mov edx,eax - shr edx,6 - and edx,1Fh - add ecx,edx - mov edx,eax - and edx,1Fh - add ecx,edx - shr ecx,1 - mov al,[.multab+ecx] - mov [esi+ebx],al - inc ebx - dec edi - jnz .next - ret - -SECTION .data -.multab db 1,1,1,2,2,3,4,4,5,6,6,7,8,8,9,10,10,11,12,12,13,14,14,15,16,16, - db 17,18,18,19,20,20,21,22,22,23,24,24,25,26,26,27,28,28,29,30,30,31 -SECTION .text - -GUIBufferData: - mov ecx,16384 - cmp byte[cbitmode],1 - jne near .16b - add ecx,16384 - cmp word[PrevResoln],224 - je .nobufb - add esi,288*8 -.nobufb -.16b - ; copy to spritetable - mov esi,[vidbuffer] - cmp word[PrevResoln],224 - je .nobufa - add esi,288*8 -.nobufa - mov edi,[spritetablea] - add edi,8*288 -.loop - mov eax,[esi] - mov [edi],eax - add esi,4 - add edi,4 - dec ecx - jnz .loop - mov edi,sprlefttot - mov ecx,64*5 -.a - mov dword[edi],0 - add edi,4 - dec ecx - jnz .a - ret - -GUIUnBuffer: - mov ecx,16384 - ; copy from spritetable - mov edi,[vidbuffer] - mov esi,[spritetablea] - add esi,8*288 - rep movsd - mov eax,01010101h - mov ecx,2*288 - rep stosd - ret - -GUIconvpal: - mov ax,[cgram] - mov [tempco0],ax - test byte[scaddtype],00100000b - jz near .noaddition - test byte[scaddtype],10000000b - jnz near .noaddition - mov cx,[cgram] - mov ax,cx - and ax,001Fh - add al,[coladdr] - cmp al,01Fh - jb .noadd - mov al,01Fh -.noadd - mov bx,ax - mov ax,cx - shr ax,5 - and ax,001Fh - add al,[coladdg] - cmp al,01Fh - jb .noaddb - mov al,01Fh -.noaddb - shl ax,5 - add bx,ax - mov ax,cx - shr ax,10 - and ax,001Fh - add al,[coladdb] - cmp al,01Fh - jb .noaddc - mov al,01Fh -.noaddc - shl ax,10 - add bx,ax - mov [cgram],bx -.noaddition - mov edi,cgram - mov ebx,prevpal - xor ah,ah -.loopa - mov cx,[edi] - push eax - push ebx - mov [ebx],cx - mov al,ah - mov ax,cx - and al,01Fh - mov bh,[maxbr] - mov bl,bh - mul bl - mov bl,15 - div bl - mov [curgsval],al - mov ax,cx - shr ax,5 - and al,01Fh - mov bl,bh - mul bl - mov bl,15 - div bl - add [curgsval],al - mov ax,cx - shr ax,10 - and al,01Fh - mov bl,bh - mul bl - mov bl,15 - div bl - add [curgsval],al - pop ebx - pop eax - add edi,2 - add ebx,2 - push eax - push ebx - mov al,ah - and eax,0FFh - mov bl,[curgsval] - push eax - push ebx - mov al,bl - mov bl,3 - xor ah,ah - div bl - pop ebx - mov bl,al - pop eax - cmp byte[MessageOn],0 - je .nochange128 - cmp al,128 - jne .nochange128 - mov bl,31 -.nochange128 - or bl,bl - jnz .noadder - inc bl -.noadder - mov [SubPalTable+eax],bl - pop ebx - pop eax - inc ah - jnz near .loopa - mov al,[maxbr] - mov [prevbright],al - mov ax,[tempco0] - mov [cgram],ax - ret - -convertnum: - ; process through each digit - push edx - push eax - push ebx - push cx - xor edx,edx ; clear high byte - xor cx,cx ; clear counter variable - mov ebx,10 -.loopa - div ebx ; get quotent and remainder - push edx ; store number to stack - inc cl - xor edx,edx - test eax,0FFFFFFFFh - jnz .loopa -.loopb - pop edx ; get number back from stack - add dl,30h ; adjust to ASCII value - mov [esi],dl - inc esi - dec cl - jnz .loopb - pop cx - pop ebx - pop eax - pop edx - mov byte[esi],0 - ret - -; eax = value, ecx = # of bytes -converthex: - mov ebx,ecx - mov ecx,4 - sub ecx,ebx - shl ecx,3 - shl eax,cl - mov ecx,ebx - xor ebx,ebx - add ecx,ecx -.loopb - mov ebx,eax - and ebx,0F0000000h - shr ebx,28 - mov dl,[.hexdat+ebx] - mov [esi],dl - inc esi - shl eax,4 - dec ecx - jnz .loopb - mov byte[esi],0 - ret - -SECTION .data -.hexdat db '0123456789ABCDEF' -GUIMousePtr: - db 50,47,45,43,40,0 ,0 ,0 - db 53,52,46,42,0 ,0 ,0 ,0 - db 55,54,54,44,0 ,0 ,0 ,0 - db 57,57,56,52,45,0 ,0 ,0 - db 59,0 ,0 ,55,50,45,0 ,0 - db 0 ,0 ,0 ,0 ,55,50,45,0 - db 0 ,0 ,0 ,0 ,0 ,55,50,47 - db 0 ,0 ,0 ,0 ,0 ,0 ,52,0 - -NEWSYM GUIFontData -; bitmap 5x5 font; char - offset for ASCII2Font - db 0,0,0,0,0; empty space 0x0 - db 01110000b,10011000b,10101000b,11001000b,01110000b; 0 0x01 - db 00100000b,01100000b,00100000b,00100000b,01110000b; 1 0x02 - db 01110000b,10001000b,00110000b,01000000b,11111000b; 2 0x03 - db 01110000b,10001000b,00110000b,10001000b,01110000b; 3 0x04 - db 01010000b,10010000b,11111000b,00010000b,00010000b; 4 0x05 - db 11111000b,10000000b,11110000b,00001000b,11110000b; 5 0x06 - db 01110000b,10000000b,11110000b,10001000b,01110000b; 6 0x07 - db 11111000b,00001000b,00010000b,00010000b,00010000b; 7 0x08 - db 01110000b,10001000b,01110000b,10001000b,01110000b; 8 0x09 - db 01110000b,10001000b,01111000b,00001000b,01110000b; 9 0x0A - db 01110000b,10001000b,11111000b,10001000b,10001000b; A 0x0B - db 11110000b,10001000b,11110000b,10001000b,11110000b; B 0x0C - db 01110000b,10001000b,10000000b,10001000b,01110000b; C 0x0D - db 11110000b,10001000b,10001000b,10001000b,11110000b; D 0x0E - db 11111000b,10000000b,11110000b,10000000b,11111000b; E 0x0F - db 11111000b,10000000b,11110000b,10000000b,10000000b; F 0x10 - db 01111000b,10000000b,10011000b,10001000b,01110000b; G 0x11 - db 10001000b,10001000b,11111000b,10001000b,10001000b; H 0x12 - db 11111000b,00100000b,00100000b,00100000b,11111000b; I 0x13 - db 01111000b,00010000b,00010000b,10010000b,01100000b; J 0x14 - db 10010000b,10100000b,11100000b,10010000b,10001000b; K 0x15 - db 10000000b,10000000b,10000000b,10000000b,11111000b; L 0x16 - db 11011000b,10101000b,10101000b,10101000b,10001000b; M 0x17 - db 11001000b,10101000b,10101000b,10101000b,10011000b; N 0x18 - db 01110000b,10001000b,10001000b,10001000b,01110000b; O 0x19 - db 11110000b,10001000b,11110000b,10000000b,10000000b; P 0x1A - db 01110000b,10001000b,10101000b,10010000b,01101000b; Q 0x1B - db 11110000b,10001000b,11110000b,10010000b,10001000b; R 0x1C - db 01111000b,10000000b,01110000b,00001000b,11110000b; S 0x1D - db 11111000b,00100000b,00100000b,00100000b,00100000b; T 0x1E - db 10001000b,10001000b,10001000b,10001000b,01110000b; U 0x1F - db 10001000b,10001000b,01010000b,01010000b,00100000b; V 0x20 - db 10001000b,10101000b,10101000b,10101000b,01010000b; W 0x21 - db 10001000b,01010000b,00100000b,01010000b,10001000b; X 0x22 - db 10001000b,01010000b,00100000b,00100000b,00100000b; Y 0x23 - db 11111000b,00010000b,00100000b,01000000b,11111000b; Z 0x24 - db 00000000b,00000000b,11111000b,00000000b,00000000b; - 0x25 - db 00000000b,00000000b,00000000b,00000000b,11111000b; _ 0x26 - db 01101000b,10010000b,00000000b,00000000b,00000000b; ~ 0x27 - db 00000000b,00000000b,00000000b,00000000b,00100000b; . 0x28 - db 00001000b,00010000b,00100000b,01000000b,10000000b; / 0x29 - db 00010000b,00100000b,01000000b,00100000b,00010000b; < 0x2A - db 01000000b,00100000b,00010000b,00100000b,01000000b; > 0x2B - db 01110000b,01000000b,01000000b,01000000b,01110000b; [ 0x2C - db 01110000b,00010000b,00010000b,00010000b,01110000b; ] 0x2D - db 00000000b,00100000b,00000000b,00100000b,00000000b; : 0x2E - db 01100000b,10011000b,01110000b,10011000b,01101000b; & 0x2F - db 00100000b,00100000b,10101000b,01110000b,00100000b; arrow down 0x30 - db 01010000b,11111000b,01010000b,11111000b,01010000b; # 0x31 - db 00000000b,11111000b,00000000b,11111000b,00000000b; = 0x32 - db 01001000b,10010000b,00000000b,00000000b,00000000b; " 0x33 - db 10000000b,01000000b,00100000b,00010000b,00001000b; \ 0x34 - db 10101000b,01110000b,11111000b,01110000b,10101000b; * 0x35 - db 01110000b,10001000b,00110000b,00000000b,00100000b; ? 0x36 - db 10001000b,00010000b,00100000b,01000000b,10001000b; % 0x37 - db 00100000b,00100000b,11111000b,00100000b,00100000b; + 0x38 - db 00000000b,00000000b,00000000b,00100000b,01000000b; , 0x39 - db 00110000b,01000000b,01000000b,01000000b,00110000b; ( 0x3A - db 01100000b,00010000b,00010000b,00010000b,01100000b; ) 0x3B - db 01110000b,10011000b,10111000b,10000000b,01110000b; @ 0x3C - db 00100000b,01000000b,00000000b,00000000b,00000000b; ' 0x3D - db 00100000b,00100000b,00100000b,00000000b,00100000b; ! 0x3E - db 01111000b,10100000b,01110000b,00101000b,11110000b; $ 0x3F - db 00000000b,00100000b,00000000b,00100000b,01000000b; ; 0x40 - db 01000000b,00100000b,00000000b,00000000b,00000000b; ` 0x41 - db 00100000b,01010000b,00000000b,00000000b,00000000b; ^ 0x42 - db 00110000b,01000000b,11000000b,01000000b,00110000b; { 0x43 - db 01100000b,00010000b,00011000b,00010000b,01100000b; } 0x44 - db 00100000b,00100000b,01110000b,01110000b,11111000b; up 0x45 - db 11111000b,01110000b,01110000b,00100000b,00100000b; down 0x46 - db 00001000b,00111000b,11111000b,00111000b,00001000b; left 0x47 - db 10000000b,11100000b,11111000b,11100000b,10000000b; right 0x48 - db 00100000b,01100000b,11111000b,01100000b,00100000b; arrow left 0x49 - db 00111000b,00100000b,00110000b,00001000b,10110000b; .5 0x4A - db 11111100b,10000100b,11111100b,00000000b,00000000b; maximize (Win) 0x4B - db 00000000b,11111100b,00000000b,00000000b,00000000b; minimize (Win) 0x4C - db 11111000b,10001000b,10001000b,10001000b,11111000b; maximize (SDL) 0x4D - db 00000000b,00000000b,00100000b,01010000b,00100000b; shw fullstop 0x4E - db 01110000b,01000000b,01000000b,01000000b,00000000b; shw left bracket 0x4F - db 00000000b,00010000b,00010000b,00010000b,01110000b; shw right bracket 0x50 - db 00000000b,00000000b,00000000b,01000000b,00100000b; shw comma 0x51 - db 00000000b,00100000b,01110000b,00100000b,00000000b; shw mid-dot 0x52 - db 11111000b,00001000b,11110000b,00100000b,11000000b; shw wo 0x53 - db 00000000b,11111000b,01010000b,01100000b,01000000b; shw mini a 0x54 - db 00000000b,00010000b,00100000b,11100000b,00100000b; shw mini i 0x55 - db 00000000b,00100000b,11111000b,10001000b,00110000b; shw mini u 0x56 - db 00000000b,00000000b,11111000b,00100000b,11111000b; shw mini e 0x57 - db 00000000b,00010000b,11111000b,00110000b,11010000b; shw mini o 0x58 - db 00000000b,01000000b,11111000b,01010000b,01000000b; shw mini ya 0x59 - db 00000000b,00000000b,11110000b,00010000b,11111000b; shw mini yu 0x5A - db 00000000b,11111000b,00001000b,01111000b,11111000b; shw mini yo 0x5B - db 00000000b,10101000b,10101000b,00010000b,01100000b; shw mini tsu 0x5C - db 00000000b,10000000b,01111000b,00000000b,00000000b; shw prolong 0x5D - db 11111000b,00101000b,00110000b,00100000b,11000000b; shw a 0x5E - db 00001000b,00110000b,11100000b,00100000b,00100000b; shw i 0x5F - db 00100000b,11111000b,10001000b,00010000b,01100000b; shw u 0x60 - db 11111000b,00100000b,00100000b,00100000b,11111000b; shw e 0x61 - db 00010000b,11111000b,00110000b,01010000b,10010000b; shw o 0x62 - db 01000000b,11111000b,01001000b,01001000b,10011000b; shw ka 0x63 - db 00100000b,11111000b,00100000b,11111000b,00100000b; shw ki 0x64 - db 01000000b,01111000b,10001000b,00010000b,01100000b; shw ku 0x65 - db 01000000b,01111000b,10010000b,00010000b,01100000b; shw ke 0x66 ^^ - db 11111000b,00001000b,00001000b,00001000b,11111000b; shw ko 0x67 - db 01010000b,11111000b,01010000b,00010000b,01100000b; shw sa 0x68 - db 01000000b,10101000b,01001000b,00010000b,11100000b; shw shi 0x69 - db 11111000b,00001000b,00010000b,00110000b,11001000b; shw su 0x6A - db 01000000b,11111000b,01010000b,01000000b,00111000b; shw se 0x6B - db 10001000b,01001000b,00001000b,00010000b,01100000b; shw so 0x6C - db 01000000b,01111000b,11001000b,00110000b,01100000b; shw ta 0x6D - db 11111000b,00100000b,11111000b,00100000b,01000000b; shw chi 0x6E - db 10101000b,10101000b,00001000b,00010000b,01100000b; shw tsu 0x6F - db 11111000b,00000000b,11111000b,00100000b,11000000b; shw te 0x70 - db 01000000b,01000000b,01100000b,01010000b,01000000b; shw to 0x71 - db 00100000b,11111000b,00100000b,00100000b,01000000b; shw na 0x72 - db 11110000b,00000000b,00000000b,00000000b,11111000b; shw ni 0x73 - db 11111000b,00001000b,00101000b,00010000b,01101000b; shw nu 0x74 - db 00100000b,11111000b,00001000b,01110000b,10101000b; shw ne 0x75 - db 00001000b,00001000b,00001000b,00010000b,01100000b; shw no 0x76 - db 01010000b,01010000b,01010000b,10001000b,10001000b; shw ha 0x77 - db 10000000b,10011000b,11100000b,10000000b,01111000b; shw hi 0x78 - db 11111000b,00001000b,00001000b,00010000b,01100000b; shw hu 0x79 - db 01000000b,10100000b,10010000b,00001000b,00000000b; shw he 0x7A - db 00100000b,11111000b,01110000b,10101000b,00100000b; shw ho 0x7B - db 11111000b,00001000b,10010000b,01100000b,00100000b; shw ma 0x7C - db 11111000b,00000000b,11111000b,00000000b,11111000b; shw mi 0x7D - db 00100000b,01000000b,01000000b,10010000b,11111000b; shw mu 0x7E - db 00001000b,01001000b,00110000b,00110000b,11001000b; shw me 0x7F - db 11111000b,00100000b,11111000b,00100000b,00111000b; shw mo 0x80 - db 01000000b,11111100b,01001000b,00100000b,00100000b; shw ya 0x81 - db 11110000b,00010000b,00010000b,00010000b,11111000b; shw yu 0x82 - db 11111000b,00001000b,11111000b,00001000b,11111000b; shw yo 0x83 - db 11111000b,00000000b,11111000b,00010000b,01100000b; shw ra 0x84 - db 10001000b,10001000b,10001000b,00010000b,01100000b; shw ri 0x85 - db 01100000b,01100000b,01101000b,01101000b,10110000b; shw ru 0x86 - db 10000000b,10000000b,10001000b,10001000b,11110000b; shw re 0x87 - db 11111000b,10001000b,10001000b,10001000b,11111000b; shw ro 0x88 - db 11111000b,10001000b,00001000b,00010000b,01100000b; shw wa 0x89 - db 10000000b,01001000b,00001000b,00010000b,11100000b; shw n 0x8A - db 10100000b,10100000b,00000000b,00000000b,00000000b; shw voiced 0x8B - db 01000000b,10100000b,01000000b,00000000b,00000000b; shw halfvoiced 0x8C - -NEWSYM GUIFontData1, times 705 db 0 - -; 189 .. 220 -GUIIconDataClose: - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,216,216,216,216,216,216,216,0 ,0 - db 214,212,202,212,212,212,202,212,210,0 - db 214,212,212,200,212,200,212,212,210,202 - db 214,212,212,212,198,212,212,212,210,202 - db 214,212,212,196,212,196,212,212,210,200 - db 214,212,194,212,212,212,194,212,210,200 - db 0 ,208,208,208,208,208,208,208,198,198 - db 0 ,0 ,198,198,198,198,198,198,198,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - -GUIIconDataButtonHole: - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,207,205,207,0 ,0 ,0 ,0 - db 0 ,0 ,207,203,202,203,207,0 ,0 ,0 - db 0 ,207,203,200,198,200,203,207,0 ,0 - db 0 ,207,202,198,197,198,202,207,0 ,0 - db 0 ,207,203,200,198,200,203,207,0 ,0 - db 0 ,0 ,207,203,202,203,207,0 ,0 ,0 - db 0 ,0 ,0 ,207,205,207,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - -GUIIconDataButtonFill: - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,207,209,207,0 ,0 ,0 ,0 - db 0 ,0 ,207,211,212,211,207,0 ,0 ,0 - db 0 ,207,211,214,216,214,211,207,0 ,0 - db 0 ,207,212,216,217,216,212,207,0 ,0 - db 0 ,207,211,214,216,214,211,207,0 ,0 - db 0 ,0 ,207,211,212,211,207,0 ,0 ,0 - db 0 ,0 ,0 ,207,209,207,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - -GUIIconDataSlideBar: - db 0 ,0 ,0 ,0 ,216,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,212,216,220,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,212,216,220,202,0 ,0 ,0 - db 0 ,0 ,212,212,216,218,220,0 ,0 ,0 - db 0 ,0 ,212,214,216,218,220,202,0 ,0 - db 0 ,0 ,212,214,216,218,220,202,0 ,0 - db 0 ,0 ,0 ,212,216,220,202,202,0 ,0 - db 0 ,0 ,0 ,212,216,220,202,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,216,202,202,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,202,0 ,0 ,0 ,0 - -GUIIconDataCheckBoxUC: - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,220,219,218,217,216,215,0 ,0 ,0 - db 0 ,219,218,217,216,215,214,202,0 ,0 - db 0 ,218,217,216,215,214,213,202,0 ,0 - db 0 ,217,216,215,214,213,212,202,0 ,0 - db 0 ,216,215,214,213,212,211,202,0 ,0 - db 0 ,215,214,213,212,211,210,202,0 ,0 - db 0 ,0 ,202,202,202,202,202,202,0 ,0 - -GUIIconDataCheckBoxC: - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,165,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,165,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,165,0 ,0 ,0 - db 0 ,220,219,218,217,165,215,0 ,0 ,0 - db 0 ,165,165,217,165,165,214,202,0 ,0 - db 0 ,218,165,216,165,214,213,202,0 ,0 - db 0 ,217,165,165,165,213,212,202,0 ,0 - db 0 ,216,215,165,213,212,211,202,0 ,0 - db 0 ,215,214,165,212,211,210,202,0 ,0 - db 0 ,0 ,202,202,202,202,202,202,0 ,0 - -GUIIconDataUpArrow: - db 201,209,209,209,209,209,209,200,0 ,0 - db 207,205,205,202,203,205,205,203,0 ,0 - db 207,205,201,202,203,202,205,203,0 ,0 - db 207,200,205,202,203,205,201,203,0 ,0 - db 207,205,205,202,203,205,205,203,0 ,0 - db 207,205,205,202,203,205,205,203,0 ,0 - db 207,205,205,202,203,205,205,203,0 ,0 - db 199,201,201,201,201,201,201,198,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - -GUIIconDataDownArrow: - db 201,209,209,209,209,209,209,200,0 ,0 - db 207,205,205,202,203,205,205,203,0 ,0 - db 207,205,205,202,203,205,205,203,0 ,0 - db 207,205,205,202,203,205,205,203,0 ,0 - db 207,200,205,202,203,205,201,203,0 ,0 - db 207,205,201,202,203,202,205,203,0 ,0 - db 207,205,205,202,203,205,205,203,0 ,0 - db 199,201,201,201,201,201,201,198,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - -NEWSYM SnowData -dw 161,251,115,211,249,87,128,101,232,176,51,180,108,193,224,112,254,159,102,238 -dw 223,123,218,42,173,160,143,170,64,1,174,29,34,187,194,199,40,89,232,32 -dw 7,195,141,67,216,48,234,1,243,116,164,182,146,136,66,70,36,43,98,208 -dw 63,240,216,253,147,36,33,253,98,80,228,156,73,82,85,1,97,72,187,239 -dw 18,196,127,182,22,22,101,25,124,145,240,213,186,22,7,161,30,98,90,197 -dw 22,205,32,150,59,133,49,140,10,128,142,185,176,142,220,195,100,102,105,194 -dw 43,139,184,153,1,95,176,169,192,201,233,243,73,65,188,14,194,39,251,140 -dw 239,181,142,160,242,248,82,49,9,157,233,162,254,121,112,6,118,24,56,121 -dw 74,209,1,223,145,6,75,73,18,168,194,168,58,39,222,170,214,75,45,218 -dw 39,197,242,98,22,90,255,5,144,244,252,55,98,18,135,101,27,85,215,207 -dw 183,28,201,142,45,122,145,159,41,243,109,29,117,203,7,234,231,214,131,133 -dw 217,8,74,207,130,77,21,229,167,78,218,109,142,58,134,238,29,182,178,14 -dw 144,129,196,219,60,128,30,105,57,53,76,122,242,208,101,241,246,99,248,67 -dw 137,244,70,51,202,94,164,125,115,72,61,72,129,169,155,122,91,154,160,83 -dw 41,102,223,218,140,40,132,16,223,92,50,230,168,47,126,117,242,136,1,245 -dw 171,0,36,98,73,69,14,229,66,177,108,92,39,250,243,161,111,85,211,99 -dw 52,98,121,188,128,201,90,205,223,92,177,19,87,18,75,54,6,81,235,137 -dw 247,66,211,129,247,39,119,206,116,250,113,231,190,196,53,51,34,114,39,22 -dw 192,33,249,151,26,22,139,97,171,238,182,88,22,176,157,255,178,199,138,98 -dw 140,36,112,90,25,245,134,64,48,190,165,113,24,195,84,70,175,9,179,69 -dw 13,26,167,237,163,159,185,128,109,114,86,74,188,103,141,48,188,203,205,191 -dw 215,193,224,4,153,36,108,3,172,235,56,251,211,115,173,216,240,33,78,150 -dw 133,64,51,103,56,26,165,222,70,148,115,119,246,229,181,63,109,49,228,108 -dw 126,10,170,48,87,42,193,24,28,255,176,176,209,181,97,93,61,241,201,137 -dw 129,97,24,159,168,215,61,113,104,143,168,7,196,216,149,239,110,65,75,143 -dw 238,0,37,19,8,56,65,234,228,72,42,5,226,95,243,51,55,231,114,90 -dw 160,141,171,108,218,252,154,64,175,142,214,211,180,129,217,118,33,130,213,2 -dw 73,145,93,21,162,141,97,225,112,253,49,43,113,208,131,104,31,51,192,37 -dw 117,186,16,45,61,114,220,6,89,163,197,203,142,80,89,115,190,190,228,15 -dw 166,145,59,139,120,79,104,252,246,73,113,144,224,65,204,155,221,85,31,99 -dw 48,253,94,159,215,31,123,204,248,153,31,210,174,178,54,146,152,88,56,92 -dw 197,35,124,104,211,118,1,207,108,68,123,161,107,69,143,13,79,170,130,193 -dw 214,153,219,247,227,2,170,208,248,139,118,241,247,183,18,135,246,126,201,46 -dw 70,234,171,72,18,135,236,216,32,178,148,231,161,15,6,254,34,181,5,71 -dw 2,219,71,87,252,16,202,190,180,83,99,209,75,134,78,84,114,32,171,246 -dw 125,11,57,200,102,29,176,26,205,151,152,108,100,146,117,95,71,77,158,207 -dw 60,192,50,135,223,237,231,53,27,195,170,146,155,160,92,224,247,187,14,50 -dw 203,5,153,42,17,75,109,14,78,160,236,114,131,105,189,209,233,135,221,207 -dw 226,119,104,10,178,107,77,160,233,179,120,227,133,241,32,223,63,247,66,157 -dw 140,81,118,81,63,193,173,228,214,78,124,123,222,149,9,242,0,128,194,110 - -NEWSYM SnowVelDist -db 57,92,100,19,100,184,238,225,55,240,255,221,215,105,226,153,164,41,22,93 -db 176,203,155,199,244,52,233,219,110,227,229,227,152,240,83,248,226,31,163,22 -db 28,156,18,10,248,67,123,167,25,138,90,10,79,107,208,229,248,233,185,10 -db 167,21,19,178,132,154,81,70,20,71,95,147,72,27,91,189,13,189,102,84 -db 195,123,251,93,68,36,178,59,107,99,104,191,76,110,44,206,123,46,98,112 -db 26,50,1,35,150,17,242,208,69,23,202,197,59,80,136,124,40,89,11,40 -db 1,136,90,72,198,83,2,174,174,4,28,205,135,35,194,54,22,40,4,132 -db 191,88,163,66,204,230,35,111,9,177,254,174,163,68,5,88,111,235,58,236 -db 4,248,172,154,101,164,43,223,10,13,210,125,146,73,192,57,117,152,128,36 -db 106,21,253,113,110,133,244,4,150,32,76,71,22,106,210,244,46,128,27,215 -db 231,112,177,196,198,120,196,57,234,74,235,108,64,181,209,188,177,63,197,200 -db 126,164,136,163,48,62,225,223,212,201,195,121,90,7,10,196,88,53,39,249 -db 147,98,65,253,246,3,152,125,242,105,44,129,94,232,13,4,86,220,194,67 -db 186,210,171,197,64,138,89,78,58,150,52,79,138,201,244,111,106,181,192,69 -db 234,253,239,113,98,37,209,151,60,47,241,235,185,52,173,94,172,182,47,150 -db 80,118,10,58,161,237,10,64,238,198,14,74,132,250,234,63,169,86,158,170 -db 76,168,124,133,28,203,246,140,228,77,50,53,115,113,157,218,90,192,28,209 -db 72,117,156,101,226,99,11,245,69,59,17,175,164,59,8,166,163,185,10,60 -db 100,19,26,38,114,232,180,115,238,184,88,103,178,67,212,21,87,64,85,1 -db 62,87,155,62,21,96,205,195,131,97,191,252,218,209,179,201,12,2,234,110 -db 162,14,145,170,156,105,85,132,132,60,239,14,80,129,225,144,149,244,188,8 -db 13,168,181,168,30,142,24,110,26,172,231,182,50,214,66,193,100,45,132,144 -db 205,190,16,133,45,250,83,183,140,229,117,226,68,59,163,96,235,227,25,155 -db 209,105,41,214,30,107,2,85,180,23,241,39,113,63,75,44,107,142,93,29 -db 62,240,235,152,147,52,54,146,109,112,139,162,238,198,201,8,141,115,112,106 -db 4,99,25,155,111,161,114,253,75,100,28,59,101,150,2,122,228,6,12,59 -db 249,181,67,136,227,227,199,46,75,203,50,25,50,61,62,22,238,124,218,134 -db 243,21,243,222,94,138,161,234,133,23,138,45,4,226,154,227,8,84,105,126 -db 200,127,240,144,124,197,102,144,53,29,94,231,108,175,136,37,44,183,178,95 -db 41,196,214,12,42,221,106,225,151,32,53,130,24,211,88,14,135,18,90,219 -db 177,129,90,217,162,181,199,133,116,56,36,100,230,91,220,83,41,65,20,64 -db 177,197,249,24,242,62,26,234,92,44,167,153,243,94,179,163,103,29,220,199 -db 128,94,236,152,53,32,77,78,228,89,124,85,87,50,197,116,179,105,236,139 -db 102,17,159,66,176,27,205,36,113,80,60,6,61,174,254,174,246,72,154,31 -db 97,40,10,8,114,203,238,26,89,51,134,110,118,176,87,32,192,210,146,207 -db 88,45,156,179,61,224,87,107,107,1,252,187,203,100,169,211,205,105,12,231 -db 137,176,166,37,192,241,169,84,32,85,112,168,154,7,247,146,183,225,246,173 -db 57,103,110,236,113,118,203,200,22,87,251,7,138,37,12,84,221,171,51,209 -db 242,37,89,73,151,162,139,189,131,209,221,96,107,144,175,79,199,123,98,138 -db 226,86,221,254,72,14,126,180,200,171,85,94,120,124,196,225,150,57,219,158 diff --git a/tools/zsnes/src/gui/guicheat.inc b/tools/zsnes/src/gui/guicheat.inc deleted file mode 100644 index 32b43cd..0000000 --- a/tools/zsnes/src/gui/guicheat.inc +++ /dev/null @@ -1,1165 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - -SECTION .text - -; GUI Cheat Code Routines - -AddCSCheatCode: - cmp byte[CSInputDisplay],'_' - je .nodisplay - jmp .okay -.nodisplay - ret -.okay - mov eax,[curentryval] - mov [curaddrvalcs],eax - mov eax,[CSCurValue] - mov [curvaluecs],eax - xor ecx,ecx - mov cl,[CheatSrcByteSize] - inc cl - cmp byte[CheatUpperByteOnly],0 - je .cspardisploop - mov cl,1 -.cspardispagain - cmp dword[curvaluecs],0FFh - jbe .cspardisploop - shr dword[curvaluecs],8 - inc dword[curaddrvalcs] - jmp .cspardispagain -.cspardisploop - push ecx - mov esi,GUICSrcTextG1 - mov ecx,3 - mov eax,[curaddrvalcs] - add eax,7E0000h - mov bl,[curvaluecs] - ; write bl at address eax - call AddCheatCode - - shr dword[curvaluecs],8 - mov byte[GUItextcolor],223 - - add dword[CheatSearchYPos],10 - inc dword[curaddrvalcs] - pop ecx - dec ecx - jnz near .cspardisploop - mov byte[CheatWinMode],2 - ret - -%macro SearchCMPByte 0 - mov bl,[edi] - cmp bl,[esi] -%endmacro - -%macro SearchCMP2Bytes 0 - mov bx,[edi] - cmp bx,[esi] -%endmacro - -%macro SearchCMP3Bytes 0 - push ecx - mov ebx,[edi] - mov ecx,[esi] - and ebx,0FFFFFFh - and ecx,0FFFFFFh - cmp ebx,ecx - pop ecx -%endmacro - -%macro SearchCMP4Bytes 0 - mov ebx,[edi] - cmp ebx,[esi] -%endmacro - -%macro SearchMacro 2 - mov dl,0FEh -%%searchloop - %2 - %1 %%nofail - and [eax],dl -%%nofail - inc edi - inc esi - cmp dl,7Fh - jne %%noinceax - inc eax -%%noinceax - rol dl,1 -; loop %%searchloop - dec ecx - jnz %%searchloop -%endmacro - -%macro SearchMacroB 1 - cmp byte[CheatCompareValue],0 - je near %%greater - cmp byte[CheatCompareValue],1 - je near %%lessthan - cmp byte[CheatCompareValue],3 - je near %%notequalthan - SearchMacro je, %1 - jmp .end -%%greater - SearchMacro ja, %1 - jmp .end -%%lessthan - SearchMacro jb, %1 - jmp .end -%%notequalthan - SearchMacro jne, %1 - jmp .end -%endmacro - -CheatCodeSearchProcess: - cmp byte[CheatSrcSearchType],1 - je near .comparative - cmp byte[CSInputDisplay],0 - je near .nodisplay - cmp byte[CSInputDisplay],'_' - je near .nodisplay - cmp byte[CSOverValue],1 - je near .nodisplay - mov byte[CSInputDisplay],'_' - mov byte[CSInputDisplay+1],0 - ; Process Cheat Search - mov ecx,65536*2 - xor ebx,ebx - mov bl,[CheatSrcByteSize] - sub ecx,ebx - mov edx,[SrcMask+ebx*4] - mov edi,[vidbuffer] - add edi,129600+65536*2 - mov esi,[wramdata] - mov bl,0FEh - mov bh,01h -.exactloop - mov eax,[esi] - and eax,edx - cmp eax,[CSCurValue] - je .found - inc eax - and eax,edx - cmp eax,[CSCurValue] - je .foundb -.failedfind - and [edi],bl - jmp .foundc -.found - test byte[edi+16384],bh - jz .failedfind - jmp .foundc -.foundb - cmp byte[FirstSearch],1 - je .clear - test byte[edi+16384],bh - jnz .failedfind - jmp .foundc -.clear - and byte[edi+16384],bl -.foundc - cmp bl,7Fh - jne .noincedi - inc edi -.noincedi - rol bl,1 - rol bh,1 - inc esi - dec ecx - jnz .exactloop - mov byte[CopyRamToggle],1 - mov byte[CheatSearchStatus],1 -.nodisplay - ret -.comparative - mov byte[CSInputDisplay],'_' - mov byte[CSInputDisplay+1],0 - mov byte[CheatSearchStatus],1 - mov eax,[vidbuffer] - add eax,129600+65536*2 - mov esi,[vidbuffer] - add esi,129600 - mov edi,[wramdata] - mov ecx,65536*2 - cmp byte[CheatSrcByteSize],1 - je near .bytesize2 - cmp byte[CheatSrcByteSize],2 - je near .bytesize3 - cmp byte[CheatSrcByteSize],3 - je near .bytesize4 - SearchMacroB SearchCMPByte -.bytesize2 - dec ecx - SearchMacroB SearchCMP2Bytes -.bytesize3 - sub ecx,2 - SearchMacroB SearchCMP3Bytes -.bytesize4 - sub ecx,3 - SearchMacroB SearchCMP4Bytes -.end - mov byte[CopyRamToggle],1 - ret - -SECTION .bss -CopyRamToggle resb 1 -FirstSearch resb 1 -SECTION .text - -CheatCodeSearchInit: - mov byte[CSInputDisplay],'_' - mov byte[CSInputDisplay+1],0 - mov byte[CheatWinMode],1 - mov byte[CheatSearchStatus],0 - mov byte[FirstSearch],1 - mov eax,[vidbuffer] - add eax,129600 - ; copy 128k ram - mov ebx,[wramdata] - mov ecx,32768 -.loop - mov edx,[ebx] - mov [eax],edx - add ebx,4 - add eax,4 - dec ecx - jnz .loop - ; fill searched buffer with 0xFF - mov eax,[vidbuffer] - add eax,129600+65536*2 - mov ecx,8192 -.loop2 - mov dword[eax],0FFFFFFFFh - add eax,4 - dec ecx - jnz .loop2 - cmp byte[CheatSrcSearchType],1 - jne .nottype1 - mov byte[CheatSearchStatus],1 -.nottype1 - mov dword[CheatCompareValue],0 - mov eax,[vidbuffer] - add eax,129600+65536*2 - cmp byte[CheatSrcByteSize],1 - je near .bytesize2 - cmp byte[CheatSrcByteSize],2 - je near .bytesize3 - cmp byte[CheatSrcByteSize],3 - je near .bytesize4 - ret -.bytesize2 - and byte[eax+16383],07Fh - ret -.bytesize3 - and byte[eax+16383],03Fh - ret -.bytesize4 - and byte[eax+16383],01Fh - ret - -NEWSYM DisableCheatsOnLoad - ; Disable all codes - mov esi,cheatdata - mov ecx,[NumCheats] - cmp ecx,0 - je .skip -.loop2 - test byte[esi],4 - jnz .disabled2 - push esi - push ecx - call DisableCheatCode - pop ecx - pop esi -.disabled2 - add esi,28 - dec ecx - jnz .loop2 -.skip - ret - -NEWSYM EnableCheatsOnLoad - ; Enable all ON toggled cheat codes - mov esi,cheatdata - mov ecx,[NumCheats] - cmp ecx,0 - je .skip2 -.loop - test byte[esi],4 - jnz .disabled - push esi - push ecx - call EnableCheatCode - pop ecx - pop esi -.disabled - add esi,28 - dec ecx - jnz .loop -.skip2 - ret - -CheatCodeRemove: - mov byte[GUICBHold],0 - cmp dword[NumCheats],0 - jne .nonone - ret -.nonone - mov esi,[GUIcurrentcheatcursloc] - shl esi,5 - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - add esi,cheatdata - push esi - call DisableCheatCode - pop esi - mov eax,255 - sub eax,[GUIcurrentcheatcursloc] - mov ebx,eax - shl eax,4 - add eax,ebx - add eax,ebx -.loop - mov bl,[esi+28] - mov [esi],bl - inc esi - dec eax - jnz .loop - dec dword[NumCheats] - mov eax,[GUIcurrentcheatcursloc] - cmp dword[NumCheats],0 - je .okay - cmp eax,[NumCheats] - jne .okay - dec eax - mov [GUIcurrentcheatcursloc],eax - sub eax,11 - mov [GUIcurrentcheatviewloc],eax - test dword[GUIcurrentcheatviewloc],80000000h - jz .noview - mov dword[GUIcurrentcheatviewloc],0 -.noview -.okay - cmp byte[NumCheats],0 - jne .cheatexists - mov byte[CheatOn],0 -.cheatexists - ret - -CheatCodeFix: - mov byte[GUICBHold],0 - cmp dword[NumCheats],0 - jne .nonone - ret -.nonone - mov esi,[GUIcurrentcheatcursloc] - shl esi,5 - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - add esi,cheatdata - push esi - call DisableCheatCode - pop esi - xor byte[esi+3],80h - call EnableCheatCodeNoPrevMod - ret - -CheatCodeToggle: - mov byte[GUICBHold],0 - cmp dword[NumCheats],0 - jne .nonone - ret -.nonone - mov esi,[GUIcurrentcheatcursloc] - shl esi,5 - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - add esi,cheatdata - test byte[esi],4 - jz DisableCheatCode - jmp EnableCheatCodeNoPrevMod - -DisableCheatCode: - ; code is at esi - xor ecx,ecx - xor ebx,ebx - or byte[esi],4 - test byte[esi],1 - jnz .gfrom - mov al,[esi+5] - mov cx,[esi+2] - mov bl,[esi+4] - mov byte[writeon],1 - test byte[esi],80h - jnz .nowrite - test byte[esi-28],80h - jnz .nowrite - call dword near [memtablew8+ebx*4] -.nowrite - mov byte[writeon],0 - ret -.gfrom - mov al,[esi+5] - mov ecx,[esi+2] - and ecx,0FFFFFFh - mov esi,[romdata] - mov [esi+ecx],al - ret -.gfram - mov al,[esi+5] - mov ecx,[esi+2] - and ecx,0FFFFFFh - mov esi,[sram] - mov [esi+ecx],al - ret - -EnableCheatCode: - ; code is at esi - xor ecx,ecx - xor ebx,ebx - and byte[esi],0FBh - test byte[esi],1 - jnz .gfrom - mov al,[esi+1] - mov cx,[esi+2] - mov bl,[esi+4] - push ecx - push eax - push ebx - push edx - call dword near [memtabler8+ebx*4] - pop edx - mov [esi+5],al - pop ebx - pop eax - pop ecx - mov byte[writeon],1 - test byte[esi],80h - jnz .nowrite - test byte[esi-28],80h - jnz .nowrite - call dword near [memtablew8+ebx*4] -.nowrite - mov byte[writeon],0 - ret -.gfrom - mov al,[esi+1] - mov ecx,[esi+2] - and ecx,0FFFFFFh - mov esi,[romdata] - mov bl,[esi+ecx] - mov [esi+ecx],al - mov [esi+5],bl - ret -.gfram - mov al,[esi+1] - mov ecx,[esi+2] - and ecx,0FFFFFFh - mov esi,[sram] - mov bl,[esi+ecx] - mov [esi+ecx],al - mov [esi+5],bl - ret - -EnableCheatCodeNoPrevMod: - ; code is at esi - xor ecx,ecx - xor ebx,ebx - and byte[esi],0FBh - test byte[esi],1 - jnz .gfrom - mov al,[esi+1] - mov cx,[esi+2] - mov bl,[esi+4] - mov byte[writeon],1 - test byte[esi],80h - jnz .nowrite - test byte[esi-28],80h - jnz .nowrite - call dword near [memtablew8+ebx*4] -.nowrite - mov byte[writeon],0 - ret -.gfrom - mov al,[esi+1] - mov ecx,[esi+2] - and ecx,0FFFFFFh - mov esi,[romdata] - mov bl,[esi+ecx] - mov [esi+ecx],al - mov [esi+5],bl - ret -.gfram - mov al,[esi+1] - mov ecx,[esi+2] - and ecx,0FFFFFFh - mov esi,[sram] - mov bl,[esi+ecx] - mov [esi+ecx],al - mov [esi+5],bl - ret - -AddCheatCode: - mov byte[GUICBHold],0 - cmp dword[NumCheats],255 - jne .okay - ret -.okay - push eax - push ebx - ; transfer description - mov eax,[NumCheats] - shl eax,5 - sub eax,[NumCheats] - sub eax,[NumCheats] - sub eax,[NumCheats] - sub eax,[NumCheats] - add eax,cheatdata - mov edx,eax - push edx - add eax,6 - mov ebx,CSDescDisplay - mov ecx,20 -.dloop - mov dl,[ebx] - mov [eax+2],dl - mov [eax+18+2],dl - mov [eax+18*2+2],dl - inc ebx - inc eax - dec ecx - jnz .dloop - pop edx - pop ebx - pop eax - ; toggle, value, address, pvalue, name(12) - mov byte[edx],0 - mov [edx+1],bl - push eax - sub eax,7E0000h - add eax,[wramdata] - mov bh,[eax] - mov [eax],bl - pop eax - mov [edx+2],eax - mov [edx+5],bh - inc dword[NumCheats] - mov edx,7 - mov al,[GUIpmenupos] - push eax - call CheckMenuItemHelp - pop eax - mov [GUIpmenupos],al - mov byte[CheatOn],1 - ret - -ProcessCheatCode: - mov byte[GUICBHold],0 - cmp dword[NumCheats],255 - je .fail - cmp byte[GUICheatPosA],0 - je .fail - jmp .okay -.fail - ret -.okay - ; make sure flashing cursor doesn't exist - xor ebx,ebx - mov bl,[GUICheatPosB] - mov byte[GUICheatTextZ2+ebx],0 - ; transfer description - mov eax,[NumCheats] - shl eax,5 - sub eax,[NumCheats] - sub eax,[NumCheats] - sub eax,[NumCheats] - sub eax,[NumCheats] - add eax,cheatdata - add eax,6 - mov ebx,GUICheatTextZ2 - mov ecx,20 -.dloop - mov dl,[ebx] - mov [eax+2],dl - mov [eax+18+2],dl - mov [eax+18*2+2],dl - inc ebx - inc eax - dec ecx - jnz .dloop - ; determine whether it is gamegenie, par, or GF - ; uppercase all codes if necessary - mov eax,GUICheatTextZ1 - mov ecx,14 -.loop - mov bl,[eax] - cmp bl,'a' - jb .nolower - cmp bl,'z' - ja .nolower - sub bl,'a'-'A' - mov [eax],bl -.nolower - inc eax - dec ecx - jnz .loop - mov byte[guicheatvalrep],0 - xor eax,eax - mov al,[GUICheatPosA] - dec al - cmp byte[GUICheatTextZ1+eax],'R' - jne .notrep - mov byte[guicheatvalrep],80h - dec byte[GUICheatPosA] -.notrep - cmp byte[GUICheatPosA],8 - je near .par - cmp byte[GUICheatPosA],9 - je near .gg - cmp byte[GUICheatPosA],14 - je near .gf -.invalidpar - jmp guicheaterror -.par - ; check if code is valid - mov eax,GUICheatTextZ1 - mov ecx,8 -.looppar - mov bl,[eax] - cmp bl,'0' - jb .invalidpar - cmp bl,'9' - jbe .okaypar - cmp bl,'A' - jb .invalidpar - cmp bl,'F' - ja .invalidpar -.okaypar - inc eax - dec ecx - jnz .looppar - jmp decodepar -.invalidgg - jmp guicheaterror -.gg - ; check if code is valid - mov eax,GUICheatTextZ1 - mov ecx,9 -.loopgg - cmp ecx,5 - jne .nomid - cmp byte[eax],'-' - jne .invalidgg - inc eax - dec ecx -.nomid - mov bl,[eax] - cmp bl,'0' - jb .invalidgg - cmp bl,'9' - jbe .okaygg - cmp bl,'A' - jb .invalidgg - cmp bl,'F' - ja .invalidgg -.okaygg - inc eax - dec ecx - jnz .loopgg - jmp decodegg - ret -.invalidgf - jmp guicheaterror -.gf - ; check if code is valid - mov eax,GUICheatTextZ1 - mov ecx,5 -.loopgf - mov bl,[eax] - cmp bl,'0' - jb .invalidgf - cmp bl,'9' - jbe .okaygf - cmp bl,'A' - jb .invalidgf - cmp bl,'F' - ja .invalidgf -.okaygf - inc eax - dec ecx - jnz .loopgf - mov eax,GUICheatTextZ1+5 - mov ecx,6 -.loopgf2 - mov bl,[eax] - cmp bl,'X' - je .okaygf2 - cmp bl,'0' - jb .invalidgf - cmp bl,'9' - jbe .okaygf2 - cmp bl,'A' - jb near .invalidgf - cmp bl,'F' - ja near .invalidgf -.okaygf2 - inc eax - dec ecx - jnz .loopgf2 - mov bl,[GUICheatTextZ1+13] - cmp bl,'0' - je .okaygf3 - cmp bl,'1' - jne near .invalidgf -.okaygf3 - jmp decodegf - -decodegf: - ; convert code to number format - mov ecx,14 - mov esi,GUICheatTextZ1 -.loopb2 - mov al,[esi] - cmp al,'X' - je .let2 - cmp al,'A' - jb .num2 - sub al,'A' - add al,10 - jmp .let2 -.num2 - sub al,'0' -.let2 - mov [esi],al - inc esi - dec ecx - jnz .loopb2 - - ; get address - xor ebx,ebx - xor ecx,ecx - mov cl,[GUICheatTextZ1] - shl ecx,4 - add cl,[GUICheatTextZ1+1] - shl ecx,4 - add cl,[GUICheatTextZ1+2] - shl ecx,4 - add cl,[GUICheatTextZ1+3] - shl ecx,4 - add cl,[GUICheatTextZ1+4] - - mov edx,[NumCheats] - shl edx,5 - sub edx,[NumCheats] - sub edx,[NumCheats] - sub edx,[NumCheats] - sub edx,[NumCheats] - - ; Write data to memory - cmp byte[GUICheatTextZ1+13],1 - je near .modifysram - - ; get data - cmp byte[GUICheatTextZ1+5],'X' - je near .nocode - cmp byte[GUICheatTextZ1+6],'X' - je near .nocode - mov bl,[GUICheatTextZ1+5] - shl bl,4 - add bl,[GUICheatTextZ1+6] - mov esi,[romdata] - mov al,[esi+ecx] - mov [esi+ecx],bl - mov byte[cheatdata+edx],1 - mov [cheatdata+edx+2],ecx - mov [cheatdata+edx+1],bl - mov [cheatdata+edx+5],al - push eax - mov al,[guicheatvalrep] - or [cheatdata+edx],al - pop eax - inc byte[NumCheats] - add edx,28 -.nocode - inc ecx - cmp byte[GUICheatTextZ1+7],'X' - je near .nocode1 - cmp byte[GUICheatTextZ1+8],'X' - je near .nocode1 - cmp byte[NumCheats],255 - je near .nocode1 - mov bl,[GUICheatTextZ1+7] - shl bl,4 - add bl,[GUICheatTextZ1+8] - mov esi,[romdata] - mov al,[esi+ecx] - mov [esi+ecx],bl - mov byte[cheatdata+edx],1 - mov [cheatdata+edx+2],ecx - mov [cheatdata+edx+1],bl - mov [cheatdata+edx+5],al - inc byte[NumCheats] - add edx,28 -.nocode1 - inc ecx - cmp byte[GUICheatTextZ1+9],'X' - je near .nocode2 - cmp byte[GUICheatTextZ1+10],'X' - je near .nocode2 - cmp byte[NumCheats],255 - je near .nocode2 - mov bl,[GUICheatTextZ1+9] - shl bl,4 - add bl,[GUICheatTextZ1+10] - mov esi,[romdata] - mov al,[esi+ecx] - mov [esi+ecx],bl - mov byte[cheatdata+edx],1 - mov [cheatdata+edx+2],ecx - mov [cheatdata+edx+1],bl - mov [cheatdata+edx+5],al - inc byte[NumCheats] -.nocode2 - jmp .quit - -.modifysram - cmp ecx,65535 - ja near .quit - mov esi,[sram] - ; get data - cmp byte[GUICheatTextZ1+5],'X' - je .nocodeb - cmp byte[GUICheatTextZ1+6],'X' - je .nocodeb - mov bl,[GUICheatTextZ1+5] - shl bl,4 - add bl,[GUICheatTextZ1+6] - mov al,[esi+ecx] - mov [esi+ecx],bl - mov byte[cheatdata+edx],2 - mov [cheatdata+edx+2],ecx - mov [cheatdata+edx+1],bl - mov [cheatdata+edx+5],al - inc byte[NumCheats] - add edx,28 -.nocodeb - inc ecx - cmp byte[GUICheatTextZ1+7],'X' - je .nocode1b - cmp byte[GUICheatTextZ1+8],'X' - je .nocode1b - cmp byte[NumCheats],255 - je .nocode1b - cmp ecx,65535 - ja .nocode1b - mov bl,[GUICheatTextZ1+7] - shl bl,4 - add bl,[GUICheatTextZ1+8] - mov al,[esi+ecx+1] - mov [esi+ecx+1],bl - mov byte[cheatdata+edx],2 - mov [cheatdata+edx+2],ecx - mov [cheatdata+edx+1],bl - mov [cheatdata+edx+5],al - inc byte[NumCheats] - add edx,28 -.nocode1b - inc ecx - cmp byte[GUICheatTextZ1+9],'X' - je .nocode2c - cmp byte[GUICheatTextZ1+10],'X' - je .nocode2c - cmp byte[NumCheats],255 - je .nocode2c - cmp ecx,65535 - ja .nocode2c - mov bl,[GUICheatTextZ1+9] - shl bl,4 - add bl,[GUICheatTextZ1+10] - mov al,[esi+ecx+2] - mov [esi+ecx+2],bl - mov byte[cheatdata+edx],2 - mov [cheatdata+edx+2],ecx - mov [cheatdata+edx+1],bl - mov [cheatdata+edx+5],al - inc byte[NumCheats] -.nocode2c - -.quit - cmp byte[NumCheats],0 - je .nocheat - mov byte[CheatOn],1 - mov dword[GUIcurrentcheatwin],1 - mov eax,[NumCheats] - dec eax - mov [GUIcurrentcheatcursloc],eax - sub eax,11 - mov [GUIcurrentcheatviewloc],eax - test dword[GUIcurrentcheatviewloc],80000000h - jz .noview - mov dword[GUIcurrentcheatviewloc],0 -.noview -.nocheat - mov dword[GUICheatTextZ1],0 - mov dword[GUICheatTextZ2],0 - mov byte[GUICheatPosA],0 - mov byte[GUICheatPosB],0 - ret - -decodegg: -;Genie Hex: D F 4 7 0 9 1 5 6 B C 8 A 2 3 E -;Normal Hex: 0 1 2 3 4 5 6 7 8 9 A B C D E F -; 4 6 D E 2 7 8 3 B 5 C 9 A 0 F 1 - ; Convert code - mov esi,GUICheatTextZ1 - mov eax,[esi+5] - mov [esi+4],eax - ; convert code to number format - mov ecx,8 - xor eax,eax -.loopb3 - mov al,[esi] - cmp al,'A' - jb .num3 - sub al,'A' - add al,10 - jmp .let3 -.num3 - sub al,'0' -.let3 - mov al,[.GG2Norm+eax] - mov [esi],al - inc esi - dec ecx - jnz .loopb3 - - mov esi,GUICheatTextZ1 - xor ecx,ecx - mov cl,[esi+2] - shl ecx,4 - add cl,[esi+3] - shl ecx,4 - add cl,[esi+4] - shl ecx,4 - add cl,[esi+5] - shl ecx,4 - add cl,[esi+6] - shl ecx,4 - add cl,[esi+7] -; 0123456789ABCDEF01234567 -; 24bit encoded address: ijklqrstopabcduvwxefghmn -; abcdefghijklmnopqrstuvwx -; >8 >12 >6<10 >6 <14 <10 - mov ebx,ecx - and ebx,000000000011110000000000b ;abcd - shl ebx,10 - mov eax,ecx - and eax,000000000000000000111100b ;efgh - shl eax,14 - add ebx,eax - mov eax,ecx - and eax,111100000000000000000000b ;ijkl - shr eax,8 - add ebx,eax - mov eax,ecx - and eax,000000000000000000000011b ;mn - shl eax,10 - add ebx,eax - mov eax,ecx - and eax,000000001100000000000000b ;op - shr eax,6 - add ebx,eax - mov eax,ecx - and eax,000011110000000000000000b ;qrst - shr eax,12 - add ebx,eax - mov eax,ecx - and eax,000000000000001111000000b ;uvwx - shr eax,6 - add ebx,eax - xor ecx,ecx - mov cx,bx - shr ebx,16 - test bl,40h - jz .noover -; xor cx,8000h -.noover - mov al,[esi] - shl al,4 - add al,[esi+1] - - ; store into cheatdata - mov edx,[NumCheats] - shl edx,5 - sub edx,[NumCheats] - sub edx,[NumCheats] - sub edx,[NumCheats] - sub edx,[NumCheats] - mov byte[cheatdata+edx],0 - mov [cheatdata+edx+1],al - mov [cheatdata+edx+2],cx - mov [cheatdata+edx+4],bl - push eax - mov al,[guicheatvalrep] - or [cheatdata+edx],al - pop eax - push ecx - push eax - push ebx - push edx - call dword near [memtabler8+ebx*4] - pop edx - mov [cheatdata+edx+5],al - pop ebx - pop eax - pop ecx - - mov byte[writeon],1 - - test byte[cheatdata+edx],80h - jnz .nowrite - test byte[cheatdata+edx-28],80h - jnz .nowrite - call dword near [memtablew8+ebx*4] -.nowrite - - mov byte[writeon],0 - mov byte[CheatOn],1 - inc byte[NumCheats] - mov dword[GUICheatTextZ1],0 - mov dword[GUICheatTextZ2],0 - mov byte[GUICheatPosA],0 - mov byte[GUICheatPosB],0 - mov dword[GUIcurrentcheatwin],1 - mov eax,[NumCheats] - dec eax - mov [GUIcurrentcheatcursloc],eax - sub eax,11 - mov [GUIcurrentcheatviewloc],eax - test dword[GUIcurrentcheatviewloc],80000000h - jz .noview - mov dword[GUIcurrentcheatviewloc],0 -.noview - ret -SECTION .data -.GG2Norm db 04h,06h,0Dh,0Eh,02h,07h,08h,03h,0Bh,05h,0Ch,09h,0Ah,00h,0Fh,01h -SECTION .text - -decodepar: - ; convert code to number format - mov ecx,8 - mov esi,GUICheatTextZ1 -.loopb - mov al,[esi] - cmp al,'A' - jb .num - sub al,'A' - add al,10 - jmp .let -.num - sub al,'0' -.let - mov [esi],al - inc esi - dec ecx - jnz .loopb - ; get address - xor ebx,ebx - xor ecx,ecx - mov bl,[GUICheatTextZ1] - shl bl,4 - add bl,[GUICheatTextZ1+1] - mov cl,[GUICheatTextZ1+2] - shl cx,4 - add cl,[GUICheatTextZ1+3] - shl cx,4 - add cl,[GUICheatTextZ1+4] - shl cx,4 - add cl,[GUICheatTextZ1+5] - mov al,[GUICheatTextZ1+6] - shl al,4 - add al,[GUICheatTextZ1+7] - - ; store into cheatdata - xor edx,edx - mov dl,[NumCheats] - push ebx - mov ebx,edx - shl edx,5 - sub edx,ebx - sub edx,ebx - sub edx,ebx - sub edx,ebx - pop ebx - mov byte[cheatdata+edx],0 - mov [cheatdata+edx+1],al - mov [cheatdata+edx+2],cx - mov [cheatdata+edx+4],bl - push eax - mov al,[guicheatvalrep] - or [cheatdata+edx],al - pop eax - push ecx - push eax - push ebx - push edx - call dword near [memtabler8+ebx*4] - pop edx - mov [cheatdata+edx+5],al - pop ebx - pop eax - pop ecx - - mov byte[writeon],1 - test byte[cheatdata+edx],80h - jnz .nowrite - test byte[cheatdata+edx-28],80h - jnz .nowrite - call dword near [memtablew8+ebx*4] -.nowrite - mov byte[writeon],0 - mov byte[CheatOn],1 - inc dword[NumCheats] - mov dword[GUICheatTextZ1],0 - mov dword[GUICheatTextZ2],0 - mov byte[GUICheatPosA],0 - mov byte[GUICheatPosB],0 - mov dword[GUIcurrentcheatwin],1 - mov eax,[NumCheats] - dec eax - mov [GUIcurrentcheatcursloc],eax - sub eax,11 - mov [GUIcurrentcheatviewloc],eax - test dword[GUIcurrentcheatviewloc],80000000h - jz .noview - mov dword[GUIcurrentcheatviewloc],0 -.noview - ret - -SECTION .bss -guicheatvalrep resb 1 diff --git a/tools/zsnes/src/gui/guicombo.inc b/tools/zsnes/src/gui/guicombo.inc deleted file mode 100644 index ed001e4..0000000 --- a/tools/zsnes/src/gui/guicombo.inc +++ /dev/null @@ -1,193 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -SECTION .text - -ComboClip: - movzx eax,byte[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 - dec ecx - jnz .loop - mov ecx,42 ; copy combination code - mov ebx,GUIComboData -.loop2 - mov dl,[ebx] - mov [eax],dl - inc ebx - inc eax - dec ecx - jnz .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 - dec ecx - jnz .loop - mov ecx,42 ; copy combination code - mov ebx,GUIComboData -.loop2 - mov dl,[ebx] - mov [eax],dl - inc ebx - inc eax - dec ecx - jnz .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 - dec ecx - jnz .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 diff --git a/tools/zsnes/src/gui/guifuncs.c b/tools/zsnes/src/gui/guifuncs.c deleted file mode 100644 index a55873b..0000000 --- a/tools/zsnes/src/gui/guifuncs.c +++ /dev/null @@ -1,1850 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#define fnamecmp strcmp -#define fnamencmp strncmp -#else -#ifdef __WIN32__ -#include "../win/lib.h" -#endif - - -#ifdef __MSDOS__ -#include -#include "../dos/lib.h" -#endif - -#include -#include -#include -#include -#define fnamencmp strncasecmp -#define fnamecmp strcasecmp -#endif - -#ifndef _MSC_VER -#include -#include -#include -#endif - -#include "../zpath.h" -#include "../md.h" -#include "../cfg.h" -#include "../input.h" -#include "../asm_call.h" -#include "../zloader.h" - -#ifndef S_ISDIR -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif - -#define BIT(X) (1 << (X)) - -extern unsigned char ComboHeader[23], ComboBlHeader[23], CombinDataGlob[3300]; -extern unsigned char ShowTimer, savecfgforce; -extern unsigned int SnowTimer, NumSnow, NumComboGlob; -extern unsigned char GUIFontData1[705], GUIFontData[705]; -enum vtype { UB, UW, UD, SB, SW, SD }; - -unsigned int ConvertBinaryToInt(char data[]) -{ - int x; - int num = 0; - - for(x = 0;x<8;x++) { if(data[x] == '1') { num |= BIT(7-x); } } - - return(num); -} - -void InsertFontChar(char data[], int pos) -{ - GUIFontData1[pos] = ConvertBinaryToInt(data); -} - -void LoadCustomFont() -{ - FILE *fp; - char data[100]; - int x = 0; - - fp = fopen_dir(ZCfgPath, "zfont.txt", "r"); - if (fp) - { - while (fgets(data,100,fp) && strcmp(data,"EOF\n") && x < 705) - { - fgets(data,10,fp); //get first line - InsertFontChar(data,x++); - - fgets(data,10,fp); //get second line - InsertFontChar(data,x++); - - fgets(data,10,fp); //get third line - InsertFontChar(data,x++); - - fgets(data,10,fp); //get fourth line - InsertFontChar(data,x++); - - fgets(data,10,fp); //get fifth line - InsertFontChar(data,x++); - } - } - else - { - memcpy(GUIFontData1,GUIFontData,705); - fp = fopen_dir(ZCfgPath, "zfont.txt", "w"); - fputs("; empty space 0x00\n00000000\n00000000\n00000000\n00000000\n00000000\n",fp); - fputs("; 0 0x01\n01110000\n10011000\n10101000\n11001000\n01110000\n",fp); - fputs("; 1 0x02\n00100000\n01100000\n00100000\n00100000\n01110000\n",fp); - fputs("; 2 0x03\n01110000\n10001000\n00110000\n01000000\n11111000\n",fp); - fputs("; 3 0x04\n01110000\n10001000\n00110000\n10001000\n01110000\n",fp); - fputs("; 4 0x05\n01010000\n10010000\n11111000\n00010000\n00010000\n",fp); - fputs("; 5 0x06\n11111000\n10000000\n11110000\n00001000\n11110000\n",fp); - fputs("; 6 0x07\n01110000\n10000000\n11110000\n10001000\n01110000\n",fp); - fputs("; 7 0x08\n11111000\n00001000\n00010000\n00010000\n00010000\n",fp); - fputs("; 8 0x09\n01110000\n10001000\n01110000\n10001000\n01110000\n",fp); - fputs("; 9 0x0A\n01110000\n10001000\n01111000\n00001000\n01110000\n",fp); - fputs("; A 0x0B\n01110000\n10001000\n11111000\n10001000\n10001000\n",fp); - fputs("; B 0x0C\n11110000\n10001000\n11110000\n10001000\n11110000\n",fp); - fputs("; C 0x0D\n01110000\n10001000\n10000000\n10001000\n01110000\n",fp); - fputs("; D 0x0E\n11110000\n10001000\n10001000\n10001000\n11110000\n",fp); - fputs("; E 0x0F\n11111000\n10000000\n11110000\n10000000\n11111000\n",fp); - fputs("; F 0x10\n11111000\n10000000\n11110000\n10000000\n10000000\n",fp); - fputs("; G 0x11\n01111000\n10000000\n10011000\n10001000\n01110000\n",fp); - fputs("; H 0x12\n10001000\n10001000\n11111000\n10001000\n10001000\n",fp); - fputs("; I 0x13\n11111000\n00100000\n00100000\n00100000\n11111000\n",fp); - fputs("; J 0x14\n01111000\n00010000\n00010000\n10010000\n01100000\n",fp); - fputs("; K 0x15\n10010000\n10100000\n11100000\n10010000\n10001000\n",fp); - fputs("; L 0x16\n10000000\n10000000\n10000000\n10000000\n11111000\n",fp); - fputs("; M 0x17\n11011000\n10101000\n10101000\n10101000\n10001000\n",fp); - fputs("; N 0x18\n11001000\n10101000\n10101000\n10101000\n10011000\n",fp); - fputs("; O 0x19\n01110000\n10001000\n10001000\n10001000\n01110000\n",fp); - fputs("; P 0x1A\n11110000\n10001000\n11110000\n10000000\n10000000\n",fp); - fputs("; Q 0x1B\n01110000\n10001000\n10101000\n10010000\n01101000\n",fp); - fputs("; R 0x1C\n11110000\n10001000\n11110000\n10010000\n10001000\n",fp); - fputs("; S 0x1D\n01111000\n10000000\n01110000\n00001000\n11110000\n",fp); - fputs("; T 0x1E\n11111000\n00100000\n00100000\n00100000\n00100000\n",fp); - fputs("; U 0x1F\n10001000\n10001000\n10001000\n10001000\n01110000\n",fp); - fputs("; V 0x20\n10001000\n10001000\n01010000\n01010000\n00100000\n",fp); - fputs("; W 0x21\n10001000\n10101000\n10101000\n10101000\n01010000\n",fp); - fputs("; X 0x22\n10001000\n01010000\n00100000\n01010000\n10001000\n",fp); - fputs("; Y 0x23\n10001000\n01010000\n00100000\n00100000\n00100000\n",fp); - fputs("; Z 0x24\n11111000\n00010000\n00100000\n01000000\n11111000\n",fp); - fputs("; - 0x25\n00000000\n00000000\n11111000\n00000000\n00000000\n",fp); - fputs("; _ 0x26\n00000000\n00000000\n00000000\n00000000\n11111000\n",fp); - fputs("; ~ 0x27\n01101000\n10010000\n00000000\n00000000\n00000000\n",fp); - fputs("; . 0x28\n00000000\n00000000\n00000000\n00000000\n00100000\n",fp); - fputs("; / 0x29\n00001000\n00010000\n00100000\n01000000\n10000000\n",fp); - fputs("; < 0x2A\n00010000\n00100000\n01000000\n00100000\n00010000\n",fp); - fputs("; > 0x2B\n01000000\n00100000\n00010000\n00100000\n01000000\n",fp); - fputs("; [ 0x2C\n01110000\n01000000\n01000000\n01000000\n01110000\n",fp); - fputs("; ] 0x2D\n01110000\n00010000\n00010000\n00010000\n01110000\n",fp); - fputs("; : 0x2E\n00000000\n00100000\n00000000\n00100000\n00000000\n",fp); - fputs("; & 0x2F\n01100000\n10011000\n01110000\n10011000\n01101000\n",fp); - fputs("; arrow down 0x30\n00100000\n00100000\n10101000\n01110000\n00100000\n",fp); - fputs("; # 0x31\n01010000\n11111000\n01010000\n11111000\n01010000\n",fp); - fputs("; = 0x32\n00000000\n11111000\n00000000\n11111000\n00000000\n",fp); - fputs("; \" 0x33\n01001000\n10010000\n00000000\n00000000\n00000000\n",fp); - fputs("; \\ 0x34\n10000000\n01000000\n00100000\n00010000\n00001000\n",fp); - fputs("; * 0x35\n10101000\n01110000\n11111000\n01110000\n10101000\n",fp); - fputs("; ? 0x36\n01110000\n10001000\n00110000\n00000000\n00100000\n",fp); - fputs("; % 0x37\n10001000\n00010000\n00100000\n01000000\n10001000\n",fp); - fputs("; + 0x38\n00100000\n00100000\n11111000\n00100000\n00100000\n",fp); - fputs("; , 0x39\n00000000\n00000000\n00000000\n00100000\n01000000\n",fp); - fputs("; ( 0x3A\n00110000\n01000000\n01000000\n01000000\n00110000\n",fp); - fputs("; ) 0x3B\n01100000\n00010000\n00010000\n00010000\n01100000\n",fp); - fputs("; @ 0x3C\n01110000\n10011000\n10111000\n10000000\n01110000\n",fp); - fputs("; \' 0x3D\n00100000\n01000000\n00000000\n00000000\n00000000\n",fp); - fputs("; ! 0x3E\n00100000\n00100000\n00100000\n00000000\n00100000\n",fp); - fputs("; $ 0x3F\n01111000\n10100000\n01110000\n00101000\n11110000\n",fp); - fputs("; ; 0x40\n00000000\n00100000\n00000000\n00100000\n01000000\n",fp); - fputs("; ` 0x41\n01000000\n00100000\n00000000\n00000000\n00000000\n",fp); - fputs("; ^ 0x42\n00100000\n01010000\n00000000\n00000000\n00000000\n",fp); - fputs("; { 0x43\n00110000\n01000000\n11000000\n01000000\n00110000\n",fp); - fputs("; } 0x44\n01100000\n00010000\n00011000\n00010000\n01100000\n",fp); - fputs("; up 0x45\n00100000\n00100000\n01110000\n01110000\n11111000\n",fp); - fputs("; down 0x46\n11111000\n01110000\n01110000\n00100000\n00100000\n",fp); - fputs("; left 0x47\n00001000\n00111000\n11111000\n00111000\n00001000\n",fp); - fputs("; right 0x48\n10000000\n11100000\n11111000\n11100000\n10000000\n",fp); - fputs("; arrow left 0x49\n00100000\n01100000\n11111000\n01100000\n00100000\n",fp); - fputs("; .5 0x4A\n00111000\n00100000\n00110000\n00001000\n10110000\n",fp); - fputs("; maximize (Win) 0x4B\n11111100\n10000100\n11111100\n00000000\n00000000\n",fp); - fputs("; minimize (Win) 0x4C\n00000000\n11111100\n00000000\n00000000\n00000000\n",fp); - fputs("; maximize (SDL) 0x4D\n11111000\n10001000\n10001000\n10001000\n11111000\n",fp); - fputs("; shw fullstop 0x4E\n00000000\n00000000\n00100000\n01010000\n00100000\n",fp); - fputs("; shw left bracket 0x4F\n01110000\n01000000\n01000000\n01000000\n00000000\n",fp); - fputs("; shw right bracket 0x50\n00000000\n00010000\n00010000\n00010000\n01110000\n",fp); - fputs("; shw comma 0x51\n00000000\n00000000\n00000000\n01000000\n00100000\n",fp); - fputs("; shw mid-dot 0x52\n00000000\n00100000\n01110000\n00100000\n00000000\n",fp); - fputs("; shw wo 0x53\n11111000\n00001000\n11110000\n00100000\n11000000\n",fp); - fputs("; shw mini a 0x54\n00000000\n11111000\n01010000\n01100000\n01000000\n",fp); - fputs("; shw mini i 0x55\n00000000\n00010000\n00100000\n11100000\n00100000\n",fp); - fputs("; shw mini u 0x56\n00000000\n00100000\n11111000\n10001000\n00110000\n",fp); - fputs("; shw mini e 0x57\n00000000\n00000000\n11111000\n00100000\n11111000\n",fp); - fputs("; shw mini o 0x58\n00000000\n00010000\n11111000\n00110000\n11010000\n",fp); - fputs("; shw mini ya 0x59\n00000000\n01000000\n11111000\n01010000\n01000000\n",fp); - fputs("; shw mini yu 0x5A\n00000000\n00000000\n11110000\n00010000\n11111000\n",fp); - fputs("; shw mini yo 0x5B\n00000000\n11111000\n00001000\n01111000\n11111000\n",fp); - fputs("; shw mini tsu 0x5C\n00000000\n10101000\n10101000\n00010000\n01100000\n",fp); - fputs("; shw prolong 0x5D\n00000000\n10000000\n01111000\n00000000\n00000000\n",fp); - fputs("; shw a 0x5E\n11111000\n00101000\n00110000\n00100000\n11000000\n",fp); - fputs("; shw i 0x5F\n00001000\n00110000\n11100000\n00100000\n00100000\n",fp); - fputs("; shw u 0x60\n00100000\n11111000\n10001000\n00010000\n01100000\n",fp); - fputs("; shw e 0x61\n11111000\n00100000\n00100000\n00100000\n11111000\n",fp); - fputs("; shw o 0x62\n00010000\n11111000\n00110000\n01010000\n10010000\n",fp); - fputs("; shw ka 0x63\n01000000\n11111000\n01001000\n01001000\n10011000\n",fp); - fputs("; shw ki 0x64\n00100000\n11111000\n00100000\n11111000\n00100000\n",fp); - fputs("; shw ku 0x65\n01000000\n01111000\n10001000\n00010000\n01100000\n",fp); - fputs("; shw ke 0x66 ^^\n01000000\n01111000\n10010000\n00010000\n01100000\n",fp); - fputs("; shw ko 0x67\n11111000\n00001000\n00001000\n00001000\n11111000\n",fp); - fputs("; shw sa 0x68\n01010000\n11111000\n01010000\n00010000\n01100000\n",fp); - fputs("; shw shi 0x69\n01000000\n10101000\n01001000\n00010000\n11100000\n",fp); - fputs("; shw su 0x6A\n11111000\n00001000\n00010000\n00110000\n11001000\n",fp); - fputs("; shw se 0x6B\n01000000\n11111000\n01010000\n01000000\n00111000\n",fp); - fputs("; shw so 0x6C\n10001000\n01001000\n00001000\n00010000\n01100000\n",fp); - fputs("; shw ta 0x6D\n01000000\n01111000\n11001000\n00110000\n01100000\n",fp); - fputs("; shw chi 0x6E\n11111000\n00100000\n11111000\n00100000\n01000000\n",fp); - fputs("; shw tsu 0x6F\n10101000\n10101000\n00001000\n00010000\n01100000\n",fp); - fputs("; shw te 0x70\n11111000\n00000000\n11111000\n00100000\n11000000\n",fp); - fputs("; shw to 0x71\n01000000\n01000000\n01100000\n01010000\n01000000\n",fp); - fputs("; shw na 0x72\n00100000\n11111000\n00100000\n00100000\n01000000\n",fp); - fputs("; shw ni 0x73\n11110000\n00000000\n00000000\n00000000\n11111000\n",fp); - fputs("; shw nu 0x74\n11111000\n00001000\n00101000\n00010000\n01101000\n",fp); - fputs("; shw ne 0x75\n00100000\n11111000\n00001000\n01110000\n10101000\n",fp); - fputs("; shw no 0x76\n00001000\n00001000\n00001000\n00010000\n01100000\n",fp); - fputs("; shw ha 0x77\n01010000\n01010000\n01010000\n10001000\n10001000\n",fp); - fputs("; shw hi 0x78\n10000000\n10011000\n11100000\n10000000\n01111000\n",fp); - fputs("; shw hu 0x79\n11111000\n00001000\n00001000\n00010000\n01100000\n",fp); - fputs("; shw he 0x7A\n01000000\n10100000\n10010000\n00001000\n00000000\n",fp); - fputs("; shw ho 0x7B\n00100000\n11111000\n01110000\n10101000\n00100000\n",fp); - fputs("; shw ma 0x7C\n11111000\n00001000\n10010000\n01100000\n00100000\n",fp); - fputs("; shw mi 0x7D\n11111000\n00000000\n11111000\n00000000\n11111000\n",fp); - fputs("; shw mu 0x7E\n00100000\n01000000\n01000000\n10010000\n11111000\n",fp); - fputs("; shw me 0x7F\n00001000\n01001000\n00110000\n00110000\n11001000\n",fp); - fputs("; shw mo 0x80\n11111000\n00100000\n11111000\n00100000\n00111000\n",fp); - fputs("; shw ya 0x81\n01000000\n11111100\n01001000\n00100000\n00100000\n",fp); - fputs("; shw yu 0x82\n11110000\n00010000\n00010000\n00010000\n11111000\n",fp); - fputs("; shw yo 0x83\n11111000\n00001000\n11111000\n00001000\n11111000\n",fp); - fputs("; shw ra 0x84\n11111000\n00000000\n11111000\n00010000\n01100000\n",fp); - fputs("; shw ri 0x85\n10001000\n10001000\n10001000\n00010000\n01100000\n",fp); - fputs("; shw ru 0x86\n01100000\n01100000\n01101000\n01101000\n10110000\n",fp); - fputs("; shw re 0x87\n10000000\n10000000\n10001000\n10001000\n11110000\n",fp); - fputs("; shw ro 0x88\n11111000\n10001000\n10001000\n10001000\n11111000\n",fp); - fputs("; shw wa 0x89\n11111000\n10001000\n00001000\n00010000\n01100000\n",fp); - fputs("; shw n 0x8A\n10000000\n01001000\n00001000\n00010000\n11100000\n",fp); - fputs("; shw voiced 0x8B\n10100000\n10100000\n00000000\n00000000\n00000000\n",fp); - fputs("; shw halfvoiced 0x8C\n01000000\n10100000\n01000000\n00000000\n00000000\n",fp); - fputs("EOF\n",fp); - } - - fclose(fp); -} - -static void CheckValueBounds(void *ptr, int min, int max, int val, enum vtype type) -{ - switch (type) - { - case SB: - if (((*(char*)ptr) > (char)max) || ((*(char*)ptr) < (char)min)) - { *(char*)ptr = (char)val; } - break; - case UB: - if (((*(unsigned char*)ptr) > (unsigned char)max) || - ((*(unsigned char*)ptr) < (unsigned char)min)) - { *(unsigned char*)ptr = (unsigned char)val; } - break; - - case SW: - if (((*(short*)ptr) > (short)max) || ((*(short*)ptr) < (short)min)) - { *(short*)ptr = (short)val; } - break; - case UW: - if (((*(unsigned short*)ptr) > (unsigned short)max) || - ((*(unsigned short*)ptr) < (unsigned short)min)) - { *(unsigned short*)ptr = (unsigned short)val; } - break; - - default: - case SD: - if (((*(int*)ptr) > max) || ((*(int*)ptr) < min)) - { *(int*)ptr = val; } - break; - case UD: - if (((*(unsigned int*)ptr) > (unsigned int)max) || - ((*(unsigned int*)ptr) < (unsigned int)min)) - { *(unsigned int*)ptr = (unsigned int)val; } - } -} - -unsigned char CalcCfgChecksum() -{ - unsigned char *ptr = &GUIRAdd, i = 0; - unsigned short chksum = 0; - - for (; i < 100 ; i++, ptr++) { chksum += *ptr; } - - chksum ^= 0xB2ED; // xor bx,1011001011101101b - i = (chksum & 0x800) >> 8; - chksum &= 0xF7FF; // and bh,0F7h - - if (chksum & 0x10) { chksum |= 0x800; } - chksum &= 0xFFEF; // and bl,0EFh - if (i) { chksum |= 0x10; } - - i = (chksum >> 8); - - return (((chksum & 0xFF) ^ i) | 0x80); -} - -void GUIRestoreVars() -{ - int i; - FILE *cfg_fp; - - psr_cfg_run(read_cfg_vars, ZCfgPath, ZCfgFile); - psr_cfg_run(read_md_vars, ZCfgPath, "zmovie.cfg"); - psr_cfg_run(read_input_vars, ZCfgPath, "zinput.cfg"); - -#ifdef __MSDOS__ - CheckValueBounds(&pl1contrl, 0, 16, 1, UB); - CheckValueBounds(&pl1p209, 0, 1, 0, UB); - CheckValueBounds(&pl2contrl, 0, 16, 0, UB); - CheckValueBounds(&pl2p209, 0, 1, 0, UB); - CheckValueBounds(&pl3contrl, 0, 16, 0, UB); - CheckValueBounds(&pl3p209, 0, 1, 0, UB); - CheckValueBounds(&pl4contrl, 0, 16, 0, UB); - CheckValueBounds(&pl4p209, 0, 1, 0, UB); - CheckValueBounds(&pl5contrl, 0, 16, 0, UB); - CheckValueBounds(&pl5p209, 0, 1, 0, UB); -#else - CheckValueBounds(&pl1contrl, 0, 1, 1, UB); - CheckValueBounds(&pl2contrl, 0, 1, 0, UB); - CheckValueBounds(&pl3contrl, 0, 1, 0, UB); - CheckValueBounds(&pl4contrl, 0, 1, 0, UB); - CheckValueBounds(&pl5contrl, 0, 1, 0, UB); -#endif - -#ifndef __MSDOS__ - CheckValueBounds(&joy_sensitivity, 0, 32767, 16384, UW); -#endif -#ifdef __WIN32__ - CheckValueBounds(&MouseSensitivity, 1, 255, 1, UB); -#endif -#ifdef __MSDOS__ - CheckValueBounds(&SidewinderFix, 0, 1, 0, UB); -#endif - CheckValueBounds(&pl12s34, 0, 1, 0, UB); - CheckValueBounds(&AllowUDLR, 0, 1, 0, UB); - CheckValueBounds(&Turbo30hz, 0, 1, 1, UB); - CheckValueBounds(&mouse1lh, 0, 1, 0, UB); - CheckValueBounds(&mouse2lh, 0, 1, 0, UB); - CheckValueBounds(&device1, 0, 1, 0, UB); - CheckValueBounds(&device2, 0, 4, 0, UB); - CheckValueBounds(&GUIComboGameSpec, 0, 1, 0, UB); - CheckValueBounds(&GameSpecificInput, 0, 1, 0, UB); - - CheckValueBounds(&AllowMMX, 0, 1, 1, UB); -#ifdef __WIN32__ - CheckValueBounds(&PauseFocusChange, 0, 1, 0, UB); - CheckValueBounds(&HighPriority, 0, 1, 0, UB); - CheckValueBounds(&DisableScreenSaver, 0, 1, 1, UB); -#endif - CheckValueBounds(&newengen, 0, 1, 1, UB); - CheckValueBounds(&bgfixer, 0, 1, 0, UB); -#ifdef NO_PNG - CheckValueBounds(&ScreenShotFormat, 0, 0, 0, UB); -#else - CheckValueBounds(&ScreenShotFormat, 0, 1, 0, UB); -#endif - CheckValueBounds(&AutoPatch, 0, 1, 1, UB); - CheckValueBounds(&DisplayInfo, 0, 1, 1, UB); - CheckValueBounds(&RomInfo, 0, 1, 1, UB); - CheckValueBounds(&FPSAtStart, 0, 1, 0, UB); - CheckValueBounds(&TimerEnable, 0, 1, 0, UB); - CheckValueBounds(&TwelveHourClock, 0, 1, 0, UB); - CheckValueBounds(&ClockBox, 0, 1, 1, UB); - CheckValueBounds(&SmallMsgText, 0, 1, 0, UB); - CheckValueBounds(&GUIEnableTransp, 0, 1, 0, UB); - -#ifdef __MSDOS__ - CheckValueBounds(&Palette0, 0, 1, 1, UB); -#endif -#ifdef __WIN32__ - CheckValueBounds(&cvidmode, 0, 42, 2, UB); - CheckValueBounds(&PrevWinMode, 0, 42, 2, UB); - CheckValueBounds(&PrevFSMode, 0, 42, 6, UB); -#endif -#ifdef __UNIXSDL__ -#ifdef __OPENGL__ - CheckValueBounds(&cvidmode, 0, 22, 2, UB); - CheckValueBounds(&PrevWinMode, 0, 22, 2, UB); - CheckValueBounds(&PrevFSMode, 0, 22, 3, UB); -#else - CheckValueBounds(&cvidmode, 0, 4, 2, UB); - CheckValueBounds(&PrevWinMode, 0, 4, 2, UB); - CheckValueBounds(&PrevFSMode, 0, 4, 3, UB); -#endif -#endif -#ifdef __MSDOS__ - CheckValueBounds(&cvidmode, 0, 18, 4, UB); -#endif -#ifndef __MSDOS__ - CheckValueBounds(&CustomResX, 256, 2048, 640, UD); - CheckValueBounds(&CustomResY, 224, 1536, 480, UD); -#endif - - CheckValueBounds(&antienab, 0, 1, 0, UB); -#ifdef __OPENGL__ - CheckValueBounds(&BilinearFilter, 0, 1, 0, UB); -#endif - CheckValueBounds(&NTSCFilter, 0, 1, 0, UB); - CheckValueBounds(&NTSCBlend, 0, 1, 0, UB); - CheckValueBounds(&NTSCRef, 0, 1, 0, UB); - CheckValueBounds(&NTSCHue, -100, 100, 0, SB); - CheckValueBounds(&NTSCSat, -100, 100, 0, SB); - CheckValueBounds(&NTSCCont, -100, 100, 0, SB); - CheckValueBounds(&NTSCBright, -100, 100, 0, SB); - CheckValueBounds(&NTSCSharp, -100, 100, 0, SB); - CheckValueBounds(&NTSCGamma, -100, 100, 0, SB); - CheckValueBounds(&NTSCRes, -100, 100, 0, SB); - CheckValueBounds(&NTSCArt, -100, 100, 0, SB); - CheckValueBounds(&NTSCFringe, -100, 100, 0, SB); - CheckValueBounds(&NTSCBleed, -100, 100, 0, SB); - CheckValueBounds(&NTSCWarp, -100, 100, 0, SB); - CheckValueBounds(&En2xSaI, 0, 3, 0, UB); -#ifndef __MSDOS__ - CheckValueBounds(&hqFilter, 0, 1, 0, UB); - CheckValueBounds(&hqFilterlevel, 2, 4, 2, UB); -#endif - CheckValueBounds(&scanlines, 0, 3, 0, UB); - CheckValueBounds(&GrayscaleMode, 0, 1, 0, UB); - CheckValueBounds(&Mode7HiRes16b, 0, 1, 0, UD); -#ifndef __UNIXSDL__ - CheckValueBounds(&vsyncon, 0, 1, 0, UB); -#endif -#ifdef __WIN32__ - CheckValueBounds(&TripleBufferWin, 0, 1, 0, UB); -#endif -#ifdef __MSDOS__ - CheckValueBounds(&Triplebufen, 0, 1, 0, UB); -#endif -#ifdef __WIN32__ - CheckValueBounds(&ForceRefreshRate, 0, 1, 0, UB); - CheckValueBounds(&SetRefreshRate, 50, 180, 60, UB); - CheckValueBounds(&KitchenSync, 0, 1, 0, UB); - CheckValueBounds(&KitchenSyncPAL, 0, 1, 0, UB); -#endif -#ifndef __MSDOS__ - CheckValueBounds(&Keep4_3Ratio, 0, 1, 1, UB); -#else - CheckValueBounds(&smallscreenon, 0, 1, 0, UD); - CheckValueBounds(&ScreenScale, 0, 1, 0, UB); -#endif - CheckValueBounds(&gammalevel, 0, 15, 0, UB); - - CheckValueBounds(&SPCDisable, 0, 1, 0, UB); - CheckValueBounds(&soundon, 0, 1, 1, UB); - CheckValueBounds(&StereoSound, 0, 1, 1, UB); - CheckValueBounds(&RevStereo, 0, 1, 0, UB); - CheckValueBounds(&Surround, 0, 1, 0, UB); -#ifdef __WIN32__ - CheckValueBounds(&PrimaryBuffer, 0, 1, 0, UB); -#endif -#ifdef __MSDOS__ - CheckValueBounds(&Force8b, 0, 1, 0, UB); -#endif - CheckValueBounds(&SoundQuality, 0, 6, 5, UD); - CheckValueBounds(&MusicRelVol, 0, 100, 100, UB); - CheckValueBounds(&SoundInterpType, 0, 3, 1, UB); - CheckValueBounds(&LowPassFilterType, 0, 3, 0, UB); -#ifdef __MSDOS__ - CheckValueBounds(&DisplayS, 0, 1, 0, UB); -#endif - CheckValueBounds(&EchoDis, 0, 1, 0, UB); - - CheckValueBounds(&RewindStates, 0, 99, 8, UB); - CheckValueBounds(&RewindFrames, 1, 99, 15, UB); - CheckValueBounds(&nosaveSRAM, 0, 1, 0, UB); - CheckValueBounds(&SRAMSave5Sec, 0, 1, 0, UB); - CheckValueBounds(&SRAMState, 0, 1, 1, UB); - CheckValueBounds(&LatestSave, 0, 1, 0, UB); - CheckValueBounds(&AutoIncSaveSlot, 0, 1, 0, UB); - CheckValueBounds(&AutoIncSaveSlotBlock, 0, 1, 0, UB); - CheckValueBounds(&AutoState, 0, 1, 0, UB); - CheckValueBounds(&PauseLoad, 0, 1, 0, UB); - CheckValueBounds(&PauseRewind, 0, 1, 0, UB); - - CheckValueBounds(&per2exec, 50, 150, 100, UD); - CheckValueBounds(&HacksDisable, 0, 1, 0, UB); - CheckValueBounds(&frameskip, 0, 10, 0, UB); - CheckValueBounds(&maxskip, 0, 9, 9, UB); - CheckValueBounds(&FastFwdToggle, 0, 1, 0, UB); - CheckValueBounds(&FFRatio, 0, 28, 8, UB); - CheckValueBounds(&SDRatio, 0, 28, 0, UB); - CheckValueBounds(&EmuSpeed, 0, 58, 29, UB); - - CheckValueBounds(&guioff, 0, 1, 0, UB); - CheckValueBounds(&showallext, 0, 1, 0, UB); -#ifdef __MSDOS__ - CheckValueBounds(&GUIloadfntype, 0, 2, 2, UB); -#else - CheckValueBounds(&GUIloadfntype, 0, 1, 0, UB); -#endif - CheckValueBounds(&prevlfreeze, 0, 1, 0, UB); - CheckValueBounds(&GUIRClick, 0, 1, 0, UB); - CheckValueBounds(&lhguimouse, 0, 1, 0, UB); - CheckValueBounds(&mouseshad, 0, 1, 1, UB); - CheckValueBounds(&mousewrap, 0, 1, 0, UB); -#ifdef __WIN32__ - CheckValueBounds(&TrapMouseCursor, 0, 1, 0, UB); - CheckValueBounds(&MouseWheel, 0, 1, 1, UB); -#endif - CheckValueBounds(&esctomenu, 0, 1, 1, UB); - CheckValueBounds(&JoyPad1Move, 0, 1, 0, UB); - CheckValueBounds(&FilteredGUI, 0, 1, 1, UB); - CheckValueBounds(&newfont, 0, 1, 0, UB); - CheckValueBounds(&savewinpos, 0, 1, 0, UB); - for (i=1 ; i<22 ; i++) - { - CheckValueBounds(GUIwinposx+i, -233, 254, 10, SD); - CheckValueBounds(GUIwinposy+i, 8, 221, 20, SD); - } - CheckValueBounds(&GUIEffect, 0, 5, 0, UB); - CheckValueBounds(&GUIRAdd, 0, 31, 15, UB); - CheckValueBounds(&GUIGAdd, 0, 31, 10, UB); - CheckValueBounds(&GUIBAdd, 0, 31, 31, UB); - CheckValueBounds(&GUITRAdd, 0, 31, 0, UB); - CheckValueBounds(&GUITGAdd, 0, 31, 10, UB); - CheckValueBounds(&GUITBAdd, 0, 31, 31, UB); - CheckValueBounds(&GUIWRAdd, 0, 31, 8, UB); - CheckValueBounds(&GUIWGAdd, 0, 31, 8, UB); - CheckValueBounds(&GUIWBAdd, 0, 31, 25, UB); -#ifdef __WIN32__ - CheckValueBounds(&AlwaysOnTop, 0, 1, 0, UB); - CheckValueBounds(&SaveMainWindowPos, 0, 1, 1, UB); - CheckValueBounds(&AllowMultipleInst, 0, 1, 1, UB); -#endif - - CheckValueBounds(&AutoLoadCht, 0, 1, 0, UB); - CheckValueBounds(&CheatSrcByteSize, 0, 3, 0, UB); - CheckValueBounds(&CheatSrcByteBase, 0, 1, 0, UB); - CheckValueBounds(&CheatSrcSearchType, 0, 1, 0, UB); - CheckValueBounds(&CheatUpperByteOnly, 0, 1, 0, UB); - - CheckValueBounds(&MovieDisplayFrame, 0, 1, 0, UB); - CheckValueBounds(&MovieStartMethod, 0, 3, 0, UB); - CheckValueBounds(&MZTForceRTR, 0, 2, 0, UB); - CheckValueBounds(&MovieVideoMode, 0, 5, 4, UB); - CheckValueBounds(&MovieAudio, 0, 1, 1, UB); - CheckValueBounds(&MovieAudioCompress, 0, 1, 1, UB); - CheckValueBounds(&MovieVideoAudio, 0, 1, 1, UB); - - CheckValueBounds(&FirstTimeData, 0, 1, 1, UB); -#ifndef NO_DEBUGGER - CheckValueBounds(&debuggeron, 0, 1, 0, UB); -#endif - CheckValueBounds(&cfgdontsave, 0, 1, 0, UB); - - //if (TimeChecker == CalcCfgChecksum()) //What does this do? - { - ShowTimer = 1; - NumSnow = 200; - SnowTimer = 0; - } - - NumComboGlob = 0; - - if ((cfg_fp = fopen_dir(ZCfgPath, "data.cmb", "rb"))) - { - fread(ComboBlHeader, 1, 23, cfg_fp); - - if (ComboBlHeader[22]) - { - NumComboGlob = ComboBlHeader[22]; - fread(CombinDataGlob, 1, 66*NumComboGlob, cfg_fp); - } - - fclose(cfg_fp); - } - - LoadCustomFont(); -} - -void GUISaveVars() -{ - FILE *cfg_fp; - - if (ShowTimer == 1) { TimeChecker = CalcCfgChecksum(); } - - if (!cfgdontsave || savecfgforce) - { - swap_backup_vars(); - psr_cfg_run(write_cfg_vars, ZCfgPath, ZCfgFile); - if (!GameSpecificInput) - { - psr_cfg_run(write_input_vars, ZCfgPath, "zinput.cfg"); - } - swap_backup_vars(); - } - - if (NumComboGlob && (cfg_fp = fopen_dir(ZCfgPath, "data.cmb", "wb"))) - { - ComboHeader[22] = NumComboGlob; - fwrite(ComboHeader, 1, 23, cfg_fp); - fwrite(CombinDataGlob, 1, 66*NumComboGlob, cfg_fp); - fclose(cfg_fp); - } -} - -//~81 prior to solar peak, horizontal compensation needs to be made. -//ISBN-014036336X in the second to last chapter discusses how emulating bonjour results in a special card case. -//Thanks Motley! -unsigned int horizon[][4][8] = {{{0x6F746E41, 0x57656E69, 0x61772047, 0x65682073, 0x00216572, 0xB7CE8EB8, 0x00000006, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x746E6153, 0x6F632061, 0x2073656D, 0x6E656877, 0x20746920, 0x776F6E73, 0x00000073, 0x00000011}, - {0x6F666562, 0x74206572, 0x6E206568, 0x79207765, 0x2E726165, 0x776F6E00, 0x00000073, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x6E64694D, 0x74686769, 0x6D615620, 0x65726970, 0x6C662073, 0x77006565, 0x00000073, 0x00000011}, - {0x6F666562, 0x5A206572, 0x53454E53, 0x646E6120, 0x27746920, 0x77000073, 0x00000073, 0x00000011}, - {0x746E6F63, 0x206C6F72, 0x6720666F, 0x696C7261, 0x6F742063, 0x2E747361, 0x00000000, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x454E535A, 0x61682053, 0x65642073, 0x74636574, 0x74206465, 0x00746168, 0x00000000, 0x00000011}, - {0x20756F79, 0x20646964, 0x20746F6E, 0x616E6F64, 0x74206574, 0x7961646F, 0x0000002E, 0x00000011}, - {0x20756F59, 0x6C6C6977, 0x776F6E20, 0x70786520, 0x65697265, 0x0065636E, 0x0000002E, 0x00000011}, - {0x2072756F, 0x74617277, 0x77002E68, 0x70786520, 0x65697265, 0x0065636E, 0x0000002E, 0x00000011}}, - - {{0x72756F59, 0x454E5320, 0x6F642053, 0x6E207365, 0x7320746F, 0x006D6565, 0x0000002E, 0x00000011}, - {0x62206F74, 0x6C702065, 0x65676775, 0x6E692064, 0x79206F74, 0x0072756F, 0x0000002E, 0x00000011}, - {0x656C6554, 0x69736976, 0x70206E6F, 0x65706F72, 0x2E796C72, 0x00727500, 0x0000002E, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x7E206E49, 0x64203138, 0x20737961, 0x6F732061, 0x0072616C, 0x00727500, 0x0000002E, 0xB7F261E0}, - {0x65776F70, 0x20646572, 0x454E535A, 0x69772053, 0x62206C6C, 0x74612065, 0x00000000, 0xB7F261E0}, - {0x73277469, 0x61657020, 0x4500216B, 0x69772053, 0x62206C6C, 0x74612065, 0x00000000, 0xB7F261E0}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x61206557, 0x6E206572, 0x7220776F, 0x726F7065, 0x676E6974, 0x756F7920, 0x00210072, 0x00000011}, - {0x696D6167, 0x6120676E, 0x76697463, 0x65697469, 0x6F742073, 0x756F7900, 0x00210072, 0x00000011}, - {0x746E694E, 0x6F646E65, 0x63207327, 0x72746E65, 0x73206C61, 0x65767265, 0x00007372, 0x00000011}, - {0x61656C70, 0x77206573, 0x20746961, 0x6F6D2061, 0x746E656D, 0x6576002E, 0x00007372, 0x00000011}}, - - {{0x20657241, 0x20756F79, 0x72616568, 0x20676E69, 0x00796E61, 0x6576002E, 0x00007372, 0x00000011}, - {0x63696F76, 0x69207365, 0x6F79206E, 0x68207275, 0x00646165, 0x6576002E, 0x00007372, 0x00000011}, - {0x68676972, 0x6F6E2074, 0x6F003F77, 0x68207275, 0x00646165, 0x6576002E, 0x00007372, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x73277449, 0x746F6E20, 0x6F6F7420, 0x74616C20, 0x00640065, 0x6576002E, 0x00007372, 0x00000011}, - {0x65766E69, 0x69207473, 0x535A206E, 0x2053454E, 0x61646F74, 0x65002179, 0x00007372, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x20646944, 0x20756F79, 0x776F6E6B, 0x20666920, 0x00756F79, 0x65002179, 0x00007372, 0x00000011}, - {0x20797562, 0x65676170, 0x6C756166, 0x65622074, 0x00007265, 0x65002179, 0x00007372, 0x00000011}, - {0x20756F79, 0x6C6C6977, 0x6B616D20, 0x69682065, 0x0000006D, 0x65002179, 0x00007372, 0x00000011}, - {0x70706168, 0x6C003F79, 0x6B616D20, 0x69682065, 0x0000006D, 0x65002179, 0x00007372, 0x00000011}}, - - {{0x276E6F44, 0x6F792074, 0x65662075, 0x74206C65, 0x69727265, 0x00656C62, 0x00007372, 0x00000011}, - {0x776F6E6B, 0x20676E69, 0x20756F79, 0x20657375, 0x454E535A, 0x00650053, 0x00007372, 0x00000011}, - {0x20646E61, 0x65766168, 0x2074276E, 0x616E6F64, 0x00646574, 0x00650053, 0x00007372, 0x00000011}, - {0x756F6E65, 0x74206867, 0x7261776F, 0x69207364, 0x00003F74, 0x00650053, 0x00007372, 0x00000011}}, - - {{0x20796857, 0x20657261, 0x20756F79, 0x79616C70, 0x00676E69, 0x00650053, 0x00007372, 0x00000011}, - {0x656D6167, 0x68772073, 0x79206E65, 0x7320756F, 0x6C756F68, 0x00650064, 0x00007372, 0x00000011}, - {0x73206562, 0x646E6570, 0x20676E69, 0x6C617571, 0x20797469, 0x656D6974, 0x00007300, 0x00000011}, - {0x68746977, 0x756F7920, 0x61662072, 0x796C696D, 0x2079003F, 0x656D6974, 0x00007300, 0x00000011}}, - - {{0x73277449, 0x73656220, 0x6F742074, 0x616C7020, 0x20790079, 0x656D6974, 0x00007300, 0x00000011}, - {0x53454E53, 0x6D616720, 0x77207365, 0x656C6968, 0x61657720, 0x676E6972, 0x00007300, 0x00000011}, - {0x69786F62, 0x6720676E, 0x65766F6C, 0x65002E73, 0x61657720, 0x676E6972, 0x00007300, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x79206F44, 0x7420756F, 0x6B6E6968, 0x69737520, 0x6100676E, 0x676E6972, 0x00007300, 0x00000011}, - {0x454E535A, 0x6E692053, 0x61657263, 0x20736573, 0x72756F79, 0x676E6900, 0x00007300, 0x00000011}, - {0x69736564, 0x74206572, 0x7573206F, 0x726F7070, 0x72750074, 0x676E6900, 0x00007300, 0x00000011}, - {0x65766564, 0x6D706F6C, 0x3F746E65, 0x726F7000, 0x72750074, 0x676E6900, 0x00007300, 0x00000011}}, - - {{0x6E616854, 0x6F79206B, 0x6F662075, 0x6C702072, 0x6E697961, 0x676E0067, 0x00007300, 0x00000011}, - {0x73657270, 0x65746E65, 0x79622064, 0x6C702000, 0x6E697961, 0x676E0067, 0x00007300, 0x00000011}, - {0x454E535A, 0x65742053, 0x00216D61, 0x6C702000, 0x6E697961, 0x676E0067, 0x00007300, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x20796857, 0x20646964, 0x20756F79, 0x64616F6C, 0x4E535A20, 0x67005345, 0x00007300, 0x00000011}, - {0x3F726F66, 0x79725420, 0x6F6E6120, 0x72656874, 0x4E535A00, 0x67005345, 0x00007300, 0x00000011}, - {0x53454E53, 0x756D6520, 0x6F74616C, 0x72002E72, 0x4E535A00, 0x67005345, 0x00007300, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x61656C50, 0x73206573, 0x206E6163, 0x72756F79, 0x4E535A00, 0x67005345, 0x00007300, 0x00000011}, - {0x706D6F63, 0x72657475, 0x726F6620, 0x72697620, 0x73657375, 0x67000021, 0x00007300, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x74206557, 0x6B6E6968, 0x756F7920, 0x6F632072, 0x7475706D, 0x67007265, 0x00007300, 0x00000011}, - {0x65746168, 0x6F792073, 0x42202175, 0x66612065, 0x64696172, 0x67000021, 0x00007300, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x20646944, 0x20756F79, 0x776F6E6B, 0x6C206120, 0x65677261, 0x67000000, 0x00007300, 0x00000011}, - {0x63726570, 0x20746E65, 0x5A20666F, 0x53454E53, 0x73617720, 0x67000000, 0x00007300, 0x00000011}, - {0x61657263, 0x20646574, 0x61207962, 0x73696620, 0x73003F68, 0x67000000, 0x00007300, 0x00000011}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, - - {{0x6E6E6957, 0x20737265, 0x276E6F64, 0x73752074, 0x72642065, 0x2E736775, 0x00007300, 0xB7F1F1E0}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}}, -#ifndef __UNIXSDL__ - {{0x27756F59, 0x73206572, 0x6C6C6974, 0x69737520, 0x6120676E, 0x002E7300, 0x00007300, 0x00000011}, - {0x7263694D, 0x666F736F, 0x534F2074, 0x6547203F, 0x69772074, 0x00006874, 0x00007300, 0x00000011}, - {0x20656874, 0x676F7270, 0x2C6D6172, 0x69777320, 0x20686374, 0x00006F74, 0x00007300, 0x00000011}, - {0x756E694C, 0x726F2078, 0x44534220, 0x6977002E, 0x20686374, 0x00006F74, 0x00007300, 0x00000011}}}; -#else - {{0x656D6F43, 0x2C6E6F20, 0x65737520, 0x72206120, 0x006C6165, 0x00006F74, 0x00007300, 0x00000011}, - {0x7265704F, 0x6E697461, 0x79532067, 0x6D657473, 0x6B696C20, 0x00000065, 0x00007300, 0x00000011}, - {0x646E6957, 0x2C73776F, 0x6F747320, 0x65622070, 0x00676E69, 0x00000065, 0x00007300, 0x00000011}, - {0x66666964, 0x6E657265, 0x6F002E74, 0x65622070, 0x00676E69, 0x00000065, 0x00007300, 0x00000011}}}; -#endif - -unsigned int *horizon_get(unsigned int distance) -{ - return(horizon[distance%21][0]); -} - -extern unsigned int GUICBHold, NumCheats; -extern unsigned char cheatdata[28*255+56]; - -void CheatCodeSave() -{ - FILE *fp = 0; - - GUICBHold=0; - - if (NumCheats) - { - cheatdata[6]=254; - cheatdata[7]=252; - - setextension(ZSaveName, "cht"); - - if ((fp = fopen_dir(ZSramPath,ZSaveName,"wb"))) - { - fwrite(cheatdata, 1, 28*NumCheats, fp); - fclose(fp); - } - } -} - -extern unsigned char CheatOn; -void DisableCheatsOnLoad(), EnableCheatsOnLoad(); -extern unsigned int GUIcurrentcheatcursloc; - -void CheatCodeLoad() -{ - FILE *fp = 0; - unsigned int cheat_file_size, i, j, k; - - setextension(ZSaveName, "cht"); - GUICBHold = 0; - - if ((fp = fopen_dir(ZSramPath,ZSaveName,"rb"))) - { - asm_call(DisableCheatsOnLoad); - - cheat_file_size = fread(cheatdata, 1, 255*28, fp); - fclose(fp); - - if(cheatdata[6]==254 && cheatdata[7]==252) - NumCheats = cheat_file_size / 28; - else - { - NumCheats = cheat_file_size / 18; - i = 28 * NumCheats; - j = cheat_file_size - (cheat_file_size % 18); - - do - { - i-=28; - j-=18; - - for (k=6;k>0;k--) cheatdata[i+k-1]=cheatdata[j+k-1]; - for (k=12;k>0;k--) cheatdata[i+k+7]=cheatdata[j+k+5]; - for (k=8;k>0;k--) cheatdata[i+k+19] = 0; - } while(i>0); - } - - asm_call(EnableCheatsOnLoad); - - if (NumCheats <= GUIcurrentcheatcursloc) GUIcurrentcheatcursloc=NumCheats-1; - if (NumCheats) CheatOn=1; - else GUIcurrentcheatcursloc=CheatOn=0; - } -} - -extern unsigned char *vidbuffer; - -void SaveCheatSearchFile() -{ - FILE *fp = 0; - - if ((fp = fopen_dir(ZCfgPath,"tmpchtsr.___","wb"))) - { - fwrite(vidbuffer+129600, 1, 65536*2+32768, fp); - fclose(fp); - } -} - -void LoadCheatSearchFile() -{ - FILE *fp = 0; - - if ((fp = fopen_dir(ZCfgPath,"tmpchtsr.___","rb"))) - { - fread(vidbuffer+129600, 1, 65536*2+32768, fp); - fclose(fp); - } -} - -extern unsigned char *spcBuffera; - -void dumpsound() -{ - FILE *fp = fopen_dir(ZSpcPath, "sounddmp.raw", "wb"); - if (fp) - { - fwrite(spcBuffera, 1, 65536*4+4096, fp); - fclose(fp); - } -} - -static bool snes_extension_match(const char *filename) -{ - char *dot = strrchr(filename, '.'); - if (dot) - { - dot++; - if (!strcasecmp(dot, "sfc") || - !strcasecmp(dot, "jma") || - !strcasecmp(dot, "zip") || - !strcasecmp(dot, "gz") || - !strcasecmp(dot, "st") || - !strcasecmp(dot, "bs") || - !strcasecmp(dot, "smc") || - !strcasecmp(dot, "swc") || - !strcasecmp(dot, "fig") || - !strcasecmp(dot, "dx2") || - !strcasecmp(dot, "ufo") || - !strcasecmp(dot, "gd3") || - !strcasecmp(dot, "gd7") || - !strcasecmp(dot, "mgd") || - !strcasecmp(dot, "mgh") || - !strcasecmp(dot, "048") || - !strcasecmp(dot, "058") || - !strcasecmp(dot, "078") || - !strcasecmp(dot, "bin") || - !strcasecmp(dot, "usa") || - !strcasecmp(dot, "eur") || - !strcasecmp(dot, "jap") || - !strcasecmp(dot, "aus") || - !strcasecmp(dot, "1") || - !strcasecmp(dot, "a")) - { - return(true); - } - } - return(false); -} - -#define HEADER_SIZE 512 -#define INFO_LEN (0xFF - 0xC0) -#define INAME_LEN 21 - -static const char *get_rom_name(const char *filename, char *namebuffer, struct stat *filestats) -{ - int InfoScore(char *); - unsigned int sum(unsigned char *array, unsigned int size); - - char *last_dot = strrchr(filename, '.'); - if (!last_dot || (strcasecmp(last_dot, ".zip") && strcasecmp(last_dot, ".gz") && strcasecmp(last_dot, ".jma"))) - { - if ((filestats->st_size >= 0x8000) && (filestats->st_size <= 0x600000+HEADER_SIZE)) - { - FILE *fp = fopen_dir(ZRomPath, filename, "rb"); - if (fp) - { - unsigned char HeaderBuffer[HEADER_SIZE]; - int HeaderSize = 0, HasHeadScore = 0, NoHeadScore = 0, HeadRemain = filestats->st_size & 0x7FFF; - bool EHi = false; - - switch(HeadRemain) - { - case 0: - NoHeadScore += 3; - break; - - case HEADER_SIZE: - HasHeadScore += 2; - break; - } - - fread(HeaderBuffer, 1, HEADER_SIZE, fp); - - if (sum(HeaderBuffer, HEADER_SIZE) < 2500) { HasHeadScore += 2; } - - //SMC/SWC Header - if (HeaderBuffer[8] == 0xAA && HeaderBuffer[9] == 0xBB && HeaderBuffer[10]== 4) - { - HasHeadScore += 3; - } - //FIG Header - else if ((HeaderBuffer[4] == 0x77 && HeaderBuffer[5] == 0x83) || - (HeaderBuffer[4] == 0xDD && HeaderBuffer[5] == 0x82) || - (HeaderBuffer[4] == 0xDD && HeaderBuffer[5] == 2) || - (HeaderBuffer[4] == 0xF7 && HeaderBuffer[5] == 0x83) || - (HeaderBuffer[4] == 0xFD && HeaderBuffer[5] == 0x82) || - (HeaderBuffer[4] == 0x00 && HeaderBuffer[5] == 0x80) || - (HeaderBuffer[4] == 0x47 && HeaderBuffer[5] == 0x83) || - (HeaderBuffer[4] == 0x11 && HeaderBuffer[5] == 2)) - { - HasHeadScore += 2; - } - else if (!strncmp("GAME DOCTOR SF 3", (char *)HeaderBuffer, 16)) - { - HasHeadScore += 5; - } - - HeaderSize = HasHeadScore > NoHeadScore ? HEADER_SIZE : 0; - - if (filestats->st_size - HeaderSize >= 0x500000) - { - fseek(fp, 0x40FFC0 + HeaderSize, SEEK_SET); - fread(HeaderBuffer, 1, INFO_LEN, fp); - if (InfoScore((char *)HeaderBuffer) > 1) - { - EHi = true; - strncpy(namebuffer, (char *)HeaderBuffer, INAME_LEN); - } - } - - if (!EHi) - { - if (filestats->st_size - HeaderSize >= 0x10000) - { - char LoHead[INFO_LEN], HiHead[INFO_LEN]; - int LoScore, HiScore; - - fseek(fp, 0x7FC0 + HeaderSize, SEEK_SET); - fread(LoHead, 1, INFO_LEN, fp); - LoScore = InfoScore(LoHead); - - fseek(fp, 0xFFC0 + HeaderSize, SEEK_SET); - fread(HiHead, 1, INFO_LEN, fp); - HiScore = InfoScore(HiHead); - - strncpy(namebuffer, LoScore > HiScore ? LoHead : HiHead, INAME_LEN); - - if (filestats->st_size - HeaderSize >= 0x20000) - { - int IntLScore; - fseek(fp, (filestats->st_size - HeaderSize) / 2 + 0x7FC0 + HeaderSize, SEEK_SET); - fread(LoHead, 1, INFO_LEN, fp); - IntLScore = InfoScore(LoHead) / 2; - - if (IntLScore > LoScore && IntLScore > HiScore) - { - strncpy(namebuffer, LoHead, INAME_LEN); - } - } - } - else //ROM only has one block - { - fseek(fp, 0x7FC0 + HeaderSize, SEEK_SET); - fread(namebuffer, INAME_LEN, 1, fp); - } - } - fclose(fp); - } - else //Couldn't open file - { - strcpy(namebuffer, "** READ FAILURE **"); - } - } - else //Smaller than a block, or Larger than 6MB - { - strcpy(namebuffer, "** INVALID FILE **"); - } - } - else //Compressed archive - { - return(filename); - } - namebuffer[21] = 0; - return(namebuffer); -} - -char **lf_names = 0; //Long File Names -char **et_names = 0; //Eight Three Names -char **i_names = 0; //Internal Names -char **d_names = 0; //Directory Names - -char **selected_names = 0; //Used to point to requested one - -#define LIST_LFN BIT(0) -#define LIST_ETN BIT(1) -#define LIST_IN BIT(2) -#define LIST_DN BIT(3) - -#ifdef __MSDOS__ -#define main_names et_names -#define LIST_MAIN LIST_ETN -#else -#define main_names lf_names -#define LIST_MAIN LIST_LFN -#endif - -#ifndef _USE_LFN -#define _USE_LFN 1 -#endif - -#define swapper(array) if (array) { hold = array[x]; array[x] = array[y]; array[y] = hold; } - -static void swapfiles(size_t x, size_t y) -{ - char *hold; - swapper(lf_names); - swapper(et_names); - swapper(i_names); -} - -static void swapdirs(size_t x, size_t y) -{ - char *hold = d_names[x]; - d_names[x] = d_names[y]; - d_names[y] = hold; -} - -static void sort(intptr_t *array, int begin, int end, void (*swapfunc)(size_t, size_t)) -{ - if (end > begin) - { - intptr_t *pivot = array + begin; - int l = begin + 1; - int r = end; - while (l < r) - { - if (strcasecmp((const char *)*(array+l), (const char *)*pivot) <= 0) - { - l++; - } - else - { - r--; - swapfunc(l, r); - } - } - l--; - swapfunc(begin, l); - sort(array, begin, l, swapfunc); - sort(array, r, end, swapfunc); - } -} - - -void free_list(char ***list) -{ - char **p = *list; - if (p) - { - p += 2; - while (*p) - { - free(*p++); - } - free(*list); - *list = 0; - } -} - -//A possible problem here would be if one of the list arrays got enlarged but a corosponding one ran out of memory -static void add_list(char ***reallist, const char *p) -{ - char **list = *reallist; - if (!list) - { - if (!(list = malloc(1003*sizeof(void *)))) { return; } - list[0] = (char *)2; - list[1] = (char *)1002; - list[2] = 0; - } - - if (list[0] == list[1]-1) - { - char **p = realloc(list, ((size_t)list[1]+1000)*sizeof(void *)); - if (p) - { - list = p; - list[1] += 1000; - } - else - { - return; - } - } - - if ((list[(size_t)*list] = malloc(strlen(p)+1))) - { - strcpy(list[(size_t)*list], p); - list[0]++; - list[(size_t)*list] = 0; - } - *reallist = list; -} - -//Make sure ZRomPath contains a full absolute directory name before calling -void populate_lists(unsigned int lists, bool snes_ext_match) -{ - DIR *dir; - - if ((lists&LIST_DN) && (strlen(ZRomPath) > ROOT_LEN)) - { - add_list(&d_names, ".."); - } - - if ((dir = opendir(ZRomPath))) - { - struct stat stat_buffer; - struct dirent *entry; - - while ((entry = readdir(dir))) - { - if ((*entry->d_name != '.') && !stat_dir(ZRomPath, entry->d_name, &stat_buffer)) - { - if (S_ISDIR(stat_buffer.st_mode)) - { - if (lists&LIST_DN) - { - add_list(&d_names, entry->d_name); - } - } - else if (!snes_ext_match || snes_extension_match(entry->d_name)) - { - if (_USE_LFN && (lists&LIST_LFN)) - { - add_list(&lf_names, entry->d_name); - } - - if (lists&LIST_IN) - { - char namebuffer[22]; - add_list(&i_names, get_rom_name(entry->d_name, namebuffer, &stat_buffer)); - } - -#ifdef __MSDOS__ - if (lists&LIST_ETN) - { - if (!_USE_LFN) //_USE_LFN won't be true when running under pure DOS - { - add_list(&et_names, entry->d_name); - } - else - { - char *sfn = realpath_sfn_dir(ZRomPath, entry->d_name, 0); - if (sfn) - { - add_list(&et_names, basename(sfn)); - free(sfn); - } - else - { - char sfn[13]; - _lfn_gen_short_fname(entry->d_name, sfn); - add_list(&et_names, sfn); - } - } - } -#endif - } - } - } - closedir(dir); - } - - if (lists&LIST_DN) - { -#ifndef __UNIXSDL__ - unsigned int drives = GetLogicalDrives(), i = 0; -#endif - - if (d_names) - { - unsigned int offset = (d_names[2][0] == '.') ? 3 : 2; - sort((intptr_t *)d_names, offset, (size_t)(*d_names), swapdirs); - } - -#ifndef __UNIXSDL__ - while (i < 26) - { - if (drives&BIT(i)) - { - char drive[] = { '[', 'A', ':', ']', 0 }; - drive[1] = 'A'+i; - add_list(&d_names, drive); - } - i++; - } -#endif - } - - if ((lists&LIST_IN) && i_names) - { - sort((intptr_t *)i_names, 2, (size_t)(*i_names), swapfiles); - } - else if ((lists&LIST_LFN) && lf_names) - { - sort((intptr_t *)lf_names, 2, (size_t)(*lf_names), swapfiles); - } - else if ((lists&LIST_ETN) && et_names) - { - sort((intptr_t *)et_names, 2, (size_t)(*et_names), swapfiles); - } -} - -static void memswap(void *p1, void *p2, size_t p2len) -{ - char *ptr1 = (char *)p1; - char *ptr2 = (char *)p2; - - const size_t p1len = ptr2 - ptr1; - unsigned char byte; - while (p2len--) - { - byte = *ptr2++; - memmove(ptr1+1, ptr1, p1len); - *ptr1++ = byte; - } -} - -extern unsigned char GUIwinptr, GUIcmenupos, GUIpmenupos; -extern unsigned char GUIwinorder[], GUIwinactiv[], pressed[]; - -extern char GUIPrevMenuData[]; - -void powercycle(bool, bool); - -void GUIloadfilename(char *filename) -{ - char *p = strdupcat(ZRomPath, filename); - if (p) - { - if (init_rom_path(p)) { powercycle(false, true); } - free(p); - } - if (GUIwinptr) { GUIcmenupos = GUIpmenupos; } -} - -void loadquickfname(const unsigned char slot) -{ - if (prevloaddnamel[1+slot*512]) // replace with better test - { - strcpy(ZRomPath, (char *)prevloaddnamel+1+slot*512); - strcatslash(ZRomPath); - strcpy(ZCartName, (char *)prevloadfnamel+slot*512); - - if (!access_dir(ZRomPath, ZCartName, R_OK)) - { - if (slot || !prevlfreeze) - { - // move menuitem to top - memswap(prevloadiname,prevloadiname+slot*28,28); - memswap(prevloadfnamel,prevloadfnamel+slot*512,512); - memswap(prevloaddnamel,prevloaddnamel+slot*512,512); - } - - GUIloadfilename(ZCartName); - } - } -} - -void GUIQuickLoadUpdate() -{ - size_t entry_size, copy_num, i = 10; - char *src; - - memcpy(GUIPrevMenuData+347, (prevlfreeze) ? " ON " : " OFF", 4); - - src = (char *)prevloadiname; - entry_size = 28; - copy_num = 28; //full window width - - while (i--) - { - char *p_src = src + i*entry_size; - char *p_dest = GUIPrevMenuData+3 + i*32; - size_t srclen = strlen(p_src); - - if (srclen >= copy_num) - { - strncpy(p_dest, p_src, copy_num); - if (srclen > copy_num) { memset(p_dest+25, '.', 3); } - } - else - { - strncpy(p_dest, p_src, srclen); - memset(p_dest+srclen, ' ', 28-srclen); - } - } -} - - -int GUIcurrentviewloc; //current file position -int GUIcurrentcursloc; //current cursor position (GUI) -int GUIcurrentdirviewloc; //current directory position -int GUIcurrentdircursloc; //current dir position (GUI) -int GUIdirentries; -int GUIfileentries; - -void free_all_file_lists() -{ - free_list(&d_names); - free_list(&i_names); - free_list(&lf_names); - free_list(&et_names); -} - -void GetLoadData() -{ - GUIcurrentviewloc = GUIcurrentcursloc = GUIcurrentdirviewloc = GUIcurrentdircursloc = 0; - - free_all_file_lists(); - - switch (GUIloadfntype) - { - case 0: //LFN - populate_lists(LIST_DN|LIST_ETN|LIST_LFN, !showallext); - selected_names = lf_names ? lf_names : et_names; - break; - case 1: //IN - populate_lists(LIST_DN|LIST_MAIN|LIST_IN, !showallext); - selected_names = i_names; - break; - default: - populate_lists(LIST_DN|LIST_MAIN, !showallext); - selected_names = main_names; - break; - } - selected_names += 2; - GUIfileentries = main_names ? ((unsigned int)(*main_names))-2 : 0; - GUIdirentries = d_names ? ((unsigned int)(*d_names))-2 : 0; -} - -unsigned int GUIcurrentfilewin; -unsigned int GUIdirStartLoc; - -void GUILoadData() -{ - char *nameptr; - - GUICBHold = 0; - if (GUIcurrentfilewin) // directories - { - nameptr = d_names[GUIcurrentdircursloc+2]; - - strcatslash(ZRomPath); - #ifndef __UNIXSDL__ - if ((strlen(nameptr) == 4) && (nameptr[2] == ':')) // MS drives are stored as '[?:]', - { // so we can't use quick string catenation to browse through - strncpy(ZRomPath, nameptr+1, 2); - ZRomPath[2] = '\\'; - ZRomPath[3] = 0; - } - else - #endif - { - if (!strcmp(nameptr, "..")) - { - strdirname(ZRomPath); - } - else - { - strcat(ZRomPath, nameptr); - } - strcatslash(ZRomPath); - } - - GetLoadData(); - } - else // files - { - nameptr = main_names[GUIcurrentcursloc+2]; - - strcpy(ZCartName, nameptr); - - if (!prevlfreeze) - { - int i = 0; - bool dupfound = false; - bool modheader = true; - - while (!dupfound && i<10) - { - dupfound = (!fnamencmp(nameptr, (char *)prevloadfnamel+i*512, 512) && (!fnamencmp(ZRomPath, (char *)prevloaddnamel+i*512+1, 512))); - if(dupfound && modheader) - { - strncpy((char *)prevloadiname+i*28, selected_names[GUIcurrentcursloc], 28); - prevloadiname[i*28+27] = 0; - modheader = false; - } - i++; - } - i--; - - if (!dupfound) - { - strncpy((char *)prevloadiname+9*28, selected_names[GUIcurrentcursloc], 28); - prevloadiname[9*28+27] = 0; - strcpy((char *)prevloaddnamel+9*512+1, ZRomPath); - strcpy((char *)prevloadfnamel+9*512, ZCartName); - } - - loadquickfname(i); - } - else - { - GUIloadfilename(ZCartName); - } - - GUIwinactiv[1] = 0; // close load dialog - GUIwinorder[--GUIwinptr] = 0; - } -} - -extern char GUILoadTextA[]; -extern unsigned char GUILoadPos; - -void GUILoadManualDir() -{ - - if (*GUILoadTextA) - { - char path_buff[PATH_SIZE]; - bool realpath_success; - - if ((GUILoadPos > ROOT_LEN) && (GUILoadTextA[GUILoadPos-1] == DIR_SLASH_C)) - { - GUILoadTextA[GUILoadPos-1] = 0; - } - - realpath_success = (int)realpath_dir(ZRomPath, GUILoadTextA, path_buff); - if (realpath_success) - { - struct stat stat_buffer; - if (!stat(path_buff, &stat_buffer)) - { - if (S_ISDIR(stat_buffer.st_mode)) - { - strcpy(ZRomPath, path_buff); - strcatslash(ZRomPath); - GetLoadData(); - } - else - { - if (init_rom_path(path_buff)) { powercycle(false, true); } - } - return; - } - } - } - - GUILoadData(); -} - - -unsigned char gui_key; -unsigned char gui_key_extended; -int GUILoadKeysNavigate() -{ -#ifdef __UNIXSDL__ - extern unsigned int numlockptr; -#endif - - int *currentviewloc, *currentcursloc, *entries; - if (GUIcurrentfilewin == 1) - { - currentviewloc = &GUIcurrentdirviewloc; - currentcursloc = &GUIcurrentdircursloc; - entries = &GUIdirentries; - } - else - { - currentviewloc = &GUIcurrentviewloc; - currentcursloc = &GUIcurrentcursloc; - entries = &GUIfileentries; - } - - //Handle left and right - if(GUIfileentries && GUIdirentries) - { - #ifdef __UNIXSDL__ - if ((gui_key_extended == 92) || ((numlockptr != 1) && (gui_key_extended == 75))) - #else - if (gui_key_extended == 75) - #endif - { - GUILoadPos = 0; - GUIcurrentfilewin ^= 1; - return(1); - } - - #ifdef __UNIXSDL__ - if ((gui_key_extended == 94) || ((numlockptr != 1) && (gui_key_extended == 77))) - #else - if(gui_key_extended == 77) - #endif - { - GUILoadPos = 0; - GUIcurrentfilewin ^= 1; - return(1); - } - } - - //Enter press - if (gui_key_extended == 13) - { - GUILoadPos = 0; - GUILoadManualDir(); - return(1); - } - - //Home key - #ifdef __UNIXSDL__ - if ((gui_key_extended == 89)||((numlockptr != 1) && (gui_key_extended == 71))) - #else - if (gui_key_extended == 71) - #endif - { - GUILoadPos = 0; - *currentcursloc = 0; - *currentviewloc = 0; - return(1); - } - - //End key - #ifdef __UNIXSDL__ - if ((gui_key_extended == 95)||((numlockptr != 1) && (gui_key_extended == 79))) - #else - if (gui_key_extended == 79) - #endif - { - GUILoadPos = 0; - *currentcursloc = (*entries)-1; - *currentviewloc = (*entries)-15; - if (*currentviewloc < 0) - { - *currentviewloc = 0; - } - return(1); - } - - //Up arrow key - #ifdef __UNIXSDL__ - if ((gui_key_extended == 90)||((numlockptr != 1) && (gui_key_extended == 72))) - #else - if (gui_key_extended == 72) - #endif - { - GUILoadPos = 0; - if (*currentcursloc) - { - if (*currentviewloc == *currentcursloc) - { - (*currentviewloc)--; - } - (*currentcursloc)--; - } - return(1); - } - - //Down arrow key - #ifdef __UNIXSDL__ - if ((gui_key_extended == 96)||((numlockptr != 1) && (gui_key_extended == 80))) - #else - if (gui_key_extended == 80) - #endif - { - GUILoadPos = 0; - if ((*currentcursloc)+1 != *entries) - { - (*currentcursloc)++; - if ((*currentcursloc)-15 == *currentviewloc) - { - (*currentviewloc)++; - } - } - return(1); - } - - //Page up key - #ifdef __UNIXSDL__ - if ((gui_key_extended == 91)||((numlockptr != 1) && (gui_key_extended == 73))) - #else - if (gui_key_extended == 73) - #endif - { - GUILoadPos = 0; - *currentviewloc -= 15; - *currentcursloc -= 15; - if (*currentviewloc < 0) - { - *currentviewloc = 0; - } - if (*currentcursloc < 0) - { - *currentcursloc = 0; - } - return(1); - } - - //Page down key - #ifdef __UNIXSDL__ - if ((gui_key_extended == 97)||((numlockptr != 1) && (gui_key_extended == 81))) - #else - if (gui_key_extended == 81) - #endif - { - GUILoadPos = 0; - *currentviewloc += 15; - *currentcursloc += 15; - if (*currentcursloc >= (*entries)-1) - { - *currentcursloc = (*entries)-1; - } - if (*currentviewloc >= (*entries)-15) - { - *currentviewloc = ((*entries)-15)>0 ? (*entries)-15 : 0; - } - return(1); - } - - return(0); -} - -#ifdef __UNIXSDL__ -#define DriveCount() 0 -#else -static unsigned int DriveCount() -{ - unsigned int drives = GetLogicalDrives(), count = 0, i = 0; - while (i < 26) - { - if (drives&BIT(i)) - { - count++; - } - i++; - } - return(count); -} -#endif - -int *GUIJT_currentviewloc, *GUIJT_currentcursloc, GUIJT_entries, GUIJT_offset, GUIJT_viewable; - -void GUIGenericJumpTo() -{ - int mid = GUIJT_viewable>>1; - *GUIJT_currentviewloc = (GUIJT_offset < GUIJT_entries-mid) ? GUIJT_offset-mid : GUIJT_entries-GUIJT_viewable; - if (*GUIJT_currentviewloc < 0) { *GUIJT_currentviewloc = 0; } - *GUIJT_currentcursloc = GUIJT_offset; -} - -void GUILoadKeysJumpTo() -{ - char **base; - int start, end; - - GUILoadTextA[GUILoadPos] = 0; - - if (GUIcurrentfilewin == 1) - { - GUIJT_currentviewloc = &GUIcurrentdirviewloc; - GUIJT_currentcursloc = &GUIcurrentdircursloc; - GUIJT_entries = GUIdirentries; - base = d_names+2; - if (!strcmp(*base, "..")) - { - base++; - GUIJT_entries--; - } - - GUIJT_entries -= DriveCount(); - } - else - { - GUIJT_currentviewloc = &GUIcurrentviewloc; - GUIJT_currentcursloc = &GUIcurrentcursloc; - GUIJT_entries = GUIfileentries; - base = selected_names; - } - - start = 0; - end = GUIJT_entries-1; - GUIJT_offset = GUIJT_entries; - if (!strcmp(GUILoadTextA, " ")) //Exactly a space picks a game randomely - { - GUIJT_offset = rand()%GUIJT_entries; - } - else - { - while (start <= end) - { - int mid = (start+end)>>1; - int pos = strncasecmp(base[mid], GUILoadTextA, GUILoadPos); - if (!pos) - { - do - { - GUIJT_offset = mid--; - } while ((mid >= 0) && !strncasecmp(base[mid], GUILoadTextA, GUILoadPos)); - break; - } - if (pos > 0) - { - end = mid-1; - } - else - { - start = mid+1; - } - } - } - - if (GUIJT_offset < GUIJT_entries) - { - if (GUIcurrentfilewin == 1) - { - GUIJT_entries += DriveCount(); - if (base > d_names+2) - { - GUIJT_offset++; - GUIJT_entries++; - } - } - - GUIJT_viewable = 15; - GUIGenericJumpTo(); - } -} - -//Not entirely accurate pow, but good for most needs and very fast -static unsigned int npow(register unsigned int base, register unsigned int exponent) -{ - register unsigned int total = 1; - if (exponent) - { - register unsigned int i; - for (i = 2, total = base; i < exponent; i += i) - { - total *= total; - } - for (i >>= 1; i < exponent; i++) - { - total *= base; - } - } - return(total); -} - -static void int_to_str(char *dest, unsigned int len, unsigned int num) -{ - *dest = 0; - if (len && (num < npow(10, len))) - { - int i; - for (i = 1; num; i++) - { - memmove(dest+1, dest, i); - *dest = (num%10)+'0'; - num /= 10; - } - } -} - -#ifndef __MSDOS__ - -char GUICustomX[5], GUICustomY[5]; -void GetCustomXY() -{ - static bool first_time = true; - if (first_time) - { - int_to_str(GUICustomX, 4, CustomResX); - int_to_str(GUICustomY, 4, CustomResY); - first_time = false; - } -} - -void SetCustomXY() -{ - if(!((atoi(GUICustomX) < 256) || (atoi(GUICustomX) > 2048) || (atoi(GUICustomY) < 224) || (atoi(GUICustomY) > 1536))) - { - CustomResX = atoi(GUICustomX); - CustomResY = atoi(GUICustomY); - if(CustomResX < 298) - Keep4_3Ratio = 0; - } -} - -extern char ShowKeep43; - -void Keep43Check() -{ - if((CustomResX*3) == (CustomResY*4)) - ShowKeep43 = 0; - else - ShowKeep43 = 1; -} - -#endif - -extern unsigned int MovieForcedLength; -char GUIMovieForcedText[11]; - -void GetMovieForcedLength() -{ - static bool first_time = true; - if (first_time) - { - int_to_str(GUIMovieForcedText, 10, MovieForcedLength); - first_time = false; - } -} - -void SetMovieForcedLength() -{ - MovieForcedLength = atoi(GUIMovieForcedText); -} diff --git a/tools/zsnes/src/gui/guikeys.inc b/tools/zsnes/src/gui/guikeys.inc deleted file mode 100644 index 708e519..0000000 --- a/tools/zsnes/src/gui/guikeys.inc +++ /dev/null @@ -1,2959 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -; GUI Keyboard Routines - -%macro GUIqcheckkeys 1 - cmp byte[pressed+%1],1 - jne %%skip - mov dword[GUIfirstkey],1 -%%skip -%endmacro - -%macro GUIqcheckkeys2 2 - mov eax,%1 - cmp byte[pressed+eax],1 - jne %%skip - cmp byte[GUIJoyPadnk+%2],2 - je %%skip - mov dword[GUIfirstkey],1 -%%skip -%endmacro - -%macro GUIgetprkeys 2 - cmp byte[pressed+%1],1 - je %%okay - cmp byte[pressed+%1],2 - jne %%nopr - cmp dword[GUIfirstkey],1 - je %%nopr - cmp dword[GUIlastkey],%1 - jne %%nopr - jmp %%skipnext -%%okay - mov dword[GUInextkeydelay],10 -%%skipnext - mov dword[GUIlastkey],%1 - mov byte[pressed+%1],2 - cmp dword[GUIkeydelay],0 - jne near .done - mov eax,[GUInextkeydelay] - mov [GUIkeydelay],eax - mov dword[GUInextkeydelay],2 - mov eax,%2 - jmp .done -%%nopr -%endmacro - -%macro GUIgetprkeysb 2 - cmp byte[pressed+%1],1 - jne %%nopr - cmp byte[GUIescpress],1 - je %%nopr2 - mov byte[pressed+%1],2 - mov eax,%2 - jmp .done -%%nopr - cmp byte[pressed+%1],0 - jne %%nopr2 - mov byte[GUIescpress],0 -%%nopr2 -%endmacro - -%macro GUIgetprkeys2 3 - mov ebx,%1 - cmp byte[pressed+ebx],0 - jne %%pressed - mov byte[GUIJoyPadnk+%3],0 - jmp %%nopr -%%pressed - cmp byte[GUIJoyPadnk+%3],2 - je %%secondpress - cmp byte[pressed+ebx],1 - je %%okay -%%secondpress - cmp dword[GUIfirstkey],1 - je %%nopr - cmp dword[GUIlastkey],ebx - jne %%nopr - jmp %%skipnext -%%okay - mov dword[GUInextkeydelay],10 -%%skipnext - mov [GUIlastkey],ebx - mov byte[GUIJoyPadnk+%3],2 - cmp dword[GUIkeydelay],0 - jne near .done - mov eax,[GUInextkeydelay] - mov [GUIkeydelay],eax - mov byte[GUIDelayB],5 - mov dword[GUInextkeydelay],2 - mov eax,%2 - jmp .done -%%nopr -%endmacro - -%macro GUIkeystoggleoptn 2 - cmp %1,%2 - jne %%set - xor %1,%2 - jmp %%clear -%%set - mov %1,%2 -%%clear - ret -%endmacro - -%macro GUIKeyCheckbox 2 - cmp dh,%2 - jne %%nohotkey - xor byte[%1],1 -%%nohotkey -%endmacro - -%macro GUIKeyButtonHole 3 - cmp dh,%3 - jne %%nohotkey - mov byte[%1],%2 -%%nohotkey -%endmacro - -%macro ToUpperASM 0 - cmp dh,'a' - jb %%notlcase - cmp dh,'z' - ja %%notlcase - sub dh,'a'-'A' -%%notlcase -%endmacro - -%macro FilterExcl2 1-* ; bytes to zero -%rep (%0) - mov byte[%1],0 - %rotate 1 -%endrep -%endmacro - -%ifdef __MSDOS__ -%macro DOSClearScreenKey 0 - call DOSClearScreen - push eax - push ecx - mov eax,[vidbufferofsb] - mov ecx,288*128 -%%sloop - mov dword[eax],0 - add eax,4 - dec ecx - jnz %%sloop - pop ecx - pop eax -%endmacro -%endif - -SECTION .bss -GUIfirstkey resd 1 -GUIlastkey resd 1 -NEWSYM GUIkeydelay, resd 1 -NEWSYM GUIkeydelay2, resd 1 -GUInextkeydelay resd 1 -GUIJoyPadnk resb 8 -NEWSYM GUIDelayB, resb 1 -UseExtKey resb 1 - -SECTION .text - -GUIgetcurrentinput: - mov byte[UseExtKey],0 - xor cx,cx -.getnextkey - call Check_Key - or al,al - jz .nokeyd - call Get_Key - cmp cl,0 - jne .nostorekey - mov ch,al -.nostorekey - xor cl,cl - cmp al,0 - jne .noextkey - call Get_Key - mov [UseExtKey],al - xor al,al - mov ch,al - mov cl,1 -.noextkey -; jmp .getnextkey -.nokeyd - mov dh,ch - mov byte[GUIDelayB],0 - ; Convert pressed to keys - mov dword[GUIfirstkey],0 -%ifdef __UNIXSDL___ - GUIqcheckkeys 90 ; UP - GUIqcheckkeys 96 ; DOWN - GUIqcheckkeys 92 ; LEFT - GUIqcheckkeys 94 ; RIGHT - GUIqcheckkeys 89 ; HOME - GUIqcheckkeys 91 ; PGUP - GUIqcheckkeys 95 ; END - GUIqcheckkeys 97 ; PGDOWN -%endif - GUIqcheckkeys 72 ; NUMPAD STUFF - GUIqcheckkeys 80 - GUIqcheckkeys 75 - GUIqcheckkeys 77 - GUIqcheckkeys 73 - GUIqcheckkeys 81 - GUIqcheckkeys 71 - GUIqcheckkeys 79 - GUIqcheckkeys 1 - GUIqcheckkeys 1Ch - -%ifndef __MSDOS__ - GUIqcheckkeys 0C8h - GUIqcheckkeys 0D0h - GUIqcheckkeys 0CBh - GUIqcheckkeys 0CDh - GUIqcheckkeys 0C9h - GUIqcheckkeys 0D1h - GUIqcheckkeys 0C7h - GUIqcheckkeys 0CFh - GUIqcheckkeys 09Ch -%endif -.notwinport - - cmp byte[JoyPad1Move],0 - je near .nopad1 - push edx - call JoyRead - pop edx - GUIqcheckkeys2 [pl1upk],0 - GUIqcheckkeys2 [pl1downk],1 - GUIqcheckkeys2 [pl1leftk],2 - GUIqcheckkeys2 [pl1rightk],3 - GUIqcheckkeys2 [pl1Lk],4 - GUIqcheckkeys2 [pl1Rk],5 - GUIqcheckkeys2 [pl1Bk],6 - GUIqcheckkeys2 [pl1Ak],7 -.nopad1 - xor al,al -%ifdef __UNIXSDL__ - GUIgetprkeys 90,90 ; UP - GUIgetprkeys 96,96 ; DOWN - GUIgetprkeys 92,92 ; LEFT - GUIgetprkeys 94,94 ; RIGHT - GUIgetprkeys 89,89 ; HOME - GUIgetprkeys 91,91 ; PGUP - GUIgetprkeys 95,95 ; END - GUIgetprkeys 97,97 ; PGDOWN - - GUIgetprkeys 72,72 ; KP8 - GUIgetprkeys 80,80 ; KP2 - GUIgetprkeys 75,75 ; KP4 - GUIgetprkeys 77,77 ; KP6 - GUIgetprkeys 71,71 ; KP7 - GUIgetprkeys 79,79 ; KP9 - GUIgetprkeys 81,81 ; KP1 - GUIgetprkeys 73,73 ; KP3 -%else - GUIgetprkeys 72,72 - GUIgetprkeys 80,80 - GUIgetprkeys 75,75 - GUIgetprkeys 77,77 - GUIgetprkeys 71,71 - GUIgetprkeys 79,79 - GUIgetprkeys 81,81 - GUIgetprkeys 73,73 -%endif - GUIgetprkeysb 1,27 - GUIgetprkeys 1Ch,13 - - mov cl,[UseExtKey] - cmp cl,72 - je .okayextk - cmp cl,80 - jne .notextkb -.okayextk - mov al,cl -.notextkb - -%ifdef __UNIXSDL__ - GUIgetprkeys 90,90 ; UP - GUIgetprkeys 96,96 ; DOWN - GUIgetprkeys 92,92 ; LEFT - GUIgetprkeys 94,94 ; RIGHT - GUIgetprkeys 89,89 ; HOME - GUIgetprkeys 91,91 ; PGUP - GUIgetprkeys 95,95 ; END - GUIgetprkeys 97,97 ; PGDOWN - - GUIgetprkeys 72,72 ; KP8 - GUIgetprkeys 80,80 ; KP2 - GUIgetprkeys 75,75 ; KP4 - GUIgetprkeys 77,77 ; KP6 - GUIgetprkeys 71,71 ; KP7 - GUIgetprkeys 79,79 ; KP9 - GUIgetprkeys 81,81 ; KP1 - GUIgetprkeys 73,73 ; KP3 - - GUIgetprkeys 09Ch,13 ; ENTER -%endif -%ifdef __WIN32__ - ;GUIgetprkeys 0C8h,72 - ;GUIgetprkeys 0D0h,80 - GUIgetprkeys 0CBh,75 - GUIgetprkeys 0CDh,77 - GUIgetprkeys 0C7h,71 - GUIgetprkeys 0CFh,79 - GUIgetprkeys 0D1h,81 - GUIgetprkeys 0C9h,73 - GUIgetprkeys 09Ch,13 -%endif -;.notwinport2 - - cmp byte[JoyPad1Move],0 - je near .nopad1b - GUIgetprkeys2 [pl1upk],72,0 - GUIgetprkeys2 [pl1downk],80,1 - GUIgetprkeys2 [pl1leftk],75,2 - GUIgetprkeys2 [pl1rightk],77,3 - GUIgetprkeys2 [pl1Lk],73,4 - GUIgetprkeys2 [pl1Rk],81,5 - GUIgetprkeys2 [pl1Bk],27,6 - GUIgetprkeys2 [pl1Ak],13,7 -.nopad1b - cmp dh,' ' - jne .notspace - mov al,' ' -.notspace - mov dword[GUInextkeydelay],10 - mov dword[GUIkeydelay],0 -.done - cmp byte[GUIcmenupos],0 - jne near .processmenu - mov dl,al - xor eax,eax - mov al,[GUIwinptr] - cmp dl,27 - jne .noclosewin - or eax,eax - jz near .runprog -.noclosewin - dec eax - xor ebx,ebx - mov bl,[GUIwinorder+eax] - cmp ebx,13 - jne .notcskeys - cmp byte[CheatWinMode],1 - ja .avoidesc -.notcskeys - cmp dl,27 - je near .closewin -.avoidesc - mov al,dl - cmp ebx,1 - je near GUILoadKeys - cmp ebx,2 - je near GUIStateSelKeys - cmp ebx,3 - je near GUIInputKeys - cmp ebx,4 - je near GUIOptionKeys - cmp ebx,5 - je near GUIVideoKeys - cmp ebx,6 - je near GUISoundKeys - cmp ebx,7 - je near GUICheatKeys - cmp ebx,10 - je near GUIGUIOptnsKeys - cmp ebx,11 - je near GUIAboutKeys - cmp ebx,12 - je near GUIResetKeys - cmp ebx,13 - je near GUICheatSearchKeys - cmp ebx,14 - je near GUIStateKeys - cmp ebx,15 - je near GUIMovieKeys - cmp ebx,16 - je near GUIComboKeys - cmp ebx,17 - je near GUIAddonKeys - cmp ebx,18 - je near GUIChipKeys - cmp ebx,19 - je near GUIPathKeys - cmp ebx,20 - je near GUISaveKeys - cmp ebx,21 - je near GUISpeedKeys - cmp ebx,8 - je near GUIGetInputLine - ret -.runprog - cmp byte[romloadskip],0 - jne .noquit - mov byte[GUIQuit],2 -.noquit - ret -.closewin - ; close window - mov byte[GUIwinorder+eax],0 - mov byte[GUIwinactiv+ebx],0 - dec byte[GUIwinptr] - cmp byte[GUIwinptr],0 - jne .nowinopen - mov al,[GUIpmenupos] - mov [GUIcmenupos],al -.nowinopen - ret -.processmenu - ToUpperASM - cmp dh,'X' ; Main Menu Hotkeys - jne .noclose - mov byte[GUIcmenupos],0 - mov byte[GUIcrowpos],0 -.noclose - cmp dh,'R' - jne .norecent - mov byte[GUIcmenupos],1 - mov byte[GUIcrowpos],0 -.norecent - cmp dh,'G' - jne .nogame - mov byte[GUIcmenupos],2 - mov byte[GUIcrowpos],0 -.nogame - cmp dh,'C' - jne .noconfig - mov byte[GUIcmenupos],3 - mov byte[GUIcrowpos],0 -.noconfig - cmp dh,'H' - jne .nocheat - mov byte[GUIcmenupos],4 - mov byte[GUIcrowpos],0 -.nocheat - cmp dh,'N' - jne .nonetplay - mov byte[GUIcmenupos],5 - mov byte[GUIcrowpos],0 -.nonetplay - cmp dh,'M' - jne .nomisc - mov byte[GUIcmenupos],6 - mov byte[GUIcrowpos],0 -.nomisc - cmp byte[GUIcmenupos],1 ; Recently Played Hotkeys - jne near .noquickmenu - cmp dh,'1' - jne .no1 - mov byte[GUIcrowpos],0 -.no1 - cmp dh,'2' - jne .no2 - mov byte[GUIcrowpos],1 -.no2 - cmp dh,'3' - jne .no3 - mov byte[GUIcrowpos],2 -.no3 - cmp dh,'4' - jne .no4 - mov byte[GUIcrowpos],3 -.no4 - cmp dh,'5' - jne .no5 - mov byte[GUIcrowpos],4 -.no5 - cmp dh,'6' - jne .no6 - mov byte[GUIcrowpos],5 -.no6 - cmp dh,'7' - jne .no7 - mov byte[GUIcrowpos],6 -.no7 - cmp dh,'8' - jne .no8 - mov byte[GUIcrowpos],7 -.no8 - cmp dh,'9' - jne .no9 - mov byte[GUIcrowpos],8 -.no9 - cmp dh,'0' - jne .no0 - mov byte[GUIcrowpos],9 -.no0 - cmp dh,'F' - jne .nof - mov byte[GUIcrowpos],11 -.nof - cmp dh,'L' - jne .nol - mov byte[GUIcrowpos],12 -.nol -.noquickmenu ; Game Hotkeys - cmp byte[GUIcmenupos],2 - jne near .noloadmenu - cmp dh,'L' - jne .noll - mov byte[GUIcrowpos],0 -.noll - cmp dh,'E' - jne .nor - mov byte[GUIcrowpos],2 -.nor - cmp dh,'S' - jne .nos - mov byte[GUIcrowpos],4 -.nos - cmp dh,'O' - jne .noo - mov byte[GUIcrowpos],5 -.noo - cmp dh,'P' - jne .nop - mov byte[GUIcrowpos],6 -.nop - cmp dh,'Q' - jne .noq - mov byte[GUIcrowpos],8 -.noq -.noloadmenu ; Config Hotkeys - cmp byte[GUIcmenupos],3 - jne near .noconfigmenu - cmp dh,'I' - jne .noin - mov byte[GUIcrowpos],0 -.noin - cmp dh,'D' - jne .noind - mov byte[GUIcrowpos],2 -.noind - cmp dh,'F' - jne .noinc - mov byte[GUIcrowpos],3 -.noinc - cmp dh,'O' - jne .noino - mov byte[GUIcrowpos],5 -.noino - cmp dh,'V' - jne .noinv - mov byte[GUIcrowpos],6 -.noinv - cmp dh,'S' - jne .noins - mov byte[GUIcrowpos],7 -.noins - cmp dh,'P' - jne .noinp - mov byte[GUIcrowpos],8 -.noinp - cmp dh,'A' - jne .noina - mov byte[GUIcrowpos],9 -.noina - cmp dh,'E' - jne .noine - mov byte[GUIcrowpos],10 -.noine -.noconfigmenu ; Cheat Hotkeys - cmp byte[GUIcmenupos],4 - jne near .nocheatmenu - cmp dh,'A' - jne .noa - mov byte[GUIcrowpos],0 -.noa - cmp dh,'B' - jne .nob - mov byte[GUIcrowpos],1 -.nob - cmp dh,'S' - jne .nos2 - mov byte[GUIcrowpos],2 -.nos2 -.nocheatmenu ; Misc Hotkeys - cmp byte[GUIcmenupos],6 - jne near .nomiscmenu - cmp dh,'K' - jne .nomk - mov byte[GUIcrowpos],0 -.nomk - cmp dh,'U' - jne .nomu - mov byte[GUIcrowpos],1 -.nomu - cmp dh,'O' - jne .nomo - mov byte[GUIcrowpos],2 -.nomo - cmp dh,'E' - jne .nome - mov byte[GUIcrowpos],3 -.nome - cmp dh,'S' - jne .noms - mov byte[GUIcrowpos],4 -.noms - cmp dh,'A' - jne .noma - mov byte[GUIcrowpos],6 -.noma -.nomiscmenu - - cmp byte[romloadskip],0 - jne .dontquit - cmp al,27 - jne .noexit - mov byte[GUIQuit],2 -.noexit -.dontquit - cmp al,13 - jne .noenter - call GUITryMenuItem -.noenter -%ifdef __UNIXSDL__ - cmp al,92 - je .leftpressed - cmp dword[numlockptr],1 - je .noleft - cmp al,75 - jne .noleft -.leftpressed -%else - cmp al,75 - jne .noleft -%endif - mov byte[GUIcrowpos],0 - cmp byte[GUIcmenupos],1 - jbe .left - dec byte[GUIcmenupos] - jmp .noleft -.left - mov byte[GUIcmenupos],6 -.noleft -%ifdef __UNIXSDL__ - cmp al,94 - je .rightpressed - cmp dword[numlockptr],1 - je .noright - cmp al,77 - jne .noright -.rightpressed -%else - cmp al,77 - jne .noright -%endif - mov byte[GUIcrowpos],0 - inc byte[GUIcmenupos] - cmp byte[GUIcmenupos],7 - jne .noright - mov byte[GUIcmenupos],1 -.noright - cmp byte[GUIcmenupos],0 - je near .noupdown -%ifdef __UNIXSDL__ - cmp al,96 - je .downpressed - cmp dword[numlockptr],1 - je .nodown - cmp al,80 - jne .nodown -.downpressed -%else - cmp al,80 - jne .nodown -%endif - xor eax,eax - mov al,[GUIcrowpos] - mov ebx,[GUICYLocPtr] - cmp byte[eax+ebx+1],2 - jne .nobottom - mov byte[GUIcrowpos],0 - jmp .nokey -.nobottom - inc eax - cmp byte[eax+ebx+1],0 - je .nobottom - mov [GUIcrowpos],al - jmp .nokey -.nodown -%ifdef __UNIXSDL__ - cmp al, 90 - je .uppressed - cmp dword[numlockptr],1 - je .noup - cmp al,72 - jne .noup -.uppressed -%else - cmp al,72 - jne .noup -%endif - xor eax,eax - mov al,[GUIcrowpos] - mov ebx,[GUICYLocPtr] - or al,al - jz .top - cmp byte[eax+ebx+1],3 - jne .notop -.top - mov al,[ebx] - mov [GUIcrowpos],al - jmp .nokey -.notop - dec eax - cmp byte[eax+ebx+1],0 - je .notop - mov [GUIcrowpos],al - jmp .nokey -.noup -.noupdown -.nokey - ret - -%macro KeyTabInc 1-* ; tab arrays - push edx -%rep %0 - xor edx,edx - mov eax,[%1] - div dword[%1+4] - mov [%1],edx - %rotate 1 - or [%1],eax - cmp eax,1 - je %%exit - %rotate -1 - sub eax,[%1] - adc dword[%1],0 - jnz %%exit - %rotate 1 -%endrep -%%exit - pop edx -%endmacro - -GUIInputKeys: - ToUpperASM - cmp dh,9 - jne .notab - KeyTabInc GUIInputTabs - mov byte[GUIFreshInputSelect],1 -.notab - GUIKeyCheckbox GameSpecificInput,'G' - GUIKeyCheckbox AllowUDLR,'A' - GUIKeyCheckbox Turbo30hz,'T' - cmp dh,'U' - jne .nousepl34 - xor byte[pl12s34],1 - mov byte[MultiTap],1 - cmp byte[pl12s34],1 - je .nomtap - cmp byte[pl3contrl],0 - jne .mtap - cmp byte[pl4contrl],0 - jne .mtap - cmp byte[pl5contrl],0 - jne .mtap -.nomtap - mov byte[MultiTap],0 -.mtap -.nousepl34 -%ifdef __MSDOS__ - GUIKeyCheckbox SidewinderFix,'S' - cmp dh,'J' - jne .nop209 - cmp byte[cplayernum],0 - jne .nopl1 - GUIKeyCheckbox pl1p209,'J' - jmp .nopl5 -.nopl1 - cmp byte[cplayernum],1 - jne .nopl2 - GUIKeyCheckbox pl2p209,'J' - jmp .nopl5 -.nopl2 - cmp byte[cplayernum],2 - jne .nopl3 - GUIKeyCheckbox pl3p209,'J' - jmp .nopl5 -.nopl3 - cmp byte[cplayernum],3 - jne .nopl4 - GUIKeyCheckbox pl4p209,'J' - jmp .nopl5 -.nopl4 - cmp byte[cplayernum],4 - jne .nopl5 - GUIKeyCheckbox pl5p209,'J' -.nopl5 - call SetDevice -.nop209 -%endif - ret - -GUITCPIPKeys: - ret - -GUIOptionKeys: - ToUpperASM - cmp byte[ShowMMXSupport],1 - jne .nommxcopy - GUIKeyCheckbox MMXSupport,'M' ; Checkboxes -.nommxcopy - GUIKeyButtonHole ScreenShotFormat,0,'P' -%ifndef NO_PNG - GUIKeyButtonHole ScreenShotFormat,1,'G' -%endif - GUIKeyCheckbox newengen, 'N' - GUIKeyCheckbox FPSAtStart,'F' - GUIKeyCheckbox TimerEnable,'C' - GUIKeyCheckbox ClockBox,'X' - GUIKeyCheckbox TwelveHourClock,'1' - GUIKeyCheckbox bgfixer,'A' - GUIKeyCheckbox SmallMsgText,'S' - GUIKeyCheckbox AutoPatch,'I' - GUIKeyCheckbox RomInfo,'R' - GUIKeyCheckbox DisplayInfo,'W' - GUIKeyCheckbox GUIEnableTransp,'T' -%ifdef __WIN32__ - GUIKeyCheckbox PauseFocusChange,'B' - GUIKeyCheckbox HighPriority,'O' - pushad - call CheckPriority - popad - GUIKeyCheckbox DisableScreenSaver,'D' - pushad - call CheckScreenSaver - popad -%endif - ret - -GUIAboutKeys: - ToUpperASM - cmp dh,'E' - jne .noeegg - xor byte[EEgg],1 -.noeegg - ret - -GUISaveKeys: - ToUpperASM - GUIKeyCheckbox AutoIncSaveSlot,'I' ; Checkboxes - GUIKeyCheckbox nosaveSRAM,'D' - GUIKeyCheckbox SRAMSave5Sec,'C' - GUIKeyCheckbox LatestSave,'S' - GUIKeyCheckbox AutoState,'A' - GUIKeyCheckbox SRAMState,'L' - GUIKeyCheckbox PauseLoad,'P' - GUIKeyCheckbox PauseRewind,'R' - ret - -GUISpeedKeys: - ToUpperASM - GUIKeyCheckbox FastFwdToggle,'T' ; Checkbox - - cmp dh,'A' ; Framerate Checkboxes - jne .noautofr - cmp byte[frameskip],0 ; 0 = autoframerate / 1-10 = frameskip 0-9 - je .zero - mov byte[frameskip],0 - jmp .notzero -.zero - mov byte[FPSOn],0 - mov byte[frameskip],1 -.notzero -.noautofr - ret - -GUIAddonKeys: - ToUpperASM - GUIKeyButtonHole device1,0,'G' ;Radio Buttons - GUIKeyButtonHole device1,1,'M' - GUIKeyButtonHole device2,0,'A' - GUIKeyButtonHole device2,1,'O' - GUIKeyButtonHole device2,2,'S' - GUIKeyButtonHole device2,3,'1' - GUIKeyButtonHole device2,4,'2' - - GUIKeyCheckbox mouse1lh,'L' ; Checkboxes - GUIKeyCheckbox mouse2lh,'E' - ret - -GUIChipKeys: - ToUpperASM - GUIKeyCheckbox nssdip1,'1' ; Checkboxes - GUIKeyCheckbox nssdip2,'2' - GUIKeyCheckbox nssdip3,'3' - GUIKeyCheckbox nssdip4,'4' - GUIKeyCheckbox nssdip5,'5' - GUIKeyCheckbox nssdip6,'6' - ret - -GUIGUIOptnsKeys: - ToUpperASM - GUIKeyCheckbox mousewrap,'M' ; Checkboxes - GUIKeyCheckbox mouseshad,'S' - GUIKeyCheckbox esctomenu,'G' - GUIKeyCheckbox savewinpos,'W' - GUIKeyCheckbox GUIRClick,'C' - GUIKeyCheckbox JoyPad1Move,'U' - GUIKeyCheckbox newfont,'O' - GUIKeyCheckbox lhguimouse,'/' - - cmp dh,'F' - jne .guioptn8 - xor byte[FilteredGUI],1 -%ifdef __MSDOS__ - call DOSClearScreen -%endif - pushad -%ifdef __OPENGL__ - cmp byte[cvidmode],5 - jl near .skipinit - pushad - call drawscreenwin - call initwinvideo - popad -.skipinit -%endif - call Clear2xSaIBuffer - popad -.guioptn8 - - GUIKeyButtonHole GUIEffect,0,'E' ; Start From Radio Buttons - GUIKeyButtonHole GUIEffect,1,'N' - GUIKeyButtonHole GUIEffect,2,'A' - GUIKeyButtonHole GUIEffect,3,'B' - GUIKeyButtonHole GUIEffect,4,'R' - GUIKeyButtonHole GUIEffect,5,'K' - -%ifdef __WIN32__ - GUIKeyCheckbox MouseWheel,'H' - GUIKeyCheckbox TrapMouseCursor,'P' - GUIKeyCheckbox AlwaysOnTop,'T' - GUIKeyCheckbox SaveMainWindowPos,'V' - GUIKeyCheckbox AllowMultipleInst,'L' -%endif -ret - -GUIVideoKeys: -%ifndef __MSDOS__ - call GUIPathKeys -%endif - cmp dh,9 - jne near .tabdone - cmp byte[NTSCFilter],0 - je near .nontsc - movzx eax,byte[cvidmode] - cmp byte[GUINTVID+eax],0 - je .nontsc - KeyTabInc GUIVideoTabs,GUIVntscTab - jmp .tabdone -.nontsc - KeyTabInc GUIVideoTabs -.tabdone - ToUpperASM - xor eax,eax - cmp dword[GUIVideoTabs],1 - jne near .notmodestab -; "Home" -%ifdef __UNIXSDL__ - cmp dl,89 - je .yeshome - cmp dword[numlockptr],1 - je .nohome - cmp dl,71 - jne .nohome -.yeshome -%else - cmp dl,71 - jne .nohome -%endif - mov dword[GUIcurrentvideocursloc],0 - mov dword[GUIcurrentvideoviewloc],0 -.nohome -; "End" -%ifdef __UNIXSDL__ - cmp dl,95 - je .yesendp - cmp dword[numlockptr],1 - je .noendp - cmp dl,79 - jne .noendp -.yesendp -%else - cmp dl,79 - jne .noendp -%endif - mov eax,[NumVideoModes] - dec eax - mov [GUIcurrentvideocursloc],eax - sub eax,19 - mov [GUIcurrentvideoviewloc],eax - test dword[GUIcurrentvideoviewloc],8000000h - jz .noendp - mov dword[GUIcurrentvideoviewloc],0 -.noendp -; "Up" -%ifdef __UNIXSDL__ - cmp dl,90 - je .up - cmp dword[numlockptr],1 - je .noup - cmp dl,72 - jne .noup -%else - cmp dl,72 - jne .noup -%endif -.up - cmp dword[GUIcurrentvideocursloc],0 - je .noup - mov ebx,[GUIcurrentvideocursloc] - cmp [GUIcurrentvideoviewloc],ebx - jne .noviewdec - dec dword[GUIcurrentvideoviewloc] -.noviewdec - dec dword[GUIcurrentvideocursloc] -.noup -; "Down" -%ifdef __UNIXSDL__ - cmp dl,96 - je .yesdown - cmp dword[numlockptr],1 - je .nodown - cmp dl,80 - jne .nodown -.yesdown -%else - cmp dl,80 - jne .nodown -%endif - mov ebx,[GUIcurrentvideocursloc] - inc ebx - cmp ebx,[NumVideoModes] - je .nodown - inc dword[GUIcurrentvideocursloc] - sub ebx,20 - cmp ebx,[GUIcurrentvideoviewloc] - jne .nodown - inc dword[GUIcurrentvideoviewloc] -.nodown -; "PageUp" -%ifdef __UNIXSDL__ - cmp dl,91 - je .yespageup - cmp dword[numlockptr],1 - je .nopageup - cmp dl,73 - jne .nopageup -.yespageup -%else - cmp dl,73 - jne .nopageup -%endif - sub dword[GUIcurrentvideoviewloc],20 - sub dword[GUIcurrentvideocursloc],20 - test dword[GUIcurrentvideoviewloc],8000000h - jz .posv - mov dword[GUIcurrentvideoviewloc],0 -.posv - test dword[GUIcurrentvideocursloc],8000000h - jz .posc - mov dword[GUIcurrentvideocursloc],0 -.posc -.nopageup -; "PageDown" -%ifdef __UNIXSDL__ - cmp dl,97 - je .yespagedn - cmp dword[numlockptr],1 - je .nopagedown - cmp dl,81 - jne .nopagedown -.yespagedn -%else - cmp dl,81 - jne .nopagedown -%endif - add dword[GUIcurrentvideoviewloc],20 - add dword[GUIcurrentvideocursloc],20 - mov ebx,[NumVideoModes] - dec ebx - cmp dword[GUIcurrentvideocursloc],ebx - jb .poscd - mov [GUIcurrentvideocursloc],ebx -.poscd - sub ebx,19 - cmp dword[GUIcurrentvideoviewloc],ebx - jl .posvd - test ebx,8000000h - jz .noneg - mov ebx,0 -.noneg - mov [GUIcurrentvideoviewloc],ebx -.posvd -.nopagedown -; "Return" - cmp dl,13 - jne .noreturn - mov byte[GUICBHold],4 -.noreturn -.notmodestab - - cmp dword[GUIVideoTabs],2 - jne near .notfilterstab - -%ifdef __MSDOS__ - cmp byte[smallscreenon],1 - je .noquarterscanlines - cmp byte[ScreenScale],1 - je .nohq4x -%endif - cmp dh,'I' - jne .nointerpolation - xor eax,eax - mov al,[cvidmode] -%ifdef __OPENGL__ - cmp byte[GUIBIFIL+eax],0 - je .nobilinearfilter - xor byte[BilinearFilter],1 - FilterExcl2 NTSCFilter - pushad - call drawscreenwin - call initwinvideo - call Clear2xSaIBuffer - popad - jmp .nointerpolation -.nobilinearfilter -%elifdef __MSDOS__ - cmp byte[GUIEAVID+eax],0 - jne .interpolation -%endif -%ifdef __WIN32__ - cmp byte[GUIDSIZE+eax],0 -%else - cmp byte[GUII2VID+eax],0 -%endif - je .nointerpolation -.interpolation - xor byte[antienab],1 - jz near .nointerpolation - FilterExcl2 En2xSaI,hqFilter,NTSCFilter -.nointerpolation - cmp dh,'N' - jne .nontscfilter - xor ebx,ebx - mov bl,[cvidmode] - cmp byte[GUINTVID+ebx],0 - je .nontscfilter - xor byte[NTSCFilter],1 - jz .nontscfilter - FilterExcl2 En2xSaI,hqFilter,scanlines,antienab -%ifdef __OPENGL__ - FilterExcl2 BilinearFilter -%endif -%ifdef __WIN32__ - cmp byte[NTSCFilter],0 - je .noforce4_3 - mov byte[Keep4_3Ratio],1 -.noforce4_3 -%endif -%ifndef __MSDOS__ - pushad - call NTSCFilterInit - popad -%endif -.nontscfilter - xor ebx,ebx - mov bl,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUI2xVID+ebx],0 -%else - cmp byte[GUIDSIZE+ebx],0 -%endif - je near .nosuper2xsai - cmp dh,'S' - jne .no2xsai - mov eax,1 - jmp .yesfilter -.no2xsai - cmp dh,'E' - jne .nosupereagle - mov eax,2 - jmp .yesfilter -.nosupereagle - cmp dh,'P' - jne .nosuper2xsai - mov eax,3 -.yesfilter - pushad - call Clear2xSaIBuffer - popad - FilterExcl2 hqFilter,scanlines,antienab,NTSCFilter - GUIkeystoggleoptn byte[En2xSaI],al -.nosuper2xsai - cmp dh,'Q' - jne .nohqfilter - xor ebx,ebx - mov bl,[cvidmode] - cmp byte[GUIHQ2X+ebx],0 - jne .hqfilter -%ifndef __MSDOS__ - cmp byte[GUIHQ3X+ebx],0 - jne .hqfilter - cmp byte[GUIHQ4X+ebx],0 - jne .hqfilter -%endif - jmp .nohqfilter -.hqfilter - pushad - call Clear2xSaIBuffer - popad - xor byte[hqFilter],1 - jz .nohqfilter - FilterExcl2 scanlines,En2xSaI,antienab,NTSCFilter -.nohqfilter -%ifndef __MSDOS__ - cmp dh,'X' - jne .nohq2x - cmp byte[hqFilter],0 - je .nohq2x - xor ebx,ebx - mov bl,[cvidmode] - cmp byte[GUIHQ2X+ebx],0 - je .nohq2x - pushad - call Clear2xSaIBuffer - popad - GUIKeyButtonHole hqFilterlevel,2,'X' -.nohq2x - cmp dh,'3' - jne .nohq3x - cmp byte[hqFilter],0 - je .nohq3x - xor ebx,ebx - mov bl,[cvidmode] - cmp byte[GUIHQ3X+ebx],0 - je .nohq3x - pushad - call Clear2xSaIBuffer - popad - GUIKeyButtonHole hqFilterlevel,3,'3' -.nohq3x - cmp dh,'4' - jne .nohq4x - cmp byte[hqFilter],0 - je .nohq4x - xor ebx,ebx - mov bl,[cvidmode] - cmp byte[GUIHQ4X+ebx],0 - je .nohq4x - pushad - call Clear2xSaIBuffer - popad - GUIKeyButtonHole hqFilterlevel,4,'4' -%endif -.nohq4x - - xor eax,eax - mov al,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUISLVID+eax],0 -%else - cmp byte[GUIDSIZE+eax],0 -%endif - je .nofullscanlines - GUIKeyButtonHole scanlines,0,'O' - cmp dh,'F' - jne .nofullscanlines - FilterExcl2 En2xSaI,hqFilter,NTSCFilter - pushad -%ifdef __MSDOS__ - call DOSClearScreen - cmp byte[cvidmode],2 ;modeQ - je .refresh - cmp byte[cvidmode],5 - jne .nomodex -.refresh - mov byte[cbitmode],1 - call initvideo2 - mov byte[cbitmode],0 - call GUISetPal -.nomodex -%endif - popad - GUIKeyButtonHole scanlines,1,'F' -.nofullscanlines -%ifdef __MSDOS__ - cmp byte[ScreenScale],1 - je .noquarterscanlines -%endif - xor eax,eax - mov al,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUIHSVID+eax],0 -%else - cmp byte[GUIDSIZE+eax],0 -%endif - je near .noquarterscanlines - cmp dh,'5' - jne .nohalfscanlines - FilterExcl2 En2xSaI,hqFilter,NTSCFilter -%ifdef __MSDOS__ - call DOSClearScreen -%endif - GUIKeyButtonHole scanlines,3,'5' -.nohalfscanlines - cmp dh,'2' - jne .noquarterscanlines - FilterExcl2 En2xSaI,hqFilter,NTSCFilter -%ifdef __MSDOS__ - call DOSClearScreen -%endif - GUIKeyButtonHole scanlines,2,'2' -.noquarterscanlines - cmp dh,'G' - jne .nograyscale - xor byte[GrayscaleMode],1 -.nograyscale - cmp dh,'H' - jne .nohiresmode7 - xor ebx,ebx - mov bl,[cvidmode] - cmp byte[GUIM7VID+ebx],0 - je .nohiresmode7 - xor byte[Mode7HiRes16b],1 -.nohiresmode7 -%ifndef __UNIXSDL__ - cmp dh,'V' - jne .novsync - xor byte[vsyncon],1 -%ifdef __WIN32__ - pushad - call initDirectDraw - call Clear2xSaIBuffer - popad -%else - jz .novsync - FilterExcl2 Triplebufen -%endif -.novsync -%endif -%ifndef __UNIXSDL__ - cmp dh,'T' - jne .notriplebuffer - xor eax,eax - mov al,[cvidmode] -%ifdef __WIN32__ - cmp byte[GUIWFVID+eax],0 - je near .notriplebuffer - xor byte[TripleBufferWin],1 - pushad - call initDirectDraw - call Clear2xSaIBuffer - popad -%else - cmp byte[GUITBVID+ebx],0 - je near .notriplebuffer - xor byte[Triplebufen],1 - jz .notriplebuffer - FilterExcl2 vsyncon -%endif -.notriplebuffer -%endif -%ifndef __MSDOS__ - cmp dh,'R' - jne .nokeep4_3 - xor ebx,ebx - mov bl,[cvidmode] - cmp byte[GUIKEEP43+ebx],0 - je near .nokeep4_3 - xor byte[Keep4_3Ratio],1 - pushad - call initwinvideo - call Clear2xSaIBuffer - popad -.nokeep4_3 -%endif -%ifdef __MSDOS__ - cmp dh,'M' - jne .nosmallscreen - xor eax,eax - mov al,[cvidmode] - cmp byte[GUISSVID+eax],0 - je .nosmallscreen - xor byte[smallscreenon],1 - FilterExcl2 ScreenScale,antienab,En2xSaI,scanlines - DOSClearScreenKey -.nosmallscreen - cmp dh,'C' - jne .nofullscreen - xor eax,eax - mov al,[cvidmode] - cmp byte[GUIFSVID+eax],0 - je .nofullscreen - xor byte[ScreenScale],1 - FilterExcl2 smallscreenon,antienab,En2xSaI - DOSClearScreenKey -.nofullscreen -%endif -.notfilterstab - - cmp dword[GUIVntscTab],1 - jl .notntsctab - cmp dh,'B' - jne .noblend - xor byte[NTSCBlend],1 -.noblend - cmp dh,'R' - jne .norefresh - xor byte[NTSCRef],1 -.norefresh - -.notntsctab - ret - -GUISoundKeys: - ToUpperASM - cmp dh,'E' - jne .notenablesound - xor byte[soundon],1 -%ifdef __WIN32__ - pushad - call reInitSound - popad -%endif -.notenablesound - - GUIKeyCheckbox StereoSound,'S' - GUIKeyCheckbox RevStereo,'V' - GUIKeyCheckbox Surround,'M' - GUIKeyCheckbox SPCDisable,'D' -%ifdef __MSDOS__ - GUIKeyCheckbox Force8b,'F' -%endif -%ifdef __WIN32__ - GUIKeyCheckbox PrimaryBuffer,'P' -%endif - - cmp dh,'R' ; Sampling Rate - jne .notsrate - mov eax,[SoundQuality] - mov al,[.sampratenext+eax] - mov [SoundQuality],al -.notsrate - - GUIKeyButtonHole SoundInterpType,0,'N' - GUIKeyButtonHole SoundInterpType,1,'G' - GUIKeyButtonHole SoundInterpType,2,'C' - cmp byte[MMXSupport],0 - je .no8ptinterp - GUIKeyButtonHole SoundInterpType,3,'8' -.no8ptinterp - - GUIKeyButtonHole LowPassFilterType,0,'O' - GUIKeyButtonHole LowPassFilterType,1,'I' - GUIKeyButtonHole LowPassFilterType,2,'Y' - cmp byte[MMXSupport],0 - je .nohiqualityfilter - GUIKeyButtonHole LowPassFilterType,3,'H' -.nohiqualityfilter - ret - -SECTION .data -.sampratenext db 1,4,5,6,2,3,0,0 -SECTION .text - -GUINetMenuKeys1: - ret - -GUIGetInputLine: - ret - -SECTION .bss -GUIEditString resd 1 ; Pointer to string -GUIEditStringcLen resd 1 ; Pointer to end of string (done in function) -GUIEditStringmLen resd 1 ; Max length of string -GUIEditStringLTxt resd 1 ; blink value, should be set to 0 when box selected -GUIEditStringLstb resd 1 ; if cursor is placed (set in main function) -GUIEditStringcWin resd 1 ; 0 = no text window selected -SECTION .text - -GUIPathKeys: - cmp dh,0 - je near .nokeypressed - cmp dword[GUIInputBox],0 - je near .nokeypressed - - cmp dword[GUIInputBox],1 - jne .notBox1 - mov eax,SRAMPath - jmp .boxselected -.notBox1 - cmp dword[GUIInputBox],2 - jne .notBox2 - mov eax,SnapPath - jmp .boxselected -.notBox2 - cmp dword[GUIInputBox],3 - jne .notBox3 - mov eax,SPCPath - jmp .boxselected -.notBox3 - cmp dword[GUIInputBox],4 - jne .notBox4 - mov eax,BSXPath - jmp .boxselected -.notBox4 - cmp dword[GUIInputBox],5 - jne .notBox5 - mov eax,SGPath - jmp .boxselected -.notBox5 - cmp dword[GUIInputBox],6 - jne .notBox6 - mov eax,STPath - jmp .boxselected -.notBox6 - cmp dword[GUIInputBox],7 - jne .notBox7 - mov eax,GNextPath - jmp .boxselected -.notBox7 - cmp dword[GUIInputBox],8 - jne .notBox8 - mov eax,FEOEZPath - jmp .boxselected -.notBox8 - cmp dword[GUIInputBox],9 - jne .notBox9 - mov eax,SJNSPath - jmp .boxselected -.notBox9 - cmp dword[GUIInputBox],10 - jne .notBox10 - mov eax,MDHPath - jmp .boxselected -.notBox10 - cmp dword[GUIInputBox],11 - jne .notBox11 - mov eax,SPL4Path - jmp .boxselected -.notBox11 -%ifndef __MSDOS__ - cmp dword[GUIInputBox],12 - jne .notBox12 - mov eax,GUICustomX - jmp .boxselected -.notBox12 - cmp dword[GUIInputBox],13 - jne .notBox13 - mov eax,GUICustomY - jmp .boxselected -.notBox13 -%endif - cmp dword[GUIInputBox],14 - jne .notBox14 - mov eax,GUIMovieForcedText - jmp .boxselected -.notBox14 - -.boxselected - mov ecx,eax - -%ifdef __WIN32__ - ;Look for paste request - cmp byte[ctrlptr],0 - je .nopaste - cmp dh,56h ;V - jne .nopaste - mov [CBBuffer],ecx - mov eax,[GUIInputLimit] - mov [CBLength],eax - pushad - call PasteClipBoard - popad - xor dx,dx - ret -.nopaste -%endif - - ;Find end of string -.findend - cmp byte[eax],0 - je .foundend - inc eax - jmp .findend -.foundend - - cmp dh,8 ;Backspace - jne .notbackspace - cmp eax,ecx - je .cantback - mov byte[eax-1],0 -.cantback - xor dx,dx - ret -.notbackspace - - cmp dh,13 ;Enter - jne .notenter - mov dword[GUIInputBox],0 - pushad - call init_save_paths - call SetMovieForcedLength -%ifndef __MSDOS__ - call SetCustomXY -%endif - popad - xor dx,dx - ret -.notenter - - ;check if we're at the end - add ecx,dword[GUIInputLimit] - cmp eax,ecx - jne .stillroom - xor dx,dx - ret -.stillroom - mov [eax],dh - - xor dx,dx -.nokeypressed - ret - -SECTION .bss -GUIInputBox resd 1 -GUIInputLimit resd 1 -SECTION .text - -GUIMovieKeys: - ToUpperASM - call GUIPathKeys - cmp dh,9 - jne near .notab - cmp byte[MovieProcessing],1 - jae .notab - KeyTabInc GUIMovieTabs,GUIDumpingTab -.notab - - GUIKeyButtonHole CMovieExt,'v','0' ; Select Radio Buttons - GUIKeyButtonHole CMovieExt,'1','1' - GUIKeyButtonHole CMovieExt,'2','2' - GUIKeyButtonHole CMovieExt,'3','3' - GUIKeyButtonHole CMovieExt,'4','4' - GUIKeyButtonHole CMovieExt,'5','5' - GUIKeyButtonHole CMovieExt,'6','6' - GUIKeyButtonHole CMovieExt,'7','7' - GUIKeyButtonHole CMovieExt,'8','8' - GUIKeyButtonHole CMovieExt,'9','9' - - cmp dword[GUIMovieTabs],1 - jne near .nocontrols - - GUIKeyButtonHole MovieStartMethod,0,'N' ; Start From Radio Buttons - GUIKeyButtonHole MovieStartMethod,1,'P' - GUIKeyButtonHole MovieStartMethod,2,'R' - GUIKeyButtonHole MovieStartMethod,3,'S' - - GUIKeyButtonHole MZTForceRTR,0,'M' ; Start From Radio Buttons - GUIKeyButtonHole MZTForceRTR,1,'C' - GUIKeyButtonHole MZTForceRTR,2,'B' - - GUIKeyCheckbox MovieDisplayFrame,'D' ; Checkbox -.nocontrols - - cmp dword[GUIDumpingTab],1 - jne near .nodumping - - GUIKeyButtonHole MovieVideoMode,0,'O' - GUIKeyButtonHole MovieVideoMode,1,'W' - GUIKeyButtonHole MovieVideoMode,2,'F' - GUIKeyButtonHole MovieVideoMode,3,'L' - GUIKeyButtonHole MovieVideoMode,4,'X' - GUIKeyButtonHole MovieVideoMode,5,'C' - - GUIKeyCheckbox MovieAudio,'A' - GUIKeyCheckbox MovieVideoAudio,'V' - GUIKeyCheckbox MovieAudioCompress,'M' - - GUIKeyButtonHole MovieForcedLengthEnabled,0,'Z' - GUIKeyButtonHole MovieForcedLengthEnabled,1,'R' - GUIKeyButtonHole MovieForcedLengthEnabled,2,'U' -.nodumping - - ret - -GUIComboKeys: - ; Calculate Position - xor eax,eax -.nozero - cmp byte[GUIComboTextH+eax],0 - je .zero - inc eax - jmp .nozero -.zero - mov [GUIComboPos],al - cmp dh,8 - jne .nobacksp - cmp byte[GUIComboPos],0 - je .nochar - mov byte[GUICCFlash],0 - xor eax,eax - mov al,[GUIComboPos] - dec eax - mov byte[GUIComboTextH+eax],0 - ret -.nobacksp - cmp dh,0 - je .nochar - cmp dh,13 - je .nochar - cmp byte[GUIComboPos],19 - je .nochar - xor eax,eax - mov byte[GUICCFlash],0 - mov al,[GUIComboPos] - mov [GUIComboTextH+eax],dh -.nochar - ret - -GUICheatKeys: - cmp dword[GUIcurrentcheatwin],1 - je near .textboxa - cmp dword[GUIcurrentcheatwin],2 - je near .textboxb - ToUpperASM - cmp dh,'R' ; Hotkeys - jne .noremocheat - jmp CheatCodeRemove -.noremocheat - cmp dh,'T' - jne .notoggcheat - jmp CheatCodeToggle -.notoggcheat - cmp dh,'S' - jne .nosavecheat - jmp CheatCodeSave -.nosavecheat - cmp dh,'L' - jne .noloadcheat - jmp CheatCodeLoad -.noloadcheat - cmp dh,'F' - jne .nofixcheat - jmp CheatCodeFix -.nofixcheat - cmp dh,'A' - jne .noauto - xor byte[AutoLoadCht],1 -.noauto - -;Main Cheat Box - cmp dword[NumCheats],0 - jne .nozero - ret -.nozero -%ifdef __UNIXSDL__ - cmp al,89 - je .homepressed - cmp dword[numlockptr],1 - je .nohome - cmp al,71 - jne .nohome -.homepressed -%else - cmp al,71 - jne .nohome -%endif - mov dword[GUIcurrentcheatcursloc],0 - mov dword[GUIcurrentcheatviewloc],0 - ret -.nohome -%ifdef __UNIXSDL__ - cmp al,89 - je .endppressed - cmp dword[numlockptr],1 - je .noendp - cmp al,79 - jne .noendp -.endppressed -%else - cmp al,79 - jne .noendp -%endif - mov eax,[NumCheats] - dec eax - mov [GUIcurrentcheatcursloc],eax - sub eax,11 - mov [GUIcurrentcheatviewloc],eax - test dword[GUIcurrentcheatviewloc],8000000h - jz .posve - mov dword[GUIcurrentcheatviewloc],0 -.posve - ret -.noendp -%ifdef __UNIXSDL__ - cmp al,90 - je .up - cmp dword[numlockptr],1 - je .noup - cmp al,72 - jne .noup -%else - cmp al,72 - jne .noup -%endif -.up - cmp dword[GUIcurrentcheatcursloc],0 - je .noup - mov ebx,[GUIcurrentcheatcursloc] - cmp [GUIcurrentcheatviewloc],ebx - jne .noviewdec - dec dword[GUIcurrentcheatviewloc] -.noviewdec - dec dword[GUIcurrentcheatcursloc] -.noup -%ifdef __UNIXSDL__ - cmp al, 96 - je .downpressed - cmp dword[numlockptr],1 - je .nodown - cmp al,80 - jne .nodown -.downpressed -%else - cmp al,80 - jne .nodown -%endif - mov ebx,[GUIcurrentcheatcursloc] - inc ebx - cmp ebx,[NumCheats] - jae .noviewinc - inc dword[GUIcurrentcheatcursloc] - sub ebx,12 - cmp ebx,[GUIcurrentcheatviewloc] - jne .noviewinc - inc dword[GUIcurrentcheatviewloc] -.noviewinc -.nodown -%ifdef __UNIXSDL__ - cmp al,91 - je .pageuppressed - cmp dword[numlockptr],1 - je .nopageup - cmp al,73 - jne .nopageup -.pageuppressed -%else - cmp al,73 - jne .nopageup -%endif - sub dword[GUIcurrentcheatviewloc],12 - sub dword[GUIcurrentcheatcursloc],12 - test dword[GUIcurrentcheatviewloc],8000000h - jz .posv - mov dword[GUIcurrentcheatviewloc],0 -.posv - test dword[GUIcurrentcheatcursloc],8000000h - jz .posc - mov dword[GUIcurrentcheatcursloc],0 -.posc -.nopageup -%ifdef __UNIXSDL__ - cmp al, 97 - je .pagednpressed - cmp dword[numlockptr],1 - je .nopagedown - cmp al,81 - jne .nopagedown -.pagednpressed -%else - cmp al,81 - jne .nopagedown -%endif - add dword[GUIcurrentcheatviewloc],12 - add dword[GUIcurrentcheatcursloc],12 - mov ebx,[NumCheats] - dec ebx - cmp dword[GUIcurrentcheatcursloc],ebx - jb .poscd - mov [GUIcurrentcheatcursloc],ebx -.poscd - sub ebx,11 - cmp dword[GUIcurrentcheatviewloc],ebx - jl .posvd - test ebx,8000000h - jz .noneg - mov ebx,0 -.noneg - mov [GUIcurrentcheatviewloc],ebx -.posvd -.nopagedown - ret - -;Enter Code Input Box -.textboxa - cmp byte[GUICheatPosA],0 - je near .nobacksp - cmp dh,9 - je .yesret - cmp dh,13 - jne near .noret -.yesret - cmp byte[GUICheatPosA],2 - jne near .nocodemod - mov byte[GUICheatPosA],0 - mov esi,[GUIcurrentcheatcursloc] - shl esi,5 - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - sub esi,[GUIcurrentcheatcursloc] - add esi,cheatdata - mov al,[GUICheatTextZ1] - cmp al,'a' - jae .lowletter - cmp al,'A' - jae .letter - sub al,'0' - jmp .num -.lowletter - sub al,'a'-10 - jmp .num -.letter - sub al,'A'-10 -.num - mov ah,[GUICheatTextZ1+1] - cmp ah,'a' - jae .lowletter2 - cmp ah,'A' - jae .letter2 - sub ah,'0' - jmp .num2 -.lowletter2 - sub ah,'a'-10 - jmp .num2 -.letter2 - sub ah,'A'-10 -.num2 - shl al,4 - and ah,0Fh - or al,ah - mov [esi+1],al - mov word[GUICheatTextZ1],0 - pushad - call EnableCheatCodeNoPrevMod - popad - jmp .noret -.nocodemod - inc dword[GUIcurrentcheatwin] - mov byte[GUICCFlash],0 -.noret - cmp dh,8 - jne .nobacksp - mov byte[GUICCFlash],0 - dec byte[GUICheatPosA] - xor eax,eax - mov al,[GUICheatPosA] - mov byte[GUICheatTextZ1+eax],'_' - mov byte[GUICheatTextZ1+eax+1],0 - ret -.nobacksp - cmp dh,0 - je .nochar - cmp dh,13 - je .nochar - cmp dh,8 - je .nochar - cmp dh,9 - je .nochar - cmp byte[GUICheatPosA],14 - je .nochar - mov byte[GUICCFlash],0 - xor eax,eax - mov al,[GUICheatPosA] - mov [GUICheatTextZ1+eax],dh - mov byte[GUICheatTextZ1+eax+1],'_' - mov byte[GUICheatTextZ1+eax+2],0 - inc byte[GUICheatPosA] -.nochar - ret - -;Description Input Box -.textboxb - cmp dh,13 - jne .noretb - mov byte[GUICCFlash],0 - jmp ProcessCheatCode -.noretb - cmp byte[GUICheatPosB],0 - je .nobackspb - cmp dh,8 - jne .nobackspb - mov byte[GUICCFlash],0 - dec byte[GUICheatPosB] - xor eax,eax - mov al,[GUICheatPosB] - mov byte[GUICheatTextZ2+eax],'_' - mov byte[GUICheatTextZ2+eax+1],0 - ret -.nobackspb - cmp dh,0 - je .nocharb - cmp dh,13 - je .nocharb - cmp dh,8 - je .nocharb - cmp byte[GUICheatPosB],18 - je .nocharb - xor eax,eax - mov byte[GUICCFlash],0 - mov al,[GUICheatPosB] - mov [GUICheatTextZ2+eax],dh - mov byte[GUICheatTextZ2+eax+1],'_' - mov byte[GUICheatTextZ2+eax+2],0 - inc byte[GUICheatPosB] -.nocharb - ret - -%macro CompareKeyMacro 3 - cmp dh,%1 - jne %%skip - mov byte[%2],%3 -%%skip -%endmacro - -InsertSearchCharacter: - push edx - push eax - ; Send character into CSInputDisplay - ; Find location - mov ecx,CSInputDisplay -.next - cmp byte[ecx],0 - je .found - cmp byte[ecx],'_' - je .found - inc ecx - jmp .next -.found - ; Delete if necessary - cmp dh,8 - jne .notdelete - cmp ecx,CSInputDisplay - je near .done - dec ecx - jmp .placecursor -.notdelete - cmp ecx,CSInputDisplay+10 - je near .done - ; Add character if necessary - cmp dh,'0' - jb near .done - cmp dh,'9' - jbe .okay - cmp byte[CheatSrcByteBase],0 - je near .done - cmp dh,'F' - ja near .done - cmp dh,'A' - jb near .done -.okay - mov [ecx],dh - inc ecx - ; Process cursor if over the window -.placecursor - mov byte[ecx],'_' - mov byte[ecx+1],0 - - mov byte[CSOverValue],0 - ; Find overall value and delete if over - mov ecx,CSInputDisplay - mov ebx,10 - cmp byte[CheatSrcByteBase],0 - je .dec - mov ebx,16 -.dec - xor eax,eax -.next2 - cmp byte[ecx],0 - je .found2 - cmp byte[ecx],'_' - je .found2 - mul ebx - or edx,edx - jz .notoverflow - mov byte[CSOverValue],1 -.notoverflow - xor edx,edx - mov dl,[ecx] - cmp dl,'A' - jb .below - sub dl,'A'-10-'0' -.below - sub dl,'0' - add eax,edx - jnc .notoverflowb - mov byte[CSOverValue],1 -.notoverflowb - inc ecx - jmp .next2 -.found2 - xor ebx,ebx - mov bl,[CheatSrcByteSize] - mov ebx,[SrcMask+ebx*4] - mov [CSCurValue],eax - cmp eax,ebx - jbe .done - mov byte[CSOverValue],1 -.done - pop eax - pop edx - ret - -SECTION .bss -CSOverValue resb 1 -CSCurValue resd 1 -SECTION .text - -InsertSearchDescription: - mov eax,CSDescDisplay - xor dl,dl -.next - cmp byte[eax],0 - je .fin - inc eax - inc dl - jmp .next -.fin - or dl,dl - jz .nobackspb - cmp dh,8 - jne .nobackspb - mov byte[eax-1],0 - ret -.nobackspb - cmp dh,0 - je .nocharb - cmp dh,13 - je .nocharb - cmp dh,8 - je .nocharb - cmp dl,18 - je .nocharb - mov [eax],dh - mov byte[eax+1],0 -.nocharb - ret - -GUICheatSearchKeys: - ToUpperASM - cmp byte[CheatWinMode],3 - je near .add - cmp byte[CheatWinMode],2 - je near .view - cmp byte[CheatWinMode],1 - je near .search - - CompareKeyMacro '1',CheatSrcByteSize,0 ; Main Menu - CompareKeyMacro '2',CheatSrcByteSize,1 - CompareKeyMacro '3',CheatSrcByteSize,2 - CompareKeyMacro '4',CheatSrcByteSize,3 - CompareKeyMacro 'D',CheatSrcByteBase,0 - CompareKeyMacro 'H',CheatSrcByteBase,1 - CompareKeyMacro 'E',CheatSrcSearchType,0 - CompareKeyMacro 'C',CheatSrcSearchType,1 - - cmp dh,13 ; Start Button - je .start - cmp dh,'S' - jne .notstart -.start - call CheatCodeSearchInit - ret -.notstart - ret - -.search ; Shortcuts for Select Comparison - cmp byte[CheatSrcSearchType],1 - je .compare - call InsertSearchCharacter - jmp .nomovedown -.compare - cmp dh,',' - je .lessthan - cmp dh,'N' - jne .notlessthan -.lessthan - mov byte[CheatCompareValue],0 -.notlessthan - cmp dh,'.' - je .greaterthan - cmp dh,'E' - jne .notgreaterthan -.greaterthan - mov byte[CheatCompareValue],1 -.notgreaterthan - cmp dh,'W' - je .equalthan - cmp dh,'+' - jne .notequalthan -.equalthan - mov byte[CheatCompareValue],2 -.notequalthan - cmp dh,'A' - jne .notnotequalthan - mov byte[CheatCompareValue],3 -.notnotequalthan - -%ifdef __UNIXSDL__ ; Select with Arrow Keys - cmp al,90 - je .yesmoveup - cmp dword[numlockptr],1 - je .nomoveup - cmp al,72 - jne .nomoveup -.yesmoveup -%else - cmp al,72 - jne .nomoveup -%endif - cmp byte[CheatCompareValue],0 - je .nomoveup - dec byte[CheatCompareValue] -.nomoveup -%ifdef __UNIXSDL__ - cmp al,96 - je .yesmovedown - cmp dword[numlockptr],1 - je .nomovedown - cmp al,80 - jne .nomovedown -.yesmovedown -%else - cmp al,80 - jne .nomovedown -%endif - cmp byte[CheatCompareValue],3 - je .nomovedown - inc byte[CheatCompareValue] - -.nomovedown ; Restart/View/Search Buttons - cmp dh,'R' - jne .notrestart - mov byte[CheatWinMode],0 - mov byte[CheatSearchStatus],0 -.notrestart - cmp dh,'V' - jne .notview - mov byte[CheatWinMode],2 -.notview - cmp dh,13 - je .searchprocess - cmp dh,'S' - jne .nosearchprocess -.searchprocess - cmp byte[CheatSearchStatus],1 - je .nosearchprocess - call CheatCodeSearchProcess -.nosearchprocess - ret - -.view ; View - cmp dword[NumCheatSrc],0 ; Return Hotkey - jne .nozero - cmp dh,27 - je .yesret - cmp dh,'R' - jne .notreturnb -.yesret - mov byte[CheatWinMode],1 -.notreturnb - ret - -.nozero ; Select Codes with arrow keys -%ifdef __UNIXSDL__ - cmp al,89 - je .yeshome - cmp dword[numlockptr],1 - je .nohome - cmp al,71 - jne .nohome -.yeshome -%else - cmp al,71 - jne .nohome -%endif - mov dword[GUIcurrentchtsrccursloc],0 - mov dword[GUIcurrentchtsrcviewloc],0 - ret -.nohome -%ifdef __UNIXSDL__ - cmp al,95 - je .yesendp - cmp dword[numlockptr],1 - je .noendp - cmp al,79 - jne .noendp -.yesendp -%else - cmp al,79 - jne .noendp -%endif - mov eax,[NumCheatSrc] - dec eax - mov [GUIcurrentchtsrccursloc],eax - sub eax,11 - mov [GUIcurrentchtsrcviewloc],eax - test dword[GUIcurrentchtsrcviewloc],8000000h - jz .posve - mov dword[GUIcurrentchtsrcviewloc],0 -.posve - ret -.noendp -%ifdef __UNIXSDL__ - cmp al,90 - je .up - cmp dword[numlockptr],1 - je .noup - cmp al,72 - jne .noup -%else - cmp al,72 - jne .noup -%endif -.up - cmp dword[GUIcurrentchtsrccursloc],0 - je .noup - mov ebx,[GUIcurrentchtsrccursloc] - cmp [GUIcurrentchtsrcviewloc],ebx - jne .noviewdec - dec dword[GUIcurrentchtsrcviewloc] -.noviewdec - dec dword[GUIcurrentchtsrccursloc] -.noup -%ifdef __UNIXSDL__ - cmp al,96 - je .yesdown - cmp dword[numlockptr],1 - je .nodown - cmp al,80 - jne .nodown -.yesdown -%else - cmp al,80 - jne .nodown -%endif - mov ebx,[GUIcurrentchtsrccursloc] - inc ebx - cmp ebx,[NumCheatSrc] - jae .noviewinc - inc dword[GUIcurrentchtsrccursloc] - sub ebx,12 - cmp ebx,[GUIcurrentchtsrcviewloc] - jne .noviewinc - inc dword[GUIcurrentchtsrcviewloc] -.noviewinc -.nodown - -%ifdef __UNIXSDL__ ; Pageup/Down to select Cheats - cmp al,91 - je .yespgup - cmp dword[numlockptr],1 - je .nopageup - cmp al,73 - jne .nopageup -.yespgup -%else - cmp al,73 - jne .nopageup -%endif - sub dword[GUIcurrentchtsrcviewloc],12 - sub dword[GUIcurrentchtsrccursloc],12 - test dword[GUIcurrentchtsrcviewloc],8000000h - jz .posv - mov dword[GUIcurrentchtsrcviewloc],0 -.posv - test dword[GUIcurrentchtsrccursloc],8000000h - jz .posc - mov dword[GUIcurrentchtsrccursloc],0 -.posc -.nopageup -%ifdef __UNIXSDL__ - cmp al,97 - je .yespgdn - cmp dword[numlockptr],1 - je .nopagedown - cmp al,81 - jne .nopagedown -.yespgdn -%else - cmp al,81 - jne .nopagedown -%endif - add dword[GUIcurrentchtsrcviewloc],12 - add dword[GUIcurrentchtsrccursloc],12 - mov ebx,[NumCheatSrc] - dec ebx - cmp dword[GUIcurrentchtsrccursloc],ebx - jb .poscd - mov [GUIcurrentchtsrccursloc],ebx -.poscd - sub ebx,11 - cmp dword[GUIcurrentchtsrcviewloc],ebx - jl .posvd - test ebx,8000000h - jz .noneg - mov ebx,0 -.noneg - mov [GUIcurrentchtsrcviewloc],ebx -.posvd -.nopagedown - - cmp dh,27 ; Return/Add Buttons - je .yesretb - cmp dh,'R' - jne .notreturn -.yesretb - mov byte[CheatWinMode],1 -.notreturn - cmp dh,13 - je .yesadd - cmp dh,'A' - jne .notadd -.yesadd - mov byte[CheatWinMode],3 - mov byte[CurCStextpos],0 - mov byte[CSInputDisplay],'_' - mov byte[CSInputDisplay+1],0 - mov byte[CSDescDisplay],0 -.notadd - ret - -.add ; Add Cheat Window - cmp dh,27 ; Button Hotkey - je .yesretc - cmp byte[CurCStextpos],1 - je .notreturnc - cmp dh,'R' - jne .notreturnc -.nofastforward -.yesretc - mov byte[CheatWinMode],2 -.notreturnc - cmp byte[CurCStextpos],0 - jne near .nofirstbox - cmp dh,9 - je .yestab - cmp byte[CSOverValue],1 - je .noret - cmp dh,13 - jne .noret -.yestab - mov byte[CurCStextpos],1 -.noret - call InsertSearchCharacter - ret -.nofirstbox - cmp byte[CurCStextpos],1 - jne near .nosecondbox - cmp dh,9 - jne .notab - mov byte[CurCStextpos],0 -.notab - cmp dh,13 - jne .noenter - jmp AddCSCheatCode -.noenter - call InsertSearchDescription - ret -.nosecondbox - ret - -; Allows you to use the arrow keys to select a state number, and Enter to pick -GUIStateSelKeys: - cmp al,13 - jne .noenter - xor eax,eax - mov al,[GUIwinptr] - dec eax - mov byte[GUIwinactiv+2],0 - mov byte[GUIwinorder+eax],0 - dec byte[GUIwinptr] - mov al,[GUIpmenupos] - mov [GUIcmenupos],al - ret -.noenter - mov bl,al - mov eax,[current_zst] - mov dl,10 - div dl - movzx ecx,ah -%ifdef __UNIXSDL__ - cmp bl,92 ; linux keypad left - je .yesleft - cmp dword[numlockptr],1 ; if numlock on, disregard numpad - je .noleft -%endif - cmp bl,75 ; linux numpad left, non-linux num/keypad left - jne .noleft -.yesleft - cmp cl,0 - jne .no0th - mov cl,4 - jmp .done -.no0th - cmp cl,5 - jne .no5th - mov cl,9 - jmp .done -.no5th - dec cl - jmp .done -.noleft -%ifdef __UNIXSDL__ - cmp bl,94 ; linux keypad right - je .yesright - cmp dword[numlockptr],1 ; if numlock on, disregard numpad - je .noright -%endif - cmp bl,77 ; linux numpad right, non-linux num/keypad right - jne .noright -.yesright - cmp cl,4 - jne .no4th - mov cl,0 - jmp .done -.no4th - cmp cl,9 - jne .no9th - mov cl,5 - jmp .done -.no9th - inc cl - jmp .done -.noright -%ifdef __UNIXSDL__ - cmp bl,90 ; linux keypad up - je .yesvert - cmp dword[numlockptr],1 ; if numlock on, disregard numpad - je .noup -%endif - cmp bl,72 ; linux numpad up, non-linux num/keypad up - je .yesvert -.noup -%ifdef __UNIXSDL__ - cmp bl,96 ; linux keypad down - je .yesvert - cmp dword[numlockptr],1 ; if numlock on, disregard numpad - je .novert -%endif - cmp bl,80 ; linux numpad down, non-linux num/keypad down - jne .novert -.yesvert - cmp cl,5 - jge .subme - add cl,5 - jmp .done -.subme - sub cl,5 - jmp .done -.novert -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try1 - cmp bl,04Fh - je .yes1 -.try1 -%endif - test byte[pressed+2],1 - jz .no1 -.yes1 - mov cl,1 - jmp .done -.no1 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try2 - cmp bl,050h - je .yes2 -.try2 -%endif - test byte[pressed+3],1 - jz .no2 -.yes2 - mov cl,2 - jmp .done -.no2 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try3 - cmp bl,051h - je .yes3 -.try3 -%endif - test byte[pressed+4],1 - jz .no3 -.yes3 - mov cl,3 - jmp .done -.no3 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try4 - cmp bl,04Bh - je .yes4 -.try4 -%endif - test byte[pressed+5],1 - jz .no4 -.yes4 - mov cl,4 - jmp .done -.no4 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try5 - test byte[pressed+04Ch],1 - jnz .yes5 -.try5 -%endif - test byte[pressed+6],1 - jz .no5 -.yes5 - mov cl,5 - jmp .done -.no5 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try6 - cmp bl,04Dh - je .yes6 -.try6 -%endif - test byte[pressed+7],1 - jz .no6 -.yes6 - mov cl,6 - jmp .done -.no6 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try7 - cmp bl,047h - je .yes7 -.try7 -%endif - test byte[pressed+8],1 - jz .no7 -.yes7 - mov cl,7 - jmp .done -.no7 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try8 - cmp bl,048h - je .yes8 -.try8 -%endif - test byte[pressed+9],1 - jz .no8 -.yes8 - mov cl,8 - jmp .done -.no8 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try9 - cmp bl,049h - je .yes9 -.try9 -%endif - test byte[pressed+10],1 - jz .no9 -.yes9 - mov cl,9 - jmp .done -.no9 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .try0 - test byte[pressed+052h],1 - jnz .yes0 -.try0 -%endif - test byte[pressed+11],1 - jz .no0 -.yes0 - mov cl,0 - jmp .done -.no0 - jmp .nochange -.done - mul dl - add al,cl - mov [current_zst],eax - ret -.nochange -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .trypgup - cmp bl,91 - je .yespgup -.trypgup -%endif - cmp bl,73 - jne .nopgup -.yespgup - cmp dword[current_zst],90 - jge .nochange2 - add dword[current_zst],10 - ret -.nopgup -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je .trypgdn - cmp bl,97 - je .yespgdn -.trypgdn -%endif - cmp bl,81 - jne .nopgdn -.yespgdn - cmp dword[current_zst],10 - jl .nochange2 - sub dword[current_zst],10 - ret -.nopgdn -.nochange2 - ret - -; Allows you to select boxes with the arrow keys, Enter to choose -GUIResetKeys: -%ifdef __UNIXSDL__ - cmp al,92 - je .yesleft - cmp dword[numlockptr],1 - je .noleft - cmp al,75 - jne .noleft -.yesleft -%else - cmp al,75 - jne .noleft -%endif - mov byte[GUICResetPos],0 -.noleft -%ifdef __UNIXSDL__ - cmp al,94 - je .yesright - cmp dword[numlockptr],1 - je .noright - cmp al,77 - jne .noright -.yesright -%else - cmp al,77 - jne .noright -%endif - mov byte[GUICResetPos],1 -.noright - cmp al,13 - jne .noconf - cmp byte[GUICResetPos],0 - je .yesreset - jmp .noreset -.noconf - ToUpperASM - cmp dh,'Y' - jne .notyesreset -.yesreset - mov byte[GUICBHold],2 - jmp GUIProcReset -.notyesreset - cmp dh,'N' - jne .notnoreset -.noreset - xor eax,eax - mov al,[GUIwinptr] - dec eax - mov byte[GUIwinactiv+12],0 - mov byte[GUIwinorder+eax],0 - dec byte[GUIwinptr] - mov al,[GUIpmenupos] - mov [GUIcmenupos],al -.notnoreset - ret - -; Allows you to select boxes with the arrow keys, Enter to choose -GUIStateKeys: -%ifdef __UNIXSDL__ - cmp al,92 - je .yesleft - cmp dword[numlockptr],1 - je .noleft - cmp al,75 - jne .noleft -.yesleft -%else - cmp al,75 - jne .noleft -%endif - mov byte[GUICStatePos],0 -.noleft -%ifdef __UNIXSDL__ - cmp al,94 - je .yesright - cmp dword[numlockptr],1 - je .noright - cmp al,77 - jne .noright -.yesright -%else - cmp al,77 - jne .noright -%endif - mov byte[GUICStatePos],1 -.noright - cmp al,13 - jne .noconf - cmp byte[GUICStatePos],0 - je .yesreset - jmp .noreset -.noconf - ToUpperASM - cmp dh,'Y' - jne .notyesreset -.yesreset - mov byte[GUICBHold],10 - jmp GUIProcStates -.notyesreset - cmp dh,'N' - jne .notnoreset -.noreset - xor eax,eax - mov al,[GUIwinptr] - dec eax - mov byte[GUIwinactiv+14],0 - mov byte[GUIwinorder+eax],0 - dec byte[GUIwinptr] - mov al,[GUIpmenupos] - mov [GUIcmenupos],al -.notnoreset - ret - -GUILoadKeys: - cmp dx,0 - jne near .keypressed -.nokeypressed - ret -.keypressed - mov [gui_key],dh - mov [gui_key_extended],dl - pushad - call GUILoadKeysNavigate - cmp eax,1 - popad - je .nokeypressed - cmp byte[GUILoadPos],0 - je near .nobacksp - cmp dh,8 - jne .nobacksp - mov byte[GUILDFlash],0 - dec byte[GUILoadPos] - xor eax,eax - mov al,[GUILoadPos] - ret -.nobacksp - cmp dh,8 - je near .nokeypressed - cmp byte[GUILoadPos],36 - je near .nokeypressed - mov byte[GUILDFlash],0 - xor eax,eax - mov al,[GUILoadPos] - mov [GUILoadTextA+eax],dh - inc byte[GUILoadPos] - pushad - call GUILoadKeysJumpTo - popad - ret - -WaitForKey: -.again3 - mov edx,10 -.again4 - mov cx,1000 - push edx - call delay - call JoyRead - pop edx - xor ebx,ebx - mov ecx,256+128+64 -.b2 - cmp byte[pressed+ebx],0 - jne near .again3 - inc ebx - dec ecx - jnz .b2 - dec edx - jnz near .again4 -.again - call JoyRead - xor ebx,ebx - mov ecx,256+128+64 -.b - cmp byte[pressed+ebx],0 - jne .pressedokay - inc ebx - dec ecx - jnz .b - jmp .again -.pressedokay -.again2 - call Check_Key - or al,al - jz .nokey - call Get_Key - jmp .again2 -.nokey - cmp byte[MouseDis],1 - je .mousedis2 - push ebx -; mov eax,0Bh -; int 33h - pop ebx -.mousedis2 - mov byte[GUIpclicked],1 - ret - diff --git a/tools/zsnes/src/gui/guimisc.inc b/tools/zsnes/src/gui/guimisc.inc deleted file mode 100644 index de54c8a..0000000 --- a/tools/zsnes/src/gui/guimisc.inc +++ /dev/null @@ -1,620 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 - -SECTION .bss -NEWSYM MovieRecordWinVal, resb 1 -NEWSYM MovieProcessing, resb 1 -NEWSYM MovieFileHand, resw 1 -NEWSYM RecData, resb 16 -NEWSYM NoPictureSave, resb 1 - -SECTION .text - -CalibrateDispA: - xor ebx,ebx - mov ecx,256 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .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 - dec ecx - jnz .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 - -SECTION .data -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 -SECTION .text - -%macro ConfigureKey2 2 - cmp ebx,0 - jne near %%no0 - mov dword[%2],%1upk ; Up -%%no0 - cmp ebx,1 - jne near %%no1 - mov dword[%2],%1downk ; Down -%%no1 - cmp ebx,2 - jne near %%no2 - mov dword[%2],%1leftk ; Left -%%no2 - cmp ebx,3 - jne near %%no3 - mov dword[%2],%1rightk ; Right -%%no3 - cmp ebx,4 - jne near %%no4 - mov dword[%2],%1startk ; Start -%%no4 - cmp ebx,5 - jne near %%no5 - mov dword[%2],%1selk ; Select -%%no5 - cmp ebx,6 - jne near %%no6 - mov dword[%2],%1Ak ; A -%%no6 - cmp ebx,7 - jne near %%no7 - mov dword[%2],%1Bk ; B -%%no7 - cmp ebx,8 - jne near %%no8 - mov dword[%2],%1Xk ; X -%%no8 - cmp ebx,9 - jne near %%no9 - mov dword[%2],%1Yk ; Y -%%no9 - cmp ebx,10 - jne near %%no10 - mov dword[%2],%1Lk ; L -%%no10 - cmp ebx,11 - jne near %%no11 - mov dword[%2],%1Rk ; R -%%no11 -%endmacro - -%macro ConfigureKey 2 - cmp byte[%2],0 - jne near %%nopl1 - ConfigureKey2 pl1,%1 -%%nopl1 - cmp byte[%2],1 - jne near %%nopl2 - ConfigureKey2 pl2,%1 -%%nopl2 - cmp byte[%2],2 - jne near %%nopl3 - ConfigureKey2 pl3,%1 -%%nopl3 - cmp byte[%2],3 - jne near %%nopl4 - ConfigureKey2 pl4,%1 -%%nopl4 - cmp byte[%2],4 - jne near %%nopl5 - ConfigureKey2 pl5,%1 -%%nopl5 -%endmacro - -SetAllKeys: - xor ebx,ebx - mov ecx,256+128+64 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .a - - mov byte[GUICBHold],0 - mov dword[keycontrolval],pl1contrl - cmp byte[cplayernum],1 - jne .nopl2 - mov dword[keycontrolval],pl2contrl -.nopl2 - cmp byte[cplayernum],2 - jne .nopl3 - mov dword[keycontrolval],pl3contrl -.nopl3 - cmp byte[cplayernum],3 - jne .nopl4 - mov dword[keycontrolval],pl4contrl -.nopl4 - cmp byte[cplayernum],4 - jne .nopl5 - mov dword[keycontrolval],pl5contrl -.nopl5 - - ;Check if controller is set - push eax - mov eax,[keycontrolval] - cmp dword[eax],0 - pop eax - jne .noLockInputChange - ret -.noLockInputChange - xor ebx,ebx - mov ecx,12 - mov dword[guipressptr],guipresstext4b -.loop - ConfigureKey guicpressptr,cplayernum - push ebx - push ecx - call guipresstestb - pop ecx - pop ebx - add dword[guipressptr],21 - inc ebx - dec ecx - jnz .loop - ret -SECTION .data -SECTION .text - -CalibrateDev1: - movzx eax,byte[cplayernum] - mov ebx,[GUIInputRefP+eax*4] - mov bl,[ebx] - mov byte[GUICBHold],0 -%ifdef __MSDOS__ - cmp al,0 - jne .notpl1 - cmp byte[pl1p209],0 - jne near .port209 -.notpl1 - cmp al,1 - jne .notpl2 - cmp byte[pl2p209],0 - jne near .port209 -.notpl2 - cmp al,2 - jne .notpl3 - cmp byte[pl3p209],0 - jne near .port209 -.notpl3 - cmp al,3 - jne .notpl4 - cmp byte[pl4p209],0 - jne near .port209 -.notpl4 - cmp al,4 - jne .notpl5 - cmp byte[pl5p209],0 - jne near .port209 -.notpl5 -%endif - 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 -%ifdef __MSDOS__ -.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 -%endif -SECTION .bss -.joyblx resd 1 -.joybly resd 1 -.joybcx resd 1 -.joybcy resd 1 -SECTION .text - - -SetDevice: - mov byte[GUICBHold],0 - movzx eax,byte[cplayernum] -%ifdef __MSDOS__ - cmp al,0 - jne .notpl1 - cmp byte[pl1p209],0 - jne .port209 -.notpl1 - cmp al,1 - jne .notpl2 - cmp byte[pl2p209],0 - jne .port209 -.notpl2 - cmp al,2 - jne .notpl3 - cmp byte[pl3p209],0 - jne .port209 -.notpl3 - cmp al,3 - jne .notpl4 - cmp byte[pl4p209],0 - jne .port209 -.notpl4 - cmp al,4 - jne .notpl5 - cmp byte[pl5p209],0 - jne .port209 -.notpl5 -%endif -;.notdos - mov dword[CalibXmin],0 - mov eax,[GUIInputRefP+eax*4] - mov bl,[GUIcurrentinputcursloc] - mov [eax],bl - mov bh,[cplayernum] - call SetInputDevice - call UpdateDevices - jmp .procmtap -%ifdef __MSDOS__ -.port209 - mov dword[CalibXmin209],0 - mov eax,[GUIInputRefP+eax*4] - mov bl,[GUIcurrentinputcursloc] - mov [eax],bl - mov bh,[cplayernum] - call SetInputDevice209 - call UpdateDevices -%endif -.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 -%ifdef __MSDOS__ - call DOSClearScreen -%endif - pushad - call Clear2xSaIBuffer - popad -; mov byte[NetPlayNoMore],1 - mov byte[RestoreValues],0 - - pushad - call MovieStop - call RestoreSystemVars - popad - - ; reset the snes - call init65816 - pushad - call procexecloop - popad - - 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 - -SECTION .bss -NEWSYM JoyX, resd 1 -NEWSYM JoyY, resd 1 -NEWSYM JoyX2, resd 1 -NEWSYM JoyY2, resd 1 -NEWSYM JoyMaxX, resd 1 -NEWSYM JoyMaxY, resd 1 -NEWSYM JoyMinX, resd 1 -NEWSYM JoyMinY, resd 1 -NEWSYM JoyExists, resb 1 -NEWSYM JoyExists2, resb 1 - -SECTION .text -NEWSYM GetCoords - mov dword[JoyX],0 - mov dword[JoyY],0 - cli - mov al,0 - out dx,al - mov ecx,00FFFFh -.loopa - in al,dx - test al,01h - jz .YAxis - test al,02h - jz .XAxis - inc dword[JoyX] - inc dword[JoyY] - dec ecx - jnz .loopa - mov byte[JoyExists], 0 - mov dword[JoyX],0 - mov dword[JoyY],0 - jmp .End -.YAxis - in al,dx - test al,02h - jz .YAxisOk - nop - nop - inc dword[JoyY] - nop - dec ecx - jnz .YAxis - mov byte[JoyExists], 0 - mov dword[JoyX],0 - mov dword[JoyY],0 -.YAxisOk - jmp .End -.XAxis - in al,dx - test al,01h - jz .XAxisOk - nop - nop - inc dword[JoyX] - nop - dec ecx - jnz .XAxis - mov byte[JoyExists], 0 - mov dword[JoyX],0 - mov dword[JoyY],0 -.XAxisOk -.End - sti - ret - -; Dual Joysticks - -NEWSYM GetCoords3 - mov dword[JoyX],0 - mov dword[JoyY],0 - mov dword[JoyX2],0 - mov dword[JoyY2],0 - cli - mov al,0 - out dx,al - mov ecx,01FFFFh -.loopa - in al,dx - test al,01h - jz .YAxis - inc dword[JoyX] - nop -.YAxis - test al,02h - jz .XAxis - inc dword[JoyY] - nop -.XAxis - test al,04h - jz .YAxis2 - inc dword[JoyX2] - nop -.YAxis2 - test al,08h - jz .XAxis2 - inc dword[JoyY2] - nop -.XAxis2 - test al,0Fh - jz .nomore - dec ecx - jnz .loopa - mov byte[JoyExists], 0 - mov dword[JoyX],0 - mov dword[JoyY],0 - mov byte[JoyExists2], 0 - mov dword[JoyX2],0 - mov dword[JoyY2],0 -.nomore - sti - ret diff --git a/tools/zsnes/src/gui/guimouse.inc b/tools/zsnes/src/gui/guimouse.inc deleted file mode 100644 index 6156d17..0000000 --- a/tools/zsnes/src/gui/guimouse.inc +++ /dev/null @@ -1,3593 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -%ifdef __WIN32__ -EXTSYM MinimizeWindow -%endif - -SECTION .bss -lastmouseholded resb 1 -mousebuttonstat resw 1 -MouseMoveOkay resb 1 -LastHoldEnable resb 1 -SECTION .text - -ProcessMouse: - ; Process holds - mov al,[GUIHold] - cmp al,[LastHoldEnable] - je near .noholdnecessary - cmp byte[GUIHold],0 - jne .noholda - cmp byte[LastHoldEnable],7 ; ntsc sliders - jne .norelease1 - xor edx,edx - mov dl,[ntscWhVar] - mov cl,[ntscCurVar] - cmp cl,[ntscLastVar+edx] - je .norelease1 -%ifndef __MSDOS__ - pushad - call NTSCFilterInit - popad -%endif - mov [ntscLastVar+edx],cl -.norelease1 - mov ecx,0 - mov edx,255 - call Set_MouseXMax - mov ecx,0 - mov edx,223 - call Set_MouseYMax -.noholda - cmp byte[GUIHold],1 ; GUI Windows - jne .nohold1 - mov ecx,0 - mov edx,255 - call Set_MouseXMax - mov ecx,16 - mov edx,223 - call Set_MouseYMax -.nohold1 - cmp byte[GUIHold],5 ; Sound Slider - je .holdslider - cmp byte[GUIHold],6 ; Speed Slider - je .holdslider - cmp byte[GUIHold],2 ; Colour Slider - je .holdslider - cmp byte[GUIHold],7 ; Video Slider - jne .nohold2m -.holdslider - mov ecx,[GUIHoldXlimL] ; Sets min/max move range for mouse - mov edx,[GUIHoldXlimR] ; once holding slider - call Set_MouseXMax - mov ecx,[GUIHoldYlim] ; Locks pointer on slider - mov edx,[GUIHoldYlim] - call Set_MouseYMax -.nohold2m - cmp byte[GUIHold],3 ; Scrollbars - jne .nohold3m - mov ecx,[GUIHoldXlimL] - mov edx,[GUIHoldXlimR] - call Set_MouseXMax - mov ecx,[GUIHoldYlim] - mov edx,[GUIHoldYlimR] - call Set_MouseYMax -.nohold3m - mov al,[GUIHold] - mov [LastHoldEnable],al -.noholdnecessary - mov byte[MouseMoveOkay],0 - call Get_MouseData - cmp byte[lhguimouse],1 - jne .notlefthanded - call SwapMouseButtons -.notlefthanded - mov [mousebuttonstat],bx - cmp byte[lastmouseholded],0 - je .noprevhold - test bx,01h - jnz .noprevhold - mov byte[lastmouseholded],0 - mov cx,[GUImouseposx] - mov dx,[GUImouseposy] - call Set_MousePosition -.noprevhold - cmp byte[mousewrap],1 - je near ProcessMouseWrap - call Get_MouseData - cmp byte[lhguimouse],1 - jne .notlefthanded2 - call SwapMouseButtons -.notlefthanded2 - cmp word[GUImouseposx],cx - je .zero2 - mov byte[MouseMoveOkay],1 -.zero2 - cmp word[GUImouseposy],dx - je .zero3 - mov byte[MouseMoveOkay],1 -.zero3 - mov [GUImouseposx],cx - test word[GUImouseposx],8000h - jz .nowrapleft - mov word[GUImouseposx],0 -.nowrapleft - cmp word[GUImouseposx],255 - jbe .nowrapright - mov word[GUImouseposx],255 -.nowrapright - mov [GUImouseposy],dx - test word[GUImouseposy],8000h - jz .nowrapup - mov word[GUImouseposy],0 -.nowrapup - cmp word[GUImouseposy],223 - jbe .nowrapdown - mov word[GUImouseposy],100 -.nowrapdown - jmp ProcessMouseButtons - -ProcessMouseWrap: - call Get_MousePositionDisplacement - add word[GUImouseposx],cx -.again - test word[GUImouseposx],8000h - jz .nowrapleft - add word[GUImouseposx],256 - jmp .again -.nowrapleft - cmp word[GUImouseposx],255 - jbe .nowrapright - sub word[GUImouseposx],256 - jmp .again -.nowrapright - add word[GUImouseposy],dx -.again2 - test word[GUImouseposy],8000h - jz .nowrapup - add word[GUImouseposy],224 - jmp .again2 -.nowrapup - cmp word[GUImouseposy],223 - jbe .nowrapdown - cmp byte[GUIHold],1 - jne .nohold - sub word[GUImouseposy],224-16 - jmp .again2 -.nohold - sub word[GUImouseposy],224 - jmp .again2 -.nowrapdown - cmp dx,0 - jne .nozero - cmp cx,0 - je .zero -.nozero - mov byte[MouseMoveOkay],1 -.zero -ProcessMouseButtons: - cmp byte[MouseMoveOkay],1 - jne .zero - mov byte[GUIOnMenuItm],0 - mov ax,[GUImouseposx] - cmp ax,[GUIMenuL] - jbe .zero - cmp ax,[GUIMenuR] - jae .zero - mov ax,[GUImouseposy] - cmp ax,18 - jbe .zero - cmp ax,[GUIMenuD] - jae .zero - ; Mouse Menu - xor dx,dx - sub ax,18 - mov bx,10 - div bx - and eax,0FFh - mov ebx,[GUICYLocPtr] - mov byte[GUIOnMenuItm],2 - cmp byte[eax+ebx+1],0 - je .zero - mov [GUIcrowpos],al - mov byte[GUIOnMenuItm],1 -.zero - ; Check if mouse is clicked on menu - mov bx,[mousebuttonstat] - cmp byte[GUIRClick],1 - jne .norclick2 - test bx,02h - jz .norclick - cmp byte[romloadskip],0 - jne .norclick2 - cmp byte[MousePRClick],0 - jne .norclick2 - mov byte[GUIQuit],2 -.norclick - mov byte[MousePRClick],0 -.norclick2 - test bx,01h - jz near .notclicked - cmp byte[GUIpclicked],1 - je near .noclick - cmp byte[GUIOnMenuItm],2 - je near .noclick - cmp byte[GUIOnMenuItm],1 - jne .nomenuitem - call GUITryMenuItem - jmp .noclick -.nomenuitem - - cmp word[GUImouseposy],3 - jb near .noclickedw - cmp word[GUImouseposy],14 - ja near .noclickedw - cmp word[GUImouseposx],230 - jb near .noclickedw - cmp word[GUImouseposx],233 - jb near .noclickedw - cmp word[GUImouseposx],242 - ja .notfound7 -%ifdef __UNIXSDL__ - jmp .clickawn -%endif - cmp word[GUImouseposy],8 - jb .clickawn - cmp word[GUImouseposy],8 - ja .clickawn2 -.clickawn - mov byte[GUIcwinpress],1 - jmp .noclick -.clickawn2 - mov byte[GUIcwinpress],3 - jmp .noclick -.notfound7 - cmp word[GUImouseposx],244 - jb near .noclickedw - cmp word[GUImouseposx],253 - ja .notfound8 - mov byte[GUIcwinpress],2 - jmp .noclick -.notfound8 -.noclickedw - - cmp word[GUImouseposy],15 - ja near .nomenu - cmp word[GUImouseposy],3 - jb near .noclicked - cmp word[GUImouseposy],13 - ja near .noclicked -; GUIDMHelp 4,12,GUIMenuItem+6,1 - cmp word[GUImouseposx],4 - jb near .noclicked - cmp word[GUImouseposx],12 - ja .notfound - mov byte[GUIcmenupos],1 - mov byte[GUIcrowpos],0 - jmp .noclick -.notfound -; GUIDMHelp 17,47,GUIMenuItem,2 - cmp word[GUImouseposx],17 - jb near .noclicked - cmp word[GUImouseposx],47 - ja .notfound2 - mov byte[GUIcmenupos],2 - mov byte[GUIcrowpos],0 - jmp .noclick -.notfound2 -; GUIDMHelp 52,94,GUIMenuItem+7,3 - cmp word[GUImouseposx],52 - jb near .noclicked - cmp word[GUImouseposx],94 - ja .notfound3 - mov byte[GUIcmenupos],3 - mov byte[GUIcrowpos],0 - jmp .noclick -.notfound3 -; GUIDMHelp 99,135,GUIMenuItem+14,4 - cmp word[GUImouseposx],99 - jb near .noclicked - cmp word[GUImouseposx],135 - ja .notfound4 - mov byte[GUIcmenupos],4 - mov byte[GUIcrowpos],0 - jmp .noclick -.notfound4 -; GUIDMHelp 140,188,GUIMenuItem+21,5 - cmp word[GUImouseposx],140 - jb near .noclicked - cmp word[GUImouseposx],188 - ja .notfound5 - mov byte[GUIcmenupos],5 - mov byte[GUIcrowpos],0 - jmp .noclick -.notfound5 -; GUIDMHelp 193,223,GUIMenuItem+29,6 - cmp word[GUImouseposx],193 - jb near .noclicked - cmp word[GUImouseposx],223 - ja .notfound6 - mov byte[GUIcmenupos],6 - mov byte[GUIcrowpos],0 - jmp .noclick -.notfound6 - jmp .noclick -.noclicked - -%ifdef __MSDOS__ - jmp .noclick -%else - mov byte[GUIpclicked],1 - mov byte[GUIHold],255 - mov eax,[GUImouseposy] - mov [GUIHoldYlim],eax - mov eax,[GUImouseposx] - mov [GUIHoldXlimL],eax - call MouseWindow - jmp .noclick -%endif -.nomenu - cmp byte[GUIcmenupos],0 - je near .checkmenuboxclick - mov al,[GUIcmenupos] - mov [GUIpmenupos],al - mov byte[GUIcmenupos],0 -.noclick - mov byte[GUIpclicked],1 - xor eax,eax - mov al,[GUIwinptr] - dec eax - xor ebx,ebx - mov bl,[GUIwinorder+eax] - cmp byte[GUIHold],2 - je near .hold2 - cmp byte[GUIHold],3 - je near .hold3 - cmp byte[GUIHold],4 - je near .hold4 - cmp byte[GUIHold],5 - je near .hold5 - cmp byte[GUIHold],6 - je near .hold6 - cmp byte[GUIHold],7 - je near .hold7 - cmp byte[GUIHold],1 - je near .hold - cmp byte[GUIHold],255 - je .holded - mov byte[GUICHold],0 - ret -.holded - mov eax,[GUIHoldYlim] - mov [GUImouseposy],eax - mov eax,[GUIHoldXlimL] - mov [GUImouseposx],eax - mov cx,[GUIHoldXlimL] - mov dx,[GUIHoldYlim] - call Set_MousePosition - ret -.hold2 - ; Colour Slide Bar Hold - mov eax,[GUIHoldYlim] - mov [GUImouseposy],eax - mov ebx,[GUImouseposx] - mov eax,[GUIHoldXlimL] - cmp ebx,eax - jnl .noless2 - mov [GUImouseposx],eax -.noless2 - mov eax,[GUIHoldXlimR] - cmp ebx,eax - jng .nogreat2 - mov [GUImouseposx],eax -.nogreat2 - mov byte[lastmouseholded],1 - jmp DisplayGUIOptnsClick -.hold3 - ; Box Hold - mov ebx,[GUIHoldYlim] - cmp ebx,[GUImouseposy] - jl .boxhold1 - mov [GUImouseposy],ebx -.boxhold1 - mov ebx,[GUIHoldXlimL] - cmp ebx,[GUImouseposx] - jl .boxhold2 - mov [GUImouseposx],ebx -.boxhold2 - mov ebx,[GUIHoldYlimR] - cmp ebx,[GUImouseposy] - jg .boxhold3 - mov [GUImouseposy],ebx -.boxhold3 - mov ebx,[GUIHoldXlimR] - cmp ebx,[GUImouseposx] - jg .boxhold4 - mov [GUImouseposx],ebx -.boxhold4 - mov byte[lastmouseholded],1 - jmp GUIWindowMove -.hold4 - mov eax,[GUImouseposx] - sub eax,[GUIwinposx+ebx*4] - mov edx,[GUImouseposy] - sub edx,[GUIwinposy+ebx*4] - cmp eax,[GUIHoldXlimL] - jl near .nobhold4 - cmp edx,[GUIHoldYlim] - jl near .nobhold4 - cmp eax,[GUIHoldXlimR] - jg near .nobhold4 - cmp edx,[GUIHoldYlimR] - jg near .nobhold4 - mov al,[GUICBHold2] - mov [GUICBHold],al - ret -.nobhold4 - mov byte[GUICBHold],0 - ret -.hold5 - ; Sound Slide Bar Hold - mov eax,[GUIHoldYlim] - mov [GUImouseposy],eax - mov ebx,[GUImouseposx] - mov eax,[GUIHoldXlimL] - cmp ebx,eax - jnl .noless5 - mov [GUImouseposx],eax -.noless5 - mov eax,[GUIHoldXlimR] - cmp ebx,eax - jng .nogreat5 - mov [GUImouseposx],eax -.nogreat5 - mov byte[lastmouseholded],1 - jmp DisplayGUISoundClick -.hold6 - ; Speed Slide Bar Hold - mov eax,[GUIHoldYlim] - mov [GUImouseposy],eax - mov ebx,[GUImouseposx] - mov eax,[GUIHoldXlimL] - cmp ebx,eax - jnl .noless6 - mov [GUImouseposx],eax -.noless6 - mov eax,[GUIHoldXlimR] - cmp ebx,eax - jng .nogreat6 - mov [GUImouseposx],eax -.nogreat6 - mov byte[lastmouseholded],1 - jmp DisplayGUISpeedClick -.hold7 - ; Video Slide Bar Hold - mov eax,[GUIHoldYlim] - mov [GUImouseposy],eax - mov ebx,[GUImouseposx] - mov eax,[GUIHoldXlimL] - cmp ebx,eax - jnl .noless7 - mov [GUImouseposx],eax -.noless7 - mov eax,[GUIHoldXlimR] - cmp ebx,eax - jng .nogreat7 - mov [GUImouseposx],eax -.nogreat7 - mov byte[lastmouseholded],1 - jmp DisplayGUIVideoClick -.hold - cmp word[GUImouseposy],16 - jge .noover - test byte[mousewrap],1 - jz .nomwrap - add word[GUImouseposy],224-16 - jmp .hold -.nomwrap - mov word[GUImouseposy],16 -.noover - mov cx,[GUImouseposy] - sub cx,[GUIHoldy] - add cx,[GUIHoldym] - movsx ecx,cx - xor eax,eax - mov al,[GUIwinptr] - dec eax - xor ebx,ebx - mov bl,[GUIwinorder+eax] - mov [GUIwinposy+ebx*4],ecx - mov cx,[GUImouseposx] - sub cx,[GUIHoldx] - add cx,[GUIHoldxm] - movsx ecx,cx - mov [GUIwinposx+ebx*4],ecx - ret -.notclicked - mov byte[GUICHold],0 - mov byte[GUIpclicked],0 - mov byte[GUIHold],0 - -%ifdef __UNIXSDL__ - cmp byte[GUIcwinpress],1 - jne .notwinpressa - mov byte[GUIcwinpress],0 - cmp word[GUImouseposy],3 - jb .notwinpressa - cmp word[GUImouseposy],13 - ja .notwinpressa - cmp word[GUImouseposx],233 - jb .notwinpressa - cmp word[GUImouseposx],242 - ja .notwinpressa - call SwitchFullScreen - ret -%endif - -%ifdef __WIN32__ - cmp byte[GUIcwinpress],1 - jne .notwinpressa - mov byte[GUIcwinpress],0 - cmp word[GUImouseposy],3 - jb .notwinpressa - cmp word[GUImouseposy],7 - ja .notwinpressa - cmp word[GUImouseposx],233 - jb .notwinpressa - cmp word[GUImouseposx],242 - ja .notwinpressa - call SwitchFullScreen - ret -%endif - -.notwinpressa - -%ifndef __MSDOS__ - cmp byte[GUIcwinpress],2 - jne .notwinpressb - mov byte[GUIcwinpress],0 - cmp word[GUImouseposy],3 - jb .notwinpressb - cmp word[GUImouseposy],13 - ja .notwinpressb - cmp word[GUImouseposx],244 - jb .notwinpressb - cmp word[GUImouseposx],253 - ja .notwinpressb - mov byte[GUIQuit],1 - ret -.notwinpressb - - cmp byte[GUIcwinpress],3 - jne .notwinpressc - mov byte[GUIcwinpress],0 - cmp word[GUImouseposy],9 - jb .notwinpressc - cmp word[GUImouseposy],13 - ja .notwinpressc - cmp word[GUImouseposx],233 - jb .notwinpressc - cmp word[GUImouseposx],242 - ja .notwinpressc -%endif -%ifdef __WIN32__ - pushad - call MinimizeWindow - popad -%endif -%ifndef __MSDOS__ - ret -%endif -.notwinpressc - - ; ButtonProcess - cmp byte[GUICBHold],1 - je near GUILoadData - cmp byte[GUICBHold],2 - je near GUIProcReset - cmp byte[GUICBHold],3 - je near GUIProcReset - cmp byte[GUICBHold],4 ; set video mode - je near GUIProcVideo -%ifndef __MSDOS__ - cmp byte[GUICBHold],12 ; set custom video mode - je near GUIProcCustomVideo -%endif - cmp byte[GUICBHold],37 ; reset ntsc options - je near GUINTSCReset - cmp byte[GUICBHold],38 ; reset ntsc options - je near GUINTSCReset - cmp byte[GUICBHold],39 ; reset ntsc options - je near GUINTSCReset - cmp byte[GUICBHold],81 ; ntsc preset - je near GUINTSCPreset - cmp byte[GUICBHold],82 ; ntsc preset - je near GUINTSCPreset - cmp byte[GUICBHold],83 ; ntsc preset - je near GUINTSCPreset - cmp byte[GUICBHold],84 ; ntsc preset - je near GUINTSCPreset - cmp byte[GUICBHold],10 - je near GUIProcStates - cmp byte[GUICBHold],11 - je near GUIProcStates - cmp byte[GUICBHold],5 - je near CheatCodeRemove - cmp byte[GUICBHold],6 - je near CheatCodeToggle - cmp byte[GUICBHold],7 - je near CheatCodeSave - cmp byte[GUICBHold],8 - je near CheatCodeLoad - cmp byte[GUICBHold],9 - je near ProcessCheatCode - cmp byte[GUICBHold],33 - je near CheatCodeFix - cmp byte[GUICBHold],14 - je near SetDevice - cmp byte[GUICBHold],15 - je near CalibrateDev1 - cmp byte[GUICBHold],16 ; movie replay - jne .notMoviePlay - mov byte[GUICBHold],0 - pushad - call MoviePlay - popad - ret -.notMoviePlay - cmp byte[GUICBHold],17 - jne .notMovieRecord0 ; movie record - mov byte[GUICBHold],0 - pushad - call MovieRecord - popad - ret -.notMovieRecord0 - cmp byte[GUICBHold],18 ; movie stop - jne .notMovieStop - mov byte[GUICBHold],0 - pushad - call MovieStop - popad - ret -.notMovieStop - cmp byte[GUICBHold],19 ; overwrite zmv ? yes - jne .notMovieRecord1 - mov byte[GUICBHold],0 - pushad - call MovieRecord - popad - ret -.notMovieRecord1 - cmp byte[GUICBHold],20 ; overwrite zmv ? no - jne .notSkipMovie - mov byte[GUICBHold],0 - pushad - call SkipMovie - popad - ret -.notSkipMovie - cmp byte[GUICBHold],29 ; insert chapter - jne .noInsertChap - mov byte[GUICBHold],0 - pushad - call MovieInsertChapter - popad - ret -.noInsertChap - cmp byte[GUICBHold],30 ; back to previous chapter - jne .noPrevChap - mov byte[GUICBHold],0 - mov byte[GUIQuit],2 - pushad - call MovieSeekBehind - popad - ret -.noPrevChap - cmp byte[GUICBHold],31 ; jump to next chapter - jne .noNextChap - mov byte[GUICBHold],0 - mov byte[GUIQuit],2 - pushad - call MovieSeekAhead - popad - ret -.noNextChap - cmp byte[GUICBHold],32 ; append movie - jne .noAppend - mov byte[GUICBHold],0 - mov byte[GUIQuit],2 - pushad - call MovieAppend - popad - ret -.noAppend - cmp byte[GUICBHold],34 ; dump raw - jne .noDumpRaw - mov byte[GUICBHold],0 - mov byte[GUIQuit],2 - pushad - call SetMovieForcedLength - call MovieDumpRaw - popad - cmp byte[MovieVideoMode],2 - jb .nomencoder - cmp byte[mencoderExists],0 - jne .nomencoder - call guimencodermsg -.nomencoder - cmp byte[MovieAudio],0 - je .nolame - cmp byte[MovieAudioCompress],0 - je .nolame - cmp byte[lameExists],0 - jne .nolame - call guilamemsg -.nolame - ret -.noDumpRaw - cmp byte[GUICBHold],35 ; stop dump - jne .noStopDumping - mov byte[GUICBHold],0 - mov byte[GUIQuit],2 - pushad - call MovieStop - popad - ret -.noStopDumping - cmp byte[GUICBHold],40 - je near SetAllKeys - cmp byte[GUICBHold],50 - jne .notstartcheat - call CheatCodeSearchInit -.notstartcheat - cmp byte[GUICBHold],60 - jne .nocombclear - mov byte[GUIComboTextH],0 - mov byte[GUINumCombo],0 - mov dword[GUIComboKey],0 -.nocombclear - cmp byte[GUICBHold],61 - jne .nocomboadd - cmp byte[NumCombo],50 - je .nocomboadd - call ComboAdder -.nocomboadd - cmp byte[GUICBHold],62 - jne .nocomboreplace - cmp byte[NumCombo],0 - je .nocomboreplace - call ComboReplace -.nocomboreplace - cmp byte[GUICBHold],63 - jne .nocomboremove - cmp byte[NumCombo],0 - je .nocomboremove - call ComboRemoval -.nocomboremove - cmp byte[GUICBHold],51 - jne .notrestartcheat - mov byte[CheatWinMode],0 - mov byte[CheatSearchStatus],0 -.notrestartcheat - cmp byte[GUICBHold],52 - jne .notviewcheat - mov byte[CheatWinMode],2 -.notviewcheat - cmp byte[GUICBHold],53 - jne .notsearchprocess - call CheatCodeSearchProcess -.notsearchprocess - cmp byte[GUICBHold],54 - jne .notreturnview - mov byte[CheatWinMode],1 -.notreturnview - cmp byte[GUICBHold],55 - jne .notadd - cmp dword[NumCheatSrc],0 - je .notadd - mov byte[CheatWinMode],3 - mov byte[CurCStextpos],0 - mov byte[CSInputDisplay],'_' - mov byte[CSInputDisplay+1],0 - mov byte[CSDescDisplay],0 -.notadd - cmp byte[GUICBHold],56 - jne .notreturnadd - mov byte[CheatWinMode],2 -.notreturnadd - cmp byte[GUICBHold],57 - jne .noinsertscc - call AddCSCheatCode -; call InsertSearchDescription -.noinsertscc -%ifndef __MSDOS__ - cmp byte[GUICBHold],65 - jne .nozsnespage - pushad - call ZsnesPage - popad -.nozsnespage - cmp byte[GUICBHold],66 - jne .nodocspage - pushad - call DocsPage - popad -.nodocspage -%endif - mov byte[GUICBHold],0 - ret -.checkmenuboxclick - mov byte[GUIpclicked],1 - xor eax,eax - mov al,[GUIwinptr] - or eax,eax - jz near .nomore - dec eax - xor ebx,ebx - mov bl,[GUIwinorder+eax] - mov ecx,[GUIwinposx+ebx*4] - cmp ecx,[GUImouseposx] - jge .noinsdwin - mov ecx,[GUIwinposy+ebx*4] - cmp ecx,[GUImouseposy] - jge .noinsdwin - mov ecx,[GUIwinposx+ebx*4] - add ecx,[GUIwinsizex+ebx*4] - cmp ecx,[GUImouseposx] - jle .noinsdwin - mov ecx,[GUIwinposy+ebx*4] - add ecx,[GUIwinsizey+ebx*4] - add ecx,10 - cmp ecx,[GUImouseposy] - jle .noinsdwin - jmp GUIWinClicked -.noinsdwin -.nextwindowfind - or eax,eax - jz near .nomore - dec eax - mov bl,[GUIwinorder+eax] - mov ecx,[GUIwinposx+ebx*4] - cmp ecx,[GUImouseposx] - jge .nextwindowfind - mov ecx,[GUIwinposy+ebx*4] - cmp ecx,[GUImouseposy] - jge .nextwindowfind - mov ecx,[GUIwinposx+ebx*4] - add ecx,[GUIwinsizex+ebx*4] - cmp ecx,[GUImouseposx] - jle .nextwindowfind - mov ecx,[GUIwinposy+ebx*4] - add ecx,[GUIwinsizey+ebx*4] - add ecx,10 - cmp ecx,[GUImouseposy] - jle .nextwindowfind - ; Shift all following windows downwards by 1 -.nextfind - inc eax - cmp al,[GUIwinptr] - je .foundend - mov cl,[GUIwinorder+eax] - mov [GUIwinorder+eax-1],cl - jmp .nextfind -.foundend - mov byte[GUIpclicked],0 - mov [GUIwinorder+eax-1],bl - ret -.nomore - cmp dword[SantaPos],272 - je .nosanta - cmp byte[ShowTimer],0 - jne .nosanta - mov dword[MsgGiftLeft],36*4 - mov byte[ShowTimer],1 -.nosanta - ret - -GUIProcVideo: - mov byte[GUICBHold],0 -%ifdef __MSDOS__ - mov al,[GUIcurrentvideocursloc] - cmp al,3 - je .yes16b - cmp al,5 - je .yes16b - cmp al,7 - je .yes16b - cmp al,10 - je .yes16b - cmp al,8 - jne .no16b -.yes16b -%endif -; mov byte[newengen],0 -; mov byte[cfgnewgfx],0 -; jmp .skipno16b -.no16b - mov byte[newengen],1 -.skipno16b - call guiprevideo - mov al,[cvidmode] - mov [.prevvid],al - mov al,[GUIcurrentvideocursloc] - mov [cvidmode],al - mov byte[ExitFromGUI],1 - call initvideo - cmp byte[videotroub],1 - je .failed - call GUISetPal - call guipostvideo - cmp dword[GUIkeydelay],0 - je .failed2 - mov dword[GUIkeydelay],0 - ret -.fullsc -%ifndef __MSDOS__ - mov [PrevFSMode],al -%endif - ret -.failed - mov byte[videotroub],0 - mov al,[.prevvid] - mov [cvidmode],al - call initvideo - call GUISetPal - call guipostvideofail - mov dword[GUIkeydelay],0 - ret -.failed2 - mov byte[videotroub],0 - mov al,[.prevvid] - mov [cvidmode],al - call initvideo - call GUISetPal - call vidpastecopyscr - mov dword[GUIkeydelay],0 - ret -SECTION .bss -.prevvid resb 1 -SECTION .text - -GUINTSCReset: - cmp byte[GUICBHold],38 - je .reset2 - cmp byte[GUICBHold],39 - jne .reset1 -.reset1 - mov byte[NTSCBlend],0 - mov byte[NTSCRef],0 - mov byte[NTSCHue],0 - mov byte[NTSCSat],0 - mov byte[NTSCCont],0 - mov byte[NTSCBright],0 - mov byte[NTSCSharp],0 - cmp byte[GUICBHold],37 - je .reset2done -.reset2 - mov byte[NTSCGamma],0 - mov byte[NTSCRes],0 - mov byte[NTSCArt],0 - mov byte[NTSCFringe],0 - mov byte[NTSCBleed],0 - mov byte[NTSCWarp],0 -.reset2done - mov byte[GUICBHold],0 -%ifndef __MSDOS__ - pushad - call NTSCFilterInit - popad -%endif - ret - -GUINTSCPreset: - cmp byte[GUICBHold],81 - jne near .nextpreset - mov byte[NTSCPresetVar],0 - jmp .lastpreset -.nextpreset - cmp byte[GUICBHold],82 - jne near .nextpreset2 - mov byte[NTSCPresetVar],1 - jmp .lastpreset -.nextpreset2 - cmp byte[GUICBHold],83 - jne near .nextpreset3 - mov byte[NTSCPresetVar],2 - jmp .lastpreset -.nextpreset3 - cmp byte[GUICBHold],84 - jne near .lastpreset - mov byte[NTSCPresetVar],3 -.lastpreset -%ifndef __MSDOS__ - pushad - call NTSCFilterInit - popad -%endif - mov byte[NTSCPresetVar],4 - mov byte[GUICBHold],0 - ret - -%ifndef __MSDOS__ -GUIProcCustomVideo: - pushad - call SetCustomXY - popad - mov byte[GUICBHold],0 - mov dword[GUIInputBox],0 -%ifdef __WIN32__ - cmp byte[cvidmode],37 -%else - cmp byte[cvidmode],20 -%endif - jl .notcustomres - mov byte[changeRes],1 - pushad - call initwinvideo - call Clear2xSaIBuffer - popad -.notcustomres - ret -%endif - -NEWSYM SwitchFullScreen - pushad - call Clear2xSaIBuffer - xor eax,eax - mov al,[cvidmode] -%ifndef __MSDOS__ - cmp byte[GUIWFVID+eax],0 - je .fullsc -%else - jmp .fullsc -%endif -%ifndef __MSDOS__ - mov al,[PrevWinMode] - mov [cvidmode],al -%endif - call initvideo - popad - ret -.fullsc -%ifndef __MSDOS__ - mov al,[PrevFSMode] - mov [cvidmode],al -%endif - call initvideo - popad - ret - -GUIWindowMove: - xor eax,eax - mov al,[GUIwinptr] - dec eax - xor ebx,ebx - mov bl,[GUIwinorder+eax] - mov eax,[GUImouseposx] - sub eax,[GUIwinposx+ebx*4] - mov edx,[GUImouseposy] - sub edx,[GUIwinposy+ebx*4] - cmp ebx,13 - je near DisplayGUICheatSearchClick2 - cmp ebx,7 - je near DisplayGUICheatClick2 - cmp ebx,5 - je near DisplayGUIVideoClick2 - cmp ebx,3 - je near DisplayGUIInputClick2 - cmp ebx,16 - je near DisplayGUIComboClick2 - jmp DisplayGUIConfirmClick2 - -GUIWinClicked: - mov ecx,[GUImouseposx] - sub ecx,[GUIwinposx+ebx*4] - mov edx,[GUImouseposy] - sub edx,[GUIwinposy+ebx*4] - mov esi,ecx - sub esi,[GUIwinsizex+ebx*4] - add esi,10 - cmp esi,-1 - jle .noclose - cmp esi,10 - jge .noclose - cmp edx,0 - jle .noclose - cmp edx,10 - jge .noclose - mov byte[GUIwinorder+eax],0 - mov byte[GUIwinactiv+ebx],0 - dec byte[GUIwinptr] - ret -.noclose - cmp edx,10 - jge .nomove - mov byte[GUIHold],1 - mov ax,[GUIwinposx+ebx*4] - movsx eax,ax - mov [GUIHoldxm],eax - mov ax,[GUIwinposy+ebx*4] - movsx eax,ax - mov [GUIHoldym],eax - xor eax,eax - mov ax,[GUImouseposx] - mov [GUIHoldx],eax - mov ax,[GUImouseposy] - mov [GUIHoldy],eax - ret -.nomove - mov eax,[GUImouseposx] - sub eax,[GUIwinposx+ebx*4] - mov edx,[GUImouseposy] - sub edx,[GUIwinposy+ebx*4] - cmp ebx,1 - je near DisplayGUIConfirmClick - cmp ebx,2 - je near DisplayGUIChoseSaveClick - cmp ebx,3 - je near DisplayGUIInputClick - cmp ebx,4 - je near DisplayGUIOptionClick - cmp ebx,5 - je near DisplayGUIVideoClick - cmp ebx,6 - je near DisplayGUISoundClick - cmp ebx,7 - je near DisplayGUICheatClick - cmp ebx,8 - je near DisplayNetOptnsClick - cmp ebx,9 - je near DisplayGameOptnsClick - cmp ebx,10 - je near DisplayGUIOptnsClick - cmp ebx,11 - je near DisplayGUIAboutClick - cmp ebx,12 - je near DisplayGUIResetClick - cmp ebx,13 - je near DisplayGUICheatSearchClick - cmp ebx,14 - je near DisplayGUIStatesClick - cmp ebx,15 - je near DisplayGUIMovieClick - cmp ebx,16 - je near DisplayGUIComboClick - cmp ebx,17 - je near DisplayGUIAddOnClick - cmp ebx,18 - je near DisplayGUIChipClick - cmp ebx,19 - je near DisplayGUIPathsClick - cmp ebx,20 - je near DisplayGUISaveClick - cmp ebx,21 - je near DisplayGUISpeedClick - ret - -%macro GUIClickArea 5 - cmp eax,%1 - jl %5 - cmp edx,%2 - jl %5 - cmp eax,%3 - jg %5 - cmp edx,%4 - jg %5 -%endmacro - -%macro GUIClickCButton 3 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 -%%noclick -%endmacro - -%macro GUIClickCButtonf 4 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 -%ifdef __WIN32__ - pushad - call %4 - popad -%endif -%%noclick -%endmacro - -%macro GUIClickCButtonK 4 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 - pushad - call %4 - popad -%%noclick -%endmacro - -%macro GUIClickCButtonB 3 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 - pushad - call drawscreenwin - call initwinvideo - call Clear2xSaIBuffer - popad -%%noclick -%endmacro - -%macro GUIClickCButtonN 4 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick -%ifdef __WIN32__ - cmp %3,1 - je %%dontenablek43 - mov byte[Keep4_3Ratio],1 -%%dontenablek43 -%endif - xor %3,1 -%ifdef __WIN32__ - pushad - call %4 - popad -%endif -%%noclick -%endmacro - -%macro GUIClickCButtonC 3 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 - mov dword[GUIccombviewloc],0 - mov dword[GUIccombcursloc],0 - mov dword[GUIccomblcursloc],0 -%%noclick -%endmacro - -%macro GUIClickCButtonM 3 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 - mov byte[MultiTap],1 - cmp byte[pl12s34],1 - je %%nomtap - cmp byte[pl3contrl],0 - jne %%noclick - cmp byte[pl4contrl],0 - jne %%noclick - cmp byte[pl5contrl],0 - jne %%noclick -%%nomtap - mov byte[MultiTap],0 -%%noclick -%endmacro - -%macro GUIClickCButtonID 3 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 - call SetDevice -%%noclick -%endmacro - -%ifdef __MSDOS__ -%macro GUIClickCButton3 3 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 - DOSClearScreenMouse - ret -%%noclick -%endmacro - -%macro DOSClearScreenMouse 0 - call DOSClearScreen - push eax - push ecx - mov eax,[vidbufferofsb] - mov ecx,288*128 -%%loop - mov dword[eax],0 - add eax,4 - dec ecx - jnz %%loop - pop ecx - pop eax - ret -%endmacro -%endif - -%macro GUIClickCButton5 4 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - cmp %3,%4 - jne %%set - xor %3,%4 - jmp %%clear -%%set - mov %3,%4 -%%clear - ret -%%noclick -%endmacro - -%macro GUIClickCButton6 4 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - cmp %3,%4 - jne %%set - xor %3,%4 - jmp %%clear -%%set - mov %3,%4 - push eax - push ecx - mov eax,[vidbufferofsb] - mov ecx,288*128 -%%loop - mov dword[eax],0 - add eax,4 - dec ecx - jnz %%loop - pop ecx - pop eax -%%clear - ret -%%noclick -%endmacro - -%macro GUIClickCButtonfr 3 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - mov byte[FPSOn],0 - cmp %3,0 - je %%zero - mov %3,0 - jmp %%notzero -%%zero - mov %3,1 -%%notzero -%%noclick -%endmacro - -%macro GUIClickCButtonL 2 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor byte[showallext],1 - mov dword[GUIcurrentfilewin],0 - call GetLoadData - ret -%%noclick -%endmacro - -%macro GUIClickCButtonI 3 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 - pushad -%ifdef __OPENGL__ - cmp byte[cvidmode],5 - jl %%skipinit - pushad - call drawscreenwin - call initwinvideo - popad -%%skipinit -%endif - call Clear2xSaIBuffer - popad -%%noclick -%endmacro - -%macro GUIClickCButtonT 4 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - xor %3,1 - mov %4,0 -%%noclick -%endmacro - -%macro GUIClickCButton5MMXC 4 - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick - cmp byte[MMXSupport],0 - je %%clear - cmp %3,%4 - jne %%set - xor %3,%4 - jmp %%clear -%%set - mov %3,%4 -%%clear - ret -%%noclick -%endmacro - -%macro GUISlidebarPostImpl 13 ; x1,y1,x2,y2,upjump,downjump,holdpos,scsize,view,cur,listsize - cmp dword[%11],0 - je near %%nolower - cmp dword[GUIdispmode],1 - je near %%slidebar - GUIClickArea %1,%2-7,%3,%2-1,%%noupper - mov byte[%12],%13 - mov byte[GUICHold],%7 - jmp %5 -%%noupper - GUIClickArea %1,%4+1,%3,%4+7,{near %%nolower} - mov byte[%12],%13 - mov byte[GUICHold],%7+1 - jmp %6 -%%slidebar - GUIClickArea %1,%2,%3,%4,{near %%nolower} - mov byte[%12],%13 - ; displacement = (GUIdispmode * pixeldisp. / (listsize-scsize)) - mov eax,[%11] - sub eax,%8 - mov ebx,edx - sub ebx,[GUIlastypos] - imul ebx - mov ebx,[GUIlastdispval] - or ebx,ebx - jz near %%zerodiv - test ebx,80000000h - jnz near %%zerodiv - idiv ebx - mov ebx,[GUIlastvpos] - add ebx,eax - mov [%9],ebx - mov ebx,[GUIlastcpos] - add ebx,eax - mov [%10],ebx - test dword[%9],8000000h - jz %%noneg - mov dword[%9],0 -%%noneg - test dword[%10],8000000h - jz %%noneg2 - mov dword[%10],0 -%%noneg2 - mov eax,[%11] - dec eax - cmp [%10],eax - jb %%notover - mov [%10],eax -%%notover - sub eax,%8-1 - cmp [%9],eax - jb %%notover2 - mov [%9],eax -%%notover2 -%%zerodiv - ret -%%nolower -%endmacro - -SECTION .bss -GUIlastdispval resd 1 -GUIdispmode resd 1 -GUIlastypos resd 1 -GUIlastcpos resd 1 -GUIlastvpos resd 1 -SECTION .text - -%macro GUISlidebarImpl 10 ; x1,y1,x2,y2,GUI?StA,ScrnSize,ViewLoc,CursLoc,Entries,win# - mov dword[GUIdispmode],0 - GUIClickArea %1,%2,%3,%4,{near %%nobar} - sub edx,%2 - cmp [%5+4],edx - ja near %%above - cmp [%5+8],edx - jb near %%below - add edx,%2 - mov [GUIlastypos],edx - mov dword[GUIdispmode],1 - mov eax,[GUIwinposy+%10*4] - add eax,%2 - mov [GUIHoldYlim],eax - mov eax,[GUIwinposy+%10*4] - add eax,%4 - mov [GUIHoldYlimR],eax - mov eax,[GUIwinposx+%10*4] - add eax,%1 - mov [GUIHoldXlimL],eax - mov eax,[GUIwinposx+%10*4] - add eax,%3 - mov [GUIHoldXlimR],eax - mov eax,[%5] - mov [GUIlastdispval],eax - mov eax,[%8] - mov [GUIlastcpos],eax - mov eax,[%7] - mov [GUIlastvpos],eax - mov byte[GUIHold],3 - ret -%%above - sub dword[%7],%6 - sub dword[%8],%6 - test dword[%7],8000000h - jz %%noneg - mov dword[%7],0 - mov dword[%8],0 -%%noneg - ret -%%below - add dword[%7],%6 - add dword[%8],%6 - mov ebx,[%9] - dec ebx - cmp [%8],ebx - jb %%notoverflow - mov [%8],ebx - sub ebx,%6-1 - mov [%7],ebx -%%notoverflow - mov ebx,[%9] - sub ebx,%6 - cmp [%7],ebx - jb %%notoverflow2 - mov [%7],ebx -%%notoverflow2 - ret -%%nobar - ; upper arrow - GUIClickArea %1,%2-7,%3,%2-1,%%noupper - mov eax,[GUIwinposy+%10*4] - add eax,%2-7 - mov [GUIHoldYlim],eax - mov eax,[GUIwinposy+%10*4] - add eax,%2-1 - mov [GUIHoldYlimR],eax - mov eax,[GUIwinposx+%10*4] - add eax,%1 - mov [GUIHoldXlimL],eax - mov eax,[GUIwinposx+%10*4] - add eax,%3 - mov [GUIHoldXlimR],eax - mov byte[GUIHold],3 - ret -%%noupper - ; lower arrow - GUIClickArea %1,%4+1,%3,%4+7,%%nolower - mov eax,[GUIwinposy+%10*4] - add eax,%4+1 - mov [GUIHoldYlim],eax - mov eax,[GUIwinposy+%10*4] - add eax,%4+7 - mov [GUIHoldYlimR],eax - mov eax,[GUIwinposx+%10*4] - add eax,%1 - mov [GUIHoldXlimL],eax - mov eax,[GUIwinposx+%10*4] - add eax,%3 - mov [GUIHoldXlimR],eax - mov byte[GUIHold],3 - ret -%%nolower -%endmacro - -%macro GUIPostWinBoxMove 11 ;x1,y1,x2,y2,view,curs,num,.scru,.scrd,jumpto,sizeofscreen - cmp eax,%1 - jl near %%noload - cmp eax,%3 - jg near %%noload - cmp edx,%2 - je near %%scrollup - cmp edx,%4 - jne near %%noload - ; Scroll Down - cmp dword[%7],%11 - jbe %9 - mov ebx,[%5] - add ebx,%11-1 - mov [%6],ebx -%9 - cmp dword[GUIScrolTim1],0 - jne near %%donescrol - mov ebx,[%7] - dec ebx - cmp ebx,[%6] - jbe %%donescrolldown - inc dword[%6] - cmp dword[%7],%11 - jbe near %%donescrol - inc dword[%5] - mov ebx,[%7] - sub ebx,%11 - cmp ebx,[%5] - ja near %%donescrolldown - mov [%5],ebx - jmp %%donescrolldown -%%scrollup - mov ebx,[%5] - mov [%6],ebx -%8 - cmp dword[GUIScrolTim1],0 - jne near %%donescrol - cmp dword[%6],0 - je %%donescrolldown - dec dword[%6] - cmp dword[%5],0 - je %%donescrolldown - dec dword[%5] -%%donescrolldown - mov dword[GUIScrolTim1],1 - cmp dword[GUIScrolTim2],4 - jb %%noscrol1 - inc dword[GUIScrolTim1] -%%noscrol1 - cmp dword[GUIScrolTim2],0 - je %%noscrol2 - inc dword[GUIScrolTim1] - dec dword[GUIScrolTim2] -%%noscrol2 -%%donescrol - jmp %10 -%%noload -%endmacro - -%macro GUIPHoldbutton 5 - GUIClickArea %1,%2,%3,%4,%%nohold - mov dword[GUIHoldXlimL],%1 - mov dword[GUIHoldXlimR],%3 - mov dword[GUIHoldYlim],%2 - mov dword[GUIHoldYlimR],%4 - mov byte[GUICBHold2],%5 - mov byte[GUIHold],4 -%%nohold -%endmacro - -%macro GUIPHoldbutton2 8 - GUIClickArea %1,%2,%3,%4,%%nohold - cmp byte[GUIHold],0 - jne %%nohold - mov dword[GUIHoldXlimL],%1 - mov dword[GUIHoldXlimR],%3 - mov dword[GUIHoldYlim],%2 - mov dword[GUIHoldYlimR],%4 - mov byte[GUICBHold2],%5 - mov byte[GUIHold],4 - cmp %6,%8 - je %%nohold - add %6,%7 -%%nohold -%endmacro - -%macro GUITextBoxInput 6 - GUIClickArea %1,%2,%3,%4,%%noclick - mov dword[GUIEditString],%5 - mov dword[GUIEditStringmLen],%6 - mov dword[GUIEditStringLTxt],0 - mov dword[GUIEditStringcWin],1 -%%noclick -%endmacro - -%macro GUITextBoxInputB 5 - GUIClickArea %1,%2,%3,%4,%%noclick - mov byte[GUINetTextm2],%5 -%%noclick -%endmacro - -%macro GUITextBoxInputNach 7 - GUIClickArea %1,%2,%3,%4,%%noclick - pushad - call %7 - popad - mov dword[GUIInputBox],%5 - mov dword[GUIInputLimit],%6-1 -%%noclick -%endmacro - -%macro GUIPButtonHole 4 - GUIClickArea %1+1,%2+1,%1+7,%2+7,%%noclick - mov %3,%4 -%%noclick -%endmacro - -%macro GUIPButtonHole2 6 - GUIClickArea %1+1,%2+1,%1+7,%2+7,%%noclick - mov %3,%4 - mov %5,%6 -%%noclick -%endmacro - -%macro GUIPButtonHoleS 4 - GUIClickArea %1+1,%2+1,%1+7,%2+7,%%noclick - mov %3,%4 -%ifdef __MSDOS__ - cmp %3,0 - je %%noclear - pushad - call DOSClearScreen - cmp byte[cvidmode],2 ;modeQ - je %%refresh - cmp byte[cvidmode],5 - jne %%nomodex -%%refresh - mov byte[cbitmode],1 - call initvideo2 - mov byte[cbitmode],0 - call GUISetPal -%%nomodex - popad -%%noclear -%endif -%%noclick -%endmacro - -%macro GUIPButtonHoleLoad 4 - GUIClickArea %1+1,%2+1,%1+7,%2+7,%%noclick - mov %3,%4 - pushad - call GetLoadData - popad -%%noclick -%endmacro - -%macro GUIWinControl 13 ;x,y,x2,y2,currentwin,vpos,#entries,starty,y/entry,cpos,winval,win#,dclicktick# - GUIClickArea %1,%2,%3,%4,{near %%noload} - cmp dword[%7],0 - je near %%noload - mov dword[%5],%11 - mov eax,edx - sub eax,%8 - xor edx,edx - mov ebx,%9 - div ebx - add eax,[%6] - mov ebx,[%7] - dec ebx - cmp eax,ebx - jg %%nomod - mov [%10],eax -%%nomod - cmp byte[GUIHold],0 - jne %%held - cmp dword[GUIDClickTL],0 - je %%noprevhold - cmp byte[GUIDClCWin],%11 - jne %%noprevhold - cmp [GUIDClCEntry],eax - jne %%noprevhold - mov dword[GUIDClickTL],0 - mov eax,%12 - cmp eax,1 - jne %%cheat - call GUILoadData - ret -%%cheat - call CheatCodeToggle - ret -%%noprevhold - mov dword[GUIDClickTL],%13 - mov byte[GUIDClCWin],%11 - mov [GUIDClCEntry],eax -%%held - mov eax,[GUIwinposy+%12*4] - add eax,%2-1 - mov [GUIHoldYlim],eax - mov eax,[GUIwinposy+%12*4] - add eax,%4+1 - mov [GUIHoldYlimR],eax - mov eax,[GUIwinposx+%12*4] - add eax,%1 - mov [GUIHoldXlimL],eax - mov eax,[GUIwinposx+%12*4] - add eax,%3 - mov [GUIHoldXlimR],eax - mov byte[GUIHold],3 - ret -%%noload -%endmacro - -%macro GUIWinControl2 13 ;Key Combination Editor Exclusive - GUIClickArea %1,%2,%3,%4,{near %%noload} - cmp dword[%7],0 - je near %%noload - mov dword[GUIccomblcursloc],0FFFFFFFFh - mov dword[%5],%11 - mov eax,edx - sub eax,%8 - xor edx,edx - mov ebx,%9 - div ebx - add eax,[%6] - mov ebx,[%7] - dec ebx - cmp eax,ebx - jg %%nomod - mov [%10],eax -%%nomod - cmp byte[GUIHold],0 - jne %%held - cmp dword[GUIDClickTL],0 - je %%noprevhold - cmp byte[GUIDClCWin],%11 - jne %%noprevhold - cmp [GUIDClCEntry],eax - jne %%noprevhold - mov dword[GUIDClickTL],0 - mov eax,%12 - cmp eax,1 - jne %%cheat - call GUILoadData - ret -%%cheat - call CheatCodeToggle - ret -%%noprevhold - mov dword[GUIDClickTL],%13 - mov byte[GUIDClCWin],%11 - mov [GUIDClCEntry],eax -%%held - mov eax,[GUIwinposy+%12*4] - add eax,%2-1 - mov [GUIHoldYlim],eax - mov eax,[GUIwinposy+%12*4] - add eax,%4+1 - mov [GUIHoldYlimR],eax - mov eax,[GUIwinposx+%12*4] - add eax,%1 - mov [GUIHoldXlimL],eax - mov eax,[GUIwinposx+%12*4] - add eax,%3 - mov [GUIHoldXlimR],eax - mov byte[GUIHold],3 - ret -%%noload -%endmacro - -%macro DGOptnsProcBox 3 - GUIClickArea %1,%2,%1+19,%2+6,%%skip - push edi - call guipresstest - pop edi - cmp ebx,1 - je %%cancelkey - cmp ebx,3Bh - je %%cancelkey - mov %3,ebx -%ifndef __MSDOS__ - cmp dword[keycontrolval],0 - je %%notwin32 - push ebx - mov ebx,[keycontrolval] - mov byte[ebx],1 - pop ebx -%%notwin32 -%endif - ret -%%cancelkey - xor ebx,ebx - mov %3,ebx - ret -%%skip -%endmacro - -%macro DGOptnsProcBoxc 5 - GUIClickArea %1,%2,%3,%4,%%skip - push edi - call guipresstest - pop edi - cmp ebx,1 - je %%cancelkey - cmp ebx,3Bh - je %%cancelkey - mov %5,ebx - ret -%%cancelkey - cmp ebx,1 - jne %%noesc - mov byte[pressed+1],2 -%%noesc - xor ebx,ebx - mov %5,ebx - ret -%%skip -%endmacro - -%macro DGOptnsProcBoxb 3 - GUIClickArea %1,%2,%1+19,%2+6,%%skip - push edi - call guipresstest - pop edi - cmp ebx,1 - je %%cancelkey - cmp ebx,3Bh - je %%cancelkey - mov %3,ebx - jmp %%donekey -%%cancelkey - cmp ebx,1 - jne %%noesc - mov byte[pressed+1],2 -%%noesc - xor ebx,ebx - mov %3,ebx -%%donekey - ret -%%skip -%endmacro - -%macro FilterExcl 3-* ; minX, minY, bytes to zero - GUIClickArea %1+1,%2+3,%1+6,%2+8,%%noclick -%rotate 1 -%rep (%0-2) - %rotate 1 - mov byte[%1],0 -%endrep -%%noclick -%endmacro - -%macro GUIPTabClick 4-* ; minX, maxX, value, var, vars to zero - GUIClickArea %1+1,11,%2-1,22,%%noclick - mov dword[%4],%3 -%if (%0>4) - %rotate 4 -%rep (%0-4) - mov dword[%1],0 - %rotate 1 -%endrep -%endif - mov byte[GUIFreshInputSelect],1 -%%noclick -%endmacro - -%macro GUIBoxVar 6 - GUIClickArea %1,%2,%3,%4,%%nope - mov dword[%5],%6 -%%nope -%endmacro - -%macro ComboBoxProc 5 - GUIClickArea %1,%2,%3,%4,%%nope - cmp byte[GUINumCombo],42 - je %%nope - xor ebx,ebx - mov bl,[GUINumCombo] - mov byte[GUIComboData+ebx],%5 - inc byte[GUINumCombo] -%%nope -%endmacro - -%macro ComboBoxProcD 4 - GUIClickArea %1,%2,%3,%4,%%nope - cmp byte[GUINumCombo],0 - je %%nope - dec byte[GUINumCombo] -%%nope -%endmacro - -; Mouse implementation - -DisplayGUIConfirmClick2: - cmp dword[GUIfileentries],1 - jbe near .noload2 - GUISlidebarPostImpl 146,33,153,33+93,.scrollupsl,.scrolldownsl,1,15,GUIcurrentviewloc,GUIcurrentcursloc,GUIfileentries,GUIcurrentfilewin,0 - GUIPostWinBoxMove 5,26,144,27+15*7,GUIcurrentviewloc,GUIcurrentcursloc,GUIfileentries,.scrollupsl,.scrolldownsl,DisplayGUIConfirmClick.skipscrol,15 -.noload2 - cmp dword[GUIdirentries],1 - jbe near .noload3 - GUISlidebarPostImpl 230,33,237,33+93,.scrollupsld,.scrolldownsld,3,15,GUIcurrentdirviewloc,GUIcurrentdircursloc,GUIdirentries,GUIcurrentfilewin,1 - GUIPostWinBoxMove 160,26,228,27+15*7,GUIcurrentdirviewloc,GUIcurrentdircursloc,GUIdirentries,.scrollupsld,.scrolldownsld,DisplayGUIConfirmClick.skipscrol,15 -.noload3 -DisplayGUIConfirmClick: -;DrawSlideBarWin 1,133,43,[GUIcurrentviewloc],[GUIfileentries],15,94,[GUILStA] - ; offset 0 = (ysize-(yend-ystart+1)), offset 1 = starty, offset 2 = endy - ; SlideBar Implementation - GUISlidebarImpl 146,33,153,33+93,GUILStA,15,GUIcurrentviewloc,GUIcurrentcursloc,GUIfileentries,1 - GUISlidebarImpl 230,33,237,33+93,GUILStB,15,GUIcurrentdirviewloc,GUIcurrentdircursloc,GUIdirentries,1 - mov dword[GUIScrolTim1],0 - mov dword[GUIScrolTim2],6 -.skipscrol - GUIClickCButtonL 10,187 - GUIWinControl 5,27,144,26+15*7,GUIcurrentfilewin,GUIcurrentviewloc,GUIfileentries,27,7,GUIcurrentcursloc,0,1,30 - GUIWinControl 160,27,228,26+15*7,GUIcurrentfilewin,GUIcurrentdirviewloc,GUIdirentries,27,7,GUIcurrentdircursloc,1,1,30 - GUIPHoldbutton 186,165,228,176,1 - GUIPButtonHoleLoad 9,163,byte[GUIloadfntype],0 - GUIPButtonHoleLoad 9,171,byte[GUIloadfntype],1 -%ifdef __MSDOS__ - GUIPButtonHoleLoad 9,179,byte[GUIloadfntype],2 -%endif - GUIClickCButton5 144,177,byte[ForceROMTiming],1 - GUIClickCButton5 144,187,byte[ForceROMTiming],2 - GUIClickCButton5 184,177,byte[ForceHiLoROM],1 - GUIClickCButton5 184,187,byte[ForceHiLoROM],2 - ret - -DisplayGUIChoseSaveClick: - GUIPHoldbutton2 94,59,102,67,80,byte[GUIChoseSlotTextX],1,'9' - GUIPHoldbutton2 105,59,113,67,81,byte[GUIChoseSlotTextX],-1,'0' - GUIPButtonHole 10,28,byte[GUIChoseSaveText2],0 - GUIPButtonHole 30,28,byte[GUIChoseSaveText2],1 - GUIPButtonHole 50,28,byte[GUIChoseSaveText2],2 - GUIPButtonHole 70,28,byte[GUIChoseSaveText2],3 - GUIPButtonHole 90,28,byte[GUIChoseSaveText2],4 - GUIPButtonHole 10,43,byte[GUIChoseSaveText2],5 - GUIPButtonHole 30,43,byte[GUIChoseSaveText2],6 - GUIPButtonHole 50,43,byte[GUIChoseSaveText2],7 - GUIPButtonHole 70,43,byte[GUIChoseSaveText2],8 - GUIPButtonHole 90,43,byte[GUIChoseSaveText2],9 - movzx eax,byte[GUIChoseSlotTextX] - sub al,'0' - mov dl,10 - mul dl - add al,byte[GUIChoseSaveText2] - mov [current_zst],eax - ret - -DisplayGUIMovieClick: - cmp byte[MovieProcessing],4 - je near .cannotzmv - cmp byte[MovieProcessing],5 - je near .cannotzmv - cmp byte[MovieProcessing],6 - je near .cannotzmv - GUIPTabClick 0,57,1,GUIMovieTabs,GUIDumpingTab -.cannotzmv - - cmp byte[MovieProcessing],1 - je near .cannotdump - cmp byte[MovieProcessing],2 - je near .cannotdump - cmp byte[MovieProcessing],3 - je near .cannotdump - GUIPTabClick 58,110,1,GUIDumpingTab,GUIMovieTabs -.cannotdump - - GUIPButtonHole 8,39,byte[CMovieExt],'v' ; Radio buttons - GUIPButtonHole 28,39,byte[CMovieExt],'1' - GUIPButtonHole 48,39,byte[CMovieExt],'2' - GUIPButtonHole 68,39,byte[CMovieExt],'3' - GUIPButtonHole 88,39,byte[CMovieExt],'4' - GUIPButtonHole 108,39,byte[CMovieExt],'5' - GUIPButtonHole 128,39,byte[CMovieExt],'6' - GUIPButtonHole 148,39,byte[CMovieExt],'7' - GUIPButtonHole 168,39,byte[CMovieExt],'8' - GUIPButtonHole 188,39,byte[CMovieExt],'9' - - cmp dword[GUIMovieTabs],1 - jne near .nocontrols - - cmp byte[MovieRecordWinVal],0 ; Overwrite Window - je near .displayboxa - GUIPHoldbutton 17,65,59,76,19 - GUIPHoldbutton 70,65,112,76,20 - ret - -.displayboxa ; Main Window - GUIPHoldbutton 7,80,49,91,16 ; Buttons - GUIPHoldbutton 55,80,97,91,17 - GUIPHoldbutton 103,80,145,91,18 - GUIPHoldbutton 151,80,193,91,32 - GUIPHoldbutton 7,108,50,119,29 - GUIPHoldbutton 85,108,138,119,30 - GUIPHoldbutton 173,108,203,119,31 - - GUIPButtonHole 8,64,byte[MovieStartMethod],0 ; Start From - GUIPButtonHole 43,64,byte[MovieStartMethod],1 - GUIPButtonHole 89,64,byte[MovieStartMethod],2 - GUIPButtonHole 135,64,byte[MovieStartMethod],3 - - DGOptnsProcBox 58,110,[KeyInsrtChap] ; Keyboard Shortcut Boxes - DGOptnsProcBox 146,110,[KeyPrevChap] - DGOptnsProcBox 210,110,[KeyNextChap] - - DGOptnsProcBox 135,124,[KeyRTRCycle] - - GUIPButtonHole 8,133,byte[MZTForceRTR],0 - GUIPButtonHole 8,143,byte[MZTForceRTR],1 - GUIPButtonHole 8,153,byte[MZTForceRTR],2 - - GUIClickCButton 8,163,byte[MovieDisplayFrame] ; Checkbox -.nocontrols - - cmp dword[GUIDumpingTab],1 - jne near .nodumping - - GUIPHoldbutton 165,178,200,189,34 - GUIPHoldbutton 206,178,235,189,35 - - GUIPButtonHole 8,64,byte[MovieVideoMode],0 ; Movie Options - GUIPButtonHole 8,74,byte[MovieVideoMode],1 - GUIPButtonHole 8,84,byte[MovieVideoMode],2 - GUIPButtonHole 8,94,byte[MovieVideoMode],3 - GUIPButtonHole 8,104,byte[MovieVideoMode],4 - GUIPButtonHole 8,114,byte[MovieVideoMode],5 - - GUIClickCButton 130,62,byte[MovieAudio] - GUIClickCButton 130,72,byte[MovieAudioCompress] - GUIClickCButton 130,82,byte[MovieVideoAudio] - - GUIPButtonHole 8,135,byte[MovieForcedLengthEnabled],0 ; Movie Options - GUIPButtonHole 8,145,byte[MovieForcedLengthEnabled],1 - GUIPButtonHole 8,155,byte[MovieForcedLengthEnabled],2 - - GUITextBoxInputNach 136,144,205,154,14,11,SetMovieForcedLength -.nodumping - - ret - -%macro GUIInputSetIndKey 1 - ;Check if controller is set - push eax - mov eax,[keycontrolval] - cmp dword[eax],0 - pop eax - je near %%lockInputChange - - DGOptnsProcBox 45,102,[%1upk] ; Up - DGOptnsProcBox 45,112,[%1downk] ; Down - DGOptnsProcBox 45,122,[%1leftk] ; Left - DGOptnsProcBox 45,132,[%1rightk] ; Right - DGOptnsProcBox 45,142,[%1startk] ; Start - DGOptnsProcBox 45,152,[%1selk] ; Select - DGOptnsProcBox 85,102,[%1Ak] ; A - DGOptnsProcBox 85,112,[%1Bk] ; B - DGOptnsProcBox 85,122,[%1Xk] ; X - DGOptnsProcBox 85,132,[%1Yk] ; Y - DGOptnsProcBox 85,142,[%1Lk] ; L - DGOptnsProcBox 85,152,[%1Rk] ; R - - DGOptnsProcBox 125,102,[%1Xtk] ; X Turbo - DGOptnsProcBox 125,112,[%1Ytk] ; Y Turbo - DGOptnsProcBox 125,122,[%1Ltk] ; L Turbo - DGOptnsProcBox 165,102,[%1Atk] ; A Turbo - DGOptnsProcBox 165,112,[%1Btk] ; B Turbo - DGOptnsProcBox 165,122,[%1Rtk] ; R Turbo - - DGOptnsProcBox 125,142,[%1DLk] ; Down-Left - DGOptnsProcBox 125,152,[%1DRk] ; Down-Right - DGOptnsProcBox 165,142,[%1ULk] ; Up-Left - DGOptnsProcBox 165,152,[%1URk] ; Up-Right -%%lockInputChange -%endmacro - -DisplayGUIInputClick2: - push eax - mov eax,[NumInputDevices] - mov [GUINumValue],eax - pop eax - GUISlidebarPostImpl 109,42,116,69,.scrollup,.scrolldown,9,5,GUIcurrentinputviewloc,GUIcurrentinputcursloc,GUINumValue,GUIBlankVar,1 - GUIPostWinBoxMove 5,35,107,35+5*8,GUIcurrentinputviewloc,GUIcurrentinputcursloc,GUINumValue,.scrollup,.scrolldown,DisplayGUIInputClick.skipscrol,5 -DisplayGUIInputClick: - ; SlideBar Implementation - push eax - mov eax,[NumInputDevices] - mov [GUINumValue],eax - pop eax - GUISlidebarImpl 109,42,116,69,GUIIStA,5,GUIcurrentinputviewloc,GUIcurrentinputcursloc,GUINumValue,3 -.skipscrol - ;x,y,x2,y2,currentwin,vpos,#entries,starty,y/entry,cpos,winval,win#,dclicktick# - GUIWinControl 5,36,107,34+5*8,GUIBlankVar,GUIcurrentinputviewloc,GUINumValue,35,8,GUIcurrentinputcursloc,4,3,0 - - GUIPTabClick 0,21,1,GUIInputTabs - GUIPTabClick 22,43,2,GUIInputTabs - GUIPTabClick 44,65,3,GUIInputTabs - GUIPTabClick 66,87,4,GUIInputTabs - GUIPTabClick 88,109,5,GUIInputTabs - - GUIPHoldbutton 123,34,153,45,14 ; Buttons - GUIPHoldbutton 123,50,177,61,40 -%ifdef __MSDOS__ - GUIPHoldbutton 123,66,183,77,15 -%endif - - cmp byte[cplayernum],0 - jne near .nopl1 - mov dword[keycontrolval],pl1contrl - GUIInputSetIndKey pl1 -.nopl1 - cmp byte[cplayernum],1 - jne near .nopl2 - mov dword[keycontrolval],pl2contrl - GUIInputSetIndKey pl2 -.nopl2 - cmp byte[cplayernum],2 - jne near .nopl3 - mov dword[keycontrolval],pl3contrl - GUIInputSetIndKey pl3 -.nopl3 - cmp byte[cplayernum],3 - jne near .nopl4 - mov dword[keycontrolval],pl4contrl - GUIInputSetIndKey pl4 -.nopl4 - cmp byte[cplayernum],4 - jne near .nopl5 - mov dword[keycontrolval],pl5contrl - GUIInputSetIndKey pl5 -.nopl5 - -%ifdef __MSDOS__ - cmp byte[cplayernum],0 - jne .notpl1 - GUIClickCButtonID 5,190,byte[pl1p209] -.notpl1 - cmp byte[cplayernum],1 - jne .notpl2 - GUIClickCButtonID 5,190,byte[pl2p209] -.notpl2 - cmp byte[cplayernum],2 - jne .notpl3 - GUIClickCButtonID 5,190,byte[pl3p209] -.notpl3 - cmp byte[cplayernum],3 - jne .notpl4 - GUIClickCButtonID 5,190,byte[pl4p209] -.notpl4 - cmp byte[cplayernum],4 - jne .notpl5 - GUIClickCButtonID 5,190,byte[pl5p209] -.notpl5 - - GUIClickCButton 105,160,byte[SidewinderFix] -%endif - - GUIClickCButton 5,160,byte[GameSpecificInput] - GUIClickCButton 5,170,byte[AllowUDLR] - GUIClickCButton 105,170,byte[Turbo30hz] - GUIClickCButtonM 5,180,byte[pl12s34] - ret - -DisplayGUIOptionClick: - cmp byte[ShowMMXSupport],1 - jne .nommx - GUIClickCButton 11,18,byte[MMXSupport] -.nommx -%ifdef __WIN32__ - GUIClickCButton 11,28,byte[PauseFocusChange] - GUIClickCButton 11,38,byte[HighPriority] - pushad - call CheckPriority - popad - GUIClickCButton 11,48,byte[DisableScreenSaver] - pushad - call CheckScreenSaver - popad -%endif - GUIClickCButton 11,68,byte[newengen] - GUIClickCButton 11,78,byte[bgfixer] - GUIPButtonHole 143,70,byte[ScreenShotFormat],0 -%ifndef NO_PNG - GUIPButtonHole 143,80,byte[ScreenShotFormat],1 -%endif - GUIClickCButton 11,98,byte[AutoPatch] - GUIClickCButton 11,108,byte[DisplayInfo] - GUIClickCButton 11,118,byte[RomInfo] - GUIClickCButton 11,138,byte[FPSAtStart] - GUIClickCButton 11,148,byte[TimerEnable] - GUIClickCButton 89,148,byte[TwelveHourClock] - GUIClickCButton 11,158,byte[ClockBox] - GUIClickCButton 11,178,byte[SmallMsgText] - GUIClickCButton 11,188,byte[GUIEnableTransp] - ret - -DisplayGUIVideoClick2: - cmp dword[GUIVideoTabs],1 ; modes - jne near .notmodestab2 - push eax - mov eax,[NumVideoModes] - mov [GUINumValue],eax - pop eax - GUISlidebarPostImpl 117,33,124,182,.scrollup,.scrolldown,5,20,GUIcurrentvideoviewloc,GUIcurrentvideocursloc,GUINumValue,GUIBlankVar,1 - GUIPostWinBoxMove 5,27,115,27+20*8,GUIcurrentvideoviewloc,GUIcurrentvideocursloc,GUINumValue,.scrollup,.scrolldown,DisplayGUIVideoClick.skipscrol,20 -.notmodestab2 -DisplayGUIVideoClick: - GUIPTabClick 0,39,1,GUIVideoTabs,GUIVntscTab - GUIPTabClick 40,91,2,GUIVideoTabs,GUIVntscTab - cmp byte[NTSCFilter],1 - jne .nontscf - GUIPTabClick 92,125,1,GUIVntscTab,GUIVideoTabs - GUIPTabClick 126,184,2,GUIVntscTab,GUIVideoTabs -.nontscf - - cmp dword[GUIVideoTabs],1 ; modes - jne near .notmodestab - ; SlideBar Implementation - push eax - mov eax,[NumVideoModes] - mov [GUINumValue],eax - pop eax - GUISlidebarImpl 117,33,124,182,GUIVStA,20,GUIcurrentvideoviewloc,GUIcurrentvideocursloc,GUINumValue,5 -.skipscrol - GUIWinControl 5,27,115,27+20*8,GUIBlankVar,GUIcurrentvideoviewloc,GUINumValue,27,8,GUIcurrentvideocursloc,2,5,0 - - GUIPHoldbutton 130,31,166,41,4 - -%ifndef __MSDOS__ - GUIPHoldbutton 182,116,218,126,12 - - GUITextBoxInputNach 130,130,178,140,12,5,SetCustomXY - GUITextBoxInputNach 191,130,239,140,13,5,SetCustomXY -%endif - -.notmodestab - - cmp dword[GUIVideoTabs],2 ; Filters tab - jne near .notfilterstab - - pushad - call Clear2xSaIBuffer - popad - -%ifdef __MSDOS__ - cmp byte[smallscreenon],1 - je .nohsline - cmp byte[ScreenScale],1 - je .noradiobuttons -%endif - xor ebx,ebx ; Interpolations - mov bl,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUIEAVID+ebx],0 - jne near .yesinterp -%endif -%ifdef __WIN32__ - cmp byte[GUIDSIZE+ebx],0 -%else - cmp byte[GUII2VID+ebx],0 -%endif - je near .nocheckboxi2 -.yesinterp - FilterExcl 18,35,hqFilter,NTSCFilter,En2xSaI - GUIClickCButton 18,35,byte[antienab] -.nocheckboxi2 -%ifdef __OPENGL__ - xor ebx,ebx ; Bilinear - mov bl,[cvidmode] - cmp byte[GUIBIFIL+ebx],0 - je .nocheckbox1bf - FilterExcl 18,35,NTSCFilter - GUIClickCButtonB 18,35,byte[BilinearFilter] -.nocheckbox1bf -%endif - - xor ebx,ebx ; NTSC filter - mov bl,[cvidmode] - cmp byte[GUINTVID+ebx],0 - je near .nontscfilter - FilterExcl 128,35,En2xSaI,hqFilter,scanlines,antienab -%ifdef __OPENGL__ - FilterExcl 128,35,BilinearFilter -%endif -%ifndef __MSDOS__ - GUIClickCButtonN 128,35,byte[NTSCFilter],NTSCFilterInit -%endif -.nontscfilter - - xor ebx,ebx ; Kreed 2x filters - mov bl,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUI2xVID+ebx],0 -%else - cmp byte[GUIDSIZE+ebx],0 -%endif - je near .no2xSaI - FilterExcl 18,45,hqFilter,scanlines,antienab,NTSCFilter - FilterExcl 128,45,hqFilter,scanlines,antienab,NTSCFilter - FilterExcl 18,55,hqFilter,scanlines,antienab,NTSCFilter - GUIClickCButton6 18,45,byte[En2xSaI],1 - GUIClickCButton6 128,45,byte[En2xSaI],2 - GUIClickCButton6 18,55,byte[En2xSaI],3 -.no2xSaI - - xor ebx,ebx ; Hq*x filters - mov bl,[cvidmode] -%ifndef __MSDOS__ - cmp byte[GUIHQ4X+ebx],0 - jne near .radiobuttonhq4x - cmp byte[GUIHQ3X+ebx],0 - jne near .radiobuttonhq3x -%endif - cmp byte[GUIHQ2X+ebx],0 -%ifdef __MSDOS__ - jne .checkboxhq -%else - jne near .radiobuttonhq2x -%endif - jmp .nocheckboxhq -.checkboxhq - FilterExcl 128,55,En2xSaI,scanlines,antienab,NTSCFilter - GUIClickCButton 128,55,byte[hqFilter] -.nocheckboxhq -%ifndef __MSDOS__ - jmp .noradiobuttons -.radiobuttonhq4x - GUIPButtonHole 188,68,byte[hqFilterlevel],4 -.radiobuttonhq3x - GUIPButtonHole 158,68,byte[hqFilterlevel],3 -.radiobuttonhq2x - GUIPButtonHole 128,68,byte[hqFilterlevel],2 - FilterExcl 128,55,En2xSaI,scanlines,antienab,NTSCFilter - GUIClickCButton 128,55,byte[hqFilter] -%endif -.noradiobuttons - - xor ebx,ebx ; Scanlines - mov bl,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUISLVID+ebx],0 -%else - cmp byte[GUIDSIZE+ebx],0 -%endif - je near .nocheckboxb - FilterExcl 168,87,En2xSaI,hqFilter,NTSCFilter - GUIPButtonHoleS 18,87,byte[scanlines],0 - GUIPButtonHoleS 168,87,byte[scanlines],1 -.nocheckboxb -%ifdef __MSDOS__ - cmp byte[ScreenScale],1 - je .nohsline -%endif - xor ebx,ebx - mov bl,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUIHSVID+ebx],0 -%else - cmp byte[GUIDSIZE+ebx],0 -%endif - je near .nohsline - FilterExcl 68,87,En2xSaI,hqFilter,NTSCFilter - FilterExcl 118,87,En2xSaI,hqFilter,NTSCFilter - GUIPButtonHoleS 68,87,byte[scanlines],2 - GUIPButtonHoleS 118,87,byte[scanlines],3 -.nohsline - - GUIClickCButton 18,115,byte[GrayscaleMode] ; Grayscale - - xor ebx,ebx ; Hires Mode7 - mov bl,[cvidmode] - cmp byte[GUIM7VID+ebx],0 - je .nocheckboxtm7 - GUIClickCButton5 128,115,byte[Mode7HiRes16b],1 -.nocheckboxtm7 - -%ifdef __MSDOS__ - xor ebx,ebx ; Triple buffs/vsyncs - mov bl,[cvidmode] - cmp byte[GUITBVID+ebx],0 - je .nocheckboxttb - GUIClickCButtonT 128,145,byte[Triplebufen],byte[vsyncon] -.nocheckboxttb - GUIClickCButtonT 18,145,byte[vsyncon],byte[Triplebufen] -%endif -%ifdef __WIN32__ - xor ebx,ebx - mov bl,[cvidmode] - cmp byte[GUIWFVID+ebx],0 - je near .notriplebufferwin - GUIClickCButtonf 128,145,byte[TripleBufferWin],initDirectDraw -.notriplebufferwin - GUIClickCButtonf 18,145,byte[vsyncon],initDirectDraw -%endif - -%ifndef __MSDOS__ - xor ebx,ebx ; Keep 4:3 Ratio - mov bl,[cvidmode] - cmp byte[GUIKEEP43+ebx],0 - je near .nocheckboxk43 - GUIClickCButtonK 18,175,byte[Keep4_3Ratio],initwinvideo -.nocheckboxk43 -%endif - -%ifdef __MSDOS__ - xor ebx,ebx ; Small Screen - mov bl,[cvidmode] - cmp byte[GUISSVID+ebx],0 - je .nocheckbox2b - FilterExcl 18,175,ScreenScale,antienab,En2xSaI,scanlines - GUIClickCButton3 18,175,byte[smallscreenon] -.nocheckbox2b - - xor ebx,ebx ; Full/Wide Screen - mov bl,[cvidmode] - cmp byte[GUIFSVID+ebx],0 - je .nocheckbox3b - FilterExcl 128,175,smallscreenon,antienab,En2xSaI - GUIClickCButton3 128,175,byte[ScreenScale] -.nocheckbox3b -%endif - -.notfilterstab - - cmp dword[GUIVntscTab],1 ; NTSC Tab - jne near .notntsctab - mov eax,[GUImouseposx] ; update mouse location - sub eax,[GUIwinposx+5*4] - mov edx,[GUImouseposy] - sub edx,[GUIwinposy+5*4] - - GUIClickCButton 5,25,byte[NTSCBlend] ; Checkboxes - GUIClickCButton 135,25,byte[NTSCRef] - - GUIPHoldbutton 8,166,67,177,81 - GUIPHoldbutton 72,166,119,177,82 - GUIPHoldbutton 124,166,147,177,83 - GUIPHoldbutton 152,166,217,177,84 - GUIPHoldbutton 102,186,137,197,37 ; button - GUIPHoldbutton 148,186,207,197,39 ; button - - ;Sliders - cmp eax,8 ; X-Range for click-area - jl near .nomovebar - cmp eax,8+200 - jg near .nomovebar - sub al,108 - cmp edx,54 ; Y-Range for click-area - jl near .nomovebar - cmp edx,58 - jg .nohuebar - mov [NTSCHue],al - mov [ntscCurVar],al - mov byte[ntscWhVar],0 - mov byte[GUIHold],7 ; Lock mouse to bar when clicked - mov eax,[GUIwinposy+5*4] - add eax,56 - mov [GUIHoldYlim],eax - jmp .nosharpbar -.nohuebar - cmp edx,74 - jl near .nomovebar - cmp edx,78 - jg .nosatbar - mov [NTSCSat],al - mov [ntscCurVar],al - mov byte[ntscWhVar],1 - mov byte[GUIHold],7 - mov eax,[GUIwinposy+5*4] - add eax,76 - mov [GUIHoldYlim],eax - jmp .nosharpbar -.nosatbar - cmp edx,94 - jl near .nomovebar - cmp edx,98 - jg .nocontbar - mov [NTSCCont],al - mov [ntscCurVar],al - mov byte[ntscWhVar],2 - mov byte[GUIHold],7 - mov eax,[GUIwinposy+5*4] - add eax,96 - mov [GUIHoldYlim],eax - jmp .nosharpbar -.nocontbar - cmp edx,114 - jl near .nomovebar - cmp edx,118 - jg .nobrightbar - mov [NTSCBright],al - mov [ntscCurVar],al - mov byte[ntscWhVar],3 - mov byte[GUIHold],7 - mov eax,[GUIwinposy+5*4] - add eax,116 - mov [GUIHoldYlim],eax - jmp .nosharpbar -.nobrightbar - cmp edx,134 - jl near .nomovebar - cmp edx,138 - jg .nosharpbar - mov [NTSCSharp],al - mov [ntscCurVar],al - mov byte[ntscWhVar],4 - mov byte[GUIHold],7 - mov eax,[GUIwinposy+5*4] - add eax,136 - mov [GUIHoldYlim],eax - jmp .nowarpbar -.nosharpbar - mov eax,[GUIwinposx+5*4] - add eax,8 - mov [GUIHoldXlimL],eax - add eax,200 - mov [GUIHoldXlimR],eax -.nomovebar - cmp byte[NTSCRef],0 - je .notntsctab -%ifndef __MSDOS__ - mov dword[NTSCPresetVar],4 - pushad - call NTSCFilterInit - popad -%endif -.notntsctab - - cmp dword[GUIVntscTab],2 ; NTSC Tab - jne near .notadvntsctab - mov eax,[GUImouseposx] ; update mouse location - sub eax,[GUIwinposx+5*4] - mov edx,[GUImouseposy] - sub edx,[GUIwinposy+5*4] - - GUIPHoldbutton 102,186,137,197,38 ; button - GUIPHoldbutton 148,186,207,197,39 ; button - - ;Sliders - cmp eax,8 ; X-Range for click-area - jl near .nomovebar2 - cmp eax,8+200 - jg near .nomovebar2 - sub al,108 - cmp edx,44 ; Y-Range for click-area - jl near .nomovebar2 - cmp edx,48 - jg .nogammabar - mov [NTSCGamma],al - mov [ntscCurVar],al - mov byte[ntscWhVar],0 - mov byte[GUIHold],7 ; Lock mouse to bar when clicked - mov eax,[GUIwinposy+5*4] - add eax,46 - mov [GUIHoldYlim],eax - jmp .nowarpbar -.nogammabar - cmp edx,64 - jl near .nomovebar2 - cmp edx,68 - jg .noresbar - mov [NTSCRes],al - mov [ntscCurVar],al - mov byte[ntscWhVar],1 - mov byte[GUIHold],7 - mov eax,[GUIwinposy+5*4] - add eax,66 - mov [GUIHoldYlim],eax - jmp .nowarpbar -.noresbar - cmp edx,84 - jl near .nomovebar2 - cmp edx,88 - jg .noartbar - mov [NTSCArt],al - mov [ntscCurVar],al - mov byte[ntscWhVar],2 - mov byte[GUIHold],7 - mov eax,[GUIwinposy+5*4] - add eax,86 - mov [GUIHoldYlim],eax - jmp .nowarpbar -.noartbar - cmp edx,104 - jl near .nomovebar2 - cmp edx,108 - jg .nofringebar - mov [NTSCFringe],al - mov [ntscCurVar],al - mov byte[ntscWhVar],3 - mov byte[GUIHold],7 - mov eax,[GUIwinposy+5*4] - add eax,106 - mov [GUIHoldYlim],eax - jmp .nowarpbar -.nofringebar - cmp edx,124 - jl near .nomovebar2 - cmp edx,128 - jg .nobleedbar - mov [NTSCBleed],al - mov [ntscCurVar],al - mov byte[ntscWhVar],4 - mov byte[GUIHold],7 - mov eax,[GUIwinposy+5*4] - add eax,126 - mov [GUIHoldYlim],eax - jmp .nowarpbar -.nobleedbar - cmp edx,144 - jl .nomovebar2 - cmp edx,148 - jg .nomovebar2 - mov [NTSCWarp],al - mov [ntscCurVar],al - mov byte[ntscWhVar],5 - mov byte[GUIHold],7 - mov eax,[GUIwinposy+5*4] - add eax,146 - mov [GUIHoldYlim],eax -.nowarpbar - mov eax,[GUIwinposx+5*4] - add eax,8 - mov [GUIHoldXlimL],eax - add eax,200 - mov [GUIHoldXlimR],eax -.nomovebar2 - cmp byte[NTSCRef],0 - je .notadvntsctab -%ifndef __MSDOS__ - mov dword[NTSCPresetVar],4 - pushad - call NTSCFilterInit - popad -%endif -.notadvntsctab - - xor eax,eax - ret - -SECTION .bss -GUINumValue resd 1 -GUIBlankVar resd 1 -ntscLastVar resb 6 -ntscCurVar resb 1 -ntscWhVar resb 1 -SECTION .data -NEWSYM NTSCPresetVar, dd 4 - -SECTION .text - -DisplayGUISoundClick: - mov eax,[GUImouseposx] - sub eax,[GUIwinposx+6*4] - mov edx,[GUImouseposy] - sub edx,[GUIwinposy+6*4] - - GUIClickCButton 11,21,byte[SPCDisable] - GUIClickCButtonf 11,31,byte[soundon],reInitSound - GUIClickCButton 11,41,byte[StereoSound] - GUIClickCButton 11,51,byte[RevStereo] - GUIClickCButton 11,61,byte[Surround] -%ifdef __MSDOS__ - GUIClickCButton 11,71,byte[Force8b] -%endif -%ifdef __WIN32__ - GUIClickCButton 11,71,byte[PrimaryBuffer] -%endif - - GUIPButtonHole 11,157,byte[SoundInterpType],0 - GUIPButtonHole 11,167,byte[SoundInterpType],1 - GUIPButtonHole 11,177,byte[SoundInterpType],2 - cmp byte[MMXSupport],0 - je near .no8ptintrp - GUIPButtonHole 11,187,byte[SoundInterpType],3 -.no8ptintrp - - GUIPButtonHole 111,157,byte[LowPassFilterType],0 - GUIPButtonHole 111,167,byte[LowPassFilterType],1 - GUIPButtonHole 111,177,byte[LowPassFilterType],2 - cmp byte[MMXSupport],0 - je near .nohiqualityfilter - GUIPButtonHole 111,187,byte[LowPassFilterType],3 -.nohiqualityfilter - - GUIClickArea 15,101,69,109,.nosrate - mov eax,[SoundQuality] - mov al,[sampratenext+eax] - mov [SoundQuality],al -.nosrate - GUIClickArea 15,129,115,133,{near .nomovebar} - sub eax,15 - mov [MusicRelVol],al - mov byte[GUIHold],5 - mov eax,[GUIwinposy+6*4] - add eax,131 - mov [GUIHoldYlim],eax - xor eax,eax - xor edx,edx - mov al,[MusicRelVol] - shl eax,7 - mov ebx,100 - div ebx - cmp al,127 - jb .noof - mov al,127 -.noof - mov [MusicVol],al - mov al,[DSPMem+0Ch] - call WDSPReg0C - mov al,[DSPMem+1Ch] - call WDSPReg1C - - mov eax,[GUIwinposx+6*4] - add eax,15 - mov [GUIHoldXlimL],eax - add eax,100 - mov [GUIHoldXlimR],eax -.nomovebar - ret - -SECTION .data -sampratenext db 1,4,5,6,2,3,0,0 -SECTION .text - -DisplayGUICheatClick2: - GUISlidebarPostImpl 231,28,238,100,.scrollup,.scrolldown,7,12,GUIcurrentcheatviewloc,GUIcurrentcheatcursloc,NumCheats,GUIBlankVar,1 - GUIPostWinBoxMove 5,22,229,22+12*7,GUIcurrentcheatviewloc,GUIcurrentcheatcursloc,NumCheats,.scrollup,.scrolldown,DisplayGUICheatClick.skipscrol,12 - -DisplayGUICheatClick: - GUIBoxVar 5,20,181,110,GUIcurrentcheatwin,0 ; Main Box - GUIBoxVar 82,129,173,136,GUIcurrentcheatwin,1 ; Enter Code Box - GUIBoxVar 82,140,196,147,GUIcurrentcheatwin,2 ; Description Box - ; SlideBar Implementation - GUISlidebarImpl 231,28,238,100,GUICStA,12,GUIcurrentcheatviewloc,GUIcurrentcheatcursloc,NumCheats,7 -.skipscrol - cmp byte[GUIcurrentcheatwin],0 - jne near .nowin - GUIWinControl 5,23,229,21+12*7,GUIBlankVar,GUIcurrentcheatviewloc,NumCheats,22,7,GUIcurrentcheatcursloc,3,7,30 -.nowin - GUIPHoldbutton 5,113,47,124,5 ; Buttons - GUIPHoldbutton 52,113,94,124,6 - GUIPHoldbutton 99,113,141,124,7 - GUIPHoldbutton 146,113,188,124,8 - GUIPHoldbutton 212,134,236,145,9 - GUIPHoldbutton 193,113,235,124,33 - GUIClickCButton5 11,186,byte[AutoLoadCht],1 ; Checkbox - ret - -DisplayNetOptnsClick: - ret - -guipresstest: - xor ebx,ebx - mov ecx,256+128+64 -.a - mov byte[pressed+ebx],0 - inc ebx - dec ecx - jnz .a - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - GUIBox 75,95,180,131,160 - GUIBox 75,95,180,95,162 - GUIBox 75,95,75,131,161 - GUIBox 180,95,180,131,159 - GUIBox 75,131,180,131,158 - GUIOuttext 81,101,guipresstext1,220-15 - GUIOuttext 80,100,guipresstext1,220 - GUIOuttext 81,111,guipresstext2,220-15 - GUIOuttext 80,110,guipresstext2,220 - GUIOuttext 81,121,guipresstext3,220-15 - GUIOuttext 80,120,guipresstext3,220 - call vidpastecopyscr -.again - call JoyRead -; mov dword[pressed+0CCh],0 -; mov dword[pressed+0CCh+80h],0 -; mov dword[pressed+0E8h],0 -; mov dword[pressed+0E8h+80h],0 - xor ebx,ebx - mov ecx,256+128+64 -.b - cmp byte[pressed+ebx],0 - jne .pressedokay - inc ebx - dec ecx - jnz .b - jmp .again -.pressedokay - push ebx - xor ebx,ebx - mov ecx,256+128+64 -.a2 - cmp byte[pressed+ebx],0 - je .pressedokayb - mov byte[pressed+ebx],2 -.pressedokayb - inc ebx - dec ecx - jnz .a2 - pop ebx -.again2 - call Check_Key - or al,al - jz .nokey - call Get_Key - jmp .again2 -.nokey -; push ebx -; mov eax,0Bh -; int 33h -; pop ebx - ret - -SECTION .data -guipresstext1 db 'ENTER THE KEY',0 -guipresstext2 db 'OR BUTTON TO USE',0 -guipresstext3 db '(ESC TO CLEAR)',0 -SECTION .text - -guipresstestb: - call GUIUnBuffer - call DisplayBoxes - call DisplayMenu - GUIBox 65,80,194,126,160 - GUIBox 65,80,194,80,162 - GUIBox 65,80,65,126,161 - GUIBox 194,80,194,126,159 - GUIBox 65,126,194,126,158 - GUIOuttext 71,86,guipresstext1,220-15 - GUIOuttext 70,85,guipresstext1,220 - GUIOuttext 71,96,guipresstext2,220-15 - GUIOuttext 70,95,guipresstext2,220 - GUIOuttext 71,116,guipresstext3b,220-15 - GUIOuttext 70,115,guipresstext3b,220 - mov eax,[guipressptr] - GUIOuttext 71,106,eax,220-15 - mov eax,[guipressptr] - GUIOuttext 70,105,eax,220 - call vidpastecopyscr - mov ecx,8192 - call delay -.tryagain - call JoyRead - xor ebx,ebx - mov ecx,256+128+64 -.b2 - cmp byte[pressed+ebx],0 - jne .tryagain - inc ebx - dec ecx - jnz .b2 - -.again - call JoyRead -; mov dword[pressed+0CCh],0 -; mov dword[pressed+0CCh+80h],0 -; mov dword[pressed+0E8h],0 -; mov dword[pressed+0E8h+80h],0 - - xor ebx,ebx - mov ecx,256+128+64 -.b - cmp byte[pressed+ebx],0 - jne .pressedokay - inc ebx - dec ecx - jnz .b - jmp .again -.pressedokay -.again2 - call Check_Key - or al,al - jz .nokey - call Get_Key - jmp .again2 -.nokey - cmp ebx,1 - je .skip - cmp ebx,3Bh - je .skip - mov eax,[guicpressptr] - mov [eax],ebx -.skip -; push ebx -; mov eax,0Bh -; int 33h -; pop ebx - ret - -SECTION .data -guipresstext3b db '(ESC TO SKIP)',0 -guipresstext4b db 'FOR UP ',0 - db 'FOR DOWN ',0 - db 'FOR LEFT ',0 - db 'FOR RIGHT ',0 - db 'FOR START ',0 - db 'FOR SELECT ',0 - db 'FOR A (RIGHT BUTTON)',0 - db 'FOR B (DOWN BUTTON) ',0 - db 'FOR X (TOP BUTTON) ',0 - db 'FOR Y (LEFT BUTTON) ',0 - db 'FOR THE L BUTTON ',0 - db 'FOR THE R BUTTON ',0 -SECTION .bss -guipressptr resd 1 -guicpressptr resd 1 -SECTION .text - -DisplayGameOptnsClick: - mov dword[keycontrolval],0 ; Shortcut Boxes - DGOptnsProcBox 27,23,[KeyBGDisble0] - DGOptnsProcBox 27+45,23,[KeyBGDisble1] - DGOptnsProcBox 27+45*2,23,[KeyBGDisble2] - DGOptnsProcBox 27+45*3,23,[KeyBGDisble3] - DGOptnsProcBox 27+45*4,23,[KeySprDisble] - DGOptnsProcBox 27,41,[KeyDisableSC0] - DGOptnsProcBox 27+45,41,[KeyDisableSC1] - DGOptnsProcBox 27+45*2,41,[KeyDisableSC2] - DGOptnsProcBox 27+45*3,41,[KeyDisableSC3] - DGOptnsProcBox 34+45*4,41,[KeyVolUp] - DGOptnsProcBox 27,50,[KeyDisableSC4] - DGOptnsProcBox 27+45,50,[KeyDisableSC5] - DGOptnsProcBox 27+45*2,50,[KeyDisableSC6] - DGOptnsProcBox 27+45*3,50,[KeyDisableSC7] - DGOptnsProcBox 34+45*4,50,[KeyVolDown] - - DGOptnsProcBox 8+25,70,[KeyQuickLoad] - DGOptnsProcBox 8+57+26,70,[KeyQuickRst] - DGOptnsProcBox 8+114+20,70,[KeyQuickExit] - DGOptnsProcBox 8+114+78,70,[KeyQuickClock] - DGOptnsProcBox 8+25,80,[KeyQuickChat] - DGOptnsProcBox 8+57+45,80,[KeyQuickSnapShot] - DGOptnsProcBox 8+108+70,80,[KeyQuickSaveSPC] - - DGOptnsProcBox 78,100,[KeyUsePlayer1234] - DGOptnsProcBox 78,110,[KeyResetAll] - DGOptnsProcBox 78,120,[KeyDisplayFPS] -%ifndef __MSDOS__ - DGOptnsProcBox 78,130,[KeyDisplayBatt] -%endif - - DGOptnsProcBox 191,100,[KeyNewGfxSwt] - DGOptnsProcBox 191,110,[KeyWinDisble] - DGOptnsProcBox 191,120,[KeyOffsetMSw] - DGOptnsProcBox 191,130,[KeyIncreaseGamma] - DGOptnsProcBox 191,140,[KeyDecreaseGamma] - ret - -DisplayGUIOptnsClick: - mov eax,[GUImouseposx] - sub eax,[GUIwinposx+10*4] - mov edx,[GUImouseposy] - sub edx,[GUIwinposy+10*4] - GUIClickCButton 12,23,byte[GUIRClick] ; Checkboxes - GUIClickCButton 12,33,byte[lhguimouse] - GUIClickCButton 12,43,byte[mouseshad] - GUIClickCButton 12,53,byte[mousewrap] - - GUIClickCButton 129,23,byte[esctomenu] - GUIClickCButton 129,33,byte[JoyPad1Move] - GUIClickCButtonI 129,43,byte[FilteredGUI] - GUIClickCButton 129,53,byte[newfont] - GUIClickCButton 129,63,byte[savewinpos] - -%ifdef __WIN32__ - GUIClickCButton 12,63,byte[TrapMouseCursor] - GUIClickCButton 12,73,byte[MouseWheel] - GUIClickCButton 12,168,byte[AlwaysOnTop] - GUIClickCButton 12,178,byte[SaveMainWindowPos] - GUIClickCButton 12,188,byte[AllowMultipleInst] -%endif - - GUIPButtonHole 72,88,byte[GUIEffect],0 ; Radio Buttons - GUIPButtonHole 122,88,byte[GUIEffect],1 - GUIPButtonHole 182,88,byte[GUIEffect],4 - GUIPButtonHole 72,98,byte[GUIEffect],5 - GUIPButtonHole 122,98,byte[GUIEffect],2 - GUIPButtonHole 182,98,byte[GUIEffect],3 - - GUIPButtonHole 48,108,byte[CurPalSelect],0 - GUIPButtonHole 88,108,byte[CurPalSelect],1 - GUIPButtonHole 133,108,byte[CurPalSelect],2 - - push eax ; Sliders - cmp byte[CurPalSelect],1 - je .yespal2b - cmp byte[CurPalSelect],2 - je .yespal3b - mov al,[GUIRAdd] - mov [TRVal2],al - mov al,[GUIGAdd] - mov [TGVal2],al - mov al,[GUIBAdd] - mov [TBVal2],al - jmp .nopal1b -.yespal2b - mov al,[GUITRAdd] - mov [TRVal2],al - mov al,[GUITGAdd] - mov [TGVal2],al - mov al,[GUITBAdd] - mov [TBVal2],al - jmp .nopal1b -.yespal3b - mov al,[GUIWRAdd] - mov [TRVal2],al - mov al,[GUIWGAdd] - mov [TGVal2],al - mov al,[GUIWBAdd] - mov [TBVal2],al -.nopal1b - pop eax - - cmp eax,25 - jl near .nomovebar - cmp eax,25+127 - jg near .nomovebar - sub eax,25 - shr eax,2 - cmp edx,122 - jl .nomovebar1 - cmp edx,126 - jg .nomovebar1 - cmp byte[TRVal2],al - je .nomovebar1b - mov [TRVal2],al - mov byte[TRVal2+1],1 -.nomovebar1b - mov byte[GUIHold],2 - mov eax,[GUIwinposy+10*4] - add eax,124 - mov [GUIHoldYlim],eax - jmp .nomovebar -.nomovebar1 - cmp edx,134 - jl .nomovebar2 - cmp edx,138 - jg .nomovebar2 - cmp byte[TGVal2],al - je .nomovebar2b - mov [TGVal2],al - mov byte[TRVal2+1],1 -.nomovebar2b - mov byte[GUIHold],2 - mov eax,[GUIwinposy+10*4] - add eax,136 - mov [GUIHoldYlim],eax - jmp .nomovebar -.nomovebar2 - cmp edx,146 - jl .nomovebar3 - cmp edx,150 - jg .nomovebar3 - cmp byte[TBVal2],al - je .nomovebar3b - mov [TBVal2],al - mov byte[TRVal2+1],1 -.nomovebar3b - mov byte[GUIHold],2 - mov eax,[GUIwinposy+10*4] - add eax,148 - mov [GUIHoldYlim],eax -.nomovebar3 -.nomovebar - - push eax - cmp byte[CurPalSelect],1 - je .yespal2 - cmp byte[CurPalSelect],2 - je .yespal3 - mov al,[TRVal2] - mov [GUIRAdd],al - mov al,[TGVal2] - mov [GUIGAdd],al - mov al,[TBVal2] - mov [GUIBAdd],al - jmp .nopal1 -.yespal2 - mov al,[TRVal2] - mov [GUITRAdd],al - mov al,[TGVal2] - mov [GUITGAdd],al - mov al,[TBVal2] - mov [GUITBAdd],al - jmp .nopal1 -.yespal3 - mov al,[TRVal2] - mov [GUIWRAdd],al - mov al,[TGVal2] - mov [GUIWGAdd],al - mov al,[TBVal2] - mov [GUIWBAdd],al -.nopal1 - pop eax - - cmp byte[TRVal2+1],1 - jne .nopalchange - call GUISetPal - mov byte[TRVal2+1],0 -.nopalchange - - cmp byte[GUIHold],2 - jne .nohold - mov eax,[GUIwinposx+10*4] - add eax,25 - mov [GUIHoldXlimL],eax - mov eax,[GUIwinposx+10*4] - add eax,25+127 - mov [GUIHoldXlimR],eax -.nohold - ret - -DisplayGUIAboutClick: -%ifndef __MSDOS__ - cmp byte[EEgg],1 - je near .eegg - GUIPHoldbutton 90,22,175,32,65 - GUIPHoldbutton 90,33,175,43,66 -.eegg -%endif - ret - -; DrawSlideBar 16,192,20,[GUIccombviewloc],[NumCombo],8,61,GUICSStC,13,14 -; DrawBorderedBox 16,10,20,190,80,19 - -; DrawGUIWinBox 3,5,34,107,77,167 -; DrawSlideBarWin 3,109,42,[GUIcurrentinputviewloc],16,5,28,GUIIStA - -DisplayGUIComboClick2: - mov dword[keycontrolval],0 - ; x1,y1,x2,y2,upjump,downjump,holdpos,scsize,view,cur,listsize - GUISlidebarPostImpl 192,28,199,72,.scrollup,.scrolldown,13,8,GUIccombviewloc,GUIccombcursloc,NumCombo,GUIBlankVar,1 - ;x1,y1,x2,y2,view,curs,num,.scru,.scrd,jumpto,sizeofscreen - GUIPostWinBoxMove 10,22,190,23+8*7,GUIccombviewloc,GUIccombcursloc,NumCombo,.scrollup,.scrolldown,DisplayGUIComboClick.skipscrol,8 -DisplayGUIComboClick: - ; SlideBar Implementation - ; x1,y1,x2,y2,GUI?StA,ScrnSize,ViewLoc,CursLoc,Entries,win# - GUISlidebarImpl 192,28,199,72,GUICSStC,8,GUIccombviewloc,GUIccombviewloc,NumCombo,16 -.skipscrol - ;x,y,x2,y2,currentwin,vpos,#entries,starty,y/entry,cpos,winval,win#,dclicktick# - GUIWinControl2 10,23,190,22+8*7,GUIBlankVar,GUIccombviewloc,NumCombo,23,7,GUIccombcursloc,6,16,0 - - GUIPButtonHole 158,82,byte[GUIComboPNum],0 - GUIPButtonHole 176,82,byte[GUIComboPNum],1 - GUIPButtonHole 194,82,byte[GUIComboPNum],2 - GUIPButtonHole 212,82,byte[GUIComboPNum],3 - GUIPButtonHole 230,82,byte[GUIComboPNum],4 - GUIClickCButton 163,88,byte[GUIComboLHorz] - GUIClickCButtonC 163,96,byte[GUIComboGameSpec] - GUIPHoldbutton 202,20,246,31,60 - GUIPHoldbutton 202,35,246,46,61 - GUIPHoldbutton 202,50,246,61,62 - GUIPHoldbutton 202,65,246,76,63 - DGOptnsProcBoxc 10,91,32,99,[GUIComboKey] - - ComboBoxProc 75,150,85,157,1 - ComboBoxProc 89,150,99,157,2 - ComboBoxProc 103,150,113,157,3 - ComboBoxProc 117,150,127,157,4 - ComboBoxProc 131,150,141,157,5 - ComboBoxProc 145,150,155,157,6 - ComboBoxProc 159,150,169,157,7 - ComboBoxProc 173,150,183,157,8 - ComboBoxProc 187,150,197,157,9 - ComboBoxProc 201,150,211,157,10 - ComboBoxProc 215,150,227,157,11 - ComboBoxProc 231,150,243,157,12 - ComboBoxProc 75,160,85,167,13 - ComboBoxProc 89,160,99,167,14 - ComboBoxProc 103,160,113,167,15 - ComboBoxProc 117,160,127,167,16 - ComboBoxProc 131,160,141,167,17 - ComboBoxProc 145,160,155,167,18 - ComboBoxProc 159,160,169,167,19 - ComboBoxProc 173,160,183,167,20 - ComboBoxProc 187,160,197,167,21 - ComboBoxProc 201,160,211,167,22 - ComboBoxProc 215,160,227,167,23 - ComboBoxProc 231,160,243,167,24 - ComboBoxProc 75,170,85,177,25 - ComboBoxProc 89,170,99,177,26 - ComboBoxProc 103,170,113,177,27 - ComboBoxProc 117,170,127,177,28 - ComboBoxProc 131,170,141,177,29 - ComboBoxProc 145,170,155,177,30 - ComboBoxProc 159,170,169,177,31 - ComboBoxProc 173,170,183,177,32 - ComboBoxProc 187,170,197,177,33 - ComboBoxProc 201,170,211,177,34 - ComboBoxProc 215,170,227,177,35 - ComboBoxProc 231,170,243,177,36 - - ComboBoxProc 10,189,20,196,37 - ComboBoxProc 24,189,34,196,38 - ComboBoxProc 38,189,48,196,39 - ComboBoxProc 52,189,62,196,40 - ComboBoxProc 66,189,76,196,41 - ComboBoxProc 80,189,90,196,42 - ComboBoxProc 107,189,117,196,43 - ComboBoxProc 121,189,131,196,44 - ComboBoxProc 135,189,145,196,45 - ComboBoxProc 149,189,159,196,46 - ComboBoxProc 163,189,173,196,47 - ComboBoxProc 177,189,187,196,48 - ComboBoxProcD 204,189,218,196 - mov ebx,[NumComboLocl] - cmp byte[GUIComboGameSpec],0 - jne .local - mov ebx,[NumComboGlob] -.local - mov [NumCombo],ebx - xor ebx,ebx - ret - -DisplayGUIResetClick: - GUIPHoldbutton 20,30,56,41,2 - GUIPHoldbutton 80,30,116,41,3 - ret - -DisplayGUIStatesClick: - GUIPHoldbutton 20,30,56,41,10 - GUIPHoldbutton 80,30,116,41,11 - ret - -DisplayGUICheatSearchClick2: - cmp byte[CheatWinMode],2 - je near DisplayGUICheatSearchClick.preview -DisplayGUICheatSearchClick: - cmp byte[CheatWinMode],1 - je near .incheatmode - cmp byte[CheatWinMode],2 - je near .view - cmp byte[CheatWinMode],3 - je near .add - - GUIPHoldbutton 95,140,140,152,50 ; Main Menu - GUIPButtonHole 11,28,byte[CheatSrcByteSize],0 - GUIPButtonHole 11,38,byte[CheatSrcByteSize],1 - GUIPButtonHole 11,48,byte[CheatSrcByteSize],2 - GUIPButtonHole 11,58,byte[CheatSrcByteSize],3 - GUIPButtonHole 11,73,byte[CheatSrcByteBase],0 - GUIPButtonHole 11,83,byte[CheatSrcByteBase],1 - GUIPButtonHole 11,113,byte[CheatSrcSearchType],0 - GUIPButtonHole 11,123,byte[CheatSrcSearchType],1 - ret - -.incheatmode ; Exact Value - GUIPHoldbutton 30,140,80,152,51 - cmp byte[CheatSearchStatus],1 - jne near .cheatsearching - jmp .nosearch - -.cheatsearching ; Return and Re-Search - cmp byte[CheatSrcSearchType],1 - je near .cheatsearchingcomp - jmp .searched - -.cheatsearchingcomp ; Select Comparison - GUIPButtonHole 11,33,byte[CheatCompareValue],0 - GUIPButtonHole 11,43,byte[CheatCompareValue],1 - GUIPButtonHole 11,53,byte[CheatCompareValue],2 - GUIPButtonHole 11,63,byte[CheatCompareValue],3 - -.searched ; Restart/View/Search Buttons - GUIPHoldbutton 120,140,170,152,53 -.nosearch - GUIPHoldbutton 10,140,60,152,51 - GUIPHoldbutton 70,140,110,152,52 - ret - -; View Cheat -.preview ; Preview Box - ; x1,y1,x2,y2,upjump,downjump,holdpos,scsize,view,cur,listsize - GUISlidebarPostImpl 173,28,180,100,.scrollup,.scrolldown,11,12,GUIcurrentchtsrcviewloc,GUIcurrentchtsrccursloc,NumCheatSrc,GUIBlankVar,1 - ;x1,y1,x2,y2,view,curs,num,.scru,.scrd,jumpto,sizeofscreen - GUIPostWinBoxMove 5,22,171,22+12*7,GUIcurrentchtsrcviewloc,GUIcurrentchtsrccursloc,NumCheatSrc,.scrollup,.scrolldown,DisplayGUICheatSearchClick.skipscrol,12 -.view - ; x1,y1,x2,y2,GUI?StA,ScrnSize,ViewLoc,CursLoc,Entries,win# - GUISlidebarImpl 173,28,180,100,GUICSStA,12,GUIcurrentchtsrcviewloc,GUIcurrentchtsrccursloc,NumCheatSrc,13 -.skipscrol - ; x,y,x2,y2,currentwin,vpos,#entries,starty,y/entry,cpos,winval,win#,dclicktick# - GUIWinControl 5,23,171,21+12*7,GUIBlankVar,GUIcurrentchtsrcviewloc,NumCheatSrc,22,7,GUIcurrentchtsrccursloc,5,13,30 - - GUIPHoldbutton 70,140,130,152,54 ; Return/Add Buttons - GUIPHoldbutton 140,140,180,152,55 - ret - -; DrawSlideBarWin 13,173,28,[GUIcurrentchtsrcviewloc],[NumCheatSrc],12,73,GUICSStA -; DrawGUIWinBox 13,5,20,171,108,167 - -.add ; Add Cheat - GUIPHoldbutton 60,155,120,167,56 ; Return/Add Buttons - GUIPHoldbutton 130,155,160,167,57 - GUIClickCButton 8,139,byte[CheatUpperByteOnly] ; Checkbox - GUIBoxVar 10,30,80,37,CurCStextpos,0 ; Input Boxes - GUIBoxVar 10,55,126,62,CurCStextpos,1 - ret - -DisplayGUIAddOnClick: - GUIPButtonHole 9,23,byte[device1],0 - GUIPButtonHole 9,33,byte[device1],1 - - GUIPButtonHole 100,23,byte[device2],0 - GUIPButtonHole 100,33,byte[device2],1 - GUIPButtonHole 100,43,byte[device2],2 - GUIPButtonHole 100,53,byte[device2],3 - GUIPButtonHole 100,63,byte[device2],4 - - DGOptnsProcBox 74,76,[KeyExtraEnab1] - DGOptnsProcBox 165,76,[KeyExtraEnab2] - - GUIClickCButton 9,83,byte[mouse1lh] - GUIClickCButton 100,83,byte[mouse2lh] - - DGOptnsProcBox 74,108,[SSAutoFire] - DGOptnsProcBox 165,108,[SSPause] - ret - -DisplayGUIChipClick: - GUIClickCButton 9,43,byte[nssdip1] - GUIClickCButton 59,43,byte[nssdip2] - GUIClickCButton 109,43,byte[nssdip3] - GUIClickCButton 9,53,byte[nssdip4] - GUIClickCButton 59,53,byte[nssdip5] - GUIClickCButton 109,53,byte[nssdip6] - ret - -%ifdef __MSDOS__ -%define path_length 256 -%else -%define path_length 1024 -%endif - -DisplayGUIPathsClick: - GUITextBoxInputNach 75,15,230,25,1,path_length,init_save_paths ;SRAMPath - GUITextBoxInputNach 75,35,230,45,2,path_length,init_save_paths ;SnapPath - GUITextBoxInputNach 75,55,230,65,3,path_length,init_save_paths ;SPCPath - GUITextBoxInputNach 8,95,100,105,4,path_length,init_save_paths ;BSXPath - GUITextBoxInputNach 8,120,100,130,5,path_length,init_save_paths ;SGPath - GUITextBoxInputNach 135,95,235,105,6,path_length,init_save_paths ;STPath - GUITextBoxInputNach 135,120,235,130,7,path_length,init_save_paths ;GNextPath - GUITextBoxInputNach 8,155,100,165,8,path_length,init_save_paths ;FEOEZPath - GUITextBoxInputNach 135,155,235,165,9,path_length,init_save_paths ;SJNSPath - GUITextBoxInputNach 8,180,100,190,10,path_length,init_save_paths ;MDHPath - GUITextBoxInputNach 135,180,235,190,11,path_length,init_save_paths ;SPL4Path - ret - -DisplayGUISaveClick: - GUIClickCButton 11,38,byte[nosaveSRAM] - GUIClickCButton 11,48,byte[SRAMSave5Sec] - GUIClickCButton 11,58,byte[SRAMState] - GUIClickCButton 11,68,byte[LatestSave] - GUIClickCButton 11,78,byte[AutoIncSaveSlot] - GUIClickCButton 11,88,byte[AutoState] - GUIClickCButton 11,98,byte[PauseLoad] - GUIClickCButton 11,108,byte[PauseRewind] - GUIPHoldbutton2 173,17,181,24,70,byte[RewindStates],1,99 - GUIPHoldbutton2 184,17,192,24,71,byte[RewindStates],-1,0 - GUIPHoldbutton2 173,29,181,36,72,byte[RewindFrames],1,99 - GUIPHoldbutton2 184,29,192,36,73,byte[RewindFrames],-1,1 - DGOptnsProcBox 27,130,[KeyStateSlc0] - DGOptnsProcBox 27+45,130,[KeyStateSlc1] - DGOptnsProcBox 27+45*2,130,[KeyStateSlc2] - DGOptnsProcBox 27+45*3,130,[KeyStateSlc3] - DGOptnsProcBox 27,139,[KeyStateSlc4] - DGOptnsProcBox 27+45,139,[KeyStateSlc5] - DGOptnsProcBox 27+45*2,139,[KeyStateSlc6] - DGOptnsProcBox 27+45*3,139,[KeyStateSlc7] - DGOptnsProcBox 27,148,[KeyStateSlc8] - DGOptnsProcBox 27+45,148,[KeyStateSlc9] - DGOptnsProcBox 27+45*2,148,[KeyIncStateSlot] - DGOptnsProcBox 27+45*3,148,[KeyDecStateSlot] - DGOptnsProcBox 8+25,157,[KeySaveState] - DGOptnsProcBox 8+57+25,157,[KeyLoadState] - DGOptnsProcBox 8+114+25,157,[KeyStateSelct] - DGOptnsProcBox 8+38,166,[KeyRewind] - ret - -DisplayGUISpeedClick: - mov eax,[GUImouseposx] ; this updates the mouse location - sub eax,[GUIwinposx+21*4] ; effectively 'grabbing' the cursor ! - mov edx,[GUImouseposy] - sub edx,[GUIwinposy+21*4] - - GUIClickCButton 11,135,byte[FastFwdToggle] ; Checkboxes - GUIClickCButtonfr 11,145,byte[frameskip] - - cmp byte[frameskip],0 - jne near .frate - DGOptnsProcBox 12,78,[KeyEmuSpeedUp] - DGOptnsProcBox 12,98,[KeyEmuSpeedDown] - jmp near .endsc -.frate - DGOptnsProcBox 12,78,[KeyFRateUp] - DGOptnsProcBox 12,98,[KeyFRateDown] -.endsc - - DGOptnsProcBox 12,58,[KeyFastFrwrd] ; Shortcut Boxes - DGOptnsProcBox 12,68,[KeySlowDown] - DGOptnsProcBox 12,88,[KeyResetSpeed] - DGOptnsProcBox 12,108,[EMUPauseKey] - DGOptnsProcBox 12,118,[INCRFrameKey] - - GUIPHoldbutton2 118,24,126,32,74,byte[FFRatio],1,28 - GUIPHoldbutton2 129,24,137,32,75,byte[FFRatio],-1,0 - GUIPHoldbutton2 118,35,126,43,76,byte[SDRatio],1,28 - GUIPHoldbutton2 129,35,137,43,77,byte[SDRatio],-1,0 - cmp byte[frameskip],0 - je near .autopress - GUIPHoldbutton2 118,13,126,21,78,byte[frameskip],1,10 - GUIPHoldbutton2 129,13,137,21,79,byte[frameskip],-1,1 - ret - -.autopress - GUIPHoldbutton2 118,13,126,21,78,byte[maxskip],1,9 - GUIPHoldbutton2 129,13,137,21,79,byte[maxskip],-1,0 - - ; Speed Slider - cmp eax,7 ; X-Range for click-area - jl near .nomovebar - cmp eax,7+116 - jg near .nomovebar - sub eax,7 - shr eax,1 - cmp edx,173 ; Y-Range for click-area - jl near .nomovebar - cmp edx,177 - jg near .nomovebar - mov [EmuSpeed],al - mov byte[GUIHold],6 ; Lock mouse to bar when clicked - mov eax,[GUIwinposy+21*4] - add eax,175 - mov [GUIHoldYlim],eax - mov eax,[GUIwinposx+21*4] - add eax,7 - mov [GUIHoldXlimL],eax - add eax,116 - mov [GUIHoldXlimR],eax -.nomovebar - ret - -DrawMouse: - mov edi,[vidbuffer] - add edi,16 - add edi,[GUImouseposx] - mov eax,[GUImouseposy] - shl eax,8 - mov ebx,[GUImouseposy] - shl ebx,5 - add eax,ebx - add edi,eax - mov esi,GUIMousePtr - mov edx,8 -.next2 - mov ecx,8 -.next - mov al,[esi] - or al,al - jz near .nodraw - test byte[mouseshad],1 - jz near .finishadow - - mov bl,[edi+288*10+8] - cmp bl,32 - jae .noprimshad - add byte[edi+288*10+8],96 - jmp .finishadow -.noprimshad - - mov bl,[edi+288*4+3] - cmp bl,32 - jb .nogray - cmp bl,63 - ja .nogray - sub bl,32 - shr bl,1 - add bl,32 - mov [edi+288*4+3],bl - jmp .finishadow -.nogray - and bl,11110000b - cmp bl,64 - jne .nomidshad2 - add byte[edi+288*4+3],16 - jmp .finishadow -.nomidshad2 - - mov bl,[edi+288*7+5] - cmp bl,148 - jb .nomidshad - cmp bl,167 - ja .mid2 - add byte[edi+288*7+5],20 - jmp .finishadow -.mid2 - cmp bl,189 - jb .nomidshad - cmp bl,220 - ja .nomidshad - sub bl,189 - shr bl,1 - add bl,189 - mov [edi+288*7+5],bl - jmp .finishadow -.nomidshad - -.finishadow - add al,88 - mov [edi],al -.nodraw - inc esi - inc edi - dec ecx - jnz near .next - add edi,288-8 - dec edx - jnz near .next2 - ret diff --git a/tools/zsnes/src/gui/guitools.inc b/tools/zsnes/src/gui/guitools.inc deleted file mode 100644 index 07aa865..0000000 --- a/tools/zsnes/src/gui/guitools.inc +++ /dev/null @@ -1,846 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -; Tools for the GUI (string functions are also used elsewhere) - -SECTION .text - -NEWSYM CopyString - push eax -.again - mov dl,[eax] - mov [ebx],dl - inc eax - inc ebx - or dl,dl - jnz .again - pop eax - ret - -NEWSYM StringLength - xor ecx,ecx - push eax -.loop - cmp byte[eax],0 - je .done - inc eax - inc ecx - jmp .loop -.done - pop eax - ret - -NEWSYM ClipString - ; clip string eax by bl characters -.next - push eax -.again - mov dl,[eax+1] - mov [eax],dl - inc eax - or dl,dl - jnz .again - pop eax - dec bl - jnz .next - ret - -NEWSYM ConcatString - ; concat eax in front of ebx, store in ebx - ; move string forward by length of eax - pushad - mov esi,eax - cmp byte[esi],0 - je near .nomore3 -.next - inc esi - cmp byte[esi],0 - jne .next - dec esi -.again - mov dl,[esi] - push ebx - xor ecx,ecx -.loop - cmp byte[ebx],0 - je .nomore - inc ebx - inc ecx - jmp .loop -.nomore - inc ebx - inc ecx -.loop2 - or ecx,ecx - jz .nomore2 - mov dh,[ebx-1] - mov [ebx],dh - dec ebx - dec ecx - jmp .loop2 -.nomore2 - pop ebx - mov [ebx],dl - cmp eax,esi - je .nomore3 - dec esi - jmp .again -.nomore3 - popad - ret - -GUIoutputchar: - push edi - push esi - push eax - xor ebx,ebx - mov bl,al - - - cmp byte[newfont],0 ; Font Setup (Menus) - jne .nozero - mov edi,GUIFontData - jmp .endfont -.nozero - mov edi,GUIFontData1 -.endfont - -; mov edi,GUIFontData - lea ebx,[ebx*5] - add edi,ebx - mov cl,5 -.loopa - mov ah,[edi] - mov ch,6 -.loopb - test ah,80h - jz .nowrite - mov al,[GUItextcolor] - sub al,cl - sub al,ch - inc al - mov [esi],al -.nowrite - shl ah,1 - inc esi - dec ch - jnz .loopb - add esi,282 - inc edi - dec cl - jnz .loopa - pop eax - pop esi - pop edi - ret - -GUIOutputString: - xor eax,eax -.more - mov al,[edi] - or al,al - jz .nomore - mov al,[ASCII2Font+eax] - call GUIoutputchar - add esi,6 - inc edi - jmp .more -.nomore - ret - -%macro GUIOuttext 4 - mov edi,%2 - mov esi,edi - shl esi,8 - shl edi,5 - add esi,edi - add esi,[vidbuffer] - add esi,%1 - add esi,16 - mov edi,%3 - mov byte[GUItextcolor],%4 - call GUIOutputString -%endmacro - -GUIDrawBox: -.loop - push edi - push ecx - rep stosb - pop ecx - pop edi - add edi,288 - dec edx - jnz .loop - ret - -%macro GUIBox 5 - mov edi,[vidbuffer] - add edi,%1 - mov edx,%2 - mov ecx,edx - shl edx,8 - shl ecx,5 - add edx,ecx - add edi,edx - add edi,16 - mov ecx,%3 - sub ecx,%1 - inc ecx - mov edx,%4 - sub edx,%2 - inc edx - mov al,%5 - call GUIDrawBox -%endmacro - -GUIHLines: - cmp ecx,0 - jl near .nodraw - cmp eax,255 - jg near .nodraw - cmp eax,0 - jnl .noofx - mov eax,0 -.noofx - cmp ecx,255 - jng .noofx2 - mov ecx,255 -.noofx2 - cmp ebx,0 - jl .nodraw - cmp ebx,223 - jg .nodraw - sub ecx,eax - inc ecx - mov edi,[vidbuffer] - add edi,eax - add edi,16 - mov eax,ebx - shl eax,8 - add edi,eax - mov eax,ebx - shl eax,5 - add edi,eax - mov eax,edx -.loop - mov [edi],ah - add eax,[GUIcolscaleval] - inc edi - dec ecx - jnz .loop -.nodraw - ret - -GUIHLine: - cmp ecx,0 - jl near .nodraw - cmp eax,255 - jg near .nodraw - cmp eax,0 - jnl .noofx - mov eax,0 -.noofx - cmp ecx,255 - jng .noofx2 - mov ecx,255 -.noofx2 - cmp ebx,0 - jl .nodraw - cmp ebx,223 - jg .nodraw - sub ecx,eax - inc ecx - mov edi,[vidbuffer] - add edi,eax - add edi,16 - mov eax,ebx - shl eax,8 - add edi,eax - mov eax,ebx - shl eax,5 - add edi,eax - mov eax,edx - rep stosb -.nodraw - ret - -%macro GUIPal 4 - mov dx,03C8h - mov al,%1 - out dx,al - inc dx - mov al,%2 - out dx,al - mov al,%3 - out dx,al - mov al,%4 - out dx,al -%endmacro - -GUIDrawShadow: -.loop - push edi - push ecx -.loop2 - mov al,[edi-3*288-3] - cmp al,148 - jb .nomidshad - cmp al,167 - ja .mid2 - add byte[edi-3*288-3],20 - jmp .noshadow -.mid2 - cmp al,189 - jb .nomidshad - cmp al,220 - ja .nomidshad - sub al,189 - shr al,1 - add al,189 - mov [edi-288*3-3],al - jmp .noshadow -.nomidshad - mov al,[edi] - cmp al,32 - jae .noshadow - add al,96 - mov [edi],al -.noshadow - inc edi - dec ecx - jnz .loop2 - pop ecx - pop edi - add edi,288 - dec edx - jnz near .loop - ret - -%macro GUIShadow 4 - mov edi,[vidbuffer] - add edi,%1+%2*288+16 - mov ecx,%3-%1+1 - mov edx,%4-%2+1 - call GUIDrawShadow -%endmacro - -GUIDrawShadow2: -.loop - push edi - push ecx -.loop2 - mov al,[edi] - cmp al,32 - jae .noshadow - add al,96 - mov [edi],al -.noshadow - inc edi - dec ecx - jnz .loop2 - pop ecx - pop edi - add edi,288 - dec ebx - jnz .loop - ret - -GUIoutputcharwin: - push edi - push esi - push eax - xor ebx,ebx - mov bl,al - - cmp byte[newfont],0 ; Font Setup (Windows) - jne .nozero - mov edi,GUIFontData - jmp .endfont -.nozero - mov edi,GUIFontData1 -.endfont - -; mov edi,GUIFontData - lea ebx,[ebx*5] - add edi,ebx - mov cl,5 -.loopa - mov ah,[edi] - mov ch,5 - cmp esi,[vidbuffer] - jb .below - mov edx,[vidbuffer] - add edx,224*288 - cmp esi,edx - jb .loopb -.below - add esi,5 - jmp .nowrite2 -.loopb - test ah,80h - jz .nowrite - mov al,[GUItextcolor] - mov [esi],al -.nowrite - shl ah,1 - inc esi - dec ch - jnz .loopb -.nowrite2 - add esi,283 - inc edi - dec cl - jnz .loopa - pop eax - pop esi - pop edi - ret - -GUIOutputStringwin: - xor eax,eax -.more - mov al,[edi] - or al,al - jz .nomore - mov al,[ASCII2Font+eax] - cmp edx,-8 - jl .nodraw - cmp edx,255 - jg .nodraw - push esi - push edx - add esi,edx - call GUIoutputcharwin - pop edx - pop esi -.nodraw - add edx,6 - inc edi - jmp .more -.nomore - ret - -GUIOutputStringwinl: - xor eax,eax - mov ecx,[cloadmaxlen] -.more - mov al,[edi] -%ifndef __MSDOS__ - cmp al,'%' - jne .noperc - call ConvertPercValue -.noperc -%endif - or al,al - jz .nomore - mov al,[ASCII2Font+eax] - cmp edx,-8 - jl .nodraw - cmp edx,255 - jg .nodraw - push esi - push edx - push ecx - add esi,edx - call GUIoutputcharwin - pop ecx - pop edx - pop esi -.nodraw - add edx,6 - inc edi - dec ecx - jz .nomore - jmp .more -.nomore - ret - -%ifndef __MSDOS__ -ConvertPercValue: - mov al,[edi+2] - cmp al,'a' - jb .notlower - cmp al,'z' - ja .notlower - sub al,'a'-'A' -.notlower - mov ah,[edi+1] - cmp ah,'a' - jb .notlowerb - cmp ah,'z' - ja .notlowerb - sub ah,'a'-'A' -.notlowerb - cmp al,'0' - jb .noperc - cmp al,'9' - jbe .yesperc - cmp al,'F' - ja .noperc - cmp al,'A' - jb .noperc -.yesperc - cmp ah,'0' - jb .noperc - cmp ah,'9' - jbe .yesperc2 - cmp ah,'F' - ja .noperc - cmp ah,'A' - jb .noperc -.yesperc2 - sub al,'0' - cmp al,9 - jbe .nodec - sub al,'A'-'0'-10 -.nodec - sub ah,'0' - cmp ah,9 - jbe .nodecb - sub ah,'A'-'0'-10 -.nodecb - shl ah,4 - or al,ah - add edi,2 - and eax,0FFh - ret -.noperc - movzx eax,byte[edi] - ret -%endif - -OutputUnder: - cmp edx,-8 - jl .nodraw - cmp edx,255 - jg .nodraw - mov dword[esi+edx+5*288-1],0E8E8E8E8h - mov byte[esi+edx+5*288+3],0E8h -.nodraw - ret - -%macro GUIOuttextwin 1 - mov esi,ebx - mov eax,ebx - shl esi,8 - shl eax,5 - add esi,eax - add esi,16 - add esi,[vidbuffer] - mov edi,%1 - call GUIOutputStringwin -%endmacro - -%macro GUIOuttextwin2 4 - mov edx,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add edx,%2 - add ebx,%3 - mov esi,ebx - mov eax,ebx - shl esi,8 - shl eax,5 - add esi,eax - add esi,16 - add esi,[vidbuffer] - mov edi,%4 - call GUIOutputStringwin -%endmacro - -%macro GUIOuttextwin2l 4 - mov edx,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add edx,%2 - add ebx,%3 - mov esi,ebx - mov eax,ebx - shl esi,8 - shl eax,5 - add esi,eax - add esi,16 - add esi,[vidbuffer] - mov edi,%4 - call GUIOutputStringwinl -%endmacro - -%macro GUIOuttextwin2u 5 - mov edx,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add edx,%2 - add ebx,%3 - mov esi,ebx - mov eax,ebx - shl esi,8 - shl eax,5 - add esi,eax - add esi,16 - add esi,[vidbuffer] - mov edi,%4 - add edx,%5*6 - call OutputUnder - sub edx,%5*6 - call GUIOutputStringwin -%endmacro - -GUIoutputiconwin: - cmp eax,-9 - jl .nodraw - cmp eax,256 - jl .draw -.nodraw - ret -.draw - mov esi,ebx - mov ecx,ebx - shl esi,8 - shl ecx,5 - add esi,ecx - add esi,16 - add esi,[vidbuffer] - add esi,eax - mov cl,10 -.loopa - mov ch,10 - cmp esi,[vidbuffer] - jb .below - mov edx,[vidbuffer] - add edx,224*288 - cmp esi,edx - jb .loopb -.below - add esi,10 - jmp .nowrite2 -.loopb - mov al,[edi] - or al,al - jz .transp - cmp al,189 - ja .col2 - cmp byte[GUIWincoladd],0 - je .col3 - inc al - jmp .col3 -.col2 - sub al,[GUIWincoladd] - dec al -.col3 - mov [esi],al -.transp - inc edi - inc esi - dec ch - jnz .loopb -.nowrite2 - add esi,278 - dec cl - jnz .loopa - ret - -%macro GUIDisplayIcon 1 - mov edi,%1 - call GUIoutputiconwin -%endmacro - -%macro GUIDisplayIconWin 4 - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add eax,%2 - add ebx,%3 - mov edi,%4 - call GUIoutputiconwin -%endmacro - -GUIDrawSlideBar: - cmp eax,-10 - jl .ret - cmp eax,256 - jg .ret - jmp .noret -.ret - ret -.noret - mov edi,[vidbuffer] - mov [vbuflimtop],edi - mov edi,[vidbuffer] - add edi,288*224 - sub edi,16 - mov [vbuflimbot],edi - mov edi,eax - mov eax,ebx - shl ebx,8 - shl eax,5 - add edi,ebx - add edi,eax - add edi,[vidbuffer] - add edi,16 - xor eax,eax - dec ecx -.loop - cmp edx,0 - je near .toparea - cmp ecx,0 - je near .bottomarea - cmp ah,1 - je .filleddisp - cmp edi,[vbuflimtop] - jb near .nodraw - cmp edi,[vbuflimbot] - ja near .nodraw - mov al,197 - sub al,byte[GUIWincoladd] - mov [edi],al - sub al,2 - mov [edi+1],al - dec al - mov [edi+2],al - dec al - mov [edi+3],al - mov [edi+4],al - inc al - mov [edi+5],al - inc al - mov [edi+6],al - add al,2 - mov [edi+7],al - jmp .fin -.filleddisp - cmp edi,[vbuflimtop] - jb near .nodraw - cmp edi,[vbuflimbot] - ja near .nodraw - mov al,202 - sub al,byte[GUIWincoladd] - mov [edi],al - sub al,2 - mov [edi+1],al - mov [edi+2],al - mov [edi+3],al - mov [edi+4],al - mov [edi+5],al - mov [edi+6],al - sub al,2 - mov [edi+7],al - jmp .fin -.toparea - cmp edi,[vbuflimtop] - jb near .nodraw - cmp edi,[vbuflimbot] - ja near .nodraw - mov al,202 - sub al,byte[GUIWincoladd] - mov [edi],al - add al,2 - mov [edi+1],al - mov [edi+2],al - mov [edi+3],al - mov [edi+4],al - mov [edi+5],al - mov [edi+6],al - mov [edi+7],al - mov ah,1 - jmp .fin -.bottomarea - cmp edi,[vbuflimtop] - jb near .nodraw - cmp edi,[vbuflimbot] - ja near .nodraw - mov al,6 - mov al,196 - sub al,byte[GUIWincoladd] - mov [edi],al - mov [edi+1],al - mov [edi+2],al - mov [edi+3],al - mov [edi+4],al - mov [edi+5],al - mov [edi+6],al - add al,2 - mov [edi+7],al - mov ah,0 -.fin -.nodraw - add edi,288 - dec ecx - dec edx - dec esi - jnz near .loop - ret - -%macro DrawSlideBarWin 8 - ; win#,X,Y start, %4-List Loc, %5-List size, %6-Screen size, %7-Bar Size - mov ebx,%5 - mov ecx,%4 - ; if (Screen Size > List Size) List Size = Screen Size - cmp ebx,%6 - jae %%noscrbig - mov ebx,%6 -%%noscrbig - ; If (ListLoc + ScreenSize > ListSize) ListLoc = ListSize - ScreenSize - mov eax,ecx - add eax,%6 - cmp eax,ebx - jbe %%nosetlloc - mov ecx,ebx - sub ecx,%6 -%%nosetlloc - ; Scrollbarsize = (Screen Size/List size)*Bar Size - push ebx - mov eax,%6 - mov ebx,%7 - mul ebx - pop ebx - div ebx - ; If (Scrollbarsize < 5) Scrollbarsize = 5 - cmp eax,5 - jae %%validscroll - mov eax,5 -%%validscroll - ; StartY = (Bar Size-Scrollbarsize)*(List Loc/(List size-ScreenSize)) - push eax - sub eax,%7 - neg eax - mul ecx - sub ebx,%6 - cmp ebx,0 - je %%zero - div ebx - jmp %%notzero -%%zero - xor eax,eax -%%notzero - mov edx,eax - pop eax - mov ecx,eax - add ecx,edx - ; ecx = endy, edx = starty - mov esi,%7 - sub esi,ecx - add esi,edx - dec esi - mov [%8],esi - mov [%8+4],edx - mov [%8+8],ecx - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add eax,%2 - add ebx,%3 - mov esi,%7 - call GUIDrawSlideBar -%endmacro diff --git a/tools/zsnes/src/gui/guiwindp.inc b/tools/zsnes/src/gui/guiwindp.inc deleted file mode 100644 index fd1522b..0000000 --- a/tools/zsnes/src/gui/guiwindp.inc +++ /dev/null @@ -1,5243 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 VERSION_STR,placedate - -SECTION .data -NEWSYM mencoderExists, db 0 -NEWSYM lameExists, db 0 - -SECTION .text - -%macro DrawGUILineSc 2 - mov dword[GUIcolscaleval],%2 - mov edx,%1 - push eax - push ecx - call GUIHLines - pop ecx - pop eax - inc ebx -%endmacro - -%macro DrawGUILine 0 - push eax - push ecx - call GUIHLine - pop ecx - pop eax - inc ebx -%endmacro - -%macro DrawTitleBar 0 - mov edx,46+157+6 - sub edx,[GUIWincoladd] - DrawGUILine - mov edx,42+157+4+4 - sub edx,[GUIWincoladd] - DrawGUILine - dec edx - DrawGUILine - dec edx - DrawGUILine - dec edx - DrawGUILine - dec edx - DrawGUILine - dec edx - DrawGUILine - dec edx - DrawGUILine - dec edx - DrawGUILine - mov edx,38+157+4 - sub edx,[GUIWincoladd] - DrawGUILine - sub ebx,10 - mov edx,44+157+4 - sub edx,[GUIWincoladd] - mov esi,9 - push ecx - mov ecx,eax -%%loop2 - DrawGUILine - dec esi - jnz %%loop2 - pop ecx - sub ebx,8 - mov edx,40+157+4 - sub edx,[GUIWincoladd] - mov esi,9 - push eax - mov eax,ecx -%%loop3 - DrawGUILine - dec esi - jnz %%loop3 - pop eax -%endmacro - -%macro drawshadow2 3 - mov edx,[GUIwinposy+%1*4] - cmp edx,223 - jg near .noshadow - cmp edx,0 - jge .noshadclip - mov edx,0 -.noshadclip - mov ebx,edx - add ebx,%3 - add ebx,9 - cmp ebx,0 - jl near .noshadow - cmp ebx,223 - jng .noshadclip2 - mov ebx,223 -.noshadclip2 - sub ebx,edx - inc ebx - mov edi,edx - shl edi,8 - mov eax,edx - shl eax,5 - add edi,eax - mov edx,[GUIwinposx+%1*4] - mov ecx,edx - cmp edx,255 - jg .noshadow - cmp edx,-3 - jnl .noshadclip3 - mov edx,-3 -.noshadclip3 - add ecx,%2 - cmp ecx,0 - jl .noshadow - cmp ecx,255 - jng .noshadclip4 - mov ecx,255 -.noshadclip4 - sub ecx,edx - inc ecx - add edi,edx - add edi,[vidbuffer] - add edi,288*3+3+16 - call GUIDrawShadow2 -.noshadow -%endmacro - -%macro GUIDrawWindowBox 2 - mov dword[GUIWincoladd],4 - mov dword[GUIWincol],148+10 - cmp byte[cwindrawn],1 - jne .noone - mov dword[GUIWincol],148+5 -.noone - cmp byte[cwindrawn],0 - jne .nozero - mov dword[GUIWincoladd],0 - mov dword[GUIWincol],148 -.nozero - drawshadow2 %1,dword[GUIwinsizex+%1*4],dword[GUIwinsizey+%1*4] - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - mov ecx,eax - add ecx,dword[GUIwinsizex+%1*4] - DrawTitleBar - mov esi,[GUIwinsizey+%1*4] - dec esi - mov edx,[GUIWincol] - add edx,2 -.loop - DrawGUILine - dec esi - jnz .loop - mov edx,[GUIWincol] - DrawGUILine - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add ebx,10 - mov ecx,eax - mov esi,[GUIwinsizey+%1*4] - mov edx,[GUIWincol] - add edx,3 - dec esi -.loop2 - DrawGUILine - dec esi - jnz .loop2 - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add ebx,10 - add eax,dword[GUIwinsizex+%1*4] - mov ecx,eax - mov esi,[GUIwinsizey+%1*4] - mov dl,[GUIWincol] - inc dl -.loop3 - DrawGUILine - dec esi - jnz .loop3 - mov ebx,[GUIwinposy+%1*4] - add ebx,3 - mov edx,[GUIwinposx+%1*4] - add edx,3 - mov byte[GUItextcolor],184 - GUIOuttextwin %2 - mov ebx,[GUIwinposy+%1*4] - add ebx,2 - mov edx,[GUIwinposx+%1*4] - add edx,2 - mov byte[GUItextcolor],220 - cmp byte[GUIWincoladd],0 - je .zero2 - sub byte[GUItextcolor],6 -.zero2 - GUIOuttextwin %2 - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add eax,dword[GUIwinsizex+%1*4] - sub eax,10 - GUIDisplayIcon GUIIconDataClose -%endmacro - -%macro DrawGUIWinBox 6 - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add eax,%2 - add ebx,%3 - mov ecx,eax - add ecx,%4-%2+1 - mov dl,%6 - mov esi,%5-%3+1 -%%loop - DrawGUILine - dec esi - jnz %%loop -%endmacro - -%macro DrawGUIWinBox2 5 - mov eax,[GUIwinposx+%1*4] - mov ecx,eax - add eax,%2 - add ecx,%3+1 - mov dl,%5 - cmp byte[GUIWincoladd],0 - je %%zero - inc dl -%%zero - mov esi,%4 - add ebx,dword[GUIwinposy+%1*4] -%%loop - DrawGUILine - dec esi - jnz %%loop -%endmacro - -%macro DrawGUIWinBox3 6 - mov ecx,%4 - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add ecx,eax - add eax,%2 - add ebx,%3 - inc ecx - mov dl,%6 - mov esi,%5-%3+1 -%%loop - DrawGUILine - dec esi - jnz %%loop -%endmacro - -%macro DrawGUIButton 9 - mov dl,[GUItextcolor] - sub dl,5 - cmp byte[GUICBHold],%7 - jne %%noa - sub dl,13 -%%noa - DrawGUIWinBox %1,%2,%3,%4,%3,dl - sub dl,3 - cmp byte[GUICBHold],%7 - jne %%nob - add dl,5 -%%nob - DrawGUIWinBox %1,%2,%3,%2,%5,dl - sub dl,3 - cmp byte[GUICBHold],%7 - jne %%noc - add dl,5 -%%noc - DrawGUIWinBox %1,%2+1,%3+1,%4-2,%5-2,dl - sub dl,3 - cmp byte[GUICBHold],%7 - jne %%nod - add dl,5 -%%nod - DrawGUIWinBox %1,%4+1,%3+1,%4-2,%5-2,dl - sub dl,3 - cmp byte[GUICBHold],%7 - jne %%noe - add dl,5 -%%noe - DrawGUIWinBox %1,%2,%5,%4-1,%5,dl - cmp byte[GUICBHold],%7 - je near %%no2 - sub byte[GUItextcolor],15 - GUIOuttextwin2 %1,%2+5+%8,%3+4+%9,%6 - add byte[GUItextcolor],15 - GUIOuttextwin2 %1,%2+4+%8,%3+3+%9,%6 - jmp %%yes -%%no2 - sub byte[GUItextcolor],18 - GUIOuttextwin2 %1,%2+6+%8,%3+5+%9,%6 - add byte[GUItextcolor],15 - GUIOuttextwin2 %1,%2+5+%8,%3+4+%9,%6 - add byte[GUItextcolor],3 -%%yes -%endmacro - -%macro GUIOuttextwin2load 3 - mov eax,[eax] - mov [cloadnpos],eax - inc dword[cloadnposb] - mov byte[GUItextcolor],223 - GUIOuttextwin2l %1,%2,%3,[cloadnpos] - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je %%zero - mov byte[GUItextcolor],222 -%%zero - GUIOuttextwin2l %1,%2-1,%3-1,[cloadnpos] - add dword[cloadnpos],32 - dec dword[cloadnleft] -%endmacro - -%macro GUIOuttextwinloadfile 3 - test dword[cloadnleft],80000000h - jnz near %%skip - mov eax,[cloadnposb] - cmp eax,[GUIfileentries] - jae near %%skip - mov eax,[cloadnposb] - shl eax,2 - add eax,[selected_names] - GUIOuttextwin2load %1,%2,%3 -%%skip -%endmacro - -%macro GUIOuttextwinloaddir 3 - test dword[cloadnleft],80000000h - jnz near %%skip - mov eax,[cloadnposb] - cmp eax,[GUIdirentries] - jae near %%skip - mov eax,[cloadnposb] - shl eax,2 - add eax,[d_names] - add eax,8 - GUIOuttextwin2load %1,%2,%3 -%%skip -%endmacro - -%macro GUIDisplayButtonHoleTu 7 - mov dword[GUITemp],GUIIconDataButtonHole - cmp %4,%5 - jne %%nofill - mov dword[GUITemp],GUIIconDataButtonFill -%%nofill - GUIDisplayIconWin %1,%2,%3,[GUITemp] - GUIDisplayTextu %1,%2+15,%3+3,%6,%7 -%endmacro - -%macro GUIDisplayButtonHole 5 - mov dword[GUITemp],GUIIconDataButtonHole - cmp %4,%5 - jne %%nofill - mov dword[GUITemp],GUIIconDataButtonFill -%%nofill - GUIDisplayIconWin %1,%2,%3,[GUITemp] -%endmacro - -%macro GUIDisplayText 4 ; Text&Shadow - mov byte[GUItextcolor],202 - cmp byte[GUIWincoladd],0 - je %%text - mov byte[GUItextcolor],196 -%%text -GUIOuttextwin2 %1,%2,%3,%4 - add byte[GUItextcolor],15 -GUIOuttextwin2 %1,%2-1,%3-1,%4 -%endmacro - -%macro GUIDisplayTextY 4 ; Yellow Text&Shadow - mov al,[GUIWincol] - mov [GUItextcolor],al - GUIOuttextwin2 %1,%2,%3,%4 - mov byte[GUItextcolor],163 - cmp byte[GUIWincoladd],0 - je %%texty - mov byte[GUItextcolor],164 -%%texty - GUIOuttextwin2 %1,%2-1,%3-1,%4 -%endmacro - -%macro GUIDisplayTextu 5 ; Text&Shadow With Underline - mov byte[GUItextcolor],202 - cmp byte[GUIWincoladd],0 - je %%textu - mov byte[GUItextcolor],196 -%%textu -GUIOuttextwin2u %1,%2,%3,%4,%5 - add byte[GUItextcolor],15 -GUIOuttextwin2 %1,%2-1,%3-1,%4 -%endmacro - -%macro GUIDisplayTextG 4 ; Green Text&Shadow - mov byte[GUItextcolor],223 - GUIOuttextwin2 %1,%2,%3,%4 - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je %%zero - mov byte[GUItextcolor],222 -%%zero - GUIOuttextwin2 %1,%2-1,%3-1,%4 -%endmacro - -%macro GUIDisplayCheckboxP 4 ; Toggled Checkbox (Plain, no text) - mov dword[GUITemp],GUIIconDataCheckBoxUC - cmp byte[%4],0 - je %%nocheckbox - mov dword[GUITemp],GUIIconDataCheckBoxC -%%nocheckbox - GUIDisplayIconWin %1,%2,%3,[GUITemp] -%endmacro - -%macro GUIDisplayCheckbox 5 ; Toggled Checkbox (Text) - mov dword[GUITemp],GUIIconDataCheckBoxUC - cmp byte[%4],0 - je %%nocheckbox - mov dword[GUITemp],GUIIconDataCheckBoxC -%%nocheckbox - GUIDisplayIconWin %1,%2,%3,[GUITemp] - GUIDisplayText %1,%2+15,%3+5,%5 -%endmacro - -%macro GUIDisplayCheckboxTn 6 ; Variable Checkbox (Text) - mov dword[GUITemp],GUIIconDataCheckBoxUC - cmp byte[%4],%5 - jne %%nocheckbox - mov dword[GUITemp],GUIIconDataCheckBoxC -%%nocheckbox - GUIDisplayIconWin %1,%2,%3,[GUITemp] - GUIDisplayText %1,%2+15,%3+5,%6 -%endmacro - -%macro GUIDisplayCheckboxu 6 ; Toggled Checkbox (Text Underline) - mov dword[GUITemp],GUIIconDataCheckBoxUC - cmp byte[%4],0 - je %%nocheckbox - mov dword[GUITemp],GUIIconDataCheckBoxC -%%nocheckbox - GUIDisplayIconWin %1,%2,%3,[GUITemp] - GUIDisplayTextu %1,%2+15,%3+5,%5,%6 -%endmacro - -%macro GUIDisplayCheckboxun 7 ; Set Var. Checkbox (Text Underline) - mov dword[GUITemp],GUIIconDataCheckBoxUC - cmp byte[%4],%5 - jne %%nocheckbox - mov dword[GUITemp],GUIIconDataCheckBoxC -%%nocheckbox - GUIDisplayIconWin %1,%2,%3,[GUITemp] - GUIDisplayTextu %1,%2+15,%3+5,%6,%7 -%endmacro - -%macro GUIDisplayCheckboxPn 5 ; Set Var. Checkbox - mov dword[GUITemp],GUIIconDataCheckBoxUC - cmp byte[%4],%5 - jne %%nocheckbox - mov dword[GUITemp],GUIIconDataCheckBoxC -%%nocheckbox - GUIDisplayIconWin %1,%2,%3,[GUITemp] -%endmacro - -%macro GUIDisplayBBoxS 6 ; Black Box W/Border - mov dword[GUIWincol],148+10 ; Minus right side - cmp byte[cwindrawn],1 - jne %%noone - mov dword[GUIWincol],148+5 -%%noone - cmp byte[cwindrawn],0 - jne %%nozero - mov dword[GUIWincol],148 -%%nozero - DrawGUIWinBox %1,%2,%3,%4,%5,%6 - mov dl,[GUIWincol] - DrawGUIWinBox %1,%2,%3-3+2,%4,%3+1,dl - mov dl,[GUIWincol] - inc dl - DrawGUIWinBox %1,%2-1,%3,%2,%5,dl - mov dl,[GUIWincol] - add dl,4 - DrawGUIWinBox %1,%2,%5+1,%4,%5-1,dl -%endmacro - -%macro GUIDisplayBBox 6 ; Black Box W/Border - mov dword[GUIWincol],148+10 - cmp byte[cwindrawn],1 - jne %%noone - mov dword[GUIWincol],148+5 -%%noone - cmp byte[cwindrawn],0 - jne %%nozero - mov dword[GUIWincol],148 -%%nozero - DrawGUIWinBox %1,%2,%3,%4,%5,%6 - mov dl,[GUIWincol] - DrawGUIWinBox %1,%2,%3-3+2,%4,%3+1,dl - mov dl,[GUIWincol] - inc dl - DrawGUIWinBox %1,%2-1,%3,%2,%5,dl - mov dl,[GUIWincol] - add dl,4 - DrawGUIWinBox %1,%2,%5+1,%4,%5-1,dl - mov dl,[GUIWincol] - add dl,3 - DrawGUIWinBox %1,%4+2,%3,%4-3,%5,dl -%endmacro - -%macro SetVidbufLoc 0 - mov esi,ebx - mov eax,ebx - shl esi,8 - shl eax,5 - add esi,eax - add esi,16 - add esi,[vidbuffer] -%endmacro - -%macro GUIDrawTArea 1 ; win #id - mov dl,[GUIWincol] - inc dl - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add ebx,10 - mov ecx,eax - add ecx,[GUIwinsizex+%1*4] - mov esi,12 -%%loop1 - DrawGUILine - dec esi - jnz %%loop1 - add dl,3 - inc eax - DrawGUILine - sub ebx,13 ; set ebx to minY - dec eax ; set eax to minX -%endmacro - -%macro DrawTabOn 1 ; %1 = array, ebp = offset, eax = minX, ebx = minY - push edi - mov esi,%1 - mov ecx,8 - add ecx,eax -%%skip - cmp byte[esi+ebp],0 - jne %%read1 - inc ebp - jmp %%skip -%%read1 - cmp byte[esi+ebp],0 - je %%ok1 - inc esi - add ecx,6 - jmp %%read1 -%%ok1 - mov dl,[GUIWincol] - add dl,4 - inc eax - DrawGUILine - sub dl,2 - mov esi,12 -%%draw1 - DrawGUILine - dec esi - jnz %%draw1 - sub ebx,12 - push ecx ; save X offset for next drawing step - dec eax - mov ecx,eax - mov esi,11 - inc dl -%%draw2 - DrawGUILine - dec esi - jnz %%draw2 - sub ebx,11 - push ebx ; save Y offset for next drawing step - mov cl,[GUIWincol] - mov [GUItextcolor],cl - add ebx,4 - push ebx ; save label Yoff - mov edx,eax - add edx,6 - push edx ; save label Xoff - SetVidbufLoc - mov edi,%1 - add edi,ebp - call GUIOutputStringwin - pop edx - pop ebx - mov byte[GUItextcolor],163 - cmp byte[GUIWincoladd],0 - je %%nochange - mov byte[GUItextcolor],164 -%%nochange - dec edx - dec ebx - SetVidbufLoc - mov edi,%1 - add edi,ebp - call GUIOutputStringwin - mov byte[GUItextcolor],217 ; restore normal colour - pop ebx ; restore Yoff for drawing step - pop eax - inc eax ; restore and set Xoff for drawing step - mov ecx,eax - mov dl,[GUIWincol] - add dl,3 - mov esi,12 -%%draw3 - DrawGUILine - dec esi - jnz %%draw3 - sub ebx,13 - inc eax -%%read2 - mov esi,%1 - cmp byte[esi+ebp],0 - je %%ok2 - inc ebp - jmp %%read2 -%%ok2 - pop edi -%endmacro - -%macro DrawTabOff 1 ; %1 = array, ebp = offset, eax = minX, ebx = minY - push edi - mov esi,%1 - mov ecx,8 - add ecx,eax -%%skip - cmp byte[esi+ebp],0 - jne %%read1 - inc ebp - jmp %%skip -%%read1 - cmp byte[esi+ebp],0 - je %%ok1 - inc esi - add ecx,6 - jmp %%read1 -%%ok1 - mov dl,[GUIWincol] - add dl,3 - inc eax - inc ebx - DrawGUILine - dec dl - push ecx ; save Xoff for next drawing step - dec eax - mov ecx,eax - mov esi,10 -%%draw1 - DrawGUILine - dec esi - jnz %%draw1 - sub ebx,10 - push ebx ; save Yoff for next drawing step - mov byte[GUItextcolor],202 - cmp byte[GUIWincoladd],0 - je %%nochange - mov byte[GUItextcolor],196 -%%nochange - add ebx,4 - push ebx ; save label Yoff - mov edx,eax - add edx,6 - push edx ; save label Xoff - SetVidbufLoc - mov edi,%1 - add edi,ebp - call GUIOutputStringwin - pop edx - pop ebx - add byte[GUItextcolor],15 - dec edx - dec ebx - SetVidbufLoc - mov edi,%1 - add edi,ebp - call GUIOutputStringwin - pop ebx ; restore Yoff for drawing step - pop eax - inc eax ; restore and set Xoff for drawing step - mov ecx,eax - mov dl,[GUIWincol] - mov esi,10 -%%draw2 - DrawGUILine - dec esi - jnz %%draw2 - sub ebx,12 - inc eax -%%read2 - mov esi,%1 - cmp byte[esi+ebp],0 - je %%ok2 - inc ebp - jmp %%read2 -%%ok2 - pop edi -%endmacro - -%macro GUIDrawTabs 1 ; tabs/label array - mov ecx,[%1+4] ; total # - cmp ecx,0 - je near %%nodraw - mov esi,[%1] ; active tab - mov ebp,8 ; set array offset at top of labels -%%loop2 - dec esi ; check if tab is the current one - push ecx - push esi - jnz near %%disabled - DrawTabOn %1 ; draws tab, updates eax, ebx & ebp for next tab... - jmp near %%done -%%disabled - DrawTabOff %1 ; ... and autosizes the tab for its label -%%done - pop esi - pop ecx - dec ecx - jnz %%loop2 -%%nodraw -%endmacro - -%macro GUIDrawSlider 8 ; win #id, minX, width, Ypos, var, text, proc1, proc2 - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add eax,%2 - add ebx,%4 - mov ecx,eax - add ecx,%3 - xor edx,edx - mov dl,215 - sub dl,[GUIWincoladd] - DrawGUILine - inc ecx - inc eax - sub dl,13 - DrawGUILine - xor eax,eax - %7 %5 ; proc1 == alters var correctly and puts result in al - mov dword[GUITemp],%2-4 - add [GUITemp],eax - GUIDisplayIconWin %1,[GUITemp],%4-4,GUIIconDataSlideBar - %8 %5,%6 ; proc2 == alters text correctly and puts pointer in esi - mov [GUITemp],esi ; Display Value (Green) - GUIDisplayTextG %1,%2+%3+6,%4-1,[GUITemp] -%endmacro - -%macro DrawBorderedBox 6; - ; draw borders - mov dl,[GUIWincol] - DrawGUIWinBox %1,%2,%6,%4,%3,dl ; freezes if you replace %6 with %3-1 - mov dl,[GUIWincol] - inc dl - DrawGUIWinBox %1,%2-1,%3,%2,%5,dl - mov dl,[GUIWincol] - add dl,4 - DrawGUIWinBox %1,%2,%5,%4,%5+1,dl - mov dl,[GUIWincol] - add dl,3 - DrawGUIWinBox %1,%4,%3,%4+1,%5,dl - DrawGUIWinBox %1,%2,%3,%4,%5,167 -%endmacro - -%macro DrawBorderedBoxB 7 ; Special function for combo displays - ; draw borders - mov dl,[GUIWincol] - DrawGUIWinBox %1,%2,%6,%4,%3,dl - mov dl,[GUIWincol] - inc dl - DrawGUIWinBox %1,%2-1,%3,%2,%5,dl - mov dl,[GUIWincol] - add dl,4 - DrawGUIWinBox %1,%2,%5,%4,%5+1,dl - mov dl,[GUIWincol] - add dl,3 - DrawGUIWinBox %1,%4,%3,%4+1,%5,dl - DrawGUIWinBox %1,%2,%3,%4,%5,167 - mov byte[GUIComboText3],%7 - mov byte[GUItextcolor],223 - GUIOuttextwin2 %1,%2+5,%3+2,GUIComboText3 - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je %%zero - mov byte[GUItextcolor],222 -%%zero - GUIOuttextwin2 %1,%2+4,%3+1,GUIComboText3 -%endmacro - -%macro DrawBorderedBoxB2 7 ; Special function for combo displays - ; draw borders - mov dl,[GUIWincol] - DrawGUIWinBox %1,%2,%6,%4,%3,dl - mov dl,[GUIWincol] - inc dl - DrawGUIWinBox %1,%2-1,%3,%2,%5,dl - mov dl,[GUIWincol] - add dl,4 - DrawGUIWinBox %1,%2,%5,%4,%5+1,dl - mov dl,[GUIWincol] - add dl,3 - DrawGUIWinBox %1,%4,%3,%4+1,%5,dl - DrawGUIWinBox %1,%2,%3,%4,%5,167 - mov byte[GUIComboText3b+1],%7 - mov byte[GUItextcolor],223 - GUIOuttextwin2 %1,%2+2,%3+2,GUIComboText3b - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je %%zero - mov byte[GUItextcolor],222 -%%zero - GUIOuttextwin2 %1,%2+1,%3+1,GUIComboText3b -%endmacro - -%macro InitTextColor 0 - mov al,217 - cmp byte[GUIWincoladd],0 - je .zero3 - mov al,211 -.zero3 - sub al,15 - mov [TextColorSp+2],al - mov al,[GUIWincol] - mov [TextColorSp],al - mov al,163 - cmp byte[GUIWincoladd],0 - je .zero - mov al,164 - mov byte[GUItextcolor],164 -.zero - mov [TextColorSp+1],al -%endmacro - -%macro GUIOuttextwin2b 4 ; Special, yellow text - mov al,[TextColorSp] - mov [GUItextcolor],al - GUIOuttextwin2 %1,%2,%3,%4 - mov al,[TextColorSp+1] - mov [GUItextcolor],al - GUIOuttextwin2 %1,%2-1,%3-1,%4 -%endmacro - -%macro GUIOuttextwin2c 4 ; Boxed, green text - mov byte[GUItextcolor],223 - push ecx ;Needed for the macro below - GUIOuttextwin2 %1,%2,%3,%4 - pop ecx - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je %%zero - mov byte[GUItextcolor],222 -%%zero - push esi - mov esi,%2 - dec esi - GUIOuttextwin2 %1,esi,%3-1,%4 - pop esi -%endmacro - -%macro GUIOuttextwin2d 5 ; Boxed, green text, limited to 5th param - push ecx - mov ecx,%4 ;Move pointer to text into ecx -%%zero - cmp byte[ecx],0 ; Check for null in string - je %%one - inc ecx - jmp %%zero -%%one - push eax - mov eax,ecx ; Move pointer to null into eax - sub ecx,%5 ; Move ecx pointer back by length to display - cmp ecx,%4 - jae %%two - mov ecx,%4 ; If pointer is before beginning, reset pointer to beginning -%%two - sub eax,ecx ; Subtract pointer from \0 pointer gives us string length - push eax - GUIOuttextwin2c %1,%2,%3,ecx - pop eax - push ebx - pop ecx - call BlinkCursorCheck - cmp ebx,%4 - pop ebx - jne near %%fixreg - inc byte[GUIBlinkCursorLoop] - cmp byte[GUIBlinkCursorLoop],30 - jne %%four - mov byte[GUIBlinkCursorLoop],0 - cmp byte[GUIBlinkCursor],' ' - je %%three - mov byte[GUIBlinkCursor],' ' - jmp %%four -%%three - mov byte[GUIBlinkCursor],'_' -%%four - imul eax,6 ; 6 pixels - add eax,%2 - push ecx - mov ecx,eax - GUIOuttextwin2c %1,ecx,%3,GUIBlinkCursor - pop ecx -%%fixreg - pop eax -%endmacro - -%macro DrawSlideBar 10 - DrawSlideBarWin %1,%2,%3+8,%4,%5,%6,%7-16,%8 - mov al,[TextColorSp+2] - mov [GUItextcolor],al - cmp byte[GUICHold],%9 - jne .noholda - add byte[GUIWincoladd],3 -.noholda - GUIDisplayIconWin %1,%2,%3,GUIIconDataUpArrow - cmp byte[GUICHold],%9 - jne .noholda2 - sub byte[GUIWincoladd],3 -.noholda2 - mov al,[TextColorSp+2] - mov [GUItextcolor],al - cmp byte[GUICHold],%10 - jne .noholdb - add byte[GUIWincoladd],3 -.noholdb - GUIDisplayIconWin %1,%2,%3+%7-8,GUIIconDataDownArrow - cmp byte[GUICHold],%10 - jne .noholdb2 - sub byte[GUIWincoladd],3 -.noholdb2 -%endmacro - -%macro DetermineChar 2 - cmp al,%1 - jne %%control - mov al,%2 -%%control -%endmacro - -; DGUIDisplay -DisplayGUILoad: - GUIDrawWindowBox 1,GUILoadDisp - - GUIDisplayText 1,21,166,GUILoadText3 -%ifdef __MSDOS__ - GUIDisplayTextY 1,6,157,GUILoadText2 - GUIDisplayText 1,21,182,GUILoadText4 -%endif - GUIDisplayText 1,21,174,GUILoadText5 - GUIDisplayText 1,6,16,GUILoadText7 - GUIDisplayText 1,161,16,GUILoadText8 - GUIDisplayText 1,146,172,GUILoadTextB - - push ecx - push esi - xor ecx,ecx - mov esi,[ZRomPath] -.strlenloop - cmp byte[esi+ecx],0 - je .foundend - inc ecx - jmp .strlenloop -.foundend - cmp ecx,39 - jb .notoverflow - add esi,ecx - sub esi,39 -.notoverflow - mov [GUITemp],esi - pop esi - pop ecx - GUIDisplayText 1,6,138,[GUITemp] - - mov byte[GUItextcolor],202 - cmp byte[GUIWincoladd],0 - je .text - mov byte[GUItextcolor],196 -.text - mov dword[cloadmaxlen],39 -%ifndef __MSDOS__ - cmp dword[GUIcurrentfilewin],0 - je near .nodir - mov eax,[GUIcurrentdircursloc] - add eax,2 - shl eax,2 - add eax,[d_names] - mov eax,[eax] - mov [GUITemp],eax - GUIOuttextwin2l 1,6,158,[GUITemp] - add byte[GUItextcolor],15 - GUIOuttextwin2l 1,5,157,[GUITemp] - jmp .nofiles -.nodir - cmp dword[GUIfileentries],0 - je near .nofiles - mov eax,[GUIcurrentcursloc] - cmp eax,[GUIfileentries] - jae near .nofiles - shl eax,2 - add eax,[selected_names] - mov eax,[eax] - mov [cloadnpos],eax - GUIOuttextwin2l 1,6,158,[cloadnpos] - add byte[GUItextcolor],15 - GUIOuttextwin2l 1,5,157,[cloadnpos] -.nofiles ; Button -%endif - mov byte[GUItextcolor],217 - cmp byte[GUIWincoladd],0 - je .text2 - mov byte[GUItextcolor],111 -.text2 - DrawGUIButton 1,186,165,228,176,GUILoadText9,1,0,0 - - ; The Three Boxes - GUIDisplayBBoxS 1,5,25,144,134,167 ; 126 = 6 * 21, 112 = 7 * 16 - GUIDisplayBBoxS 1,160,25,228,134,167 ; 78 = 6 * 13 - GUIDisplayBBox 1,5,145,228,152,167 ; 126 = 6 * 21, 112 = 7 * 16 - - xor ebx,ebx ; Flash Code? - mov bl,[GUILoadPos] - mov byte[GUILoadTextA+ebx],0 - test byte[GUILDFlash],8 - jnz .nound - mov byte[GUILoadTextA+ebx],'_' - mov byte[GUILoadTextA+ebx+1],0 -.nound - - mov ebx,[GUIcurrentcursloc] ; check if its in the Files box? - sub ebx,[GUIcurrentviewloc] - cmp dword[GUIcurrentfilewin],0 - je .files - mov ebx,[GUIcurrentdircursloc] - sub ebx,[GUIcurrentdirviewloc] -.files - - mov eax,ebx ; Draw 2 more boxes? - lea ebx,[ebx*4] - add ebx,eax - add ebx,eax - add ebx,eax - add ebx,27 - cmp dword[GUIcurrentfilewin],0 - jne .dir - DrawGUIWinBox2 1,5,144,7,224 - jmp .files2 -.dir - DrawGUIWinBox2 1,160,228,7,224 -.files2 - - mov byte[GUItextcolor],223 ; Green Shadow - GUIOuttextwin2 1,8,148, GUILoadTextA - - cmp dword[GUIfileentries],0 - jne .yesfiles - mov dword[GUIcurrentfilewin],1 -.yesfiles - - mov eax,[GUIfileentries] - sub eax,[GUIcurrentviewloc] - mov [cloadnleft],eax - mov eax,[GUIcurrentviewloc] - mov [cloadnposb],eax - mov dword[cloadmaxlen],23 - - GUIOuttextwinloadfile 1,8,29 ; Text/Shadow for Filename Box - GUIOuttextwinloadfile 1,8,29+7 - GUIOuttextwinloadfile 1,8,29+7*2 - GUIOuttextwinloadfile 1,8,29+7*3 - GUIOuttextwinloadfile 1,8,29+7*4 - GUIOuttextwinloadfile 1,8,29+7*5 - GUIOuttextwinloadfile 1,8,29+7*6 - GUIOuttextwinloadfile 1,8,29+7*7 - GUIOuttextwinloadfile 1,8,29+7*8 - GUIOuttextwinloadfile 1,8,29+7*9 - GUIOuttextwinloadfile 1,8,29+7*10 - GUIOuttextwinloadfile 1,8,29+7*11 - GUIOuttextwinloadfile 1,8,29+7*12 - GUIOuttextwinloadfile 1,8,29+7*13 - GUIOuttextwinloadfile 1,8,29+7*14 - - mov eax,[GUIdirentries] - sub eax,[GUIcurrentdirviewloc] - mov [cloadnleft],eax - mov eax,[GUIcurrentdirviewloc] - mov [cloadnposb],eax - mov dword[cloadmaxlen],11 - - GUIOuttextwinloaddir 1,164,29 ; Text/Shadow for DIR Box - GUIOuttextwinloaddir 1,164,29+7 - GUIOuttextwinloaddir 1,164,29+7*2 - GUIOuttextwinloaddir 1,164,29+7*3 - GUIOuttextwinloaddir 1,164,29+7*4 - GUIOuttextwinloaddir 1,164,29+7*5 - GUIOuttextwinloaddir 1,164,29+7*6 - GUIOuttextwinloaddir 1,164,29+7*7 - GUIOuttextwinloaddir 1,164,29+7*8 - GUIOuttextwinloaddir 1,164,29+7*9 - GUIOuttextwinloaddir 1,164,29+7*10 - GUIOuttextwinloaddir 1,164,29+7*11 - GUIOuttextwinloaddir 1,164,29+7*12 - GUIOuttextwinloaddir 1,164,29+7*13 - GUIOuttextwinloaddir 1,164,29+7*14 - - mov byte[GUItextcolor],221 ; Green Text - cmp byte[GUIWincoladd],0 - je .zero4 - mov byte[GUItextcolor],222 -.zero4 - GUIOuttextwin2 1,7,147, GUILoadTextA - - xor ebx,ebx - mov bl,[GUILoadPos] - mov byte[GUILoadTextA+ebx],0 - - GUIDisplayButtonHole 1,9,163,byte[GUIloadfntype],0 ; Radio Buttons - GUIDisplayButtonHole 1,9,171,byte[GUIloadfntype],1 -%ifdef __MSDOS__ - GUIDisplayButtonHole 1,9,179,byte[GUIloadfntype],2 -%endif - - GUIDisplayCheckboxTn 1,10,187,showallext,1,GUILoadText6 ; Checkboxes - GUIDisplayCheckboxTn 1,144,177,ForceROMTiming,1,GUILoadTextC - GUIDisplayCheckboxTn 1,144,187,ForceROMTiming,2,GUILoadTextD - GUIDisplayCheckboxTn 1,184,177,ForceHiLoROM,1,GUILoadTextE - GUIDisplayCheckboxTn 1,184,187,ForceHiLoROM,2,GUILoadTextF - - ; Slidebar for Files - ; win#,X,Y start, %4-List Loc, %5-List size, %6-Screen size, %7-Bar Size - DrawSlideBarWin 1,146,33,[GUIcurrentviewloc],[GUIfileentries],15,94,GUILStA - cmp byte[GUICHold],1 - jne .noholda - add byte[GUIWincoladd],3 -.noholda - GUIDisplayIconWin 1,146,25,GUIIconDataUpArrow - cmp byte[GUICHold],1 - jne .noholda2 - sub byte[GUIWincoladd],3 -.noholda2 - cmp byte[GUICHold],2 - jne .noholdb - add byte[GUIWincoladd],3 -.noholdb - GUIDisplayIconWin 1,146,127,GUIIconDataDownArrow - cmp byte[GUICHold],2 - jne .noholdb2 - sub byte[GUIWincoladd],3 -.noholdb2 - - ; Slidebar for DIR - DrawSlideBarWin 1,230,33,[GUIcurrentdirviewloc],[GUIdirentries],15,94,GUILStB - cmp byte[GUICHold],3 - jne .noholdc - add byte[GUIWincoladd],3 -.noholdc - GUIDisplayIconWin 1,230,25,GUIIconDataUpArrow - cmp byte[GUICHold],3 - jne .noholdc2 - sub byte[GUIWincoladd],3 -.noholdc2 - cmp byte[GUICHold],4 - jne .noholdd - add byte[GUIWincoladd],3 -.noholdd - GUIDisplayIconWin 1,230,127,GUIIconDataDownArrow - cmp byte[GUICHold],4 - jne .noholdd2 - sub byte[GUIWincoladd],3 -.noholdd2 - ret - -SECTION .data -GUILoadText1 db 'SELECT FILE TO LOAD:',0 -%ifndef __MSDOS__ -GUILoadText3 db 'LONG FILENAME',0 -%else -GUILoadText2 db 'DISPLAY TYPE:',0 -GUILoadText3 db 'WIN9X LONG FILENAME',0 -GUILoadText4 db 'DOS 8.3 FORMAT',0 -%endif -GUILoadText5 db 'SNES HEADER NAME',0 -GUILoadText6 db 'SHOW ALL EXTENSIONS',0 -GUILoadText7 db 'FILENAME',0 -GUILoadText8 db 'DIRECTORY',0 -GUILoadText9 db 'LOAD',0 -NEWSYM GUILoadTextA, times 38 db 0 -GUILoadTextB db 'FORCE',0 -GUILoadTextC db 'NTSC',0 -GUILoadTextD db 'PAL',0 -GUILoadTextE db 'LOROM',0 -GUILoadTextF db 'HIROM',0 -SECTION .bss -GUILStA resd 3 -GUILStB resd 3 -NEWSYM GUILoadPos, resb 1 - -SECTION .text - -DisplayGUIReset: ; Reset Confirmation - GUIDrawWindowBox 12,GUIResetDisp - - cmp byte[GUIWincoladd],0 ;Red Box around buttons - je .zero - mov byte[GUItextcolor],211 -.zero - mov dl,224 - cmp byte[GUIWincoladd],0 - je .zero4 - inc dl -.zero4 - cmp byte[GUICResetPos],0 - je near .resetboxa - DrawGUIWinBox 12,79,29,117,42,dl - jmp .resetboxb -.resetboxa - DrawGUIWinBox 12,19,29,57,42,dl -.resetboxb - - DrawGUIButton 12,20,30,56,41,GUIResetText2,2,0,0 ; Buttons - DrawGUIButton 12,80,30,116,41,GUIResetText3,3,0,0 - - GUIDisplayTextY 12,6,16,GUIResetText1 - ret - -SECTION .data -GUIResetText1 db 'RESET: ARE YOU SURE ?',0 -GUIResetText2 db 'YES',0 -GUIResetText3 db 'NO',0 - -SECTION .text - -DisplayGUIStates: ; Save/Load State Confirmation - GUIDrawWindowBox 14,GUIStatesDisp - - cmp byte[GUIWincoladd],0 ; Red Box around buttons - je .zero - mov byte[GUItextcolor],211 -.zero - mov dl,224 - cmp byte[GUIWincoladd],0 - je .zero4 - inc dl -.zero4 - cmp byte[GUICStatePos],0 - je near .resetboxa - DrawGUIWinBox 14,79,29,117,42,dl - jmp .resetboxb -.resetboxa - DrawGUIWinBox 14,19,29,57,42,dl -.resetboxb - - DrawGUIButton 14,20,30,56,41,GUIStatesText3,10,0,0 ; Buttons - DrawGUIButton 14,80,30,116,41,GUIStatesText4,11,0,0 - - cmp byte[GUIStatesText5],1 ; Determines Load or Save box - je near .load - GUIDisplayTextY 14,6,16,GUIStatesText1 - jmp .save -.load - GUIDisplayTextY 14,6,16,GUIStatesText2 -.save - ret - -SECTION .data -GUIStatesText1 db 'OKAY TO SAVE STATE?',0 -GUIStatesText2 db 'OKAY TO LOAD STATE?',0 -GUIStatesText3 db 'YES',0 -GUIStatesText4 db 'NO',0 -GUIStatesText5 db 0 - -SECTION .text - -DisplayGUIChoseSave: ; Pick Save State - GUIDrawWindowBox 2,GUIStateSelDisp - - GUIDisplayTextY 2,6,16,GUIChoseSaveText1 - mov byte[GUIChoseSaveText2],'0' - GUIDisplayText 2,21,31,GUIChoseSaveText2 - mov byte[GUIChoseSaveText2],'1' - GUIDisplayText 2,41,31,GUIChoseSaveText2 - mov byte[GUIChoseSaveText2],'2' - GUIDisplayText 2,61,31,GUIChoseSaveText2 - mov byte[GUIChoseSaveText2],'3' - GUIDisplayText 2,81,31,GUIChoseSaveText2 - mov byte[GUIChoseSaveText2],'4' - GUIDisplayText 2,101,31,GUIChoseSaveText2 - mov byte[GUIChoseSaveText2],'5' - GUIDisplayText 2,21,46,GUIChoseSaveText2 - mov byte[GUIChoseSaveText2],'6' - GUIDisplayText 2,41,46,GUIChoseSaveText2 - mov byte[GUIChoseSaveText2],'7' - GUIDisplayText 2,61,46,GUIChoseSaveText2 - mov byte[GUIChoseSaveText2],'8' - GUIDisplayText 2,81,46,GUIChoseSaveText2 - mov byte[GUIChoseSaveText2],'9' - GUIDisplayText 2,101,46,GUIChoseSaveText2 - GUIDisplayTextY 2,6,61,GUIChoseSlotText1 - - mov eax,[current_zst] - mov dl,10 - div dl - add al,'0' - - mov [GUIChoseSaveText2],ah - mov [GUIChoseSlotTextX],al - - mov dword[GUITemp],GUIIconDataButtonHole ; Radio Buttons - GUIDisplayButtonHole 2,10,28,byte[GUIChoseSaveText2],0 - GUIDisplayButtonHole 2,30,28,byte[GUIChoseSaveText2],1 - GUIDisplayButtonHole 2,50,28,byte[GUIChoseSaveText2],2 - GUIDisplayButtonHole 2,70,28,byte[GUIChoseSaveText2],3 - GUIDisplayButtonHole 2,90,28,byte[GUIChoseSaveText2],4 - GUIDisplayButtonHole 2,10,43,byte[GUIChoseSaveText2],5 - GUIDisplayButtonHole 2,30,43,byte[GUIChoseSaveText2],6 - GUIDisplayButtonHole 2,50,43,byte[GUIChoseSaveText2],7 - GUIDisplayButtonHole 2,70,43,byte[GUIChoseSaveText2],8 - GUIDisplayButtonHole 2,90,43,byte[GUIChoseSaveText2],9 - - GUIDisplayBBox 2,72,59,90,66,167 ; Save Slot Frameskip +/- Box - GUIDisplayTextG 2,83,61,GUIChoseSlotTextX - mov byte[GUItextcolor],217 - cmp byte[GUIWincoladd],0 - je .slotzero5 - mov byte[GUItextcolor],211 -.slotzero5 - DrawGUIButton 2,94,59,102,67,GUIChoseSlotTextY,80,-2,-1 - DrawGUIButton 2,105,59,113,67,GUIChoseSlotTextZ,81,-2,-1 - ret - -SECTION .data -GUIChoseSaveText1 db 'SELECT SAVE SLOT:',0 -GUIChoseSaveText2 db '-',0 -GUIChoseSlotText1 db 'SLOT LEVEL:',0 -GUIChoseSlotTextX db '-',0 -GUIChoseSlotTextY db '+',0 -GUIChoseSlotTextZ db '-',0 - -SECTION .text - -%macro DGOptnsBorderBox 3 - mov dword[GUIWincol],148+10 - cmp byte[cwindrawn],1 - jne %%noone - mov dword[GUIWincol],148+5 -%%noone - cmp byte[cwindrawn],0 - jne %%nozero - mov dword[GUIWincol],148 -%%nozero - mov dl,[GUIWincol] - DrawGUIWinBox %1,%2+1,%3,%2+18,%3,dl - mov dl,[GUIWincol] - inc dl - DrawGUIWinBox %1,%2,%3+1,%2-1,%3+5,dl - mov dl,[GUIWincol] - add dl,4 - DrawGUIWinBox %1,%2+1,%3+8,%2+18,%3-8,dl - mov dl,[GUIWincol] - add dl,3 - DrawGUIWinBox %1,%2+22,%3+1,%2-23,%3+5,dl -%endmacro - -%macro DGOptnsDrawBox 3 - mov eax,[GUIwinposx+9*4] - mov ebx,[GUIwinposy+9*4] - add eax,%1 - add ebx,%2 - mov ecx,eax - add ecx,20 - mov dl,167 - mov esi,7 -%%loop - DrawGUILine - dec esi - jnz %%loop - mov eax,%3 - mov ebx,[ScanCodeListing+eax*3] - mov [GUIGameDisplayKy],ebx - mov byte[GUIGameDisplayKy+3],0 - mov byte[GUItextcolor],223 - GUIOuttextwin2 9,%1+3,%2+2,GUIGameDisplayKy - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je %%zero - mov byte[GUItextcolor],222 -%%zero - GUIOuttextwin2 9,%1+2,%2+1,GUIGameDisplayKy -%endmacro - -%macro DDrawBox 4 - mov eax,[GUIwinposx+%1*4] - mov ebx,[GUIwinposy+%1*4] - add eax,%2+1 - add ebx,%3+1 - mov ecx,eax - add ecx,20 - mov dl,167 - mov esi,7 -%%loop - DrawGUILine - dec esi - jnz %%loop - mov eax,%4 - mov ebx,[ScanCodeListing+eax*3] - mov [GUIGameDisplayKy],ebx - mov byte[GUIGameDisplayKy+3],0 - mov byte[GUItextcolor],223 - GUIOuttextwin2 %1,%2+4,%3+3,GUIGameDisplayKy - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je %%zero - mov byte[GUItextcolor],222 -%%zero - GUIOuttextwin2 %1,%2+3,%3+2,GUIGameDisplayKy - DGOptnsBorderBox %1,%2,%3 -%endmacro - -%macro DGOptnsDrawBox2 3 - mov eax,[GUIwinposx+3*4] - mov ebx,[GUIwinposy+3*4] - add eax,%1 - add ebx,%2 - mov ecx,eax - add ecx,20 - mov dl,167 - mov esi,7 -%%loop - DrawGUILine - dec esi - jnz %%loop - mov eax,%3 - mov ebx,[ScanCodeListing+eax*3] - mov [GUIGameDisplayKy],ebx - mov byte[GUIGameDisplayKy+3],0 - mov byte[GUItextcolor],223 - GUIOuttextwin2 3,%1+3,%2+2,GUIGameDisplayKy - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je %%zero - mov byte[GUItextcolor],222 -%%zero - GUIOuttextwin2 3,%1+2,%2+1,GUIGameDisplayKy -%endmacro - -%macro GUIInputDispAll 1 - GUIInputDispKey 45,102,%1upk ; Up - GUIInputDispKey 45,112,%1downk ; Down - GUIInputDispKey 45,122,%1leftk ; Left - GUIInputDispKey 45,132,%1rightk ; Right - GUIInputDispKey 45,142,%1startk ; Start - GUIInputDispKey 45,152,%1selk ; Select - GUIInputDispKey 85,102,%1Ak ; A - GUIInputDispKey 85,112,%1Bk ; B - GUIInputDispKey 85,122,%1Xk ; X - GUIInputDispKey 85,132,%1Yk ; Y - GUIInputDispKey 85,142,%1Lk ; L - GUIInputDispKey 85,152,%1Rk ; R - - GUIInputDispKey 125,102,%1Xtk ; X Turbo - GUIInputDispKey 125,112,%1Ytk ; Y Turbo - GUIInputDispKey 125,122,%1Ltk ; L Turbo - GUIInputDispKey 165,102,%1Atk ; A Turbo - GUIInputDispKey 165,112,%1Btk ; B Turbo - GUIInputDispKey 165,122,%1Rtk ; R Turbo - - GUIInputDispKey 125,142,%1DLk ; Down-Left - GUIInputDispKey 125,152,%1DRk ; Down-Right - GUIInputDispKey 165,142,%1ULk ; Up-Left - GUIInputDispKey 165,152,%1URk ; Up-Right -%endmacro - -%macro GUIInputDispKey 3 - mov eax,[%3] - mov [GUIInputTextE],eax - DGOptnsDrawBox2 %1,%2,[GUIInputTextE] -%endmacro - -DisplayGUIInput: ; Player Select, Joystick/keyboard Type List, Button Assignments - - GUIDrawWindowBox 3,GUIInputDisp - mov eax,[GUIInputTabs] - dec al - mov [cplayernum],al - GUIDrawTArea 3 - GUIDrawTabs GUIInputTabs - - GUIDisplayTextY 3,6,26,GUIInputTextA - movzx eax,byte[cplayernum] - mov ebx,[GUIInputRefP+eax*4] - movzx ebx,byte[ebx] - cmp byte[GUIFreshInputSelect],0 - je .notfreshinput - pushad - mov byte[GUIFreshInputSelect],0 - mov dword[GUIJT_viewable],5 - mov eax,[NumInputDevices] - mov [GUIJT_entries],eax - mov [GUIJT_offset],ebx - mov eax,GUIcurrentinputviewloc - mov [GUIJT_currentviewloc],eax - mov eax,GUIcurrentinputcursloc - mov [GUIJT_currentcursloc],eax - call GUIGenericJumpTo - popad -.notfreshinput - mov al,bl - mov ebx,eax - shl eax,4 - add eax,ebx - add eax,GUIInputNames - mov [GUITemp],eax - GUIDisplayTextY 3,6+54,83,[GUITemp] ; CDV - GUIDisplayTextY 3,6,83,GUIInputTextA1 - - GUIDisplayTextY 3,6,94,GUIInputTextB - GUIDisplayText 3,6,104,GUIInputTextB1 - GUIDisplayText 3,6,114,GUIInputTextB2 - GUIDisplayText 3,6,124,GUIInputTextB3 - GUIDisplayText 3,6,134,GUIInputTextB4 - GUIDisplayText 3,6,144,GUIInputTextB5 - GUIDisplayText 3,6,154,GUIInputTextB6 - - GUIDisplayText 3,76,104,GUIInputTextC1 - GUIDisplayText 3,76,114,GUIInputTextC2 - GUIDisplayText 3,76,124,GUIInputTextC3 - GUIDisplayText 3,76,134,GUIInputTextC4 - GUIDisplayText 3,76,144,GUIInputTextC5 - GUIDisplayText 3,76,154,GUIInputTextC6 - - GUIDisplayTextY 3,116,94,GUIInputTextC - GUIDisplayText 3,156,104,GUIInputTextC1 - GUIDisplayText 3,156,114,GUIInputTextC2 - GUIDisplayText 3,156,124,GUIInputTextC6 - GUIDisplayText 3,116,104,GUIInputTextC3 - GUIDisplayText 3,116,114,GUIInputTextC4 - GUIDisplayText 3,116,124,GUIInputTextC5 - - GUIDisplayTextY 3,113,134,GUIInputTextD - GUIDisplayText 3,153,144,GUIInputTextD1 - GUIDisplayText 3,153,154,GUIInputTextD2 - GUIDisplayText 3,113,144,GUIInputTextD3 - GUIDisplayText 3,113,154,GUIInputTextD4 - -%ifdef __MSDOS__ - GUIDisplayCheckboxu 3,105,160,SidewinderFix,GUIInputTextE4,0 - - cmp byte[cplayernum],0 - jne .notp1 - GUIDisplayCheckboxu 3,5,190,pl1p209,GUIInputTextE5,4 -.notp1 - cmp byte[cplayernum],1 - jne .notp2 - GUIDisplayCheckboxu 3,5,190,pl2p209,GUIInputTextE5,4 -.notp2 - cmp byte[cplayernum],2 - jne .notp3 - GUIDisplayCheckboxu 3,5,190,pl3p209,GUIInputTextE5,4 -.notp3 - cmp byte[cplayernum],3 - jne .notp4 - GUIDisplayCheckboxu 3,5,190,pl4p209,GUIInputTextE5,4 -.notp4 - cmp byte[cplayernum],4 - jne .notp5 - GUIDisplayCheckboxu 3,5,190,pl5p209,GUIInputTextE5,4 -.notp5 -%endif - - GUIDisplayCheckboxu 3,5,160,GameSpecificInput,GUIInputTextE6,0 - GUIDisplayCheckboxu 3,5,170,AllowUDLR,GUIInputTextE7,0 - GUIDisplayCheckboxu 3,105,170,Turbo30hz,GUIInputTextE8,0 - GUIDisplayCheckboxu 3,5,180,pl12s34,GUIInputTextE9,0 - - DrawGUIButton 3,123,34,153,45,GUIInputTextE1,14,0,0 ; Buttons - DrawGUIButton 3,123,50,177,61,GUIInputTextE2,40,0,0 -%ifdef __MSDOS__ - DrawGUIButton 3,123,66,183,77,GUIInputTextE3,15,0,0 -%endif - - GUIDisplayBBoxS 3,5,34,107,77,167 ; Main Box - mov ebx,[GUIcurrentinputcursloc] - sub ebx,[GUIcurrentinputviewloc] - mov eax,ebx - lea ebx,[ebx*8] - add ebx,36 - DrawGUIWinBox2 3,5,107,7,224 - - mov eax,[GUIcurrentinputviewloc] ; Text&Shadow inside Main Box - shl eax,4 - add eax,[GUIcurrentinputviewloc] - add eax,GUIInputNames - mov [GUITemp],eax - GUIDisplayTextG 3,11,38,[GUITemp] - add dword[GUITemp],17 - GUIDisplayTextG 3,11,38+8,[GUITemp] - add dword[GUITemp],17 - GUIDisplayTextG 3,11,38+8*2,[GUITemp] - add dword[GUITemp],17 - GUIDisplayTextG 3,11,38+8*3,[GUITemp] - add dword[GUITemp],17 - GUIDisplayTextG 3,11,38+8*4,[GUITemp] - - ; Sidebar - DrawSlideBarWin 3,109,42,[GUIcurrentinputviewloc],[NumInputDevices],5,28,GUIIStA - cmp byte[GUICHold],9 - jne .noholda - add byte[GUIWincoladd],3 -.noholda - GUIDisplayIconWin 3,109,34,GUIIconDataUpArrow - cmp byte[GUICHold],9 - jne .noholda2 - sub byte[GUIWincoladd],3 -.noholda2 - cmp byte[GUICHold],10 - jne .noholdb - add byte[GUIWincoladd],3 -.noholdb - GUIDisplayIconWin 3,109,70,GUIIconDataDownArrow - cmp byte[GUICHold],10 - jne .noholdb2 - sub byte[GUIWincoladd],3 -.noholdb2 - - ; Hotkey Boxes - cmp byte[cplayernum],0 - jne near .notpl1 - GUIInputDispAll pl1 -.notpl1 - cmp byte[cplayernum],1 - jne near .notpl2 - GUIInputDispAll pl2 -.notpl2 - cmp byte[cplayernum],2 - jne near .notpl3 - GUIInputDispAll pl3 -.notpl3 - cmp byte[cplayernum],3 - jne near .notpl4 - GUIInputDispAll pl4 -.notpl4 - cmp byte[cplayernum],4 - jne near .notpl5 - GUIInputDispAll pl5 -.notpl5 - - DGOptnsBorderBox 3,44,101 ; Box borders, keep them at bottom - DGOptnsBorderBox 3,44,111 - DGOptnsBorderBox 3,44,121 - DGOptnsBorderBox 3,44,131 - DGOptnsBorderBox 3,44,141 - DGOptnsBorderBox 3,44,151 - DGOptnsBorderBox 3,84,101 - DGOptnsBorderBox 3,84,111 - DGOptnsBorderBox 3,84,121 - DGOptnsBorderBox 3,84,131 - DGOptnsBorderBox 3,84,141 - DGOptnsBorderBox 3,84,151 - DGOptnsBorderBox 3,124,101 - DGOptnsBorderBox 3,124,111 - DGOptnsBorderBox 3,124,121 - DGOptnsBorderBox 3,124,141 - DGOptnsBorderBox 3,124,151 - DGOptnsBorderBox 3,164,101 - DGOptnsBorderBox 3,164,111 - DGOptnsBorderBox 3,164,121 - DGOptnsBorderBox 3,164,141 - DGOptnsBorderBox 3,164,151 - ret - -SECTION .data -GUIInputTabs dd 1,5 - db '#1',0 - db '#2',0 - db '#3',0 - db '#4',0 - db '#5',0 - -GUIInputRefP dd pl1contrl,pl2contrl,pl3contrl,pl4contrl,pl5contrl - -GUIInputTextA db 'DEVICE:',0 -GUIInputTextA1 db 'CURRENT:',0 - -GUIInputTextB db 'KEYS:',0 -GUIInputTextB1 db ' UP',0 -GUIInputTextB2 db ' DOWN',0 -GUIInputTextB3 db ' LEFT',0 -GUIInputTextB4 db ' RIGHT',0 -GUIInputTextB5 db ' START',0 -GUIInputTextB6 db 'SELECT',0 - -GUIInputTextC db 'TURBO:',0 -GUIInputTextC1 db 'A',0 -GUIInputTextC2 db 'B',0 -GUIInputTextC3 db 'X',0 -GUIInputTextC4 db 'Y',0 -GUIInputTextC5 db 'L',0 -GUIInputTextC6 db 'R',0 - -GUIInputTextD db 'DIAGONALS:',0 -GUIInputTextD1 db 'UL',0 -GUIInputTextD2 db 'UR',0 -GUIInputTextD3 db 'DL',0 -GUIInputTextD4 db 'DR',0 - -GUIInputTextE dd 0 -GUIInputTextE1 db 'SET',0 -GUIInputTextE2 db 'SET KEYS',0 -%ifdef __MSDOS__ -GUIInputTextE3 db 'CALIBRATE',0 -GUIInputTextE4 db 'SIDEWINDER FIX',0 -GUIInputTextE5 db 'USE JOYSTICK PORT 209H',0 -%endif -GUIInputTextE6 db 'GAME SPECIFIC',0 -GUIInputTextE7 db 'ALLOW U+D/L+R',0 -GUIInputTextE8 db 'TURBO AT 30HZ',0 -GUIInputTextE9 db 'USE PL3/4 AS PL1/2',0 - -GUIFreshInputSelect db 1 - -SECTION .bss -GUIIStA resd 3 -GUIcurrentinputviewloc resd 1 -GUIcurrentinputcursloc resd 1 - -SECTION .text - -DisplayGUIOption: ; Emu Options - GUIDrawWindowBox 4,GUIOptionDisp - -%ifndef __WIN32__ - cmp byte[ShowMMXSupport],1 - jne near .nommx -%endif - GUIDisplayTextY 4,11,13,GUIOptionTextA - cmp byte[ShowMMXSupport],1 - jne near .nommx - GUIDisplayCheckboxu 4,11,18,MMXSupport,GUIOptionTextA1,7 -.nommx -%ifdef __WIN32__ - GUIDisplayCheckboxu 4,11,28,PauseFocusChange,GUIOptionTextA2,13 - GUIDisplayCheckboxu 4,11,38,HighPriority,GUIOptionTextA3,16 - GUIDisplayCheckboxu 4,11,48,DisableScreenSaver,GUIOptionTextA4,0 -%endif - - GUIDisplayTextY 4,11,63,GUIOptionTextB - GUIDisplayCheckboxu 4,11,68,newengen,GUIOptionTextB1,4 - cmp byte[newengen],0 - jne near .newengen - GUIDisplayCheckboxu 4,11,78,bgfixer,GUIOptionTextB2,4 -.newengen - - GUIDisplayTextY 4,140,63,GUIOptionTextF - GUIDisplayButtonHoleTu 4,143,70,byte[ScreenShotFormat],0,GUIOptionTextF1,2 -%ifndef NO_PNG - GUIDisplayButtonHoleTu 4,143,80,byte[ScreenShotFormat],1,GUIOptionTextF2,2 -%endif - - GUIDisplayTextY 4,11,93,GUIOptionTextC - GUIDisplayCheckboxu 4,11,98,AutoPatch,GUIOptionTextC1,7 - GUIDisplayCheckboxu 4,11,108,DisplayInfo,GUIOptionTextC2,3 - GUIDisplayCheckboxu 4,11,118,RomInfo,GUIOptionTextC3,4 - - GUIDisplayTextY 4,11,133,GUIOptionTextD - GUIDisplayCheckboxu 4,11,138,FPSAtStart,GUIOptionTextD1,5 - GUIDisplayCheckboxu 4,11,148,TimerEnable,GUIOptionTextD2,5 - cmp byte[TimerEnable],1 - jne near .noclock - GUIDisplayCheckboxu 4,89,148,TwelveHourClock,GUIOptionTextD3,0 - GUIDisplayCheckboxu 4,11,158,ClockBox,GUIOptionTextD4,13 -.noclock - - GUIDisplayTextY 4,11,173,GUIOptionTextE - GUIDisplayCheckboxu 4,11,178,SmallMsgText,GUIOptionTextE1,4 - GUIDisplayCheckboxu 4,11,188,GUIEnableTransp,GUIOptionTextE2,4 - ret - -SECTION .data -GUIOptionTextA db 'SYSTEM:',0 -GUIOptionTextA1 db 'ENABLE MMX SUPPORT',0 -%ifdef __WIN32__ -GUIOptionTextA2 db 'PAUSE EMU IN BACKGROUND',0 -GUIOptionTextA3 db 'INCREASE EMU PRIORITY',0 -GUIOptionTextA4 db 'DISABLE POWER MANAGEMENT',0 -%endif -NEWSYM ShowMMXSupport, db 2 - -GUIOptionTextB db 'GFX ENGINES:',0 -GUIOptionTextB1 db 'USE NEW GFX ENG',0 -GUIOptionTextB2 db 'USE ALT OLD GFX ENG',0 - -GUIOptionTextC db 'ROM:',0 -GUIOptionTextC1 db 'ENABLE IPS AUTO-PATCHING',0 -GUIOptionTextC2 db 'SHOW ROM INFO ON LOAD',0 -GUIOptionTextC3 db 'LOG ROM INFO',0 - -GUIOptionTextD db 'OVERLAYS:',0 -GUIOptionTextD1 db 'SHOW FPS CNTR ON EMU LOAD',0 -GUIOptionTextD2 db 'SHOW CLOCK',0 -GUIOptionTextD3 db '12 HOUR MODE',0 -GUIOptionTextD4 db 'SHOW CLOCK BOX',0 - -GUIOptionTextE db 'MESSAGES:',0 -GUIOptionTextE1 db 'USE SMALL MESSAGE TEXT',0 -GUIOptionTextE2 db 'USE TRANSPARENT TEXT',0 - -GUIOptionTextF db 'SSHOTS:',0 -GUIOptionTextF1 db 'BMP',0 -%ifndef NO_PNG -GUIOptionTextF2 db 'PNG',0 -%endif - -SECTION .text - -%macro NTSCslidSet 1 ; slider variable - mov al,[%1] - add al,100 -%endmacro - -%macro NTSCslidText 2 ; slider var, text - mov dword[%2],' ' - mov esi,%2+3 - mov al,[%1] - mov bl,10 - test al,128 - jz %%asciilp - xor al,255 - inc al -%%asciilp ; turns decimal into ascii - xor ah,ah - div bl - add ah,48 - mov [esi],ah - dec esi - cmp al,0 - jne %%asciilp - test byte[%1],128 - jz %%pos - mov byte[esi],'-' -%%pos - mov esi,%2 -%endmacro - -DisplayGUIVideo: - cmp byte[TripBufAvail],0 ; Check features - jne .notexttb -%ifdef __MSDOS__ - mov byte[Triplebufen],0 -%endif -.notexttb - cmp byte[MMXSupport],1 - jne .2xSaIdis - cmp byte[newgfx16b],0 - je .2xSaIdis - jmp .no2xSaIdis -.2xSaIdis - mov byte[En2xSaI],0 - mov byte[hqFilter],0 -.no2xSaIdis - cmp byte[En2xSaI],0 - je .no2xsaien -%ifdef __MSDOS__ - mov byte[Triplebufen],0 -%endif - mov byte[hqFilter],0 - mov byte[scanlines],0 - mov byte[antienab],0 -.no2xsaien - cmp byte[hqFilter],0 - je .nohqen - mov byte[En2xSaI],0 - mov byte[scanlines],0 - mov byte[antienab],0 -.nohqen - - GUIDrawWindowBox 5,GUIVideoDisp - - xor eax,eax - mov al,[cvidmode] - cmp byte[GUINTVID+eax],0 - jne .ntsc - mov byte[NTSCFilter],0 - mov dword[GUIVntscTab],0 - cmp byte[GUIVideoTabs],0 - jne .ntsc - mov byte[GUIVideoTabs],1 -.ntsc - GUIDrawTArea 5 - GUIDrawTabs GUIVideoTabs - cmp byte[NTSCFilter],0 - je near .nontsc - GUIDrawTabs GUIVntscTab -.nontsc - - cmp dword[GUIVideoTabs],1 ; Video Modes List/Options Tab - jne near .notmodestab - DrawGUIButton 5,128,30,164,41,GUIVideoTextA4,4,0,0 ; Mode Set Button - -%ifndef __MSDOS__ ; Legend - GUIDisplayTextY 5,130,50,GUIVideoTextA1 - GUIDisplayText 5,130,58,GUIVideoTextA1a - GUIDisplayText 5,130,66,GUIVideoTextA1b - GUIDisplayText 5,130,74,GUIVideoTextA1c - GUIDisplayText 5,130,82,GUIVideoTextA1d - GUIDisplayText 5,130,90,GUIVideoTextA1e -%ifdef __OPENGL__ - GUIDisplayText 5,130,98,GUIVideoTextA1f -%endif - - DrawGUIButton 5,180,115,216,126,GUIVideoTextA4,12,0,0 ; Custom Set Button - - GUIDisplayText 5,130,120,GUIVideoTextA2 - GUIDisplayText 5,180,135,GUIVideoTextA2a - GUIDisplayBBox 5,130,130,170,140,167 - GUIDisplayBBox 5,191,130,231,140,167 - - pushad - call GetCustomXY - popad - - GUIOuttextwin2d 5,138,133,GUICustomX,4 - GUIOuttextwin2d 5,199,133,GUICustomY,4 -%endif - - GUIDisplayBBoxS 5,5,26,115,189,167 ; Video Modes Box - DrawSlideBarWin 5,117,34,[GUIcurrentvideoviewloc],[NumVideoModes],20,148,GUIVStA - cmp byte[GUICHold],5 ; Scrollbar - jne .noholda - add byte[GUIWincoladd],3 -.noholda - GUIDisplayIconWin 5,117,26,GUIIconDataUpArrow - cmp byte[GUICHold],5 - jne .noholdb - sub byte[GUIWincoladd],3 -.noholdb - cmp byte[GUICHold],6 - jne .noholdc - add byte[GUIWincoladd],3 -.noholdc - GUIDisplayIconWin 5,117,182,GUIIconDataDownArrow - cmp byte[GUICHold],6 - jne .noholdd - sub byte[GUIWincoladd],3 -.noholdd - - mov ebx,[GUIcurrentvideocursloc] ; Box - sub ebx,[GUIcurrentvideoviewloc] - lea ebx,[ebx*8] - add ebx,28 - DrawGUIWinBox2 5,5,115,7,224 - - mov byte[GUItextcolor],223 ; Text in Box - mov eax,[GUIcurrentvideoviewloc] - mov ebx,eax - shl eax,4 - add eax,ebx - add eax,ebx - add eax,GUIVideoModeNames - mov [GUITemp],eax - GUIDisplayTextG 5,11,30,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*2,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*3,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*4,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*5,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*6,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*7,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*8,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*9,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*10,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*11,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*12,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*13,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*14,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*15,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*16,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*17,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*18,[GUITemp] - add dword[GUITemp],18 - GUIDisplayTextG 5,11,30+8*19,[GUITemp] - - xor eax,eax ; Mode Value - mov al,[cvidmode] - mov ebx,eax - shl eax,4 - add eax,ebx - add eax,ebx - add eax,GUIVideoModeNames - mov [GUITemp],eax - GUIDisplayTextY 5,7,194,GUIVideoTextA3 - GUIDisplayTextY 5,91,194,[GUITemp] ; (5,61,194) -.notmodestab - ; Filters tab - cmp dword[GUIVideoTabs],2 - jne near .notfilterstab - - ; Video Filters -%ifdef __MSDOS__ - cmp byte[smallscreenon],1 - je .nocheckboxw - cmp byte[ScreenScale],1 - je .notexthq4xa -%endif - xor eax,eax ; Interpolations - mov al,[cvidmode] -%ifdef __WIN32__ - cmp byte[GUIDSIZE+eax],0 -%else - cmp byte[GUII2VID+eax],0 -%endif - je near .notext3 - GUIDisplayTextY 5,13,30,GUIVideoTextB1 - GUIDisplayCheckboxu 5,18,35,antienab,GUIVideoTextB1a,0 -.notext3 -%ifdef __MSDOS__ ; Eagle Filter - xor eax,eax - mov al,[cvidmode] - cmp byte[GUIEAVID+eax],0 - je near .notext4 - GUIDisplayTextY 5,13,30,GUIVideoTextB1 - GUIDisplayCheckboxu 5,18,35,antienab,GUIVideoTextB1b,9 -.notext4 -%endif -%ifdef __OPENGL__ - xor eax,eax ; Bilinear - mov al,[cvidmode] - cmp byte[GUIBIFIL+eax],0 - je near .nocheckboxe - GUIDisplayTextY 5,13,30,GUIVideoTextB1 - GUIDisplayCheckboxu 5,18,35,BilinearFilter,GUIVideoTextB1c,1 -.nocheckboxe -%endif - - xor eax,eax ; NTSC filter - mov al,[cvidmode] - cmp byte[GUINTVID+eax],0 - je near .nocheckboxbf - GUIDisplayCheckboxu 5,128,35,NTSCFilter,GUIVideoTextB1d,0 -.nocheckboxbf - - cmp byte[MMXSupport],0 - je near .nocheckboxx - xor eax,eax ; Kreed 2x filters - mov al,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUI2xVID+eax],0 -%else - cmp byte[GUIDSIZE+eax],0 -%endif - je near .nocheckboxx - GUIDisplayCheckboxun 5,18,45,En2xSaI,1,GUIVideoTextB1e,2 ;2x - GUIDisplayCheckboxun 5,128,45,En2xSaI,2,GUIVideoTextB1f,6 ;Seagle - GUIDisplayCheckboxun 5,18,55,En2xSaI,3,GUIVideoTextB1g,2 ;S2x -.nocheckboxx - - cmp byte[MMXSupport],0 - je near .notexthq4xa - xor eax,eax ; Hq*x - mov al,[cvidmode] - cmp byte[GUIHQ2X+eax],0 - je near .notexthq2xa -%ifdef __MSDOS__ - GUIDisplayCheckboxu 5,128,55,hqFilter,GUIVideoTextB1h,1 -%else - GUIDisplayCheckboxu 5,128,55,hqFilter,GUIVideoTextB1i,1 - cmp byte[hqFilter],0 - je near .notexthq4xa - GUIDisplayButtonHoleTu 5,128,68,byte[hqFilterlevel],2,GUIVideoTextB1j,1 - jmp .notexthq2xa -%endif - jmp .notexthq4xa -.notexthq2xa -%ifndef __MSDOS__ - xor eax,eax - mov al,[cvidmode] - cmp byte[GUIHQ3X+eax],0 - je near .notexthq3xa - GUIDisplayButtonHoleTu 5,158,68,byte[hqFilterlevel],3,GUIVideoTextB1k,0 -.notexthq3xa - xor eax,eax - mov al,[cvidmode] - cmp byte[GUIHQ4X+eax],0 - je near .notexthq4xa - GUIDisplayButtonHoleTu 5,188,68,byte[hqFilterlevel],4,GUIVideoTextB1l,0 -%endif -.notexthq4xa - - xor eax,eax ; Scanlines - mov al,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUISLVID+eax],0 -%else - cmp byte[GUIDSIZE+eax],0 -%endif - je near .nocheckboxb - GUIDisplayTextY 5,13,80,GUIVideoTextB2 ; Scanlines text - GUIDisplayButtonHoleTu 5,18,87,byte[scanlines],0,GUIVideoTextB2a,1 ; None - GUIDisplayButtonHoleTu 5,168,87,byte[scanlines],1,GUIVideoTextB2d,0 ; Full -.nocheckboxb -%ifdef __MSDOS__ - cmp byte[ScreenScale],1 - je .nocheckboxw -%endif - xor eax,eax - mov al,[cvidmode] -%ifdef __MSDOS__ - cmp byte[GUIHSVID+eax],0 -%else - cmp byte[GUIDSIZE+eax],0 -%endif - je near .nocheckboxw - GUIDisplayButtonHoleTu 5,68,87,byte[scanlines],2,GUIVideoTextB2b,0 ; 25% - GUIDisplayButtonHoleTu 5,118,87,byte[scanlines],3,GUIVideoTextB2c,0 ; 50% -.nocheckboxw - - GUIDisplayTextY 5,13,110,GUIVideoTextB3 ; Misc Filters - GUIDisplayCheckboxu 5,18,115,GrayscaleMode,GUIVideoTextB3a,0 ; Grayscale - - xor eax,eax ; Hires Mode7 - mov al,[cvidmode] - cmp byte[GUIM7VID+eax],0 - je near .nocheckboxm72 - cmp byte[newengen],0 - je near .nocheckboxm72 - GUIDisplayCheckboxu 5,128,115,Mode7HiRes16b,GUIVideoTextB3b,0 -.nocheckboxm72 - ; Monitor Refresh -%ifndef __UNIXSDL__ ; VSync - GUIDisplayTextY 5,13,140,GUIVideoTextB4 - GUIDisplayCheckboxu 5,18,145,vsyncon,GUIVideoTextB4a,0 -%endif - -%ifdef __WIN32__ - xor eax,eax ; Triple Buffering - mov al,[cvidmode] - cmp byte[GUIWFVID+eax],0 - je near .nocheckboxslw2 - GUIDisplayCheckboxu 5,128,145,TripleBufferWin,GUIVideoTextB4b,0 -.nocheckboxslw2 -%endif -%ifdef __MSDOS__ - xor eax,eax - mov al,[cvidmode] - cmp byte[GUITBVID+eax],0 - je near .nocheckboxtbb - cmp byte[TripBufAvail],0 - je near .nocheckboxtbb - GUIDisplayCheckboxu 5,128,145,Triplebufen,GUIVideoTextB4b,0 -.nocheckboxtbb -%endif - -%ifndef __MSDOS__ - xor eax,eax ; Keep 4:3 Ratio - mov al,[cvidmode] - cmp byte[GUIKEEP43+eax],0 - je near .nocheckboxk43 - pushad - call Keep43Check - popad - cmp byte[ShowKeep43],0 - je near .nocheckboxk43 - GUIDisplayTextY 5,13,170,GUIVideoTextB5 - GUIDisplayCheckboxu 5,18,175,Keep4_3Ratio,GUIVideoTextB5a,8 -.nocheckboxk43 -%endif - -%ifdef __MSDOS__ - xor eax,eax ; Small Screen - mov al,[cvidmode] - cmp byte[GUISSVID+eax],0 - je near .nocheckbox3b - GUIDisplayTextY 5,13,170,GUIVideoTextB5 - GUIDisplayCheckboxu 5,18,175,smallscreenon,GUIVideoTextB5b,1 -.nocheckbox3b - - xor eax,eax ; Full/Widescreen - mov al,[cvidmode] - cmp byte[GUIFSVID+eax],0 - je near .notext5 - cmp byte[GUIWSVID+eax],0 - jne near .notext4a - GUIDisplayTextY 5,13,170,GUIVideoTextB5 - GUIDisplayCheckboxu 5,128,175,ScreenScale,GUIVideoTextB5c,6 - jmp .notext5 -.notext4a - GUIDisplayTextY 5,13,170,GUIVideoTextB5 - GUIDisplayCheckboxu 5,128,175,ScreenScale,GUIVideoTextB5d,6 -.notext5 -%endif - -.notfilterstab - - cmp dword[GUIVntscTab],1 ; NTSC Tab - jne near .notntsctab - - GUIDisplayCheckboxu 5,5,25,NTSCBlend,GUIVideoTextC1a,0 - GUIDisplayCheckboxu 5,135,25,NTSCRef,GUIVideoTextC1b,0 - - DrawGUIButton 5,8,166,67,177,GUIVideoTextC3a,81,0,0 - DrawGUIButton 5,72,166,119,177,GUIVideoTextC3b,82,0,0 - DrawGUIButton 5,124,166,147,177,GUIVideoTextC3c,83,0,0 - DrawGUIButton 5,152,166,217,177,GUIVideoTextC3d,84,0,0 - DrawGUIButton 5,102,186,137,197,GUIVideoTextCD1,37,0,0 - DrawGUIButton 5,148,186,207,197,GUIVideoTextCD2,39,0,0 - - GUIDisplayTextY 5,7,46,GUIVideoTextC2a - GUIDisplayTextY 5,7,66,GUIVideoTextC2b - GUIDisplayTextY 5,7,86,GUIVideoTextC2c - GUIDisplayTextY 5,7,106,GUIVideoTextC2d - GUIDisplayTextY 5,7,126,GUIVideoTextC2e - GUIDisplayTextY 5,7,156,GUIVideoTextC3 - - GUIDrawSlider 5,8,200,56,NTSCHue,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - GUIDrawSlider 5,8,200,76,NTSCSat,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - GUIDrawSlider 5,8,200,96,NTSCCont,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - GUIDrawSlider 5,8,200,116,NTSCBright,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - GUIDrawSlider 5,8,200,136,NTSCSharp,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - -.notntsctab - - cmp dword[GUIVntscTab],2 ; Advanced NTSC Options Tab - jne near .notadvntsctab - - DrawGUIButton 5,102,186,137,197,GUIVideoTextCD1,38,0,0 - DrawGUIButton 5,148,186,207,197,GUIVideoTextCD2,39,0,0 - - GUIDisplayTextY 5,7,36,GUIVideoTextD1a - GUIDisplayTextY 5,7,56,GUIVideoTextD1b - GUIDisplayTextY 5,7,76,GUIVideoTextD1c - GUIDisplayTextY 5,7,96,GUIVideoTextD1d - GUIDisplayTextY 5,7,116,GUIVideoTextD1e - GUIDisplayTextY 5,7,136,GUIVideoTextD1f - - GUIDrawSlider 5,8,200,46,NTSCGamma,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - GUIDrawSlider 5,8,200,66,NTSCRes,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - GUIDrawSlider 5,8,200,86,NTSCArt,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - GUIDrawSlider 5,8,200,106,NTSCFringe,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - GUIDrawSlider 5,8,200,126,NTSCBleed,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - GUIDrawSlider 5,8,200,146,NTSCWarp,GUIVideoTextCD3,NTSCslidSet,NTSCslidText - -.notadvntsctab - ret - -SECTION .data -GUIVideoTabs dd 1,2 - db 'MODES',0 - db 'FILTERS',0 -GUIVntscTab dd 0,2 - db 'NTSC',0 - db 'ADV NTSC',0 - -%ifndef __MSDOS__ ; Modes Tab -GUIVideoTextA1 db 'LEGEND:',0 -GUIVideoTextA1a db 'D = ALLOW FILTERS',0 -GUIVideoTextA1b db 'S = STRETCH',0 -GUIVideoTextA1c db 'R = KEEP 8:7 RATIO',0 -GUIVideoTextA1d db 'W = WINDOWED',0 -GUIVideoTextA1e db 'F = FULLSCREEN',0 -%ifdef __OPENGL__ -GUIVideoTextA1f db 'O = USES OPENGL',0 -%endif - -GUIVideoTextA2 db 'CUSTOM:',0 -GUIVideoTextA2a db 'X',0 -%endif - -GUIVideoTextA3 db 'CURRENT:',0 -GUIVideoTextA4 db 'SET',0 ; set button - -GUIVideoTextB1 db 'VIDEO FILTERS:',0 ; Filters.Exclusive -GUIVideoTextB1a db 'INTERPOLATION',0 ; -y -%ifdef __MSDOS__ -GUIVideoTextB1b db 'EAGLE ENGINE',0 ; same loc at interpolation -y -%endif -%ifdef __OPENGL__ -GUIVideoTextB1c db 'BILINEAR FILTER',0 -%endif -GUIVideoTextB1d db 'NTSC FILTER',0 -GUIVideoTextB1e db '2XSAI ENGINE',0 -GUIVideoTextB1f db 'SUPER EAGLE',0 -GUIVideoTextB1g db 'SUPER 2XSAI',0 - -%ifdef __MSDOS__ -GUIVideoTextB1h db 'HQ2X',0 -%else -GUIVideoTextB1i db 'HQ FILTER',0 -GUIVideoTextB1j db '2X',0 -GUIVideoTextB1k db '3X',0 -GUIVideoTextB1l db '4X',0 -%endif - -GUIVideoTextB2 db 'SCANLINES:',0 ; Filters.Scanlines -GUIVideoTextB2a db 'NONE',0 -GUIVideoTextB2b db '25%',0 -GUIVideoTextB2c db '50%',0 -GUIVideoTextB2d db 'FULL',0 - -GUIVideoTextB3 db 'MISC FILTERS:',0 ; Filters.Other -GUIVideoTextB3a db 'GRAYSCALE MODE',0 ; -v8 -GUIVideoTextB3b db 'HI-RES MODE 7',0 ; - -%ifndef __UNIXSDL__ -GUIVideoTextB4 db 'MONITOR SYNC:',0 ; Video.Sync -GUIVideoTextB4a db 'VSYNC',0 ; -w -GUIVideoTextB4b db 'TRIPLE BUFFERING',0 ; -3 -%endif - -GUIVideoTextB5 db 'DISPLAY OPTIONS:',0 ; Video.Display -%ifndef __MSDOS__ -GUIVideoTextB5a db 'USE 4:3 RATIO',0 -NEWSYM ShowKeep43, db 0 -%else -GUIVideoTextB5b db 'SMALL SCREEN',0 ; -c -GUIVideoTextB5c db 'FULL SCREEN',0 ; -cc -GUIVideoTextB5d db 'WIDE SCREEN',0 ; -cc -%endif - -GUIVideoTextC1a db 'BLEND FRAMES',0 ; NTSC Tab -GUIVideoTextC1b db 'REFRESH',0 - -GUIVideoTextC2a db 'HUE:',0 -GUIVideoTextC2b db 'SATURATION:',0 -GUIVideoTextC2c db 'CONTRAST:',0 -GUIVideoTextC2d db 'BRIGHTNESS:',0 -GUIVideoTextC2e db 'SHARPNESS:',0 - -GUIVideoTextC3 db 'PRESETS:',0 ; NTSC Presets -GUIVideoTextC3a db 'COMPOSITE',0 -GUIVideoTextC3b db 'S-VIDEO',0 -GUIVideoTextC3c db 'RGB',0 -GUIVideoTextC3d db 'MONOCHROME',0 - -GUIVideoTextD1a db 'GAMMA:',0 ; NTSC Adv Tab -GUIVideoTextD1b db 'RESOLUTION:',0 -GUIVideoTextD1c db 'ARTIFACTS:',0 -GUIVideoTextD1d db 'FRINGING:',0 -GUIVideoTextD1e db 'BLEED:',0 -GUIVideoTextD1f db 'HUE WARPING:',0 - -GUIVideoTextCD1 db 'RESET',0 ; NTSC buttons + counter -GUIVideoTextCD2 db 'RESET ALL',0 -GUIVideoTextCD3 db '----%',0 - -SECTION .bss -GUIVStA resd 3 -GUIcurrentvideoviewloc resd 1 -GUIcurrentvideocursloc resd 1 - -SECTION .text - -%macro VolslidSet 1 ; slider variable - mov al,[%1] -%endmacro - -%macro VolslidText 2 ; slider var, text - mov word[%2],' ' - mov esi,%2+3 - mov al,[%1] - mov bl,10 -%%asciilp ; turns decimal into ascii - dec esi - xor ah,ah - div bl - add ah,48 - mov [esi],ah - cmp al,0 - jne %%asciilp - mov esi,%2 -%endmacro - -DisplayGUISound: ; Sound Related Options - GUIDrawWindowBox 6,GUISoundDisp - - GUIDisplayTextY 6,6,16,GUISoundTextA - GUIDisplayCheckboxu 6,11,21,SPCDisable,GUISoundTextA1,0 - cmp byte[SPCDisable],0 - jne near .nosound - GUIDisplayCheckboxu 6,11,31,soundon,GUISoundTextA2,0 - cmp byte[soundon],1 - jne near .nosound - GUIDisplayCheckboxu 6,11,41,StereoSound,GUISoundTextA3,7 - cmp byte[StereoSound],1 - jne near .nostereo - GUIDisplayCheckboxu 6,11,51,RevStereo,GUISoundTextA4,2 - GUIDisplayCheckboxu 6,11,61,Surround,GUISoundTextA5,2 -.nostereo -%ifdef __MSDOS__ - GUIDisplayCheckboxu 6,11,71,Force8b,GUISoundTextA6,0 -%endif -%ifdef __WIN32__ - GUIDisplayCheckboxu 6,11,71,PrimaryBuffer,GUISoundTextA7,4 -%endif -.nosound - - GUIDisplayTextY 6,6,152,GUISoundTextD - GUIDisplayButtonHoleTu 6,11,157,byte[SoundInterpType],0,GUISoundTextF,0 - GUIDisplayButtonHoleTu 6,11,167,byte[SoundInterpType],1,GUISoundTextD1,0 - GUIDisplayButtonHoleTu 6,11,177,byte[SoundInterpType],2,GUISoundTextD2,0 - cmp byte[MMXSupport],0 - je near .no8ptinterp - GUIDisplayButtonHoleTu 6,11,187,byte[SoundInterpType],3,GUISoundTextD3,0 -.no8ptinterp - - GUIDisplayTextY 6,106,152,GUISoundTextE - GUIDisplayButtonHoleTu 6,111,157,byte[LowPassFilterType],0,GUISoundTextF,1 - GUIDisplayButtonHoleTu 6,111,167,byte[LowPassFilterType],1,GUISoundTextE1,1 - GUIDisplayButtonHoleTu 6,111,177,byte[LowPassFilterType],2,GUISoundTextE2,1 - cmp byte[MMXSupport],0 - je near .nohiqualityfilter - GUIDisplayButtonHoleTu 6,111,187,byte[LowPassFilterType],3,GUISoundTextE3,0 -.nohiqualityfilter - -%ifdef __MSDOS__ - cmp byte[SoundQuality],2 - jbe .okay - cmp byte[SoundQuality],4 - je .okay - cmp byte[StereoSound],1 - jne .okay - cmp byte[SBHDMA],0 - jne .okay - cmp byte[vibracard], 1 - je .okay - GUIDisplayBBox 6,15,101,69,109,167 - GUIDisplayTextG 6,23,104,GUISoundTextB0 - jmp .nosrate -.okay -%endif - - GUIDisplayTextY 6,6,93,GUISoundTextB - GUIDisplayBBox 6,15,101,69,109,167 ;Sampling Rate Box - mov eax,[SoundQuality] - lea eax,[eax*8+GUISoundTextB1] - mov [GUITemp],eax - GUIDisplayTextG 6,23,104,[GUITemp] -.nosrate - - GUIDisplayTextY 6,6,116,GUISoundTextC - GUIDrawSlider 6,15,100,131,MusicRelVol,GUISoundTextC1,VolslidSet,VolslidText - ret - -SECTION .data -GUISoundTextA db 'SOUND SWITCHES:',0 -GUISoundTextA1 db 'DISABLE SPC EMULATION',0 -GUISoundTextA2 db 'ENABLE SOUND',0 -GUISoundTextA3 db 'ENABLE STEREO SOUND',0 -GUISoundTextA4 db 'REVERSE STEREO CHANNELS',0 -GUISoundTextA5 db 'SIMULATE SURROUND SOUND',0 -GUISoundTextA6 db 'FORCE 8-BIT OUTPUT',0 ; DOS Only -GUISoundTextA7 db 'USE PRIMARY BUFFER',0 ; Win Only - -GUISoundTextB db 'SAMPLING RATE:',0 -GUISoundTextB0 db 'N/A',0 -GUISoundTextB1 db ' 8000HZ',0 -GUISoundTextB2 db '11025HZ',0 -GUISoundTextB3 db '22050HZ',0 -GUISoundTextB4 db '44100HZ',0 -GUISoundTextB5 db '16000HZ',0 -GUISoundTextB6 db '32000HZ',0 -GUISoundTextB7 db '48000HZ',0 - -GUISoundTextC db 'VOLUME LEVEL:',0 -GUISoundTextC1 db '---%',0 - -GUISoundTextD db 'INTERPOLATION:',0 -GUISoundTextD1 db 'GAUSSIAN',0 -GUISoundTextD2 db 'CUBIC SPLINE',0 -GUISoundTextD3 db '8-POINT',0 - -GUISoundTextE db 'LOWPASS:',0 -GUISoundTextE1 db 'SIMPLE',0 -GUISoundTextE2 db 'DYNAMIC',0 -GUISoundTextE3 db 'HI QUALITY',0 - -GUISoundTextF db 'NONE',0 - -SECTION .text - -DisplayGUICheatConv: - mov eax,[ccheatnpos] - add eax,4 - xor ebx,ebx - mov ecx,3 - mov edx,GUICheatTextZ3 -.loop - mov bl,[eax] - and bl,0Fh - mov bl,[GUICheatTextZ4+ebx] - mov [edx+1],bl - mov bl,[eax] - and bl,0F0h - shr bl,4 - mov bl,[GUICheatTextZ4+ebx] - mov [edx],bl - add edx,2 - dec eax - dec ecx - jnz .loop - mov eax,[ccheatnpos] - inc eax - mov edx,GUICheatTextZ3+7 - mov bl,[eax] - and bl,0Fh - mov bl,[GUICheatTextZ4+ebx] - mov [edx+1],bl - mov bl,[eax] - and bl,0F0h - shr bl,4 - mov bl,[GUICheatTextZ4+ebx] - mov [edx],bl - mov eax,[ccheatnpos] - add eax,5 - mov edx,GUICheatTextZ3+10 - mov bl,[eax] - and bl,0Fh - mov bl,[GUICheatTextZ4+ebx] - mov [edx+1],bl - mov bl,[eax] - and bl,0F0h - shr bl,4 - mov bl,[GUICheatTextZ4+ebx] - mov [edx],bl - mov eax,[ccheatnpos] - test byte[eax-28],80h - jnz .src - test byte[eax],04h - jz .on - mov byte[GUICheatTextZ3+13],'O' - mov byte[GUICheatTextZ3+14],'F' - mov byte[GUICheatTextZ3+15],'F' - jmp .off -.on - test byte[eax],80h - jnz .repl - mov byte[GUICheatTextZ3+13],'O' - mov byte[GUICheatTextZ3+14],'N' - mov byte[GUICheatTextZ3+15],' ' - jmp .off -.repl - mov byte[GUICheatTextZ3+13],'R' - mov byte[GUICheatTextZ3+14],'P' - mov byte[GUICheatTextZ3+15],'L' - jmp .off -.src - mov byte[GUICheatTextZ3+13],'S' - mov byte[GUICheatTextZ3+14],'R' - mov byte[GUICheatTextZ3+15],'C' -.off - mov ecx,20 - add eax,8 - mov edx,GUICheatTextZ3+17 -.loop2 - mov bl,[eax] - mov [edx],bl - inc eax - inc edx - dec ecx - jnz .loop2 - ret - -%macro GUIOuttextwin2cheat 2 - test dword[ccheatnleft],80000000h - jnz near %%skip - call DisplayGUICheatConv - mov byte[GUItextcolor],223 - GUIOuttextwin2 7,%1,%2,GUICheatTextZ3 - mov byte[GUItextcolor],221 ;Text - cmp byte[GUIWincoladd],0 - je %%zero - mov byte[GUItextcolor],222 -%%zero - GUIOuttextwin2 7,%1-1,%2-1,GUICheatTextZ3 - add dword[ccheatnpos],28 - dec dword[ccheatnleft] -%%skip -%endmacro - -DisplayGUICheat: ; Add/Browse Cheats menu - GUIDrawWindowBox 7,GUICheatDisp - - GUIDisplayText 7,6,13,GUICheatTextA - GUIDisplayText 7,6,132,GUICheatTextC1 - GUIDisplayText 7,6,143,GUICheatTextC2 - GUIDisplayText 7,11,154,GUICheatTextD1 - GUIDisplayText 7,11,164,GUICheatTextD2 - GUIDisplayText 7,11,172,GUICheatTextD3 - GUIDisplayText 7,11,180,GUICheatTextD4 - - mov byte[GUItextcolor],217 - cmp byte[GUIWincoladd],0 - je .zero - mov byte[GUItextcolor],211 -.zero - DrawGUIButton 7,5,113,47,124,GUICheatTextB1,5,0,0 ; Draw Buttons - DrawGUIButton 7,52,113,94,124,GUICheatTextB2,6,0,0 - DrawGUIButton 7,99,113,141,124,GUICheatTextB3,7,0,0 - DrawGUIButton 7,146,113,188,124,GUICheatTextB4,8,0,0 - DrawGUIButton 7,193,113,235,124,GUICheatTextB5,33,0,0 - DrawGUIButton 7,212,134,236,145,GUICheatTextB6,9,0,0 - - GUIDisplayBBoxS 7,5,20,229,108,167 ; Draw Cheat Box - - cmp dword[GUIcurrentcheatwin],0 ; Red Highlight for Cheats box - jne near .nowinbox - mov ebx,[GUIcurrentcheatcursloc] - sub ebx,[GUIcurrentcheatviewloc] - mov eax,ebx - lea ebx,[ebx*8] - sub ebx,eax - add ebx,22 - DrawGUIWinBox2 7,5,229,7,224 -.nowinbox - - mov dword[ccheatnpos],cheatdata ; Green Text - mov eax,[NumCheats] - sub eax,[GUIcurrentcheatviewloc] - dec eax - mov [ccheatnleft],eax - mov eax,[GUIcurrentcheatviewloc] - mov ebx,eax - shl eax,5 - sub eax,ebx - sub eax,ebx - sub eax,ebx - sub eax,ebx - add [ccheatnpos],eax - GUIOuttextwin2cheat 12,24 - GUIOuttextwin2cheat 12,24+7 - GUIOuttextwin2cheat 12,24+7*2 - GUIOuttextwin2cheat 12,24+7*3 - GUIOuttextwin2cheat 12,24+7*4 - GUIOuttextwin2cheat 12,24+7*5 - GUIOuttextwin2cheat 12,24+7*6 - GUIOuttextwin2cheat 12,24+7*7 - GUIOuttextwin2cheat 12,24+7*8 - GUIOuttextwin2cheat 12,24+7*9 - GUIOuttextwin2cheat 12,24+7*10 - GUIOuttextwin2cheat 12,24+7*11 - -;Scrollbar - DrawSlideBarWin 7,231,28,[GUIcurrentcheatviewloc],[NumCheats],12,73,GUICStA - cmp byte[GUICHold],7 - jne .noholda - add byte[GUIWincoladd],3 -.noholda - GUIDisplayIconWin 7,231,20,GUIIconDataUpArrow - cmp byte[GUICHold],7 - jne .noholda2 - sub byte[GUIWincoladd],3 -.noholda2 - cmp byte[GUICHold],8 - jne .noholdb - add byte[GUIWincoladd],3 -.noholdb - GUIDisplayIconWin 7,231,101,GUIIconDataDownArrow - cmp byte[GUICHold],8 - jne .noholdb2 - sub byte[GUIWincoladd],3 -.noholdb2 - - mov ebx,[GUIcurrentcheatcursloc] ; Draw input boxes - sub ebx,[GUIcurrentcheatviewloc] - mov eax,ebx - lea ebx,[ebx*4] - add ebx,eax - add ebx,eax - add ebx,eax - add ebx,22 - - mov dl,167 ;Code Box - cmp dword[GUIcurrentcheatwin],1 - jne .notopibox - mov dl,226 - cmp byte[GUIWincoladd],0 - je .nocoladd - inc dl -.nocoladd -.notopibox - GUIDisplayBBox 7,82,129,172,136,dl - - mov dl,167 ;Descrip. Box - cmp dword[GUIcurrentcheatwin],2 - jne .nobotibox - mov dl,226 - cmp byte[GUIWincoladd],0 - je .nocoladd2 - inc dl -.nocoladd2 -.nobotibox - GUIDisplayBBox 7,82,140,196,147,dl - - GUIDisplayTextG 7,84,132,GUICheatTextZ1 ;Green Text&Shadow - GUIDisplayTextG 7,84,143,GUICheatTextZ2 - - xor eax,eax ; Code for movement of cursor - mov al,[GUICheatPosA] - mov byte[GUICheatTextZ1+eax],0 - xor ebx,ebx - mov bl,[GUICheatPosB] - mov byte[GUICheatTextZ2+ebx],0 - test byte[GUICCFlash],8 - jnz .nound - cmp dword[GUIcurrentcheatwin],1 - je .win1 - cmp dword[GUIcurrentcheatwin],2 - je .win2 - jmp .nound -.win1 - mov byte[GUICheatTextZ1+eax],'_' - jmp .nound -.win2 - mov byte[GUICheatTextZ2+ebx],'_' -.nound - - GUIDisplayCheckbox 7,11,186,AutoLoadCht,GUICheatTextE1 ; Checkbox - cmp dword[GUIcurrentcheatwin],0 ; Draw underline only if you - jne near .noshortcut ; don't have an input box selected - GUIDisplayCheckboxu 7,11,186,AutoLoadCht,GUICheatTextE1,0 -.noshortcut - ret - -SECTION .data -GUICheatTextA db 'ADDRESS CV PV TGL DESCRIPTION',0 ; Top - -GUICheatTextB1 db 'REMOVE',0 ; Buttons -GUICheatTextB2 db 'TOGGLE',0 -GUICheatTextB3 db 'SAVE',0 -GUICheatTextB4 db 'LOAD',0 -GUICheatTextB5 db 'FIX',0 -GUICheatTextB6 db 'ADD',0 - -GUICheatTextC1 db 'ENTER CODE:',0 ; Text by input boxes -GUICheatTextC2 db 'DESCRIPTION:',0 - -GUICheatTextD1 db 'VALID CODES: GAME GENIE, PAR, AND GF',0 ; Info for User -GUICheatTextD2 db 'NOTE: YOU MAY HAVE TO RESET THE GAME',0 -GUICheatTextD3 db 'AFTER ENTERING THE CODE. REMEMBER TO',0 -GUICheatTextD4 db 'INSERT THE "-" FOR GAME GENIE CODES.',0 - -GUICheatTextE1 db 'AUTO-LOAD .CHT FILE AT GAME LOAD',0 ; Checkbox Text - -GUICheatTextZ1 db '_',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; 14 characters -GUICheatTextZ2 db '_',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; 18 characters -GUICheatTextZ3 db '000000 00 00 OFF BLAHBLAH---',0,0,0,0,0,0,0,0,0,0,0,0 -GUICheatTextZ4 db '0123456789ABCDEF' -GUICheatTextZ5 db ' ',0 - -SECTION .bss -GUICheatPosA resb 1 -GUICheatPosB resb 1 -GUICStA resd 3 -GUIcurrentcheatviewloc resd 1 -NEWSYM GUIcurrentcheatcursloc, resd 1 -GUIcurrentcheatwin resd 1 -ccheatnpos resd 1 -ccheatnleft resd 1 - -SECTION .text - -DrawWindowSearch: - GUIDrawWindowBox 13,GUISearchDisp - ret - -CSRemoveFlash: -.loop - cmp byte[esi],'_' - je .flash - cmp byte[esi],0 - je .notflash - inc esi - jmp .loop -.flash - mov byte[esi],0 -.notflash - ret - -CSAddFlash: -.loop - cmp byte[esi],'_' - je .flash - cmp byte[esi],0 - je .notflash - inc esi - jmp .loop -.notflash - mov byte[esi],'_' - mov byte[esi+1],0 -.flash - ret - -DisplayGUISearch: - cmp byte[CheatWinMode],1 ; Determine which CS window we're on - je near Incheatmode - cmp byte[CheatWinMode],2 - je near Cheatmodeview - cmp byte[CheatWinMode],3 - je near Cheatmodeadd - mov dword[GUIwinsizex+13*4],170 - mov dword[GUIwinsizey+13*4],150 - call DrawWindowSearch - - GUIDisplayTextY 13,6,16,GUICSrcTextA1 - ; Radio Buttons - GUIDisplayButtonHoleTu 13,11,28,byte[CheatSrcByteSize],0,GUICSrcTextA1a,0 - GUIDisplayButtonHoleTu 13,11,38,byte[CheatSrcByteSize],1,GUICSrcTextA1b,0 - GUIDisplayButtonHoleTu 13,11,48,byte[CheatSrcByteSize],2,GUICSrcTextA1c,0 - GUIDisplayButtonHoleTu 13,11,58,byte[CheatSrcByteSize],3,GUICSrcTextA1d,0 - GUIDisplayButtonHoleTu 13,11,73,byte[CheatSrcByteBase],0,GUICSrcTextA1e,0 - GUIDisplayButtonHoleTu 13,11,83,byte[CheatSrcByteBase],1,GUICSrcTextA1f,0 - - GUIDisplayTextY 13,6,101,GUICSrcTextA2 - GUIDisplayButtonHoleTu 13,11,113,byte[CheatSrcSearchType],0,GUICSrcTextA2a,0 - GUIDisplayButtonHoleTu 13,11,123,byte[CheatSrcSearchType],1,GUICSrcTextA2b,0 - - mov byte[GUItextcolor],217 ; Button - cmp byte[GUIWincoladd],0 - je .zero2 - mov byte[GUItextcolor],211 -.zero2 - DrawGUIButton 13,95,140,140,152,GUICSrcTextA3,50,0,1 - ret - -Incheatmode: ; Return and Re-search Window - mov dword[GUIwinsizex+13*4],180 - mov dword[GUIwinsizey+13*4],150 - call DrawWindowSearch - - mov byte[GUItextcolor],217 ; Text And Shadow - cmp byte[GUIWincoladd],0 - je .zero2 - mov byte[GUItextcolor],211 -.zero2 - cmp byte[CheatSearchStatus],1 - jne near CheatSearching - GUIDisplayText 13,5,20,GUICSrcTextC1 - GUIDisplayText 13,5,30,GUICSrcTextC2 - GUIDisplayText 13,5,40,GUICSrcTextC3 - GUIDisplayText 13,5,50,GUICSrcTextC4 - jmp DisplayChtSrcRes.nosearch - -CheatSearching: ; Exact Value Search - cmp byte[CheatSrcSearchType],1 - je near CheatSearchingComp - - GUIDisplayText 13,5,20,GUICSrcTextB1 - GUIDisplayText 13,5,65,GUICSrcTextG1a - - GUIDisplayBBox 13,10,40,80,47,167 ; Input Box - - test byte[GUICCFlash],8 ; Flash Cursor Code? - jnz .nound - mov esi,CSInputDisplay - call CSRemoveFlash -.nound - - mov byte[GUItextcolor],223 ; Green Shadow - cmp byte[CSOverValue],1 - jne .notdark - mov byte[GUItextcolor],202 ; Alt Color -.notdark - GUIOuttextwin2 13,13,42,CSInputDisplay - - mov byte[GUItextcolor],221 ; Green Text - cmp byte[GUIWincoladd],0 - je .zero4 - mov byte[GUItextcolor],222 -.zero4 - cmp byte[CSOverValue],1 - jne .notdark2 - mov byte[GUItextcolor],207 ; Alt Color -.notdark2 - GUIOuttextwin2 13,12,41,CSInputDisplay - - mov esi,CSInputDisplay ; More flash? - call CSAddFlash - - xor eax,eax ; Find Max Size - mov al,[CheatSrcByteSize] - mov eax,[SrcMask+eax*4] - mov esi,GUICSrcTextG1 - cmp byte[CheatSrcByteBase],1 - je .hex - call convertnum - jmp .dec -.hex - xor ecx,ecx - mov cl,[CheatSrcByteSize] - inc ecx - call converthex -.dec - GUIDisplayText 13,71,65,GUICSrcTextG1 ; Max Size Text - jmp DisplayChtSrcRes - -CheatSearchingComp: ; Comparative search - GUIDisplayTextY 13,6,16,GUICSrcTextD - GUIDisplayButtonHoleTu 13,11,33,byte[CheatCompareValue],0,GUICSrcTextD1,0 - GUIDisplayButtonHoleTu 13,11,43,byte[CheatCompareValue],1,GUICSrcTextD2,1 - GUIDisplayButtonHoleTu 13,11,53,byte[CheatCompareValue],2,GUICSrcTextD3,2 - GUIDisplayButtonHoleTu 13,11,63,byte[CheatCompareValue],3,GUICSrcTextD4,5 - jmp DisplayChtSrcRes - -FindChtSrcRes: ; Calculate search results - inc edi - mov eax,[vidbuffer] - add eax,129600+65536*2 - mov ecx,16384 - xor esi,esi - xor ebx,ebx -.searchloop - mov dl,[eax] - mov dh,8 -.sloop2 - test dl,1 - jz .notset - inc ebx - dec edi - jz .found -.notset - inc esi - shr dl,1 - dec dh - jnz .sloop2 - inc eax - dec ecx - jnz .searchloop - mov eax,ebx - ret -.found - mov [CSStartEntry],esi - jmp .notset - -DisplayChtSrcRes: ; Buttons (Restart/View/Search) - DrawGUIButton 13,120,140,170,152,GUICSrcTextG2a,53,0,1 -.nosearch - DrawGUIButton 13,10,140,60,152,GUICSrcTextG2b,51,0,1 - DrawGUIButton 13,70,140,110,152,GUICSrcTextG2c,52,0,1 - - xor edi,edi ; Call and display # of results - call FindChtSrcRes - mov esi,GUICSrcTextG1 - call convertnum - GUIDisplayText 13,12,125,GUICSrcTextG1b - GUIDisplayText 13,97,125,GUICSrcTextG1 - mov dword[GUIcurrentchtsrcviewloc],0 - mov dword[GUIcurrentchtsrccursloc],0 - ret - -Cheatmodeview: ; View ResultsWindow - mov byte[GUICSrcTextE+12],32 - cmp byte[CheatSrcByteSize],3 - jne .yesprev - cmp byte[CheatSrcByteBase],0 - jne .yesprev - mov byte[GUICSrcTextE+12],0 -.yesprev - mov dword[GUIwinsizex+13*4],185 - mov dword[GUIwinsizey+13*4],150 - call DrawWindowSearch - - GUIDisplayText 13,10,12,GUICSrcTextE ; Text - - GUIDisplayBBoxS 13,5,20,171,108,167 ; Box - - mov edi,[GUIcurrentchtsrcviewloc] - call FindChtSrcRes - mov [NumCheatSrc],eax - mov [ccheatnpos],esi - - mov byte[GUItextcolor],223 ; Display Window Contents - mov eax,[NumCheatSrc] - sub eax,[GUIcurrentchtsrcviewloc] - cmp eax,12 - jbe .notof - mov eax,12 -.notof - mov [ccheatnleft],eax - mov [ccheatnleftb],eax - - mov dword[CheatSearchYPos],24 - mov dword[CheatSearchXPos],10 - mov eax,[CSStartEntry] - mov [CSCurEntry],eax - - cmp dword[ccheatnleft],0 - je near .noentry - mov byte[CheatLooped],0 - mov ebx,[GUIcurrentchtsrccursloc] - sub ebx,[GUIcurrentchtsrcviewloc] - mov [curentryleft],ebx - mov eax,ebx - lea ebx,[ebx*8] - sub ebx,eax - add ebx,22 - DrawGUIWinBox2 13,5,171,7,224 -.nextdisplay - cmp dword[curentryleft],0 - jne .notzero - mov eax,[CSCurEntry] - mov [curentryval],eax -.notzero - dec dword[curentryleft] - - mov esi,GUICSrcTextG1 - mov ecx,3 - mov eax,[CSCurEntry] - add eax,7E0000h - call converthex - GUIOuttextwin2 13,[CheatSearchXPos],[CheatSearchYPos],GUICSrcTextG1 - - mov esi,GUICSrcTextG1 - mov ebx,[wramdata] - add ebx,[CSCurEntry] - mov eax,[ebx] - cmp byte[CheatSrcByteBase],0 - je .dec - xor ecx,ecx - mov cl,[CheatSrcByteSize] - inc ecx - call converthex - jmp .hex -.dec - xor ebx,ebx - mov bl,[CheatSrcByteSize] - and eax,[SrcMask+ebx*4] - call convertnum -.hex - add dword[CheatSearchXPos],42 - GUIOuttextwin2 13,[CheatSearchXPos],[CheatSearchYPos],GUICSrcTextG1 - - add dword[CheatSearchXPos],60 - cmp byte[GUICSrcTextE+12],0 - je near .noprevious - mov esi,GUICSrcTextG1 - mov ebx,[vidbuffer] - add ebx,129600 - add ebx,[CSCurEntry] - mov eax,[ebx] - cmp byte[CheatSrcByteBase],0 - je .decb - xor ecx,ecx - mov cl,[CheatSrcByteSize] - inc ecx - call converthex - jmp .hexb -.decb - xor ebx,ebx - mov bl,[CheatSrcByteSize] - and eax,[SrcMask+ebx*4] - call convertnum -.hexb - GUIOuttextwin2 13,[CheatSearchXPos],[CheatSearchYPos],GUICSrcTextG1 -.noprevious - sub dword[CheatSearchXPos],102 - add dword[CheatSearchYPos],7 - -.nextentry ; Search for next entry - inc dword[CSCurEntry] - mov eax,[CSCurEntry] - mov ecx,eax - and ecx,7 - mov edx,1 - shr eax,3 - shl edx,cl - add eax,dword[vidbuffer] - add eax,129600+65536*2 - test byte[eax],dl - jz .nextentry - dec dword[ccheatnleft] - jnz near .nextdisplay - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je .zero4 - mov byte[GUItextcolor],222 -.zero4 - mov dword[CheatSearchYPos],23 - mov dword[CheatSearchXPos],11 - mov eax,[CSStartEntry] - mov [CSCurEntry],eax - mov eax,[ccheatnleftb] - mov [ccheatnleft],eax - inc byte[CheatLooped] - cmp byte[CheatLooped],2 - jne near .nextdisplay -.noentry -; Slidebar - ; win#,X,Y start, %4-List Loc, %5-List size, %6-Screen size, %7-Bar Size - DrawSlideBarWin 13,173,28,[GUIcurrentchtsrcviewloc],[NumCheatSrc],12,73,GUICSStA - cmp byte[GUICHold],11 - jne .noholda - add byte[GUIWincoladd],3 -.noholda - GUIDisplayIconWin 13,173,20,GUIIconDataUpArrow - cmp byte[GUICHold],11 - jne .noholda2 - sub byte[GUIWincoladd],3 -.noholda2 - cmp byte[GUICHold],12 - jne .noholdb - add byte[GUIWincoladd],3 -.noholdb - GUIDisplayIconWin 13,173,101,GUIIconDataDownArrow - cmp byte[GUICHold],12 - jne .noholdb2 - sub byte[GUIWincoladd],3 -.noholdb2 - mov byte[GUItextcolor],217 - cmp byte[GUIWincoladd],0 - je .zero3 - mov byte[GUItextcolor],211 -.zero3 - DrawGUIButton 13,70,140,130,152,GUICSrcTextG2d,54,0,1 - DrawGUIButton 13,140,140,180,152,GUICSrcTextG2e,55,0,1 - ret - -Cheatmodeadd: ; Add Window - mov dword[GUIwinsizex+13*4],170 - mov dword[GUIwinsizey+13*4],165 - call DrawWindowSearch - - GUIDisplayText 13,5,20,GUICSrcTextF1 ; Text - GUIDisplayText 13,5,45,GUICSrcTextF2 - GUIDisplayText 13,5,70,GUICSrcTextF3 - - GUIDisplayCheckbox 13,8,139,CheatUpperByteOnly,GUICSrcTextF4 ; Checkbox - - GUIDisplayBBox 13,10,30,80,37,167 ; Boxes - GUIDisplayBBox 13,10,55,126,62,167 - GUIDisplayBBox 13,10,80,80,120,167 - - DrawGUIButton 13,60,155,120,167,GUICSrcTextG2d,56,0,1 ; Buttons - DrawGUIButton 13,130,155,160,167,GUICSrcTextG2e,57,0,1 - - GUIDisplayText 13,5,130,GUICSrcTextG1a ; Max Value Text - xor eax,eax - mov al,[CheatSrcByteSize] - mov eax,[SrcMask+eax*4] - mov esi,GUICSrcTextG1 - cmp byte[CheatSrcByteBase],1 - je .hex - call convertnum - jmp .dec -.hex - xor ecx,ecx - mov cl,[CheatSrcByteSize] - inc ecx - call converthex -.dec - GUIDisplayText 13,71,130,GUICSrcTextG1 - - cmp byte[CurCStextpos],0 ; Cheat Input - jne near .nofirstbox - test byte[GUICCFlash],8 - jnz .nound -.nofirstbox - mov esi,CSInputDisplay - call CSRemoveFlash -.nound - mov byte[GUItextcolor],223 - cmp byte[CSOverValue],1 - jne .notdark - mov byte[GUItextcolor],202 -.notdark - GUIOuttextwin2 13,13,32,CSInputDisplay - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je .zero4 - mov byte[GUItextcolor],222 -.zero4 - cmp byte[CSOverValue],1 - jne .notdark2 - mov byte[GUItextcolor],207 -.notdark2 - GUIOuttextwin2 13,12,31,CSInputDisplay - mov esi,CSInputDisplay - call CSAddFlash - - cmp byte[CurCStextpos],1 ; Cheat Desc. Input - jne .noundb - test byte[GUICCFlash],8 - jnz .noundb - mov esi,CSDescDisplay - call CSAddFlash -.noundb - GUIDisplayTextG 13,13,57,CSDescDisplay - mov esi,CSDescDisplay - call CSRemoveFlash - - cmp byte[CSOverValue],1 - je near .nodisplay - cmp byte[CSInputDisplay],'_' - je near .nodisplay - - mov dword[CheatSearchYPos],83 ; PAR Code? - mov eax,[curentryval] - mov [curaddrvalcs],eax - mov eax,[CSCurValue] - mov [curvaluecs],eax - xor ecx,ecx - mov cl,[CheatSrcByteSize] - inc cl - cmp byte[CheatUpperByteOnly],0 - je .cspardisploop - mov cl,1 -.cspardispagain - cmp dword[curvaluecs],0FFh - jbe .cspardisploop - shr dword[curvaluecs],8 - inc dword[curaddrvalcs] - jmp .cspardispagain -.cspardisploop ; Max Value Display? - push ecx - mov esi,GUICSrcTextG1 - mov ecx,3 - mov eax,[curaddrvalcs] - add eax,7E0000h - call converthex - mov esi,GUICSrcTextG1+6 - mov ecx,1 - mov al,[curvaluecs] - call converthex - shr dword[curvaluecs],8 - mov byte[GUItextcolor],223 - inc dword[CheatSearchYPos] - GUIOuttextwin2 13,13,[CheatSearchYPos],GUICSrcTextG1 - dec dword[CheatSearchYPos] - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je .zero4c - mov byte[GUItextcolor],222 -.zero4c - GUIOuttextwin2 13,12,[CheatSearchYPos],GUICSrcTextG1 - add dword[CheatSearchYPos],10 - inc dword[curaddrvalcs] - pop ecx - dec ecx - jnz near .cspardisploop -.nodisplay - ret - -SECTION .bss -NEWSYM CheatWinMode, resb 1 -NEWSYM CheatSearchStatus, resb 1 -CheatCompareValue resd 1 -NumCheatSrc resd 1 -GUIcurrentchtsrcviewloc resd 1 -GUIcurrentchtsrccursloc resd 1 -CSStartEntry resd 1 -CSCurEntry resd 1 -CheatSearchXPos resd 1 -CheatSearchYPos resd 1 -CheatLooped resd 1 -ccheatnleftb resd 1 -CurCStextpos resd 1 - -SECTION .data -SrcMask dd 0FFh,0FFFFh,0FFFFFFh,0FFFFFFFFh -CSInputDisplay db '_',0,' ',0 -CSDescDisplay db ' ',0,0 - -SECTION .bss -curentryval resd 1 -curentryleft resd 1 -curaddrvalcs resd 1 -curvaluecs resd 1 -GUICSStA resd 3 - -SECTION .data - -; A = Opening Screen -; B = Exact Value Search -; C = Comparison Search Message -; D = Comparison Search Method -; E = View Results -; F = Add Cheat -; G = General Use - -GUICSrcTextA1 db 'SELECT SIZE AND FORMAT:',0 -GUICSrcTextA1a db '1 BYTE [0..255]',0 -GUICSrcTextA1b db '2 BYTES [0..65535]',0 -GUICSrcTextA1c db '3 BYTES [0..16777215]',0 -GUICSrcTextA1d db '4 BYTES [0..4294967295]',0 -GUICSrcTextA1e db 'DEC (BASE 10)',0 -GUICSrcTextA1f db 'HEX (BASE 16)',0 -GUICSrcTextA2 db 'SELECT SEARCH TYPE:',0 -GUICSrcTextA2a db 'EXACT VALUE SEARCH',0 -GUICSrcTextA2b db 'COMPARATIVE SEARCH',0 -GUICSrcTextA3 db 'START',0 ; Button - -GUICSrcTextB1 db 'ENTER VALUE:',0 ; Make Yellow - -GUICSrcTextC1 db 'NOW RETURN TO YOUR GAME',0 -GUICSrcTextC2 db 'AND COME BACK WHEN ',0 -GUICSrcTextC3 db 'THE NEXT SEARCH',0 -GUICSrcTextC4 db 'SHOULD BE PROCESSED',0 - -GUICSrcTextD db 'SELECT COMPARISON:',0 -GUICSrcTextD1 db 'NEW VALUE IS > OLD VALUE',0 -GUICSrcTextD2 db 'NEW VALUE IS < OLD VALUE',0 -GUICSrcTextD3 db 'NEW VALUE IS = OLD VALUE',0 -GUICSrcTextD4 db 'NEW VALUE IS != OLD VALUE',0 - -GUICSrcTextE db 'ADDR VALUE PVALUE',0 - -GUICSrcTextF1 db 'ENTER NEW VALUE:',0 -GUICSrcTextF2 db 'ENTER CHEAT DESCRIPTION:',0 -GUICSrcTextF3 db 'PAR CODE EQUIVALENT:',0 -GUICSrcTextF4 db 'USE ONLY UPPER BYTE',0 - -GUICSrcTextG1 db ' ',0 ; All variables -GUICSrcTextG1a db 'MAX VALUE:',0 -GUICSrcTextG1b db '# OF RESULTS:',0 -GUICSrcTextG2a db 'SEARCH',0 ; Buttons -GUICSrcTextG2b db 'RESTART',0 -GUICSrcTextG2c db 'VIEW',0 -GUICSrcTextG2d db 'RETURN',0 -GUICSrcTextG2e db 'ADD',0 - -SECTION .bss -CCursLoc resd 1 -CViewLoc resd 1 -NViewLoc resd 1 -TViewLoc resd 1 - -SECTION .text - -DisplayNetOptns: - ret - -SECTION .bss -NEWSYM GUINCStA, resd 3 -FileNameMod resb 512 -CurCStringPos resd 1 - -SECTION .text - -DisplayGameOptns: ; Misc Key Window - GUIDrawWindowBox 9,GUIGameDisp - - GUIDisplayTextY 9,6,16,GUIGameOptnsTextA - mov byte[GUIGameOptnsTextA1+2],'1' - GUIDisplayText 9,9,25,GUIGameOptnsTextA1 - mov byte[GUIGameOptnsTextA1+2],'2' - GUIDisplayText 9,9+45,25,GUIGameOptnsTextA1 - mov byte[GUIGameOptnsTextA1+2],'3' - GUIDisplayText 9,9+90,25,GUIGameOptnsTextA1 - mov byte[GUIGameOptnsTextA1+2],'4' - GUIDisplayText 9,9+135,25,GUIGameOptnsTextA1 - GUIDisplayText 9,9+180,25,GUIGameOptnsTextA2 - - GUIDisplayTextY 9,6,34,GUIGameOptnsTextB - mov byte[GUIGameOptnsTextB1+2],'1' - GUIDisplayText 9,9,43,GUIGameOptnsTextB1 - mov byte[GUIGameOptnsTextB1+2],'2' - GUIDisplayText 9,9+45,43,GUIGameOptnsTextB1 - mov byte[GUIGameOptnsTextB1+2],'3' - GUIDisplayText 9,9+45*2,43,GUIGameOptnsTextB1 - mov byte[GUIGameOptnsTextB1+2],'4' - GUIDisplayText 9,9+45*3,43,GUIGameOptnsTextB1 - GUIDisplayText 9,9+45*4,43,GUIGameOptnsTextB2 - mov byte[GUIGameOptnsTextB1+2],'5' - GUIDisplayText 9,9,52,GUIGameOptnsTextB1 - mov byte[GUIGameOptnsTextB1+2],'6' - GUIDisplayText 9,9+45,52,GUIGameOptnsTextB1 - mov byte[GUIGameOptnsTextB1+2],'7' - GUIDisplayText 9,9+45*2,52,GUIGameOptnsTextB1 - mov byte[GUIGameOptnsTextB1+2],'8' - GUIDisplayText 9,9+45*3,52,GUIGameOptnsTextB1 - GUIDisplayText 9,9+45*4,52,GUIGameOptnsTextB3 - - GUIDisplayTextY 9,6,61,GUIGameOptnsTextC - GUIDisplayText 9,9,72,GUIGameOptnsTextC1 - GUIDisplayText 9,9+52,72,GUIGameOptnsTextC2 - GUIDisplayText 9,9+109,72,GUIGameOptnsTextC3 - GUIDisplayText 9,9+160,72,GUIGameOptnsTextC4 - GUIDisplayText 9,9,82,GUIGameOptnsTextC5 - GUIDisplayText 9,9+52,82,GUIGameOptnsTextC6 - GUIDisplayText 9,137,82,GUIGameOptnsTextC7 - - GUIDisplayTextY 9,6,93,GUIGameOptnsTextD1 - GUIDisplayText 9,9,102,GUIGameOptnsTextD1a - GUIDisplayText 9,9,112,GUIGameOptnsTextD1b - GUIDisplayText 9,9,122,GUIGameOptnsTextD1c -%ifndef __MSDOS__ - GUIDisplayText 9,9,132,GUIGameOptnsTextD1d -%endif - - GUIDisplayTextY 9,119,93,GUIGameOptnsTextD2 - GUIDisplayText 9,122,102,GUIGameOptnsTextD2a - GUIDisplayText 9,122,112,GUIGameOptnsTextD2b - GUIDisplayText 9,122,122,GUIGameOptnsTextD2c - GUIDisplayText 9,122,132,GUIGameOptnsTextD2d - GUIDisplayText 9,122,142,GUIGameOptnsTextD2e - - ; Draw black boxes - DDrawBox 9,26,22,[KeyBGDisble0] - DDrawBox 9,71,22,[KeyBGDisble1] - DDrawBox 9,116,22,[KeyBGDisble2] - DDrawBox 9,161,22,[KeyBGDisble3] - DDrawBox 9,206,22,[KeySprDisble] - - DDrawBox 9,26,40,[KeyDisableSC0] - DDrawBox 9,71,40,[KeyDisableSC1] - DDrawBox 9,116,40,[KeyDisableSC2] - DDrawBox 9,161,40,[KeyDisableSC3] - DDrawBox 9,213,40,[KeyVolUp] - DDrawBox 9,26,49,[KeyDisableSC4] - DDrawBox 9,71,49,[KeyDisableSC5] - DDrawBox 9,116,49,[KeyDisableSC6] - DDrawBox 9,161,49,[KeyDisableSC7] - DDrawBox 9,213,49,[KeyVolDown] - - DDrawBox 9,32,69,[KeyQuickLoad] - DDrawBox 9,90,69,[KeyQuickRst] - DDrawBox 9,141,69,[KeyQuickExit] - DDrawBox 9,199,69,[KeyQuickClock] - DDrawBox 9,32,79,[KeyQuickChat] - DDrawBox 9,109,79,[KeyQuickSnapShot] - DDrawBox 9,185,79,[KeyQuickSaveSPC] - - DDrawBox 9,77,99,[KeyUsePlayer1234] - DDrawBox 9,77,109,[KeyResetAll] - DDrawBox 9,77,119,[KeyDisplayFPS] -%ifndef __MSDOS__ - DDrawBox 9,77,129,[KeyDisplayBatt] -%endif - - DDrawBox 9,190,99,[KeyNewGfxSwt] - DDrawBox 9,190,109,[KeyWinDisble] - DDrawBox 9,190,119,[KeyOffsetMSw] - DDrawBox 9,190,129,[KeyIncreaseGamma] - DDrawBox 9,190,139,[KeyDecreaseGamma] - ret - -SECTION .bss -GUIGameOptnsColA resb 1 -GUIGameOptnsColB resb 1 -GUIGameDisplayKy resd 1 - -SECTION .data - -GUIGameOptnsTextA db 'BG DISABLES:',0 -GUIGameOptnsTextA1 db 'BG#',0 -GUIGameOptnsTextA2 db 'OBJ',0 - -GUIGameOptnsTextB db 'SOUND KEYS:',0 -GUIGameOptnsTextB1 db 'CH#',0 -GUIGameOptnsTextB2 db '+VOL',0 -GUIGameOptnsTextB3 db '-VOL',0 - -GUIGameOptnsTextC db 'QUICK KEYS:',0 -GUIGameOptnsTextC1 db 'LOAD',0 -GUIGameOptnsTextC2 db 'RESET',0 -GUIGameOptnsTextC3 db 'EXIT',0 -GUIGameOptnsTextC4 db 'CLOCK',0 -GUIGameOptnsTextC5 db 'CHAT',0 -GUIGameOptnsTextC6 db 'SNAPSHOT',0 -GUIGameOptnsTextC7 db 'SAVE SPC',0 - -GUIGameOptnsTextD1 db 'MISC TOGGLES:',0 -GUIGameOptnsTextD1a db 'USE PL12/34',0 -GUIGameOptnsTextD1b db 'PANIC KEY',0 -GUIGameOptnsTextD1c db 'DISPLAY FPS',0 -GUIGameOptnsTextD1d db 'BATT POWER',0 - -GUIGameOptnsTextD2 db 'GFX TOGGLES:',0 -GUIGameOptnsTextD2a db 'NEW GFX ENG',0 -GUIGameOptnsTextD2b db 'BG WINDOW',0 -GUIGameOptnsTextD2c db 'OFFSET MODE',0 -GUIGameOptnsTextD2d db '+ GAMMA',0 -GUIGameOptnsTextD2e db '- GAMMA',0 - - -SECTION .text - -%macro GUICslidSet 1 ; slider var - mov al,[%1] - shl eax,2 - add eax,2 -%endmacro - -%macro GUICslidText 2 ; slider var, text - mov byte[%2],' ' - mov esi,%2+2 - mov al,[%1] - mov bl,10 -%%asciilp ; turns decimal into ascii - dec esi - xor ah,ah - div bl - add ah,48 - mov [esi],ah - cmp al,0 - jne %%asciilp - mov esi,%2 -%endmacro - -DisplayGUIOptns: ; GUI Options -%ifdef __WIN32__ ; If Windows, extend window down - mov dword[GUIwinsizey+10*4],192 -%endif - GUIDrawWindowBox 10,GUIGUIDisp - - ; Setup Colors - cmp byte[CurPalSelect],1 - je .yespal2b - cmp byte[CurPalSelect],2 - je .yespal3b - mov al,[GUIRAdd] - mov [TRVal2],al - mov al,[GUIGAdd] - mov [TGVal2],al - mov al,[GUIBAdd] - mov [TBVal2],al - jmp .nopal1b -.yespal2b - mov al,[GUITRAdd] - mov [TRVal2],al - mov al,[GUITGAdd] - mov [TGVal2],al - mov al,[GUITBAdd] - mov [TBVal2],al - jmp .nopal1b -.yespal3b - mov al,[GUIWRAdd] - mov [TRVal2],al - mov al,[GUIWGAdd] - mov [TGVal2],al - mov al,[GUIWBAdd] - mov [TBVal2],al -.nopal1b - - GUIDrawSlider 10,25,127,124,TRVal2,GUIGUIOptnsTextD2,GUICslidSet,GUICslidText - GUIDrawSlider 10,25,127,136,TGVal2,GUIGUIOptnsTextD2,GUICslidSet,GUICslidText - GUIDrawSlider 10,25,127,148,TBVal2,GUIGUIOptnsTextD2,GUICslidSet,GUICslidText - - GUIDisplayTextY 10,6,16,GUIGUIOptnsTextA - ;Checkboxes - GUIDisplayCheckboxu 10,12,23,GUIRClick,GUIGUIOptnsTextA1a,1 - GUIDisplayCheckboxu 10,12,33,lhguimouse,GUIGUIOptnsTextA1b,6 - GUIDisplayCheckboxu 10,12,43,mouseshad,GUIGUIOptnsTextA1c,0 - GUIDisplayCheckboxu 10,12,53,mousewrap,GUIGUIOptnsTextA1d,0 -%ifdef __WIN32__ - GUIDisplayCheckboxu 10,12,63,TrapMouseCursor,GUIGUIOptnsTextA1e,3 - GUIDisplayCheckboxu 10,12,73,MouseWheel,GUIGUIOptnsTextA1f,1 -%endif - - GUIDisplayCheckboxu 10,129,23,esctomenu,GUIGUIOptnsTextA2a,7 - GUIDisplayCheckboxu 10,129,33,JoyPad1Move,GUIGUIOptnsTextA2b,6 - GUIDisplayCheckboxu 10,129,43,FilteredGUI,GUIGUIOptnsTextA2c,0 - GUIDisplayCheckboxu 10,129,53,newfont,GUIGUIOptnsTextA2d,12 - GUIDisplayCheckboxu 10,129,63,savewinpos,GUIGUIOptnsTextA2e,9 - - GUIDisplayTextY 10,6,91,GUIGUIOptnsTextE - GUIDisplayButtonHoleTu 10,72,88,byte[GUIEffect],0,GUIGUIOptnsTextE1,3 - GUIDisplayButtonHoleTu 10,122,88,byte[GUIEffect],1,GUIGUIOptnsTextE2,1 - GUIDisplayButtonHoleTu 10,182,88,byte[GUIEffect],4,GUIGUIOptnsTextE5,2 - GUIDisplayButtonHoleTu 10,72,98,byte[GUIEffect],5,GUIGUIOptnsTextE6,3 - GUIDisplayButtonHoleTu 10,122,98,byte[GUIEffect],2,GUIGUIOptnsTextE3,6 - GUIDisplayButtonHoleTu 10,182,98,byte[GUIEffect],3,GUIGUIOptnsTextE4,6 - - GUIDisplayTextY 10,6,111,GUIGUIOptnsTextB - GUIDisplayText 10,60,111,GUIGUIOptnsTextB1 - GUIDisplayText 10,100,111,GUIGUIOptnsTextB2 - GUIDisplayText 10,145,111,GUIGUIOptnsTextB3 - -%ifdef __WIN32__ - GUIDisplayTextY 10,6,161,GUIGUIOptnsTextC - GUIDisplayCheckboxu 10,12,168,AlwaysOnTop,GUIGUIOptnsTextC1,14 - GUIDisplayCheckboxu 10,12,178,SaveMainWindowPos,GUIGUIOptnsTextC2,2 - GUIDisplayCheckboxu 10,12,188,AllowMultipleInst,GUIGUIOptnsTextC3,1 -%endif - - mov byte[GUIGUIOptnsTextD1],'R' - GUIDisplayText 10,16,123,GUIGUIOptnsTextD1 - mov byte[GUIGUIOptnsTextD1],'G' - GUIDisplayText 10,16,135,GUIGUIOptnsTextD1 - mov byte[GUIGUIOptnsTextD1],'B' - GUIDisplayText 10,16,147,GUIGUIOptnsTextD1 - ; Radio Buttons - GUIDisplayButtonHole 10,48,108,byte[CurPalSelect],0 - GUIDisplayButtonHole 10,88,108,byte[CurPalSelect],1 - GUIDisplayButtonHole 10,133,108,byte[CurPalSelect],2 - ret - -SECTION .data -GUIGUIOptnsTextA db 'GUI SWITCHES:',0 -GUIGUIOptnsTextA1a db 'RCLICK OPENS GUI',0 -GUIGUIOptnsTextA1b db 'SWAP L/R MBUTTONS',0 -GUIGUIOptnsTextA1c db 'SHOW MOUSE SHADOW',0 -GUIGUIOptnsTextA1d db 'MICE WRAP GUI WIN',0 -%ifdef __WIN32__ -GUIGUIOptnsTextA1e db 'TRAP MOUSE CURSOR',0 -GUIGUIOptnsTextA1f db 'WHEEL MICE SCROLL',0 -%endif - -GUIGUIOptnsTextA2a db 'ESC TO GAME MENU',0 -GUIGUIOptnsTextA2b db 'CTRL GUI W/GPAD1',0 -GUIGUIOptnsTextA2c db 'FILTERED GUI',0 -GUIGUIOptnsTextA2d db 'USE CUSTOM FONT',0 -GUIGUIOptnsTextA2e db 'SAVE GUI WIN POS',0 - -GUIGUIOptnsTextB db 'COLOR:',0 -GUIGUIOptnsTextB1 db 'BACK',0 -GUIGUIOptnsTextB2 db 'TITLE',0 -GUIGUIOptnsTextB3 db 'WIN',0 - -%ifdef __WIN32__ -GUIGUIOptnsTextC db 'MAIN WINDOW OPTIONS:',0 -GUIGUIOptnsTextC1 db 'EMU ALWAYS ON TOP',0 -GUIGUIOptnsTextC2 db 'SAVE MAIN WINDOW POSITION',0 -GUIGUIOptnsTextC3 db 'ALLOW MULTIPLE INSTANCES OF EMU',0 -%endif - -GUIGUIOptnsTextD1 db '@',0 -GUIGUIOptnsTextD2 db ' ',0 - -GUIGUIOptnsTextE db 'BG EFFECTS:',0 -GUIGUIOptnsTextE1 db 'NONE',0 -GUIGUIOptnsTextE2 db 'SNOW',0 -GUIGUIOptnsTextE3 db 'WATER A',0 -GUIGUIOptnsTextE4 db 'WATER B',0 -GUIGUIOptnsTextE5 db 'BURNING',0 -GUIGUIOptnsTextE6 db 'SMOKE',0 - -SECTION .text - -DisplayGUIAbout: ; Displays the About Box - ;This will attach compile date onto the end of GUIGUIAboutText1 - pushad - mov eax,GUIGUIAboutTextA1 - mov [VERSION_STR],eax - call placedate - popad - - GUIDrawWindowBox 11,GUIAboutDisp - cmp byte[EEgg],1 - je near .eegg - GUIDisplayText 11,6,16,GUIGUIAboutTextA1 ; Text - GUIDisplayText 11,6,26,GUIGUIAboutTextA2 - GUIDisplayTextY 11,6,36,GUIGUIAboutTextB - GUIDisplayText 11,6,46,GUIGUIAboutTextB1 - GUIDisplayText 11,6,56,GUIGUIAboutTextB2 - GUIDisplayTextY 11,6,66,GUIGUIAboutTextC - GUIDisplayText 11,6,76,GUIGUIAboutTextC1 - GUIDisplayText 11,6,86,GUIGUIAboutTextC2 - GUIDisplayText 11,6,96,GUIGUIAboutTextC3 - GUIDisplayText 11,6,106,GUIGUIAboutTextC4 - GUIDisplayText 11,6,116,GUIGUIAboutTextC5 - GUIDisplayText 11,6,131,GUIGUIAboutTextD1 - GUIDisplayText 11,6,141,GUIGUIAboutTextD2 - GUIDisplayText 11,6,151,GUIGUIAboutTextD3 - GUIDisplayText 11,6,161,GUIGUIAboutTextD4 - GUIDisplayText 11,6,171,GUIGUIAboutTextD5 - GUIDisplayText 11,6,181,GUIGUIAboutTextD6 - GUIDisplayText 11,6,191,GUIGUIAboutTextD7 - - mov byte[GUItextcolor],217 ; Buttons - cmp byte[GUIWincoladd],0 - je .zero3 - mov byte[GUItextcolor],211 -.zero3 - DrawGUIButton 11,90,22,175,32,GUIGUIAboutTextE1,65,0,0 - DrawGUIButton 11,90,33,175,43,GUIGUIAboutTextE2,66,0,0 - ret - -.eegg ;Playground - GUIDisplayText 11,42,36,GUIGUIAboutTextF - GUIDisplayText 11,30,96,GUIGUIAboutTextFa - GUIDisplayText 11,39,106,GUIGUIAboutTextFb - ret - -SECTION .data -GUIGUIAboutTextA1 db 'ZSNES V',ZVERSION,' ',0 ;Need room for date -%ifdef __MSDOS__ -GUIGUIAboutTextA2 db 'DOS VERSION',0 -%elifdef __WIN32__ -GUIGUIAboutTextA2 db 'WIN VERSION',0 -%elifdef __UNIXSDL__ -GUIGUIAboutTextA2 db 'SDL VERSION',0 -%endif - -GUIGUIAboutTextB db 'CODED BY: ',0 -GUIGUIAboutTextB1 db ' ZSKNIGHT _DEMO_',0 -GUIGUIAboutTextB2 db ' PAGEFAULT NACH',0 - -GUIGUIAboutTextC db 'ASSISTANT CODERS:',0 -GUIGUIAboutTextC1 db ' PHAROS STATMAT',0 -GUIGUIAboutTextC2 db ' TEUF HPSOLO',0 -GUIGUIAboutTextC3 db ' THEODDONE33 SILOH',0 -GUIGUIAboutTextC4 db ' IPHER GRINVADER',0 -GUIGUIAboutTextC5 db ' JONAS QUINN DEATHLIKE',0 - -GUIGUIAboutTextD1 db 'ZSNES comes with ABSOLUTELY',0 -GUIGUIAboutTextD2 db 'NO WARRANTY. This is free',0 -GUIGUIAboutTextD3 db 'software, and you are welcome',0 -GUIGUIAboutTextD4 db 'to redistribute it under',0 -GUIGUIAboutTextD5 db 'certain conditions; please',0 -GUIGUIAboutTextD6 db 'read ',39,'LICENSE.TXT',39,0 -GUIGUIAboutTextD7 db 'thoroughly before doing so.',0 - -GUIGUIAboutTextE1 db 'WWW.ZSNES.COM',0 -GUIGUIAboutTextE2 db 'DOCUMENTATION',0 - -GUIGUIAboutTextF db 'HIDDEN MESSAGE!',0 -GUIGUIAboutTextFa db 'PRESS ',39,'E',39,' TO RETURN ',0 -GUIGUIAboutTextFb db 'TO THE ABOUT BOX',0 - -SECTION .text - -DisplayGUIMovies: ; Movie Record/Playback options - GUIDrawWindowBox 15,GUIMovieDisp ; Display Window - GUIDrawTArea 15 - - cmp byte[MovieProcessing],4 - je near .cannotzmv - cmp byte[MovieProcessing],5 - je near .cannotzmv - cmp byte[MovieProcessing],6 - je near .cannotzmv - GUIDrawTabs GUIMovieTabs -.cannotzmv - - cmp byte[MovieProcessing],1 - je near .cannotdump - cmp byte[MovieProcessing],2 - je near .cannotdump - cmp byte[MovieProcessing],3 - je near .cannotdump - GUIDrawTabs GUIDumpingTab -.cannotdump - - cmp byte[RawDumpInProgress],0 - je .notdumping - mov dword[GUIMovieTabs],0 - mov dword[GUIDumpingTab],1 -.notdumping - - cmp byte[MovieRecordWinVal],0 - je near .displayboxa - - GUIDisplayText 15,9,26,GUIMovieTextX1 ; Overwrite Message Box - GUIDisplayText 15,9,36,GUIMovieTextX2 - GUIDisplayText 15,9,51,GUIMovieTextX3 - - mov byte[GUItextcolor],217 - cmp byte[GUIWincoladd],0 - je .zero4 - mov byte[GUItextcolor],211 -.zero4 - DrawGUIButton 15,17,65,59,76,GUIMovieTextX4,19,0,0 ; Yes/No Buttons - DrawGUIButton 15,70,65,112,76,GUIMovieTextX5,20,0,0 - ret - -.displayboxa ; Main Window - mov byte[GUItextcolor],217 - cmp byte[GUIWincoladd],0 - je .zero - mov byte[GUItextcolor],211 -.zero - - GUIDisplayTextY 15,8,31,GUIMovieTextA ; Slot text - mov byte[GUIMovieTextA1],'0' - GUIDisplayText 15,20,42,GUIMovieTextA1 - mov byte[GUIMovieTextA1],'1' - GUIDisplayText 15,40,42,GUIMovieTextA1 - mov byte[GUIMovieTextA1],'2' - GUIDisplayText 15,60,42,GUIMovieTextA1 - mov byte[GUIMovieTextA1],'3' - GUIDisplayText 15,80,42,GUIMovieTextA1 - mov byte[GUIMovieTextA1],'4' - GUIDisplayText 15,100,42,GUIMovieTextA1 - mov byte[GUIMovieTextA1],'5' - GUIDisplayText 15,120,42,GUIMovieTextA1 - mov byte[GUIMovieTextA1],'6' - GUIDisplayText 15,140,42,GUIMovieTextA1 - mov byte[GUIMovieTextA1],'7' - GUIDisplayText 15,160,42,GUIMovieTextA1 - mov byte[GUIMovieTextA1],'8' - GUIDisplayText 15,180,42,GUIMovieTextA1 - mov byte[GUIMovieTextA1],'9' - GUIDisplayText 15,200,42,GUIMovieTextA1 - - ; Display Radio buttons - GUIDisplayButtonHole 15,8,39,byte[CMovieExt],'v' - GUIDisplayButtonHole 15,28,39,byte[CMovieExt],'1' - GUIDisplayButtonHole 15,48,39,byte[CMovieExt],'2' - GUIDisplayButtonHole 15,68,39,byte[CMovieExt],'3' - GUIDisplayButtonHole 15,88,39,byte[CMovieExt],'4' - GUIDisplayButtonHole 15,108,39,byte[CMovieExt],'5' - GUIDisplayButtonHole 15,128,39,byte[CMovieExt],'6' - GUIDisplayButtonHole 15,148,39,byte[CMovieExt],'7' - GUIDisplayButtonHole 15,168,39,byte[CMovieExt],'8' - GUIDisplayButtonHole 15,188,39,byte[CMovieExt],'9' - - mov dword[GUIMovieTextZ+8],'INAC' ; Determine and Display Status - mov dword[GUIMovieTextZ+12],'TIVE' - mov dword[GUIMovieTextZ+16],' ' - mov dword[GUIMovieTextZ+20],' ' - cmp byte[MovieProcessing],1 - jne .noplay - mov dword[GUIMovieTextZ+8],'PLAY' - mov dword[GUIMovieTextZ+12],'ING ' - mov dword[GUIMovieTextZ+16],' ' - mov dword[GUIMovieTextZ+20],' ' -.noplay - cmp byte[MovieProcessing],2 - jne .norec - mov dword[GUIMovieTextZ+8],'RECO' - mov dword[GUIMovieTextZ+12],'RDIN' - mov dword[GUIMovieTextZ+16],'G ' - mov dword[GUIMovieTextZ+20],' ' -.norec - cmp byte[MovieProcessing],3 - jne .nooldplay - mov dword[GUIMovieTextZ+8],'OLD ' - mov dword[GUIMovieTextZ+12],'PLAY' - mov dword[GUIMovieTextZ+16],'ING ' - mov dword[GUIMovieTextZ+20],' ' -.nooldplay - cmp byte[MovieProcessing],4 - jne .noendingdump - mov dword[GUIMovieTextZ+8],'DUMP' - mov dword[GUIMovieTextZ+12],'ING ' - mov dword[GUIMovieTextZ+16],'ENDI' - mov dword[GUIMovieTextZ+20],'NG ' -.noendingdump - cmp byte[MovieProcessing],5 - jne .nodump - mov dword[GUIMovieTextZ+8],'DUMP' - mov dword[GUIMovieTextZ+12],'ING ' - mov dword[GUIMovieTextZ+16],' ' - mov dword[GUIMovieTextZ+20],' ' -.nodump - cmp byte[MovieProcessing],6 - jne .noolddump - mov dword[GUIMovieTextZ+8],'DUMP' - mov dword[GUIMovieTextZ+12],'ING ' - mov dword[GUIMovieTextZ+16],'OLD ' - mov dword[GUIMovieTextZ+20],' ' -.noolddump - - GUIDisplayTextY 15,6,192,GUIMovieTextZ - - cmp dword[GUIMovieTabs],1 - jne near .notcontrols - - GUIDisplayTextY 15,8,56,GUIMovieTextB ; "Start From" Section - GUIDisplayTextY 15,8,100,GUIMovieTextD ; Chapters - - GUIDisplayButtonHoleTu 15,8,64,byte[MovieStartMethod],0,GUIMovieTextB1,0 - GUIDisplayButtonHoleTu 15,43,64,byte[MovieStartMethod],1,GUIMovieTextB2,0 - GUIDisplayButtonHoleTu 15,89,64,byte[MovieStartMethod],2,GUIMovieTextB3,0 - GUIDisplayButtonHoleTu 15,135,64,byte[MovieStartMethod],3,GUIMovieTextB4,6 - - DrawGUIButton 15,7,80,49,91,GUIMovieTextC1,16,0,0 ; Draw Buttons - DrawGUIButton 15,55,80,97,91,GUIMovieTextC2,17,0,0 - DrawGUIButton 15,103,80,145,91,GUIMovieTextC3,18,0,0 - DrawGUIButton 15,151,80,193,91,GUIMovieTextC4,32,0,0 - DrawGUIButton 15,7,108,50,119,GUIMovieTextD1,29,0,0 - DrawGUIButton 15,85,108,138,119,GUIMovieTextD2,30,0,0 - DrawGUIButton 15,173,108,203,119,GUIMovieTextD3,31,0,0 - - DDrawBox 15,57,109,[KeyInsrtChap] ; Chapter Keyboard Shortcut Boxes - DDrawBox 15,145,109,[KeyPrevChap] - DDrawBox 15,210,109,[KeyNextChap] - - GUIDisplayTextY 15,8,125,GUIMovieTextE ; Movie State Load - - GUIDisplayButtonHoleTu 15,8,133,byte[MZTForceRTR],0,GUIMovieTextE1,14 - GUIDisplayButtonHoleTu 15,8,143,byte[MZTForceRTR],1,GUIMovieTextE2,12 - GUIDisplayButtonHoleTu 15,8,153,byte[MZTForceRTR],2,GUIMovieTextE3,14 - - DDrawBox 15,134,123,[KeyRTRCycle] ; MZT Load Shortcut Box - - GUIDisplayCheckboxu 15,8,163,MovieDisplayFrame,GUIMovieTextE9,0 ; Checkbox -.notcontrols - - cmp dword[GUIDumpingTab],1 - jne near .nodumping - - GUIDisplayTextY 15,8,56,GUIMovieTextF ; Video Section - GUIDisplayButtonHoleTu 15,8,64,byte[MovieVideoMode],0,GUIMovieTextF1,1 - GUIDisplayButtonHoleTu 15,8,74,byte[MovieVideoMode],1,GUIMovieTextF2,2 - GUIDisplayButtonHoleTu 15,8,84,byte[MovieVideoMode],2,GUIMovieTextF3,0 - GUIDisplayButtonHoleTu 15,8,94,byte[MovieVideoMode],3,GUIMovieTextF4,9 - GUIDisplayButtonHoleTu 15,8,104,byte[MovieVideoMode],4,GUIMovieTextF5,0 - GUIDisplayButtonHoleTu 15,8,114,byte[MovieVideoMode],5,GUIMovieTextF6,0 - - GUIDisplayTextY 15,129,56,GUIMovieTextG ; Audio Section - GUIDisplayTextY 15,162,171,GUIMovieTextI - - cmp byte[MovieVideoMode],5 - je near .custom - GUIDisplayCheckboxu 15,130,62,MovieAudio,GUIMovieTextG1,5 - cmp byte[MovieAudio],1 - jne near .nomux -.custom - GUIDisplayCheckboxu 15,130,72,MovieAudioCompress,GUIMovieTextG2,2 - cmp byte[MovieVideoMode],2 - jl near .nomux - cmp byte[MovieVideoMode],5 - je near .nomux - GUIDisplayCheckboxu 15,130,82,MovieVideoAudio,GUIMovieTextG3,11 -.nomux - - DrawGUIButton 15,165,178,200,189,GUIMovieTextI1,34,0,0 - DrawGUIButton 15,206,178,235,189,GUIMovieTextI2,35,0,0 - - GUIDisplayTextY 15,8,127,GUIMovieTextH ; Video Section - GUIDisplayButtonHoleTu 15,8,135,byte[MovieForcedLengthEnabled],0,GUIMovieTextH1,0 - GUIDisplayButtonHoleTu 15,8,145,byte[MovieForcedLengthEnabled],1,GUIMovieTextH2,11 - GUIDisplayButtonHoleTu 15,8,155,byte[MovieForcedLengthEnabled],2,GUIMovieTextH3,0 - - GUIDisplayBBox 15,136,144,205,154,167 - - pushad - call GetMovieForcedLength - popad - - GUIOuttextwin2d 15,139,148,GUIMovieForcedText,10 -.nodumping - - ret - -SECTION .data - -GUIMovieTabs dd 1,1 - db 'CONTROLS',0 -GUIDumpingTab dd 0,1 - db 'DUMPING',0 - -GUIMovieTextA db 'SELECT MOVIE:',0 -GUIMovieTextA1 db ' ',0 - -GUIMovieTextB db 'RECORD FROM:',0 -GUIMovieTextB1 db 'NOW',0 -GUIMovieTextB2 db 'POWER',0 -GUIMovieTextB3 db 'RESET',0 -GUIMovieTextB4 db 'POWER+SRAM CLEAR',0 - -GUIMovieTextC1 db 'PLAY',0 -GUIMovieTextC2 db 'RECORD',0 -GUIMovieTextC3 db 'STOP',0 -GUIMovieTextC4 db 'APPEND',0 - -GUIMovieTextD db 'CHAPTERS:',0 -GUIMovieTextD1 db 'INSERT',0 -GUIMovieTextD2 db 'PREVIOUS',0 -GUIMovieTextD3 db 'NEXT',0 - -GUIMovieTextE db 'ON MOVIE STATE LOAD:',0 -GUIMovieTextE1 db 'DO NOT SWITCH MODES',0 -GUIMovieTextE2 db 'SWITCH TO RECORD',0 -GUIMovieTextE3 db 'SWITCH TO PLAYBACK',0 -GUIMovieTextE9 db 'DISPLAY FRAME COUNTER',0 - -GUIMovieTextF db 'VIDEO OPTIONS:',0 -GUIMovieTextF1 db 'NO VIDEO DUMP',0 -GUIMovieTextF2 db 'RAW VIDEO',0 -GUIMovieTextF3 db 'FFV1',0 -GUIMovieTextF4 db 'X264 LOSSLESS',0 -GUIMovieTextF5 db 'XVID LOSSLESS',0 -GUIMovieTextF6 db 'CUSTOM',0 - -GUIMovieTextG db 'AUDIO OPTIONS:',0 -GUIMovieTextG1 db 'DUMP AUDIO',0 -GUIMovieTextG2 db 'COMPRESS AUDIO',0 -GUIMovieTextG3 db 'MERGE WITH VIDEO',0 - -GUIMovieTextH db 'DUMPING LENGTH:',0 -GUIMovieTextH1 db 'ZMV LENGTH',0 -GUIMovieTextH2 db 'DUMP # OF FRAMES',0 -GUIMovieTextH3 db 'UNTIL STOP',0 - -GUIMovieTextI db 'DUMPING:',0 -GUIMovieTextI1 db 'START',0 -GUIMovieTextI2 db 'STOP',0 - -GUIMovieTextX1 db 'WARNING: THIS MOVIE',0 ; Overwrite Window -GUIMovieTextX2 db 'FILE ALREADY EXISTS',0 -GUIMovieTextX3 db 'OKAY TO OVERWRITE ?',0 -GUIMovieTextX4 db 'YES',0 -GUIMovieTextX5 db 'NO',0 - -GUIMovieTextZ db 'STATUS: ',0 - -NEWSYM CMovieExt, db 'v' - -SECTION .text - -; Key types: Up, Down, Left, Right, A, B, X, Y, L, R (Press/Relase/P+R) -; Frame delays: 1 frame, 2, 3, 4, 5, 1 sec., 2, 3 ,4 ,5 - -DisplayGUICombo: - mov eax,[GUIccombcursloc] - cmp [GUIccomblcursloc],eax - je .nolastcurschange - mov [GUIccomblcursloc],eax - ; copy contents into temporary variables - mov esi,[GUIccombcursloc] - shl esi,6 - add esi,[GUIccombcursloc] - add esi,[GUIccombcursloc] - add esi,CombinDataGlob - cmp byte[GUIComboGameSpec],0 - je .nogamespecb - sub esi,CombinDataGlob - add esi,CombinDataLocl -.nogamespecb - ; copy 20 bytes to GUIComboTextH - mov ecx,20 - mov edi,GUIComboTextH - rep movsb - ; copy 42 bytes to GUIComboData - mov ecx,42 - mov edi,GUIComboData - rep movsb - mov ax,[esi] - mov [GUIComboKey],ax - mov al,[esi+2] - mov [GUIComboPNum],al - mov al,[esi+3] - mov [GUIComboLHorz],al - ; determine length of combo data - mov eax,GUIComboData - xor ecx,ecx -.notfin - cmp byte[eax],0 - je .fin - inc eax - inc ecx - jmp .notfin -.fin - mov [GUINumCombo],cl -.nolastcurschange - - ; copy into data if description equal - mov esi,[GUIccombcursloc] - shl esi,6 - add esi,[GUIccombcursloc] - add esi,[GUIccombcursloc] - add esi,CombinDataGlob - cmp byte[GUIComboGameSpec],0 - je .nogamespecc - sub esi,CombinDataGlob - add esi,CombinDataLocl -.nogamespecc - mov ecx,20 - mov edi,GUIComboTextH -.comploop - mov al,[esi] - cmp al,[edi] - jne near .notequal - or al,al - jz .donecomp - inc esi - inc edi - dec ecx - jnz .comploop -.donecomp - call ComboClip - mov edi,[GUIccombcursloc] - shl edi,6 - add edi,[GUIccombcursloc] - add edi,[GUIccombcursloc] - add edi,CombinDataGlob - cmp byte[GUIComboGameSpec],0 - je .nogamespecd - sub edi,CombinDataGlob - add edi,CombinDataLocl -.nogamespecd - mov ecx,20 - mov esi,GUIComboTextH - rep movsb - ; copy 42 bytes to GUIComboData - mov ecx,42 - mov esi,GUIComboData - rep movsb - mov ax,[GUIComboKey] - mov [edi],ax - mov al,[GUIComboPNum] - mov [edi+2],al - mov al,[GUIComboLHorz] - mov [edi+3],al -.notequal - InitTextColor - - cmp byte[GUIWincoladd],0 - je .zero4 - mov byte[GUItextcolor],211 -.zero4 - - GUIDrawWindowBox 16,GUIComboDisp - - DrawBorderedBox 16,10,20,190,80,19 - DrawBorderedBox 16,37,91,157,99,90 - DrawBorderedBox 16,10,91,32,99,90 - DrawBorderedBox 16,10,110,220,146,109 - - ; Draw SlideBar - ; win#,X,Y start,List Loc,List size,# Lines,Bar Size(Y),UpArrowResource#,DownArrowRes# - DrawSlideBar 16,192,20,[GUIccombviewloc],[NumCombo],8,61,GUICSStC,13,14 - - ; Draw control boxes - DrawBorderedBoxB 16,75,150,85,157,149,251 - DrawBorderedBoxB 16,89,150,99,157,149,252 - DrawBorderedBoxB 16,103,150,113,157,149,253 - DrawBorderedBoxB 16,117,150,127,157,149,254 - DrawBorderedBoxB 16,131,150,141,157,149,'A' - DrawBorderedBoxB 16,145,150,155,157,149,'B' - DrawBorderedBoxB 16,159,150,169,157,149,'X' - DrawBorderedBoxB 16,173,150,183,157,149,'Y' - DrawBorderedBoxB 16,187,150,197,157,149,'L' - DrawBorderedBoxB 16,201,150,211,157,149,'R' - DrawBorderedBoxB2 16,215,150,227,157,149,'T' - DrawBorderedBoxB2 16,231,150,243,157,149,'L' - - DrawBorderedBoxB 16,75,160,85,167,159,251 - DrawBorderedBoxB 16,89,160,99,167,159,252 - DrawBorderedBoxB 16,103,160,113,167,159,253 - DrawBorderedBoxB 16,117,160,127,167,159,254 - DrawBorderedBoxB 16,131,160,141,167,159,'A' - DrawBorderedBoxB 16,145,160,155,167,159,'B' - DrawBorderedBoxB 16,159,160,169,167,159,'X' - DrawBorderedBoxB 16,173,160,183,167,159,'Y' - DrawBorderedBoxB 16,187,160,197,167,159,'L' - DrawBorderedBoxB 16,201,160,211,167,159,'R' - DrawBorderedBoxB2 16,215,160,227,167,159,'T' - DrawBorderedBoxB2 16,231,160,243,167,159,'L' - - DrawBorderedBoxB 16,75,170,85,177,169,251 - DrawBorderedBoxB 16,89,170,99,177,169,252 - DrawBorderedBoxB 16,103,170,113,177,169,253 - DrawBorderedBoxB 16,117,170,127,177,169,254 - DrawBorderedBoxB 16,131,170,141,177,169,'A' - DrawBorderedBoxB 16,145,170,155,177,169,'B' - DrawBorderedBoxB 16,159,170,169,177,169,'X' - DrawBorderedBoxB 16,173,170,183,177,169,'Y' - DrawBorderedBoxB 16,187,170,197,177,169,'L' - DrawBorderedBoxB 16,201,170,211,177,169,'R' - DrawBorderedBoxB2 16,215,170,227,177,169,'T' - DrawBorderedBoxB2 16,231,170,243,177,169,'L' - - DrawBorderedBoxB 16,10,189,20,196,188,'1' - DrawBorderedBoxB 16,24,189,34,196,188,'2' - DrawBorderedBoxB 16,38,189,48,196,188,'3' - DrawBorderedBoxB 16,52,189,62,196,188,'4' - DrawBorderedBoxB 16,66,189,76,196,188,'5' - DrawBorderedBoxB 16,80,189,90,196,188,'9' - - DrawBorderedBoxB 16,107,189,117,196,188,250 - DrawBorderedBoxB 16,121,189,131,196,188,'1' - DrawBorderedBoxB 16,135,189,145,196,188,'2' - DrawBorderedBoxB 16,149,189,159,196,188,'3' - DrawBorderedBoxB 16,163,189,173,196,188,'4' - DrawBorderedBoxB 16,177,189,187,196,188,'5' - - DrawBorderedBoxB 16,204,189,218,196,188,255 - - GUIDisplayText 16,10,13,GUIComboText1 ; Text - GUIDisplayText 16,138,13,GUIComboText2 - GUIDisplayText 16,38,84,GUIComboTextE - GUIDisplayText 16,10,84,GUIComboTextF - GUIDisplayText 16,10,103,GUIComboText4 - GUIDisplayText 16,10,152,GUIComboText5 - GUIDisplayText 16,10,162,GUIComboText6 - GUIDisplayText 16,10,172,GUIComboText7 - GUIDisplayText 16,10,182,GUIComboText8 - GUIDisplayText 16,114,182,GUIComboText9 - GUIDisplayText 16,204,182,GUIComboTextG - GUIDisplayText 16,145,85,GUIComboTextI - - DrawGUIButton 16,202,20,246,31,GUIComboTextA,60,-1,0 ; Buttons - DrawGUIButton 16,202,35,246,46,GUIComboTextB,61,-1,0 - DrawGUIButton 16,202,50,246,61,GUIComboTextC,62,-1,0 - DrawGUIButton 16,202,65,246,76,GUIComboTextD,63,-1,0 - - ; Calculate Text Cursor Position / Draw Box Text - xor eax,eax -.nozerocp - cmp byte[GUIComboTextH+eax],0 - je .zerocp - inc eax - jmp .nozerocp -.zerocp - mov [GUIComboPos],al - test byte[GUICCFlash],8 - jnz .nound - mov byte[GUIComboTextH+eax],'_' - mov byte[GUIComboTextH+eax+1],0 -.nound - GUIOuttextwin2c 16,39,94,GUIComboTextH - xor eax,eax - mov al,[GUIComboPos] - mov byte[GUIComboTextH+eax],0 - - ; Display Current Combo Key - mov eax,[GUIComboKey] - mov ebx,[ScanCodeListing+eax*3] - mov [GUIGameDisplayKy],ebx - mov byte[GUIGameDisplayKy+3],0 - GUIOuttextwin2c 16,14,94,GUIGameDisplayKy - - ; Buttons - mov byte[GUItextcolor],217 - cmp byte[GUIWincoladd],0 - je .zero20 - mov byte[GUItextcolor],211 -.zero20 - DrawGUIButton 16,202,20,246,31,GUIComboTextA,60,-1,0 - DrawGUIButton 16,202,35,246,46,GUIComboTextB,61,-1,0 - DrawGUIButton 16,202,50,246,61,GUIComboTextC,62,-1,0 - DrawGUIButton 16,202,65,246,76,GUIComboTextD,63,-1,0 - - ; Radio Switches - GUIDisplayButtonHole 16,158,82,byte[GUIComboPNum],0 - GUIDisplayButtonHole 16,176,82,byte[GUIComboPNum],1 - GUIDisplayButtonHole 16,194,82,byte[GUIComboPNum],2 - GUIDisplayButtonHole 16,212,82,byte[GUIComboPNum],3 - GUIDisplayButtonHole 16,230,82,byte[GUIComboPNum],4 - ; Checkboxes - GUIDisplayCheckbox 16,163,88,GUIComboLHorz,GUIComboTextJ - GUIDisplayCheckbox 16,163,96,GUIComboGameSpec,GUIComboTextK - - ; Draw Combination Keys (Each 15x11 -> 210x36) - xor eax,eax - mov al,[GUINumCombo] - or eax,eax - jz near .comboend - xor ebx,ebx - mov ecx,11 - mov edx,112 -.comboiconloop - push eax - mov al,[GUIComboData+ebx] - dec al - mov esi,GUIIconDataComboPressRelease - cmp al,12 - jb .doneicon - mov esi,GUIIconDataComboPress - sub al,12 - cmp al,12 - jb .doneicon - mov esi,GUIIconDataComboRelease - sub al,12 - cmp al,12 - jb .doneicon - mov esi,GUIIconDataComboFrame - cmp al,17 - jne .not9 - mov al,20 - jmp .doneicon -.not9 - cmp al,18 - jb .doneicon - sub al,7 - mov esi,GUIIconDataComboSecond - cmp al,11 - jne .notback - mov al,250-37 - jmp .doneicon -.notback -.doneicon - cmp al,11 - jbe .control - add al,37 -.control - DetermineChar 0,251 - DetermineChar 1,252 - DetermineChar 2,253 - DetermineChar 3,254 - DetermineChar 4,'A' - DetermineChar 5,'B' - DetermineChar 6,'X' - DetermineChar 7,'Y' - DetermineChar 8,'L' - DetermineChar 9,'R' - DetermineChar 10,'T' - DetermineChar 11,'E' - mov [GUIComboText3],al - pushad - mov eax,edx - add ecx,8 - add eax,5 - - mov byte[GUItextcolor],223 - push ecx - push eax - GUIOuttextwin2 16,ecx,eax,GUIComboText3 - pop eax - pop ecx - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je .zerocol - mov byte[GUItextcolor],222 -.zerocol - dec ecx - dec eax - GUIOuttextwin2 16,ecx,eax,GUIComboText3 - - popad - push ecx - push edx - push ebx - GUIDisplayIconWin 16,ecx,edx,esi - pop ebx - pop edx - pop ecx - pop eax - add ecx,15 - cmp ecx,11+15*14 - jne .notoverflowx - sub ecx,15*14 - add edx,11 -.notoverflowx - inc ebx - dec eax - jnz near .comboiconloop -.comboend - - ; Display Bordered Box - cmp dword[NumCombo],0 - je near .nowinbox - mov ebx,[GUIccombcursloc] - sub ebx,[GUIccombviewloc] - mov eax,ebx - lea ebx,[ebx*8] - sub ebx,eax - add ebx,23 - DrawGUIWinBox2 16,10,190,7,224 -.nowinbox - - ; Display Scroll Lines - ; Copy Description to GUIScrolBufA, Others to GUIScrolBufB - mov edi,[GUIccombviewloc] - shl edi,6 - add edi,[GUIccombviewloc] - add edi,[GUIccombviewloc] - add edi,CombinDataGlob - cmp byte[GUIComboGameSpec],0 - je .nogamespec - sub edi,CombinDataGlob - add edi,CombinDataLocl -.nogamespec - - mov ecx,12 - mov eax,25 - mov ebx,[NumCombo] - sub ebx,[GUIccombviewloc] - cmp ebx,0 - jle near .noscrolldisplay - cmp ebx,8 - jbe .scrolloop - mov ebx,8 -.scrolloop - push ebx - push edi - push eax - - xor eax,eax - mov ax,[edi+62] - mov eax,[ScanCodeListing+eax*3] - mov [GUIScrolBufB],eax - mov byte[GUIScrolBufB+3],32 - mov dword[GUIScrolBufB+4],20202020h - mov al,[edi+64] - add al,49 - mov [GUIScrolBufB+4],al - mov byte[GUIScrolBufB+7],'N' - cmp byte[edi+65],0 - je .yesnoff - mov byte[GUIScrolBufB+7],'Y' -.yesnoff - mov bl,20 - mov eax,GUIScrolBufA -.scloopb - mov bh,[edi] - mov [eax],bh - inc edi - inc eax - dec bl - jnz .scloopb - pop eax - - mov byte[GUItextcolor],223 - push ecx - push eax - GUIOuttextwin2 16,ecx,eax,GUIScrolBufA - pop eax - pop ecx - push ecx - push eax - add ecx,128 - GUIOuttextwin2 16,ecx,eax,GUIScrolBufB - pop eax - pop ecx - mov byte[GUItextcolor],221 - cmp byte[GUIWincoladd],0 - je .zerocolb - mov byte[GUItextcolor],222 -.zerocolb - push ecx - push eax - dec ecx - dec eax - push ecx - push eax - GUIOuttextwin2 16,ecx,eax,GUIScrolBufA - pop eax - pop ecx - add ecx,128 - GUIOuttextwin2 16,ecx,eax,GUIScrolBufB - pop eax - pop ecx - pop edi - pop ebx - add eax,7 - add edi,66 - dec ebx - jnz near .scrolloop -.noscrolldisplay - ret - -SECTION .bss -GUIccombviewloc resd 1 -GUIccombcursloc resd 1 -GUIccomblcursloc resd 1 -NEWSYM NumCombo, resd 1 -NEWSYM NumComboGlob, resd 1 -NEWSYM NumComboLocl, resd 1 -GUICSStC resd 3 -GUIComboKey resd 1 -GUIComboPos resb 1 -GUIComboPNum resb 1 -GUIComboLHorz resb 1 -NEWSYM GUINumCombo, resb 1 -GUIComboData resb 50 -GUIScrolBufA resb 21 -GUIScrolBufB resb 10 - -SECTION .data -GUIComboText1 db 'DESCRIPTION',0 -GUIComboText2 db 'KEY P# LH',0 -GUIComboText3 db ' ',0 -GUIComboText3b db 'S ',0 -GUIComboText4 db 'COMBINATION KEYS:',0 -GUIComboText5 db 'PRESS+REL',0 -GUIComboText6 db 'PRESS ONLY',0 -GUIComboText7 db 'REL ONLY',0 -GUIComboText8 db 'FRAME DELAY',0 -GUIComboText9 db 'SECOND DELAY',0 -GUIComboTextA db 'CLEAR',0 -GUIComboTextB db 'ADD',0 -GUIComboTextC db 'REPLACE',0 -GUIComboTextD db 'DELETE',0 -GUIComboTextE db 'DESCRIPTION:',0 -GUIComboTextF db 'KEY:',0 -GUIComboTextG db 'DEL',0 -GUIComboTextH db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -GUIComboTextI db 'P# 1 2 3 4 5',0 -GUIComboTextJ db 254,' = LAST ',253,'/',254,0 -GUIComboTextK db 'GAME SPECFIC',0 - -GUIIconDataComboPressRelease: - db 0 ,166,0 ,0 ,166,0 ,0 ,0 ,0 ,0 - db 0 ,166,0 ,166,166,166,0 ,0 ,0 ,0 - db 0 ,166,0 ,0 ,166,0 ,0 ,0 ,0 ,0 - db 166,166,166,0 ,166,0 ,0 ,0 ,0 ,0 - db 0 ,166,0 ,0 ,166,0 ,0 ,0 ,0 ,0 - db 0 ,234,234,234,234,0 ,0 ,0 ,0 ,0 - db 234,234,234,234,234,234,0 ,0 ,0 ,0 - db 234,234,234,234,234,234,0 ,0 ,0 ,0 - db 235,234,234,234,234,235,0 ,0 ,0 ,0 - db 0 ,235,235,235,235,0 ,0 ,0 ,0 ,0 - -GUIIconDataComboPress: - db 0 ,0 ,166,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,166,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,166,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,166,166,166,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,166,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,236,236,236,236,0 ,0 ,0 ,0 ,0 - db 236,236,236,236,236,236,0 ,0 ,0 ,0 - db 236,236,236,236,236,236,0 ,0 ,0 ,0 - db 237,236,236,236,236,237,0 ,0 ,0 ,0 - db 0 ,237,237,237,237,0 ,0 ,0 ,0 ,0 - -GUIIconDataComboRelease: - db 0 ,0 ,0 ,166,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,166,166,166,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,166,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,166,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,166,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,238,238,238,238,0 ,0 ,0 ,0 ,0 - db 238,238,238,238,238,238,0 ,0 ,0 ,0 - db 238,238,238,238,238,238,0 ,0 ,0 ,0 - db 239,238,238,238,238,239,0 ,0 ,0 ,0 - db 0 ,239,239,239,239,0 ,0 ,0 ,0 ,0 - -GUIIconDataComboFrame: - db 0 ,0 ,0 ,0 ,58 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,56 ,46 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,54 ,44 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,52 ,0 ,42 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,50 ,40 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,48 ,38 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,46 ,36 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,44 ,0 ,34 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,42 ,32 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,40 ,32 ,0 ,0 ,0 ,0 ,0 ,0 - -GUIIconDataComboSecond: - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,51 ,45 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,51 ,45 ,0 ,0 ,0 ,0 ,0 ,0 - db 0 ,54 ,52 ,48 ,46 ,0 ,0 ,0 ,0 ,0 - db 53 ,46 ,50 ,50 ,48 ,45 ,0 ,0 ,0 ,0 - db 52 ,50 ,45 ,48 ,46 ,44 ,0 ,0 ,0 ,0 - db 51 ,50 ,50 ,46 ,50 ,43 ,0 ,0 ,0 ,0 - db 50 ,50 ,50 ,50 ,50 ,42 ,0 ,0 ,0 ,0 - db 0 ,48 ,46 ,44 ,42 ,0 ,0 ,0 ,0 ,0 - db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 - -SECTION .text - -EEMode: - pushad - call GetTime - cmp eax,360 - popad - ja .noEE - mov eax,1 - ret -.noEE - mov eax,0 - ret - -DisplayGUIAddOns: ;Select Special Controllers - GUIDrawWindowBox 17,GUIAddOnsDisp - - call EEMode - cmp eax,0 - je near .noEE ;You know it! - - push eax - push ebx - push ecx - mov eax,GUIAddOnEETopBar - mov ebx,GUIAddOnsDisp -.loopA - mov cl,[eax] - mov [ebx],cl - inc eax - inc ebx - cmp cl,0 - jne .loopA - pop ecx - pop ebx - pop eax - - GUIDisplayText 17,20,15,GUIAddOnText1Alt - GUIDisplayText 17,112,15,GUIAddOnText2Alt - - GUIDisplayButtonHoleTu 17,9,23,byte[device1],0,GUIAddOnText3Alt,0 - GUIDisplayButtonHoleTu 17,9,33,byte[device1],1,GUIAddOnText4Alt,0 - - GUIDisplayButtonHoleTu 17,100,23,byte[device2],0,GUIAddOnText3Alt,1 - GUIDisplayButtonHoleTu 17,100,33,byte[device2],1,GUIAddOnText4Alt,1 - GUIDisplayButtonHoleTu 17,100,43,byte[device2],2,GUIAddOnText5Alt,0 - GUIDisplayButtonHoleTu 17,100,53,byte[device2],3,GUIAddOnText6Alt,0 - GUIDisplayButtonHoleTu 17,100,63,byte[device2],4,GUIAddOnText7Alt,0 - - GUIDisplayText 17,12,78,GUIAddOnText8Alt - GUIDisplayText 17,103,78,GUIAddOnText9Alt - - GUIDisplayCheckboxu 17,9,83,mouse1lh,GUIAddOnTextDAlt,0 - GUIDisplayCheckboxu 17,100,83,mouse2lh,GUIAddOnTextDAlt,1 - - GUIDisplayTextY 17,12,100,GUIAddOnTextAAlt - GUIDisplayText 17,12,110,GUIAddOnTextBAlt - GUIDisplayText 17,103,110,GUIAddOnTextCAlt - jmp .endEE -.noEE ;Regular - - push eax - push ebx - push ecx - mov eax,GUIAddOnsDispEE - mov ebx,GUIAddOnsDisp -.loopB - mov cl,[eax] - mov [ebx],cl - inc eax - inc ebx - cmp cl,0 - jne .loopB - pop ecx - pop ebx - pop eax - - GUIDisplayTextY 17,20,15,GUIAddOnText1 - GUIDisplayTextY 17,112,15,GUIAddOnText2 - - GUIDisplayButtonHoleTu 17,9,23,byte[device1],0,GUIAddOnText3,0 - GUIDisplayButtonHoleTu 17,9,33,byte[device1],1,GUIAddOnText4,0 - - GUIDisplayButtonHoleTu 17,100,23,byte[device2],0,GUIAddOnText3,1 - GUIDisplayButtonHoleTu 17,100,33,byte[device2],1,GUIAddOnText4,1 - GUIDisplayButtonHoleTu 17,100,43,byte[device2],2,GUIAddOnText5,0 - GUIDisplayButtonHoleTu 17,100,53,byte[device2],3,GUIAddOnText6,0 - GUIDisplayButtonHoleTu 17,100,63,byte[device2],4,GUIAddOnText7,0 - - GUIDisplayText 17,12,78,GUIAddOnText8 - GUIDisplayText 17,103,78,GUIAddOnText9 - - GUIDisplayCheckboxu 17,9,83,mouse1lh,GUIAddOnTextD,0 - GUIDisplayCheckboxu 17,100,83,mouse2lh,GUIAddOnTextD,1 - - GUIDisplayTextY 17,12,100,GUIAddOnTextA - GUIDisplayText 17,12,110,GUIAddOnTextB - GUIDisplayText 17,103,110,GUIAddOnTextC -.endEE - DDrawBox 17,73,75,[KeyExtraEnab1] - DDrawBox 17,164,75,[KeyExtraEnab2] - - DDrawBox 17,73,107,[SSAutoFire] - DDrawBox 17,164,107,[SSPause] - ret - -SECTION .data -GUIAddOnText1 db 'PORT 1:',0 -GUIAddOnText2 db 'PORT 2:',0 -GUIAddOnText3 db 'GAMEPAD',0 -GUIAddOnText4 db 'MOUSE',0 -GUIAddOnText5 db 'SUPER SCOPE',0 -GUIAddOnText6 db '1 JUSTIFIER',0 -GUIAddOnText7 db '2 JUSTIFIERS',0 -GUIAddOnText8 db 'CYCLE P1:',0 -GUIAddOnText9 db 'CYCLE P2:',0 -GUIAddOnTextA db 'SUPER SCOPE KEYS:',0 -GUIAddOnTextB db 'AUTO-FIRE',0 -GUIAddOnTextC db 'SS PAUSE',0 -GUIAddOnTextD db 'LEFT HANDED',0 - -;EE -GUIAddOnText1Alt db 83,76,79,84,32,49,58,0 -GUIAddOnText2Alt db 83,76,79,84,32,50,58,0 -GUIAddOnText3Alt db 79,70,70,0 -GUIAddOnText4Alt db 87,72,73,84,69,32,66,82,69,65,68,0 -GUIAddOnText5Alt db 82,89,69,32,66,82,69,65,68,0 -GUIAddOnText6Alt db 87,72,69,65,84,32,66,82,69,65,68,0 -GUIAddOnText7Alt db 69,78,71,76,73,83,72,32,77,85,70,70,73,78,0 -GUIAddOnText8Alt db 80,79,80,32,84,65,82,84,0 -GUIAddOnText9Alt db 87,65,70,70,76,69,0 -GUIAddOnTextAAlt db 67,79,70,70,69,69,63,0 -GUIAddOnTextBAlt db 67,82,69,65,77,0 -GUIAddOnTextCAlt db 83,85,71,65,82,0 -GUIAddOnTextDAlt db 81,85,73,67,75,32,84,79,65,83,84,0 -GUIAddOnEETopBar db 84,79,65,83,84,69,82,32,79,80,84,73,79,78,83,0 - -SECTION .text - -DisplayGUIChipConfig: - GUIDrawWindowBox 18,GUIChipConfigDisp - - call EEMode ; You know it! - cmp eax,0 - je near .noEE - GUIDisplayText 18,10,38,GUIChipText1Alt - GUIDisplayCheckbox 18,9,43,nssdip1,GUIChipText2Alt - GUIDisplayCheckbox 18,59,43,nssdip2,GUIChipText3Alt - GUIDisplayCheckbox 18,109,43,nssdip3,GUIChipText4Alt - GUIDisplayCheckbox 18,9,53,nssdip4,GUIChipText5Alt - GUIDisplayCheckbox 18,59,53,nssdip5,GUIChipText6Alt - GUIDisplayCheckbox 18,109,53,nssdip6,GUIChipText7Alt - jmp .endEE -.noEE ; Regular Shadow - GUIDisplayTextY 18,10,38,GUIChipTextA - GUIDisplayCheckboxu 18,9,43,nssdip1,GUIChipTextA1,4 ;Checkboxes - GUIDisplayCheckboxu 18,59,43,nssdip2,GUIChipTextA2,4 - GUIDisplayCheckboxu 18,109,43,nssdip3,GUIChipTextA3,4 - GUIDisplayCheckboxu 18,9,53,nssdip4,GUIChipTextA4,4 - GUIDisplayCheckboxu 18,59,53,nssdip5,GUIChipTextA5,4 - GUIDisplayCheckboxu 18,109,53,nssdip6,GUIChipTextA6,4 -.endEE - ret - -SECTION .data -GUIChipTextA db 'SUPER SYSTEM:',0 -GUIChipTextA1 db 'DIP 1',0 -GUIChipTextA2 db 'DIP 2',0 -GUIChipTextA3 db 'DIP 3',0 -GUIChipTextA4 db 'DIP 4',0 -GUIChipTextA5 db 'DIP 5',0 -GUIChipTextA6 db 'DIP 6',0 - -;EE -GUIChipText1Alt db 69,88,84,82,65,83,0 -GUIChipText2Alt db 83,65,76,84,0 -GUIChipText3Alt db 71,65,82,76,73,67,0 -GUIChipText4Alt db 80,69,80,80,69,82,0 -GUIChipText5Alt db 67,72,69,69,83,69,0 -GUIChipText6Alt db 66,85,84,84,69,82,0 -GUIChipText7Alt db 67,65,84,83,85,80,0 - -SECTION .text - -BlinkCursorCheck: - cmp dword[GUIInputBox],0 - jne .checkboxes - mov ebx,0 - ret -.checkboxes - cmp dword[GUIInputBox],1 - jne .notBox1 - mov ebx,SRAMPath - ret -.notBox1 - cmp dword[GUIInputBox],2 - jne .notBox2 - mov ebx,SnapPath - ret -.notBox2 - cmp dword[GUIInputBox],3 - jne .notBox3 - mov ebx,SPCPath - ret -.notBox3 - cmp dword[GUIInputBox],4 - jne .notBox4 - mov ebx,BSXPath - ret -.notBox4 - cmp dword[GUIInputBox],5 - jne .notBox5 - mov ebx,SGPath - ret -.notBox5 - cmp dword[GUIInputBox],6 - jne .notBox6 - mov ebx,STPath - ret -.notBox6 - cmp dword[GUIInputBox],7 - jne .notBox7 - mov ebx,GNextPath - ret -.notBox7 - cmp dword[GUIInputBox],8 - jne .notBox8 - mov ebx,FEOEZPath - ret -.notBox8 - cmp dword[GUIInputBox],9 - jne .notBox9 - mov ebx,SJNSPath - ret -.notBox9 - cmp dword[GUIInputBox],10 - jne .notBox10 - mov ebx,MDHPath - ret -.notBox10 - cmp dword[GUIInputBox],11 - jne .notBox11 - mov ebx,SPL4Path -.notBox11 -%ifndef __MSDOS__ - cmp dword[GUIInputBox],12 - jne .notBox12 - mov ebx,GUICustomX - ret -.notBox12 - cmp dword[GUIInputBox],13 - jne .notBox13 - mov ebx,GUICustomY -.notBox13 -%endif - cmp dword[GUIInputBox],14 - jne .notBox14 - mov ebx,GUIMovieForcedText -.notBox14 - ret - -DisplayGUIPaths: - GUIDrawWindowBox 19,GUIPathsDisp - - GUIDisplayText 19,8,18,GUIPathsText1 ; Text - GUIDisplayText 19,8,38,GUIPathsText2 - GUIDisplayText 19,8,58,GUIPathsText3 - GUIDisplayText 19,60,78,GUIPathsText4 - GUIDisplayText 19,8,88,GUIPathsText5 - GUIDisplayText 19,135,88,GUIPathsText6 - GUIDisplayText 19,8,113,GUIPathsText8 - GUIDisplayText 19,135,113,GUIPathsText7 - GUIDisplayText 19,45,138,GUIPathsText9 - GUIDisplayText 19,8,148,GUIPathsTextA - GUIDisplayText 19,135,148,GUIPathsTextB - GUIDisplayText 19,8,173,GUIPathsTextC - GUIDisplayText 19,135,173,GUIPathsTextD - - GUIDisplayBBox 19,75,15,231,25,167 ;Input boxes - GUIDisplayBBox 19,75,35,231,45,167 - GUIDisplayBBox 19,75,55,231,65,167 - GUIDisplayBBox 19,8,95,106,105,167 - GUIDisplayBBox 19,8,120,106,130,167 - GUIDisplayBBox 19,135,95,235,105,167 - GUIDisplayBBox 19,135,120,235,130,167 - GUIDisplayBBox 19,8,155,106,165,167 - GUIDisplayBBox 19,8,180,106,190,167 - GUIDisplayBBox 19,135,155,235,165,167 - GUIDisplayBBox 19,135,180,235,190,167 - - GUIOuttextwin2d 19,77,19,SRAMPath,25 ; Green Text - GUIOuttextwin2d 19,77,39,SnapPath,25 - GUIOuttextwin2d 19,77,59,SPCPath,25 - GUIOuttextwin2d 19,10,99,BSXPath,15 - GUIOuttextwin2d 19,10,124,SGPath,15 - GUIOuttextwin2d 19,137,99,STPath,15 - GUIOuttextwin2d 19,137,124,GNextPath,15 - GUIOuttextwin2d 19,10,159,FEOEZPath,15 - GUIOuttextwin2d 19,10,184,MDHPath,15 - GUIOuttextwin2d 19,137,159,SJNSPath,15 - GUIOuttextwin2d 19,137,184,SPL4Path,15 - ret - -SECTION .data -GUIPathsText1 db 'SAVES:',0 -GUIPathsText2 db 'SNAPSHOTS:',0 -GUIPathsText3 db 'SPCS:',0 -GUIPathsText4 db '--BIOS/BASE CARTS--',0 -GUIPathsText5 db 'BS-X:',0 -GUIPathsText6 db 'SUFAMI TURBO:',0 -GUIPathsText7 db 'SD GUNDAM G-NEXT:',0 -GUIPathsText8 db 'SAME GAME:',0 -GUIPathsText9 db '--SPC7110 GRAPHIC PACKS--',0 -GUIPathsTextA db 'FEOEZ:',0 -GUIPathsTextB db 'FEOEZ - SJNS:',0 -GUIPathsTextC db 'MDH:',0 -GUIPathsTextD db 'SPL4:',0 -GUIBlinkCursor db 0,0 -GUIBlinkCursorLoop db 0 - -SECTION .text - -DisplayGUISave: ;Save & Rewind options/Hotkeys - GUIDrawWindowBox 20,GUISaveDisp - - GUIDisplayText 20,8,19,GUISaveTextA1 ; Text - GUIDisplayText 20,8,31,GUISaveTextA2 - GUIDisplayText 20,9,159,GUISaveTextC2 - GUIDisplayText 20,9+57,159,GUISaveTextC3 - GUIDisplayText 20,9+114,159,GUISaveTextC4 - GUIDisplayText 20,9,168,GUISaveTextC5 - - GUIDisplayTextY 20,6,123,GUISaveTextC - mov byte[GUISaveTextC1+2],'0' - GUIDisplayText 20,9,132,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'1' - GUIDisplayText 20,9+45,132,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'2' - GUIDisplayText 20,9+45*2,132,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'3' - GUIDisplayText 20,9+45*3,132,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'4' - GUIDisplayText 20,9,141,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'5' - GUIDisplayText 20,9+45,141,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'6' - GUIDisplayText 20,9+45*2,141,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'7' - GUIDisplayText 20,9+45*3,141,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'8' - GUIDisplayText 20,9,150,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'9' - GUIDisplayText 20,9+45,150,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'+' - GUIDisplayText 20,9+45*2,150,GUISaveTextC1 - mov byte[GUISaveTextC1+2],'-' - GUIDisplayText 20,9+45*3,150,GUISaveTextC1 - - GUIDisplayCheckboxu 20,11,38,nosaveSRAM,GUISaveTextB1,0 - cmp byte[nosaveSRAM],0 - jne near .nosavesram - GUIDisplayCheckboxu 20,11,48,SRAMSave5Sec,GUISaveTextB2,5 ;Checkboxes -.nosavesram - GUIDisplayCheckboxu 20,11,58,SRAMState,GUISaveTextB3,0 - GUIDisplayCheckboxu 20,11,68,LatestSave,GUISaveTextB4,0 - GUIDisplayCheckboxu 20,11,78,AutoIncSaveSlot,GUISaveTextB5,5 - GUIDisplayCheckboxu 20,11,88,AutoState,GUISaveTextB6,0 - GUIDisplayCheckboxu 20,11,98,PauseLoad,GUISaveTextB7,0 - GUIDisplayCheckboxu 20,11,108,PauseRewind,GUISaveTextB8,12 - - GUIDisplayBBox 20,150,17,165,24,167 ; Rewind States Box - mov ah,[RewindStates] - mov al,48 - add ah,48 -.asciiloop - cmp ah,58 - jb .hex2asciidone - inc al - sub ah,10 - jmp .asciiloop -.hex2asciidone - mov [GUISaveTextZ3],ax - GUIDisplayTextG 20,154,19,GUISaveTextZ3 - - GUIDisplayBBox 20,150,29,165,36,167 ; Second/Rewind Box - mov ah,[RewindFrames] - mov al,48 - add ah,48 -.asciiloop2 - cmp ah,58 - jb .hex2asciidone2 - inc al - sub ah,10 - jmp .asciiloop2 -.hex2asciidone2 - mov [GUISaveTextZ3],ax - GUIDisplayTextG 20,154,31,GUISaveTextZ3 - - DDrawBox 20,26,129,[KeyStateSlc0] ; Boxes for State section - DDrawBox 20,71,129,[KeyStateSlc1] - DDrawBox 20,116,129,[KeyStateSlc2] - DDrawBox 20,161,129,[KeyStateSlc3] - DDrawBox 20,26,138,[KeyStateSlc4] - DDrawBox 20,71,138,[KeyStateSlc5] - DDrawBox 20,116,138,[KeyStateSlc6] - DDrawBox 20,161,138,[KeyStateSlc7] - DDrawBox 20,26,147,[KeyStateSlc8] - DDrawBox 20,71,147,[KeyStateSlc9] - DDrawBox 20,116,147,[KeyIncStateSlot] - DDrawBox 20,161,147,[KeyDecStateSlot] - DDrawBox 20,32,156,[KeySaveState] - DDrawBox 20,89,156,[KeyLoadState] - DDrawBox 20,146,156,[KeyStateSelct] - DDrawBox 20,45,165,[KeyRewind] - - mov byte[GUItextcolor],217 ;Buttons - cmp byte[GUIWincoladd],0 - je .zero - mov byte[GUItextcolor],211 -.zero - DrawGUIButton 20,173,17,181,25,GUISaveTextZ1,70,-2,-1 ; + Rewind States - DrawGUIButton 20,184,17,192,25,GUISaveTextZ2,71,-2,-1 ; - Rewind States - DrawGUIButton 20,173,29,181,37,GUISaveTextZ1,72,-2,-1 ; + Second/Rewind - DrawGUIButton 20,184,29,192,37,GUISaveTextZ2,73,-2,-1 ; - Second/Rewind - ret - -SECTION .data -GUISaveTextA1 db '# OF REWIND STATES',0 -GUISaveTextA2 db '1/5 SECONDS PER REWIND',0 - -GUISaveTextB1 db 'DO NOT SAVE SRAM',0 -GUISaveTextB2 db 'SRAM CHECK+SAVE',0 -GUISaveTextB3 db 'LOAD SAVESTATE W/SRAM',0 -GUISaveTextB4 db 'START AT LATEST SAVE',0 -GUISaveTextB5 db 'AUTO INCREMENT SAVE SLOT',0 -GUISaveTextB6 db 'AUTO STATE SAVE/LOAD',0 -GUISaveTextB7 db 'PAUSE AFTER LOADING STATE',0 -GUISaveTextB8 db 'PAUSE AFTER REWIND',0 - -GUISaveTextC db 'STATE SHORTCUTS:',0 -GUISaveTextC1 db 'ST#',0 ; Used for numbers 0-9 and +/- -GUISaveTextC2 db 'SAVE',0 -GUISaveTextC3 db 'LOAD',0 -GUISaveTextC4 db 'PICK',0 -GUISaveTextC5 db 'REWIND',0 - -GUISaveTextZ1 db '+',0 -GUISaveTextZ2 db '-',0 -GUISaveTextZ3 db ' ',0 - -SECTION .text - -%macro SpdslidSet 1 ; slider var - mov al,[%1] - shl eax,1 -%endmacro - -%macro SpdslidText 2 ; slider var, text - mov dword[%2],0 - mov esi,%2+2 - mov al,[%1] ; currently emuspeed ranges from 0 to 58 - mov bl,10 - cmp al,29 ; this will turn it into '/30' to '30x' - jb %%slowmo - mov byte[esi],'x' ; adds 'x' after the ff value - sub al,28 - jmp %%asciilp -%%slowmo - inc esi - mov byte[%2],1 ; slomo indicator - mov al,30 - sub al,[%1] -%%asciilp ; turns decimal into ascii - dec esi - xor ah,ah - div bl - add ah,48 - mov [esi],ah - cmp al,0 - jne %%asciilp - cmp byte[%2],1 - jne %%done - dec esi - mov byte[esi],'/' ; adds '/' before the slomo value -%%done -%endmacro - -DisplayGUISpeed: ;Speed Options - GUIDrawWindowBox 21,GUISpeedDisp - - cmp byte[frameskip],0 - jne near .noautoshad - GUIDisplayText 21,6,15,GUISpeedTextA1 - GUIDisplayText 21,40,79,GUISpeedTextB3 - GUIDisplayText 21,40,99,GUISpeedTextB5 - GUIDisplayTextY 21,8,164,GUISpeedTextD - jmp near .endautoshad -.noautoshad - GUIDisplayText 21,6,15,GUISpeedTextA1b - GUIDisplayText 21,40,79,GUISpeedTextB3b - GUIDisplayText 21,40,99,GUISpeedTextB5b -.endautoshad - GUIDisplayText 21,6,26,GUISpeedTextA2 - GUIDisplayText 21,6,37,GUISpeedTextA3 - - GUIDisplayTextY 21,8,49,GUISpeedTextB - GUIDisplayText 21,40,59,GUISpeedTextB1 - GUIDisplayText 21,40,69,GUISpeedTextB2 - GUIDisplayText 21,40,89,GUISpeedTextB4 - GUIDisplayText 21,40,109,GUISpeedTextB6 - GUIDisplayText 21,40,119,GUISpeedTextB7 - - cmp byte[frameskip],0 ; Shortcut Boxes - jne near .frate - DDrawBox 21,10,76,[KeyEmuSpeedUp] - DDrawBox 21,10,96,[KeyEmuSpeedDown] - jmp near .endsc -.frate - DDrawBox 21,10,76,[KeyFRateUp] - DDrawBox 21,10,96,[KeyFRateDown] -.endsc - DDrawBox 21,10,56,[KeyFastFrwrd] - DDrawBox 21,10,66,[KeySlowDown] - DDrawBox 21,10,86,[KeyResetSpeed] - DDrawBox 21,10,106,[EMUPauseKey] - DDrawBox 21,10,116,[INCRFrameKey] - - GUIDisplayCheckboxu 21,11,135,FastFwdToggle,GUISpeedTextC1,0 - GUIDisplayCheckboxun 21,11,145,frameskip,0,GUISpeedTextC2,0 - - GUIDisplayBBox 21,96,24,114,31,167 ; FF Ratio Box - mov ah,[FFRatio] - add ah,2 - mov al,48 - add ah,48 -.asciiloop - cmp ah,58 - jb .hex2asciidone - inc al - sub ah,10 - jmp .asciiloop -.hex2asciidone - cmp al,48 - jne .yestens - mov al,32 -.yestens - mov [GUISpeedTextZ3],ax - GUIDisplayTextG 21,101,26,GUISpeedTextZ3 - - GUIDisplayBBox 21,96,35,114,42,167 ; SD Ratio Box - mov ah,[SDRatio] - add ah,2 - mov al,48 - add ah,48 -.asciiloop2 - cmp ah,58 - jb .hex2asciidone2 - inc al - sub ah,10 - jmp .asciiloop2 -.hex2asciidone2 - cmp al,48 - jne .yestens2 - mov al,32 -.yestens2 - mov [GUISpeedTextZ3],ax - GUIDisplayTextG 21,101,37,GUISpeedTextZ3 - - mov byte[GUItextcolor],217 ;Buttons - cmp byte[GUIWincoladd],0 - je .zero88 - mov byte[GUItextcolor],211 -.zero88 - DrawGUIButton 21,118,24,126,32,GUISaveTextZ1,74,-2,-1 ; + Rewind States - DrawGUIButton 21,129,24,137,32,GUISaveTextZ2,75,-2,-1 ; - Rewind States - DrawGUIButton 21,118,35,126,43,GUISaveTextZ1,76,-2,-1 ; + Second/Rewind - DrawGUIButton 21,129,35,137,43,GUISaveTextZ2,77,-2,-1 ; - Second/Rewind - - cmp byte[frameskip],0 - jne near .noslider - GUIDrawSlider 21,7,116,175,EmuSpeed,GUISpeedTextD1,SpdslidSet,SpdslidText -.noslider - cmp byte[frameskip],0 ; Determine if AutoFR is enabled - je near .auto - - GUIDisplayBBox 21,96,13,114,20,167 ; Non AFR FrameRate +/- Box - mov al,[frameskip] - add al,47 - mov [GUISpeedTextX],al - GUIDisplayTextG 21,107,15,GUISpeedTextX - - mov byte[GUItextcolor],217 - cmp byte[GUIWincoladd],0 - je .zero6 - mov byte[GUItextcolor],211 -.zero6 - DrawGUIButton 21,118,13,126,21,GUISpeedTextY,78,-2,-1 - DrawGUIButton 21,129,13,137,21,GUISpeedTextZ,79,-2,-1 - jmp .ratioborders - -.auto ; AFR Max Frameskip +/- Box - GUIDisplayBBox 21,96,13,114,20,167 - mov al,[maxskip] - add al,48 - mov [GUISpeedTextX],al - GUIDisplayTextG 21,107,15,GUISpeedTextX - - mov byte[GUItextcolor],217 - cmp byte[GUIWincoladd],0 - je .zero5 - mov byte[GUItextcolor],211 -.zero5 - DrawGUIButton 21,118,13,126,21,GUISpeedTextY,78,-2,-1 - DrawGUIButton 21,129,13,137,21,GUISpeedTextZ,79,-2,-1 -.ratioborders - ret - -SECTION .data -GUISpeedTextA1 db 'MAX FRAME SKIP',0 -GUISpeedTextA1b db 'FRAME RATE',0 -GUISpeedTextA2 db 'FASTFWD RATIO x',0 -GUISpeedTextA3 db 'SLOWDWN RATIO /',0 - -GUISpeedTextB db 'SHORTCUTS:',0 -GUISpeedTextB1 db 'FAST FORWARD',0 -GUISpeedTextB2 db 'SLOW DOWN',0 -GUISpeedTextB3 db '+ EMU SPEED',0 -GUISpeedTextB3b db '+ FRAME RATE',0 -GUISpeedTextB4 db 'RESET SPEED',0 -GUISpeedTextB5 db '- EMU SPEED',0 -GUISpeedTextB5b db '- FRAME RATE',0 -GUISpeedTextB6 db 'PAUSE GAME',0 -GUISpeedTextB7 db 'INCR FRAME',0 - -GUISpeedTextC1 db 'TOGGLED FFWD/SLWDWN',0 -GUISpeedTextC2 db 'AUTO FRAME RATE',0 - -GUISpeedTextD db 'EMU SPEED:',0 -GUISpeedTextD1 db '---',0 - -GUISpeedTextZ3 db '--',0 -GUISpeedTextX db '-',0 -GUISpeedTextY db '+',0 -GUISpeedTextZ db '-',0 - -;General data -GUILoadDisp db 'LOAD GAME',0 -GUIResetDisp db 'RESET GAME',0 -GUIStateSelDisp db 'STATE SELECT',0 -GUIInputDisp db 'INPUT DEVICE',0 -GUIOptionDisp db 'OPTIONS',0 -GUISoundDisp db 'SOUND CONFIG',0 -GUIVideoDisp db 'VIDEO CONFIG',0 -GUICheatDisp db 'CHEAT',0 -GUISearchDisp db 'CHEAT SEARCH',0 -GUINetDisp db 'REMOTE',0,0,0,0,0,0,0,0,0 -GUIGameDisp db 'MISC KEYS',0 -GUIGUIDisp db 'GUI OPTIONS',0 -GUIAboutDisp db 'ABOUT',0 -GUIMovieDisp db 'MOVIE OPTIONS',0 -GUIStatesDisp db 'STATE CONFIRM',0 -GUIComboDisp db 'KEY COMBINATION EDITOR',0 -GUIAddOnsDisp db 'DEVICES SELECTOR',0 -GUIAddOnsDispEE db 'DEVICES SELECTOR',0 -GUIChipConfigDisp db 'CONFIGURE CHIPS',0 -GUIPathsDisp db 'SETUP PATHS',0 -GUISaveDisp db 'SAVE OPTIONS',0 -GUISpeedDisp db 'SPEED OPTIONS',0 - -SECTION .bss -GUIItemBoxColor resd 1 -TextColorSp resd 1 - -SECTION .data -NEWSYM GUIMenuItem - db 'GAME ',0 - db 'CONFIG',0 - db 'CHEAT ',0 - db 'NETPLAY',0 - db 'MISC ',0 - db 25,0 diff --git a/tools/zsnes/src/gui/menu.asm b/tools/zsnes/src/gui/menu.asm deleted file mode 100644 index 0d66fbb..0000000 --- a/tools/zsnes/src/gui/menu.asm +++ /dev/null @@ -1,909 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 FPSOn,MessageOn,cbitmode,copyvid -EXTSYM MsgCount,Msgptr,OutputGraphicString,OutputGraphicString16b,vidbuffer -EXTSYM curblank,drawhline,drawhline16b,drawvline,drawvline16b,frameskip -EXTSYM pressed,dumpsound,Grab_BMP_Data,Grab_BMP_Data_8 -EXTSYM spcon,vesa2_bpos,vesa2_clbit,vesa2_gpos,vesa2_rpos, -EXTSYM spritetablea,sprlefttot,newengen,Get_Key,continueprognokeys -EXTSYM ForceNonTransp,GUIOn,Check_Key,JoyRead,GetScreen,SSKeyPressed -EXTSYM SPCKeyPressed,StopSound,StartSound,ExecExitOkay,t1cc,Clear2xSaIBuffer -EXTSYM ScreenShotFormat,spcsaved,savespcdata -EXTSYM exiter,xpb,xpc,snesmmap,memtabler8,snesmap2,regaccessbankr8,dmadata,initaddrl -EXTSYM spcPCRam,xp,curcyc,Curtableaddr,UpdateDPage,splitflags,execsingle,joinflags -EXTSYM pdh,SPCRAM,cvidmode - -%ifdef __MSDOS__ -EXTSYM GUI16VID -%endif - -%ifndef NO_DEBUGGER -EXTSYM numinst,debuggeron -%endif - -%ifndef NO_PNG -EXTSYM Grab_PNG_Data -%endif - -SECTION .text - -GUIBufferData: - mov ecx,16000 - cmp byte[cbitmode],1 - jne near .16b - add ecx,16384 -.16b - ; copy to spritetable - mov esi,[vidbuffer] - mov edi,[spritetablea] - add esi,4*384 - add edi,4*384 -.loop - mov eax,[esi] - mov [edi],eax - add esi,4 - add edi,4 - dec ecx - jnz .loop - mov edi,sprlefttot - mov ecx,64*5 -.a - mov dword[edi],0 - add edi,4 - dec ecx - jnz .a - ret - -GUIUnBuffer: - mov ecx,16000 - cmp byte[cbitmode],1 - jne near .16b - add ecx,16384 -.16b - ; copy from spritetable - mov esi,[vidbuffer] - mov edi,[spritetablea] - add esi,4*384 - add edi,4*384 -.loop - mov eax,[edi] - mov [esi],eax - add esi,4 - add edi,4 - dec ecx - jnz .loop - ret - -SECTION .bss -NEWSYM nextmenupopup, resb 1 -NEWSYM NoInputRead, resb 1 -NEWSYM PrevMenuPos, resb 1 -NEWSYM MenuDisplace, resd 1 -NEWSYM MenuDisplace16, resd 1 -NEWSYM MenuNoExit, resb 1 -NEWSYM SPCSave, resb 1 - -SECTION .text - -NEWSYM showmenu - mov byte[ForceNonTransp],1 - cmp byte[cbitmode],1 - je near .nopalread - mov edi,[vidbuffer] - add edi,100000 - mov dx,03C7h - mov al,0 - out dx,al - mov dx,03C9h - mov ecx,768 - mov byte[edi],12 - inc edi -.b - in al,dx - shl al,2 - mov [edi],al - inc edi - dec ecx - jnz .b -.nopalread - - cmp byte[cbitmode],1 - je near .nopal16b - ; set palette of colors 128,144, and 160 to white, blue, and red - mov al,128 - mov dx,03C8h - out dx,al - inc dx - mov al,63 - out dx,al - out dx,al - out dx,al - mov al,144 - mov dx,03C8h - out dx,al - inc dx - xor al,al - out dx,al - out dx,al - mov al,50 - out dx,al - mov al,160 - mov dx,03C8h - out dx,al - inc dx - mov al,45 - out dx,al - xor al,al - out dx,al - out dx,al -.nopal16b - - mov byte[NoInputRead],0 - cmp byte[newengen],0 - je .nong16b - cmp byte[cbitmode],0 - je .nong16b - call GetScreen -.nong16b - cmp byte[SSKeyPressed],1 - jne .nosskey - mov byte[SSKeyPressed],0 - call saveimage - jmp .nopalwrite -.nosskey - cmp byte[SPCKeyPressed],1 - je near .savespckey - test byte[pressed+14],1 - jz .nof12 - call saveimage - jmp .nopalwrite -.nof12 - mov dword[menucloc],0 - cmp byte[nextmenupopup],0 - je .nomenuinc2 - mov byte[pressed+1Ch],0 - mov dword[menucloc],40*288 - cmp byte[PrevMenuPos],1 - jne .nomenuinc - mov dword[menucloc],50*288 -.nomenuinc - cmp byte[PrevMenuPos],2 - jne .nomenuinc2 - mov dword[menucloc],60*288 -.nomenuinc2 - cmp byte[PrevMenuPos],3 - jne .nomenuinc3 - mov dword[menucloc],70*288 -.nomenuinc3 - - mov dword[menudrawbox8b.stringi+13],' BMP' -%ifndef NO_PNG - cmp byte[ScreenShotFormat],0 - je .normalscrn -%ifdef __MSDOS__ - movzx eax,byte[cvidmode] - cmp byte[GUI16VID+eax],1 - je .pngok - mov byte[ScreenShotFormat],0 - jmp .normalscrn -%endif -.pngok - mov dword[menudrawbox8b.stringi+13],' PNG' -%endif -.normalscrn - mov byte[nextmenupopup],0 - mov byte[menu16btrans],0 - mov byte[pressed+1],0 - mov byte[pressed+59],0 - mov byte[curblank],00h - call GUIBufferData - ; Draw box - call menudrawbox8b - call menudrawbox8b - cmp byte[newengen],0 - je .notng - mov byte[GUIOn],1 -.notng - pushad - call copyvid - popad - call StopSound -.nextkey - ;call GUIUnBuffer - call menudrawbox8b - push eax - call copyvid - pop eax - - call JoyRead - call Check_Key - or al,al - jz .nextkey - call Get_Key - cmp al,0 - jne near .processextend - - call Get_Key - cmp al,72 - jne .noup - cmp dword[menucloc],0 - jne .nogoup - add dword[menucloc],80*288 -.nogoup - sub dword[menucloc],10*288 - call menudrawbox8b -; mov al,[newengen] ; WTF? -; mov byte[newengen],0 - -; mov [newengen],al - jmp .nextkey -.noup - cmp al,80 - jne .nodown - cmp dword[menucloc],70*288 - jne .nogodown - sub dword[menucloc],80*288 -.nogodown - add dword[menucloc],10*288 - call menudrawbox8b -; mov al,[newengen] -; mov byte[newengen],0 -; push eax - call copyvid -; pop eax -; mov [newengen],al - jmp .nextkey -.nodown - jmp .nextkey -.processextend - cmp al,27 - je near .exitloop - cmp al,13 - je .done - jmp .nextkey -.done - call GUIUnBuffer -; mov al,[newengen] -; mov byte[newengen],0 -; push eax - call copyvid -; pop eax -; mov [newengen],al - cmp dword[menucloc],0 - jne .nosaveimg - call saveimage -.nosaveimg - cmp dword[menucloc],40*288 - jne .nosaveimg2 - call saveimage - mov byte[ExecExitOkay],0 - mov byte[nextmenupopup],3 - mov byte[NoInputRead],1 - mov byte[t1cc],0 - mov byte[PrevMenuPos],0 -.nosaveimg2 - cmp dword[menucloc],50*288 - jne .noskipframe - mov byte[ExecExitOkay],0 - mov byte[nextmenupopup],3 - mov byte[NoInputRead],1 - mov byte[t1cc],0 - mov byte[PrevMenuPos],1 -.noskipframe - cmp dword[menucloc],70*288 - jne .noimagechange - cmp byte[cbitmode],0 - je .noimagechange - xor byte[ScreenShotFormat],1 - mov byte[MenuNoExit],1 - mov byte[ExecExitOkay],0 - mov byte[nextmenupopup],1 - mov byte[NoInputRead],1 - mov byte[t1cc],0 - mov byte[PrevMenuPos],3 -.noimagechange - cmp dword[menucloc],60*288 - jne .nomovewin - mov byte[MenuNoExit],1 - mov byte[ExecExitOkay],0 - mov byte[nextmenupopup],1 - mov byte[NoInputRead],1 - mov byte[t1cc],0 - mov byte[PrevMenuPos],2 - cmp dword[MenuDisplace],0 - je .movewin - mov dword[MenuDisplace],0 - mov dword[MenuDisplace16],0 - jmp .nomovewin -.movewin - mov dword[MenuDisplace],90*288 - mov dword[MenuDisplace16],90*288*2 -.nomovewin - cmp dword[menucloc],10*288 - jne .nofps - cmp byte[frameskip],0 - je .yesfs - mov dword[Msgptr],.unablefps - mov eax,[MsgCount] - mov [MessageOn],eax - jmp .nofps -.yesfs - xor byte[FPSOn],1 -.nofps - cmp dword[menucloc],20*288 - jne near .nospcsave -.savespckey - cmp byte[spcon],0 - je .nospc - - mov dword[Msgptr],.search - mov eax,[MsgCount] - mov [MessageOn],eax - call copyvid - mov byte[SPCSave],1 - call breakatsignb - mov byte[SPCSave],0 - pushad - call savespcdata - popad - - mov byte[curblank],40h - mov dword[Msgptr],spcsaved - mov eax,[MsgCount] - mov [MessageOn],eax - jmp .nospcsave -.nospc - mov dword[Msgptr],.nosound - mov eax,[MsgCount] - mov [MessageOn],eax - jmp .nospcsave -.unablespc - mov dword[Msgptr],.unable - mov eax,[MsgCount] - mov [MessageOn],eax - jmp .nospcsave -.yesesc - mov dword[Msgptr],.escpress - mov eax,[MsgCount] - mov [MessageOn],eax -.nospcsave - cmp dword[menucloc],30*288 - jne .nosnddmp - pushad - call dumpsound - popad - mov dword[Msgptr],.sndbufsav - mov eax,[MsgCount] - mov [MessageOn],eax -.nosnddmp - cmp byte[SPCKeyPressed],1 - jne .exitloop - mov byte[SPCKeyPressed],0 - jmp .nopalwrite -.exitloop - call GUIUnBuffer -; mov al,[newengen] -; mov byte[newengen],0 -; push eax - call copyvid -; pop eax -; mov [newengen],al - cmp byte[cbitmode],1 - je near .nopalwrite - mov edi,[vidbuffer] - add edi,100000 - mov dx,03C8h - mov al,0 - out dx,al - mov dx,03C9h - mov ecx,768 - inc edi -.c - mov al,[edi] - shr al,2 - out dx,al - inc edi - dec ecx - jnz .c -.nopalwrite - mov eax,pressed - mov ecx,256 -.looppr - cmp byte[eax],1 - jne .notpr - mov byte[eax],2 -.notpr - inc eax - dec ecx - jnz .looppr -; mov byte[pressed+1],2 -; cmp byte[pressed+59],1 -; jne .not59 -; mov byte[pressed+59],2 -;.not59 -; cmp byte[pressed+28],1 -; jne .not28 -; mov byte[pressed+28],2 -;.not28 - call StartSound - mov byte[ForceNonTransp],0 - mov byte[GUIOn],0 - pushad - call Clear2xSaIBuffer - popad - cmp byte[MenuNoExit],1 - je .noexitmenu - jmp continueprognokeys -.noexitmenu - mov byte[MenuNoExit],0 - jmp showmenu - -SECTION .data -.unablefps db 'NEED AUTO FRAMERATE ON',0 -.sndbufsav db 'BUFFER SAVED AS SOUNDDMP.RAW',0 -.search db 'SEARCHING FOR SONG START.',0 -.nosound db 'SOUND MUST BE ENABLED.',0 -.unable db 'CANNOT USE IN NEW GFX ENGINE.',0 -.escpress db 'ESC TERMINATED SEARCH.',0 -SECTION .text - -NEWSYM menudrawbox8b - cmp byte[cbitmode],1 - je near menudrawbox16b - ; draw a small blue box with a white border - mov esi,40+20*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov ecx,150 - mov al,95 -.loop - mov byte[esi],144 - inc esi - dec ecx - jnz .loop - add esi,288-150 - dec al - mov ecx,150 - jnz .loop - mov al,128 - ; Draw lines - mov esi,40+20*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov ecx,150 - call drawhline - mov esi,40+20*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov ecx,95 - call drawvline - mov esi,40+114*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov ecx,150 - call drawhline - mov esi,40+32*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov ecx,150 - call drawhline - mov esi,189+20*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov ecx,95 - call drawvline - call menudrawcursor8b - - mov esi,45+23*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov edi,.string - call OutputGraphicString - mov esi,45+35*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov edi,.stringa - call OutputGraphicString - mov esi,45+45*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov edi,.stringb - test byte[FPSOn],1 - jz .nofps - mov edi,.stringc -.nofps - call OutputGraphicString - mov esi,45+55*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov edi,.stringd - call OutputGraphicString - mov esi,45+65*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov edi,.stringe - call OutputGraphicString - mov esi,45+75*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov edi,.stringf - call OutputGraphicString - mov esi,45+85*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov edi,.stringg - call OutputGraphicString - mov esi,45+95*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov edi,.stringh - call OutputGraphicString - mov esi,45+105*288 - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov edi,.stringi - call OutputGraphicString -; mov al,[newengen] -; mov byte[newengen],0 -; push eax - call copyvid -; pop eax -; mov [newengen],al - ret - -SECTION .data -.string db 'MISC OPTIONS',0 -.stringa db 'SAVE SNAPSHOT',0 -.stringb db 'SHOW FPS',0 -.stringc db 'HIDE FPS',0 -.stringd db 'SAVE SPC DATA',0 -.stringe db 'SOUND BUFFER DUMP',0 -.stringf db 'SNAPSHOT/INCR FRM',0 -.stringg db 'INCR FRAME ONLY',0 -.stringh db 'MOVE THIS WINDOW',0 -.stringi db 'IMAGE FORMAT: ---',0 -SECTION .text - -NEWSYM menudrawcursor8b - cmp byte[cbitmode],1 - je near menudrawcursor16b - ; draw a small red box - mov esi,41+34*288 - add esi,[menucloc] - add esi,[vidbuffer] - add esi,[MenuDisplace] - mov ecx,148 - mov al,9 -.loop - mov byte[esi],160 - inc esi - dec ecx - jnz .loop - add esi,288-148 - dec al - mov ecx,148 - jnz .loop - - mov al,128 - ret - -SECTION .bss -NEWSYM menucloc, resd 1 -SECTION .text - -NEWSYM menudrawbox16b - ; draw shadow behind box - cmp byte[menu16btrans],0 - jne .noshadow - mov byte[menu16btrans],1 - mov esi,50*2+30*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov ecx,150 - mov al,95 - mov ah,5 -.loop16b2 - mov dx,[esi] - and dx,[vesa2_clbit] - shr dx,1 - mov [esi],dx - add esi,2 - dec ecx - jnz .loop16b2 - add esi,288*2-150*2 - dec al - mov ecx,150 - jnz .loop16b2 -.noshadow - - mov ax,01Fh - mov cl,[vesa2_rpos] - shl ax,cl - mov [.allred],ax - mov ax,012h - mov cl,[vesa2_bpos] - shl ax,cl - mov dx,ax - mov ax,01h - mov cl,[vesa2_gpos] - shl ax,cl - mov bx,ax - mov ax,01h - mov cl,[vesa2_rpos] - shl ax,cl - or bx,ax - - ; draw a small blue box with a white border - mov esi,40*2+20*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov ecx,150 - mov al,95 - mov ah,5 -.loop16b - mov [esi],dx - add esi,2 - dec ecx - jnz .loop16b - add esi,288*2-150*2 - dec ah - jnz .nocolinc16b - add dx,bx - mov ah,5 -.nocolinc16b - dec al - mov ecx,150 - jnz .loop16b - - ; Draw lines - mov ax,0FFFFh - mov esi,40*2+20*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov ecx,150 - call drawhline16b - mov esi,40*2+20*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov ecx,95 - call drawvline16b - mov esi,40*2+114*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov ecx,150 - call drawhline16b - mov esi,40*2+32*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov ecx,150 - call drawhline16b - mov esi,189*2+20*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov ecx,95 - call drawvline16b - call menudrawcursor16b - - mov esi,45*2+23*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov edi,menudrawbox8b.string - call OutputGraphicString16b - mov esi,45*2+35*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov edi,menudrawbox8b.stringa - call OutputGraphicString16b - mov esi,45*2+45*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov edi,menudrawbox8b.stringb - test byte[FPSOn],1 - jz .nofps - mov edi,menudrawbox8b.stringc -.nofps - call OutputGraphicString16b - mov esi,45*2+55*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov edi,menudrawbox8b.stringd - call OutputGraphicString16b - mov esi,45*2+65*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov edi,menudrawbox8b.stringe - call OutputGraphicString16b - mov esi,45*2+75*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov edi,menudrawbox8b.stringf - call OutputGraphicString16b - mov esi,45*2+85*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov edi,menudrawbox8b.stringg - call OutputGraphicString16b - mov esi,45*2+95*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov edi,menudrawbox8b.stringh - call OutputGraphicString16b - mov esi,45*2+105*288*2 - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov edi,menudrawbox8b.stringi - call OutputGraphicString16b -; mov al,[newengen] -; mov byte[newengen],0 -; push eax - call copyvid -; pop eax -; mov [newengen],al - ret - -SECTION .bss -.allred resw 1 -.blue resw 1 -.stepb resw 1 - -NEWSYM menu16btrans, resb 1 - -SECTION .text - -NEWSYM menudrawcursor16b - ; draw a small red box - mov esi,41*2+34*288*2 - add esi,[menucloc] - add esi,[menucloc] - add esi,[vidbuffer] - add esi,[MenuDisplace16] - mov ecx,148 - mov al,9 - mov bx,[menudrawbox16b.allred] -.loop - mov [esi],bx - add esi,2 - dec ecx - jnz .loop - add esi,288*2-148*2 - dec al - mov ecx,148 - jnz .loop - mov al,128 - ret - -saveimage: - mov byte[pressed+1],0 - mov byte[pressed+59],0 - -%ifndef NO_PNG - cmp byte[ScreenShotFormat],1 - jne .notpng - pushad - call Grab_PNG_Data - popad - ret -.notpng -%endif - - cmp byte[cbitmode],1 - je near .save16b - pushad - call Grab_BMP_Data_8 - popad - ret - -.save16b - pushad - call Grab_BMP_Data - popad - ret - -SECTION .data -NEWSYM keyonsn, db 0 -NEWSYM prbreak, db 0 -SECTION .text - -breakatsignb: - mov byte[keyonsn],0 - mov byte[prbreak],0 -%ifndef NO_DEBUGGER - cmp byte[SPCSave],1 - jne .nospcsave - mov byte[debuggeron],1 -.nospcsave -%endif - - mov byte[exiter],01h - xor eax,eax - xor ebx,ebx - xor ecx,ecx - xor edx,edx - mov bl,[xpb] - mov ax,[xpc] - test ax,8000h - jz .loweraddr - mov esi,[snesmmap+ebx*4] - jmp .skiplower -.loweraddr - cmp ax,4300h - jb .lower - cmp dword[memtabler8+ebx*4],regaccessbankr8 - je .dma -.lower - mov esi,[snesmap2+ebx*4] - jmp .skiplower -.dma - mov esi,dmadata-4300h -.skiplower - mov [initaddrl],esi - add esi,eax ; add program counter to address - mov ebp,[spcPCRam] - mov dl,[xp] ; set flags - mov dh,[curcyc] ; set cycles - mov edi,[Curtableaddr] - call UpdateDPage - ; execute -.loopa - call splitflags - call execsingle - call joinflags - mov dh,[pdh] -%ifndef NO_DEBUGGER - inc dword[numinst] - cmp byte[numinst],0 - jne .skipa - call Check_Key - test al,0FFh - jz .skipa - call Get_Key - cmp al,27 - je .skipc -.skipa -%endif - cmp byte[SPCRAM+6],40h - je .skipc - cmp byte[keyonsn],1 - jne .loopa - jmp .noesc -.skipc - mov byte[prbreak],1 -.noesc - ; copy back data - mov [spcPCRam],ebp - mov [Curtableaddr],edi - mov [xp],dl - mov [curcyc],dh - - mov eax,[initaddrl] - sub esi,eax ; subtract program counter by address - mov [xpc],si - mov byte[exiter],0 -%ifndef NO_DEBUGGER - cmp byte[SPCSave],1 - jne .nospcsave2 - mov byte[debuggeron],0 -.nospcsave2 -%endif - ret diff --git a/tools/zsnes/src/icons/16x16x32.png b/tools/zsnes/src/icons/16x16x32.png deleted file mode 100644 index 15ae71c..0000000 Binary files a/tools/zsnes/src/icons/16x16x32.png and /dev/null differ diff --git a/tools/zsnes/src/icons/32x32x32.png b/tools/zsnes/src/icons/32x32x32.png deleted file mode 100644 index 2c4692c..0000000 Binary files a/tools/zsnes/src/icons/32x32x32.png and /dev/null differ diff --git a/tools/zsnes/src/icons/48x48x32.png b/tools/zsnes/src/icons/48x48x32.png deleted file mode 100644 index 2a3e9e2..0000000 Binary files a/tools/zsnes/src/icons/48x48x32.png and /dev/null differ diff --git a/tools/zsnes/src/icons/64x64x32.png b/tools/zsnes/src/icons/64x64x32.png deleted file mode 100644 index e6317a9..0000000 Binary files a/tools/zsnes/src/icons/64x64x32.png and /dev/null differ diff --git a/tools/zsnes/src/init.asm b/tools/zsnes/src/init.asm deleted file mode 100644 index 2f7e371..0000000 --- a/tools/zsnes/src/init.asm +++ /dev/null @@ -1,1002 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 UpdateDevices,Makemode7Table,MusicRelVol,MusicVol,makesprprtable -EXTSYM romloadskip,start65816,showinfogui,inittable,zexit -EXTSYM SA1inittable,MessageOn,Msgptr,MsgCount,sndrot,SnowTimer -EXTSYM inittablec,newgfx16b,DisplayInfo,ssautosw,GUIDelayB,pl12s34 -EXTSYM Output_Text,Turbo30hz,CombinDataLocl,current_zst -EXTSYM BackupSystemVars,SnowData,SnowVelDist,Setper2exec,ShowMMXSupport -EXTSYM JoyRead,pressed,mousebuttons,mousexdir,mouseydir,mousexpos,mouseypos -EXTSYM pl1selk,pl1startk,pl1upk,pl1downk,pl1leftk,pl1rightk,pl1Xk -EXTSYM pl1Ak,pl1Lk,pl1Yk,pl1Bk,pl1Rk,pl1Xtk,pl1Ytk,pl1Atk,pl1Btk,pl1Ltk,pl1Rtk -EXTSYM pl1ULk,pl1URk,pl1DLk,pl1DRk,pl2contrl,pl2selk,pl2startk,pl2upk,pl2downk -EXTSYM pl2leftk,pl2rightk,pl2Xk,pl2Ak,pl2Lk,pl2Yk,pl2Bk,pl2Rk,pl2Xtk,pl2Ytk -EXTSYM pl2Atk,pl2Btk,pl2Ltk,pl2Rtk,pl2ULk,pl2URk,pl2DLk,pl2DRk,pl3contrl,pl3selk -EXTSYM pl3startk,pl3upk,pl3downk,pl3leftk,pl3rightk,pl3Xk,pl3Ak,pl3Lk,pl3Yk -EXTSYM pl3Bk,pl3Rk,pl3Xtk,pl3Ytk,pl3Atk,pl3Btk,pl3Ltk,pl3Rtk,pl3ULk,pl3URk -EXTSYM pl3DLk,pl3DRk,pl4contrl,pl4selk,pl4startk,pl4upk,pl4downk,pl4leftk -EXTSYM pl4rightk,pl4Xk,pl4Ak,pl4Lk,pl4Yk,pl4Bk,pl4Rk,pl4Xtk,pl4Ytk,pl4Atk,pl4Btk -EXTSYM pl4Ltk,pl4Rtk,pl4ULk,pl4URk,pl4DLk,pl4DRk,pl5contrl,pl5selk,pl5startk -EXTSYM pl5upk,pl5downk,pl5leftk,pl5rightk,pl5Xk,pl5Ak,pl5Lk,pl5Yk,pl5Bk,pl5Rk -EXTSYM pl5Xtk,pl5Ytk,pl5Atk,pl5Btk,pl5Ltk,pl5Rtk,pl5ULk,pl5URk,pl5DLk,pl5DRk -EXTSYM CombinDataGlob,NumCombo,GUIComboGameSpec,mousexloc,mouseyloc,extlatch -EXTSYM AllowMMX,MMXextSupport,romdata,procexecloop,wramdata,LoadSecondState -EXTSYM romispal,initregr,initregw,loadfileGUI,loadstate2,CMovieExt,AutoState -EXTSYM MoviePlay,MovieDumpRaw,AllowUDLR,device1,device2,processmouse1,SaveSecondState -EXTSYM processmouse2,cpalval,init65816,clearmem,SetupROM,ZCartName,initsnes,SSPause - -%ifdef __MSDOS__ -EXTSYM init18_2hz -%endif - -%ifndef NO_DEBUGGER -EXTSYM startdebugger -%ifndef __MSDOS__ -%ifdef __WIN32__ -EXTSYM initwinvideo -%endif -EXTSYM Start60HZ -%endif -%endif - -; Initiation - -SECTION .data -NEWSYM regsbackup, times 3019 db 0 -NEWSYM forceromtype, db 0 -; FIX STATMAT -NEWSYM autoloadstate, db 0 ; auto load state slot number -NEWSYM autoloadmovie, db 0 -NEWSYM ZMVRawDump, db 0 - -SECTION .text - -NEWSYM init - ; prevents a crash if cpalval gets accessed before initializing - mov eax,cpalval - mov ecx,256 -.looppal - mov dword[eax],cpalval - add eax,4 - dec ecx - jnz .looppal - - ; Initialize snow stuff - mov ecx,400 - xor edx,edx -.snowloop - shl word[SnowData+edx*2],8 - and byte[SnowVelDist+edx],0F7h - cmp dword[SnowTimer],0 - jne .skip - or byte[SnowVelDist+edx],08h -.skip - inc edx - dec ecx - jnz .snowloop - - pushad - call BackupSystemVars - popad - - mov al,[romtype] - mov [forceromtype],al - mov byte[romtype],0 - mov ax,ds - mov es,ax - mov eax,regsbackup - mov ebx,sndrot - mov ecx,3019 -.rbackupl - mov dl,[ebx] - mov [eax],dl - inc ebx - inc eax - dec ecx - jnz .rbackupl - pushad - call clearmem - popad - call inittable - call inittablec - call SA1inittable - ; SPC Init - pushad - call procexecloop - popad - ; SNES Init - pushad - call Setper2exec - popad - call Makemode7Table - call makesprprtable - mov eax,[ZCartName] - cmp byte[eax],0 - jne .found - cmp byte[romloadskip],1 - je .noloadfile -.found - mov byte[romloadskip],0 - pushad - call loadfileGUI - call SetupROM - popad - cmp byte[DisplayInfo],0 - je .noloadfile - pushad - call showinfogui - popad -.noloadfile - call UpdateDevices - pushad - call init65816 - popad - call initregr - call initregw - pushad - call initsnes - popad - - ; Initialize volume - xor edx,edx - movzx eax,byte[MusicRelVol] - shl eax,7 - mov ebx,0A3D70A3Dh - mul ebx - shr edx,6 - cmp dl,127 - jb .noof - mov dl,127 -.noof - mov [MusicVol],dl - - cmp byte[AutoState],1 - jne .noloadzss - pushad - call LoadSecondState - popad -.noloadzss - -; FIX STATMAT - ; Here's the auto-load ZST file stuff - cmp byte[autoloadstate],1 - jl .noautoloadstate - movzx eax,byte[autoloadstate] - dec eax - mov [current_zst],eax - - ; Load the specified state file - pushad - call loadstate2 - popad -.noautoloadstate - - cmp byte[autoloadmovie],1 - jb .noautloadmovie - cmp byte[autoloadmovie],10 - ja .noautloadmovie - mov al,[autoloadmovie] - add al,'0'-1 - cmp al,'0' - jne .notzero1 - mov al,'v' -.notzero1 - mov [CMovieExt],al - - pushad - cmp byte[ZMVRawDump],0 - je .norawdump - call MovieDumpRaw - jmp .aftermovieplay -.norawdump - call MoviePlay -.aftermovieplay - popad -.noautloadmovie - - cmp byte[yesoutofmemory],1 - jne .noout - call outofmemfix -.noout -%ifndef NO_DEBUGGER - cmp byte[debugger],0 - je near start65816 - cmp byte[romloadskip],1 - je near start65816 -%ifndef __MSDOS__ - ;; Prevent nasty hang in debugger. Likely not a good way... - ;; If we don't do this, then on the SDL and win32 ports, update_ticks_pc2 - ;; won't be set and CheckTimers will hang. - - ;; Most likely it isn't desirable to be checking timers under the - ;; debugger anyway, but this is a much simpler fix. - - pushad -%ifdef __WIN32__ - ;; need to get "freq" set first - call initwinvideo -%endif - call Start60HZ - popad -%endif - jmp startdebugger -%else - jmp start65816 -%endif - -; global variables - -SECTION .data - -NEWSYM romtype, db 0 ; ROM type in bytes -NEWSYM resetv, dw 0 ; reset vector -NEWSYM abortv, dw 0 ; abort vector -NEWSYM nmiv2, dw 0 ; nmi vector -NEWSYM nmiv, dw 0 ; nmi vector -NEWSYM irqv, dw 0 ; irq vector -NEWSYM irqv2, dw 0 ; irq vector -NEWSYM brkv, dw 0 ; brk vector -NEWSYM copv, dw 0 ; cop vector -NEWSYM abortv8, dw 0 ; abort vector emulation mode -NEWSYM nmiv8, dw 0 ; nmi vector emulation mode -NEWSYM irqv8, dw 0 ; irq vector emulation mode -NEWSYM brkv8, dw 0 ; brk vector emulation mode -NEWSYM copv8, dw 0 ; cop vector emulation mode -NEWSYM cycpb268, db 109 ; 110 -NEWSYM cycpb358, db 149 ; 155 -NEWSYM cycpbl2, db 109 ; percentage left of CPU/SPC to run (3.58 = 175) -NEWSYM cycpblt2, db 149 ; percentage of CPU/SPC to run -NEWSYM writeon, db 0 ; Write enable/disable on snes rom memory -NEWSYM totlines, dw 263 ; total # of lines - -;This is saved in states -NEWSYM curcyc, db 0 ; cycles left in scanline -NEWSYM cacheud, db 1 ; update cache every ? frames -NEWSYM ccud, db 0 ; current cache increment -NEWSYM spcon, db 0 ; SPC Enable (1=enabled) - -; 65816 registers -NEWSYM xat, dw 0 -NEWSYM xdbt, db 0 -NEWSYM xpbt, db 0 -NEWSYM xst, dw 0 -NEWSYM xdt, dw 0 -NEWSYM xxt, dw 0 -NEWSYM xyt, dw 0 -NEWSYM xpc, dw 0 -NEWSYM debugger, db 0 ; Start with debugger (1=yes,0=no) -NEWSYM curnmi, db 0 ; if in NMI(1) or not(0) - -ALIGN32 -NEWSYM cycpbl, dd 110 ; percentage left of CPU/SPC to run (3.58 = 175) -NEWSYM cycpblt, dd 110 ; percentage of CPU/SPC to run - -NEWSYM cpuoverptr, dd 0 ; pointer to cpuover - -ALIGN32 -NEWSYM xa, dd 0 -NEWSYM xdb, dd 0 -NEWSYM xpb, dd 0 -NEWSYM xs, dd 0 -NEWSYM xd, dd 0 -NEWSYM xx, dd 0 -NEWSYM xy, dd 0 -NEWSYM flagnz, dd 0 -NEWSYM flago, dd 0 -NEWSYM flagc, dd 0 -NEWSYM bankkp, dd 0 -NEWSYM Sflagnz, dd 0 -NEWSYM Sflago, dd 0 -NEWSYM Sflagc, dd 0 - -;******************************************************* -; Read Input Device Reads from Keyboard, etc. -;******************************************************* - -SECTION .bss -NEWSYM WhichSW, resb 1 -NEWSYM WhichGR, resb 1 -NEWSYM autofr, resb 1 -TurboCB resb 1 - -NEWSYM JoyAOrig, resd 1 -NEWSYM JoyBOrig, resd 1 -NEWSYM JoyCOrig, resd 1 -NEWSYM JoyDOrig, resd 1 -NEWSYM JoyEOrig, resd 1 -NEWSYM JoyANow, resd 1 -NEWSYM JoyBNow, resd 1 -NEWSYM JoyCNow, resd 1 -NEWSYM JoyDNow, resd 1 -NEWSYM JoyENow, resd 1 -NEWSYM LethEnData, resd 1 -NEWSYM ComboCounter, resb 1 -SECTION .text - -%macro PlayerDeviceHelp 3 - mov eax,[%1] - cmp byte[pressed+eax],1 - jne %%no - or dword[%2],%3 -%%no -%endmacro - -%macro ProcSNESMouse 1 - test byte[mousebuttons],02h - jz %%n - or dword[%1],00000000100000000000000000000000b - mov al,1 -%%n - test byte[mousebuttons],01h - jz %%n2 - or dword[%1],00000000010000000000000000000000b -%%n2 - or dword[%1],00000000000000010000000000000000b - mov al,[mouseypos] - and al,7Fh - or byte[%1+1],al - mov al,[mousexpos] - and al,7Fh - or byte[%1],al - test byte[mouseydir],01h - jz %%n3 - or dword[%1],00000000000000001000000000000000b -%%n3 - test byte[mousexdir],01h - jz %%n4 - or dword[%1],00000000000000000000000010000000b -%%n4 -%endmacro - -%macro ProcessKeyComb 2 - cmp dword[NumCombo],0 - je near %%nocomb - mov eax,CombinDataGlob - cmp byte[GUIComboGameSpec],0 - je %%local - mov eax,CombinDataLocl -%%local - push ecx - push ebx - xor ebx,ebx - cmp byte[ComboProg+%1],0 - jne near %%progressing - test dword[%2],01000000h - jz %%noright - mov dword[CombDirSwap],0 -%%noright - test dword[%2],02000000h - jz %%noleft - mov dword[CombDirSwap],1 -%%noleft - mov ecx,[NumCombo] -%%loop - mov bx,[eax+62] - cmp byte[pressed+ebx],1 - jne %%nopress - cmp byte[eax+64],%1 - je %%startprogress -%%nopress - add eax,66 - dec ecx - jnz %%loop - jmp %%endcomb -%%startprogress - mov byte[pressed+ebx],2 - inc byte[ComboCounter] - mov byte[ComboProg+%1],1 - mov byte[ComboPtr+%1],0 - mov dword[PressComb+%1*4],0 - mov dword[HoldComb+%1*4],0 - mov dword[CombCont+%1*4],CombContDatN - cmp dword[CombDirSwap],0 - je %%NoSwapLeftRight - cmp byte[eax+65],0 - je %%NoSwapLeftRight - mov dword[CombCont+%1*4],CombContDatR -%%NoSwapLeftRight - add eax,20 - mov [StartComb+%1*4],eax -%%progressing - mov ecx,%1 - mov eax,[StartComb+%1*4] - call ProcessCombo - mov [StartComb+%1*4],eax - or ebx,ebx - jz %%proccomb - mov byte[ComboProg+%1],0 -%%proccomb - mov dword[%2],0 - mov eax,[HoldComb+%1*4] - or dword[%2],eax - mov eax,[PressComb+%1*4] - or dword[%2],eax -%%endcomb - pop ebx - pop ecx -%%nocomb -%endmacro - -ProcessCombo: - mov dword[KeyLPress],0 - cmp dword[CombDelay+ecx*4],0 - jne .delay -.nextsession - xor ebx,ebx - cmp byte[eax],0 - je .finish - mov bl,[eax] - cmp bl,37 - jb .keypress - cmp bl,48 - ja .finish - sub ebx,37 - shl ebx,2 - add ebx,CombTDelN - cmp byte[romispal],0 - je .ntsc - sub ebx,CombTDelN - add ebx,CombTDelP -.ntsc - mov ebx,[ebx] - mov [CombDelay+ecx*4],ebx - inc eax - inc byte[ComboPtr+ecx] - cmp byte[ComboPtr+ecx],42 - je .finish -.delay - dec dword[CombDelay+ecx*4] - xor ebx,ebx - ret -.finish - mov ebx,1 - ret -.keypress - cmp dword[KeyLPress],0 - jne .alreadyproc - mov dword[PressComb+ecx*4],0 - mov dword[KeyLPress],1 -.alreadyproc - dec ebx - cmp ebx,12 - jae .pressonly - shl ebx,2 - add ebx,[CombCont+ecx*4] - mov ebx,[ebx] - or [PressComb+ecx*4],ebx - jmp .finkeyproc -.pressonly - sub ebx,12 - cmp ebx,12 - jae .releaseonly - shl ebx,2 - add ebx,[CombCont+ecx*4] - mov ebx,[ebx] - or [HoldComb+ecx*4],ebx - jmp .finkeyproc -.releaseonly - sub ebx,12 ; <- bugfix from Maxim - shl ebx,2 - add ebx,[CombCont+ecx*4] - mov ebx,[ebx] - xor ebx,0FFFFFFFFh - and [HoldComb+ecx*4],ebx - and [PressComb+ecx*4],ebx ; <- buxfix from Maxim -.finkeyproc - inc eax - inc byte[ComboPtr+ecx] - cmp byte[ComboPtr+ecx],42 - je near .finish - jmp .nextsession - -SECTION .data -TurboSw db 0 -ComboProg times 5 db 0 -ComboPtr times 5 db 0 -KeyLPress dd 0 -CombDirSwap dd 0 -CombDelay times 5 dd 0 -StartComb times 5 dd 0 -HoldComb times 5 dd 0 -PressComb times 5 dd 0 -CombCont times 5 dd 0 -CombTDelN dd 1,2,3,4,5,9,30,60,120,180,240,300 -CombTDelP dd 1,2,3,4,5,9,25,50,100,150,200,250 -CombContDatN dd 08000000h,04000000h,02000000h,01000000h,00800000h,80000000h - dd 00400000h,40000000h,00200000h,00100000h,10000000h,20000000h -CombContDatR dd 08000000h,04000000h,01000000h,02000000h,00800000h,80000000h - dd 00400000h,40000000h,00200000h,00100000h,10000000h,20000000h - -SECTION .text - -%macro PlayerDeviceFix 1 - cmp byte[AllowUDLR],1 - je %%noleftright - mov eax,[%1] - and eax,0C000000h - cmp eax,0C000000h - jne %%noupdown - and dword[%1],0F3FFFFFFh -%%noupdown - mov eax,[%1] - and eax,03000000h - cmp eax,03000000h - jne %%noleftright - and dword[%1],0FCFFFFFFh -%%noleftright -%endmacro - -NEWSYM ReadInputDevice - mov byte[WhichSW],1 - mov byte[WhichGR],0 - inc byte[TurboSw] - mov byte[TurboCB],01h - cmp byte[Turbo30hz],0 - je .noturbo30 - mov byte[TurboCB],02h -.noturbo30 - ; Read External Devices (Joystick, PPort, etc.) - call JoyRead - ; Process Data - mov dword[JoyAOrig],0 - mov dword[JoyBOrig],0 - - ; Get Player1 input device - cmp byte[device1],1 - jne .nomouse1 - call processmouse1 - ProcSNESMouse JoyAOrig - jmp .noinput1 -.nomouse1 - PlayerDeviceHelp pl1Bk ,JoyAOrig,80000000h - PlayerDeviceHelp pl1Yk ,JoyAOrig,40000000h - PlayerDeviceHelp pl1selk ,JoyAOrig,20000000h - PlayerDeviceHelp pl1startk,JoyAOrig,10000000h - PlayerDeviceHelp pl1upk ,JoyAOrig,08000000h - PlayerDeviceHelp pl1downk ,JoyAOrig,04000000h - PlayerDeviceHelp pl1leftk ,JoyAOrig,02000000h - PlayerDeviceHelp pl1rightk,JoyAOrig,01000000h - PlayerDeviceHelp pl1Ak ,JoyAOrig,00800000h - PlayerDeviceHelp pl1Xk ,JoyAOrig,00400000h - PlayerDeviceHelp pl1Lk ,JoyAOrig,00200000h - PlayerDeviceHelp pl1Rk ,JoyAOrig,00100000h - PlayerDeviceHelp pl1ULk ,JoyAOrig,0A000000h - PlayerDeviceHelp pl1URk ,JoyAOrig,09000000h - PlayerDeviceHelp pl1DLk ,JoyAOrig,06000000h - PlayerDeviceHelp pl1DRk ,JoyAOrig,05000000h - PlayerDeviceFix JoyAOrig - mov al,[TurboCB] - test byte[TurboSw],al - jnz near .noswitch - PlayerDeviceHelp pl1Xtk ,JoyAOrig,00400000h - PlayerDeviceHelp pl1Ytk ,JoyAOrig,40000000h - PlayerDeviceHelp pl1Atk ,JoyAOrig,00800000h - PlayerDeviceHelp pl1Btk ,JoyAOrig,80000000h - PlayerDeviceHelp pl1Ltk ,JoyAOrig,00200000h - PlayerDeviceHelp pl1Rtk ,JoyAOrig,00100000h -.noswitch - mov byte[ComboCounter],0 - ProcessKeyComb 0,JoyAOrig - or dword[JoyAOrig],00008000h ; Joystick Enable - cmp byte[GUIDelayB],0 - je .noinput1 - cmp byte[GUIDelayB],1 - jne .inputbd - test dword[JoyAOrig],80000000h - jnz .inputbdcb - dec byte[GUIDelayB] - jmp .noinput1 -.inputbd - dec byte[GUIDelayB] -.inputbdcb - and dword[JoyAOrig],7FFFFFFFh -.noinput1 - cmp byte[device2],1 - jne .nomouse2 - call processmouse2 - ProcSNESMouse JoyBOrig - jmp .noinput2 -.nomouse2 - cmp byte[device2],2 - jne .nosuperscope - call processmouse2 - mov byte[JoyBOrig+2],0FFh - mov al,[ssautosw] - test byte[mousebuttons],01h - jz .nobutton1 - or al,80h -.nobutton1 - push eax - mov eax,[SSPause] - cmp byte[pressed+eax],0 - pop eax - jz .nobutton3 - or al,10h -.nobutton3 - test byte[mousebuttons],02h - jz .nobutton4 - or al,40h -.nobutton4 - mov [JoyBOrig+3],al - jmp .noinput2 -.nosuperscope - cmp byte[device2],3 - jne .nolethalen - call processmouse2 - mov eax,[romdata] - cmp dword[eax+1000h],0AD20C203h - jne .not - mov eax,[wramdata] - cmp byte[eax],26 - je .not - mov bl,[mousexloc] - mov [eax+40Ah],bl - mov bl,[mouseyloc] - mov [eax+40Eh],bl -.not -; mov word[JoyBOrig+2],000Eh -; and dword[LethEnData],0000000FFh -; or dword[LethEnData],055010000h -; inc byte[LethEnData] - test byte[LethEnData],1 - jz .n1 -; mov byte[LethEnData+2],8 - mov byte[extlatch],0 -.n1 - test byte[mousebuttons],01h - jz .nobutton1b -; or dword[LethEnData+2],10h - or byte[JoyAOrig+3],80h -.nobutton1b - push eax - mov eax,[SSPause] - cmp byte[pressed+eax],0 - pop eax - jz .nobutton3b -; or byte[LethEnData+2],40h -.nobutton3b - test byte[mousebuttons],02h - jz .nobutton4b -; or byte[LethEnData+2],40h - or byte[JoyAOrig+2],80h -.nobutton4b - jmp .noinput2 -.nolethalen - cmp byte[pl2contrl],0 - je near .noinput2 - ; Get Player2 input device - PlayerDeviceHelp pl2Bk ,JoyBOrig,80000000h - PlayerDeviceHelp pl2Yk ,JoyBOrig,40000000h - PlayerDeviceHelp pl2selk ,JoyBOrig,20000000h - PlayerDeviceHelp pl2startk,JoyBOrig,10000000h - PlayerDeviceHelp pl2upk ,JoyBOrig,08000000h - PlayerDeviceHelp pl2downk ,JoyBOrig,04000000h - PlayerDeviceHelp pl2leftk ,JoyBOrig,02000000h - PlayerDeviceHelp pl2rightk,JoyBOrig,01000000h - PlayerDeviceHelp pl2Ak ,JoyBOrig,00800000h - PlayerDeviceHelp pl2Xk ,JoyBOrig,00400000h - PlayerDeviceHelp pl2Lk ,JoyBOrig,00200000h - PlayerDeviceHelp pl2Rk ,JoyBOrig,00100000h - PlayerDeviceHelp pl2ULk ,JoyBOrig,0A000000h - PlayerDeviceHelp pl2URk ,JoyBOrig,09000000h - PlayerDeviceHelp pl2DLk ,JoyBOrig,06000000h - PlayerDeviceHelp pl2DRk ,JoyBOrig,05000000h - PlayerDeviceFix JoyBOrig - mov al,[TurboCB] - test byte[TurboSw],al - jnz near .noswitch2 - PlayerDeviceHelp pl2Xtk ,JoyBOrig,00400000h - PlayerDeviceHelp pl2Ytk ,JoyBOrig,40000000h - PlayerDeviceHelp pl2Atk ,JoyBOrig,00800000h - PlayerDeviceHelp pl2Btk ,JoyBOrig,80000000h - PlayerDeviceHelp pl2Ltk ,JoyBOrig,00200000h - PlayerDeviceHelp pl2Rtk ,JoyBOrig,00100000h -.noswitch2 - ProcessKeyComb 1,JoyBOrig - or dword[JoyBOrig],00008000h ; Joystick Enable -.noinput2 - mov dword[JoyCOrig],0 - cmp byte[pl3contrl],0 - je near .noinput3 - ; Get Player3 input device - PlayerDeviceHelp pl3Bk ,JoyCOrig,80000000h - PlayerDeviceHelp pl3Yk ,JoyCOrig,40000000h - PlayerDeviceHelp pl3selk ,JoyCOrig,20000000h - PlayerDeviceHelp pl3startk,JoyCOrig,10000000h - PlayerDeviceHelp pl3upk ,JoyCOrig,08000000h - PlayerDeviceHelp pl3downk ,JoyCOrig,04000000h - PlayerDeviceHelp pl3leftk ,JoyCOrig,02000000h - PlayerDeviceHelp pl3rightk,JoyCOrig,01000000h - PlayerDeviceHelp pl3Ak ,JoyCOrig,00800000h - PlayerDeviceHelp pl3Xk ,JoyCOrig,00400000h - PlayerDeviceHelp pl3Lk ,JoyCOrig,00200000h - PlayerDeviceHelp pl3Rk ,JoyCOrig,00100000h - PlayerDeviceHelp pl3ULk ,JoyCOrig,0A000000h - PlayerDeviceHelp pl3URk ,JoyCOrig,09000000h - PlayerDeviceHelp pl3DLk ,JoyCOrig,06000000h - PlayerDeviceHelp pl3DRk ,JoyCOrig,05000000h - PlayerDeviceFix JoyCOrig - mov al,[TurboCB] - test byte[TurboSw],al - jnz near .noswitch3 - PlayerDeviceHelp pl3Xtk ,JoyCOrig,00400000h - PlayerDeviceHelp pl3Ytk ,JoyCOrig,40000000h - PlayerDeviceHelp pl3Atk ,JoyCOrig,00800000h - PlayerDeviceHelp pl3Btk ,JoyCOrig,80000000h - PlayerDeviceHelp pl3Ltk ,JoyCOrig,00200000h - PlayerDeviceHelp pl3Rtk ,JoyCOrig,00100000h -.noswitch3 - ProcessKeyComb 2,JoyCOrig - or dword[JoyCOrig],00008000h ; Joystick Enable -.noinput3 - mov dword[JoyDOrig],0 - cmp byte[pl4contrl],0 - je near .noinput4 - ; Get Player4 input device - PlayerDeviceHelp pl4Bk ,JoyDOrig,80000000h - PlayerDeviceHelp pl4Yk ,JoyDOrig,40000000h - PlayerDeviceHelp pl4selk ,JoyDOrig,20000000h - PlayerDeviceHelp pl4startk,JoyDOrig,10000000h - PlayerDeviceHelp pl4upk ,JoyDOrig,08000000h - PlayerDeviceHelp pl4downk ,JoyDOrig,04000000h - PlayerDeviceHelp pl4leftk ,JoyDOrig,02000000h - PlayerDeviceHelp pl4rightk,JoyDOrig,01000000h - PlayerDeviceHelp pl4Ak ,JoyDOrig,00800000h - PlayerDeviceHelp pl4Xk ,JoyDOrig,00400000h - PlayerDeviceHelp pl4Lk ,JoyDOrig,00200000h - PlayerDeviceHelp pl4Rk ,JoyDOrig,00100000h - PlayerDeviceHelp pl4ULk ,JoyDOrig,0A000000h - PlayerDeviceHelp pl4URk ,JoyDOrig,09000000h - PlayerDeviceHelp pl4DLk ,JoyDOrig,06000000h - PlayerDeviceHelp pl4DRk ,JoyDOrig,05000000h - PlayerDeviceFix JoyDOrig - mov al,[TurboCB] - test byte[TurboSw],al - jnz near .noswitch4 - PlayerDeviceHelp pl4Xtk ,JoyDOrig,00400000h - PlayerDeviceHelp pl4Ytk ,JoyDOrig,40000000h - PlayerDeviceHelp pl4Atk ,JoyDOrig,00800000h - PlayerDeviceHelp pl4Btk ,JoyDOrig,80000000h - PlayerDeviceHelp pl4Ltk ,JoyDOrig,00200000h - PlayerDeviceHelp pl4Rtk ,JoyDOrig,00100000h -.noswitch4 - ProcessKeyComb 3,JoyDOrig - or dword[JoyDOrig],00008000h ; Joystick Enable -.noinput4 - mov dword[JoyEOrig],0 - cmp byte[pl5contrl],0 - je near .noinput5 - ; Get Player4 input device - PlayerDeviceHelp pl5Bk ,JoyEOrig,80000000h - PlayerDeviceHelp pl5Yk ,JoyEOrig,40000000h - PlayerDeviceHelp pl5selk ,JoyEOrig,20000000h - PlayerDeviceHelp pl5startk,JoyEOrig,10000000h - PlayerDeviceHelp pl5upk ,JoyEOrig,08000000h - PlayerDeviceHelp pl5downk ,JoyEOrig,04000000h - PlayerDeviceHelp pl5leftk ,JoyEOrig,02000000h - PlayerDeviceHelp pl5rightk,JoyEOrig,01000000h - PlayerDeviceHelp pl5Ak ,JoyEOrig,00800000h - PlayerDeviceHelp pl5Xk ,JoyEOrig,00400000h - PlayerDeviceHelp pl5Lk ,JoyEOrig,00200000h - PlayerDeviceHelp pl5Rk ,JoyEOrig,00100000h - PlayerDeviceHelp pl5ULk ,JoyEOrig,0A000000h - PlayerDeviceHelp pl5URk ,JoyEOrig,09000000h - PlayerDeviceHelp pl5DLk ,JoyEOrig,06000000h - PlayerDeviceHelp pl5DRk ,JoyEOrig,05000000h - PlayerDeviceFix JoyEOrig - mov al,[TurboCB] - test byte[TurboSw],al - jnz near .noswitch5 - PlayerDeviceHelp pl5Xtk ,JoyEOrig,00400000h - PlayerDeviceHelp pl5Ytk ,JoyEOrig,40000000h - PlayerDeviceHelp pl5Atk ,JoyEOrig,00800000h - PlayerDeviceHelp pl5Btk ,JoyEOrig,80000000h - PlayerDeviceHelp pl5Ltk ,JoyEOrig,00200000h - PlayerDeviceHelp pl5Rtk ,JoyEOrig,00100000h -.noswitch5 - ProcessKeyComb 4,JoyEOrig - or dword[JoyEOrig],00008000h ; Joystick Enable -.noinput5 - cmp byte[pl12s34],1 - jne .nop24 - cmp byte[device1],0 - jne .nop13 - mov eax,[JoyCOrig] - or [JoyAOrig],eax -.nop13 - cmp byte[device2],0 - jne .nop24 - mov eax,[JoyDOrig] - or [JoyBOrig],eax -.nop24 - ret - -;******************************************************* -; Init 65816 Initializes the Registers -;******************************************************* - -SECTION .data - -NEWSYM disablespcclr, db 0 -NEWSYM numspcvblleft, dd 0 -NEWSYM spc700idle, dd 0 -NEWSYM ENVDisable, db 0 -SECTION .text - -NEWSYM idledetectspc - inc dword[numspcvblleft] - cmp byte[SPCStallSetting],2 - jae .fullstall - inc byte[SPCStallSetting] - mov byte[ReturnFromSPCStall],1 - ret -.fullstall - mov dword[spc700idle],29 - mov dword[Msgptr],.unableskip - mov eax,[MsgCount] - mov [MessageOn],eax - ret - -SECTION .data -.unableskip db 'SPC700 STALL DETECTED.',0 - -SECTION .bss -NEWSYM ReturnFromSPCStall, resb 1 -NEWSYM SPCStallSetting, resb 1 -SECTION .text - -;******************************************************* -; Print Hexadecimal (16-bit/8-bit) -;******************************************************* -NEWSYM printhex - mov ecx,4 - xor ebx,ebx -.loopa - mov bx,ax - and bx,0F000h - shr bx,12 - mov dl,[.hexdat+ebx] - push ax - mov ah,02h - call Output_Text - pop ax - shl ax,4 - dec ecx - jnz .loopa - ret - -SECTION .data -.hexdat db '0123456789ABCDEF' - -SECTION .bss -NEWSYM IPSPatched, resb 1 -NEWSYM Checksumvalue, resw 1 -NEWSYM SramExists, resb 1 -NEWSYM NumofBanks, resd 1 -NEWSYM NumofBytes, resd 1 - -SECTION .text - -NEWSYM DosExit ; Terminate Program - cmp byte[AutoState],1 - jne .noautostate - pushad - call SaveSecondState - popad -.noautostate -%ifdef __MSDOS__ - call init18_2hz -%endif - call zexit - -NEWSYM MMXCheck - ; Check for cpu that doesn't support CPUID - mov byte[ShowMMXSupport],0 - mov byte[MMXSupport],0 - mov byte[MMXextSupport],0 - - ; Real way to check for presence of CPUID instruction -kode54 - pushfd - pop eax - mov edx,eax - xor eax,1 << 21 - push eax - popfd - pushfd - pop eax - xor eax,edx - jz .nommx - - ; MMX support - mov eax,1 - CPUID - - test edx,1 << 23 - jz .nommx - mov byte[ShowMMXSupport],1 - mov al,[AllowMMX] - mov [MMXSupport],al - jz .nommx - - ; Check if CPU has SSE (also support mmxext) - test edx,1 << 25 - jz .tryextmmx - mov byte[MMXextSupport],1 - ret - -.tryextmmx - ; Test extended CPU flag - mov eax,80000001h - CPUID - test edx,1 << 22 - jz .nommx - mov byte[MMXextSupport],1 -.nommx - ret - -;******************************************************* -; Show Information -;******************************************************* -; -; Maker Code = FFB0-FFB1 -; Game Code = FFB2-FFB5 -; Expansion RAM Size = FFBD (0=none, 1=16kbit, 3=64kbit, 5=256kbit,etc. -; Map Mode = FFD5 2.68-20h=map20h,21h=map21h,22h=reserved,23h=SA-1,25h=map25h -; 3.58-30h=map20h,31h=map21h,35h=map25h,highspeed -; Rom Mask Version = FFDB -; FFD6 (ROM Type) : 0*=DSP,1*=SFX,2*=OBC1,3*=SA-1,E*-F*=other -; *3=ROM,*4=ROM+RAM,*5=ROM+RAM+BATTERY,*6=ROM+BATTERY -; F3=C4 - - -SECTION .bss -NEWSYM DSP1Type, resb 1 -NEWSYM Interleaved, resb 1 -SECTION .text - -NEWSYM outofmemfix - mov esi,[romdata] - cmp byte[romtype],2 - jne .nhirom - add esi,8000h -.nhirom - mov word[resetv],8000h - mov word[xpc],8000h - mov byte[esi],58h - mov byte[esi+1],80h - mov byte[esi+2],0FEh - mov dword[Msgptr],outofmemoryerror - cmp byte[newgfx16b],1 - jne .notso - mov dword[Msgptr],outofmemoryerror2 -.notso - mov dword[MessageOn],0FFFFFFFFh - ret - -SECTION .bss -NEWSYM yesoutofmemory, resb 1 -NEWSYM MMXSupport, resb 1 -SECTION .data -NEWSYM outofmemoryerror, db 'OUT OF MEMORY.',0 -NEWSYM outofmemoryerror2, db 'ROM IS TOO BIG.',0 diff --git a/tools/zsnes/src/initc.c b/tools/zsnes/src/initc.c deleted file mode 100644 index 40348ec..0000000 --- a/tools/zsnes/src/initc.c +++ /dev/null @@ -1,2886 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#include "linux/audio.h" -#define DIR_SLASH "/" -#else -#include -#include -#include -#include -#include -#define DIR_SLASH "\\" -#endif -#include "asm_call.h" -#include "cfg.h" -#include "input.h" -#include "zpath.h" -#include "cpu/memtable.h" - -#define NUMCONV_FR4 -#include "numconv.h" - -#ifndef __GNUC__ -#define strcasecmp stricmp -#define strncasecmp strnicmp -#endif - -//C++ style code in C -#define bool unsigned char -#define true 1 -#define false 0 - -//NSRT Goodness -#define Lo 0x7FC0 -#define Hi 0xFFC0 -#define EHi 0x40FFC0 - -#define MB_bytes 0x100000 -#define Mbit_bytes 0x20000 - -//Offsets to add to infoloc start to reach particular variable -#define BankOffset 21 //Contains Speed as well -#define TypeOffset 22 -#define ROMSizeOffset 23 -#define SRAMSizeOffset 24 -#define CountryOffset 25 -#define CompanyOffset 26 -#define VersionOffset 27 -#define InvCSLowOffset 28 -#define InvCSHiOffset 29 -#define CSLowOffset 30 -#define CSHiOffset 31 -//Additional defines for the BS header -#define BSYearOffset 21 //Not sure how to calculate year yet -#define BSMonthOffset 22 -#define BSDayOffset 23 -#define BSBankOffset 24 -#define BSSizeOffset 25 //Contains Type as well -//26 - 31 is the same -#define ResetLoOffset 60 -#define ResetHiOffset 61 - - -// Some archaic code from an unfinished Dynarec -extern unsigned int curexecstate; -extern unsigned char spcon; - -void procexecloop() -{ - curexecstate &= 0xFFFFFF00; - - if (spcon) { curexecstate += 3; } - else { curexecstate += 1; } -} - -void Debug_WriteString(char *str) -{ - FILE *fp = 0; - fp = fopen_dir(ZCfgPath, "zsnes.dbg", "w"); - if (!fp) { return; } - fputs(str, fp); - fclose(fp); -} - -//I want to port over the more complicated -//functions from init.asm, or replace with -//better versions from NSRT. -Nach - -//init.asm goodness -extern unsigned int NumofBanks; -extern unsigned int NumofBytes; -extern unsigned int *romdata; -extern unsigned char romtype; -extern unsigned char Interleaved; - -unsigned int maxromspace; -unsigned int curromspace; -unsigned int infoloc; -unsigned int ramsize; -unsigned int ramsizeand; - -bool SplittedROM; -unsigned int addOnStart; -unsigned int addOnSize; - - -//Deinterleave functions -bool validChecksum(unsigned char *ROM, int BankLoc) -{ - if (ROM[BankLoc + InvCSLowOffset] + (ROM[BankLoc + InvCSHiOffset] << 8) + - ROM[BankLoc + CSLowOffset] + (ROM[BankLoc + CSHiOffset] << 8) == 0xFFFF) - { - return(true); - } - return(false); -} - -bool valid_normal_bank(unsigned char bankbyte) -{ - switch (bankbyte) - { - case 32: case 33: case 48: case 49: - return(true); - break; - } - return(false); -} - -bool EHiHeader(unsigned char *ROM, int BankLoc) -{ - if (validChecksum(ROM, BankLoc) && (ROM[BankLoc+BankOffset] == 53 || ROM[BankLoc+BankOffset] == 37)) - { - return(true); - } - return(false); -} - -void SwapData(unsigned int *loc1, unsigned int *loc2, unsigned int amount) -{ - unsigned int temp; - while (amount--) - { - temp = *loc1; - *loc1++ = *loc2; - *loc2++ = temp; - } -} - -void swapBlocks(char *blocks) -{ - unsigned int i, j; - for (i = 0; i < NumofBanks; i++) - { - for (j = 0; j < NumofBanks; j++) - { - if (blocks[j] == (char)i) - { - char b; - SwapData(romdata + blocks[i]*0x2000, romdata + blocks[j]*0x2000, 0x2000); - b = blocks[j]; - blocks[j] = blocks[i]; - blocks[i] = b; - break; - } - } - } -} - -void deintlv1() -{ - char blocks[256]; - int i, numblocks = NumofBanks/2; - for (i = 0; i < numblocks; i++) - { - blocks[i * 2] = i + numblocks; - blocks[i * 2 + 1] = i; - } - swapBlocks(blocks); -} - -void CheckIntl1(unsigned char *ROM) -{ - unsigned int ROMmidPoint = NumofBytes / 2; - if (validChecksum(ROM, ROMmidPoint + Lo) && - !validChecksum(ROM, Lo) && - ROM[ROMmidPoint+Lo+CountryOffset] < 14) //Country Code - { - deintlv1(); - Interleaved = true; - } - else if (validChecksum(ROM, Lo) && !validChecksum(ROM, Hi) && - ROM[Lo+CountryOffset] < 14 && //Country code - //Rom make up - (ROM[Lo+BankOffset] == 33 || ROM[Lo+BankOffset] == 49 || - ROM[Lo+BankOffset] == 53 || ROM[Lo+BankOffset] == 58)) - { - if (ROM[Lo+20] == 32 ||//Check that Header name did not overflow - !(ROM[Lo+BankOffset] == ROM[Lo+20] || ROM[Lo+BankOffset] == ROM[Lo+19] || - ROM[Lo+BankOffset] == ROM[Lo+18] || ROM[Lo+BankOffset] == ROM[Lo+17])) - { - deintlv1(); - Interleaved = true; - } - } -} - -void CheckIntlEHi(unsigned char *ROM) -{ - if (EHiHeader(ROM, Lo)) - { - unsigned int oldNumBanks = NumofBanks; - - //Swap 4MB ROM with the other one - SwapData(romdata, romdata+((NumofBytes-0x400000)/4), 0x100000); - - //Deinterleave the 4MB ROM first - NumofBanks = 128; - deintlv1(); - - //Now the other one - NumofBanks = oldNumBanks - 128; - romdata += 0x100000; //Ofset pointer - deintlv1(); - - //Now fix the data and we're done - NumofBanks = oldNumBanks; - romdata -= 0x100000; - - Interleaved = true; - } -} - -//ROM loading functions, which some strangly enough were in guiload.inc -bool AllASCII(unsigned char *b, int size) -{ - int i; - for (i = 0; i < size; i++) - { - if (b[i] && (b[i] < 32 || b[i] > 126)) - { - return(false); - } - } - return(true); -} - -//Code to detect if opcode sequence is a valid and popular one for an SNES ROM -//Code by Cowering -static bool valid_start_sequence(unsigned char opcode1, unsigned char opcode2, unsigned char opcode3) -{ - switch (opcode1) - { - case 0x78: case 0x5c: case 0x18: case 0xad: - return(true); - break; - case 0x4b: - if (opcode2 == 0xab && (opcode3 == 0x18 || opcode3 == 0x20)) - { - return(true); - } - break; - case 0x4c: - if ((opcode2 == 0x00 || opcode2 == 0xc0) && opcode3 == 0x84) - { - return(true); - } - if (opcode2 == 0x6d && opcode3 == 0x86) - { - return(true); - } - if (opcode2 == 0x00 && opcode3 == 0x80) - { - return(true); - } - break; - case 0xc2: - if (opcode2 == 0x30 && opcode3 == 0xa9) - { - return(true); - } - break; - case 0x20: - if ((opcode2 == 0x16 || opcode2 == 0x06) && opcode3 == 0x80) - { - return(true); - } - break; - case 0x80: - if ((opcode2 == 0x16 && opcode3 == 0x4c) || - (opcode2 == 0x07 && opcode3 == 0x82)) - { - return(true); - } - break; - case 0x9c: - if (opcode2 == 0x00 && opcode3 == 0x21) - { - return(true); - } - break; - case 0xa2: - if (opcode2 == 0xff && opcode3 == 0x86) - { - return(true); - } - break; - case 0xa9: - if ((opcode2 == 0x00 && (opcode3 = 0x48 || opcode3 == 0x4b)) || - (opcode2 == 0x8f && opcode3 == 0x8d) || - (opcode2 == 0x20 && opcode3 == 0x4b) || - (opcode2 == 0x1f && opcode3 == 0x4b)) - { - return(true); - } - break; - } - return(false); -} - -static int valid_reset(unsigned char *Buffer) -{ - unsigned char *ROM = (unsigned char *)romdata; - unsigned short Reset = Buffer[ResetLoOffset] | ((unsigned short)Buffer[ResetHiOffset] << 8); - if ((Reset != 0xFFFF) && (Reset & 0x8000)) - { - unsigned char opcode1 = ROM[(Reset+0) & 0x7FFF]; - unsigned char opcode2 = ROM[(Reset+1) & 0x7FFF]; - unsigned char opcode3 = ROM[(Reset+2) & 0x7FFF]; - - if (valid_start_sequence(opcode1, opcode2, opcode3)) - { - return(10); - } - return(2); - } - return(-4); -} - -int InfoScore(unsigned char *Buffer) -{ - int score = valid_reset(Buffer); - if (validChecksum(Buffer, 0)) { score += 5; } - if (Buffer[CompanyOffset] == 0x33) { score += 3; } - if (!Buffer[ROMSizeOffset]) { score += 2; } - if ((1 << (Buffer[ROMSizeOffset] - 7)) > 48) { score -= 2; } - if ((8 << Buffer[SRAMSizeOffset]) > 1024) { score -= 2; } - if (Buffer[CountryOffset] < 14) { score += 2; } - if (!AllASCII(Buffer, 20)) { score -= 2; } - if (valid_normal_bank(Buffer[BSBankOffset])) { score += 2; } - return(score); -} - -extern unsigned char ForceHiLoROM; -extern unsigned char forceromtype; - -void BankCheck() -{ - unsigned char *ROM = (unsigned char *)romdata; - infoloc = 0; - Interleaved = false; - - if (NumofBytes < Lo) - { - romtype = 1; - infoloc = 1; //Whatever, we just need a valid location - } - - if (NumofBytes < Hi) - { - romtype = 1; - infoloc = Lo; - } - - if (NumofBytes >= 0x500000) - { - //Deinterleave if neccesary - CheckIntlEHi(ROM); - - if (EHiHeader(ROM, EHi)) - { - romtype = 2; - infoloc = EHi; - } - } - - if (!infoloc) - { - static bool CommandLineForce2 = false; - int loscore, hiscore; - - //Deinterleave if neccesary - CheckIntl1(ROM); - - loscore = InfoScore(ROM+Lo); - hiscore = InfoScore(ROM+Hi); - - switch(ROM[Lo + BankOffset]) - { - case 32: case 35: case 48: case 50: - loscore += 3; - break; - } - switch(ROM[Hi + BankOffset]) - { - case 33: case 49: case 53: case 58: - hiscore += 3; - break; - } - - /* - Force code. - ForceHiLoROM is from the GUI. - forceromtype is from Command line, we have a static var - to prevent forcing a secong game loaded from the GUI when - the first was loaded from the command line with forcing. - */ - if (ForceHiLoROM == 1 || - (forceromtype == 1 && !CommandLineForce2)) - { - CommandLineForce2 = true; - loscore += 50; - } - else if (ForceHiLoROM == 2 || - (forceromtype == 2 && !CommandLineForce2)) - { - CommandLineForce2 = true; - hiscore += 50; - } - - if (hiscore > loscore) - { - romtype = 2; - infoloc = Hi; - } - else - { - romtype = 1; - infoloc = Lo; - } - } -} - -//Chip detection functions -bool CHIPBATT, BSEnable, C4Enable, DSP1Enable, DSP2Enable, DSP3Enable; -bool DSP4Enable, OBCEnable, RTCEnable, SA1Enable, SDD1Enable, SFXEnable; -bool SETAEnable; //ST010 & 11 -bool SGBEnable, SPC7110Enable, ST18Enable; - -void chip_detect() -{ - unsigned char *ROM = (unsigned char *)romdata; - - C4Enable = RTCEnable = SA1Enable = SDD1Enable = OBCEnable = CHIPBATT = false; - SGBEnable = ST18Enable = DSP1Enable = DSP2Enable = DSP3Enable = false; - DSP4Enable = SPC7110Enable = BSEnable = SFXEnable = SETAEnable = false; - - //DSP Family - if (ROM[infoloc+TypeOffset] == 3) - { - if (ROM[infoloc+BankOffset] == 48) { DSP4Enable = true; } - else { DSP1Enable = true; } - return; - } - - if (ROM[infoloc+TypeOffset] == 5) - { - CHIPBATT = true; - if (ROM[infoloc+BankOffset] == 32) { DSP2Enable = true; } - else if (ROM[infoloc+BankOffset] == 48 && ROM[infoloc+CompanyOffset] == 0xB2) //Bandai - { DSP3Enable = true; } - else { DSP1Enable = true; } - return; - } - - switch((unsigned short)ROM[infoloc+BankOffset] | (ROM[infoloc+TypeOffset] << 8)) - { - case 0x1320: //Mario Chip 1 - case 0x1420: //GSU-x - SFXEnable = true; - return; - break; - - case 0x1520: //GSU-x + Battery - case 0x1A20: //GSU-1 + Battery + Start in 21MHz - SFXEnable = true; - CHIPBATT = true; - return; - break; - - case 0x2530: - OBCEnable = true; - CHIPBATT = true; - return; - break; - - case 0x3423: - SA1Enable = true; - return; - break; - - case 0x3223: //One sample game seems to use this for some reason - case 0x3523: - SA1Enable = true; - CHIPBATT = true; - return; - break; - - case 0x4332: - SDD1Enable = true; - return; - break; - - case 0x4532: - SDD1Enable = true; - CHIPBATT = true; - return; - break; - - case 0x5535: - RTCEnable = true; - CHIPBATT = true; - return; - break; - - case 0xE320: - SGBEnable = true; - return; - break; - - case 0xF320: - C4Enable = true; - return; - break; - - case 0xF530: - ST18Enable = true; - CHIPBATT = true; //Check later if this should be removed - return; - break; - - case 0xF53A: - SPC7110Enable = true; - CHIPBATT = true; - return; - break; - - case 0xF630: - SETAEnable = true; - CHIPBATT = true; - return; - break; - - case 0xF93A: - SPC7110Enable = true; - RTCEnable = true; - CHIPBATT = true; - return; - break; - } - - //BS Dump - if ((ROM[infoloc+CompanyOffset] == 0x33 || ROM[infoloc+CompanyOffset] == 0xFF) && - (!ROM[infoloc+BSYearOffset] || (ROM[infoloc+BSYearOffset] & 131) == 128) && - valid_normal_bank(ROM[infoloc+BSBankOffset])) - { - unsigned char m = ROM[infoloc+BSMonthOffset]; - if (!m && !ROM[infoloc+BSDayOffset]) - { - //BS Add-on cart - return; - } - if ((m == 0xFF && ROM[infoloc+BSDayOffset] == 0xFF) || - (!(m & 0xF) && ((m >> 4) - 1 < 12))) - { - BSEnable = true; - return; - } - } -} - -//Checksum functions -unsigned short sum(unsigned char *array, unsigned int size) -{ - unsigned short theSum = 0; - unsigned int i; - - //Prevent crashing by reading too far (needed for messed up ROMs) - if (array + size > (unsigned char *)romdata + maxromspace) - { - return(0xFFFF); - } - - for (i = 0; i < size; i++) - { - theSum += array[i]; - } - return(theSum); -} - -static unsigned short Checksumvalue; -void CalcChecksum() -{ - unsigned char *ROM = (unsigned char *)romdata; - - if (SplittedROM) - { - Checksumvalue = sum(ROM+addOnStart, addOnSize); - Checksumvalue -= sum(ROM+infoloc+addOnStart-16, 48); - } - else if (SPC7110Enable) - { - Checksumvalue = sum(ROM, curromspace); - } - else - { - Checksumvalue = sum(ROM, curromspace); - if (NumofBanks > 128 && maxromspace == 6*MB_bytes) - { - Checksumvalue += sum(ROM+4*MB_bytes, 2*MB_bytes); - } - if (BSEnable) - { - Checksumvalue -= sum(&ROM[infoloc - 16], 48); //Fix for BS Dumps - } - } -} - -static void rom_memcpy(unsigned char *dest, unsigned char *src, size_t len) -{ - unsigned char *endrom = (unsigned char *)romdata+maxromspace; - while (len-- && (dest < endrom) && (src < endrom)) - { - *dest++ = *src++; - } -} - -//This will mirror up non power of two ROMs to powers of two -static unsigned int mirror_rom(unsigned char *start, unsigned int length) -{ - unsigned int mask = 0x800000; - while (!(length & mask)) { mask >>= 1; } - - length -= mask; - if (length) - { - start += mask; - length = mirror_rom(start, length); - - while (length != mask) - { - rom_memcpy(start+length, start, length); - length += length; - } - } - - return(length+mask); -} - -//Misc functions -void MirrorROM(unsigned char *ROM) -{ - unsigned int ROMSize, StartMirror = 0; - if (!SPC7110Enable) - { - curromspace = mirror_rom((unsigned char *)romdata, curromspace); - } - else if (curromspace == 0x300000) - { - memcpy((unsigned char *)romdata+curromspace, romdata, curromspace); - curromspace += curromspace; - } - - if (curromspace > maxromspace) - { - curromspace = maxromspace; - } - NumofBanks = curromspace >> 15; - - //This will mirror (now) full sized ROMs through the ROM buffer - ROMSize = curromspace; - while (ROMSize < maxromspace) - { - ROM[ROMSize++] = ROM[StartMirror++]; - } - - //If ROM was too small before, but now decent size with mirroring, adjust location - if (infoloc < Lo) - { - infoloc = Lo; - } -} - - -void SetupSramSize() -{ - unsigned char *ROM = (unsigned char *)romdata; - if (BSEnable) - { - ramsize = 0; - } - else if (SFXEnable) - { - if (ROM[infoloc+CompanyOffset] == 0x33) //Extended header - { - ramsize = 8 << ((unsigned int)ROM[infoloc-3]); - } - else - { - ramsize = 256; - } - } - else if (SETAEnable) - { - ramsize = 32; - } - else if (!strncmp((char *)ROM, "BANDAI SFC-ADX", 14)) - { // For the Sufami Turbo - ramsize = 8 << ((unsigned int)ROM[0x100032]); - } - else - { - ramsize = ((ROM[infoloc+SRAMSizeOffset]) ? (8 << ((unsigned int)ROM[infoloc+SRAMSizeOffset])) : 0); - } - - //Fix if some ROM goes nuts on size - if (ramsize > 1024) - { - ramsize = 1024; - } - - //Convert from Kb to bytes; - ramsize *= 128; - ramsizeand = ramsize-1; -} - -//File loading code -bool Header512; - -char CSStatus[41], CSStatus2[41], CSStatus3[41], CSStatus4[41]; - -void DumpROMLoadInfo() -{ - FILE *fp = 0; - - if (RomInfo) //rominfo.txt info dumping enabled? - { - fp = fopen_dir(ZCfgPath, "rominfo.txt", "w"); - if (!fp) { return; } - fputs("This is the info for the last game you ran.\n\nFile: ", fp); - fputs(ZCartName, fp); - fputs(" Header: ", fp); - fputs(Header512 ? "Yes\n" : "No\n", fp); - fputs(CSStatus, fp); - fputs("\n", fp); - fputs(CSStatus2, fp); - fputs("\n", fp); - fputs(CSStatus3, fp); - fputs("\n", fp); - fputs(CSStatus4, fp); - fputs("\n", fp); - fclose(fp); - } -} - -void loadFile(char *filename) -{ - bool multifile = false; - char *incrementer = 0; - unsigned char *ROM = (unsigned char *)romdata; - - if (strlen(filename) >= 3) //Char + ".1" - { - char *ext = filename+strlen(filename)-2; - if (!strcmp(ext, ".1") || !strcasecmp(ext, ".A")) - { - incrementer = ext + 1; - multifile = true; - } - } - - for (;;) - { - struct stat stat_results; - stat_dir(ZRomPath, filename, &stat_results); - - if ((unsigned int)stat_results.st_size <= maxromspace+512-curromspace) - { - FILE *fp = 0; - fp = fopen_dir(ZRomPath, filename, "rb"); - - if (!fp) { return; } - - if (curromspace && ((stat_results.st_size & 0x7FFF) == 512)) - { - stat_results.st_size -= 512; - fseek(fp, 512, SEEK_SET); - } - - fread(ROM+curromspace, stat_results.st_size, 1, fp); - fclose(fp); - - curromspace += stat_results.st_size; - - if (!multifile) { return; } - - (*incrementer)++; - } - else - { - return; - } - } -} - -void loadGZipFile(char *filename) -{ - //Open file for size reading - FILE *fp = fopen_dir(ZRomPath, filename, "rb"); - if (fp) - { - int fsize, gzsize; - gzFile GZipFile; - - fseek(fp, -4, SEEK_END); - gzsize = fread4(fp); - fsize = ftell(fp); - rewind(fp); - - //Open GZip file for decompression, use existing file handle - if ((GZipFile = gzdopen(fileno(fp), "rb"))) - { - int len = gzdirect(GZipFile) ? fsize : gzsize; - if (len && ((unsigned int)len <= maxromspace+512) && (gzread(GZipFile, romdata, len) == len)) - { - curromspace = len; //Success - } - gzclose(GZipFile); - } - fclose(fp); - } -} - -void loadZipFile(char *filename) -{ - int err, fileSize; - unsigned char *ROM = (unsigned char *)romdata; - bool multifile = false, NSS = false; - char *incrementer = 0; - - unzFile zipfile = unzopen_dir(ZRomPath, filename); //Open zip file - int cFile = unzGoToFirstFile(zipfile); //Set cFile to first compressed file - unz_file_info cFileInfo; //Create variable to hold info for a compressed file - - int LargestGoodFile = 0; //To keep track of largest file - - //Variables for the file we pick - char ourFile[256]; - ourFile[0] = '\n'; - - while(cFile == UNZ_OK) //While not at end of compressed file list - { - //Temporary char array for file name - char cFileName[256]; - - //Gets info on current file, and places it in cFileInfo - unzGetCurrentFileInfo(zipfile, &cFileInfo, cFileName, 256, NULL, 0, NULL, 0); - - //Get the file's size - fileSize = cFileInfo.uncompressed_size; - - //Find split files - if (strlen(cFileName) >= 3) //Char + ".1" - { - char *ext = cFileName+strlen(cFileName)-2; - if (!strcmp(ext, ".1") || !strcasecmp(ext, ".A")) - { - strcpy(ourFile, cFileName); - incrementer = ourFile+strlen(ourFile)-1; - multifile = true; - break; - } - } - - //Find Nintendo Super System ROMs - if (strlen(cFileName) >= 5) //Char + ".IC2" - { - char *ext = cFileName+strlen(cFileName)-4; - if (!strncasecmp(ext, ".IC", 3)) - { - strcpy(ourFile, cFileName); - incrementer = ourFile+strlen(ourFile)-1; - *incrementer = '7'; - NSS = true; - break; - } - } - - //Check for valid ROM based on size - if (((unsigned int)fileSize <= maxromspace+512) && - (fileSize > LargestGoodFile)) - { - strcpy(ourFile, cFileName); - LargestGoodFile = fileSize; - } - - //Go to next file in zip file - cFile = unzGoToNextFile(zipfile); - } - - //No files found - if (ourFile[0] == '\n') - { - unzClose(zipfile); - return; - } - - for (;;) - { - //Sets current file to the file we liked before - if (unzLocateFile(zipfile, ourFile, 1) != UNZ_OK) - { - if (NSS) - { - (*incrementer)--; - continue; - } - unzClose(zipfile); - return; - } - - //Gets info on current file, and places it in cFileInfo - unzGetCurrentFileInfo(zipfile, &cFileInfo, ourFile, 256, NULL, 0, NULL, 0); - - //Get the file's size - fileSize = cFileInfo.uncompressed_size; - - //Too big? - if (curromspace + fileSize > maxromspace+512) - { - unzClose(zipfile); - return; - } - - //Open file - unzOpenCurrentFile(zipfile); - - //Read file into memory - err = unzReadCurrentFile(zipfile, ROM+curromspace, fileSize); - - //Close file - unzCloseCurrentFile(zipfile); - - //Encountered error? - if (err != fileSize) - { - unzClose(zipfile); - return; - } - - if (curromspace && ((fileSize & 0x7FFF) == 512)) - { - fileSize -= 512; - memmove(ROM+curromspace, ROM+curromspace+512, fileSize); - } - - curromspace += fileSize; - - if (NSS) - { - if (!*incrementer) { return; } - (*incrementer)--; - continue; - } - - if (!multifile) - { - unzClose(zipfile); - return; - } - (*incrementer)++; - } -} - -void load_file_fs(char *path) -{ - unsigned char *ROM = (unsigned char *)romdata; - - if (isextension(path, "jma")) - { - #ifdef NO_JMA - puts("This binary was built without JMA support."); - #else - load_jma_file_dir(ZRomPath, path); - #endif - } - if (isextension(path, "zip")) - { - loadZipFile(path); - } - if (isextension(path, "gz")) - { - loadGZipFile(path); - } - else - { - loadFile(path); - } - - if ((curromspace & 0x7FFF) == 512) - { - memmove(ROM, ROM+512, addOnStart); - curromspace -= 512; - } -} - -char *STCart2 = 0; -unsigned char *sram2; -extern unsigned char *sram; - -void SplitSetup(char *basepath, char *basefile, unsigned int MirrorSystem) -{ - unsigned char *ROM = (unsigned char *)romdata; - - curromspace = 0; - if (maxromspace < addOnStart+addOnSize) { return; } - memmove(ROM+addOnStart, ROM, addOnSize); - - if (!*basepath) - { - load_file_fs(basefile); - } - else - { - load_file_fs(basepath); - } - - if (!curromspace) { return; } - - switch (MirrorSystem) - { - case 1: - memcpy(ROM+0x100000, ROM, 0x100000); //Mirror 8 to 16 - break; - - case 2: - memcpy(ROM+0x180000, ROM+0x100000, 0x80000); //Mirrors 12 to 16 - memcpy(ROM+0x200000, ROM+0x400000, 0x80000); //Copy base over - memset(ROM+0x280000, 0, 0x180000); //Blank out rest - break; - - case 3: - memcpy(ROM+0x40000, ROM, 0x40000); - memcpy(ROM+0x80000, ROM, 0x80000); - break; - } - - curromspace = addOnStart+addOnSize; - SplittedROM = true; -} - -void SplitSupport() -{ - char *ROM = (char *)romdata; - SplittedROM = false; - - //Same Game add on - if (curromspace == 0x80000 && ROM[Hi+CompanyOffset] == 0x33 && - !ROM[Hi+BankOffset] && !ROM[Hi+BSMonthOffset] && !ROM[Hi+BSDayOffset]) - { - addOnStart = 0x200000; - addOnSize = 0x80000; - SplitSetup(SGPath, "SAMEGAME.ZIP", 1); - } - - //SD Gundam G-Next add on - if (curromspace == 0x80000 && ROM[Lo+CompanyOffset] == 0x33 && - !ROM[Lo+BankOffset] && !ROM[Lo+BSMonthOffset] && !ROM[Lo+BSDayOffset] && !strncmp(ROM+Lo, "GNEXT", 5)) - { - addOnStart = 0x400000; - addOnSize = 0x80000; - SplitSetup(GNextPath, "G-NEXT.ZIP", 2); - addOnStart = 0x200000; //Correct for checksum calc - } - - //Sufami Turbo - if (!strncmp(ROM, "BANDAI SFC-ADX", 14)) - { - if (!STCart2) - { - addOnStart = 0x100000; - addOnSize = curromspace; - SplitSetup(STPath, "STBIOS.ZIP", 3); - } - else if (maxromspace >= (curromspace<<2)+0x100000) - { - memcpy(ROM+curromspace+curromspace, ROM, curromspace); - memcpy(ROM+curromspace*3, ROM, curromspace); - curromspace = 0; - load_file_fs(STCart2); - memcpy(ROM+curromspace, ROM, curromspace); - SwapData(romdata, romdata+(curromspace>>1), curromspace>>1); - addOnSize = curromspace<<2; - addOnStart = 0x100000; - SplitSetup(STPath, "STBIOS.ZIP", 3); - addOnSize = (curromspace-addOnStart) >> 2; //Correct for checksum calc - sram2 = sram+65536; - } - } -} - -bool NSRTHead(unsigned char *ROM) -{ - unsigned char *NSRTHead = ROM + 0x1D0; //NSRT Header Location - - if (!strncmp("NSRT", (char*)&NSRTHead[24],4) && NSRTHead[28] == 22) - { - if ((sum(NSRTHead, 32) & 0xFF) != NSRTHead[30] || - NSRTHead[30] + NSRTHead[31] != 255 || - (NSRTHead[0] & 0x0F) > 13 || - ((NSRTHead[0] & 0xF0) >> 4) > 3 || - ((NSRTHead[0] & 0xF0) >> 4) == 0) - { - return(false); //Corrupt - } - return(true); //NSRT header - } - return(false); //None -} - -void calculate_state_sizes(), InitRewindVars(), zst_init(); -bool findZipIPS(char *, char *); -extern bool EMUPause; -extern unsigned char device1, device2; -unsigned char lorommapmode2, curromsize, snesinputdefault1, snesinputdefault2; -bool input1gp, input1mouse, input2gp, input2mouse, input2scope, input2just; - -void loadROM() -{ - bool isCompressed = false, isZip = false; - - zst_init(); - - EMUPause = false; - curromspace = 0; - - if (isextension(ZCartName, "jma")) - { - #ifdef NO_JMA - puts("This binary was built without JMA support."); - #else - isCompressed = true; - load_jma_file_dir(ZRomPath, ZCartName); - #endif - } - else if (isextension(ZCartName, "zip")) - { - isCompressed = true; - isZip = true; - loadZipFile(ZCartName); - } - else if (isextension(ZCartName, "gz")) - { - isCompressed = true; - loadGZipFile(ZCartName); - } - - if (!isCompressed) { loadFile(ZCartName); } - - Header512 = false; - - if (!curromspace) { return; } - - if (!strncmp("GAME DOCTOR SF 3", (char *)romdata, 16) || - !strncmp("SUPERUFO", (char *)romdata+8, 8)) - { - Header512 = true; - } - else - { - int HeadRemain = (curromspace & 0x7FFF); - switch(HeadRemain) - { - case 0: - break; - - case 512: - Header512 = true; - break; - - default: - { - unsigned char *ROM = (unsigned char *)romdata; - - //SMC/SWC header - if (ROM[8] == 0xAA && ROM[9]==0xBB && ROM[10]== 4) - { - Header512 = true; - } - //FIG header - else if ((ROM[4] == 0x77 && ROM[5] == 0x83) || - (ROM[4] == 0xDD && ROM[5] == 0x82) || - (ROM[4] == 0xDD && ROM[5] == 2) || - (ROM[4] == 0xF7 && ROM[5] == 0x83) || - (ROM[4] == 0xFD && ROM[5] == 0x82) || - (ROM[4] == 0x00 && ROM[5] == 0x80) || - (ROM[4] == 0x47 && ROM[5] == 0x83) || - (ROM[4] == 0x11 && ROM[5] == 2)) - { - Header512 = true; - } - break; - } - } - } - - device1 = 0; - device2 = 0; - input1gp = true; - input1mouse = true; - input2gp = true; - input2mouse = true; - input2scope = true; - input2just = true; - - if (Header512) - { - unsigned char *ROM = (unsigned char *)romdata; - if (NSRTHead(ROM)) - { - switch (ROM[0x1ED] & 0xF0) //Port 1 - { - case 0x00: //Gamepad - input1mouse = false; - break; - - case 0x10: //Mouse port 1 - device1 = 1; - input1gp = false; - break; - - case 0x20: //Mouse or Gamepad port 1 - device1 = 1; - break; - - case 0x90: //Lasabirdie - not yet supported - input1gp = false; - input1mouse = false; - break; - } - - switch (ROM[0x1ED] & 0x0F) //Port 1 - { - case 0x00: //Gamepad - input2mouse = false; - input2scope = false; - input2just = false; - break; - - case 0x01: //Mouse port 2 - device2 = 1; - input2gp = false; - input2scope = false; - input2just = false; - break; - - case 0x02: //Mouse or Gamepad port 2 - device1 = 2; - input2just = false; - input2scope = false; - break; - - case 0x03: //Super Scope port 2 - device2 = 2; - input2gp = false; - input2mouse = false; - input2just = false; - break; - - case 0x04: //Super Scope or Gamepad port 2 - device2 = 2; - input2mouse = false; - input2just = false; - break; - - case 0x05: //Justifier (Lethal Enforcer gun) port 2 - device2 = 3; - input2mouse = false; - input2scope = false; - break; - - case 0x06: //Multitap port 2 - input2gp = false; - input2mouse = false; - input2just = false; - input2scope = false; - break; - - case 0x07: //Mouse or Gamepad port 1, Mouse, Super Scope, or Gamepad port 2 - input2just = false; - break; - - case 0x08: //Mouse or Multitap port 2 - device2 = 1; - input2just = false; - input2scope = false; - break; - - case 0x09: //Lasabirdie - not yet supported - input2gp = false; - input2mouse = false; - input2just = false; - input2scope = false; - break; - - case 0x0A: //Barcode Battler - not yet supported - input2gp = false; - input2mouse = false; - input2just = false; - input2scope = false; - break; - } - } - curromspace -= 512; - memmove((unsigned char *)romdata, ((unsigned char *)romdata)+512, curromspace); - } - - snesinputdefault1 = device1; - snesinputdefault2 = device2; - - SplitSupport(); - - if (isZip) - { - int i; - char ext[4]; - - strcpy(ext, "ips"); - for (i = 0; findZipIPS(ZCartName, ext); i++) - { - if (i > 9) { break; } - ext[2] = i+'0'; - } - } - - if (curromspace) - { - unsigned char *ROM = (unsigned char *)romdata; - NumofBytes = curromspace; - NumofBanks = curromspace >> 15; - BankCheck(); - curromsize = ROM[infoloc+ROMSizeOffset]; - chip_detect(); - SetupSramSize(); - calculate_state_sizes(); - InitRewindVars(); - } -} - -//Memory Setup functions -extern unsigned char wramdataa[65536]; -extern unsigned char ram7fa[65536]; -extern unsigned char regptra[49152]; -extern unsigned char regptwa[49152]; -extern unsigned char vidmemch2[4096]; -extern unsigned char vidmemch4[4096]; -extern unsigned char vidmemch8[4096]; -extern unsigned char pal16b[1024]; -extern unsigned char pal16bcl[1024]; -extern unsigned char pal16bclha[1024]; -extern unsigned char pal16bxcl[256]; -extern unsigned char SPCRAM[65472]; - -extern unsigned char *sram; -extern unsigned char *vidbuffer; -extern unsigned char *vram; -extern unsigned char *vcache2b; -extern unsigned char *vcache4b; -extern unsigned char *vcache8b; -#ifdef OLD_DEBUGGER -extern unsigned char *debugbuf; -#endif -extern unsigned char *sram; - -void clearSPCRAM() -{ - /* - SPC RAM is filled with alternating 0x00 and 0xFF for 0x20 bytes. - - Basically the SPCRAM is initialized as follows: - xx00 - xx1f: $00 - xx20 - xx3f: $ff - xx40 - xx5f: $00 - xx60 - xx7f: $ff - xx80 - xx9f: $00 - xxa0 - xxbf: $ff - xxc0 - xxdf: $00 - xxe0 - xxff: $ff - */ - unsigned int i; - for (i = 0; i < 65472; i += 0x40) - { - memset(SPCRAM+i, 0, 0x20); - memset(SPCRAM+i+0x20, 0xFF, 0x20); - } -} - -void clearmem2() -{ - memset(sram, 0xFF, 65536); - clearSPCRAM(); -} - -void clearmem() -{ - int i; - - memset(vidbuffer, 0, 131072); - memset(wramdataa, 0, 65536); - memset(ram7fa, 0, 65536); - memset(vram, 0, 65536); - memset(sram, 0, 65536*2); -#ifdef OLD_DEBUGGER - memset(debugbuf, 0, 80000); -#endif - memset(regptra, 0, 49152); - memset(regptwa, 0, 49152); - memset(vcache2b, 0, 262144+256); - memset(vcache4b, 0, 131072+256); - memset(vcache8b, 0, 65536+256); - memset(vidmemch2, 0, 4096); - memset(vidmemch4, 0, 4096); - memset(vidmemch8, 0, 4096); - memset(pal16b, 0, 1024); - memset(pal16bcl, 0, 1024); - memset(pal16bclha, 0, 1024); - for (i=0 ; i<1024 ; i+=4) - { - memset(pal16bxcl+i, 255, 2); - memset(pal16bxcl+i+2, 0, 2); - } - memset(romdata, 0xFF, maxromspace+32768); - clearmem2(); -} - -extern unsigned char BRRBuffer[32]; -extern unsigned char echoon0; -extern unsigned int PHdspsave; -extern unsigned int PHdspsave2; -unsigned char echobuf[90000]; -extern unsigned char *spcBuffera; -extern unsigned char DSPMem[256]; - -void clearvidsound() -{ - memset(vram, 0, 65536); - memset(vidmemch2, 0, 4096); - memset(vidmemch4, 0, 4096); - memset(vidmemch8, 0, 4096); - memset(BRRBuffer, 0, PHdspsave); - memset(&echoon0, 0, PHdspsave2); - memset(echobuf, 0, 90000); - memset(spcBuffera, 0, 65536*4+4096); - memset(DSPMem, 0, 256); -} - -/* - ---------------Caution Hack City-------------- - -Would be nice to trash this section in the future -*/ - -extern unsigned char ENVDisable, cycpb268, cycpb358, cycpbl2, cycpblt2, cycpbl; -extern unsigned char cycpblt, opexec268, opexec358, opexec268b, opexec358b; -extern unsigned char opexec268cph, opexec358cph, opexec268cphb, opexec358cphb; -bool HacksDisable; - -void headerhack() -{ - char *RomData = (char *)romdata; - ENVDisable = 0; - - if (curromspace < Lo || HacksDisable) { return; } - - //Super Famista (J) - //Shows black screen after one screen. - if (!strncmp((RomData+Lo),"\xbd\xb0\xca\xdf\xb0\xcc\xa7\xd0\xbd\xc0 ", 12)) - { - RomData[0x2762F] = 0xEA; - RomData[0x27630] = 0xEA; - } - - //Super Famista 2 (J) - //Shows black screen after loading the ROM. - if (!strncmp((RomData+Lo),"\xbd\xb0\xca\xdf\xb0\xcc\xa7\xd0\xbd\xc0 2", 12)) - { - //Skip a check for value FF at 2140 when spc not initialized yet?!? - RomData[0x6CED] = 0xEA; - RomData[0x6CEE] = 0xEA; - //Skip a check for value FF at 2140 when spc not initialized yet?!? - RomData[0x6CF9] = 0xEA; - RomData[0x6CFA] = 0xEA; - } - - //Deae Tonosama Appare Ichiban (J) - //Shows some screen and hangs there. - if (!strncmp((RomData+Lo),"\xc3\xde\xb1\xb4\xc4\xc9\xbb\xcf", 8)) - { - RomData[0x17837C] = 0xEA; - RomData[0x17837D] = 0xEA; - } - - //Human Grand Prix III - F1 Triple Battle (J) - //Shows black screen after loading the ROM. - if (!strncmp((RomData+Lo),"HUMAN GRANDPRIX 3 ", 20)) - { - cycpb268 = 135; - cycpb358 = 157; - cycpbl2 = 125; - cycpblt2 = 125; - cycpbl = 125; - cycpblt = 125; - } - - //Accele Brid (J) - //Hangs after some time in the first level. - if (!strncmp((RomData+Lo),"ACCELEBRID ", 12)) - { - RomData[0x34DA2] = 0; - RomData[0x34DA3] = 0; - } - - //Home Alone (J/E/U) - //Hangs after starting a new game. - if (!strncmp((RomData+Lo),"HOME ALONE ", 12)) - { - RomData[0x666B] = 0xEE; - RomData[0x666C] = 0xBC; - } - - //Emerald Dragon (J) - //Hangs while drawing the logo after loading the ROM. - if (!strncmp((RomData+Hi),"EMERALD DRAG", 12)) - { - ENVDisable = true; - } - - //Rendering Ranger R2 - //Shows black screen after loading the ROM. - if (!strncmp((RomData+Lo),"REND", 4)) - { - cycpb268 = 157; - cycpb358 = 157; - cycpbl2 = 157; - cycpblt2 = 157; - cycpbl = 157; - cycpblt = 157; - } - - //Tuff E Nuff (U/E), Dead Dance (J), - //Cyber Knight II - Tikyu Teikoku no Yabou (J) - //Shows black screen after loading the ROM. (Tuff E Nuff, Dead Dance) - //Shows black screen after two screens. (Cyber Knight II) - if (!strncmp((RomData+Lo),"CYBER KNIGHT 2 ", 16) || - !strncmp((RomData+Lo),"DEAD", 4) || - !strncmp((RomData+Lo),"TUFF", 4)) - { - cycpb268 = 75; - cycpb358 = 77; - cycpbl2 = 75; - cycpblt2 = 75; - cycpbl = 75; - cycpblt = 75; - } - - //Addams Family Values (U/E) - //Restarts or shows a black screen after starting a new game. - if (!strncmp((RomData+Lo), "ADDAMS FAMILY VALUES", 20)) - { - opexec268 = 120; - opexec358 = 100; - } - - //Front Mission - //Flickering worldmap and statusbar. - if (!strncmp((RomData+Hi), "\xcc\xdb\xdd\xc4\xd0\xaf\xbc\xae", 8) || - !strncmp((RomData+Hi), "FRONT MI", 8)) - { - opexec268 = 226; - opexec358 = 226; - opexec268cph = 80; - opexec358cph = 80; - } -} - -void Setper2exec() -{ - if (per2exec != 100) - { // Decrease standard % of execution by 5% to replace branch and 16bit - // cycle deductions - opexec268b = (unsigned char)((opexec268 * 95 * per2exec) / 10000); - opexec358b = (unsigned char)((opexec358 * 87 * per2exec) / 10000); // 82 - opexec268cphb = (unsigned char)((opexec268cph * 95 * per2exec) / 10000); - opexec358cphb = (unsigned char)((opexec358cph * 87 * per2exec) / 10000); // 82 - } -} - -extern unsigned int SPC7110TempPosition, SPC7110TempLength, SPCDecmPtr; -static char *SPC7110path, SPC7110fname[8+1+6+4+1]; //dir / 12345 .bin -char *SPC7110filep; -extern unsigned char *SPC7110IndexPtr, *SPC7110PackPtr; -unsigned int SPC7110IndexSize; - -static void SPC7PathSetup(char *PathVar, const char *Default) -{ - if (*PathVar) - { - SPC7110path = PathVar; - strcatslash(SPC7110path); - *SPC7110fname = 0; - } - else - { - SPC7110path = ZSramPath; - strcpy(SPC7110fname, Default); - strcatslash(SPC7110fname); - } -} - -extern unsigned int MsgCount, MessageOn; -extern char *Msgptr; -unsigned int SPC7110Entries, CRC32; - -void SPC7PackIndexLoad() -{ - char *ROM = (char *)romdata; - FILE *fp = 0; - SPC7110IndexSize = 0; - - //Get correct path for the ROM we just loaded - if (!strncmp(ROM+infoloc, "HU TENGAI MAKYO ZERO ", 21)) - { SPC7PathSetup(FEOEZPath, "FEOEZSP7"); } - else if (!strncmp(ROM+infoloc, "JUMP TENGAIMAKYO ZERO", 21)) - { SPC7PathSetup(SJNSPath, "SJNS-SP7"); } - else if (!strncmp(ROM+infoloc, "MOMOTETSU HAPPY ", 21)) - { SPC7PathSetup(MDHPath, "MDH-SP7"); } - else if (!strncmp(ROM+infoloc, "SUPER POWER LEAG 4 ", 21)) - { SPC7PathSetup(SPL4Path, "SPL4-SP7"); } - else - { - Msgptr = "DECOMPRESSED PACK NOT FOUND"; - MessageOn = 360; - return; - } - - //Set the pointer to after the slash - needed for the case converters - SPC7110filep = SPC7110fname+strlen(SPC7110fname); - - //Index file; - strcat(SPC7110fname, "index.bin"); - - //Load the index - fp = fopen_dir(SPC7110path, SPC7110fname, "rb"); - if (fp) - { - SPC7110IndexSize = fread(SPC7110IndexPtr, 1, 12*4608, fp); - fclose(fp); - - //Get file pointer ready for individual pack files - strcpy(SPC7110filep, "123456.bin"); //Extension Lower Case - } - - SPC7110Entries = 0; - - if (!SPC7110IndexSize) - { - Msgptr = "DECOMPRESSED PACK NOT FOUND"; - MessageOn = 360; - } -} - -void SPC7_Convert_Upper() -{ - char *i = SPC7110filep; - while (*i) - { - *i = toupper(*i); //To make extension Upper case - i++; - } -} - -void SPC7_Convert_Lower() -{ - char *i = SPC7110filep; - while (*i) - { - *i = tolower(*i); //To make everything Lower case - i++; - } -} - -void SPC7_Data_Load() -{ - FILE *fp = fopen_dir(SPC7110path, SPC7110fname, "rb"); - if (!fp) - { - SPC7_Convert_Upper(); - fp = fopen_dir(SPC7110path, SPC7110fname, "rb"); - - if (!fp) - { - SPC7_Convert_Lower(); - fp = fopen_dir(SPC7110path, SPC7110fname, "rb"); - } - } - - if (fp) - { - fseek(fp, SPC7110TempPosition, SEEK_SET); - fread(SPC7110PackPtr, 1, SPC7110TempLength, fp); - fclose(fp); - } -} - -extern unsigned char IPSPatched; - -unsigned int showinfogui() -{ - unsigned int i; - unsigned char *ROM = (unsigned char *)romdata; - - strcpy(CSStatus, " TYPE: "); - strcpy(CSStatus2, "INTERLEAVED: CHKSUM: "); - strcpy(CSStatus3, "VIDEO: BANK: CRC32: "); - strcpy(CSStatus4, " "); - - for (i=0 ; i<21 ; i++) - { CSStatus[i] = (ROM[infoloc + i]) ? ROM[infoloc + i] : 32; } - - if (Interleaved) - { - memcpy(CSStatus2+12, "Yes ", 4); - memcpy(CSStatus4+10, "PLEASE DEINTERLEAVE ROM", 23); - } - else - { - memcpy(CSStatus2+12, "No ", 4); - memset(CSStatus4+10, ' ', 23); - } - - memcpy(CSStatus2+20, (IPSPatched) ? "IPS ":" ", 4); - memcpy(CSStatus3+6, (ROM[infoloc + 25] < 2 || ROM[infoloc + 25] > 12) ? "NTSC":"PAL ", 4); - - if (infoloc == EHi) { memcpy(CSStatus3+19, "EHi ", 4); } - else { memcpy(CSStatus3+19, (romtype == 2) ? "Hi ":"Lo ", 4); } - - memcpy(CSStatus+31, "NORMAL ", 9); - if (SA1Enable) { memcpy(CSStatus+31, "SA-1 ", 9); } - if (RTCEnable) { memcpy(CSStatus+31, "RTC ", 9); } - if (SPC7110Enable) { memcpy(CSStatus+31, "SPC7110 ", 9); } - if (SFXEnable) { memcpy(CSStatus+31, "SUPER FX ", 9); } - if (C4Enable) { memcpy(CSStatus+31, "C4 ", 9); } - if (DSP1Enable) { memcpy(CSStatus+31, "DSP-1 ", 9); } - if (DSP2Enable) { memcpy(CSStatus+31, "DSP-2 ", 9); } - if (DSP3Enable) { memcpy(CSStatus+31, "DSP-3 ", 9); } - if (DSP4Enable) { memcpy(CSStatus+31, "DSP-4 ", 9); } - if (SDD1Enable) { memcpy(CSStatus+31, "S-DD1 ", 9); } - if (OBCEnable) { memcpy(CSStatus+31, "OBC1 ", 9); } - if (SETAEnable) { memcpy(CSStatus+31, "SETA DSP ", 9); } - if (ST18Enable) { memcpy(CSStatus+31, "ST018 ", 9); } - if (SGBEnable) { memcpy(CSStatus+31, "SGB ", 9); } - if (BSEnable) { memcpy(CSStatus+31, "BROADCAST", 9); - // dummy out date so CRC32 matches - ROM[infoloc+BSMonthOffset] = 0x42; - ROM[infoloc+BSDayOffset] = 0x00; } - // 42 is the answer, and the uCONSRT standard - - // calculate CRC32 for the whole ROM, or Add-on ROM only - CRC32 = (SplittedROM) ? crc32(0, ROM+addOnStart, addOnSize) : crc32(0, ROM, NumofBytes); - // place CRC32 on line - sprintf(CSStatus3+32, "%08X", CRC32); - - i = (SplittedROM) ? infoloc + 0x1E + addOnStart: infoloc + 0x1E; - - if ((ROM[i] == (Checksumvalue & 0xFF)) && (ROM[i+1] == (Checksumvalue >> 8))) - { memcpy(CSStatus2+36, "OK ", 4); } - else - { - memcpy(CSStatus2+36, "FAIL", 4); - if (!IPSPatched) { memcpy(CSStatus4, "BAD ROM ",8); } - else { memset(CSStatus4, ' ', 7); } - } - - DumpROMLoadInfo(); - - MessageOn = 300; - Msgptr = CSStatus; - return (MsgCount); -} - -extern unsigned int nmiprevaddrl, nmiprevaddrh, nmirept, nmiprevline, nmistatus; -extern unsigned char spcnumread, yesoutofmemory; -extern unsigned char NextLineCache, sramsavedis, sndrot, regsbackup[3019]; -extern unsigned int Voice0Freq, Voice1Freq, Voice2Freq, Voice3Freq; -extern unsigned int Voice4Freq, Voice5Freq, Voice6Freq, Voice7Freq; -extern unsigned int dspPAdj; -extern unsigned short Voice0Pitch, Voice1Pitch, Voice2Pitch, Voice3Pitch; -extern unsigned short Voice4Pitch, Voice5Pitch, Voice6Pitch, Voice7Pitch; -void outofmemfix(), GUIDoReset(); - -void initpitch() -{ - Voice0Pitch = DSPMem[2+0*0x10]; - Voice0Freq = ((((Voice0Pitch & 0x3FFF) * dspPAdj) >> 8) & 0xFFFFFFFF); - Voice1Pitch = DSPMem[2+1*0x10]; - Voice1Freq = ((((Voice1Pitch & 0x3FFF) * dspPAdj) >> 8) & 0xFFFFFFFF); - Voice2Pitch = DSPMem[2+2*0x10]; - Voice2Freq = ((((Voice2Pitch & 0x3FFF) * dspPAdj) >> 8) & 0xFFFFFFFF); - Voice3Pitch = DSPMem[2+3*0x10]; - Voice3Freq = ((((Voice3Pitch & 0x3FFF) * dspPAdj) >> 8) & 0xFFFFFFFF); - Voice4Pitch = DSPMem[2+4*0x10]; - Voice4Freq = ((((Voice4Pitch & 0x3FFF) * dspPAdj) >> 8) & 0xFFFFFFFF); - Voice5Pitch = DSPMem[2+5*0x10]; - Voice5Freq = ((((Voice5Pitch & 0x3FFF) * dspPAdj) >> 8) & 0xFFFFFFFF); - Voice6Pitch = DSPMem[2+6*0x10]; - Voice6Freq = ((((Voice6Pitch & 0x3FFF) * dspPAdj) >> 8) & 0xFFFFFFFF); - Voice7Pitch = DSPMem[2+7*0x10]; - Voice7Freq = ((((Voice7Pitch & 0x3FFF) * dspPAdj) >> 8) & 0xFFFFFFFF); -} - -extern unsigned int SfxR1, SfxR2, SetaCmdEnable, SfxSFR, SfxSCMR; -extern unsigned char disablespcclr, *sfxramdata, SramExists; -extern unsigned char *setaramdata, *wramdata, *SA1RAMArea, cbitmode; -extern unsigned char ForcePal, ForceROMTiming, romispal, MovieWaiting, DSP1Type; -extern unsigned short totlines; -void SetAddressingModes(), GenerateBank0Table(); -void SetAddressingModesSA1(), GenerateBank0TableSA1(); -void InitDSP(), InitDSP2(), InitDSP3(), InitDSP4(), InitOBC1(), InitFxTables(); -void initregr(), initregw(); - -#ifdef __MSDOS__ -void dosmakepal(); -#endif - -void CheckROMType() -{ - unsigned char *ROM = (unsigned char *)romdata; - - if (!MovieWaiting) - { - MirrorROM((unsigned char *)romdata); - CalcChecksum(); - } - - lorommapmode2 = 0; - if (!strncmp((char *)ROM+0x207FC0, "DERBY STALLION 96", 17) || - !strncmp((char *)ROM+Lo, "SOUND NOVEL-TCOOL", 17)) - { lorommapmode2 = 1; } - - // Setup memmapping - SetAddressingModes(); - GenerateBank0Table(); - - disablespcclr = (memcmp(ROM+Hi, "BS Z", 4)) ? 0 : 1; - - if (!strncmp((char *)ROM, "BANDAI SFC-ADX", 14)) - { - map_mem(0x60, &stbanka, 0x08); - if (STCart2) - { - map_mem(0x70, &stbankb, 0x08); - } - } - else if (romtype == 1) // LoROM SRAM mapping - { // banks 70 - 77 - map_mem(0x70, &srambank, 0x08); - - if (!BSEnable) - { // banks 78 - 7D (not for BS) - map_mem(0x78, &srambank, 0x06); - } - - if (!SDD1Enable) - { // banks F0 - FF (not for S-DD1) - map_mem(0xF0, &srambank, 0x10); - } - } - - // Setup DSP-X stuff - DSP1Type = 0; - - if (DSP1Enable) - { - InitDSP(); - - if (romtype == 1) - { - DSP1Type = 1; - map_mem(0x30, &dsp1bank, 0x10); - map_mem(0xB0, &dsp1bank, 0x10); - map_mem(0xE0, &dsp1bank, 0x10); - } - else - { - DSP1Type = 2; - } - } - - if (DSP2Enable) - { - asm_call(InitDSP2); - map_mem(0x3F, &dsp2bank, 1); - } - - if (DSP3Enable) - { - InitDSP3(); - - // DSP-3 mapping, banks 20 - 3F - map_mem(0x20, &dsp3bank, 0x20); - } - - if (DSP4Enable) - { - InitDSP4(); - - // DSP-4 mapping, banks 30 - 3F - map_mem(0x30, &dsp4bank, 0x10); - } - - if (OBCEnable) - { - InitOBC1(); - - map_mem(0x00, &obc1bank, 0x40); - map_mem(0x80, &obc1bank, 0x40); - } - - if (C4Enable) - { - map_mem(0x00, &c4bank, 0x40); - map_mem(0x80, &c4bank, 0x40); - } - - if (SFXEnable) - { - // Setup SuperFX stuff - if (maxromspace >= 0x600000) - { - //SuperFX mapping, banks 70 - 73 - map_mem(0x70, &sfxbank, 1); - map_mem(0x71, &sfxbankb, 1); - map_mem(0x72, &sfxbankc, 1); - map_mem(0x73, &sfxbankd, 1); - - //SRAM mapping, banks 78 - 79 - map_mem(0x78, &sramsbank, 2); - - SfxR1 = 0; - SfxR2 = 0; - memset(sfxramdata, 0, 262144); // clear 256kB SFX ram - - if (SramExists) - { - memcpy(sfxramdata, sram, 65536); // proper SFX sram area - } - - asm_call(InitFxTables); - } - else - { - yesoutofmemory = 1; - } - } - - if (SETAEnable) - { - if (strncmp((char *)ROM+Lo, "2DAN MORITA SHOUGI", 18)) - { - //Setup Seta 10 stuff - - //Really banks 68h-6Fh:0000-7FFF are all mapped the same by the chip but - //F1 ROC II only uses bank 68h - map_mem(0x68, &setabank, 1); - - //Control register (and some status?) is in banks 60h-67h:0000-3FFF - map_mem(0x60, &setabanka, 1); - - SetaCmdEnable = 0x00000080; // 60:0000 - } - else - { - void ST011_Reset(); - ST011_Reset(); - map_mem(0x68, &seta11bank, 1); - map_mem(0x60, &seta11banka, 1); - } - memset(setaramdata, 0, 4096); // clear 4kB SETA ram - - // proper SETA sram area - if (SramExists) - { - memcpy(setaramdata, sram, 4096); - } - } - - // General stuff all mixed together [... wouldn't it be cool to clean that] - SfxSFR = 0; - SfxSCMR &= 0xFFFFFF00; - asm_call(initregr); - asm_call(initregw); - - if (SA1Enable) - { - SA1RAMArea = ROM + 4096*1024; - - GenerateBank0TableSA1(); - SetAddressingModesSA1(); - - if (CHIPBATT) // proper SA-1 sram area - { - memset(SA1RAMArea, 0, 131072); - if (SramExists) { memcpy(SA1RAMArea, sram, 131072); } - } - } - - wramdata = wramdataa; -} - -extern unsigned short copv, brkv, abortv, nmiv, nmiv2, irqv, irqv2, resetv; -extern unsigned short copv8, brkv8, abortv8, nmiv8, irqv8; - -void SetIRQVectors() -{ // get vectors (NMI & reset) - unsigned char *ROM = (unsigned char *)romdata; - - if (!memcmp(ROM+infoloc+36+24, "\0xFF\0xFF", 2)) // if reset error - { - memcpy(ROM+infoloc+36+6, "\0x9C\0xFF", 2); - memcpy(ROM+infoloc+36+24, "\0x80\0xFF", 2); - } - - memcpy(&copv, ROM+infoloc+0x24, 2); - memcpy(&brkv, ROM+infoloc+0x26, 2); - memcpy(&abortv, ROM+infoloc+0x28, 2); - memcpy(&nmiv, ROM+infoloc+0x2A, 2); - memcpy(&nmiv2, ROM+infoloc+0x2A, 2); - memcpy(&irqv, ROM+infoloc+0x2E, 2); - memcpy(&irqv2, ROM+infoloc+0x2E, 2); - - // 8-bit and reset - memcpy(&copv8, ROM+infoloc+0x34, 2); - memcpy(&abortv8, ROM+infoloc+0x38, 2); - memcpy(&nmiv8, ROM+infoloc+0x3A, 2); - memcpy(&resetv, ROM+infoloc+0x3C, 2); - memcpy(&brkv8, ROM+infoloc+0x3E, 2); - memcpy(&irqv8, ROM+infoloc+0x3E, 2); - - if (yesoutofmemory) // failed ? - { - resetv = 0x8000; - memcpy(ROM+0x0000, "\0x80\0xFE", 2); - memcpy(ROM+0x8000, "\0x80\0xFE", 2); - } -} - -void SetupROM() -{ - static bool CLforce = false; - unsigned char *ROM = (unsigned char *)romdata; - - CheckROMType(); - SetIRQVectors(); - - #ifdef __MSDOS__ - if (!cbitmode) // 8-bit mode uses a palette - { - asm_call(dosmakepal); - } - #endif - - /* get timing (pal/ntsc) - ForceROMTiming is from the GUI. - ForcePal is from Command line, we have a static var - to prevent forcing a secong game loaded from the GUI when - the first was loaded from the command line with forcing. - */ - if (ForcePal && !CLforce) { CLforce = true; } - else { ForcePal = ForceROMTiming; } - - switch (ForcePal) - { - case 1: - romispal = 0; - break; - case 2: - romispal = (!BSEnable); - break; - default: - romispal = ((!BSEnable) && (ROM[infoloc+CountryOffset] > 1) && (ROM[infoloc+CountryOffset] < 0xD)); - } - - #ifdef __UNIXSDL__ - InitSampleControl(); - #endif - - if (romispal) - { - totlines = 314; - MsgCount = 100; - } - else - { - totlines = 263; - MsgCount = 120; - } -} - -extern int NumComboLocl; -extern unsigned char ComboHeader[23]; -extern char CombinDataLocl[3300]; -extern bool romloadskip; - -void SaveCombFile() -{ - if (!romloadskip) - { - FILE *fp; - - setextension(ZSaveName, "cmb"); - - if (NumComboLocl) - { - ComboHeader[22] = NumComboLocl; - - if ((fp = fopen_dir(ZSramPath, ZSaveName, "wb"))) - { - fwrite(ComboHeader, 1, 23, fp); - fwrite(CombinDataLocl, 1, NumComboLocl*66, fp); - fclose(fp); - } - } - } -} - -void OpenCombFile() -{ - FILE *fp; - - setextension(ZSaveName, "cmb"); - NumComboLocl = 0; - - if ((fp = fopen_dir(ZSramPath, ZSaveName, "rb"))) - { - fread(ComboHeader, 1, 23, fp); - NumComboLocl = ComboHeader[22]; - - if (NumComboLocl) - { - fread(CombinDataLocl, 1, NumComboLocl*66, fp); - } - - fclose(fp); - } -} - -unsigned char SFXCounter, SfxAC, ForceNewGfxOff; - -void preparesfx() -{ - char *ROM = (char *)romdata, i; - - SFXCounter = SfxAC = 0; - - if (!strncmp(ROM+Lo, "FX S", 4) || - !strncmp(ROM+Lo, "DIRT", 4)) - { - SFXCounter = 1; - } - else if (!strncmp(ROM+Lo, "Stun", 4)) - { - ForceNewGfxOff=1; - } - - for (i=63;i>=0;i--) - { - memcpy(romdata+i*0x4000 ,romdata+i*0x2000,0x8000); - memcpy(romdata+i*0x4000+0x2000,romdata+i*0x2000,0x8000); - } -} - -void map_set(void **dest, unsigned char *src, size_t count, size_t step) -{ - while (count--) - { - *dest = src; - dest++; - src += step; - } -} - -extern unsigned char MultiType; -extern void *snesmmap[256]; -extern void *snesmap2[256]; - -unsigned int cromptradd; -extern unsigned char MultiTap; -extern unsigned int SfxR0, SfxR1, SfxR2, SfxR3, SfxR4, SfxR5, SfxR6, SfxR7, - SfxR8, SfxR9, SfxR10, SfxR11, SfxR12, SfxR13, SfxR14, SfxR15; -extern void *ram7f; - -void map_lorom() -{ - unsigned char *ROM = (unsigned char *)romdata; - int x; - - // set addresses 8000-FFFF - // set banks 00-7F (80h x 32KB ROM banks @ 8000h) - map_set(snesmmap,ROM-0x8000,0x80,0x8000); - - // set banks 80-FF (80h x 32KB ROM banks @ 8000h) - if (lorommapmode2) - { - map_set(snesmmap+0x80,ROM+0x1F8000,0x20,0x8000); - map_set(snesmmap+0xA0,ROM+0x0F8000,0x60,0x8000); - } - else - { - map_set(snesmmap+0x80,ROM-0x8000,0x80,0x8000); - } - - // set addresses 0000-7FFF - // set banks 00-3F (40h x WRAM) - map_set(snesmap2,wramdata,0x40,0); - - // set banks 40-7F (40h x 32KB ROM banks @ 8000h) - map_set(snesmap2+0x40,ROM+0x200000,0x40,0x8000); - - // set banks 80-BF (40h x WRAM) - map_set(snesmap2+0x80,wramdata,0x40,0); - - // set banks C0-FF (40h x 32KB ROM banks @ 8000h) - map_set(snesmap2+0xC0,ROM+0x200000,0x40,0x8000); - - // set banks 70-77 (07h x SRAM) - for (x = 0x70; x <= 0x77; x++) { snesmap2[x] = sram; } - - // set banks 7E/7F (WRAM) - snesmmap[0x7E] = snesmap2[0x7E] = wramdata; - snesmmap[0x7F] = snesmap2[0x7F] = ram7f; -} - -void map_hirom() -{ - unsigned char *ROM = (unsigned char *)romdata; - int x; - - // set addresses 8000-FFFF - // set banks 00-3F (40h x 64KB ROM banks @10000h) - map_set(snesmmap,ROM,0x40,0x10000); - - // set banks 40-7F (40h x 64KB ROM banks @10000h) - map_set(snesmmap+0x40,ROM,0x40,0x10000); - - // set banks 80-BF (40h x 64KB ROM banks @10000h) - map_set(snesmmap+0x80,ROM,0x40,0x10000); - - // set banks C0-FF (40h x 64KB ROM banks @10000h) - map_set(snesmmap+0xC0,ROM,0x40,0x10000); - - // set addresses 0000-7FFF - // set banks 00-3F (40h x WRAM) - map_set(snesmap2,wramdata,0x40,0); - - // set banks 40-7F (40h x 64KB ROM banks @10000h) - map_set(snesmap2+0x40,ROM,0x40,0x10000); - - // set banks 80-BF (40h x WRAM) - map_set(snesmap2+0x80,wramdata,0x40,0); - - // set banks C0-FF (40h x 64KB ROM banks @10000h) - map_set(snesmap2+0xC0,ROM,0x40,0x10000); - - // set banks 70-77 (07h x SRAM) - for (x = 0x70; x <= 0x77; x++) { snesmap2[x] = sram; } - - // set banks 7E/7F (WRAM) - snesmmap[0x7E] = snesmap2[0x7E] = wramdata; - snesmmap[0x7F] = snesmap2[0x7F] = ram7f; -} - -void map_ehirom() -{ - unsigned char *ROM = (unsigned char *)romdata; - int x; - - // set addresses 8000-FFFF - // set banks 00-3F (40h x 32KB ROM banks @ 10000h) - map_set(snesmmap,ROM+0x400000,0x20,0x10000); - map_set(snesmmap+0x20,ROM+0x400000,0x20,0x10000); - - // set banks 40-7F (40h x 32KB ROM banks @ 10000h) - map_set(snesmmap+0x40,ROM+0x400000,0x20,0x10000); - map_set(snesmmap+0x60,ROM+0x400000,0x20,0x10000); - - // set banks 80-BF (40h x 32KB ROM banks @10000h) - map_set(snesmmap+0x80,ROM+0x400000,0x20,0x10000); - map_set(snesmmap+0xA0,ROM+0x400000,0x20,0x10000); - - // set banks C0-FF (40h x 64KB ROM banks @10000h) - map_set(snesmmap+0xC0,ROM,0x40,0x10000); - - // set addresses 0000-7FFF - // set banks 00-3F (40h x WRAM) - map_set(snesmap2,wramdata,0x40,0); - - // set banks 40-7F (40h x 32KB ROM banks @ 8000h) - map_set(snesmap2+0x40,ROM+0x400000,0x20,0x10000); - map_set(snesmap2+0x60,ROM+0x400000,0x20,0x10000); - - // set banks 80-BF (40h x WRAM) - map_set(snesmap2+0x80,wramdata,0x40,0); - - // set banks C0-FF (40h x 64KB ROM banks @10000h) - map_set(snesmap2+0xC0,ROM,0x40,0x10000); - - // set banks 70-77 (07h x SRAM) - for(x = 0x70; x <= 0x77; x++) { snesmap2[x] = sram; } - - // set banks 7E/7F (WRAM) - snesmmap[0x7E] = snesmap2[0x7E] = wramdata; - snesmmap[0x7F] = snesmap2[0x7F] = ram7f; -} - -void map_sfx() -{ - unsigned char *ROM = (unsigned char *)romdata; - - // Clear SFX registers - SfxR0 = SfxR1 = SfxR2 = SfxR3 = SfxR4 = SfxR5 = SfxR6 = SfxR7 = 0; - SfxR8 = SfxR9 = SfxR10 = SfxR11 = SfxR12 = SfxR13 = SfxR14 = SfxR15 = 0; - - // set addresses 8000-FFFF - // set banks 00-3F (40h x 64KB ROM banks @10000h) - map_set(snesmmap,ROM,0x40,0x10000); - - // set banks 40-7F (40h x128KB ROM banks @20000h) - map_set(snesmmap+0x40,ROM+0x8000,0x30,0x20000); - map_set(snesmmap+0x70,ROM+0x8000,0x10,0x20000); - - // set banks 80-BF (40h x 64KB ROM banks @10000h) - map_set(snesmmap+0x80,ROM,0x40,0x10000); - - // set banks C0-FF (40h x128KB ROM banks @20000h) - map_set(snesmmap+0xC0,ROM+0x8000,0x30,0x20000); - map_set(snesmmap+0xF0,ROM+0x8000,0x10,0x20000); - - // set addresses 0000-7FFF - // set banks 00-3F (40h x WRAM) - map_set(snesmap2,wramdata,0x40,0); - - // set banks 40-7F (40h x128KB ROM banks @20000h) - map_set(snesmap2+0x40,ROM+0x8000,0x30,0x20000); - map_set(snesmap2+0x70,ROM+0x8000,0x10,0x20000); - - // set banks 80-BF (40h x WRAM) - map_set(snesmap2+0x80,wramdata,0x40,0); - - // set banks C0-FF (40h x128KB ROM banks @20000h) - map_set(snesmap2+0xC0,ROM+0x8000,0x30,0x20000); - map_set(snesmap2+0xF0,ROM+0x8000,0x10,0x20000); - - // set banks 70-73/78/79 (SFXRAM & SRAM) - map_set(snesmap2+0x70,sfxramdata,4,0x10000); - snesmap2[0x78] = snesmap2[0x79] = sram; - - // set banks 7E/7F (WRAM) - snesmmap[0x7E] = snesmap2[0x7E] = wramdata; - snesmmap[0x7F] = snesmap2[0x7F] = ram7f; - - preparesfx(); -} - -void map_sa1() -{ - unsigned char *ROM = (unsigned char *)romdata; - unsigned char test[] = { 0xA9, 0x10, 0xCF, 0xAD }; - - if(!memcmp(ROM+0xB95, test, 4)) { ROM[0xB96] = 0; } - - // set addresses 8000-FFFF - // set banks 00-3F (40h x 32KB ROM banks @ 8000h) - map_set(snesmmap,ROM-0x8000,0x40,0x8000); - - // set banks 40-7F (40h x 64KB ROM banks @10000h) - map_set(snesmmap+0x40,ROM,0x40,0x10000); - - // set banks 80-BF (40h x 32KB ROM banks @ 8000h) - map_set(snesmmap+0x80,ROM+0x1F8000,0x40,0x8000); - - // set banks C0-FF (40h x 64KB ROM banks @10000h) - map_set(snesmmap+0xC0,ROM,0x40,0x10000); - - // set addresses 0000-7FFF - // set banks 00-3F (40h x WRAM) - map_set(snesmap2,wramdata,0x40,0); - - // set banks 40-7F (40h x 64KB ROM banks @10000h) - map_set(snesmap2+0x40,ROM,0x40,0x10000); - - // set banks 80-BF (40h x WRAM) - map_set(snesmap2+0x80,wramdata,0x40,0); - - // set banks C0-FF (40h x 64KB ROM banks @10000h) - map_set(snesmap2+0xC0,ROM,0x40,0x10000); - - // set banks 7E/7F (WRAM) - snesmmap[0x7E] = snesmap2[0x7E] = wramdata; - snesmmap[0x7F] = snesmap2[0x7F] = ram7f; -} - -void map_sdd1() -{ - unsigned char *ROM = (unsigned char *)romdata; - unsigned char test[] = { 0xA9, 0x10, 0xCF, 0xAD }; - - if(!memcmp(ROM+0xB95, test, 4)) { ROM[0xB96] = 0; } - - // set addresses 8000-FFFF - // set banks 00-3F (40h x 32KB ROM banks @ 8000h) - map_set(snesmmap,ROM-0x8000,0x40,0x8000); - - // set banks 40-7F (40h x 64KB ROM banks @10000h) - map_set(snesmmap+0x40,ROM,0x40,0x10000); - - // set banks 80-BF (40h x 32KB ROM banks @ 8000h) - map_set(snesmmap+0x80,ROM-0x8000,0x40,0x8000); - - // set banks C0-FF (40h x 64KB ROM banks @10000h) - map_set(snesmmap+0xC0,ROM,0x40,0x10000); - - // set addresses 0000-7FFF - // set banks 00-3F (40h x WRAM) - map_set(snesmap2,wramdata,0x40,0); - - // set banks 40-7F (40h x 64KB ROM banks @10000h) - map_set(snesmap2+0x40,ROM,0x40,0x10000); - - // set banks 80-BF (40h x WRAM) - map_set(snesmap2+0x80,wramdata,0x40,0); - - // set banks C0-FF (40h x 64KB ROM banks @10000h) - map_set(snesmap2+0xC0,ROM,0x40,0x10000); - - // set banks 7E/7F (WRAM) - snesmmap[0x7E] = snesmap2[0x7E] = wramdata; - snesmmap[0x7F] = snesmap2[0x7F] = ram7f; -} - -void map_bsx() -{ - unsigned char *ROM = (unsigned char *)romdata; - int x; - - // set addresses 8000-FFFF - // set banks 00-7F (80h x 32KB ROM banks @ 8000h) - map_set(snesmmap,ROM-0x8000,0x80,0x8000); - - // set banks 80-BF (40h x 32KB ROM banks @ 8000h) - map_set(snesmmap+0x80,ROM-0x8000,0x40,0x8000); - - // set banks C0-FF (40h x 32KB ROM banks @ 8000h) - map_set(snesmmap+0xC0,ROM+0x8000,0x40,0x8000); - - // set addresses 0000-7FFF - // set banks 00-3F (40h x WRAM) - map_set(snesmap2,wramdata,0x40,0); - - // set banks 40-7F (40h x 32KB ROM banks @ 8000h) - map_set(snesmap2+0x40,ROM+0x200000,0x40,0x8000); - - // set banks 80-BF (40h x WRAM) - map_set(snesmap2+0x80,wramdata,0x40,0); - - // set banks C0-FF (40h x 32KB ROM banks @ 8000h) - map_set(snesmap2+0xC0,ROM+0x8000,0x40,0x8000); - - // set banks 70-77 (07h x SRAM) - for (x = 0x70; x <= 0x77; x++) { snesmap2[x] = sram; } - - // set banks 7E/7F (WRAM) - snesmmap[0x7E] = snesmap2[0x7E] = wramdata; - snesmmap[0x7F] = snesmap2[0x7F] = ram7f; -} - -void initsnes() -{ - ForceNewGfxOff = 0; - - if (!BSEnable) - { - MultiTap = pl12s34 ? 0 : (pl3contrl || pl4contrl || pl5contrl); - - if (SFXEnable) { map_sfx(); } - else if (SA1Enable) { map_sa1(); } - else if (SDD1Enable) { map_sdd1(); } - else if (SPC7110Enable) { map_hirom(); } - else if (curromsize == 13) { map_ehirom(); } - else if (romtype == 2) { map_hirom(); } - else { map_lorom(); } - } - else - { - map_bsx(); - } -} - -bool PatchUsingIPS(char *); -void DosExit(), OpenSramFile(), CheatCodeLoad(), LoadSecondState(), LoadGameSpecificInput(); -extern unsigned char GUIOn, GUIOn2; - -bool loadfileGUI() -{ - bool result = true; - - spcon = !SPCDisable; - MessageOn = yesoutofmemory = IPSPatched = 0; - - loadROM(); - - if (curromspace) - { - SramExists = 0; - OpenSramFile(); - OpenCombFile(); - LoadGameSpecificInput(); - - if (!(GUIOn || GUIOn2)) - { - puts("File opened successfully !"); - } - if (!IPSPatched) - { - int i; - char ext[4]; - - strcpy(ext, "ips"); - for (i = 0; PatchUsingIPS(ext); i++) - { - if (i > 9) { break; } - ext[2] = i+'0'; - } - } - } - else - { - if (GUIOn || GUIOn2) { result = false; } - else - { - puts("Error opening file!\n"); - asm_call(DosExit); - } - } - - return (result); -} - -extern unsigned int CheatOn, NumCheats; -extern unsigned char CheatWinMode, CheatSearchStatus; -void GUIQuickLoadUpdate(); - -void powercycle(bool sramload, bool romload) -{ - clearmem2(); - - nmiprevaddrl = 0; - nmiprevaddrh = 0; - nmirept = 0; - nmiprevline = 224; - nmistatus = 0; - spcnumread = 0; - NextLineCache = 0; - curexecstate = 1; - - if (sramload) { OpenSramFile(); } - if (romload) { romloadskip = 1; } - - if (!romload || (loadfileGUI())) - { - if (romload) - { CheatOn = NumCheats = CheatWinMode = CheatSearchStatus = 0; } - - SetupROM(); - - if (romload) - { - if (DisplayInfo) { showinfogui(); } - initsnes(); - } - - sramsavedis = 0; - memcpy(&sndrot, regsbackup, 3019); - - if (yesoutofmemory) { asm_call(outofmemfix); } - asm_call(GUIDoReset); - - if (romload) - { - GUIQuickLoadUpdate(); - - if (AutoLoadCht) { CheatCodeLoad(); } - if (AutoState) { LoadSecondState(); } - } - } -} - -extern unsigned char osm2dis, ReturnFromSPCStall, SPCStallSetting, prevoamptr; -extern unsigned char reg1read, reg2read, reg3read, reg4read, NMIEnab, INTEnab; -extern unsigned char doirqnext, vidbright, forceblnk, timeron, spcP, JoyAPos, JoyBPos; -extern unsigned char coladdr, coladdg, coladdb; -extern unsigned char SDD1BankA,SDD1BankB, SDD1BankC, SDD1BankD; -extern unsigned char intrset, curcyc, cycpl, GUIReset; -extern unsigned int numspcvblleft, SPC700read, SPC700write, spc700idle; -extern unsigned int FIRTAPVal0, FIRTAPVal1, FIRTAPVal2, FIRTAPVal3, FIRTAPVal4, FIRTAPVal5, FIRTAPVal6, FIRTAPVal7; -extern unsigned int xa, xdb, xpb, xs, xd, xx, xy, scrndis; -extern unsigned short VIRQLoc, resolutn, xpc; -extern unsigned char spcextraram[64], SPCROM[64]; -extern unsigned int tableD[256]; -unsigned char SPCSkipXtraROM, bgfixer2 = 0, disableeffects = 0; -//This is saved in states -unsigned char cycpl = 0; // cycles per scanline -unsigned char cycphb = 0; // cycles per hblank -unsigned char intrset = 0; // interrupt set -unsigned short curypos = 0; // current y position -unsigned short stackand = 0x01FF; // value to and stack to keep it from going to the wrong area -unsigned short stackor = 0x0100; // value to or stack to keep it from going to the wrong area - -// 65816 registers -unsigned char xp = 0; -unsigned char xe = 0; -unsigned char xirqb = 0; // which bank the irqs start at -unsigned int Curtableaddr = 0; // Current table address - -void SA1Reset(); -void InitC4(); -void RTCinit(); -void SPC7110init(); - -void init65816() -{ - unsigned int i; - osm2dis = 0; - bgfixer2 = 0; - if(SA1Enable) - { - SA1Reset(); - SetAddressingModesSA1(); - } - - if(C4Enable) - { - osm2dis = 1; - bgfixer2 = 1; - InitC4(); - } - - if(RTCEnable) - RTCinit(); - - if(SPC7110Enable) - { - if (!SPC7110IndexPtr) SPC7110IndexPtr = malloc(12*4608); - if (!SPC7110PackPtr) SPC7110PackPtr = malloc(65536); - - if (SPC7110IndexPtr && SPC7110PackPtr) - { - SPC7PackIndexLoad(); - - SPC7110init(); - map_mem(0x50, &SPC7110bank, 1); - map_mem(0x00, &SPC7110SRAMBank, 1); - map_mem(0x30, &SPC7110SRAMBank, 1); - snesmmap[0x50] = SPC7110PackPtr; - snesmap2[0x50] = SPC7110PackPtr; - memset(SPC7110PackPtr, 0, 0x10000); - } - else - { - puts("You don't have enough memory to run SPC7110 games!"); - Msgptr = "MEMORY ERROR!"; - MessageOn = 360; - return; - } - } - else - { - if (SPC7110IndexPtr) free(SPC7110IndexPtr); - if (SPC7110PackPtr) free(SPC7110PackPtr); - } - - cycpb268 = 117; - cycpb358 = 127; - cycpbl2 = 117; - cycpblt2 = 117; - cycpbl = 117; - cycpblt = 117; - - SPCSkipXtraROM = 0; - if(ReturnFromSPCStall) - { - cycpb268 = 69; - cycpb358 = 81; - cycpbl2 = 69; - cycpblt2 = 69; - cycpbl = 69; - cycpblt = 69; - SPCSkipXtraROM = 1; - if(SPCStallSetting == 2) - { - cycpb268 = 240; - cycpb358 = 240; - cycpbl = 240; - cycpblt = 240; - cycpbl2 = 240; - cycpblt2 = 240; - SPCSkipXtraROM = 0; - } - } - else - { - SPCStallSetting = 0; - } - - numspcvblleft = 480; - SPC700write = 0; - SPC700read = 0; - spc700idle = 0; - - for(i = 0;i<0x40;i++) - { - spcextraram[i] = 0xFF; - SPCRAM[0xFFC0+i] = SPCROM[i]; - } - - // Clear SPC Memory - clearSPCRAM(); - clearvidsound(); - - prevoamptr = 0xFF; - disableeffects = 0; - opexec268 = opexec268b; - opexec358 = opexec358b; - opexec268cph = opexec268cphb; - opexec358cph = opexec358cphb; - - if (!(((unsigned char *)romdata)[infoloc+BankOffset] & 0xF0)) // if not fastrom - { - opexec358 = opexec268; - opexec358cph = opexec268cph; - cycpb358 = cycpb268; - } - - FIRTAPVal0 = 0x7F; - FIRTAPVal1 = 0; - FIRTAPVal2 = 0; - FIRTAPVal3 = 0; - FIRTAPVal4 = 0; - FIRTAPVal5 = 0; - FIRTAPVal6 = 0; - FIRTAPVal7 = 0; - - // Check Headers - headerhack(); - - SPCRAM[0xF4] = 0; - SPCRAM[0xF5] = 0; - SPCRAM[0xF6] = 0; - SPCRAM[0xF7] = 0; - reg1read = 0; - reg2read = 0; - reg3read = 0; - reg4read = 0; - cycpbl = 0; - spcnumread = 0; - NMIEnab = 1; - VIRQLoc = 0; - doirqnext = 0; - resolutn = 224; - vidbright = 0; - forceblnk = 0; - spcP = 0; - timeron = 0; - JoyAPos = 0; - JoyBPos = 0; - coladdr = 0; - coladdg = 0; - coladdb = 0; - INTEnab = 0; - xa = 0; - xdb = 0; - xpb = 0; - xs = 0x01FF; - xd = 0; - xx = 0; - xy = 0; - SDD1BankA = 0; - SDD1BankB = 0x01; - SDD1BankC = 0x02; - SDD1BankD = 0x03; - xirqb = 0; - xp = 52; // NVMXDIZC - xe = 1; // E - xpc = resetv; - - intrset = 0; - - if (xpc < 0x8000) - { - xpc += 0x8000; - //xpb = 0x40; - } - - // 2.68 Mhz / 3.58 Mhz = 228 - curcyc = cycpl = opexec268; - cycphb = opexec268cph; // 2.68 Mhz / 3.58 Mhz = 56 - cycpbl = 110; // 3.58Mhz = 175 - cycpblt = 110; - curypos = 0; - Curtableaddr = *tableD; - scrndis = 0; - stackand = 0x01FF; - stackor = 0x0100; - - nmiprevaddrl = 0; - nmiprevaddrh = 0; - nmirept = 0; - nmiprevline = 224; - nmistatus = 0; - - if(GUIReset) - { - GUIReset = 0; - } - - else - { - memset(wramdataa,0x55,0x10000); - memset(ram7fa, 0x55,0x10000); - } - - if(BSEnable) - { - memset(wramdataa,0xFF,0x10000); - memset(ram7fa,0xFF,0x10000); - if(romtype == 1) - memset(ram7fa+65528, 0x01, 8); - } -} - -void zexit() -{ - exit(0); -} - diff --git a/tools/zsnes/src/input.psr b/tools/zsnes/src/input.psr deleted file mode 100644 index d9a9617..0000000 --- a/tools/zsnes/src/input.psr +++ /dev/null @@ -1,300 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -@ PSR-produced config file (stock default in CAPS) -@ -@ Note, if you're worried you messed up a setting, removing the line will have -@ ZSNES use the default settings for that option. -@ The next time ZSNES is run, the line will reappear with the default settings. - -@ -@ ---- -@ -- Input -- -@ ---- - -@ -@ Player 1 Input -%ifdef __MSDOS__ -@ Input Device: 0 = Unplugged, 1 = KEYBOARD, 2 = 2-button pad, 3 = 4-button pad -@ 4 = 6-button pad, 5 = 8-button pad, 6-9 = Sidewinder #1-4 -@ 10-11 = Gamepad Pro #0-1, 12-16 = Parallel Port LPT1 #1-5 -%else -@ Input Device: 0 = Unplugged, 1 = KEYBOARD/GAMEPAD -%endif -pl1contrl db 1 -@ Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R -pl1selk dd 54 -pl1startk dd 28 -%ifdef __MSDOS__ -pl1upk dd 72 -pl1downk dd 80 -pl1leftk dd 75 -pl1rightk dd 77 -%elifdef __UNIXSDL__ -pl1upk dd 90 -pl1downk dd 96 -pl1leftk dd 92 -pl1rightk dd 94 -%elifdef __WIN32__ -pl1upk dd 200 -pl1downk dd 208 -pl1leftk dd 203 -pl1rightk dd 205 -%endif -pl1Xk dd 31 -pl1Ak dd 45 -pl1Lk dd 32 -pl1Yk dd 30 -pl1Bk dd 44 -pl1Rk dd 46 -@ Turbo Keys for A, B, X, Y, L, R -pl1Atk dd 0 -pl1Btk dd 0 -pl1Xtk dd 0 -pl1Ytk dd 0 -pl1Ltk dd 0 -pl1Rtk dd 0 -@ Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right -pl1ULk dd 0 -pl1URk dd 0 -pl1DLk dd 0 -pl1DRk dd 0 -%ifdef __MSDOS__ -@ Use Port 209h (0 = NO, 1 = Yes) -@ Enable if your gameport requires said resource. -pl1p209 db 0 -%endif - -@ -@ Player 2 -%ifdef __MSDOS__ -@ Input Device: 0 = UNPLUGGED, 1 = Keyboard, 2 = 2-button pad, 3 = 4-button pad -@ 4 = 6-button pad, 5 = 8-button pad, 6-9 = Sidewinder #1-4 -@ 10-11 = Gamepad Pro #0-1, 12-16 = Parallel Port LPT1 #1-5 -%else -@ Input Device: 0 = UNPLUGGED, 1 = Keyboard/Gamepad -%endif -pl2contrl db 0 -@ Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R -pl2selk dd 0 -pl2startk dd 0 -pl2upk dd 0 -pl2downk dd 0 -pl2leftk dd 0 -pl2rightk dd 0 -pl2Xk dd 0 -pl2Ak dd 0 -pl2Lk dd 0 -pl2Yk dd 0 -pl2Bk dd 0 -pl2Rk dd 0 -@ Turbo Keys for A, B, X, Y, L, R -pl2Atk dd 0 -pl2Btk dd 0 -pl2Xtk dd 0 -pl2Ytk dd 0 -pl2Ltk dd 0 -pl2Rtk dd 0 -@ Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right -pl2ULk dd 0 -pl2URk dd 0 -pl2DLk dd 0 -pl2DRk dd 0 -%ifdef __MSDOS__ -@ Use Port 209h (0 = NO, 1 = Yes) -@ Enable if your gameport requires said resource. -pl2p209 db 0 -%endif - -@ -@ Player 3 -%ifdef __MSDOS__ -@ Input Device: 0 = UNPLUGGED, 1 = Keyboard, 2 = 2-button pad, 3 = 4-button pad -@ 4 = 6-button pad, 5 = 8-button pad, 6-9 = Sidewinder #1-4 -@ 10-11 = Gamepad Pro #0-1, 12-16 = Parallel Port LPT1 #1-5 -%else -@ Input Device: 0 = UNPLUGGED, 1 = Keyboard/Gamepad -%endif -pl3contrl db 0 -@ Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R -pl3selk dd 0 -pl3startk dd 0 -pl3upk dd 0 -pl3downk dd 0 -pl3leftk dd 0 -pl3rightk dd 0 -pl3Xk dd 0 -pl3Ak dd 0 -pl3Lk dd 0 -pl3Yk dd 0 -pl3Bk dd 0 -pl3Rk dd 0 -@ Turbo Keys for A, B, X, Y, L, R -pl3Atk dd 0 -pl3Btk dd 0 -pl3Xtk dd 0 -pl3Ytk dd 0 -pl3Ltk dd 0 -pl3Rtk dd 0 -@ Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right -pl3ULk dd 0 -pl3URk dd 0 -pl3DLk dd 0 -pl3DRk dd 0 -%ifdef __MSDOS__ -@ Use Port 209h (0 = NO, 1 = Yes) -@ Enable if your gameport requires said resource. -pl3p209 db 0 -%endif - -@ -@ Player 4 -%ifdef __MSDOS__ -@ Input Device: 0 = UNPLUGGED, 1 = Keyboard, 2 = 2-button pad, 3 = 4-button pad -@ 4 = 6-button pad, 5 = 8-button pad, 6-9 = Sidewinder #1-4 -@ 10-11 = Gamepad Pro #0-1, 12-16 = Parallel Port LPT1 #1-5 -%else -@ Input Device: 0 = UNPLUGGED, 1 = Keyboard/Gamepad -%endif -pl4contrl db 0 -@ Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R -pl4selk dd 0 -pl4startk dd 0 -pl4upk dd 0 -pl4downk dd 0 -pl4leftk dd 0 -pl4rightk dd 0 -pl4Xk dd 0 -pl4Ak dd 0 -pl4Lk dd 0 -pl4Yk dd 0 -pl4Bk dd 0 -pl4Rk dd 0 -@ Turbo Keys for A, B, X, Y, L, R -pl4Atk dd 0 -pl4Btk dd 0 -pl4Xtk dd 0 -pl4Ytk dd 0 -pl4Ltk dd 0 -pl4Rtk dd 0 -@ Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right -pl4ULk dd 0 -pl4URk dd 0 -pl4DLk dd 0 -pl4DRk dd 0 -%ifdef __MSDOS__ -@ Use Port 209h (0 = NO, 1 = Yes) -@ Enable if your gameport requires said resource. -pl4p209 db 0 -%endif - -@ -@ Player 5 -%ifdef __MSDOS__ -@ Input Device: 0 = UNPLUGGED, 1 = Keyboard, 2 = 2-button pad, 3 = 4-button pad -@ 4 = 6-button pad, 5 = 8-button pad, 6-9 = Sidewinder #1-4 -@ 10-11 = Gamepad Pro #0-1, 12-16 = Parallel Port LPT1 #1-5 -%else -@ Input Device: 0 = UNPLUGGED, 1 = Keyboard/Gamepad -%endif -pl5contrl db 0 -@ Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R -pl5selk dd 0 -pl5startk dd 0 -pl5upk dd 0 -pl5downk dd 0 -pl5leftk dd 0 -pl5rightk dd 0 -pl5Xk dd 0 -pl5Ak dd 0 -pl5Lk dd 0 -pl5Yk dd 0 -pl5Bk dd 0 -pl5Rk dd 0 -@ Turbo Keys for A, B, X, Y, L, R -pl5Atk dd 0 -pl5Btk dd 0 -pl5Xtk dd 0 -pl5Ytk dd 0 -pl5Ltk dd 0 -pl5Rtk dd 0 -@ Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right -pl5ULk dd 0 -pl5URk dd 0 -pl5DLk dd 0 -pl5DRk dd 0 -%ifdef __MSDOS__ -@ Use Port 209h (0 = NO, 1 = Yes) -@ Enable if your gameport requires said resource. -pl5p209 db 0 -%endif - -%ifndef __MSDOS__ -@ -@ Joystick Sensitivity [0..32767] -@ Change this value if you have input issues. Higher value = less sensitive. -@ If your joystick is not being read at all, try 128 or other low values. -joy_sensitivity dw 16384 -%endif - -%ifdef __WIN32__ -@ -@ Mouse Sensitivity [1..255] -@ Only change this value to lower the mouse movement speed on certain mice -@ The mouse speed will be lowered by a factor of the entered number -MouseSensitivity db 1 -%endif - -%ifdef __MSDOS__ -@ -@ Enable Sidewinder Fix (0 = NO, 1 = Yes) -@ Enable this if the Sidewinder is still not detected properly. -SidewinderFix db 0 -%endif - -@ -@ Share Player 3 & 4 Control Inputs w/Player 1 & 2 (0 = DISABLE, 1 = Enable) -@ Allow 2 devices to be used for one player -@ (enabling this disables Multiplayer 5 support). -pl12s34 db 0 - -@ -@ Allow Up+Down and Left+Right Pad Input (0 = NO, 1 = Yes) -AllowUDLR db 0 - -@ -@ Turbo Keys Equal 30 Presses/sec Instead of 60 (0 = No, 1 = YES) -Turbo30hz db 1 - -@ -@ Left Handed Mouse Behavior for SNES Devices (0 = NO SWAP, 1 = Swap) -@ (swap left and right mouse buttons) -mouse1lh db 0 @First device -mouse2lh db 0 @Second device - -@ -@ Super Scope Buttons -SSAutoFire dd 13 -SSPause dd 14 - -@ -@ Port 1 and Port 2 device settings (0 = GAMEPAD, 1 = Mouse) -device1 db 0 -@ (0 = GAMEPAD, 1 = Mouse, 2 = Super Scope, 3 = 1 Justifier, 4 = 2 Justifiers) -device2 db 0 diff --git a/tools/zsnes/src/install-sh b/tools/zsnes/src/install-sh deleted file mode 100755 index e9de238..0000000 --- a/tools/zsnes/src/install-sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/tools/zsnes/src/jma/7z.h b/tools/zsnes/src/jma/7z.h deleted file mode 100644 index 50e1f24..0000000 --- a/tools/zsnes/src/jma/7z.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __7Z_H -#define __7Z_H - -#include "iiostrm.h" - -bool decompress_lzma_7z(ISequentialInStream& in, unsigned in_size, ISequentialOutStream& out, unsigned out_size) throw (); -bool decompress_lzma_7z(const unsigned char* in_data, unsigned in_size, unsigned char* out_data, unsigned out_size) throw (); - -#endif - diff --git a/tools/zsnes/src/jma/7zlzma.cpp b/tools/zsnes/src/jma/7zlzma.cpp deleted file mode 100644 index b849d8d..0000000 --- a/tools/zsnes/src/jma/7zlzma.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "7z.h" - -#include "lzmadec.h" - -bool decompress_lzma_7z(ISequentialInStream& in, unsigned in_size, ISequentialOutStream& out, unsigned out_size) throw () -{ - try - { - NCompress::NLZMA::CDecoder cc; - - UINT64 in_size_l = in_size; - UINT64 out_size_l = out_size; - - if (cc.ReadCoderProperties(&in) != S_OK) { return(false); } - if (cc.Code(&in, &out, &in_size_l, &out_size_l) != S_OK) { return(false); } - if (out.size_get() != out_size || out.overflow_get()) { return(false); } - - return(true); - } - catch (...) - { - return(false); - } -} - -bool decompress_lzma_7z(const unsigned char* in_data, unsigned int in_size, unsigned char* out_data, unsigned int out_size) throw () -{ - ISequentialInStream_Array in(reinterpret_cast(in_data), in_size); - ISequentialOutStream_Array out(reinterpret_cast(out_data), out_size); - - return(decompress_lzma_7z(in, in_size, out, out_size)); -} diff --git a/tools/zsnes/src/jma/aribitcd.h b/tools/zsnes/src/jma/aribitcd.h deleted file mode 100644 index 1fb421b..0000000 --- a/tools/zsnes/src/jma/aribitcd.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __COMPRESSION_BITCODER_H -#define __COMPRESSION_BITCODER_H - -#include "rngcoder.h" - -namespace NCompression { -namespace NArithmetic { - -const int kNumBitModelTotalBits = 11; -const UINT32 kBitModelTotal = (1 << kNumBitModelTotalBits); - -const int kNumMoveReducingBits = 2; - -///////////////////////////// -// CBitModel - -template -class CBitModel -{ -public: - UINT32 m_Probability; - void UpdateModel(UINT32 aSymbol) - { - /* - m_Probability -= (m_Probability + ((aSymbol - 1) & ((1 << aNumMoveBits) - 1))) >> aNumMoveBits; - m_Probability += (1 - aSymbol) << (kNumBitModelTotalBits - aNumMoveBits); - */ - if (aSymbol == 0) - m_Probability += (kBitModelTotal - m_Probability) >> aNumMoveBits; - else - m_Probability -= (m_Probability) >> aNumMoveBits; - } -public: - void Init() { m_Probability = kBitModelTotal / 2; } -}; - -template -class CBitDecoder: public CBitModel -{ -public: - UINT32 Decode(CRangeDecoder *aRangeDecoder) - { - UINT32 aNewBound = (aRangeDecoder->m_Range >> kNumBitModelTotalBits) * CBitModel::m_Probability; - if (aRangeDecoder->m_Code < aNewBound) - { - aRangeDecoder->m_Range = aNewBound; - CBitModel::m_Probability += (kBitModelTotal - CBitModel::m_Probability) >> aNumMoveBits; - if (aRangeDecoder->m_Range < kTopValue) - { - aRangeDecoder->m_Code = (aRangeDecoder->m_Code << 8) | aRangeDecoder->m_Stream.ReadByte(); - aRangeDecoder->m_Range <<= 8; - } - return 0; - } - else - { - aRangeDecoder->m_Range -= aNewBound; - aRangeDecoder->m_Code -= aNewBound; - CBitModel::m_Probability -= (CBitModel::m_Probability) >> aNumMoveBits; - if (aRangeDecoder->m_Range < kTopValue) - { - aRangeDecoder->m_Code = (aRangeDecoder->m_Code << 8) | aRangeDecoder->m_Stream.ReadByte(); - aRangeDecoder->m_Range <<= 8; - } - return 1; - } - } -}; - -}} - - -#endif diff --git a/tools/zsnes/src/jma/ariconst.h b/tools/zsnes/src/jma/ariconst.h deleted file mode 100644 index 751b2b7..0000000 --- a/tools/zsnes/src/jma/ariconst.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __ARICONST_H -#define __ARICONST_H - -#include "aribitcd.h" - - -typedef NCompression::NArithmetic::CRangeDecoder CMyRangeDecoder; -template class CMyBitDecoder: - public NCompression::NArithmetic::CBitDecoder {}; - -#endif diff --git a/tools/zsnes/src/jma/ariprice.h b/tools/zsnes/src/jma/ariprice.h deleted file mode 100644 index ccc398e..0000000 --- a/tools/zsnes/src/jma/ariprice.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __COMPRESSION_ARIPRICE_H -#define __COMPRESSION_ARIPRICE_H - -namespace NCompression { -namespace NArithmetic { - -const UINT32 kNumBitPriceShiftBits = 6; -const UINT32 kBitPrice = 1 << kNumBitPriceShiftBits; - -}} - -#endif diff --git a/tools/zsnes/src/jma/btreecd.h b/tools/zsnes/src/jma/btreecd.h deleted file mode 100644 index acce366..0000000 --- a/tools/zsnes/src/jma/btreecd.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __BITTREECODER_H -#define __BITTREECODER_H - -#include "aribitcd.h" -#include "rcdefs.h" - - -////////////////////////// -// CBitTreeDecoder - -template -class CBitTreeDecoder -{ - CMyBitDecoder m_Models[1 << m_NumBitLevels]; -public: - void Init() - { - for(UINT32 i = 1; i < (1 << m_NumBitLevels); i++) - m_Models[i].Init(); - } - UINT32 Decode(CMyRangeDecoder *aRangeDecoder) - { - UINT32 aModelIndex = 1; - RC_INIT_VAR - for(UINT32 aBitIndex = m_NumBitLevels; aBitIndex > 0; aBitIndex--) - { - // aModelIndex = (aModelIndex << 1) + m_Models[aModelIndex].Decode(aRangeDecoder); - RC_GETBIT(aNumMoveBits, m_Models[aModelIndex].m_Probability, aModelIndex) - } - RC_FLUSH_VAR - return aModelIndex - (1 << m_NumBitLevels); - }; -}; - -//////////////////////////////// -// CReverseBitTreeDecoder - -template -class CReverseBitTreeDecoder2 -{ - CMyBitDecoder *m_Models; - UINT32 m_NumBitLevels; -public: - CReverseBitTreeDecoder2(): m_Models(0) { } - ~CReverseBitTreeDecoder2() { delete []m_Models; } - bool Create(UINT32 aNumBitLevels) - { - m_NumBitLevels = aNumBitLevels; - m_Models = new CMyBitDecoder[1 << aNumBitLevels]; - return (m_Models != 0); - } - void Init() - { - UINT32 aNumModels = 1 << m_NumBitLevels; - for(UINT32 i = 1; i < aNumModels; i++) - m_Models[i].Init(); - } - UINT32 Decode(CMyRangeDecoder *aRangeDecoder) - { - UINT32 aModelIndex = 1; - UINT32 aSymbol = 0; - RC_INIT_VAR - for(UINT32 aBitIndex = 0; aBitIndex < m_NumBitLevels; aBitIndex++) - { - // UINT32 aBit = m_Models[aModelIndex].Decode(aRangeDecoder); - // aModelIndex <<= 1; - // aModelIndex += aBit; - // aSymbol |= (aBit << aBitIndex); - RC_GETBIT2(aNumMoveBits, m_Models[aModelIndex].m_Probability, aModelIndex, ; , aSymbol |= (1 << aBitIndex)) - } - RC_FLUSH_VAR - return aSymbol; - }; -}; -//////////////////////////// -// CReverseBitTreeDecoder2 - -template -class CReverseBitTreeDecoder -{ - CMyBitDecoder m_Models[1 << m_NumBitLevels]; -public: - void Init() - { - for(UINT32 i = 1; i < (1 << m_NumBitLevels); i++) - m_Models[i].Init(); - } - UINT32 Decode(CMyRangeDecoder *aRangeDecoder) - { - UINT32 aModelIndex = 1; - UINT32 aSymbol = 0; - RC_INIT_VAR - for(UINT32 aBitIndex = 0; aBitIndex < m_NumBitLevels; aBitIndex++) - { - // UINT32 aBit = m_Models[aModelIndex].Decode(aRangeDecoder); - // aModelIndex <<= 1; - // aModelIndex += aBit; - // aSymbol |= (aBit << aBitIndex); - RC_GETBIT2(aNumMoveBits, m_Models[aModelIndex].m_Probability, aModelIndex, ; , aSymbol |= (1 << aBitIndex)) - } - RC_FLUSH_VAR - return aSymbol; - } -}; - - - -#endif diff --git a/tools/zsnes/src/jma/crc32.cpp b/tools/zsnes/src/jma/crc32.cpp deleted file mode 100644 index e3377d5..0000000 --- a/tools/zsnes/src/jma/crc32.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright (C) 2004-2007 NSRT Team ( http://nsrt.edgeemu.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 - -namespace CRC32lib -{ - //Don't ask questions, this is the PKZip CRC32 table - const unsigned int crc32Table[256] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, - 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, - 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, - 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, - 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, - 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, - 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, - 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, - 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, - 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, - 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, - 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, - 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, - 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, - 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, - 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, - 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; - - - //CRC32 for char arrays - unsigned int CRC32(const unsigned char *array, size_t size, register unsigned int crc32) - { - const unsigned char *end_p = array+size; - for (register const unsigned char *p = array; p < end_p; p++) - { - crc32 = ((crc32 >> 8) & 0x00FFFFFF) ^ crc32Table[(crc32 ^ *p) & 0xFF]; - } - - return(~crc32); - } -} diff --git a/tools/zsnes/src/jma/crc32.h b/tools/zsnes/src/jma/crc32.h deleted file mode 100644 index 876a7d3..0000000 --- a/tools/zsnes/src/jma/crc32.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright (C) 2004-2007 NSRT Team ( http://nsrt.edgeemu.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef CRC32_H -#define CRC32_H - -namespace CRC32lib -{ - unsigned int CRC32(const unsigned char *, size_t, register unsigned int crc32 = 0xFFFFFFFF); -} - -#endif diff --git a/tools/zsnes/src/jma/iiostrm.cpp b/tools/zsnes/src/jma/iiostrm.cpp deleted file mode 100644 index f271996..0000000 --- a/tools/zsnes/src/jma/iiostrm.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "portable.h" -#include "iiostrm.h" -#include "crc32.h" - -HRESULT ISequentialInStream_Array::Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - if (aSize > size) - { - aSize = size; - } - - *aProcessedSize = aSize; - memcpy(aData, data, aSize); - size -= aSize; - data += aSize; - return(S_OK); -} - -HRESULT ISequentialOutStream_Array::Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - if (aSize > size) - { - overflow = true; - aSize = size; - } - - *aProcessedSize = aSize; - memcpy(data, aData, aSize); - size -= aSize; - data += aSize; - total += aSize; - return(S_OK); -} - -HRESULT ISequentialInStream_String::Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - if (aSize > data.size()) - { - aSize = data.size(); - } - - *aProcessedSize = aSize; - memcpy(aData, data.c_str(), aSize); - data.erase(0, aSize); - return(S_OK); -} - -HRESULT ISequentialOutStream_String::Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - *aProcessedSize = aSize; - data.append((const char *)aData, aSize); - total += aSize; - return(S_OK); -} - -HRESULT ISequentialInStream_Istream::Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - data.read((char *)aData, aSize); - *aProcessedSize = data.gcount(); - return(S_OK); -} - -HRESULT ISequentialOutStream_Ostream::Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - *aProcessedSize = aSize; - data.write((char *)aData, aSize); - total += aSize; - return(S_OK); -} - - - -HRESULT ISequentialInStreamCRC32_Array::Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - ISequentialInStream_Array::Read(aData, aSize, aProcessedSize); - crc32 = CRC32lib::CRC32((const unsigned char *)aData, *aProcessedSize, ~crc32); - return(S_OK); -} - -HRESULT ISequentialOutStreamCRC32_Array::Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - ISequentialOutStream_Array::Write(aData, aSize, aProcessedSize); - crc32 = CRC32lib::CRC32((const unsigned char *)aData, *aProcessedSize, ~crc32); - return(S_OK); -} - -HRESULT ISequentialInStreamCRC32_String::Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - ISequentialInStream_String::Read(aData, aSize, aProcessedSize); - crc32 = CRC32lib::CRC32((const unsigned char *)aData, *aProcessedSize, ~crc32); - return(S_OK); -} - -HRESULT ISequentialOutStreamCRC32_String::Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - ISequentialOutStream_String::Write(aData, aSize, aProcessedSize); - crc32 = CRC32lib::CRC32((const unsigned char *)aData, *aProcessedSize, ~crc32); - return(S_OK); -} - -HRESULT ISequentialInStreamCRC32_Istream::Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - ISequentialInStream_Istream::Read(aData, aSize, aProcessedSize); - crc32 = CRC32lib::CRC32((const unsigned char *)aData, *aProcessedSize, ~crc32); - return(S_OK); -} - -HRESULT ISequentialOutStreamCRC32_Ostream::Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize) -{ - ISequentialOutStream_Ostream::Write(aData, aSize, aProcessedSize); - crc32 = CRC32lib::CRC32((const unsigned char *)aData, *aProcessedSize, ~crc32); - return(S_OK); -} diff --git a/tools/zsnes/src/jma/iiostrm.h b/tools/zsnes/src/jma/iiostrm.h deleted file mode 100644 index a5b2ab2..0000000 --- a/tools/zsnes/src/jma/iiostrm.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __IINOUTSTREAMS_H -#define __IINOUTSTREAMS_H - -#include -#include - -#include "portable.h" - - -class ISequentialInStream -{ -public: - virtual HRESULT Read(void *, UINT32, UINT32 *) = 0; - - virtual ~ISequentialInStream() {} -}; - - -class ISequentialInStream_Array : public ISequentialInStream -{ - const char *data; - unsigned int size; -public: - ISequentialInStream_Array(const char *Adata, unsigned Asize) : data(Adata), size(Asize) { } - - HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialInStream_Array() {} -}; - -class ISequentialInStream_String : public ISequentialInStream -{ - std::string& data; -public: - ISequentialInStream_String(std::string& Adata) : data(Adata) { } - - HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialInStream_String() {} -}; - -class ISequentialInStream_Istream : public ISequentialInStream -{ - std::istream& data; -public: - ISequentialInStream_Istream(std::istream& Adata) : data(Adata) { } - - HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialInStream_Istream() {} -}; - - - -class ISequentialOutStream -{ -public: - virtual bool overflow_get() const = 0; - virtual unsigned int size_get() const = 0; - - virtual HRESULT Write(const void *, UINT32, UINT32 *) = 0; - - virtual ~ISequentialOutStream() {} -}; - - -class ISequentialOutStream_Array : public ISequentialOutStream -{ - char *data; - unsigned int size; - bool overflow; - unsigned int total; -public: - ISequentialOutStream_Array(char *Adata, unsigned Asize) : data(Adata), size(Asize), overflow(false), total(0) { } - - bool overflow_get() const { return(overflow); } - unsigned int size_get() const { return(total); } - - HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialOutStream_Array() {} -}; - -class ISequentialOutStream_String : public ISequentialOutStream -{ - std::string& data; - unsigned int total; -public: - ISequentialOutStream_String(std::string& Adata) : data(Adata), total(0) { } - - bool overflow_get() const { return(false); } - unsigned int size_get() const { return(total); } - - HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialOutStream_String() {} -}; - - -class ISequentialOutStream_Ostream : public ISequentialOutStream -{ - std::ostream& data; - unsigned int total; -public: - ISequentialOutStream_Ostream(std::ostream& Adata) : data(Adata), total(0) { } - - bool overflow_get() const { return(false); } - unsigned int size_get() const { return(total); } - - HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialOutStream_Ostream() {} -}; - - - -class ISequentialStreamCRC32 -{ -protected: - unsigned int crc32; -public: - ISequentialStreamCRC32() : crc32(0) {} - unsigned int crc32_get() const { return(crc32); } - - virtual ~ISequentialStreamCRC32() {} -}; - - -class ISequentialInStreamCRC32_Array : public ISequentialInStream_Array, public ISequentialStreamCRC32 -{ -public: - ISequentialInStreamCRC32_Array(const char *Adata, unsigned Asize) : ISequentialInStream_Array(Adata, Asize) { } - - HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialInStreamCRC32_Array() {} -}; - -class ISequentialInStreamCRC32_String : public ISequentialInStream_String, public ISequentialStreamCRC32 -{ -public: - ISequentialInStreamCRC32_String(std::string& Adata) : ISequentialInStream_String(Adata) { } - - HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialInStreamCRC32_String() {} -}; - -class ISequentialInStreamCRC32_Istream : public ISequentialInStream_Istream, public ISequentialStreamCRC32 -{ -public: - ISequentialInStreamCRC32_Istream(std::istream& Adata) : ISequentialInStream_Istream(Adata) { } - - HRESULT Read(void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialInStreamCRC32_Istream() {} -}; - - -class ISequentialOutStreamCRC32_Array : public ISequentialOutStream_Array, public ISequentialStreamCRC32 -{ -public: - ISequentialOutStreamCRC32_Array(char *Adata, unsigned Asize) : ISequentialOutStream_Array(Adata, Asize) { } - - HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialOutStreamCRC32_Array() {} -}; - -class ISequentialOutStreamCRC32_String : public ISequentialOutStream_String, public ISequentialStreamCRC32 -{ -public: - ISequentialOutStreamCRC32_String(std::string& Adata) : ISequentialOutStream_String(Adata) { } - - HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialOutStreamCRC32_String() {} -}; - - -class ISequentialOutStreamCRC32_Ostream : public ISequentialOutStream_Ostream, public ISequentialStreamCRC32 -{ -public: - ISequentialOutStreamCRC32_Ostream(std::ostream& Adata) : ISequentialOutStream_Ostream(Adata) { } - - HRESULT Write(const void *aData, UINT32 aSize, UINT32 *aProcessedSize); - - virtual ~ISequentialOutStreamCRC32_Ostream() {} -}; - -#endif diff --git a/tools/zsnes/src/jma/inbyte.cpp b/tools/zsnes/src/jma/inbyte.cpp deleted file mode 100644 index c727a4b..0000000 --- a/tools/zsnes/src/jma/inbyte.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "inbyte.h" - -namespace NStream{ - -CInByte::CInByte(UINT32 aBufferSize): - m_BufferBase(0), - m_BufferSize(aBufferSize) -{ - m_BufferBase = new BYTE[m_BufferSize]; -} - -CInByte::~CInByte() -{ - delete []m_BufferBase; -} - -void CInByte::Init(ISequentialInStream *aStream) -{ - m_Stream = aStream; - m_ProcessedSize = 0; - m_Buffer = m_BufferBase; - m_BufferLimit = m_Buffer; - m_StreamWasExhausted = false; -} - -bool CInByte::ReadBlock() -{ - if (m_StreamWasExhausted) - return false; - m_ProcessedSize += (m_Buffer - m_BufferBase); - UINT32 aNumProcessedBytes; - HRESULT aResult = m_Stream->Read(m_BufferBase, m_BufferSize, &aNumProcessedBytes); - if (aResult != S_OK) - throw aResult; - m_Buffer = m_BufferBase; - m_BufferLimit = m_Buffer + aNumProcessedBytes; - m_StreamWasExhausted = (aNumProcessedBytes == 0); - return (!m_StreamWasExhausted); -} - -} diff --git a/tools/zsnes/src/jma/inbyte.h b/tools/zsnes/src/jma/inbyte.h deleted file mode 100644 index 53afa17..0000000 --- a/tools/zsnes/src/jma/inbyte.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __STREAM_INBYTE_H -#define __STREAM_INBYTE_H - -#include "iiostrm.h" - -namespace NStream { - -class CInByte -{ - UINT64 m_ProcessedSize; - BYTE *m_BufferBase; - UINT32 m_BufferSize; - BYTE *m_Buffer; - BYTE *m_BufferLimit; - ISequentialInStream* m_Stream; - bool m_StreamWasExhausted; - - bool ReadBlock(); - -public: - CInByte(UINT32 aBufferSize = 0x100000); - ~CInByte(); - - void Init(ISequentialInStream *aStream); - - bool ReadByte(BYTE &aByte) - { - if(m_Buffer >= m_BufferLimit) - if(!ReadBlock()) - return false; - aByte = *m_Buffer++; - return true; - } - BYTE ReadByte() - { - if(m_Buffer >= m_BufferLimit) - if(!ReadBlock()) - return 0x0; - return *m_Buffer++; - } - void ReadBytes(void *aData, UINT32 aSize, UINT32 &aProcessedSize) - { - for(aProcessedSize = 0; aProcessedSize < aSize; aProcessedSize++) - if (!ReadByte(((BYTE *)aData)[aProcessedSize])) - return; - } - bool ReadBytes(void *aData, UINT32 aSize) - { - UINT32 aProcessedSize; - ReadBytes(aData, aSize, aProcessedSize); - return (aProcessedSize == aSize); - } - UINT64 GetProcessedSize() const { return m_ProcessedSize + (m_Buffer - m_BufferBase); } -}; - -} - -#endif diff --git a/tools/zsnes/src/jma/jma.cpp b/tools/zsnes/src/jma/jma.cpp deleted file mode 100644 index 87e0322..0000000 --- a/tools/zsnes/src/jma/jma.cpp +++ /dev/null @@ -1,550 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 -#include "jma.h" -using namespace std; - -#include "portable.h" -#include "7z.h" -#include "crc32.h" - -namespace JMA -{ - const char jma_magic[] = { 'J', 'M', 'A', 0, 'N' }; - const unsigned int jma_header_length = 5; - const unsigned char jma_version = 1; - const unsigned int jma_version_length = 1; - const unsigned int jma_total_header_length = jma_header_length + jma_version_length + UINT_SIZE; - - //Convert DOS/zip/JMA integer time to to time_t - time_t uint_to_time(unsigned short date, unsigned short time) - { - tm formatted_time; - - formatted_time.tm_mday = date & 0x1F; - formatted_time.tm_mon = ((date >> 5) & 0xF) - 1; - formatted_time.tm_year = ((date >> 9) & 0x7f) + 80; - formatted_time.tm_sec = (time & 0x1F) * 2; - formatted_time.tm_min = (time >> 5) & 0x3F; - formatted_time.tm_hour = (time >> 11) & 0x1F; - - return(mktime(&formatted_time)); - } - - - //Retreive the file block, what else? - void jma_open::retrieve_file_block() throw(jma_errors) - { - unsigned char uint_buffer[UINT_SIZE]; - unsigned char ushort_buffer[USHORT_SIZE]; - - //File block size is the last UINT in the file - stream.seekg(-UINT_SIZE,ios::end); - stream.read((char *)uint_buffer, UINT_SIZE); - size_t file_block_size = charp_to_uint(uint_buffer); - - //Currently at the end of the file, so that's the file size - size_t jma_file_size = stream.tellg(); - - //The file block can't be larger than the JMA file without it's header. - //This if can probably be improved - if (file_block_size >= jma_file_size-jma_total_header_length) - { - throw(JMA_BAD_FILE); - } - - //Seek to before file block so we can read the file block - stream.seekg(-((int)file_block_size+UINT_SIZE),ios::end); - - //This is needed if the file block is compressed - stringstream decompressed_file_block; - //Pointer to where to read file block from (file or decompressed buffer) - istream *file_block_stream; - - //Setup file info buffer and byte to read with - jma_file_info file_info; - char byte; - - stream.get(byte); - if (!byte) //If file block is compressed - { - //Compressed size isn't counting the byte we just read or the UINT for compressed size - size_t compressed_size = file_block_size - (1+UINT_SIZE); - - //Read decompressed size / true file block size - stream.read((char *)uint_buffer, UINT_SIZE); - file_block_size = charp_to_uint(uint_buffer); - - //Setup access methods for decompression - ISequentialInStream_Istream compressed_data(stream); - ISequentialOutStream_Ostream decompressed_data(decompressed_file_block); - - //Decompress the data - if (!decompress_lzma_7z(compressed_data, compressed_size, decompressed_data, file_block_size)) - { - throw(JMA_DECOMPRESS_FAILED); - } - - //Go to beginning, setup pointer to buffer - decompressed_file_block.seekg(0, ios::beg); - file_block_stream = &decompressed_file_block; - } - else - { - stream.putback(byte); //Putback byte, byte is part of filename, not compressed indicator - file_block_stream = &stream; - } - - - //Minimum file name length is 2 bytes, a char and a null - //Minimum comment length is 1 byte, a null - //There are currently 2 UINTs and 2 USHORTs per file - while (file_block_size >= 2+1+UINT_SIZE*2+USHORT_SIZE*2) //This does allow for a gap, but that's okay - { - //First stored in the file block is the file name null terminated - file_info.name = ""; - - file_block_stream->get(byte); - while (byte) - { - file_info.name += byte; - file_block_stream->get(byte); - } - - //There must be a file name or the file is bad - if (!file_info.name.length()) - { - throw(JMA_BAD_FILE); - } - - //Same trick as above for the comment - file_info.comment = ""; - - file_block_stream->get(byte); - while (byte) - { - file_info.comment += byte; - file_block_stream->get(byte); - } - - //Next is a UINT representing the file's size - file_block_stream->read((char *)uint_buffer, UINT_SIZE); - file_info.size = charp_to_uint(uint_buffer); - - //Followed by CRC32 - file_block_stream->read((char *)uint_buffer, UINT_SIZE); - file_info.crc32 = charp_to_uint(uint_buffer); - - //Special USHORT representation of file's date - file_block_stream->read((char *)ushort_buffer, USHORT_SIZE); - file_info.date = charp_to_ushort(ushort_buffer); - - //Special USHORT representation of file's time - file_block_stream->read((char *)ushort_buffer, USHORT_SIZE); - file_info.time = charp_to_ushort(ushort_buffer); - - file_info.buffer = 0; //Pointing to null till we decompress files - - files.push_back(file_info); //Put file info into our structure - - //Subtract size of the file info we just read - file_block_size -= file_info.name.length()+file_info.comment.length()+2+UINT_SIZE*2+USHORT_SIZE*2; - } - } - - //Constructor for opening JMA files for reading - jma_open::jma_open(const char *compressed_file_name) throw (jma_errors) - { - decompressed_buffer = 0; - compressed_buffer = 0; - - stream.open(compressed_file_name, ios::in | ios::binary); - if (!stream.is_open()) - { - throw(JMA_NO_OPEN); - } - - //Header is "JMA\0N" - unsigned char header[jma_header_length]; - stream.read((char *)header, jma_header_length); - if (memcmp(jma_magic, header, jma_header_length)) - { - throw(JMA_BAD_FILE); - } - - //Not the cleanest code but logical - stream.read((char *)header, 5); - if (*header <= jma_version) - { - chunk_size = charp_to_uint(header+1); //Chunk size is a UINT that follows version # - retrieve_file_block(); - } - else - { - throw(JMA_UNSUPPORTED_VERSION); - } - } - - //Destructor only has to close the stream if neccesary - jma_open::~jma_open() - { - if (stream.is_open()) - { - stream.close(); - } - } - - //Return a vector containing useful info about the files in the JMA - vector jma_open::get_files_info() - { - vector file_info_vector; - jma_public_file_info file_info; - - for (vector::iterator i = files.begin(); i != files.end(); i++) - { - file_info.name = i->name; - file_info.comment = i->comment; - file_info.size = i->size; - file_info.datetime = uint_to_time(i->date, i->time); - file_info.crc32 = i->crc32; - file_info_vector.push_back(file_info); - } - - return(file_info_vector); - } - - //Skip forward a given number of chunks - void jma_open::chunk_seek(unsigned int chunk_num) throw(jma_errors) - { - //Check the stream is open - if (!stream.is_open()) - { - throw(JMA_NO_OPEN); - } - - //Clear possible errors so the seek will work - stream.clear(); - - //Move forward over header - stream.seekg(jma_total_header_length, ios::beg); - - unsigned char int4_buffer[UINT_SIZE]; - - while (chunk_num--) - { - //Read in size of chunk - stream.read((char *)int4_buffer, UINT_SIZE); - - //Skip chunk plus it's CRC32 - stream.seekg(charp_to_uint(int4_buffer)+UINT_SIZE, ios::cur); - } - } - - //Return a vector of pointers to each file in the JMA, the buffer to hold all the files - //must be initilized outside. - vector jma_open::get_all_files(unsigned char *buffer) throw(jma_errors) - { - //If there's no stream we can't read from it, so exit - if (!stream.is_open()) - { - throw(JMA_NO_OPEN); - } - - //Seek to the first chunk - chunk_seek(0); - - //Set the buffer that decompressed data goes to - decompressed_buffer = buffer; - - //If the JMA is not solid - if (chunk_size) - { - unsigned char int4_buffer[UINT_SIZE]; - size_t size = get_total_size(files); - - //For each chunk in the file... - for (size_t remaining_size = size; remaining_size; remaining_size -= chunk_size) - { - //Read the compressed size - stream.read((char *)int4_buffer, UINT_SIZE); - size_t compressed_size = charp_to_uint(int4_buffer); - - //Allocate memory of the correct size to hold the compressed data in the JMA - //Throw error on failure as that is unrecoverable from - try - { - compressed_buffer = new unsigned char[compressed_size]; - } - catch (bad_alloc xa) - { - throw(JMA_NO_MEM_ALLOC); - } - - //Read all the compressed data in - stream.read((char *)compressed_buffer, compressed_size); - - //Read the expected CRC of compressed data from the file - stream.read((char *)int4_buffer, UINT_SIZE); - - //If it doesn't match, throw error and cleanup memory - if (CRC32lib::CRC32(compressed_buffer, compressed_size) != charp_to_uint(int4_buffer)) - { - delete[] compressed_buffer; - throw(JMA_BAD_FILE); - } - - //Decompress the data, cleanup memory on failure - if (!decompress_lzma_7z(compressed_buffer, compressed_size, - decompressed_buffer+size-remaining_size, - (remaining_size > chunk_size) ? chunk_size : remaining_size)) - { - delete[] compressed_buffer; - throw(JMA_DECOMPRESS_FAILED); - } - delete[] compressed_buffer; - - if (remaining_size <= chunk_size) //If we just decompressed the remainder - { - break; - } - } - } - else //Solidly compressed JMA - { - unsigned char int4_buffer[UINT_SIZE]; - - //Read the size of the compressed data - stream.read((char *)int4_buffer, UINT_SIZE); - size_t compressed_size = charp_to_uint(int4_buffer); - - //Get decompressed size - size_t size = get_total_size(files); - - //Setup access methods for decompression - ISequentialInStream_Istream compressed_data(stream); - ISequentialOutStream_Array decompressed_data(reinterpret_cast(decompressed_buffer), size); - - //Decompress the data - if (!decompress_lzma_7z(compressed_data, compressed_size, decompressed_data, size)) - { - throw(JMA_DECOMPRESS_FAILED); - } - - /* - //Allocate memory of the right size to hold the compressed data in the JMA - try - { - compressed_buffer = new unsigned char[compressed_size]; - } - catch (bad_alloc xa) - { - throw(JMA_NO_MEM_ALLOC); - } - - //Copy the compressed data into memory - stream.read((char *)compressed_buffer, compressed_size); - size_t size = get_total_size(files); - - //Read the CRC of the compressed data - stream.read((char *)int4_buffer, UINT_SIZE); - - //If it doesn't match, complain - if (CRC32lib::CRC32(compressed_buffer, compressed_size) != charp_to_uint(int4_buffer)) - { - delete[] compressed_buffer; - throw(JMA_BAD_FILE); - } - - //Decompress the data - if (!decompress_lzma_7z(compressed_buffer, compressed_size, decompressed_buffer, size)) - { - delete[] compressed_buffer; - throw(JMA_DECOMPRESS_FAILED); - } - delete[] compressed_buffer; - */ - } - - vector file_pointers; - size_t size = 0; - - //For each file, add it's pointer to the vector, size is pointer offset in the buffer - for (vector::iterator i = files.begin(); i != files.end(); i++) - { - i->buffer = decompressed_buffer+size; - file_pointers.push_back(decompressed_buffer+size); - size += i->size; - } - - //Return the vector of pointers - return(file_pointers); - } - - //Extracts the file with a given name found in the archive to the given buffer - void jma_open::extract_file(string& name, unsigned char *buffer) throw(jma_errors) - { - if (!stream.is_open()) - { - throw(JMA_NO_OPEN); - } - - size_t size_to_skip = 0; - size_t our_file_size = 0; - - //Search through the vector of file information - for (vector::iterator i = files.begin(); i != files.end(); i++) - { - if (i->name == name) - { - //Set the variable so we can tell we found it - our_file_size = i->size; - break; - } - - //Keep a running total of size - size_to_skip += i->size; - } - - if (!our_file_size) //File with the specified name was not found in the archive - { - throw(JMA_FILE_NOT_FOUND); - } - - //If the JMA only contains one file, we can skip a lot of overhead - if (files.size() == 1) - { - get_all_files(buffer); - return; - } - - if (chunk_size) //we are using non-solid archive.. - { - unsigned int chunks_to_skip = size_to_skip / chunk_size; - - //skip over requisite number of chunks - chunk_seek(chunks_to_skip); - - //Allocate memory for compressed and decompressed data - unsigned char *comp_buffer = 0, *decomp_buffer = 0; - try - { - //Compressed data size is <= non compressed size - unsigned char *combined_buffer = new unsigned char[chunk_size*2]; - comp_buffer = combined_buffer; - decomp_buffer = combined_buffer+chunk_size; - } - catch (bad_alloc xa) - { - throw(JMA_NO_MEM_ALLOC); - } - - size_t first_chunk_offset = size_to_skip % chunk_size; - unsigned char int4_buffer[UINT_SIZE]; - for (size_t i = 0; i < our_file_size;) - { - //Get size - stream.read((char *)int4_buffer, UINT_SIZE); - size_t compressed_size = charp_to_uint(int4_buffer); - - //Read all the compressed data in - stream.read((char *)comp_buffer, compressed_size); - - //Read the CRC of the compressed data - stream.read((char *)int4_buffer, UINT_SIZE); - - //If it doesn't match, complain - if (CRC32lib::CRC32(comp_buffer, compressed_size) != charp_to_uint(int4_buffer)) - { - delete[] comp_buffer; - throw(JMA_BAD_FILE); - } - - //Decompress chunk - if (!decompress_lzma_7z(comp_buffer, compressed_size, decomp_buffer, chunk_size)) - { - delete[] comp_buffer; - throw(JMA_DECOMPRESS_FAILED); - } - - size_t copy_amount = our_file_size-i > chunk_size-first_chunk_offset ? chunk_size-first_chunk_offset : our_file_size-i; - - memcpy(buffer+i, decomp_buffer+first_chunk_offset, copy_amount); - first_chunk_offset = 0; //Set to zero since this is only for the first iteration - i += copy_amount; - } - delete[] comp_buffer; - } - else //Solid JMA - { - unsigned char *decomp_buffer = 0; - try - { - decomp_buffer = new unsigned char[get_total_size(files)]; - } - catch (bad_alloc xa) - { - throw(JMA_NO_MEM_ALLOC); - } - - get_all_files(decomp_buffer); - - memcpy(buffer, decomp_buffer+size_to_skip, our_file_size); - - delete[] decomp_buffer; - } - } - - bool jma_open::is_solid() - { - return(chunk_size ? false : true); - } - - const char *jma_error_text(jma_errors error) - { - switch (error) - { - case JMA_NO_CREATE: - return("JMA could not be created"); - - case JMA_NO_MEM_ALLOC: - return("Memory for JMA could be allocated"); - - case JMA_NO_OPEN: - return("JMA could not be opened"); - - case JMA_BAD_FILE: - return("Invalid/Corrupt JMA"); - - case JMA_UNSUPPORTED_VERSION: - return("JMA version not supported"); - - case JMA_COMPRESS_FAILED: - return("JMA compression failed"); - - case JMA_DECOMPRESS_FAILED: - return("JMA decompression failed"); - - case JMA_FILE_NOT_FOUND: - return("File not found in JMA"); - } - return("Unknown error"); - } - -} - - diff --git a/tools/zsnes/src/jma/jma.h b/tools/zsnes/src/jma/jma.h deleted file mode 100644 index 2aaa5ca..0000000 --- a/tools/zsnes/src/jma/jma.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef JMA_H -#define JMA_H - -#include -#include -#include -#include - -namespace JMA -{ - enum jma_errors { JMA_NO_CREATE, JMA_NO_MEM_ALLOC, JMA_NO_OPEN, JMA_BAD_FILE, - JMA_UNSUPPORTED_VERSION, JMA_COMPRESS_FAILED, JMA_DECOMPRESS_FAILED, - JMA_FILE_NOT_FOUND }; - - struct jma_file_info_base - { - std::string name; - std::string comment; - size_t size; - unsigned int crc32; - }; - - struct jma_public_file_info : jma_file_info_base - { - time_t datetime; - }; - - struct jma_file_info : jma_file_info_base - { - unsigned short date; - unsigned short time; - const unsigned char *buffer; - }; - - template - inline size_t get_total_size(std::vector& files) - { - size_t size = 0; - for (typename std::vector::iterator i = files.begin(); i != files.end(); i++) - { - size += i->size; //We do have a problem if this wraps around - } - - return(size); - } - - class jma_open - { - public: - jma_open(const char *) throw(jma_errors); - ~jma_open(); - - std::vector get_files_info(); - std::vector get_all_files(unsigned char *) throw(jma_errors); - void extract_file(std::string& name, unsigned char *) throw(jma_errors); - bool is_solid(); - - private: - std::ifstream stream; - std::vector files; - size_t chunk_size; - unsigned char *decompressed_buffer; - unsigned char *compressed_buffer; - - void chunk_seek(unsigned int) throw(jma_errors); - void retrieve_file_block() throw(jma_errors); - }; - - const char *jma_error_text(jma_errors); -} -#endif diff --git a/tools/zsnes/src/jma/lencoder.h b/tools/zsnes/src/jma/lencoder.h deleted file mode 100644 index 6f30e47..0000000 --- a/tools/zsnes/src/jma/lencoder.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __LENCODER_H -#define __LENCODER_H - -#include "btreecd.h" - -namespace NLength { - -const UINT32 kNumPosStatesBitsMax = 4; -const int kNumPosStatesMax = (1 << kNumPosStatesBitsMax); - - -const int kNumPosStatesBitsEncodingMax = 4; -const int kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax); - - -const int kNumMoveBits = 5; - -const int kNumLenBits = 3; -const int kNumLowSymbols = 1 << kNumLenBits; -const int kNumMidBits = 3; -const int kNumMidSymbols = 1 << kNumMidBits; - -const int kNumHighBits = 8; - -const int kNumSymbolsTotal = kNumLowSymbols + kNumMidSymbols + (1 << kNumHighBits); - -const int kNumSpecSymbols = kNumLowSymbols + kNumMidSymbols; - -class CDecoder -{ - CMyBitDecoder m_Choice; - CBitTreeDecoder m_LowCoder[kNumPosStatesMax]; - CMyBitDecoder m_Choice2; - CBitTreeDecoder m_MidCoder[kNumPosStatesMax]; - CBitTreeDecoder m_HighCoder; - UINT32 m_NumPosStates; -public: - void Create(UINT32 aNumPosStates) - { m_NumPosStates = aNumPosStates; } - void Init() - { - m_Choice.Init(); - for (UINT32 aPosState = 0; aPosState < m_NumPosStates; aPosState++) - { - m_LowCoder[aPosState].Init(); - m_MidCoder[aPosState].Init(); - } - m_Choice2.Init(); - m_HighCoder.Init(); - } - UINT32 Decode(CMyRangeDecoder *aRangeDecoder, UINT32 aPosState) - { - if(m_Choice.Decode(aRangeDecoder) == 0) - return m_LowCoder[aPosState].Decode(aRangeDecoder); - else - { - UINT32 aSymbol = kNumLowSymbols; - if(m_Choice2.Decode(aRangeDecoder) == 0) - aSymbol += m_MidCoder[aPosState].Decode(aRangeDecoder); - else - { - aSymbol += kNumMidSymbols; - aSymbol += m_HighCoder.Decode(aRangeDecoder); - } - return aSymbol; - } - } - -}; - -} - - -#endif diff --git a/tools/zsnes/src/jma/litcoder.h b/tools/zsnes/src/jma/litcoder.h deleted file mode 100644 index 639d6c5..0000000 --- a/tools/zsnes/src/jma/litcoder.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __LITERALCODER_H -#define __LITERALCODER_H - -#include "aribitcd.h" -#include "rcdefs.h" - -namespace NLiteral { - -const int kNumMoveBits = 5; - -class CDecoder2 -{ - CMyBitDecoder m_Decoders[3][1 << 8]; -public: - void Init() - { - for (int i = 0; i < 3; i++) - for (int j = 1; j < (1 << 8); j++) - m_Decoders[i][j].Init(); - } - - BYTE DecodeNormal(CMyRangeDecoder *aRangeDecoder) - { - UINT32 aSymbol = 1; - RC_INIT_VAR - do - { - // aSymbol = (aSymbol << 1) | m_Decoders[0][aSymbol].Decode(aRangeDecoder); - RC_GETBIT(kNumMoveBits, m_Decoders[0][aSymbol].m_Probability, aSymbol) - } - while (aSymbol < 0x100); - RC_FLUSH_VAR - return aSymbol; - } - - BYTE DecodeWithMatchByte(CMyRangeDecoder *aRangeDecoder, BYTE aMatchByte) - { - UINT32 aSymbol = 1; - RC_INIT_VAR - do - { - UINT32 aMatchBit = (aMatchByte >> 7) & 1; - aMatchByte <<= 1; - // UINT32 aBit = m_Decoders[1 + aMatchBit][aSymbol].Decode(aRangeDecoder); - // aSymbol = (aSymbol << 1) | aBit; - UINT32 aBit; - RC_GETBIT2(kNumMoveBits, m_Decoders[1 + aMatchBit][aSymbol].m_Probability, aSymbol, - aBit = 0, aBit = 1) - if (aMatchBit != aBit) - { - while (aSymbol < 0x100) - { - // aSymbol = (aSymbol << 1) | m_Decoders[0][aSymbol].Decode(aRangeDecoder); - RC_GETBIT(kNumMoveBits, m_Decoders[0][aSymbol].m_Probability, aSymbol) - } - break; - } - } - while (aSymbol < 0x100); - RC_FLUSH_VAR - return aSymbol; - } -}; - -class CDecoder -{ - CDecoder2 *m_Coders; - UINT32 m_NumPrevBits; - UINT32 m_NumPosBits; - UINT32 m_PosMask; -public: - CDecoder(): m_Coders(0) {} - ~CDecoder() { Free(); } - void Free() - { - delete []m_Coders; - m_Coders = 0; - } - void Create(UINT32 aNumPosBits, UINT32 aNumPrevBits) - { - Free(); - m_NumPosBits = aNumPosBits; - m_PosMask = (1 << aNumPosBits) - 1; - m_NumPrevBits = aNumPrevBits; - UINT32 aNumStates = 1 << (m_NumPrevBits + m_NumPosBits); - m_Coders = new CDecoder2[aNumStates]; - } - void Init() - { - UINT32 aNumStates = 1 << (m_NumPrevBits + m_NumPosBits); - for (UINT32 i = 0; i < aNumStates; i++) - m_Coders[i].Init(); - } - UINT32 GetState(UINT32 aPos, BYTE aPrevByte) const - { return ((aPos & m_PosMask) << m_NumPrevBits) + (aPrevByte >> (8 - m_NumPrevBits)); } - BYTE DecodeNormal(CMyRangeDecoder *aRangeDecoder, UINT32 aPos, BYTE aPrevByte) - { return m_Coders[GetState(aPos, aPrevByte)].DecodeNormal(aRangeDecoder); } - BYTE DecodeWithMatchByte(CMyRangeDecoder *aRangeDecoder, UINT32 aPos, BYTE aPrevByte, BYTE aMatchByte) - { return m_Coders[GetState(aPos, aPrevByte)].DecodeWithMatchByte(aRangeDecoder, aMatchByte); } -}; - -} - -#endif diff --git a/tools/zsnes/src/jma/lzma.cpp b/tools/zsnes/src/jma/lzma.cpp deleted file mode 100644 index d020ed2..0000000 --- a/tools/zsnes/src/jma/lzma.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "lzma.h" - -namespace NCompress { -namespace NLZMA { - -UINT32 kDistStart[kDistTableSizeMax]; - -static class CConstInit -{ -public: - CConstInit() - { - UINT32 aStartValue = 0; - int i; - for (i = 0; i < kDistTableSizeMax; i++) - { - kDistStart[i] = aStartValue; - aStartValue += (1 << kDistDirectBits[i]); - } - } -} g_ConstInit; - -}} diff --git a/tools/zsnes/src/jma/lzma.h b/tools/zsnes/src/jma/lzma.h deleted file mode 100644 index 949b70b..0000000 --- a/tools/zsnes/src/jma/lzma.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "lencoder.h" - -#ifndef __LZMA_H -#define __LZMA_H - -namespace NCompress { -namespace NLZMA { - -const UINT32 kNumRepDistances = 4; - -const BYTE kNumStates = 12; - -const BYTE kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; -const BYTE kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; -const BYTE kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; -const BYTE kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; - -class CState -{ -public: - BYTE m_Index; - void Init() - { m_Index = 0; } - void UpdateChar() - { m_Index = kLiteralNextStates[m_Index]; } - void UpdateMatch() - { m_Index = kMatchNextStates[m_Index]; } - void UpdateRep() - { m_Index = kRepNextStates[m_Index]; } - void UpdateShortRep() - { m_Index = kShortRepNextStates[m_Index]; } -}; - -class CBaseCoder -{ -protected: - CState m_State; - BYTE m_PreviousByte; - bool m_PeviousIsMatch; - UINT32 m_RepDistances[kNumRepDistances]; - void Init() - { - m_State.Init(); - m_PreviousByte = 0; - m_PeviousIsMatch = false; - for(UINT32 i = 0 ; i < kNumRepDistances; i++) - m_RepDistances[i] = 0; - } -}; - -const int kNumPosSlotBits = 6; -const int kDicLogSizeMax = 28; -const int kDistTableSizeMax = kDicLogSizeMax * 2; - -extern UINT32 kDistStart[kDistTableSizeMax]; -const BYTE kDistDirectBits[kDistTableSizeMax] = -{ - 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, - 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, - 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26 -}; - -const UINT32 kNumLenToPosStates = 4; -inline UINT32 GetLenToPosState(UINT32 aLen) -{ - aLen -= 2; - if (aLen < kNumLenToPosStates) - return aLen; - return kNumLenToPosStates - 1; -} - -const int kMatchMinLen = 2; - -const int kMatchMaxLen = kMatchMinLen + NLength::kNumSymbolsTotal - 1; - -const int kNumAlignBits = 4; -const int kAlignTableSize = 1 << kNumAlignBits; -const UINT32 kAlignMask = (kAlignTableSize - 1); - -const int kStartPosModelIndex = 4; -const int kEndPosModelIndex = 14; -const int kNumPosModels = kEndPosModelIndex - kStartPosModelIndex; - -const int kNumFullDistances = 1 << (kEndPosModelIndex / 2); - - -const int kMainChoiceLiteralIndex = 0; -const int kMainChoiceMatchIndex = 1; - -const int kMatchChoiceDistanceIndex= 0; -const int kMatchChoiceRepetitionIndex = 1; - -const int kNumMoveBitsForMainChoice = 5; -const int kNumMoveBitsForPosCoders = 5; - -const int kNumMoveBitsForAlignCoders = 5; - -const int kNumMoveBitsForPosSlotCoder = 5; - -const int kNumLitPosStatesBitsEncodingMax = 4; -const int kNumLitContextBitsMax = 8; - -}} - -#endif diff --git a/tools/zsnes/src/jma/lzmadec.cpp b/tools/zsnes/src/jma/lzmadec.cpp deleted file mode 100644 index ad6b570..0000000 --- a/tools/zsnes/src/jma/lzmadec.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/* -Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "portable.h" -#include "lzmadec.h" - -#define RETURN_E_OUTOFMEMORY_IF_FALSE(x) { if (!(x)) return E_OUTOFMEMORY; } - -namespace NCompress { -namespace NLZMA { - -HRESULT CDecoder::SetDictionarySize(UINT32 aDictionarySize) -{ - if (aDictionarySize > (1 << kDicLogSizeMax)) - return E_INVALIDARG; - - UINT32 aWindowReservSize = MyMax(aDictionarySize, UINT32(1 << 21)); - - if (m_DictionarySize != aDictionarySize) - { - m_OutWindowStream.Create(aDictionarySize, kMatchMaxLen, aWindowReservSize); - m_DictionarySize = aDictionarySize; - } - return S_OK; -} - -HRESULT CDecoder::SetLiteralProperties( - UINT32 aLiteralPosStateBits, UINT32 aLiteralContextBits) -{ - if (aLiteralPosStateBits > 8) - return E_INVALIDARG; - if (aLiteralContextBits > 8) - return E_INVALIDARG; - m_LiteralDecoder.Create(aLiteralPosStateBits, aLiteralContextBits); - return S_OK; -} - -HRESULT CDecoder::SetPosBitsProperties(UINT32 aNumPosStateBits) -{ - if (aNumPosStateBits > NLength::kNumPosStatesBitsMax) - return E_INVALIDARG; - UINT32 aNumPosStates = 1 << aNumPosStateBits; - m_LenDecoder.Create(aNumPosStates); - m_RepMatchLenDecoder.Create(aNumPosStates); - m_PosStateMask = aNumPosStates - 1; - return S_OK; -} - -CDecoder::CDecoder(): - m_DictionarySize((UINT32)-1) -{ - Create(); -} - -HRESULT CDecoder::Create() -{ - for(int i = 0; i < kNumPosModels; i++) - { - RETURN_E_OUTOFMEMORY_IF_FALSE( - m_PosDecoders[i].Create(kDistDirectBits[kStartPosModelIndex + i])); - } - return S_OK; -} - - -HRESULT CDecoder::Init(ISequentialInStream *anInStream, - ISequentialOutStream *anOutStream) -{ - m_RangeDecoder.Init(anInStream); - - m_OutWindowStream.Init(anOutStream); - - int i; - for(i = 0; i < kNumStates; i++) - { - for (UINT32 j = 0; j <= m_PosStateMask; j++) - { - m_MainChoiceDecoders[i][j].Init(); - m_MatchRepShortChoiceDecoders[i][j].Init(); - } - m_MatchChoiceDecoders[i].Init(); - m_MatchRepChoiceDecoders[i].Init(); - m_MatchRep1ChoiceDecoders[i].Init(); - m_MatchRep2ChoiceDecoders[i].Init(); - } - - m_LiteralDecoder.Init(); - - // m_RepMatchLenDecoder.Init(); - - for (i = 0; (UINT32) i < kNumLenToPosStates; i++) - m_PosSlotDecoder[i].Init(); - - for(i = 0; i < kNumPosModels; i++) - m_PosDecoders[i].Init(); - - m_LenDecoder.Init(); - m_RepMatchLenDecoder.Init(); - - m_PosAlignDecoder.Init(); - return S_OK; - -} - -HRESULT CDecoder::CodeReal(ISequentialInStream *anInStream, - ISequentialOutStream *anOutStream, - const UINT64 *anInSize, const UINT64 *anOutSize) -{ - if (anOutSize == NULL) - return E_INVALIDARG; - - Init(anInStream, anOutStream); - - CState aState; - aState.Init(); - bool aPeviousIsMatch = false; - BYTE aPreviousByte = 0; - UINT32 aRepDistances[kNumRepDistances]; - for(UINT32 i = 0 ; i < kNumRepDistances; i++) - aRepDistances[i] = 0; - - UINT64 aNowPos64 = 0; - UINT64 aSize = *anOutSize; - while(aNowPos64 < aSize) - { - UINT64 aNext = MyMin(aNowPos64 + (1 << 18), aSize); - while(aNowPos64 < aNext) - { - UINT32 aPosState = UINT32(aNowPos64) & m_PosStateMask; - if (m_MainChoiceDecoders[aState.m_Index][aPosState].Decode(&m_RangeDecoder) == (UINT32) kMainChoiceLiteralIndex) - { - // aCounts[0]++; - aState.UpdateChar(); - if(aPeviousIsMatch) - { - BYTE aMatchByte = m_OutWindowStream.GetOneByte(0 - aRepDistances[0] - 1); - aPreviousByte = m_LiteralDecoder.DecodeWithMatchByte(&m_RangeDecoder, - UINT32(aNowPos64), aPreviousByte, aMatchByte); - aPeviousIsMatch = false; - } - else - aPreviousByte = m_LiteralDecoder.DecodeNormal(&m_RangeDecoder, - UINT32(aNowPos64), aPreviousByte); - m_OutWindowStream.PutOneByte(aPreviousByte); - aNowPos64++; - } - else - { - aPeviousIsMatch = true; - UINT32 aDistance, aLen; - if(m_MatchChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) == - (UINT32) kMatchChoiceRepetitionIndex) - { - if(m_MatchRepChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) == 0) - { - if(m_MatchRepShortChoiceDecoders[aState.m_Index][aPosState].Decode(&m_RangeDecoder) == 0) - { - aState.UpdateShortRep(); - aPreviousByte = m_OutWindowStream.GetOneByte(0 - aRepDistances[0] - 1); - m_OutWindowStream.PutOneByte(aPreviousByte); - aNowPos64++; - // aCounts[3 + 4]++; - continue; - } - // aCounts[3 + 0]++; - aDistance = aRepDistances[0]; - } - else - { - if(m_MatchRep1ChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) == 0) - { - aDistance = aRepDistances[1]; - aRepDistances[1] = aRepDistances[0]; - // aCounts[3 + 1]++; - } - else - { - if (m_MatchRep2ChoiceDecoders[aState.m_Index].Decode(&m_RangeDecoder) == 0) - { - // aCounts[3 + 2]++; - aDistance = aRepDistances[2]; - } - else - { - // aCounts[3 + 3]++; - aDistance = aRepDistances[3]; - aRepDistances[3] = aRepDistances[2]; - } - aRepDistances[2] = aRepDistances[1]; - aRepDistances[1] = aRepDistances[0]; - } - aRepDistances[0] = aDistance; - } - aLen = m_RepMatchLenDecoder.Decode(&m_RangeDecoder, aPosState) + kMatchMinLen; - // aCounts[aLen]++; - aState.UpdateRep(); - } - else - { - aLen = kMatchMinLen + m_LenDecoder.Decode(&m_RangeDecoder, aPosState); - aState.UpdateMatch(); - UINT32 aPosSlot = m_PosSlotDecoder[GetLenToPosState(aLen)].Decode(&m_RangeDecoder); - // aCounts[aPosSlot]++; - if (aPosSlot >= (UINT32) kStartPosModelIndex) - { - aDistance = kDistStart[aPosSlot]; - if (aPosSlot < (UINT32) kEndPosModelIndex) - aDistance += m_PosDecoders[aPosSlot - kStartPosModelIndex].Decode(&m_RangeDecoder); - else - { - aDistance += (m_RangeDecoder.DecodeDirectBits(kDistDirectBits[aPosSlot] - - kNumAlignBits) << kNumAlignBits); - aDistance += m_PosAlignDecoder.Decode(&m_RangeDecoder); - } - } - else - aDistance = aPosSlot; - - - aRepDistances[3] = aRepDistances[2]; - aRepDistances[2] = aRepDistances[1]; - aRepDistances[1] = aRepDistances[0]; - - aRepDistances[0] = aDistance; - // UpdateStat(aLen, aPosSlot); - } - if (aDistance >= aNowPos64) - throw E_INVALIDDATA; - m_OutWindowStream.CopyBackBlock(aDistance, aLen); - aNowPos64 += aLen; - aPreviousByte = m_OutWindowStream.GetOneByte(0 - 1); - } - } - } - return Flush(); -} - -HRESULT CDecoder::Code(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize, const UINT64 *anOutSize) -{ - try { - return CodeReal(anInStream, anOutStream, anInSize, anOutSize); - } catch (HRESULT& e) { - return e; - } catch (...) { - return E_FAIL; - } -} - -HRESULT CDecoder::ReadCoderProperties(ISequentialInStream *anInStream) -{ - UINT32 aNumPosStateBits; - UINT32 aLiteralPosStateBits; - UINT32 aLiteralContextBits; - UINT32 aDictionarySize; - - UINT32 aProcessesedSize; - - BYTE aByte; - RETURN_IF_NOT_S_OK(anInStream->Read(&aByte, sizeof(aByte), &aProcessesedSize)); - if (aProcessesedSize != sizeof(aByte)) - return E_INVALIDARG; - - aLiteralContextBits = aByte % 9; - BYTE aRemainder = aByte / 9; - aLiteralPosStateBits = aRemainder % 5; - aNumPosStateBits = aRemainder / 5; - - UINT8 uint_buffer[UINT_SIZE]; - RETURN_IF_NOT_S_OK(anInStream->Read(uint_buffer, sizeof(aDictionarySize), &aProcessesedSize)); - aDictionarySize = charp_to_uint(uint_buffer); - - if (aProcessesedSize != sizeof(aDictionarySize)) - return E_INVALIDARG; - - RETURN_IF_NOT_S_OK(SetDictionarySize(aDictionarySize)); - RETURN_IF_NOT_S_OK(SetLiteralProperties(aLiteralPosStateBits, aLiteralContextBits)); - RETURN_IF_NOT_S_OK(SetPosBitsProperties(aNumPosStateBits)); - - return S_OK; -} - -}} diff --git a/tools/zsnes/src/jma/lzmadec.h b/tools/zsnes/src/jma/lzmadec.h deleted file mode 100644 index bb91912..0000000 --- a/tools/zsnes/src/jma/lzmadec.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __LZARITHMETIC_DECODER_H -#define __LZARITHMETIC_DECODER_H - -#include "winout.h" -#include "lzma.h" -#include "lencoder.h" -#include "litcoder.h" - -namespace NCompress { -namespace NLZMA { - -typedef CMyBitDecoder CMyBitDecoder2; - -class CDecoder -{ - NStream::NWindow::COut m_OutWindowStream; - CMyRangeDecoder m_RangeDecoder; - - CMyBitDecoder2 m_MainChoiceDecoders[kNumStates][NLength::kNumPosStatesMax]; - CMyBitDecoder2 m_MatchChoiceDecoders[kNumStates]; - CMyBitDecoder2 m_MatchRepChoiceDecoders[kNumStates]; - CMyBitDecoder2 m_MatchRep1ChoiceDecoders[kNumStates]; - CMyBitDecoder2 m_MatchRep2ChoiceDecoders[kNumStates]; - CMyBitDecoder2 m_MatchRepShortChoiceDecoders[kNumStates][NLength::kNumPosStatesMax]; - - CBitTreeDecoder m_PosSlotDecoder[kNumLenToPosStates]; - - CReverseBitTreeDecoder2 m_PosDecoders[kNumPosModels]; - CReverseBitTreeDecoder m_PosAlignDecoder; - // CBitTreeDecoder2 m_PosDecoders[kNumPosModels]; - // CBitTreeDecoder m_PosAlignDecoder; - - NLength::CDecoder m_LenDecoder; - NLength::CDecoder m_RepMatchLenDecoder; - - NLiteral::CDecoder m_LiteralDecoder; - - UINT32 m_DictionarySize; - - UINT32 m_PosStateMask; - - HRESULT Create(); - - HRESULT Init(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream); - - HRESULT Flush() { return m_OutWindowStream.Flush(); } - - HRESULT CodeReal(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize, const UINT64 *anOutSize); - -public: - - CDecoder(); - - HRESULT Code(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize, const UINT64 *anOutSize); - HRESULT ReadCoderProperties(ISequentialInStream *anInStream); - - HRESULT SetDictionarySize(UINT32 aDictionarySize); - HRESULT SetLiteralProperties(UINT32 aLiteralPosStateBits, UINT32 aLiteralContextBits); - HRESULT SetPosBitsProperties(UINT32 aNumPosStateBits); -}; - -}} - -#endif diff --git a/tools/zsnes/src/jma/portable.h b/tools/zsnes/src/jma/portable.h deleted file mode 100644 index 12416c7..0000000 --- a/tools/zsnes/src/jma/portable.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright (C) 2004-2007 NSRT Team ( http://nsrt.edgeemu.com ) -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef __PORTABLE_H -#define __PORTABLE_H - -#include - -typedef signed char INT8; -typedef unsigned char UINT8; -typedef short INT16; -typedef unsigned short UINT16; -typedef long INT32; -typedef unsigned long UINT32; -typedef long long INT64; -typedef unsigned long long UINT64; - -typedef UINT8 BYTE; -typedef UINT16 WORD; -typedef UINT32 DWORD; - -typedef unsigned UINT_PTR; - -typedef int BOOL; -#define FALSE 0 -#define TRUE 1 - -#define HRESULT int -#define S_OK 0 -#define E_INVALIDARG -1 -#define E_OUTOFMEMORY -2 -#define E_FAIL -3 -#define E_INTERNAL_ERROR -4 -#define E_INVALIDDATA -5 - -template inline T MyMin(T a, T b) { - return a < b ? a : b; -} - -template inline T MyMax(T a, T b) { - return a > b ? a : b; -} - -#define RETURN_IF_NOT_S_OK(x) { HRESULT __aResult_ = (x); if(__aResult_ != S_OK) return __aResult_; } - - -#define UINT_SIZE (4) -#define USHORT_SIZE (2) - -//Convert an array of 4 bytes back into an integer -inline unsigned int charp_to_uint(const unsigned char buffer[UINT_SIZE]) -{ - unsigned int num = (unsigned int)buffer[3]; - num |= ((unsigned int)buffer[2]) << 8; - num |= ((unsigned int)buffer[1]) << 16; - num |= ((unsigned int)buffer[0]) << 24; - return(num); -} - -//Convert an array of 2 bytes back into a short integer -inline unsigned short charp_to_ushort(const unsigned char buffer[USHORT_SIZE]) -{ - unsigned short num = (unsigned short)buffer[1]; - num |= ((unsigned short)buffer[0]) << 8; - return(num); -} - -#endif diff --git a/tools/zsnes/src/jma/rcdefs.h b/tools/zsnes/src/jma/rcdefs.h deleted file mode 100644 index 6106b57..0000000 --- a/tools/zsnes/src/jma/rcdefs.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __RCDEFS_H -#define __RCDEFS_H - -#include "aribitcd.h" -#include "ariconst.h" - -#define RC_INIT_VAR \ - UINT32 aRange = aRangeDecoder->m_Range; \ - UINT32 aCode = aRangeDecoder->m_Code; - -#define RC_FLUSH_VAR \ - aRangeDecoder->m_Range = aRange; \ - aRangeDecoder->m_Code = aCode; - -#define RC_NORMALIZE \ - if (aRange < NCompression::NArithmetic::kTopValue) \ - { \ - aCode = (aCode << 8) | aRangeDecoder->m_Stream.ReadByte(); \ - aRange <<= 8; } - -#define RC_GETBIT2(aNumMoveBits, aProb, aModelIndex, Action0, Action1) \ - {UINT32 aNewBound = (aRange >> NCompression::NArithmetic::kNumBitModelTotalBits) * aProb; \ - if (aCode < aNewBound) \ - { \ - Action0; \ - aRange = aNewBound; \ - aProb += (NCompression::NArithmetic::kBitModelTotal - aProb) >> aNumMoveBits; \ - aModelIndex <<= 1; \ - } \ - else \ - { \ - Action1; \ - aRange -= aNewBound; \ - aCode -= aNewBound; \ - aProb -= (aProb) >> aNumMoveBits; \ - aModelIndex = (aModelIndex << 1) + 1; \ - }} \ - RC_NORMALIZE - -#define RC_GETBIT(aNumMoveBits, aProb, aModelIndex) RC_GETBIT2(aNumMoveBits, aProb, aModelIndex, ; , ;) - -#endif diff --git a/tools/zsnes/src/jma/rngcoder.h b/tools/zsnes/src/jma/rngcoder.h deleted file mode 100644 index 711c2de..0000000 --- a/tools/zsnes/src/jma/rngcoder.h +++ /dev/null @@ -1,143 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __COMPRESSION_RANGECODER_H -#define __COMPRESSION_RANGECODER_H - -#include "inbyte.h" - -namespace NCompression { -namespace NArithmetic { - -const UINT32 kNumTopBits = 24; -const UINT32 kTopValue = (1 << kNumTopBits); - -class CRangeDecoder -{ -public: - NStream::CInByte m_Stream; - UINT32 m_Range; - UINT32 m_Code; - UINT32 m_Word; - void Normalize() - { - while (m_Range < kTopValue) - { - m_Code = (m_Code << 8) | m_Stream.ReadByte(); - m_Range <<= 8; - } - } - - void Init(ISequentialInStream *aStream) - { - m_Stream.Init(aStream); - m_Code = 0; - m_Range = UINT32(-1); - for(int i = 0; i < 5; i++) - m_Code = (m_Code << 8) | m_Stream.ReadByte(); - } - - UINT32 GetThreshold(UINT32 aTotal) - { - return (m_Code) / ( m_Range /= aTotal); - } - - void Decode(UINT32 aStart, UINT32 aSize, UINT32 aTotal) - { - m_Code -= aStart * m_Range; - m_Range *= aSize; - Normalize(); - } - - /* - UINT32 DecodeDirectBitsDiv(UINT32 aNumTotalBits) - { - m_Range >>= aNumTotalBits; - UINT32 aThreshold = m_Code / m_Range; - m_Code -= aThreshold * m_Range; - - Normalize(); - return aThreshold; - } - - UINT32 DecodeDirectBitsDiv2(UINT32 aNumTotalBits) - { - if (aNumTotalBits <= kNumBottomBits) - return DecodeDirectBitsDiv(aNumTotalBits); - UINT32 aResult = DecodeDirectBitsDiv(aNumTotalBits - kNumBottomBits) << kNumBottomBits; - return (aResult | DecodeDirectBitsDiv(kNumBottomBits)); - } - */ - - UINT32 DecodeDirectBits(UINT32 aNumTotalBits) - { - UINT32 aRange = m_Range; - UINT32 aCode = m_Code; - UINT32 aResult = 0; - for (UINT32 i = aNumTotalBits; i > 0; i--) - { - aRange >>= 1; - /* - aResult <<= 1; - if (aCode >= aRange) - { - aCode -= aRange; - aResult |= 1; - } - */ - UINT32 t = (aCode - aRange) >> 31; - aCode -= aRange & (t - 1); - // aRange = aRangeTmp + ((aRange & 1) & (1 - t)); - aResult = (aResult << 1) | (1 - t); - - if (aRange < kTopValue) - { - aCode = (aCode << 8) | m_Stream.ReadByte(); - aRange <<= 8; - } - } - m_Range = aRange; - m_Code = aCode; - return aResult; - } - - UINT32 DecodeBit(UINT32 aSize0, UINT32 aNumTotalBits) - { - UINT32 aNewBound = (m_Range >> aNumTotalBits) * aSize0; - UINT32 aSymbol; - if (m_Code < aNewBound) - { - aSymbol = 0; - m_Range = aNewBound; - } - else - { - aSymbol = 1; - m_Code -= aNewBound; - m_Range -= aNewBound; - } - Normalize(); - return aSymbol; - } - - UINT64 GetProcessedSize() {return m_Stream.GetProcessedSize(); } -}; - -}} - -#endif diff --git a/tools/zsnes/src/jma/winout.cpp b/tools/zsnes/src/jma/winout.cpp deleted file mode 100644 index 1f33885..0000000 --- a/tools/zsnes/src/jma/winout.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "winout.h" - -namespace NStream { -namespace NWindow { - -void COut::Create(UINT32 aKeepSizeBefore, UINT32 aKeepSizeAfter, UINT32 aKeepSizeReserv) -{ - m_Pos = 0; - m_PosLimit = aKeepSizeReserv + aKeepSizeBefore; - m_KeepSizeBefore = aKeepSizeBefore; - m_KeepSizeAfter = aKeepSizeAfter; - m_KeepSizeReserv = aKeepSizeReserv; - m_StreamPos = 0; - m_MoveFrom = m_KeepSizeReserv; - m_WindowSize = aKeepSizeBefore; - UINT32 aBlockSize = m_KeepSizeBefore + m_KeepSizeAfter + m_KeepSizeReserv; - delete []m_Buffer; - m_Buffer = new BYTE[aBlockSize]; -} - -COut::~COut() -{ - delete []m_Buffer; -} - -void COut::SetWindowSize(UINT32 aWindowSize) -{ - m_WindowSize = aWindowSize; - m_MoveFrom = m_KeepSizeReserv + m_KeepSizeBefore - aWindowSize; -} - -void COut::Init(ISequentialOutStream *aStream, bool aSolid) -{ - m_Stream = aStream; - - if(aSolid) - m_StreamPos = m_Pos; - else - { - m_Pos = 0; - m_PosLimit = m_KeepSizeReserv + m_KeepSizeBefore; - m_StreamPos = 0; - } -} - -HRESULT COut::Flush() -{ - UINT32 aSize = m_Pos - m_StreamPos; - if(aSize == 0) - return S_OK; - UINT32 aProcessedSize; - HRESULT aResult = m_Stream->Write(m_Buffer + m_StreamPos, aSize, &aProcessedSize); - if (aResult != S_OK) - return aResult; - if (aSize != aProcessedSize) - return E_FAIL; - m_StreamPos = m_Pos; - return S_OK; -} - -void COut::MoveBlockBackward() -{ - HRESULT aResult = Flush(); - if (aResult != S_OK) - throw aResult; - memmove(m_Buffer, m_Buffer + m_MoveFrom, m_WindowSize + m_KeepSizeAfter); - m_Pos -= m_MoveFrom; - m_StreamPos -= m_MoveFrom; -} - -}} diff --git a/tools/zsnes/src/jma/winout.h b/tools/zsnes/src/jma/winout.h deleted file mode 100644 index 38e06bd..0000000 --- a/tools/zsnes/src/jma/winout.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) -Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License version 2.1 as published by the Free Software Foundation. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __STREAM_WINDOWOUT_H -#define __STREAM_WINDOWOUT_H - -#include "iiostrm.h" - -namespace NStream { -namespace NWindow { - -// m_KeepSizeBefore: how mach BYTEs must be in buffer before m_Pos; -// m_KeepSizeAfter: how mach BYTEs must be in buffer after m_Pos; -// m_KeepSizeReserv: how mach BYTEs must be in buffer for Moving Reserv; -// must be >= aKeepSizeAfter; // test it - -class COut -{ - BYTE *m_Buffer; - UINT32 m_Pos; - UINT32 m_PosLimit; - UINT32 m_KeepSizeBefore; - UINT32 m_KeepSizeAfter; - UINT32 m_KeepSizeReserv; - UINT32 m_StreamPos; - - UINT32 m_WindowSize; - UINT32 m_MoveFrom; - - ISequentialOutStream *m_Stream; - - virtual void MoveBlockBackward(); -public: - COut(): m_Buffer(0), m_Stream(0) {} - virtual ~COut(); - void Create(UINT32 aKeepSizeBefore, - UINT32 aKeepSizeAfter, UINT32 aKeepSizeReserv = (1<<17)); - void SetWindowSize(UINT32 aWindowSize); - - void Init(ISequentialOutStream *aStream, bool aSolid = false); - HRESULT Flush(); - - UINT32 GetCurPos() const { return m_Pos; } - const BYTE *GetPointerToCurrentPos() const { return m_Buffer + m_Pos;}; - - void CopyBackBlock(UINT32 aDistance, UINT32 aLen) - { - if (m_Pos >= m_PosLimit) - MoveBlockBackward(); - BYTE *p = m_Buffer + m_Pos; - aDistance++; - for(UINT32 i = 0; i < aLen; i++) - p[i] = p[i - aDistance]; - m_Pos += aLen; - } - - void PutOneByte(BYTE aByte) - { - if (m_Pos >= m_PosLimit) - MoveBlockBackward(); - m_Buffer[m_Pos++] = aByte; - } - - BYTE GetOneByte(UINT32 anIndex) const - { - return m_Buffer[m_Pos + anIndex]; - } - - BYTE *GetBuffer() const { return m_Buffer; } -}; - -}} - -#endif diff --git a/tools/zsnes/src/jma/zsnesjma.cpp b/tools/zsnes/src/jma/zsnesjma.cpp deleted file mode 100644 index d28407e..0000000 --- a/tools/zsnes/src/jma/zsnesjma.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright (C) 2004-2007 NSRT Team ( http://nsrt.edgeemu.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 -using namespace std; - -#include "zsnesjma.h" -#include "jma.h" - -extern "C" { -extern unsigned char *romdata; -extern unsigned int curromspace; -extern unsigned int maxromspace; -} - -void load_jma_file(const char *filename) -{ - try - { - JMA::jma_open JMAFile(filename); - vector file_info = JMAFile.get_files_info(); - - string our_file_name; - size_t our_file_size = 0; - - for (vector::iterator i = file_info.begin(); i != file_info.end(); i++) - { - //Check for valid ROM based on size - if ((i->size <= maxromspace+512) && (i->size > our_file_size)) - { - our_file_name = i->name; - our_file_size = i->size; - } - } - - if (!our_file_size) - { - return; - } - - JMAFile.extract_file(our_file_name, romdata); - - curromspace = our_file_size; - } - catch (JMA::jma_errors jma_error) - { - //No need to do anything - } -} - diff --git a/tools/zsnes/src/jma/zsnesjma.h b/tools/zsnes/src/jma/zsnesjma.h deleted file mode 100644 index f33d0b1..0000000 --- a/tools/zsnes/src/jma/zsnesjma.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright (C) 2004-2007 NSRT Team ( http://nsrt.edgeemu.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifdef __cplusplus -extern "C" { -#endif -void load_jma_file(const char *filename); -#ifdef __cplusplus -} -#endif - diff --git a/tools/zsnes/src/linux/audio.c b/tools/zsnes/src/linux/audio.c deleted file mode 100644 index d31f6bf..0000000 --- a/tools/zsnes/src/linux/audio.c +++ /dev/null @@ -1,358 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 "../gblhdr.h" -#include - -#ifdef __LIBAO__ -#include -#include -#include -#endif - -#include "../asm_call.h" -#include "../cfg.h" - -#ifdef __LIBAO__ -static pthread_t audio_thread; -static pthread_mutex_t audio_mutex; -static pthread_cond_t audio_wait; -static ao_device *audio_device = 0; -static volatile unsigned int samples_waiting = 0; -#endif - -unsigned char *sdl_audio_buffer = 0; -int sdl_audio_buffer_len = 0, sdl_audio_buffer_fill = 0; -int sdl_audio_buffer_head = 0, sdl_audio_buffer_tail = 0; -unsigned char sound_sdl = false; - -int SoundEnabled = 1; -unsigned char PrevStereoSound; -unsigned int PrevSoundQuality; - -#define SAMPLE_NTSC_HI_SCALE 995ULL -#define SAMPLE_NTSC_LO 59649ULL -#define SAMPLE_PAL_HI_SCALE 1ULL -#define SAMPLE_PAL_LO 50ULL -static const int freqtab[7] = { 8000, 11025, 22050, 44100, 16000, 32000, 48000 }; -#define RATE freqtab[SoundQuality = ((SoundQuality > 6) ? 1 : SoundQuality)] - -struct -{ - unsigned long long hi; - unsigned long long lo; - unsigned long long balance; -} sample_control; - -void InitSampleControl() -{ - extern unsigned char romispal; - if (romispal) - { - sample_control.hi = SAMPLE_PAL_HI_SCALE*RATE; - sample_control.lo = SAMPLE_PAL_LO; - } - else - { - sample_control.hi = SAMPLE_NTSC_HI_SCALE*RATE; - sample_control.lo = SAMPLE_NTSC_LO; - } - sample_control.balance = sample_control.hi; -} - - -#ifdef __LIBAO__ -static void SoundWriteSamples_ao(unsigned int samples) -{ - extern unsigned int BufferSizeB, BufferSizeW; - extern int DSPBuffer[1280]; - void ProcessSoundBuffer(); - short stemp[1280]; - - int *d = DSPBuffer, *end_d = 0; - short *p = stemp; - - while (samples > 1280) - { - SoundWriteSamples_ao(1280); - samples -= 1280; - } - - //printf("samples %d\n", samples); - - BufferSizeB = samples; - BufferSizeW = samples<<1; - - asm_call(ProcessSoundBuffer); - - end_d = DSPBuffer+samples; - for (; d < end_d; d++, p++) - { - if ((unsigned int)(*d + 0x7FFF) < 0xFFFF) { *p = *d; continue; } - if (*d > 0x7FFF) { *p = 0x7FFF; } - else { *p = 0x8001; } - } - - ao_play(audio_device, (char *)stemp, samples*2); -} - -void SoundWrite_ao() -{ - unsigned int samples = 0; - - if (!pthread_mutex_trylock(&audio_mutex)) - { - if (!samples_waiting && sample_control.lo) - { - samples = (unsigned int)((sample_control.balance/sample_control.lo) << StereoSound); - sample_control.balance %= sample_control.lo; - sample_control.balance += sample_control.hi; - - samples_waiting = samples; - pthread_cond_broadcast(&audio_wait); //Send signal - } - pthread_mutex_unlock(&audio_mutex); - } - else - { - pthread_cond_broadcast(&audio_wait); //Send signal - } -} - -static void *SoundThread_ao(void *useless) -{ - unsigned int samples; - - for (;;) - { - pthread_mutex_lock(&audio_mutex); - - //The while() is there to prevent error codes from breaking havoc - while (!samples_waiting) - { - pthread_cond_wait(&audio_wait, &audio_mutex); //Wait for signal - } - - samples = samples_waiting; - samples_waiting = 0; - pthread_mutex_unlock(&audio_mutex); - - SoundWriteSamples_ao(samples); - } - return(0); -} - -static int SoundInit_ao() -{ - int driver_id = ao_driver_id(libAoDriver); - if (driver_id < 0) { driver_id = ao_default_driver_id(); } - - ao_sample_format driver_format; - driver_format.bits = 16; - driver_format.channels = StereoSound+1; - driver_format.rate = freqtab[SoundQuality = ((SoundQuality > 6) ? 1 : SoundQuality)]; - driver_format.byte_format = AO_FMT_LITTLE; - - if (audio_device) - { - ao_close(audio_device); - } - else - { - if (pthread_create(&audio_thread, 0, SoundThread_ao, 0)) - { - puts("pthread_create() failed."); - } - else if (pthread_mutex_init(&audio_mutex, 0)) - { - puts("pthread_mutex_init() failed."); - } - else if (pthread_cond_init(&audio_wait, 0)) - { - puts("pthread_cond_init() failed."); - } - InitSampleControl(); - } - - //ao_option driver_options = { "buf_size", "32768", 0 }; - - audio_device = ao_open_live(driver_id, &driver_format, 0); - if (audio_device) - { - ao_info *di = ao_driver_info(driver_id); - printf("\nAudio Opened.\nDriver: %s\nChannels: %u\nRate: %u\n\n", di->name, driver_format.channels, driver_format.rate); - } - else - { - SoundEnabled = 0; - puts("Audio Open Failed"); - return(false); - } - return(true); -} - -#endif - -void SoundWrite_sdl() -{ - extern int DSPBuffer[]; - extern unsigned char DSPDisable; - extern unsigned int BufferSizeB, BufferSizeW, T36HZEnabled; - - // Process sound - BufferSizeB = 256; - BufferSizeW = BufferSizeB+BufferSizeB; - - // take care of the things we left behind last time - SDL_LockAudio(); - while (sdl_audio_buffer_fill < sdl_audio_buffer_len) - { - short *p = (short*)&sdl_audio_buffer[sdl_audio_buffer_tail]; - - if (soundon && !DSPDisable) { asm_call(ProcessSoundBuffer); } - - if (T36HZEnabled) - { - memset(p, 0, BufferSizeW); - } - else - { - int *d = DSPBuffer, *end_d = DSPBuffer+BufferSizeB; - - for (; d < end_d; d++, p++) - { - if ((unsigned int)(*d + 0x7fff) < 0xffff) { *p = *d; continue; } - if (*d > 0x7fff) { *p = 0x7fff; } - else { *p = 0x8001; } - } - } - - sdl_audio_buffer_fill += BufferSizeW; - sdl_audio_buffer_tail += BufferSizeW; - if (sdl_audio_buffer_tail >= sdl_audio_buffer_len) { sdl_audio_buffer_tail = 0; } - } - SDL_UnlockAudio(); -} - -static void SoundUpdate_sdl(void *userdata, unsigned char *stream, int len) -{ - int left = sdl_audio_buffer_len - sdl_audio_buffer_head; - - if (left > 0) - { - if (left <= len) - { - memcpy(stream, &sdl_audio_buffer[sdl_audio_buffer_head], left); - stream += left; - len -= left; - sdl_audio_buffer_head = 0; - sdl_audio_buffer_fill -= left; - } - - if (len) - { - memcpy(stream, &sdl_audio_buffer[sdl_audio_buffer_head], len); - sdl_audio_buffer_head += len; - sdl_audio_buffer_fill -= len; - } - } -} - -static int SoundInit_sdl() -{ - const int samptab[7] = { 1, 1, 2, 4, 2, 4, 4 }; - SDL_AudioSpec audiospec; - SDL_AudioSpec wanted; - - SDL_CloseAudio(); - - if (sdl_audio_buffer) - { - free(sdl_audio_buffer); - sdl_audio_buffer = 0; - } - sdl_audio_buffer_len = 0; - - wanted.freq = RATE; - wanted.channels = StereoSound+1; - wanted.samples = samptab[SoundQuality] * 128 * wanted.channels; - wanted.format = AUDIO_S16LSB; - wanted.userdata = 0; - wanted.callback = SoundUpdate_sdl; - - if (SDL_OpenAudio(&wanted, &audiospec) < 0) - { - SoundEnabled = 0; - return(false); - } - SDL_PauseAudio(0); - - sdl_audio_buffer_len = audiospec.size*2; - sdl_audio_buffer_len = (sdl_audio_buffer_len + 255) & ~255; // Align to SPCSize - if (!(sdl_audio_buffer = malloc(sdl_audio_buffer_len))) - { - SDL_CloseAudio(); - puts("Audio Open Failed"); - SoundEnabled = 0; - return(false); - } - - sound_sdl = true; - printf("\nAudio Opened.\nDriver: Simple DirectMedia Layer output\nChannels: %u\nRate: %u\n\n", wanted.channels, wanted.freq); - return(true); -} - - -int InitSound() -{ - sound_sdl = false; - if (!SoundEnabled) - { - return(false); - } - - PrevSoundQuality = SoundQuality; - PrevStereoSound = StereoSound; - - #ifdef __LIBAO__ - if (strcmp(libAoDriver, "sdl") && !(!strcmp(libAoDriver, "auto") && !strcmp(ao_driver_info(ao_default_driver_id())->name, "null"))) - { - return(SoundInit_ao()); - } - #endif - return(SoundInit_sdl()); -} - -void DeinitSound() -{ - #ifdef __LIBAO__ - if (audio_device) - { - pthread_kill(audio_thread, SIGTERM); - pthread_mutex_destroy(&audio_mutex); - pthread_cond_destroy(&audio_wait); - ao_close(audio_device); - } - #endif - SDL_CloseAudio(); - if (sdl_audio_buffer) { free(sdl_audio_buffer); } -} - diff --git a/tools/zsnes/src/linux/audio.h b/tools/zsnes/src/linux/audio.h deleted file mode 100644 index 4c98688..0000000 --- a/tools/zsnes/src/linux/audio.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef AUDIO_H -#define AUDIO_H - -void InitSampleControl(); -int InitSound(); -void DeinitSound(); - -#ifdef __LIBAO__ -void SoundWrite_ao(); -#endif -void SoundWrite_sdl(); - -extern int SoundEnabled; -extern unsigned char PrevStereoSound; -extern unsigned int PrevSoundQuality; -extern unsigned char sound_sdl; - -#endif diff --git a/tools/zsnes/src/linux/battery.c b/tools/zsnes/src/linux/battery.c deleted file mode 100644 index d47d324..0000000 --- a/tools/zsnes/src/linux/battery.c +++ /dev/null @@ -1,446 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 "../gblhdr.h" - - - - -/* -Functions for battery probing on Linux by Nach -I believe Linux 2.4.x+ is needed for ACPI support -but it'll compile fine for older versions too - -Special thanks David Lee Lambert for most of the code here -*/ - -#ifdef linux -#include -#include - -int CheckBattery() -{ - int battery = -1; //No battery / Can't get info - const char *ac = "/proc/acpi/ac_adapter/"; - - //Check ac adapter - DIR *ac_dir = opendir(ac); - if (ac_dir) - { - char fnbuf[40]; // longer than len(ac)+len(HEXDIGIT*4)+len({state|info}) - FILE *fp; - const char *pattern = " %39[^:]: %39[ -~]"; // for sscanf - char line[80], key[40], arg[40]; - - struct dirent *ent; - while ((ent = readdir(ac_dir))) - { - if (ent->d_name[0] == '.') { continue; } - - snprintf(fnbuf, 40, "%s%s/state", ac, ent->d_name); - fp = fopen(fnbuf, "r"); - if (fp) - { - while (fgets(line, 80, fp) && sscanf(line, pattern, key, arg) == 2) - { - if (!strcmp(key, "state")) - { - if (!strcmp(arg, "on-line")) - { - battery = 0; - } - else if (!strcmp(arg, "off-line")) - { - battery = 1; - break; - } - } - } - fclose(fp); - } - } - closedir(ac_dir); - } - return(battery); -} - -static int BatteryLifeTime; -static int BatteryLifePercent; - -static void update_battery_info() -{ - const char *batt = "/proc/acpi/battery/"; - - //Check batteries - DIR *batt_dir = opendir(batt); - if (batt_dir) - { - char fnbuf[40]; // longer than len(ac)+len(HEXDIGIT*4)+len({state|info}) - FILE *fp; - const char *pattern = " %39[^:]: %39[ -~]"; // for sscanf - char line[80], key[40], arg[40]; - - float x, design_capacity = 0.0f, remaining_capacity = 0.0f, present_rate = 0.0f, full_capacity = 0.0f; - - struct dirent *ent; - while ((ent = readdir(batt_dir))) - { - if (ent->d_name[0] == '.') { continue; } - snprintf(fnbuf, 40, "%s%s/info", batt, ent->d_name); - fp = fopen(fnbuf, "r"); - if (fp) - { - while (fgets(line, 80, fp) && sscanf(line, pattern, key, arg) == 2) - { - if (!strcmp(key, "design capacity") && sscanf(arg, "%g", &x) == 1) - { - design_capacity += x; - } - else if (!strcmp(key, "last full capacity") && sscanf(arg, "%g", &x) == 1) - { - full_capacity += x; - } - } - fclose(fp); - } - snprintf(fnbuf, 40, "%s%s/state", batt, ent->d_name); - fp = fopen(fnbuf, "r"); - if (fp) - { - int charging = 0; - while (fgets(line, 80, fp) && sscanf(line, pattern, key, arg) == 2) - { - if (!strcmp(key, "charging state")) - { - if (!strcmp(arg, "discharging")) - { - charging = -1; - } - else if (!strcmp(arg, "charging")) - { - charging = 1; - } - } - else if (!strcmp(key, "present rate") && sscanf(arg, "%g", &x) == 1) - { - present_rate += charging * x; - charging = 0; - } - else if (!strcmp(key, "remaining capacity") && sscanf(arg, "%g:", &x) == 1) - { - remaining_capacity += x; - charging = 0; - } - } - fclose(fp); - } - } - if (design_capacity > 0.0f) - { - BatteryLifePercent = (int)floorf(remaining_capacity / ((full_capacity > 0.0f) ? full_capacity : design_capacity) * 100.0); - if (BatteryLifePercent > 100) { BatteryLifePercent = 100; } - if (present_rate < 0.0f) - { - // Linux specifies rates in mWh or mAh - BatteryLifeTime = (int)floorf(remaining_capacity / (-present_rate) * 3600.0); - } - } - closedir(batt_dir); - } -} - -int CheckBatteryTime() -{ - BatteryLifeTime = -1; - update_battery_info(); - return(BatteryLifeTime); -} - -int CheckBatteryPercent() -{ - BatteryLifePercent = -1; - update_battery_info(); - return(BatteryLifePercent); -} - -/* -Functions for battery on FreeBSD/DragonFly by Nach - -If there's another FreeBSD based OS that doesn't -define one of these three, please let me know. -*/ -#elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) -#include -#include - -int CheckBattery() -{ - int state; - size_t state_len = sizeof(state); - if (!sysctlbyname("hw.acpi.battery.state", &state, &state_len, 0, 0)) - { - if ((state > -1) && (state < 7)) //7 == failure - { - if (!state || state&2) - { - return(0); //Plugged in - } - return(1); //Running off of battery - } - } - return(-1); -} - -//Note that I have not yet gotten anyone to test if this function has correct info returned -int CheckBatteryTime() -{ - int batt_time; - size_t batt_time_len = sizeof(batt_time); - if (!sysctlbyname("hw.acpi.battery.time", &batt_time, &batt_time_len, 0, 0)) - { - if (batt_time > -1) - { - return(batt_time * 60); - } - } - return(-1); -} - -int CheckBatteryPercent() -{ - int life = -1; - size_t life_len = sizeof(life); - sysctlbyname("hw.acpi.battery.life", &life, &life_len, 0, 0); - return(life); -} - -/* -Functions for battery on NetBSD/OpenBSD by Nach - -If there's another NetBSD based OS that uses -the same API, please let me know. - -Note this was the least tested section for all -the battery specific code. -*/ - -#elif (defined(__NetBSD__) || defined(__OpenBSD__)) -#include -#include -#include -#include - -#ifndef APM_BATT_ABSENT -#define APM_BATT_ABSENT APM_BATTERY_ABSENT -#endif - -int CheckBattery() -{ - int fd = open("/dev/apm", O_RDONLY); - if (fd != -1) - { - struct apm_power_info info; - if (!ioctl(fd, APM_IOC_GETPOWER, &info) && - (info.battery_state != APM_BATT_UNKNOWN) && (info.battery_state != APM_BATT_ABSENT)) - { - close(fd); - if ((info.battery_state == APM_BATT_CHARGING) || (info.ac_state == APM_AC_ON)) { return(0); } //Plugged in - return(1); //Running off of battery - } - close(fd); - } - return(-1); -} - -int CheckBatteryTime() -{ - int fd = open("/dev/apm", O_RDONLY); - if (fd != -1) - { - struct apm_power_info info; - if (!ioctl(fd, APM_IOC_GETPOWER, &info) && (info.minutes_left > 0) && (info.minutes_left < 0xFFFF)) - { - close(fd); - return(info.minutes_left*60); - } - close(fd); - } - return(-1); -} - -int CheckBatteryPercent() -{ - int fd = open("/dev/apm", O_RDONLY); - if (fd != -1) - { - struct apm_power_info info; - if (!ioctl(fd, APM_IOC_GETPOWER, &info)) - { - close(fd); - return((info.battery_life == 255) ? 100 : info.battery_life); - } - close(fd); - } - return(-1); -} - -/* -Functions for battery on Mac OS X by drizztbsd, Nach - -If you have issues, please report. -*/ - -#elif defined(__APPLE__) -#include -#include -#include -#include -#include - -static int stringsAreEqual(CFStringRef a, CFStringRef b) -{ - if (!a || !b) - { - return(0); - } - return(CFStringCompare(a, b, 0) == kCFCompareEqualTo); -} - -static int BatteryLifeTime; -static int BatteryLifePercent; -static int HasBattery; - -static void update_battery_info() -{ - CFTypeRef powerBlob = IOPSCopyPowerSourcesInfo(); - CFArrayRef powerSourcesList = IOPSCopyPowerSourcesList(powerBlob); - unsigned int count = CFArrayGetCount(powerSourcesList); - unsigned int i; - unsigned int tmp; - char ret; - - int totalCurrentCapacity = 0, totalMaxCapacity = 0; - - BatteryLifeTime = -1; - BatteryLifePercent = -1; - HasBattery = -1; - - for (i = 0; i < count; ++i) - { - CFTypeRef powerSource; - CFDictionaryRef description; - - powerSource = CFArrayGetValueAtIndex(powerSourcesList, i); - description = IOPSGetPowerSourceDescription(powerBlob, powerSource); - - //continue if one battery is not present - if (CFDictionaryGetValue(description, CFSTR(kIOPSIsPresentKey)) == kCFBooleanFalse) - { - continue; - } - - if (stringsAreEqual(CFDictionaryGetValue(description, CFSTR(kIOPSTransportTypeKey)), CFSTR(kIOPSInternalType))) - { - int currentCapacity, maxCapacity; - - CFStringRef currentState = CFDictionaryGetValue(description, CFSTR(kIOPSPowerSourceStateKey)); - CFNumberRef timeToEmptyNum = CFDictionaryGetValue(description, CFSTR(kIOPSTimeToEmptyKey)); - - if (CFEqual(currentState, CFSTR(kIOPSACPowerValue)) && (HasBattery != 1)) - { - HasBattery = 0; - } - else if (CFEqual(currentState, CFSTR(kIOPSBatteryPowerValue))) - { - CFNumberRef timeToEmptyNum = CFDictionaryGetValue(description, CFSTR(kIOPSTimeToEmptyKey)); - if(CFNumberGetValue(timeToEmptyNum, kCFNumberIntType, &tmp)) - { - if (BatteryLifeTime > -1) - { - BatteryLifeTime += tmp; - } - else - { - BatteryLifeTime = tmp; - } - } - HasBattery = 1; - } - CFNumberRef currentCapacityNum = CFDictionaryGetValue(description, CFSTR(kIOPSCurrentCapacityKey)); - CFNumberRef maxCapacityNum = CFDictionaryGetValue(description, CFSTR(kIOPSMaxCapacityKey)); - - if (CFNumberGetValue(currentCapacityNum, kCFNumberIntType, ¤tCapacity) && CFNumberGetValue(maxCapacityNum, kCFNumberIntType, &maxCapacity)) - { - totalCurrentCapacity += currentCapacity; - totalMaxCapacity += maxCapacity; - } - } - } - - CFRelease(powerSourcesList); - CFRelease(powerBlob); - - if (totalCurrentCapacity && totalMaxCapacity) - { - BatteryLifePercent = (int)roundf((totalCurrentCapacity / (float)totalMaxCapacity) * 100.0f); - } -} - -int CheckBattery() -{ - update_battery_info(); - return(HasBattery); -} - -int CheckBatteryTime() -{ - update_battery_info(); - if (BatteryLifeTime > -1) - { - return(BatteryLifeTime * 60); - } - return(-1); -} - -int CheckBatteryPercent() -{ - update_battery_info(); - return(BatteryLifePercent); -} - -#else //Not Linux, FreeBSD/DragonFlyBSD, NetBSD/OpenBSD, Mac OS X - -int CheckBattery() -{ - return(-1); -} - -int CheckBatteryTime() -{ - return(-1); -} - -int CheckBatteryPercent() -{ - return(-1); -} - -#endif diff --git a/tools/zsnes/src/linux/gl_draw.c b/tools/zsnes/src/linux/gl_draw.c deleted file mode 100644 index f732e4b..0000000 --- a/tools/zsnes/src/linux/gl_draw.c +++ /dev/null @@ -1,412 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 "../cfg.h" -#include "../gblhdr.h" -#include "../asm_call.h" - -#define BYTE unsigned char -#define WORD unsigned short -#define DWORD unsigned long - -//C++ style code in C -#define bool unsigned char -#define true 1 -#define false 0 - -// FUNCTIONS -void hq2x_16b(void); - -// VIDEO VARIABLES -extern SDL_Surface *surface; -extern int SurfaceX, SurfaceY; -extern int SurfaceLocking; -extern DWORD BitDepth; - -// OPENGL VARIABLES -static unsigned short *glvidbuffer = 0; -static GLuint gltextures[4]; -static int gltexture256, gltexture512; -static int glfilters = GL_NEAREST; -static int glscanready = 0; -extern Uint8 GUIOn2; - -extern unsigned int vidbuffer; -extern unsigned char curblank; -extern BYTE GUIRESIZE[]; - -void gl_clearwin(); -void UpdateVFrame(); - -void gl_scanlines(); - -bool OGLModeCheck(); - -int gl_start(int width, int height, int req_depth, int FullScreen) -{ - Uint32 flags = SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_HWPALETTE | SDL_OPENGL; - int i; - - flags |= (GUIRESIZE[cvidmode] ? SDL_RESIZABLE : 0); - flags |= (FullScreen ? SDL_FULLSCREEN : 0); - - - SurfaceX = width; SurfaceY = height; - surface = SDL_SetVideoMode(SurfaceX, SurfaceY, req_depth, flags); - if (surface == NULL) - { - fprintf(stderr, "Could not set %dx%d-GL video mode.\n",SurfaceX, SurfaceY); - return false; - } - - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); -#if (SDL_MAJOR_VERSION > 1) || ((SDL_MINOR_VERSION > 2) || ((SDL_MINOR_VERSION == 2) && (SDL_PATCHLEVEL >= 10))) - SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); -#endif - - if (!glvidbuffer) - { - glvidbuffer = (unsigned short *) malloc(512 * 512 * sizeof(short)); - } - gl_clearwin(); - SDL_WarpMouse(SurfaceX / 4, SurfaceY / 4); - - // Grab mouse in fullscreen mode - FullScreen ? SDL_WM_GrabInput(SDL_GRAB_ON) : - SDL_WM_GrabInput(SDL_GRAB_OFF); - - SDL_WM_SetCaption("ZSNES", "ZSNES"); - SDL_ShowCursor(0); - - /* Setup some GL stuff */ - - glEnable(GL_TEXTURE_1D); - glEnable(GL_TEXTURE_2D); - - glViewport(0, 0, SurfaceX, SurfaceY); - - /* - * gltextures[0]: 2D texture, 256x224 - * gltextures[1]: 2D texture, 512x224 - * gltextures[3]: 1D texture, 256 lines of alternating alpha - */ - glGenTextures(4, gltextures); - for (i = 0; i < 3; i++) { - glBindTexture(GL_TEXTURE_2D, gltextures[i]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glfilters); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glfilters); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - } - - if (scanlines) gl_scanlines(); - - return true; -} - -void gl_end() -{ - if (glvidbuffer) - { - glDeleteTextures(4, gltextures); - free(glvidbuffer); - glvidbuffer = 0; - } -} - -extern DWORD AddEndBytes; -extern DWORD NumBytesPerLine; -extern unsigned char *WinVidMemStart; -extern unsigned char NGNoTransp; -void copy640x480x16bwin(void); -extern unsigned char SpecialLine[224]; /* 0 if lo-res, > 0 if hi-res */ - -void gl_clearwin() -{ - glClear(GL_COLOR_BUFFER_BIT); - memset(glvidbuffer, 0, 512 * 448 * 2); -} - -/* gl_drawspan: - * Puts a quad on the screen for hires/lores portions, starting at line start, - * and ending at line end.. - * Builds the 256x256/512x256 textures if gltexture256 or gltexture512 == 0 - */ -static void gl_drawspan(int hires, int start, int end) -{ - int i, j; - - switch (hires) - { - case 0: - break; - case 3: - case 7: - hires = 2; - break; - default: - hires = 1; - break; - } - - if (hires) - { - if (hires != gltexture512) - { - unsigned short *vbuf1 = &((unsigned short *) vidbuffer)[16]; - unsigned short *vbuf2 = &((unsigned short *) vidbuffer)[75036 * 2 + 16]; - unsigned short *vbuf = &glvidbuffer[0]; - - if (hires>1) // mode 7 - { - for (j = 224; j--;) - { - for (i = 256; i--;) - *vbuf++ = *vbuf1++; - for (i = 256; i--;) - *vbuf++ = *vbuf2++; - vbuf1 += 32; - vbuf2 += 32; - } - glBindTexture(GL_TEXTURE_2D, gltextures[1]); - glTexImage2D(GL_TEXTURE_2D, 0, 3, 256, 512, 0, - GL_RGB, GL_UNSIGNED_SHORT_5_6_5, - glvidbuffer); - - gltexture512 = 2; - } - else - { - for (j = 224; j--;) - { - for (i = 256; i--;) - { - *vbuf++ = *vbuf1++; - *vbuf++ = *vbuf2++; - } - vbuf1 += 32; - vbuf2 += 32; // skip the two 16-pixel-wide columns - } - - glBindTexture(GL_TEXTURE_2D, gltextures[1]); - glTexImage2D(GL_TEXTURE_2D, 0, 3, 512, 256, 0, - GL_RGB, GL_UNSIGNED_SHORT_5_6_5, - glvidbuffer); - - gltexture512 = 1; - } - } - - glBindTexture(GL_TEXTURE_2D, gltextures[1]); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, (224.0 / 256.0) * (start / 224.0)); - glVertex2f(-1.0f, (112 - start) / 112.0); - glTexCoord2f(1.0f, (224.0 / 256.0) * (start / 224.0)); - glVertex2f(1.0f, (112 - start) / 112.0); - glTexCoord2f(1.0f, (224.0 / 256.0) * (end / 224.0)); - glVertex2f(1.0f, (112 - end) / 112.0); - glTexCoord2f(0.0f, (224.0 / 256.0) * (end / 224.0)); - glVertex2f(-1.0f, (112 - end) / 112.0); - glEnd(); - } - else - { - glBindTexture(GL_TEXTURE_2D, gltextures[0]); - if (!gltexture256) - { - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 16); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 288); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, 256, 256, 0, - GL_RGB, GL_UNSIGNED_SHORT_5_6_5, - ((unsigned short *) vidbuffer) + 288); - - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - - gltexture256 = 1; - } - - glBegin(GL_QUADS); - glTexCoord2f(0.0f, (224.0 / 256.0) * (start / 224.0)); - glVertex2f(-1.0f, (112 - start) / 112.0); - glTexCoord2f(1.0f, (224.0 / 256.0) * (start / 224.0)); - glVertex2f(1.0f, (112 - start) / 112.0); - glTexCoord2f(1.0f, (224.0 / 256.0) * (end / 224.0)); - glVertex2f(1.0f, (112 - end) / 112.0); - glTexCoord2f(0.0f, (224.0 / 256.0) * (end / 224.0)); - glVertex2f(-1.0f, (112 - end) / 112.0); - glEnd(); - } -} - -void gl_drawwin() -{ - int i; - - NGNoTransp = 0; // Set this value to 1 within the appropriate - // video mode if you want to add a custom - // transparency routine or hardware - // transparency. This only works if - // the value of newengen is equal to 1. - // (see ProcessTransparencies in newgfx16.asm - // for ZSNES' current transparency code) - UpdateVFrame(); - if (curblank || !OGLModeCheck()) - return; - - if (BilinearFilter) - { - glfilters = GL_LINEAR; - if (GUIOn2 && !FilteredGUI) - glfilters = GL_NEAREST; - } - else - { - glfilters = GL_NEAREST; - } - - if (SurfaceX >= 512 && (hqFilter || En2xSaI)) - { - AddEndBytes = 0; - NumBytesPerLine = 1024; - WinVidMemStart = (void *) glvidbuffer; - - if (hqFilter) hq2x_16b(); - else asm_call(copy640x480x16bwin); - - /* Display 1 512x448 quad for the 512x448 buffer */ - glBindTexture(GL_TEXTURE_2D, gltextures[1]); - glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_DECAL); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, - GL_RGB, GL_UNSIGNED_SHORT_5_6_5, glvidbuffer); - - glDisable (GL_DEPTH_TEST); - glDisable (GL_LIGHTING); - glDisable (GL_BLEND); - - glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); - glVertex3f(-1.0f, 1.0f, -1.0f); - glTexCoord2f(1.0f, 0.0f); - glVertex3f(1.0f, 1.0f, -1.0f); - glTexCoord2f(1.0f, 448.0f / 512.0f); - glVertex3f(1.0f, -1.0f, -1.0f); - glTexCoord2f(0.0f, 448.0f / 512.0f); - glVertex3f(-1.0f, -1.0f, -1.0f); - glEnd(); - } - else - { - /* - * This code splits the hires/lores portions up, and draws - * them with gl_drawspan - */ - int lasthires, lasthires_line = 0; - - gltexture256 = gltexture512 = 0; - - lasthires = SpecialLine[1]; - for (i = 0; i < 224; i++) - { - if (SpecialLine[i + 1]) - { - if (lasthires) - continue; - gl_drawspan(lasthires, lasthires_line, i); - - lasthires = SpecialLine[i + 1]; - lasthires_line = i; - } - else - { - if (!lasthires) - continue; - gl_drawspan(lasthires, lasthires_line, i); - - lasthires = SpecialLine[i + 1]; - lasthires_line = i; - } - } - - if (i - lasthires_line > 1) - gl_drawspan(lasthires, lasthires_line, i); - - /* - * This is here rather than right outside this if because the - * GUI doesn't allow scanlines to be selected while filters are - * on.. There is no technical reason they can't be on while - * filters are on, however. Feel free to change the GUI, and - * move this outside the if (En2xSaI) {}, if you do. - */ - if (scanlines) - { - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - if (scanlines != glscanready) gl_scanlines(); - - glBlendFunc(GL_DST_COLOR, GL_ZERO); - glBindTexture(GL_TEXTURE_1D, gltextures[3]); - glBegin(GL_QUADS); - for (i = 0; i < SurfaceY; i += 256) - { - glTexCoord1f(0.0f); - glVertex3f(-1.0f, (SurfaceY - i * 2.0) / SurfaceY, -1.0f); - glTexCoord1f(0.0f); - glVertex3f(1.0f, (SurfaceY - i * 2.0) / SurfaceY, -1.0f); - glTexCoord1f(1.0f); - glVertex3f(1.0f, (SurfaceY - (i + 256) * 2.0) / SurfaceY, -1.0f); - glTexCoord1f(1.0f); - glVertex3f(-1.0f, (SurfaceY - (i + 256) * 2.0) / SurfaceY, -1.0f); - } - glEnd(); - - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - } - } - SDL_GL_SwapBuffers(); -} - -void gl_scanlines(void) -{ - GLubyte scanbuffer[256][4]; - int i, j = scanlines==1 ? 0 : (scanlines==2 ? 192 : 128); - - for (i = 0; i < 256; i += 2) - { - scanbuffer[i][0] = scanbuffer[i][1] = scanbuffer[i][2] = j; - scanbuffer[i][3] = 0xFF; - - scanbuffer[i+1][0] = scanbuffer[i+1][1] = scanbuffer[i+1][2] = 0xFF; - scanbuffer[i+1][3] = 0xFF; - } - - glBindTexture(GL_TEXTURE_1D, gltextures[3]); - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, 256, 0, GL_RGBA, - GL_UNSIGNED_BYTE, scanbuffer); - - glscanready = scanlines; -} diff --git a/tools/zsnes/src/linux/gl_draw.h b/tools/zsnes/src/linux/gl_draw.h deleted file mode 100644 index 6ee6b0a..0000000 --- a/tools/zsnes/src/linux/gl_draw.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - -#ifndef GL_DRAW_h -#define GL_DRAW_h 1 - -int gl_start(int width, int height, int req_depth, int FullScreen); -void gl_end(); -void gl_clearwin(); -void gl_drawwin(); - -#endif - - diff --git a/tools/zsnes/src/linux/safelib.c b/tools/zsnes/src/linux/safelib.c deleted file mode 100644 index f3a7b3c..0000000 --- a/tools/zsnes/src/linux/safelib.c +++ /dev/null @@ -1,355 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 "gblhdr.h" - -#include -#include -#include -#include -#include -#include - -#ifndef OPEN_MAX -#define OPEN_MAX 256 -#endif - -#include "safelib.h" - -#include "../argv.h" - -//C++ style code in C -#define bool unsigned char -#define true 1 -#define false 0 - - -//Introducing secure forking ;) -Nach - -//Taken from the secure programming cookbook, somewhat modified -static bool spc_drop_privileges() -{ - gid_t newgid = getgid(), oldgid = getegid(); - uid_t newuid = getuid(), olduid = geteuid(); - - char *name = getlogin(); - struct passwd *userinfo; - - if (!olduid && name && (userinfo = getpwnam(name)) && userinfo->pw_uid) - { - setgroups(1, &userinfo->pw_gid); - -#if !defined(linux) - setegid(userinfo->pw_gid); - if (setgid(userinfo->pw_gid) == -1) { return(false); } -#else - if (setregid(userinfo->pw_gid, userinfo->pw_gid) == -1) { return(false); } -#endif - -#if !defined(linux) - seteuid(userinfo->pw_uid); - if (setuid(userinfo->pw_uid) == -1) { return(false); } -#else - if (setreuid(userinfo->pw_uid, userinfo->pw_uid) == -1) { return(false); } -#endif - - if ((setegid(oldgid) != -1) || (getegid() != userinfo->pw_gid)) { return(false); } - if ((seteuid(olduid) != -1) || (geteuid() != userinfo->pw_uid)) { return(false); } - } - else - { - //If root privileges are to be dropped, be sure to pare down the ancillary - //groups for the process before doing anything else because the setgroups() - //system call requires root privileges. Drop ancillary groups regardless of - //whether privileges are being dropped temporarily or permanently. - - if (!olduid) setgroups(1, &newgid); - - if (newgid != oldgid) - { -#if !defined(linux) - setegid(newgid); - if (setgid(newgid) == -1) { return(false); } -#else - if (setregid(newgid, newgid) == -1) { return(false); } -#endif - } - - if (newuid != olduid) - { -#if !defined(linux) - seteuid(newuid); - if (setuid(newuid) == -1) { return(false); } -#else - if (setreuid(newuid, newuid) == -1) { return(false); } -#endif - } - - //verify that the changes were successful - if (newgid != oldgid && (setegid(oldgid) != -1 || getegid() != newgid)) { return(false); } - if (newuid != olduid && (seteuid(olduid) != -1 || geteuid() != newuid)) { return(false); } - } - return(true); -} - -static int open_devnull(int fd) -{ - FILE *f = 0; - - if (!fd) { f = freopen(_PATH_DEVNULL, "rb", stdin); } - else if (fd == 1) { f = freopen(_PATH_DEVNULL, "wb", stdout); } - else if (fd == 2) { f = freopen(_PATH_DEVNULL, "wb", stderr); } - return(f && fileno(f) == fd); -} - -static bool array_contains(int *a, size_t size, int key) -{ - size_t i; - for (i = 0; i < size; i++) - { - if (a[i] == key) { return(true); } - } - return(false); -} - -static bool spc_sanitize_files(int *a, size_t size, int skip) -{ - int fd, fds; - struct stat st; - - //Make sure all open descriptors other than the standard ones are closed - if ((fds = getdtablesize()) == -1) - { - fds = OPEN_MAX; - } - for (fd = 3; fd < fds; fd++) - { - if ((fd != skip) && !array_contains(a, size, fd)) { close(fd); } - } - - //Verify that the standard descriptors are open. If they're not, attempt to - //open them using /dev/null. If any are unsuccessful, fail. - for (fd = 0; fd < 3; fd++) - { - if (fstat(fd, &st) == -1 && (errno != EBADF || !open_devnull(fd))) - { - return(false); - } - } - return(true); -} - -//Pass array of file descriptors to leave open -pid_t safe_fork(int *a, size_t size) -{ - int filedes[2]; - if (!pipe(filedes)) - { - char success = 0; - pid_t childpid; - if ((childpid = fork()) == -1) //Fork Failed - { - close(filedes[0]); - close(filedes[1]); - return(-1); - } - - if (childpid) //Parent Process - { - close(filedes[1]); //Close writing - read(filedes[0], &success, 1); - close(filedes[0]); - if (success) - { - return(childpid); - } - waitpid(childpid, 0, 0); - return(-1); - } - - - //This is the child proccess - - close(filedes[0]); //Close reading - - if (!spc_sanitize_files(a, size, filedes[1]) || !spc_drop_privileges()) - { - write(filedes[1], &success, 1); - close(filedes[1]); - _exit(0); - } - - success = 1; - write(filedes[1], &success, 1); - close(filedes[1]); - return(0); - } - return(-1); -} - - -//Introducing a popen which doesn't return until it knows for sure of program launched or couldn't open -Nach - - -//Forks, parent is paused until child successfully execs (returns child pid) or child exits (returns failure) -static pid_t parent_pause_fork() -{ - int filedes[2]; - if (!pipe(filedes)) - { - int pid = fork(); - if (pid == -1) //Failed - { - close(filedes[0]); - close(filedes[1]); - } - else if (pid > 0) //Parent - { - char success = 1; - close(filedes[1]); - read(filedes[0], &success, 1); - close(filedes[0]); - if (success) - { - return(pid); - } - waitpid(pid, 0, 0); - } - else //Child - { - close(filedes[0]); - fcntl(filedes[1], F_SETFD, FD_CLOEXEC); - return(-filedes[1]); - } - } - return(0); -} - -static void close_child(pid_t pid) -{ - char success = 0; - write(-pid, &success, 1); - close(-pid); - _exit(0); -} - -#define IS_PARENT(x) ((x) > 0) -#define IS_CHILD(x) ((x) < 0) -#define IS_FAIL(x) ((x) == 0) - - -static struct fp_pid_link -{ - FILE *fp; - pid_t pid; - struct fp_pid_link *next; -} fp_pids = { 0, 0, 0 }; - - -FILE *safe_popen(char *command, const char *mode) -{ - //filedes[0] is for reading - //filedes[1] is for writing. - int filedes[2]; - - if (mode && (*mode == 'r' || *mode == 'w') && !pipe(filedes)) - { - pid_t childpid = parent_pause_fork(); - if (IS_PARENT(childpid)) - { - FILE *fp; - if (*mode == 'r') - { - close(filedes[1]); - fp = fdopen(filedes[0], "r"); - } - else - { - close(filedes[0]); - fp = fdopen(filedes[1], "w"); - } - - if (fp) - { - struct fp_pid_link *link = &fp_pids; - while (link->next) - { - link = link->next; - } - - link->next = (struct fp_pid_link *)malloc(sizeof(struct fp_pid_link)); - if (link->next) - { - link->next->fp = fp; - link->next->pid = childpid; - link->next->next = 0; - return(fp); - } - fclose(fp); - } - kill(childpid, SIGTERM); - waitpid(childpid, 0, 0); - } - else if (IS_CHILD(childpid)) - { - char **argv = build_argv(command); - if (argv) - { - if (*mode == 'r') - { - dup2(filedes[1], STDOUT_FILENO); - } - else - { - dup2(filedes[0], STDIN_FILENO); - } - - if (spc_sanitize_files(0, 0, -childpid) && spc_drop_privileges()) - { - execvp(argv[0], argv); - } - free(argv); - } - close_child(childpid); - } - close(filedes[0]); - close(filedes[1]); - } - return(0); -} - -void safe_pclose(FILE *fp) -{ - struct fp_pid_link *link = &fp_pids; - - while (link->next && link->next->fp != fp) - { - link = link->next; - } - if (link->next->fp == fp) - { - struct fp_pid_link *dellink = link->next; - fclose(fp); - waitpid(link->next->pid, 0, 0); - link->next = link->next->next; - free(dellink); - } -} diff --git a/tools/zsnes/src/linux/safelib.h b/tools/zsnes/src/linux/safelib.h deleted file mode 100644 index 4b93822..0000000 --- a/tools/zsnes/src/linux/safelib.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef SAFELIB_H -#define SAFELIB_H - -#include -#include - -pid_t safe_fork(int *, size_t); - -FILE *safe_popen(char *, const char *); -void safe_pclose(FILE *); - -#define popen safe_popen -#define pclose safe_pclose - -#endif diff --git a/tools/zsnes/src/linux/sdlintrf.asm b/tools/zsnes/src/linux/sdlintrf.asm deleted file mode 100644 index e22d9b6..0000000 --- a/tools/zsnes/src/linux/sdlintrf.asm +++ /dev/null @@ -1,806 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 getchar,PrevFSMode,sem_sleep,SBHDMA,putchar,Start60HZ -EXTSYM pressed,AdjustFrequency,vidbufferofsb,vidbuffer,clearwin -EXTSYM Stop60HZ,initwinvideo,vesa2_rpos,vesa2_gpos,vesa2_bpos,vesa2_rposng -EXTSYM vesa2_gposng,vesa2_bposng,vesa2_usbit,vesa2_clbit,vesa2_clbitng -EXTSYM vesa2_clbitng2,vesa2_clbitng3,vesa2red10,res640,res480,cbitmode,cvidmode -EXTSYM vesa2_bits,vesa2_x,vesa2_y,genfulladdtab,GUICPC,drawscreenwin -EXTSYM ConvertToAFormat,HalfTrans,UnusedBit,UnusedBitXor -EXTSYM ngrposng,nggposng,ngbposng,HalfTransB,HalfTransC,UpdateVFrame,GetMouseX -EXTSYM GetMouseY,GetMouseMoveX,GetMouseMoveY,GetMouseButton,T36HZEnabled -EXTSYM MouseButton,Start36HZ,Stop36HZ,CheckTimers,vesa2_rfull,vesa2_rtrcl -EXTSYM vesa2_rtrcla,vesa2_gfull,vesa2_gtrcl,vesa2_gtrcla,vesa2_bfull,vesa2_btrcl -EXTSYM vesa2_btrcla,Init_2xSaIMMXW,V8Mode,GrayscaleMode,PrevWinMode -EXTSYM pl1upk,pl1downk,pl1leftk,pl1rightk,pl1startk,pl1selk -EXTSYM pl1Ak,pl1Bk,pl1Xk,pl1Yk,pl1Lk,pl1Rk -EXTSYM pl2upk,pl2downk,pl2leftk,pl2rightk,pl2startk,pl2selk -EXTSYM pl2Ak,pl2Bk,pl2Xk,pl2Yk,pl2Lk,pl2Rk -EXTSYM pl3upk,pl3downk,pl3leftk,pl3rightk,pl3startk,pl3selk -EXTSYM pl3Ak,pl3Bk,pl3Xk,pl3Yk,pl3Lk,pl3Rk -EXTSYM pl4upk,pl4downk,pl4leftk,pl4rightk,pl4startk,pl4selk -EXTSYM pl4Ak,pl4Bk,pl4Xk,pl4Yk,pl4Lk,pl4Rk -EXTSYM pl5upk,pl5downk,pl5leftk,pl5rightk,pl5startk,pl5selk -EXTSYM pl5Ak,pl5Bk,pl5Xk,pl5Yk,pl5Lk,pl5Rk - -%ifdef __OPENGL__ -EXTSYM Clear2xSaIBuffer -%endif - -; NOTE: For timing, Game60hzcall should be called at 50hz or 60hz (depending -; on romispal) after a call to InitPreGame and before DeInitPostGame are -; made. GUI36hzcall should be called at 36hz after a call GUIInit and -; before GUIDeInit. - -SECTION .text - -NEWSYM StartUp - ret - -; SystemInit - Initialize all Joystick stuff, load in all configuration data, -; parse commandline data, obtain current directory (One time initialization) - -NEWSYM SystemInit - ; Be sure to set SBHDMA to a value other than 0 if 16bit sound exists - mov byte[SBHDMA],1 - ret - -NEWSYM PrintStr ; Print ASCIIZ string - pushad -.next - mov al,[edx] - or al,al - jz .finish - push edx - mov dl,al - push edx - call putchar - pop edx - pop edx - inc edx - jmp .next -.finish - popad - ret - -SECTION .data -NEWSYM wfkey, db 0 - -SECTION .text -NEWSYM WaitForKey ; Wait for a key to be pressed - pushad - call getchar - mov [wfkey],al - popad - mov al,[wfkey] - ; return key in al - ret - -SECTION .data -NEWSYM CurKeyPos, dd 0 -NEWSYM CurKeyReadPos, dd 0 -NEWSYM KeyBuffer, times 16 dd 0 - -SECTION .text -NEWSYM Check_Key - mov al,[CurKeyPos] - cmp al,[CurKeyReadPos] - jne .yeskey - xor al,al - ret -.yeskey - mov al,0FFh - ret - -NEWSYM Get_Key - ; wait if there are no keys in buffer, then return key in al - ; for extended keys, return a 0, then the extended key afterwards - xor eax,eax -.nokey -; call JoyRead - mov al,[CurKeyReadPos] - cmp al,[CurKeyPos] - je .nokey - test word[KeyBuffer+eax*4],100h - jnz .upper - mov al,[KeyBuffer+eax*4] - inc dword[CurKeyReadPos] - and dword[CurKeyReadPos],0Fh - ret -.upper - sub word[KeyBuffer+eax*4],100h - xor al,al - ret - -NEWSYM Get_Memfree - mov eax,02000000h - ret - -NEWSYM Output_Text ; Output character (ah=02h) or string (ah=09h) - pushad - - ; This function usually displays an error message on-screen - cmp ah,02h - je .char - cmp ah,09h - je .string - ret -.char - push edx - call putchar - pop edx - popad - ret -.string - pushad - call PrintStr ; print edx - popad - popad - ret - -NEWSYM InitPreGame ; Executes before starting/continuing a game - mov byte[pressed+1],2 - pushad - call Start60HZ -%ifdef __OPENGL__ - call drawscreenwin -%endif - call initwinvideo - popad - - mov al,[GrayscaleMode] - cmp al,[V8Mode] - je .nochangemode - xor byte[V8Mode],1 - xor al,al -.nochangemode - - pushad - call AdjustFrequency - popad - - pushad - xor eax,eax - mov edi,[vidbufferofsb] - mov ecx,288*128 - rep stosd - popad - - pushad - call clearwin - popad - ret - -NEWSYM SetupPreGame ; Executes after pre-game init, can execute multiple - ; times after a single InitPreGame - mov byte[pressed+1],2 - ret - - -NEWSYM DeInitPostGame ; Called after game is ended - pushad - call Stop60HZ - popad - ret - -; **************************** -; Video Stuff -; **************************** - -; ** init video mode functions ** -SECTION .data -NEWSYM firstvideo, dd 1 -SECTION .text - -NEWSYM initvideo ; Returns 1 in videotroub if trouble occurs - mov byte[res640],1 - mov byte[res480],1 - mov byte[cbitmode],1 - mov word[vesa2_x],512 - mov word[vesa2_y],480 - mov byte[vesa2_bits],16 - mov dword[vesa2_bits],16 - mov dword[vesa2_rpos],11 - mov dword[vesa2_gpos],5 - mov dword[vesa2_bpos],0 - mov byte[vesa2red10],0 - mov byte[vesa2_rposng],11 - mov byte[vesa2_gposng],5 - mov byte[vesa2_bposng],0 - mov dword[vesa2_clbitng],1111011111011110b - mov dword[vesa2_clbitng2],11110111110111101111011111011110b - mov dword[vesa2_clbitng2+4],11110111110111101111011111011110b - mov dword[vesa2_clbitng3],0111101111101111b - - pushad - call initwinvideo - popad - - movzx eax,byte[cvidmode] - cmp byte[GUIWFVID+eax],0 - je .prevwinmode - mov [PrevFSMode],al - jmp .doneprevmode -.prevwinmode - mov [PrevWinMode],al -.doneprevmode - - cmp dword[firstvideo],1 - je .skipinitgfx - pushad - call InitializeGfxStuff - popad - -.skipinitgfx - mov dword[firstvideo],0 - - pushad - call InitializeGfxStuff - popad - - ret - - -NEWSYM deinitvideo - ret - -; ** copy video mode functions ** -SECTION .data -NEWSYM converta, dd 0 -%ifdef __OPENGL__ -NEWSYM blinit, db 1 -%endif - -SECTION .text -NEWSYM DrawScreen ; In-game screen render w/ triple buffer check - cmp dword[converta],1 - jne near .skipconv - pushad - mov dword[UnusedBit], 10000000000000001000000000000000b - mov dword[HalfTrans], 01111011110111100111101111011110b - mov dword[UnusedBitXor], 01111111111111110111111111111111b - mov dword[UnusedBit+4], 10000000000000001000000000000000b - mov dword[HalfTrans+4], 01111011110111100111101111011110b - mov dword[UnusedBitXor+4],01111111111111110111111111111111b - mov dword[HalfTransB], 00000100001000010000010000100001b - mov dword[HalfTransB+4], 00000100001000010000010000100001b - mov dword[HalfTransC], 01111011110111100111101111011110b - mov dword[HalfTransC+4], 01111011110111100111101111011110b - mov dword[ngrposng],10 - mov dword[nggposng],5 - mov dword[ngbposng],0 - - call ConvertToAFormat - - popad - -.skipconv - pushad - call drawscreenwin -%ifdef __OPENGL__ - cmp byte[blinit],1 - jne .noreinit - call initwinvideo - call Clear2xSaIBuffer - mov byte[blinit],0 -.noreinit -%endif - popad - - ret - -NEWSYM vidpastecopyscr ; GUI screen render - pushad - mov eax,[vidbuffer] - mov ecx,224*288 - mov edx,ecx - sub ecx,288 - dec edx -.loop - movzx ebx,byte[eax+edx] - mov bx,[GUICPC+ebx*2] - mov [eax+edx*2],bx - dec edx - dec ecx - jnz .loop - popad - jmp DrawScreen - -; ** Video Mode Variables ** -SECTION .data - -; Total Number of Video Modes -%ifdef __OPENGL__ -NEWSYM NumVideoModes, dd 23 -%else -NEWSYM NumVideoModes, dd 5 -%endif - -; GUI Video Mode Names - Make sure that all names are of the same length -; and end with a NULL terminator -NEWSYM GUIVideoModeNames -db '256x224 R W',0 ;0 -db '256x224 R F',0 ;1 -db '512x448 DR W',0 ;2 -db '512x448 DR F',0 ;3 -db '640x480 DR F',0 ;4 -%ifdef __OPENGL__ -db '256x224 O R W',0 ;5 -db '512x448 ODR W',0 ;6 -db '640x480 ODS F',0 ;7 -db '640x480 ODS W',0 ;8 -db '640x560 ODR W',0 ;9 -db '768x672 ODR W',0 ;10 -db '800x600 ODS F',0 ;11 -db '800x600 ODS W',0 ;12 -db '896x784 ODR W',0 ;13 -db '1024x768 ODS F',0 ;14 -db '1024x768 ODS W',0 ;15 -db '1024x896 ODR W',0 ;16 -db '1280x960 ODS F',0 ;17 -db '1280x1024 ODS F',0 ;18 -db '1600x1200 ODS F',0 ;19 -db 'VARIABLE ODR W',0 ;20 -db 'VARIABLE ODS W',0 ;21 -db 'CUSTOM OD F',0 ;22 -%endif - -; Video Mode Feature Availability (1 = Available, 0 = Not Available) -; Left side starts with Video Mode 0 -; vid mode column = 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2 -NEWSYM GUII2VID, db 0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation -NEWSYM GUIWFVID, db 0,1,0,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,0,0,1 ; Fullscreen -NEWSYM GUIDSIZE, db 0,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; D Modes -NEWSYM GUIKEEP43, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1 ; Keep 4:3 Ratio -NEWSYM GUIM7VID, db 0,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; Hires Mode 7 -NEWSYM GUIHQ2X, db 0,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; Hq2x Filter -NEWSYM GUIHQ3X, db 0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Hq3x Filter) -NEWSYM GUIHQ4X, db 0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Hq4x Filter) -NEWSYM GUINTVID, db 0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; NTSC Filter -NEWSYM GUIRESIZE, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0 ; SDL Resizable -%ifdef __OPENGL__ -NEWSYM GUIBIFIL, db 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; SDL Bilinear Filter -%endif - -SECTION .text - -; **************************** -; Input Device Stuff -; **************************** - -; Variables related to Input Device Routines: -; pl1selk,pl1startk,pl1upk,pl1downk,pl1leftk,pl1rightk,pl1Xk, -; pl1Ak,pl1Lk,pl1Yk,pl1Bk,pl1Rk -; (Change 1 to 2,3,4 for other players) -; Each of these variables contains the corresponding key pressed value -; for the key data -; pressed[] -; - This is an array of pressed/released data (bytes) where the -; corresponding key pressed value is used as the index. The value -; for each entry is 0 for released and 1 for pressed. Also, when -; writing keyboard data to this array, be sure to first check if -; the value of the array entry is 2 or not. If it is 2, do not write 1 -; to that array entry. (however, you can write 0 to it) -; As an example, to access Player 1 L button press data, it is -; done like : pressed[pl1Lk] -; The 3 character key description of that array entry is accessed by the -; GUI through ScanCodeListing[pl1Lk*3] - -; Note: When storing the input device configuration of a dynamic input -; device system (ie. Win9x) rather than a static system (ie. Dos), it -; is best to store in the name of the device and relative button -; assignments in the configuration file, then convert it to ZSNES' -; numerical corresponding key format after reading from it. And then -; convert it back when writing to it back. - -NEWSYM UpdateDevices ; One-time input device init - ret - -NEWSYM JoyRead - pushad - call UpdateVFrame - popad - ret - -SECTION .data - -; Total Number of Input Devices -NEWSYM NumInputDevices, dd 2 - -; Input Device Names -NEWSYM GUIInputNames -db 'NONE ',0 -db 'KEYBOARD/GAMEPAD',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 - -; GUI Description codes for each corresponding key pressed value -NEWSYM ScanCodeListing - db '---','ESC',' 1 ',' 2 ',' 3 ',' 4 ',' 5 ',' 6 ' ; 00h - db ' 7 ',' 8 ',' 9 ',' 0 ',' - ',' = ','BKS','TAB' - db ' Q ',' W ',' E ',' R ',' T ',' Y ',' U ',' I ' ; 10h - db ' O ',' P ',' [ ',' ] ','RET','LCT',' A ',' S ' - db ' D ',' F ',' G ',' H ',' J ',' K ',' L ',' : ' ; 20h - db ' " ',' ~ ','LSH',' \ ',' Z ',' X ',' C ',' V ' - db ' B ',' N ',' M ',' , ',' . ',' / ','RSH',' * ' ; 30h - db 'LAL','SPC','CAP','F1 ','F2 ','F3 ','F4 ','F5 ' - db 'F6 ','F7 ','F8 ','F9 ','F10','NUM','SCR','KP7' ; 40h - db 'KP8','KP9','KP-','KP4','KP5','KP6','KP+','KP1' - db 'KP2','KP3','KP0','KP.',' ',' ','OEM','F11' ; 50h - db 'F12','HOM','UP ','PGU','LFT','5DH','RGT','END' - db 'DWN','PGD','INS','DEL','64H','65H','66H','67H' ; 60h - db '68H','69H','6AH','6BH','6CH','6DH','6EH','6FH' - db '70H','71H','72H','73H','74H','75H','76H','77H' ; 70h - db '78H','79H','7AH','7BH','7CH','7DH','7EH','7FH' - ; Keyboard continued (Direct Input) - db '80H','81H','82H','83H','84H','85H','86H','87H' ; 80h - db '88H','89H','8AH','8BH','8CH','8DH','8EH','8FH' - db '90H','91H','92H','93H','94H','95H','96H','97H' ; 90h - db '98H','99H','9AH','9BH','9CH','9DH','9EH','9FH' - db 'A0H','A1H','A2H','A3H','A4H','A5H','A6H','A7H' ; A0h - db 'A8H','A9H','AAH','ABH','ACH','ADH','AEH','AFH' - db 'B0H','B1H','B2H','B3H','B4H','B5H','B6H','B7H' ; B0h - db 'B8H','B9H','BAH','BBH','BCH','BDH','BEH','BFH' - db 'C0H','C1H','C2H','C3H','C4H','C5H','C6H','C7H' ; C0h - db 'C8H','C9H','CAH','CBH','CCH','CDH','CEH','CFH' - db 'D0H','D1H','D2H','D3H','D4H','D5H','D6H','D7H' ; D0h - db 'D8H','D9H','DAH','DBH','DCH','DDH','DEH','DFH' - db 'E0H','E1H','E2H','E3H','E4H','E5H','E6H','E7H' ; E0h - db 'E8H','E9H','EAH','EBH','ECH','EDH','EEH','EFH' - db 'F0H','F1H','F2H','F3H','F4H','F5H','F6H','F7H' ; F0h - db 'F8H','F9H','FAH','FBH','FCH','FDH','FEH','FFH' - ; Joystick Stuff - db 'J00','J01','J02','J03','J04','J05','J06','J07' ; 100h - db 'J08','J09','J0A','J0B','J0C','J0D','J0E','J0F' - db 'J10','J11','J12','J13','J14','J15','J16','J17' ; 110h - db 'J18','J19','J1A','J1B','J1C','J1D','J1E','J1F' - db 'J20','J21','J22','J23','J24','J25','J26','J27' ; 120h - db 'J28','J29','J2A','J2B','J2C','J2D','J2E','J2F' - db 'J30','J31','J32','J33','J34','J35','J36','J37' ; 130h - db 'J38','J39','J3A','J3B','J3C','J3D','J3E','J3F' - db 'J40','J41','J42','J43','J44','J45','J46','J47' ; 140h - db 'J48','J49','J4A','J4B','J4C','J4D','J4E','J4F' - db 'J50','J51','J52','J53','J54','J55','J56','J57' ; 150h - db 'J58','J59','J5A','J5B','J5C','J5D','J5E','J5F' - db 'J60','J61','J62','J63','J64','J65','J66','J67' ; 160h - db 'J68','J69','J6A','J6B','J6C','J6D','J6E','J6F' - db 'J70','J71','J72','J73','J74','J75','J76','J77' ; 170h - db 'J78','J79','J7A','J7B','J7C','J7D','J7E','J7F' -%ifdef __UNIXSDL__ - ; Extra Joystick Stuff - db 'J80','J81','J82','J83','J84','J85','J86','J87' ; 180h - db 'J88','J89','J8A','J8B','J8C','J8D','J8E','J8F' - db 'J90','J91','J92','J93','J94','J95','J96','J97' ; 190h - db 'J98','J99','J9A','J9B','J9C','J9D','J9E','J9F' - db 'JA0','JA1','JA2','JA3','JA4','JA5','JA6','JA7' ; 2A0h - db 'JA8','JA9','JAA','JAB','JAC','JAD','JAE','JAF' - db 'JB0','JB1','JB2','JB3','JB4','JB5','JB6','JB7' ; 2B0h - db 'JB8','JB9','JBA','JBB','JBC','JBD','JBE','JBF' -%else - ; Extra Stuff (180h) (Parallel Port) - db 'PPB','PPY','PSL','PST','PUP','PDN','PLT','PRT' ; 180h - db 'PPA','PPX','PPL','PPR',' ',' ',' ',' ' - db 'P2B','P2Y','P2S','P2T','P2U','P2D','P2L','P2R' ; 190h - db 'P2A','P2X','P2L','P2R',' ',' ',' ',' ' - db 'PPB','PPY','PSL','PST','PUP','PDN','PLT','PRT' ; 2A0h - db 'PPA','PPX','PPL','PPR',' ',' ',' ',' ' - db 'P2B','P2Y','P2S','P2T','P2U','P2D','P2L','P2R' ; 2B0h - db 'P2A','P2X','P2L','P2R',' ',' ',' ',' ' -%endif - -SECTION .text - -; **************************** -; Mouse Stuff -; **************************** - -NEWSYM Init_Mouse - ; return non-zero if successful - mov eax,01h - ret - -SECTION .data -NEWSYM WMouseX, dd 0 -NEWSYM WMouseY, dd 0 -NEWSYM WMouseMoveX, dd 0 -NEWSYM WMouseMoveY, dd 0 -NEWSYM WMouseButton, dd 0 - -SECTION .text -NEWSYM Get_MouseData ; Returns both pressed and coordinates - ; bx : bit 0 = left button, bit 1 = right button - ; cx = Mouse X Position, dx = Mouse Y Position - pushad - call GetMouseX - mov [WMouseX],eax - call GetMouseY - mov [WMouseY],eax - call GetMouseButton - mov [WMouseButton],eax - popad - mov cx,[WMouseX] - mov dx,[WMouseY] - mov bx,[WMouseButton] - ret - -NEWSYM Set_MouseXMax - ret - -NEWSYM Set_MouseYMax - ret - -NEWSYM Set_MousePosition - ret - -NEWSYM Get_MousePositionDisplacement - ; returns x,y displacement in pixel in cx,dx - pushad - call GetMouseMoveX - mov [WMouseMoveX],eax - call GetMouseMoveY - mov [WMouseMoveY],eax - popad - mov cx,[WMouseMoveX] - mov dx,[WMouseMoveY] - ret - - -NEWSYM MouseWindow - pushad - or byte[MouseButton],2 - mov byte[T36HZEnabled],1 - call GetMouseButton - and byte[MouseButton],0FDh - popad - ret - -NEWSYM GUIInit - pushad - call Start36HZ - popad - ret - -NEWSYM GUIDeInit - pushad - call Stop36HZ - popad - ret - -; **************************** -; Sound Stuff -; **************************** - -NEWSYM StopSound - call Start36HZ - call JoyRead - ret - -NEWSYM StartSound - call Start60HZ - call JoyRead - ret - -NEWSYM delay - ret - -NEWSYM Check60hz - ; Call the timer update function here - pushad - call CheckTimers - call sem_sleep - popad - ret - -SECTION .data -BitPosR db 11 -BitPosG db 5 -BitPosB db 0 -BitSizeR db 5 -BitSizeG db 6 -BitSizeB db 5 -SECTION .text - -InitializeGfxStuff: - ; Process Red Stuff - mov al,[BitPosR] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[BitSizeR],6 - jne .no6bit - mov [vesa2_usbit],bx - inc al -.no6bit - or [vesa2_clbit],bx - mov [vesa2_rpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrr - shl bx,cl - jmp .shlr -.shrr - shr bx,1 -.shlr - mov [vesa2_rfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_rtrcl],bx - xor bx,0FFFFh - mov [vesa2_rtrcla],bx - - ; Process Green Stuff - mov al,[BitPosG] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[BitSizeG],6 - jne .no6bitb - mov [vesa2_usbit],bx - inc al -.no6bitb - or [vesa2_clbit],bx - mov [vesa2_gpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrg - shl bx,cl - jmp .shlg -.shrg - shr bx,1 -.shlg - mov [vesa2_gfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_gtrcl],bx - xor bx,0FFFFh - mov [vesa2_gtrcla],bx - - ; Process Blue Stuff - mov al,[BitPosB] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[BitSizeB],6 - jne .no6bitc - mov [vesa2_usbit],bx - inc al -.no6bitc - or [vesa2_clbit],bx - mov [vesa2_bpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrb - shl bx,cl - jmp .shlb -.shrb - shr bx,1 -.shlb - mov [vesa2_bfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_btrcl],bx - xor bx,0FFFFh - mov [vesa2_btrcla],bx - - xor word[vesa2_clbit],0FFFFh - call genfulladdtab - cmp byte[converta],1 - je .red10 - mov eax,565 - jmp .red11 -.red10 - mov eax,555 -.red11 - push eax - call Init_2xSaIMMXW - pop eax - - ret - -%macro SetDefaultKey2 13 - mov dword[%1upk],%4 ; Up - mov dword[%1downk],%5 ; Down - mov dword[%1leftk],%6 ; Left - mov dword[%1rightk],%7 ; Right - mov dword[%1startk],%3 ; Start - mov dword[%1selk],%2 ; Select - mov dword[%1Ak],%9 ; A - mov dword[%1Bk],%12 ; B - mov dword[%1Xk],%8 ; X - mov dword[%1Yk],%11 ; Y - mov dword[%1Lk],%10 ; L - mov dword[%1Rk],%13 ; R -%endmacro - -%macro SetDefaultKey 12 - cmp bh,0 - jne %%nopl1 - SetDefaultKey2 pl1,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl1 - cmp bh,1 - jne %%nopl2 - SetDefaultKey2 pl2,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl2 - cmp bh,2 - jne %%nopl3 - SetDefaultKey2 pl3,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl3 - cmp bh,3 - jne %%nopl4 - SetDefaultKey2 pl4,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl4 - cmp bh,4 - jne %%nopl5 - SetDefaultKey2 pl5,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl5 -%endmacro - -NEWSYM SetInputDevice - ; bl = device #, bh = player # (0-4) - ; Sets keys according to input device selected - cmp bl,0 - jne near .nozero - SetDefaultKey 0,0,0,0,0,0,0,0,0,0,0,0 - ret -.nozero - cmp bh,1 - je near .input2 -%ifdef __UNIXSDL__ - SetDefaultKey 54,28,90,96,92,94,31,45,32,30,44,46 -%else - SetDefaultKey 54,28,200,208,203,205,31,45,32,30,44,46 -%endif - ret -.input2 -%ifdef __UNIXSDL__ - SetDefaultKey 56,29,36,50,49,51,98,89,91,99,95,97 -%else - SetDefaultKey 56,29,36,50,49,51,210,199,201,211,207,209 -%endif - ret - diff --git a/tools/zsnes/src/linux/sdllink.c b/tools/zsnes/src/linux/sdllink.c deleted file mode 100644 index 05c52b1..0000000 --- a/tools/zsnes/src/linux/sdllink.c +++ /dev/null @@ -1,1351 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 "../gblhdr.h" -#include "sw_draw.h" -#include "gl_draw.h" - -#include -#include - -#include -#include - -#include "audio.h" -#include "safelib.h" -#include "../cfg.h" -#include "../input.h" - -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef unsigned long DWORD; -typedef Uint32 UINT32; -typedef long long _int64; -typedef long long LARGE_INTEGER; -#define QueryPerformanceCounter(x) asm volatile("rdtsc" : "=a"(((unsigned int *)(x))[0]),"=d"(((unsigned int *)x)[1])) - - -typedef enum { FALSE = 0, TRUE = 1 } BOOL; -typedef enum vidstate_e { vid_null, vid_none, vid_soft, vid_gl } vidstate_t; - -/* VIDEO VARIABLES */ -SDL_Surface *surface; -int SurfaceLocking = 0; -int SurfaceX, SurfaceY; -static DWORD WindowWidth = 256; -static DWORD WindowHeight = 224; -static DWORD FullScreen = 0; -static vidstate_t sdl_state = vid_null; -static int UseOpenGL = 0; -static const int BitDepth = 16; -DWORD FirstVid = 1; - -void SwitchFullScreen (void); -DWORD SMode=0; -DWORD DSMode=0; -DWORD prevHQMode=-1; - -extern DWORD converta; -extern DWORD *BitConv32Ptr; -extern DWORD *RGBtoYUVPtr; - -extern BYTE GUIWFVID[]; -extern BYTE GUISMODE[]; -extern BYTE GUIDSMODE[]; -extern BYTE GUIHQ2X[]; -extern BYTE GUIHQ3X[]; -extern BYTE GUIHQ4X[]; -extern BYTE GUIRESIZE[]; -extern BYTE GUIM7VID[]; - -/* JOYSTICK AND KEYBOARD INPUT */ -SDL_Joystick *JoystickInput[5]; -unsigned int AxisOffset[5] = {256 + 128 + 64}; // per joystick offsets in -unsigned int ButtonOffset[5] = {448}; // pressed. We have 128 + 64 -unsigned int HatOffset[5] = {448}; // bytes for all joysticks. We -unsigned int BallOffset[5] = {448}; // can control all 5 players. -int shiftptr = 0; -int offset; -DWORD numlockptr; - -extern unsigned char pressed[]; -extern int CurKeyPos; -extern int CurKeyReadPos; -extern int KeyBuffer[16]; - -/* MOUSE INPUT */ -static float MouseMinX = 0; -static float MouseMaxX = 256; -static float MouseMinY = 0; -static float MouseMaxY = 223; -static int MouseX, MouseY; -static int MouseMove2X, MouseMove2Y; -unsigned char MouseButton; -static float MouseXScale = 1.0; -static float MouseYScale = 1.0; -DWORD LastUsedPos = 0; -DWORD CurMode = -1; - -extern BYTE GUIOn; -extern BYTE GUIOn2; -extern BYTE EMUPause; -static BYTE IsActivated = 1; - -/* TIMER VARIABLES/MACROS */ -// millisecond per world update -#define UPDATE_TICKS_GAME (1000.0/59.948743718592964824120603015060) -#define UPDATE_TICKS_GAMEPAL (20.0) -#define UPDATE_TICKS_GUI (1000.0/36.0) -#define UPDATE_TICKS_UDP (1000.0/60.0) - -int T60HZEnabled = 0; -int T36HZEnabled = 0; -float end, end2; -float start, start2; -float update_ticks_pc, update_ticks_pc2; - -// Used for semaphore code -static SDL_sem *sem_frames = NULL; -static struct timeval sem_start; -void sem_sleep_rdy(void); -void sem_sleep_die(void); -float sem_GetTicks(void); - -extern unsigned char romispal; - -/* FUNCTION DECLARATIONS */ -void clearwin (void); -void drawscreenwin(void); -void initwinvideo(); -unsigned int sdl_keysym_to_pc_scancode(int); -void ProcessKeyBuf(int); -void UpdateSound(void *userdata, Uint8 * stream, int len); - -void GUI36hzcall(void); -void Game60hzcall(void); -_int64 copymaskRB = 0x001FF800001FF800LL; -_int64 copymaskG = 0x0000FC000000FC00LL; -_int64 copymagic = 0x0008010000080100LL; -#ifdef __OPENGL__ -void gl_clearwin(void); -#endif - -static void adjustMouseXScale(void) -{ - MouseXScale = (MouseMaxX - MouseMinX) / ((float) WindowWidth); -} - -static void adjustMouseYScale(void) -{ - MouseYScale = (MouseMaxY - MouseMinY) / ((float) WindowHeight); -} - -void SetHQx(unsigned int ResX, unsigned int ResY) -{ - int maxHQ; - if(ResX/256 < ResY/224) - maxHQ = ResX/256; - else - maxHQ = ResY/224; - - if(maxHQ >= 2) - { - GUIHQ2X[cvidmode] = 1; - GUIHQ3X[cvidmode] = 0; - GUIHQ4X[cvidmode] = 0; - } - - else - { - GUIHQ2X[cvidmode] = 0; - GUIHQ3X[cvidmode] = 0; - GUIHQ4X[cvidmode] = 0; - } -} - -void SetHiresOpt(unsigned int ResX, unsigned int ResY) -{ - if(ResX >= 512 && ResY >= 448) - GUIM7VID[cvidmode] = 1; - else - GUIM7VID[cvidmode] = 0; -} - -void Clear2xSaIBuffer(); - -int Main_Proc(void) -{ - SDL_Event event; - unsigned int key; - - while (SDL_PollEvent(&event)) - { - switch (event.type) - { - case SDL_ACTIVEEVENT: - IsActivated = event.active.gain; - break; - case SDL_KEYDOWN: - if ((event.key.keysym.sym == SDLK_RETURN) && - (event.key.keysym.mod & KMOD_ALT)) { - SwitchFullScreen(); - break; - } - if (event.key.keysym.sym == SDLK_LSHIFT || - event.key.keysym.sym == SDLK_RSHIFT) - shiftptr = 1; - if (event.key.keysym.mod & KMOD_NUM) - numlockptr = 1; - else - numlockptr = 0; - - key = sdl_keysym_to_pc_scancode(event.key.keysym.sym); - if (key < 448) - { - pressed[key] = 1; - ProcessKeyBuf(event.key.keysym.sym); - } - break; - - case SDL_KEYUP: - if (event.key.keysym.sym == SDLK_LSHIFT || - event.key.keysym.sym == SDLK_RSHIFT) - shiftptr = 0; - key = sdl_keysym_to_pc_scancode(event.key.keysym.sym); - if (key < 448) - { - pressed[key] = 0; - } - break; - - case SDL_MOUSEMOTION: - if (FullScreen) - { - MouseX += event.motion.xrel; - MouseY += event.motion.yrel; - } - else - { - MouseX = ((int) ((float) event.motion.x) * MouseXScale); - MouseY = ((int) ((float) event.motion.y) * MouseYScale); - } - - if (MouseX < MouseMinX) MouseX = MouseMinX; - if (MouseX > MouseMaxX) MouseX = MouseMaxX; - if (MouseY < MouseMinY) MouseY = MouseMinY; - if (MouseY > MouseMaxY) MouseY = MouseMaxY; - break; - - case SDL_MOUSEBUTTONDOWN: - /* - button 2 = enter (i.e. select) - button 4 = mouse wheel up (treat as "up" key) - button 5 = mouse wheel down (treat as "down" key) - */ - switch (event.button.button) - { - case 4: - ProcessKeyBuf(SDLK_UP); - break; - case 5: - ProcessKeyBuf(SDLK_DOWN); - break; - case 3: - MouseButton |= 2; - break; - case 2: - ProcessKeyBuf(SDLK_RETURN); - // Yes, this is intentional - DDOI - case 1: - MouseButton |= event.button.button; - break; - } - break; - - case SDL_MOUSEBUTTONUP: - switch (event.button.button) - { - case 1: case 2: - MouseButton &= ~event.button.button; - break; - - case 3: - MouseButton &= ~2; - break; - } - break; - - case SDL_JOYHATMOTION: // POV hats act as direction pad - offset = HatOffset[event.jhat.which]; - if (offset >= (256 + 128 + 64)) break; - switch (event.jhat.value) - { - case SDL_HAT_CENTERED: - pressed[offset] = 0; - pressed[offset + 1] = 0; - pressed[offset + 2] = 0; - pressed[offset + 3] = 0; - break; - case SDL_HAT_UP: - pressed[offset + 3] = 1; - pressed[offset + 2] = 0; - break; - case SDL_HAT_RIGHTUP: - pressed[offset] = 1; - pressed[offset + 3] = 1; - pressed[offset + 1] = 0; - pressed[offset + 2] = 0; - break; - case SDL_HAT_RIGHT: - pressed[offset] = 1; - pressed[offset + 1] = 0; - break; - case SDL_HAT_RIGHTDOWN: - pressed[offset] = 1; - pressed[offset + 2] = 1; - pressed[offset + 1] = 0; - pressed[offset + 3] = 0; - break; - case SDL_HAT_DOWN: - pressed[offset + 2] = 1; - pressed[offset + 3] = 0; - break; - case SDL_HAT_LEFTDOWN: - pressed[offset + 1] = 1; - pressed[offset + 2] = 1; - pressed[offset] = 0; - pressed[offset + 3] = 0; - break; - case SDL_HAT_LEFT: - pressed[offset + 1] = 1; - pressed[offset] = 0; - break; - case SDL_HAT_LEFTUP: - pressed[offset + 1] = 1; - pressed[offset + 3] = 1; - pressed[offset] = 0; - pressed[offset + 2] = 0; - break; - } - break; - - /* - joystick trackball code untested; change the test - values if the motion is too sensitive (or not - sensitive enough) - */ - case SDL_JOYBALLMOTION: - offset = BallOffset[event.jball.which]; - offset += event.jball.ball; - if (offset >= (256 + 128 + 64)) break; - if (event.jball.xrel < -100) - { - pressed[offset] = 0; - pressed[offset + 1] = 1; - } - if (event.jball.xrel > 100) - { - pressed[offset] = 1; - pressed[offset + 1] = 0; - } - if (event.jball.yrel < -100) - { - pressed[offset + 2] = 0; - pressed[offset + 3] = 1; - } - if (event.jball.yrel > 100) - { - pressed[offset + 2] = 1; - pressed[offset + 3] = 0; - } - break; - - case SDL_JOYAXISMOTION: - offset = AxisOffset[event.jaxis.which]; - offset += event.jaxis.axis * 2; - if (offset >= (256 + 128 + 64)) break; - //printf("DEBUG axis offset: %d\n", offset); - if (event.jaxis.value < -(joy_sensitivity)) - { - pressed[offset + 1] = 1; - pressed[offset + 0] = 0; - } - else if (event.jaxis.value > joy_sensitivity) - { - pressed[offset + 0] = 1; - pressed[offset + 1] = 0; - } - else - { - pressed[offset + 0] = 0; - pressed[offset + 1] = 0; - } - break; - - case SDL_JOYBUTTONDOWN: - offset = ButtonOffset[event.jbutton.which]; - offset += event.jbutton.button; - //printf("DEBUG button offset: %d\n", offset); - if (offset >= (256 + 128 + 64)) break; - pressed[offset] = 1; - break; - - case SDL_JOYBUTTONUP: - offset = ButtonOffset[event.jbutton.which]; - offset += event.jbutton.button; - //printf("DEBUG button offset: %d\n", offset); - if (offset >= (256 + 128 + 64)) break; - pressed[offset] = 0; - break; - case SDL_QUIT: - exit(0); - break; -#ifdef __OPENGL__ - case SDL_VIDEORESIZE: - if(!GUIRESIZE[cvidmode]) - { - surface = SDL_SetVideoMode(WindowWidth, WindowHeight, BitDepth, surface->flags & ~SDL_RESIZABLE); - adjustMouseXScale(); - adjustMouseYScale(); - break; - } - WindowWidth = SurfaceX = event.resize.w; - WindowHeight = SurfaceY = event.resize.h; - SetHQx(SurfaceX,SurfaceY); - SetHiresOpt(SurfaceX,SurfaceY); - surface = SDL_SetVideoMode(WindowWidth, WindowHeight, BitDepth, surface->flags); - adjustMouseXScale(); - adjustMouseYScale(); - glViewport(0,0, WindowWidth, WindowHeight); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - if (cvidmode == 20) - { - if (224*WindowWidth > 256*WindowHeight && WindowHeight) - { - glOrtho (- ((float) 224*WindowWidth)/((float) 256*WindowHeight), - ((float) 224*WindowWidth)/((float) 256*WindowHeight), -1, 1, -1, 1); - } - else if (224*WindowWidth < 256*WindowHeight && WindowWidth) - { - glOrtho (-1, 1,- ((float) 256*WindowHeight)/((float) 224*WindowWidth), - ((float) 256*WindowHeight)/((float) 224*WindowWidth), -1, 1); - } - else - { - glOrtho (-1, 1, -1, 1, -1, 1); - } - } - - if (Keep4_3Ratio && (cvidmode == 21)) - { - if (3*WindowWidth > 4*WindowHeight && WindowHeight) - { - glOrtho (- ((float) 3*WindowWidth)/((float) 4*WindowHeight), - ((float) 3*WindowWidth)/((float) 4*WindowHeight), -1, 1, -1, 1); - } - else if (3*WindowWidth < 4*WindowHeight && WindowWidth) - { - glOrtho (-1, 1,- ((float) 4*WindowHeight)/((float) 3*WindowWidth), - ((float) 4*WindowHeight)/((float) 3*WindowWidth), -1, 1); - } - else - { - glOrtho (-1, 1, -1, 1, -1, 1); - } - } - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glDisable(GL_DEPTH_TEST); - glFlush(); - gl_clearwin(); - Clear2xSaIBuffer(); - break; -#endif - default: - break; - } - } - - return TRUE; -} - -unsigned int sdl_keysym_to_pc_scancode(int sym) -{ - switch (sym) - { - case SDLK_ESCAPE: return 0x01; - case SDLK_1: return 0x02; - case SDLK_2: return 0x03; - case SDLK_3: return 0x04; - case SDLK_4: return 0x05; - case SDLK_5: return 0x06; - case SDLK_6: return 0x07; - case SDLK_7: return 0x08; - case SDLK_8: return 0x09; - case SDLK_9: return 0x0a; - case SDLK_0: return 0x0b; - case SDLK_MINUS: return 0x0c; - case SDLK_EQUALS: return 0x0d; - case SDLK_BACKSPACE: return 0x0e; - case SDLK_TAB: return 0x0f; - case SDLK_q: return 0x10; - case SDLK_w: return 0x11; - case SDLK_e: return 0x12; - case SDLK_r: return 0x13; - case SDLK_t: return 0x14; - case SDLK_y: return 0x15; - case SDLK_u: return 0x16; - case SDLK_i: return 0x17; - case SDLK_o: return 0x18; - case SDLK_p: return 0x19; - case SDLK_LEFTBRACKET: return 0x1a; - case SDLK_RIGHTBRACKET: return 0x1b; - case SDLK_RETURN: return 0x1c; - case SDLK_LCTRL: return 0x1d; - case SDLK_a: return 0x1e; - case SDLK_s: return 0x1f; - case SDLK_d: return 0x20; - case SDLK_f: return 0x21; - case SDLK_g: return 0x22; - case SDLK_h: return 0x23; - case SDLK_j: return 0x24; - case SDLK_k: return 0x25; - case SDLK_l: return 0x26; - case SDLK_SEMICOLON: return 0x27; - case SDLK_QUOTE: return 0x28; - case SDLK_BACKQUOTE: - case SDLK_HASH: return 0x29; - case SDLK_LSHIFT: return 0x2a; - case SDLK_BACKSLASH: return 0x2b; - case SDLK_z: return 0x2c; - case SDLK_x: return 0x2d; - case SDLK_c: return 0x2e; - case SDLK_v: return 0x2f; - case SDLK_b: return 0x30; - case SDLK_n: return 0x31; - case SDLK_m: return 0x32; - case SDLK_COMMA: return 0x33; - case SDLK_PERIOD: return 0x34; - case SDLK_SLASH: return 0x35; - case SDLK_RSHIFT: return 0x36; - case SDLK_KP_MULTIPLY: return 0x37; - case SDLK_LALT: return 0x38; - case SDLK_SPACE: return 0x39; - case SDLK_CAPSLOCK: return 0x3a; - case SDLK_F1: return 0x3b; - case SDLK_F2: return 0x3c; - case SDLK_F3: return 0x3d; - case SDLK_F4: return 0x3e; - case SDLK_F5: return 0x3f; - case SDLK_F6: return 0x40; - case SDLK_F7: return 0x41; - case SDLK_F8: return 0x42; - case SDLK_F9: return 0x43; - case SDLK_F10: return 0x44; - case SDLK_NUMLOCK: return 0x45; - case SDLK_SCROLLOCK: return 0x46; - case SDLK_KP7: return 0x47; - case SDLK_KP8: return 0x48; - case SDLK_KP9: return 0x49; - case SDLK_KP_MINUS: return 0x4a; - case SDLK_KP4: return 0x4b; - case SDLK_KP5: return 0x4c; - case SDLK_KP6: return 0x4d; - case SDLK_KP_PLUS: return 0x4e; - case SDLK_KP1: return 0x4f; - case SDLK_KP2: return 0x50; - case SDLK_KP3: return 0x51; - case SDLK_KP0: return 0x52; - case SDLK_KP_PERIOD: return 0x53; - case SDLK_F11: return 0x57; - case SDLK_F12: return 0x58; - case SDLK_HOME: return 0x59; - case SDLK_UP: return 0x5a; - case SDLK_PAGEUP: return 0x5b; - case SDLK_LEFT: return 0x5c; - case SDLK_RIGHT: return 0x5e; - case SDLK_END: return 0x5f; - case SDLK_DOWN: return 0x60; - case SDLK_PAGEDOWN: return 0x61; - case SDLK_INSERT: return 0x62; - case SDLK_DELETE: return 0x63; - - } - return(0x64+sym); -} - -void ProcessKeyBuf(int scancode) -{ - int accept = 0; - int vkeyval = 0; - - if (((scancode >= 'A') && (scancode <= 'Z')) || - ((scancode >= 'a') && (scancode <= 'z')) || - (scancode == SDLK_ESCAPE) || (scancode == SDLK_SPACE) || - (scancode == SDLK_BACKSPACE) || (scancode == SDLK_RETURN) || - (scancode == SDLK_TAB)) - { - accept = 1; - vkeyval = scancode; - } - if ((scancode >= '0') && (scancode <= '9')) - { - accept = 1; - vkeyval = scancode; - if (shiftptr) - { - switch (scancode) - { - case '1': vkeyval = '!'; break; - case '2': vkeyval = '@'; break; - case '3': vkeyval = '#'; break; - case '4': vkeyval = '$'; break; - case '5': vkeyval = '%'; break; - case '6': vkeyval = '^'; break; - case '7': vkeyval = '&'; break; - case '8': vkeyval = '*'; break; - case '9': vkeyval = '('; break; - case '0': vkeyval = ')'; break; - } - } - } - if ((scancode >= SDLK_KP0) && (scancode <= SDLK_KP9)) - { - if (numlockptr) - { - accept = 1; - vkeyval = scancode - SDLK_KP0 + '0'; - } - else - { - - switch (scancode) - { - case SDLK_KP9: vkeyval = 256 + 73; accept = 1; break; - case SDLK_KP8: vkeyval = 256 + 72; accept = 1; break; - case SDLK_KP7: vkeyval = 256 + 71; accept = 1; break; - case SDLK_KP6: vkeyval = 256 + 77; accept = 1; break; - case SDLK_KP5: vkeyval = 256 + 76; accept = 1; break; - case SDLK_KP4: vkeyval = 256 + 75; accept = 1; break; - case SDLK_KP3: vkeyval = 256 + 81; accept = 1; break; - case SDLK_KP2: vkeyval = 256 + 80; accept = 1; break; - case SDLK_KP1: vkeyval = 256 + 79; accept = 1; break; - } - } // end no-numlock - } // end testing of keypad - if (!shiftptr) - { - switch (scancode) - { - case SDLK_MINUS: vkeyval = '-'; accept = 1; break; - case SDLK_EQUALS: vkeyval = '='; accept = 1; break; - case SDLK_LEFTBRACKET: vkeyval = '['; accept = 1; break; - case SDLK_RIGHTBRACKET: vkeyval = ']'; accept = 1; break; - case SDLK_SEMICOLON: vkeyval = ';'; accept = 1; break; - case SDLK_COMMA: vkeyval = ','; accept = 1; break; - case SDLK_PERIOD: vkeyval = '.'; accept = 1; break; - case SDLK_SLASH: vkeyval = '/'; accept = 1; break; - case SDLK_QUOTE: vkeyval = '`'; accept = 1; break; - } - } - else - { - switch (scancode) - { - case SDLK_MINUS: vkeyval = '_'; accept = 1; break; - case SDLK_EQUALS: vkeyval = '+'; accept = 1; break; - case SDLK_LEFTBRACKET: vkeyval = '{'; accept = 1; break; - case SDLK_RIGHTBRACKET: vkeyval = '}'; accept = 1; break; - case SDLK_SEMICOLON: vkeyval = ':'; accept = 1; break; - case SDLK_QUOTE: vkeyval = '"'; accept = 1; break; - case SDLK_COMMA: vkeyval = '<'; accept = 1; break; - case SDLK_PERIOD: vkeyval = '>'; accept = 1; break; - case SDLK_SLASH: vkeyval = '?'; accept = 1; break; - case SDLK_BACKQUOTE: vkeyval = '~'; accept = 1; break; - case SDLK_BACKSLASH: vkeyval = '|'; accept = 1; break; - } - } - switch (scancode) - { - case SDLK_PAGEUP: vkeyval = 256 + 73; accept = 1; break; - case SDLK_UP: vkeyval = 256 + 72; accept = 1; break; - case SDLK_HOME: vkeyval = 256 + 71; accept = 1; break; - case SDLK_RIGHT: vkeyval = 256 + 77; accept = 1; break; - case SDLK_LEFT: vkeyval = 256 + 75; accept = 1; break; - case SDLK_PAGEDOWN: vkeyval = 256 + 81; accept = 1; break; - case SDLK_DOWN: vkeyval = 256 + 80; accept = 1; break; - case SDLK_END: vkeyval = 256 + 79; accept = 1; break; - case SDLK_KP_PLUS: vkeyval = '+'; accept = 1; break; - case SDLK_KP_MINUS: vkeyval = '-'; accept = 1; break; - case SDLK_KP_MULTIPLY: vkeyval = '*'; accept = 1; break; - case SDLK_KP_DIVIDE: vkeyval = '/'; accept = 1; break; - case SDLK_KP_PERIOD: vkeyval = '.'; accept = 1; break; - } - - if (accept) - { - KeyBuffer[CurKeyPos] = vkeyval; - CurKeyPos++; - if (CurKeyPos == 16) - CurKeyPos = 0; - } -} - -BOOL InitJoystickInput(void) -{ - int i, max_num_joysticks; - int num_axes, num_buttons, num_hats, num_balls; - int next_offset = 256; - - for (i = 0; i < 5; i++) - JoystickInput[i] = NULL; - - // If it is possible to use SDL_NumJoysticks - // before initialising SDL_INIT_JOYSTICK then - // this call can be replaced with SDL_InitSubSystem - SDL_InitSubSystem (SDL_INIT_JOYSTICK); - max_num_joysticks = SDL_NumJoysticks(); - if (!max_num_joysticks) - { - printf("ZSNES could not find any joysticks.\n"); - SDL_QuitSubSystem(SDL_INIT_JOYSTICK); - return FALSE; - } - SDL_JoystickEventState(SDL_ENABLE); - - if (max_num_joysticks > 5) max_num_joysticks = 5; - - for (i = 0; i < max_num_joysticks; i++) - { - JoystickInput[i] = SDL_JoystickOpen(i); - num_axes = SDL_JoystickNumAxes(JoystickInput[i]); - num_buttons = SDL_JoystickNumButtons(JoystickInput[i]); - num_hats = SDL_JoystickNumHats(JoystickInput[i]); - num_balls = SDL_JoystickNumBalls(JoystickInput[i]); - printf("Device %i %s\n", i, SDL_JoystickName(i)); - printf(" %i axis, %i buttons, %i hats, %i balls\n", - num_axes, num_buttons, num_hats, num_balls); - - if (next_offset >= 448) - { - printf("Warning: Joystick won't work.\n"); - continue; - } - - AxisOffset[i] = next_offset; - ButtonOffset[i] = AxisOffset[i] + num_axes * 2; - HatOffset[i] = ButtonOffset[i] + num_buttons; - BallOffset[i] = HatOffset[i] + num_hats * 4; - next_offset = BallOffset[i] + num_balls * 4; - - if (next_offset > (256 + 128 + 64)) - { - printf("Warning: Too many buttons, axes, hats and/or Balls!\n"); - printf("Warning: Joystick won't work fully.\n"); - } - } - - return TRUE; -} - -BOOL InitInput() -{ - InitJoystickInput(); - return TRUE; -} - -int startgame() -{ - static bool ranonce = false; - int status; - - if (!ranonce) - { - ranonce = true; - - // Start semaphore code so ZSNES multitasks nicely :) - sem_sleep_rdy(); - } - - if (sdl_state != vid_null) - { - if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_VIDEO) < 0) - { - fprintf(stderr, "Could not initialize SDL: %s", SDL_GetError()); - return FALSE; - } - sdl_state = vid_none; - } - - if (sdl_state == vid_soft) { sw_end(); } -#ifdef __OPENGL__ - else if (sdl_state == vid_gl) { gl_end(); } - - SDL_Init(SDL_INIT_VIDEO); - - if (UseOpenGL) - { - status = gl_start(WindowWidth, WindowHeight, BitDepth, FullScreen); - } - else -#endif - { - status = sw_start(WindowWidth, WindowHeight, BitDepth, FullScreen); - } - - if (!status) return FALSE; - sdl_state = (UseOpenGL ? vid_gl : vid_soft); - - return TRUE; -} - -void Start60HZ(void) -{ - update_ticks_pc2 = UPDATE_TICKS_UDP; - if (romispal == 1) - { - update_ticks_pc = UPDATE_TICKS_GAMEPAL; - } - else - { - update_ticks_pc = UPDATE_TICKS_GAME; - } - - // Restore timer data from semaphore data - start = sem_GetTicks(); - start2 = sem_GetTicks(); - T36HZEnabled = 0; - T60HZEnabled = 1; -} - -void Stop60HZ(void) -{ - T60HZEnabled = 0; -} - -void Start36HZ(void) -{ - update_ticks_pc2 = UPDATE_TICKS_UDP; - update_ticks_pc = UPDATE_TICKS_GUI; - - // Restore timer data from semaphore data - start = sem_GetTicks(); - start2 = sem_GetTicks(); - T60HZEnabled = 0; - T36HZEnabled = 1; -} - -void Stop36HZ(void) -{ - T36HZEnabled = 0; -} - -void init_hqNx(void) -{ - DWORD color32; - DWORD *p; - int i, j, k, r, g, b, Y, u, v; - - for(i = 0, p = BitConv32Ptr; i < 65536; i++, p++) { - color32=((i&0xF800)<<8)+ - ((i&0x07E0)<<5)+ - ((i&0x001F)<<3)+0xFF000000; - - *p = color32; - } - - for (i=0; i<32; i++) - for (j=0; j<64; j++) - for (k=0; k<32; k++) { - r = i << 3; - g = j << 2; - b = k << 3; - Y = (r + g + b) >> 2; - u = 128 + ((r - b) >> 2); - v = 128 + ((-r + 2*g -b)>>3); - RGBtoYUVPtr[(i << 11) + (j << 5) + k] = (Y<<16) + (u<<8) + v; - } -} - -unsigned char prevNTSCMode = 0; -unsigned char changeRes = 1; -unsigned char prevKeep4_3Ratio = 0; - -bool OGLModeCheck() -{ - return(cvidmode > 4); -} - -void initwinvideo(void) -{ - DWORD newmode = 0; - - init_hqNx(); - - if ((CurMode != cvidmode) || (prevNTSCMode != NTSCFilter) || - (changeRes) || (prevKeep4_3Ratio != Keep4_3Ratio)) - { - CurMode = cvidmode; - newmode = 1; - WindowWidth = 256; - WindowHeight = 224; - prevNTSCMode = NTSCFilter; - changeRes = 0; - prevKeep4_3Ratio = Keep4_3Ratio; - - FullScreen = GUIWFVID[cvidmode]; -#ifdef __OPENGL__ - UseOpenGL = 0; - if (OGLModeCheck()) - UseOpenGL = 1; - - if ((cvidmode == 20) || (cvidmode == 21) || (cvidmode == 22)) - { - SetHQx(CustomResX,CustomResY); - SetHiresOpt(CustomResX,CustomResY); - } -#else - if (OGLModeCheck()) - cvidmode = 2; // set it to the default 512x448 W -#endif - - switch (cvidmode) - { - default: - case 0: - case 1: - WindowWidth = 256; - WindowHeight = 224; - break; - case 2: - case 3: - case 6: - if (NTSCFilter) - { - WindowWidth = 602; - WindowHeight = 446; - } - else - { - WindowWidth = 512; - WindowHeight = 448; - } - break; - case 4: - case 7: - case 8: - WindowWidth = 640; - WindowHeight = 480; - break; - case 9: - WindowWidth = 640; - WindowHeight = 560; - break; - case 10: - WindowWidth = 768; - WindowHeight = 672; - break; - case 11: - case 12: - WindowWidth = 800; - WindowHeight = 600; - break; - case 13: - WindowWidth = 896; - WindowHeight = 784; - break; - case 14: - case 15: - WindowWidth = 1024; - WindowHeight = 768; - break; - case 16: - WindowWidth = 1024; - WindowHeight = 896; - break; - case 17: - WindowWidth = 1280; - WindowHeight = 960; - break; - case 18: - WindowWidth = 1280; - WindowHeight = 1024; - break; - case 19: - WindowWidth = 1600; - WindowHeight = 1200; - break; - case 20: // Variable ODR - case 21: // Variable ODS - case 22: // Custom Res - WindowWidth = CustomResX; - WindowHeight = CustomResY; - break; - } - adjustMouseXScale(); - adjustMouseYScale(); - } - - if (startgame() != TRUE) - { - /* Exit zsnes if SDL could not be initialized */ - if (sdl_state == vid_null) - exit(0); - else - return; - } - - if (newmode == 1) - { - #ifdef __OPENGL__ - if(OGLModeCheck()) - { - surface = SDL_SetVideoMode(WindowWidth, WindowHeight, BitDepth, surface->flags); - adjustMouseXScale(); - adjustMouseYScale(); - glViewport(0,0, WindowWidth, WindowHeight); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - if (cvidmode == 20) - { - if (224*WindowWidth > 256*WindowHeight && WindowHeight) - { - glOrtho (- ((float) 224*WindowWidth)/((float) 256*WindowHeight), - ((float) 224*WindowWidth)/((float) 256*WindowHeight), -1, 1, -1, 1); - } - else if (224*WindowWidth < 256*WindowHeight && WindowWidth) - { - glOrtho (-1, 1,- ((float) 256*WindowHeight)/((float) 224*WindowWidth), - ((float) 256*WindowHeight)/((float) 224*WindowWidth), -1, 1); - } - else - { - glOrtho (-1, 1, -1, 1, -1, 1); - } - } - - if (Keep4_3Ratio && ((cvidmode == 21)||(cvidmode == 22))) - { - if (3*WindowWidth > 4*WindowHeight && WindowHeight) - { - glOrtho (- ((float) 3*WindowWidth)/((float) 4*WindowHeight), - ((float) 3*WindowWidth)/((float) 4*WindowHeight), -1, 1, -1, 1); - } - else if (3*WindowWidth < 4*WindowHeight && WindowWidth) - { - glOrtho (-1, 1,- ((float) 4*WindowHeight)/((float) 3*WindowWidth), - ((float) 4*WindowHeight)/((float) 3*WindowWidth), -1, 1); - } - else - { - glOrtho (-1, 1, -1, 1, -1, 1); - } - } - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glDisable(GL_DEPTH_TEST); - glFlush(); - } - #endif - clearwin(); - } - - if (FirstVid == 1) - { - FirstVid = 0; - - InitSound(); - InitInput(); - } - - if (((PrevStereoSound != StereoSound) || (PrevSoundQuality != SoundQuality))) - { - InitSound(); - } -} - -void CheckTimers(void) -{ - //QueryPerformanceCounter((LARGE_INTEGER*)&end2); - end2 = sem_GetTicks(); - - while ((end2 - start2) >= update_ticks_pc2) - { - start2 += update_ticks_pc2; - } - - if (T60HZEnabled) - { - //QueryPerformanceCounter((LARGE_INTEGER*)&end); - end = sem_GetTicks(); - - while ((end - start) >= update_ticks_pc) - { - Game60hzcall(); - SDL_SemPost(sem_frames); - start += update_ticks_pc; - } - } - - if (T36HZEnabled) - { - //QueryPerformanceCounter((LARGE_INTEGER*)&end); - end = sem_GetTicks(); - - while ((end - start) >= update_ticks_pc) - { - GUI36hzcall(); - start += update_ticks_pc; - } - } -} - -void sem_sleep(void) -{ - end = update_ticks_pc - (sem_GetTicks() - start) - .2f; - if (end>0.f) SDL_SemWaitTimeout(sem_frames, (int)end); -} - -static SDL_Thread *sem_threadid = NULL; -static int sem_threadrun; - -int sem_thread(void *param) -{ - while (sem_threadrun) - { - if (T60HZEnabled) - { - SDL_SemPost(sem_frames); - usleep(romispal ? 2000 : 1000); - } - else - usleep(20000); - } - return(0); -} - -void sem_sleep_rdy(void) -{ - if (sem_frames) return; - sem_frames = SDL_CreateSemaphore(0); - sem_threadrun = 1; - sem_threadid = SDL_CreateThread(sem_thread, 0); -} - -void sem_sleep_die(void) -{ - if (sem_threadid) - { - sem_threadrun = 0; - SDL_WaitThread(sem_threadid, NULL); - sem_threadid = NULL; - } - if (sem_frames) - { - SDL_DestroySemaphore(sem_frames); - sem_frames = NULL; - } -} - -void UpdateVFrame(void) -{ - //Quick fix for GUI CPU usage - if (GUIOn || GUIOn2 || EMUPause) { usleep(6000); } - - CheckTimers(); - Main_Proc(); - - if (sound_sdl) - { - SoundWrite_sdl(); - } -} - -void clearwin() -{ - /* If we're vid_null and we get here, there's a problem */ - /* elsewhere - DDOI */ - if (sdl_state == vid_none) return; - -#ifdef __OPENGL__ - if (UseOpenGL) - gl_clearwin(); - else -#endif - sw_clearwin(); -} - -void drawscreenwin(void) -{ -#ifdef __LIBAO__ - extern bool RawDumpInProgress; - if (!sound_sdl && !GUIOn2 && !GUIOn && !EMUPause && !RawDumpInProgress) - { - SoundWrite_ao(); - } -#endif - - /* Just in case - DDOI */ - if (sdl_state == vid_none) return; - -#ifdef __OPENGL__ - if (UseOpenGL) - gl_drawwin(); - else -#endif - sw_drawwin(); -} - -void UnloadSDL() -{ - DeinitSound(); - sem_sleep_die(); // Shutdown semaphore - if (sdl_state == vid_soft) { sw_end(); } -#ifdef __OPENGL__ - else if (sdl_state == vid_gl) { gl_end(); } -#endif - if (sdl_state != vid_null) - { - SDL_WM_GrabInput(SDL_GRAB_OFF); // probably redundant - SDL_FreeSurface(surface); - } - SDL_QuitSubSystem(SDL_INIT_JOYSTICK); - SDL_QuitSubSystem(SDL_INIT_VIDEO); - SDL_Quit(); -} - -int GetMouseX(void) -{ - return ((int) MouseX); -} -int GetMouseY(void) -{ - return ((int) MouseY); -} - -int GetMouseMoveX(void) -{ - // InputRead(); - //SDL_GetRelativeMouseState(&MouseMove2X, NULL); - SDL_GetRelativeMouseState(&MouseMove2X, &MouseMove2Y); - return (MouseMove2X); -} - -int GetMouseMoveY(void) -{ - return (MouseMove2Y); -} -int GetMouseButton(void) -{ - return ((int) MouseButton); -} - -void SetMouseMinX(int MinX) -{ - MouseMinX = MinX; - adjustMouseXScale(); -} -void SetMouseMaxX(int MaxX) -{ - MouseMaxX = MaxX; - adjustMouseXScale(); -} -void SetMouseMinY(int MinY) -{ - MouseMinY = MinY; - adjustMouseYScale(); -} -void SetMouseMaxY(int MaxY) -{ - MouseMaxY = MaxY; - adjustMouseYScale(); -} -void SetMouseX(int X) -{ - MouseX = X; -} -void SetMouseY(int Y) -{ - MouseY = Y; -} - -/* evul, maybe should use something other than constructor method */ -void __attribute__ ((stdcall, constructor)) sem_StartTicks() -{ - gettimeofday(&sem_start, NULL); -} - -float sem_GetTicks() -{ - struct timeval now; - float ticks; - - gettimeofday(&now, NULL); - ticks=((float)(now.tv_sec-sem_start.tv_sec))*1000.f+((float)(now.tv_usec-sem_start.tv_usec))*.001f; - return(ticks); -} - - - -void LaunchBrowser(char *browser, char *url) -{ - char *const arglist[] = { browser, url, 0 }; - execvp(browser, arglist); -} - -void LaunchURL(char *url) -{ - if (safe_fork(0, 0)) //If fork failed, or we are the parent - { - MouseX = 0; - MouseY = 0; - return; - } - - //We are now the child proccess - - //If any of these LaunchBrowser() calls return that means it failed and we should try the next one - LaunchBrowser("mozilla", url); - LaunchBrowser("mozilla-firefox", url); - LaunchBrowser("firefox", url); - LaunchBrowser("konqueror", url); - LaunchBrowser("opera", url); - LaunchBrowser("lynx", url); - LaunchBrowser("links", url); - - _exit(0); //All browser launches failed, oh well -} - -void ZsnesPage() -{ - LaunchURL("http://www.zsnes.com/"); -} - -void DocsPage() -{ - LaunchURL("http://zsnes-docs.sourceforge.net/"); -} - diff --git a/tools/zsnes/src/linux/sockserv.c b/tools/zsnes/src/linux/sockserv.c deleted file mode 100644 index c59f346..0000000 --- a/tools/zsnes/src/linux/sockserv.c +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - diff --git a/tools/zsnes/src/linux/sockserv.h b/tools/zsnes/src/linux/sockserv.h deleted file mode 100644 index c59f346..0000000 --- a/tools/zsnes/src/linux/sockserv.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - diff --git a/tools/zsnes/src/linux/sw_draw.c b/tools/zsnes/src/linux/sw_draw.c deleted file mode 100644 index 1cc8df4..0000000 --- a/tools/zsnes/src/linux/sw_draw.c +++ /dev/null @@ -1,237 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 "../gblhdr.h" -#include "../cfg.h" -#include "../asm_call.h" - - -#define BYTE unsigned char -#define WORD unsigned short -#define DWORD unsigned long - -//C++ style code in C -#define bool unsigned char -#define true 1 -#define false 0 - -void CheckFrame(); -// VIDEO VARIABLES -extern SDL_Surface *surface; -extern int SurfaceX, SurfaceY; -extern int SurfaceLocking; - -extern unsigned int vidbuffer; -extern DWORD converta; -extern unsigned char curblank; -extern int frametot; -extern BYTE GUIOn,GUIOn2; - -void UpdateVFrame(void); -void NTSCFilterInit(); -void NTSCFilterDraw(int SurfaceX, int SurfaceY, int pitch, unsigned char * buffer); - -bool OGLModeCheck(); -void initwinvideo(); - -bool sw_start(int width, int height, int req_depth, int FullScreen) -{ - //unsigned int color32, p; - //int i; -#ifndef __MACOSX__ - Uint32 flags = SDL_DOUBLEBUF | SDL_HWSURFACE; -#else - Uint32 flags = SDL_SWSURFACE; -#endif - DWORD GBitMask; - - flags |= (FullScreen ? SDL_FULLSCREEN : 0); - - if (NTSCFilter) NTSCFilterInit(); - - SurfaceX = width; SurfaceY = height; - surface = SDL_SetVideoMode(SurfaceX, SurfaceY, req_depth, flags); - if (surface == NULL) { - fprintf (stderr, "Could not set %dx%d video mode: %s\n", SurfaceX, SurfaceY, SDL_GetError ()); - return false; - } - - SurfaceLocking = SDL_MUSTLOCK(surface); - SDL_WarpMouse(SurfaceX/4,SurfaceY/4); - - // Grab mouse in fullscreen mode - FullScreen ? SDL_WM_GrabInput(SDL_GRAB_ON) : SDL_WM_GrabInput(SDL_GRAB_OFF); - - SDL_WM_SetCaption ("ZSNES","ZSNES"); - SDL_ShowCursor(0); - - // Check hardware for 565/555 - GBitMask = surface->format->Gmask; - if(GBitMask != 0x07E0) converta = 1; - else converta = 0; - - return true; -} - -void sw_end() { - // Do nothing -} - -static void LockSurface(void) -{ - if (SurfaceLocking) SDL_LockSurface(surface); -} - -static void UnlockSurface(void) -{ - if (SurfaceLocking) SDL_UnlockSurface(surface); - SDL_Flip(surface); -} - -extern DWORD AddEndBytes; -extern DWORD NumBytesPerLine; -extern unsigned char *WinVidMemStart; -extern unsigned char NGNoTransp; -extern unsigned short resolutn; -void copy640x480x16bwin(void); -void hq2x_16b(void); -void hq3x_16b(void); -void hq4x_16b(void); -void ClearWin16 (void); -void DrawWin256x224x16(void); -void DrawWin320x240x16(void); -DWORD ScreenPtr; -DWORD SurfBufD; -DWORD pitch; - -void sw_clearwin() -{ - pitch = surface->pitch; - SurfBufD = (DWORD) surface->pixels; - - LockSurface(); - ClearWin16(); - UnlockSurface(); -} - -extern unsigned char prevNTSCMode; -extern unsigned char changeRes; -extern unsigned char prevKeep4_3Ratio; - -void sw_drawwin() -{ - NGNoTransp = 0; // Set this value to 1 within the appropriate - // video mode if you want to add a custom - // transparency routine or hardware - // transparency. This only works if - // the value of newengen is equal to 1. - // (see ProcessTransparencies in newgfx16.asm - // for ZSNES' current transparency code) - - - UpdateVFrame(); - - if (curblank || OGLModeCheck()) return; - LockSurface(); - - if (NTSCFilter != prevNTSCMode) initwinvideo(); - - if (changeRes) initwinvideo(); - - if (prevKeep4_3Ratio != Keep4_3Ratio) initwinvideo(); - - ScreenPtr = vidbuffer; - ScreenPtr += 16*2+32*2+256*2; - - if (resolutn == 239) ScreenPtr+=8*288*2; - - pitch = surface->pitch; - SurfBufD = (DWORD) surface->pixels; - - if (SurfBufD == 0) { - UnlockSurface(); - return; - } - - if (SurfaceX == 256 && SurfaceY == 224) DrawWin256x224x16(); - else if (SurfaceX == 320 && SurfaceY == 240) DrawWin320x240x16(); - else if((SurfaceX == 512 && SurfaceY == 448)) - { - AddEndBytes = pitch-1024; - NumBytesPerLine = pitch; - WinVidMemStart = (void*)SurfBufD; - - if (hqFilter) - { - switch (hqFilter) - { - case 1: - hq2x_16b(); - break; - case 2: - //hq3x_16b(); - break; - case 3: - //hq4x_16b(); - break; - default: - break; - } - } - else asm_call(copy640x480x16bwin); - } - else if ((SurfaceX == 602) && NTSCFilter) - { - AddEndBytes = pitch-1024; - NumBytesPerLine = pitch; - WinVidMemStart = (void*)SurfBufD; - - NTSCFilterDraw(SurfaceX, SurfaceY, pitch, WinVidMemStart); - } - - else if (SurfaceX == 640 && SurfaceY == 480) - { - AddEndBytes = pitch-1024; - NumBytesPerLine = pitch; - WinVidMemStart = (void*) (SurfBufD + 16*640*2 + 64*2); - if (hqFilter) - { - switch (hqFilter) - { - case 1: - hq2x_16b(); - break; - case 2: - //hq3x_16b(); - break; - case 3: - //hq4x_16b(); - break; - default: - break; - } - } - else if (NTSCFilter) NTSCFilterDraw(SurfaceX, SurfaceY, pitch, WinVidMemStart-16*640*2-64*2); else asm_call(copy640x480x16bwin); - } - - UnlockSurface(); -} diff --git a/tools/zsnes/src/linux/sw_draw.h b/tools/zsnes/src/linux/sw_draw.h deleted file mode 100644 index bbff3a4..0000000 --- a/tools/zsnes/src/linux/sw_draw.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - -#ifndef SW_DRAW_h -#define SW_DRAW_h 1 - -int sw_start(int width, int height, int req_depth, int FullScreen); -void sw_end(); -void sw_clearwin(); -void sw_drawwin(); - -#endif - - diff --git a/tools/zsnes/src/linux/zsnes.1 b/tools/zsnes/src/linux/zsnes.1 deleted file mode 100644 index ad936d4..0000000 --- a/tools/zsnes/src/linux/zsnes.1 +++ /dev/null @@ -1,215 +0,0 @@ -.TH "ZSNES v1.51" 1 - -.SH NAME -ZSNES - Super Nintendo console emulator -.SH SYNOPSIS -.B ZSNES -[-?] [-1 #] [-2 #] [-dd] [-dh] [-f #] [-g #] [-h | -l] [-j] [-js #] [-k #] [-m] [-mc] [-md] [-ml #] [-n #] [-o] [-p #] [-r #] [-s] [-sa] [-t | -u] [-v #] [-y] [-z] [-zm #] [-zs #] [romname] - -.SH DESCRIPTION -.B ZSNES -is an emulator for the Super Nintendo video game console. It is written in a combination of x86 assembly, C, C++, and PSR. It is currently available on Windows, DOS, x86 Linux, x86 Mac OS X, and x86 BSD. - -Visit http://www.zsnes.com/ for the latest updates. - -.SH OPTIONS -Note: Many of these options can also be set in the GUI. -.TP -.B -? -Display command-line help -.TP -.B -1 # / -2 # -Set controls for Player 1/2 -.nf -\fI0\fP = None \fI1\fP = Keyboard/Gamepad -.fi -.TP -.B -dd -Disable sound DSP emulation -.TP -.B -dh -Disable game hacks -.TP -.B -f # -Enable frame skipping, where \fB#\fP is a numerical value from \fI0-9\fP -.TP -.B -g # -Specify gamma correction value, where \fB#\fP is a numerical value from \fI0-15\fP -.TP -.B -h -Force HiROM. Cannot be used with \fB-l\fP -.TP -.B -j -Disable Mouse (Automatically turns off right mouse click) -.TP -.B -js # -Adjust joystick sensitivity, where \fB#\fP is a numerical value from \fI0-32767\fP -.TP -.B -k # -Set volume level, where \fB#\fP is a numerical value from \fI1-100\fP -.TP -.B -l -Force LoROM. Cannot be used with \fB-h\fP -.TP -.B -m -Disable GUI (Must specify ROM filename) -.TP -.B -mc -Exit ZSNES when closing a movie (use with \fB-zm\fP) -.TP -.B -md -Dump raw video (use with \fB-zm\fP) -.TP -.B -ml -Define movie dump length in amount of frames (use with \fB-md\fP) -.TP -.B -n # -Enable scanlines (when available), where -.B # -is one of: -.nf -\fl0\fP = none \fI1\fP = full \fI2\fP = 25% -\fI3\fP = 50% -.fi -.TP -.B -o -Disable MMX support -.TP -.B -p # -Change the clock speed of the main CPU, where -.B # -is a numerical value from \fI50-150\fP. 100 is the normal speed. Changing this value may have adverse side effects. -.TP -.B -r # -Set audio sampling rate, where -.B # -is one of: -.nf -\fI0\fP = 8 KHz \fI1\fP = 11.025 KHz \fI2\fP = 22.05 KHz -\fI3\fP = 44.1 KHz \fI4\fP = 16 KHz \fI5\fP = 32 KHz -\fI6\fP = 48 KHz -.fi -.TP -.B -s -Enable SPC700/DSP emulation (Sound) -.TP -.B -sa -Show files with all extensions (*.*) in GUI. Default is to only show files with one of the extensions listed in -.B romname -.TP -.B -t -Force NTSC (60 Hz) timing. Cannot be used with \fB-u\fP -.TP -.B -u -Force PAL (50 Hz) timing. Cannot be used with \fB-t\fP -.TP -.B -v # -Select video mode, where -.B # -is one of: -.nf - \fI0\fP = 256x224 R W \fI1\fP = 256x224 R F \fI2\fP = 512x448 DR W - \fI3\fP = 512x448 DR F \fI4\fP = 640x480 DR F \fI5\fP = 256x224 OR W - \fI6\fP = 512x448 ODR \fI7\fP = 640x480 ODS F \fI8\fP = 640x480 ODS W - \fI9\fP = 640x560 ODR W \fI10\fP = 768x672 ODR W \fI11\fP = 800x600 ODS F -\fI12\fP = 800x600 ODS W \fI13\fP = 896x784 ODR W \fI14\fP = 1024x768 ODS F -\fI15\fP = 1024x768 ODS W \fI16\fP = 1024x896 ODR W \fI17\fP = 1280x960 ODS F -\fI18\fP = 1280x1024 ODS F \fI19\fP = 1600x1200 ODS F \fI20\fP = VARIABLE ODR W -\fI21\fP = VARIABLE ODS W \fI22\fP = CUSTOM OD F -.fi -.TP -.B -y -Enable Interpolation -.TP -.B -z -Disable stereo sound. Stereo sound is enabled by default -.TP -.B -zm # -Auto load specified movie on startup, where \fB#\fP is a numerical value from \fI0-9\fP -.TP -.B -zs # -Auto load specified save state on startup, where \fB#\fP is a numerical value from \fI0-99\fP -.TP -.B romname -Name of ROM to auto-load -.B romname -is of the format \fBfilename.ext\fP, where -.B .ext -is one of -SMC, SFC, SWC, FIG, MGD, MGH, UFO, BIN, GD3, GD7, USA, EUR, JAP, AUS, ST, BS, DX2, 048, 058, 078, 1 or A. You can also load ROMs which have been compressed with GZip, Zip or JMA. - - -.SH "FILES AND DIRECTORIES" -.TP -ZSNES -The main program. -.TP -~/.zsnes -This is the directory where ZSNES configuration files are stored. By default, it is also the directory where save states, screenshots, SPC dumps and ZMV movie files are stored, but you can change this behaviour by editing zsnesl.cfg. This directory is created by ZSNES. -.TP -~/.zsnes/zsnesl.cfg -This file is where configuration settings for ZSNES are stored. It is in a human-readable format and can be edited by hand. It is created by ZSNES. -.TP -~/.zsnes/zmovie.cfg -This file is where settings specific to AVI dumping are saved. It is created by ZSNES. -.TP -~/.zsnes/zfont.txt -This file allows you to customize the fonts in the GUI. Enable "Use Custom Font" in the GUI Options menu. It is created by ZSNES. -.TP -~/.zsnes/zinput.cfg -This file is where input configuration settings for ZSNES are stored. - -.B If for some reason you update your version of ZSNES and it keeps crashing before you can do anything, you should try deleting the above .cfg files and let ZSNES create new ones. - -.SH "SPECIAL CHIP GAMES" -Many games on the Super Nintendo used custom CPUs in addition to the main SNES CPU. Some of these CPUs have not been fully reverse-engineered, and games that use them may either not work or may experience strange bugs. - -You can find more information about these special CPUs at: - -http://users.tpg.com.au/advlink/dsp/ - -http://nsrt.edgeemu.com/INFO/chipinfo.htm - - -.SH "GRAPHICS PACKS" -Some games based on the SPC7110 chip, such as Far East of Eden Zero, can use special graphics packs to work around unemulated portions of their custom CPU. These graphics packs must be stored in individual directories within the save directory, which is specified in zsnesl.cfg. By default, this is ~/.zsnes. The directory name of each graphics pack must be capitalized and all files within that directory must be in lowercase. - -The proper directory name for a given graphics pack can be found in the readme file included with that pack. - -NOTE: As of version 1.40, games which use the S-DD1 chip (Star Ocean and Street Fighter Alpha 2) do not require graphics packs. - -.SH "REPORTING BUGS" -You can report bugs using the bug tracker at the ZSNES BountySource page, located at - -http://zsnes.bountysource.com/development/ - -.SH AUTHORS -Please refer to the "About" section of the documentation. - -.SH ZSNES RELATED WEBSITES -.TP -ZSNES Home Page: -http://www.zsnes.com/ -.TP -ZSNES Board: -http://board.zsnes.com/ -.TP -ZSNES Project Page: -https://zsnes.bountysource.com/ -.TP -ZSNES Repository (SubVersioN): -https://svn.bountysource.com/zsnes/trunk/ -.TP -ZSNES Documentation Online: -http://zsnes-docs.sf.net/ -.TP -ZSNES IRC: -#zsnes on irc.freenode.net -.TP -ZSNES Docs IRC: -#zsnes-docs on irc.freenode.net - -.SH "COPYRIGHT NOTICE" -Copyright \(co 1997-2007 ZSNES Team - -Permission is granted to copy and distribute this manual under the terms of the GNU Free Documentation License. \ No newline at end of file diff --git a/tools/zsnes/src/linux/zsnes.desktop b/tools/zsnes/src/linux/zsnes.desktop deleted file mode 100644 index 8905f92..0000000 --- a/tools/zsnes/src/linux/zsnes.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=ZSNES -Type=Application -Comment=SNES (Super Nintendo) emulator that uses x86 assembly -Exec=zsnes -Path= -Icon=zsnes.png -Categories=Application;Game;Emulator; diff --git a/tools/zsnes/src/macros.mac b/tools/zsnes/src/macros.mac deleted file mode 100644 index 2e6b09a..0000000 --- a/tools/zsnes/src/macros.mac +++ /dev/null @@ -1,79 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - -%ifdef __AMD64__ -bits 64 -%else -bits 32 -%endif - -section .text -; Zsnes required macros - -%define ZVERSION '1.51' - - -%ifdef MACHO -section .text align=16 -section .data align=4 -section .bss align=4 -%endif - -%ifdef ELF - -%imacro newsym 1 - GLOBAL %1 - %1: -%endmacro -%imacro newsym 2+ - GLOBAL %1 - %1: %2 -%endmacro -%define EXTSYM EXTERN - -section .note.GNU-stack noalloc noexec nowrite progbits - -%else - -%imacro newsym 1 - GLOBAL _%1 - _%1: - %1: -%endmacro -%imacro newsym 2+ - GLOBAL _%1 - _%1: - %1: %2 -%endmacro -%imacro EXTSYM 1-* -%rep %0 - EXTERN _%1 - %define %1 _%1 -%rotate 1 -%endrep -%endmacro -%endif - -%macro ALIGN32 0 - times ($$-$) & 1Fh nop ; Long word alignment -%endmacro -%macro ALIGN16 0 - times ($$-$) & 1Fh nop ; Long word alignment -%endmacro diff --git a/tools/zsnes/src/makefile.ms b/tools/zsnes/src/makefile.ms deleted file mode 100644 index b0cc36d..0000000 --- a/tools/zsnes/src/makefile.ms +++ /dev/null @@ -1,527 +0,0 @@ -#Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -# -#http://www.zsnes.com -#http://sourceforge.net/projects/zsnes -#https://zsnes.bountysource.com -# -#This program is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public License -#version 2 as published by the Free Software Foundation. -# -#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. - -#Parameters: -# -# PLATFORM=platform_name Chose target platform and how you're creating it. -# Valid options are: -# dos, dos-cross, msvc, win32, win32-cross, win32-unix-shell -# -# RELEASEGRADE=yes for high assembly optimization for releases, will take at least half an hour. -# clean cleans object and executable files. -# -# --Not for MSVC-- -# DEBUG=yes for debugging with GDB. -# CPU=cpu-type optimize for a particular CPU, find a list of cpu types in the GCC manual. - - -ENV=$(PLATFORM) -ifneq (${ENV},) #end if is at the bottom of the file - - -CHIPDIR=chips -CPUDIR=cpu -DOSDIR=dos -EFFECTSDIR=effects -GUIDIR=gui -JMADIR=jma -NETDIR=net -VIDEODIR=video -WINDIR=win -ZIPDIR=zip -MMLIBDIR=mmlib - -DELETECOMMAND=rm -f -DELPRE=rm -f -DELSUF= -SLASH=/ -PSR=parsegen.exe -ASM=nasm -ASMOPT=-O1 -ASMFLAGSORIG= -COPT=-O3 -CPUOPT=i586 -ifneq ($(CPU),) -CPUOPT=$(CPU) -endif -CFLAGSORIG=-march=${CPUOPT} -ffast-math -fomit-frame-pointer -fno-unroll-loops -Wall -Wno-unused -I. -LIBSORIG=-lz -lpng -DRESOBJ=${WINDIR}/zsnes.obj -CROSS=no -STRIP=-Ws -s - - -ifeq (${ENV},dos) - CC = gcc - CPPC = gpp - OS=__MSDOS__ -endif - -ifeq (${ENV},win32-unix-shell) - ENV=win32 - CROSS=yes -endif - -ifeq (${ENV},win32) - CC = gcc - CPPC = g++ - WINDRES = windres - OS=__WIN32__ - OBJFIX=objfix.exe -endif - -ifeq (${ENV},msvc) - CFLAGSORIG=/nologo /Ox /G6 /c /EHsc - MSVCLIBS=zlib.lib libpng.lib wsock32.lib user32.lib gdi32.lib shell32.lib winmm.lib dinput8.lib dxguid.lib - DRESOBJ=${WINDIR}/zsnes.res - OS=__WIN32__ -endif - -ifeq (${ENV},dos-cross) - CC = i586-msdosdjgpp-gcc - CPPC = i586-msdosdjgpp-g++ - OS=__MSDOS__ - CROSS=yes -endif - -ifeq (${ENV},win32-cross) - CC = i586-mingw32-gcc - CPPC = i586-mingw32-g++ - WINDRES = i586-mingw32-windres - OS=__WIN32__ - CROSS=yes - OBJFIX=objfix -endif - -ifeq (${CROSS},no) - DELETECOMMAND=del - ifeq (${OS},__WIN32__) - DELPRE=@for %%n in (znotfile.nt, - DELSUF=) do if exist %%n del %%n - else - DELPRE=@for %n in (znotfile.nt, - DELSUF=) do if exist %n del %n - endif - SLASH=\${BLAHBLAHBLAH} - SEP=, -endif - -ifeq (${OS},__MSDOS__) - EXE=zsnes.exe - FILEFORMAT=coff - LIBS=${LIBSORIG} -lm - OE=.do -endif - -ifeq (${OS},__WIN32__) - EXE=zsnesw.exe - FILEFORMAT=win32 - LIBS=${LIBSORIG} -ldxguid -ldinput8 -lwsock32 -luser32 -lgdi32 -lshell32 -lwinmm -mwindows - OE=.obj -endif - -ifeq (${DEBUG},yes) - ifneq (${ENV},msvc) - CFLAGSORIG=-fno-omit-frame-pointer -ggdb3 -DDEBUG - COPT=-O0 - ASMFLAGSORIG=-DDEBUG -g - EXE=zsnesd.exe - STRIP= - endif -endif - -ifeq (${RELEASE},yes) - CFLAGSORIG+= -D__RELEASE__ - ASMFLAGSORIG+= -D__RELEASE__ - RELEASEGRADE=yes -endif - -ifeq (${RELEASEGRADE},yes) - ASMOPT=-O9999 -endif - -ifeq (${DEBUGGER},no) - CFLAGSORIG+= -DNO_DEBUGGER - ASMFLAGSORIG+= -DNO_DEBUGGER -endif - -LINK=${CPPC} - -ifeq (${JMA},no) - CFLAGSORIG+= -DNO_JMA - ASMFLAGSORIG+= -DNO_JMA - ifeq (${OS},__MSDOS__) - LINK=${CC} - endif -endif - -CFLAGS=${CFLAGSORIG} -D${OS} -ASMFLAGS=${ASMFLAGSORIG} -f ${FILEFORMAT} -D${OS} - - -CHIPSOBJ=${CHIPDIR}/dsp1emu${OE} ${CHIPDIR}/fxemu2${OE} ${CHIPDIR}/sfxproc${OE}\ - ${CHIPDIR}/fxemu2b${OE} ${CHIPDIR}/fxemu2c${OE} ${CHIPDIR}/fxtable${OE}\ - ${CHIPDIR}/sa1proc${OE} ${CHIPDIR}/sa1regs${OE} ${CHIPDIR}/dsp1proc${OE}\ - ${CHIPDIR}/st10proc${OE} ${CHIPDIR}/seta10${OE} ${CHIPDIR}/dsp2proc${OE}\ - ${CHIPDIR}/sdd1emu${OE} ${CHIPDIR}/c4emu${OE} ${CHIPDIR}/dsp4proc${OE}\ - ${CHIPDIR}/dsp4emu${OE} ${CHIPDIR}/dsp3proc${OE} ${CHIPDIR}/dsp3emu${OE}\ - ${CHIPDIR}/obc1emu${OE} ${CHIPDIR}/obc1proc${OE} ${CHIPDIR}/c4proc${OE}\ - ${CHIPDIR}/7110proc${OE} ${CHIPDIR}/st11proc${OE} ${CHIPDIR}/seta11${OE} - -CPUOBJ=${CPUDIR}/dma${OE} ${CPUDIR}/dsp${OE} ${CPUDIR}/dspproc${OE}\ - ${CPUDIR}/execute${OE} ${CPUDIR}/executec${OE} ${CPUDIR}/irq${OE}\ - ${CPUDIR}/memory${OE} ${CPUDIR}/memtable${OE} ${CPUDIR}/spc700${OE}\ - ${CPUDIR}/stable${OE} ${CPUDIR}/table${OE}\ - ${CPUDIR}/tablec${OE} - -DOSOBJORIG=${DOSDIR}/joy${OE} ${DOSDIR}/vesa2${OE} - -EFFECTSOBJ=${EFFECTSDIR}/burn${OE} ${EFFECTSDIR}/water${OE} ${EFFECTSDIR}/smoke${OE} - -GUIOBJ=${GUIDIR}/gui${OE} ${GUIDIR}/guifuncs${OE} ${GUIDIR}/menu${OE} - -ifneq (${JMA},no) -JMAOBJ=${JMADIR}/7zlzma${OE} ${JMADIR}/crc32${OE} ${JMADIR}/iiostrm${OE}\ - ${JMADIR}/inbyte${OE} ${JMADIR}/jma${OE} ${JMADIR}/lzma${OE} ${JMADIR}/lzmadec${OE}\ - ${JMADIR}/winout${OE} ${JMADIR}/zsnesjma${OE} -endif - -MAINOBJ=endmem${OE} init${OE} initc${OE} patch${OE}\ - ui${OE} vcache${OE} version${OE} zmovie${OE} zstate${OE} zloader${OE}\ - cfg${OE} md${OE} input${OE} zpath${OE} ztimec${OE} ztime${OE} - -ifneq (${DEBUGGER},no) - MAINOBJ+= debugger${OE} debugasm${OE} - ifeq (${OS},__MSDOS__) - LIBS+= -lpdcur - else - LIBS+= -lpdcurses - MSVCLIBS+= pdcurses.lib - endif -endif - -NETOBJ= -#${NETDIR}/ztcp${OE} - -VIDEOBJ=${VIDEODIR}/makev16b${OE} ${VIDEODIR}/makev16t${OE} ${VIDEODIR}/makevid${OE}\ - ${VIDEODIR}/mode716${OE} ${VIDEODIR}/mode716b${OE} ${VIDEODIR}/mode716d${OE}\ - ${VIDEODIR}/mode716e${OE} ${VIDEODIR}/mode716t${OE} ${VIDEODIR}/mode7${OE}\ - ${VIDEODIR}/mode7ext${OE} ${VIDEODIR}/mv16tms${OE} ${VIDEODIR}/newg162${OE}\ - ${VIDEODIR}/newgfx16${OE} ${VIDEODIR}/newgfx2${OE} ${VIDEODIR}/newgfx${OE}\ - ${VIDEODIR}/m716text${OE} ${VIDEODIR}/procvid${OE} ${VIDEODIR}/procvidc${OE}\ - -#only used on Win32 -WINOBJ= ${DRESOBJ}\ - ${WINDIR}/winintrf${OE} ${WINDIR}/winlink${OE} ${WINDIR}/lib${OE}\ - ${WINDIR}/safelib${OE} ${MMLIBDIR}/mm${OE} ${MMLIBDIR}/windows${OE} - -WINVIDOBJ=${VIDEODIR}/sw_draw${OE} ${VIDEODIR}/hq2x16${OE} ${VIDEODIR}/hq2x32${OE}\ - ${VIDEODIR}/2xsaiw${OE} ${VIDEODIR}/hq3x16${OE} ${VIDEODIR}/hq3x32${OE}\ - ${VIDEODIR}/hq4x16${OE} ${VIDEODIR}/hq4x32${OE} ${VIDEODIR}/copyvwin${OE} - -ZIPOBJ=${ZIPDIR}/unzip${OE} ${ZIPDIR}/zpng${OE} - - -OBJSORIG=${CHIPSOBJ} ${CPUOBJ} ${GUIOBJ} ${VIDEOBJ} ${MAINOBJ} ${ZIPOBJ} ${EFFECTSOBJ} ${JMAOBJ} - -ifeq (${OS},__MSDOS__) -DOSOBJ=${DOSOBJORIG} ${DOSDIR}/dosintrf${OE} ${DOSDIR}/gppro${OE} ${DOSDIR}/initvid${OE}\ - ${DOSDIR}/sound${OE} ${DOSDIR}/sw${OE} ${DOSDIR}/vesa12${OE} ${DOSDIR}/lib${OE} -OBJS=${OBJSORIG} ${DOSOBJ} -DELETEOBJS=${OBJSORIG} ${DOSOBJ} -endif - -ifeq (${OS},__WIN32__) -VIDEOBJ+= ${VIDEODIR}/ntsc${OE} -OBJS=${OBJSORIG} ${WINOBJ} ${WINVIDOBJ} ${NETOBJ} -DELETEOBJS=${OBJS} -endif - - -.SUFFIXES: .c .cpp .asm .psr - -ifneq (${ENV},msvc) -%${OE}: %.c - ${CC} ${COPT} ${CFLAGS} -o $@ -c $< - -%${OE}: %.cpp - ${CPPC} ${COPT} ${CFLAGS} -o $@ -c $< - -%${OE}: %.asm - ${ASM} ${ASMOPT} ${ASMFLAGS} -o $@ $< -ifeq (${OS},__WIN32__) - objfix $@ -endif -else -%.obj : %.c - cl ${CFLAGS} /Fo$@ $< - -%.obj: %.cpp - cl ${CFLAGS} /Fo$@ $< - -%.obj: %.asm - ${ASM} ${ASMOPT} ${ASMFLAGS} -o $@ $< -endif - -%${OE}: %.psr - ${PSR} -D${OS} -cheader $(patsubst %${OE},%.h,$@) -fname $(patsubst %${OE},%,$@) temppsr.c $< -ifneq (${ENV},msvc) - ${CC} ${CFLAGS} -O1 -o $@ -c temppsr.c -else - cl ${CFLAGS} /Fo$@ temppsr.c -endif - ${DELETECOMMAND} temppsr.c - -ALL: zsnes - ${DELETECOMMAND} version${OE} - -zsnes: ${PSR} ${OBJFIX} ${OBJS} -ifneq (${ENV},msvc) - ${LINK} ${STRIP} -o ${EXE} ${OBJS} ${LIBS} -else - @echo /Fezsnesw.exe *.obj ${CPUDIR}\*.obj ${VIDEODIR}\*.obj ${CHIPDIR}\*.obj ${EFFECTSDIR}\*.obj ${DOSDIR}\*.obj ${WINDIR}\*.obj ${GUIDIR}\*.obj > link.vc - @echo ${ZIPDIR}\*.obj ${JMADIR}\*.obj ${NETDIR}\*.obj ${MMLIBDIR}\*.obj >> link.vc - @echo ${MSVCLIBS} >> link.vc - cl /nologo @link.vc ${WINDIR}/zsnes.res /link -endif - -cfg${OE}: cfg.psr ${PSR} -input${OE}: input.psr ${PSR} -debugasm${OE}: debugasm.asm macros.mac -debugger${OE}: debugger.c asm_call.h zpath.h ${JMADIR}/zsnesjma.h \ - ${ZIPDIR}/zunzip.h -endmem${OE}: endmem.asm macros.mac -init${OE}: init.asm macros.mac -initc${OE}: initc.c asm_call.h cfg${OE} zpath.h ${CPUDIR}/memtable.h \ - ${JMADIR}/zsnesjma.h ${ZIPDIR}/zunzip.h input${OE} -md${OE}: md.psr ${PSR} -patch${OE}: patch.c zpath.h ${JMADIR}/zsnesjma.h ${ZIPDIR}/zunzip.h -ui${OE}: ui.c asm_call.h cfg${OE} zpath.h ${JMADIR}/zsnesjma.h \ - ${MMLIBDIR}/mm.h ${ZIPDIR}/zunzip.h input${OE} -vcache${OE}: vcache.asm macros.mac -version${OE}: version.c -zloader${OE}: zloader.c asm_call.h cfg${OE} zloader.h zpath.h \ - ${JMADIR}/zsnesjma.h ${ZIPDIR}/zunzip.h input${OE} -zmovie${OE}: zmovie.c asm_call.h cfg${OE} gblvars.h md${OE} numconv.h zpath.h \ - ${JMADIR}/zsnesjma.h ${WINDIR}/safelib.h ${ZIPDIR}/zunzip.h zmovie.h input${OE} -zpath${OE}: zpath.c cfg${OE} zpath.h ${DOSDIR}/lib.h ${JMADIR}/zsnesjma.h \ - ${WINDIR}/lib.h ${WINDIR}/safelib.h ${ZIPDIR}/zunzip.h -zstate${OE}: zstate.c asm_call.h cfg${OE} gblvars.h numconv.h zpath.h \ - ${JMADIR}/zsnesjma.h ${ZIPDIR}/zunzip.h zmovie.h input${OE} -ztime${OE}: ztime.asm -ztimec${OE}: ztimec.c - -${CHIPDIR}/7110proc${OE}: ${CHIPDIR}/7110proc.asm macros.mac \ - ${CPUDIR}/regs.mac ${CPUDIR}/regsw.mac -${CHIPDIR}/c4emu${OE}: ${CHIPDIR}/c4emu.c -${CHIPDIR}/c4proc${OE}: ${CHIPDIR}/c4proc.asm macros.mac -${CHIPDIR}/dsp1emu${OE}: ${CHIPDIR}/dsp1emu.c -${CHIPDIR}/dsp1proc${OE}: ${CHIPDIR}/dsp1proc.asm macros.mac -${CHIPDIR}/dsp2proc${OE}: ${CHIPDIR}/dsp2proc.asm macros.mac -${CHIPDIR}/dsp3emu${OE}: ${CHIPDIR}/dsp3emu.c -${CHIPDIR}/dsp3proc${OE}: ${CHIPDIR}/dsp3proc.asm macros.mac -${CHIPDIR}/dsp4emu${OE}: ${CHIPDIR}/dsp4emu.c -${CHIPDIR}/dsp4proc${OE}: ${CHIPDIR}/dsp4proc.asm macros.mac -${CHIPDIR}/fxemu2${OE}: ${CHIPDIR}/fxemu2.asm macros.mac ${CHIPDIR}/fxemu2.mac -${CHIPDIR}/fxemu2b${OE}: ${CHIPDIR}/fxemu2b.asm macros.mac \ - ${CHIPDIR}/fxemu2.mac ${CHIPDIR}/fxemu2b.mac -${CHIPDIR}/fxemu2c${OE}: ${CHIPDIR}/fxemu2c.asm macros.mac \ - ${CHIPDIR}/fxemu2.mac ${CHIPDIR}/fxemu2c.mac -${CHIPDIR}/fxtable${OE}: ${CHIPDIR}/fxtable.asm macros.mac -${CHIPDIR}/obc1emu${OE}: ${CHIPDIR}/obc1emu.c -${CHIPDIR}/obc1proc${OE}: ${CHIPDIR}/obc1proc.asm macros.mac -${CHIPDIR}/sa1proc${OE}: ${CHIPDIR}/sa1proc.asm macros.mac -${CHIPDIR}/sa1regs${OE}: ${CHIPDIR}/sa1regs.asm macros.mac ${CPUDIR}/regs.mac \ - ${CPUDIR}/regsw.mac -${CHIPDIR}/sdd1emu${OE}: ${CHIPDIR}/sdd1emu.c -${CHIPDIR}/seta10${OE}: ${CHIPDIR}/seta10.c -${CHIPDIR}/seta11${OE}: ${CHIPDIR}/seta11.c -${CHIPDIR}/sfxproc${OE}: ${CHIPDIR}/sfxproc.asm macros.mac ${CPUDIR}/regs.mac \ - ${CPUDIR}/regsw.mac -${CHIPDIR}/st10proc${OE}: ${CHIPDIR}/st10proc.asm macros.mac -${CHIPDIR}/st11proc${OE}: ${CHIPDIR}/st11proc.asm macros.mac - -${CPUDIR}/dma${OE}: ${CPUDIR}/dma.asm macros.mac -${CPUDIR}/dsp${OE}: ${CPUDIR}/dsp.asm macros.mac -${CPUDIR}/dspproc${OE}: ${CPUDIR}/dspproc.asm macros.mac ${CPUDIR}/firtable.inc -${CPUDIR}/execute${OE}: ${CPUDIR}/execute.asm macros.mac -${CPUDIR}/executec${OE}: ${CPUDIR}/executec.c gblvars.h -${CPUDIR}/irq${OE}: ${CPUDIR}/irq.asm macros.mac -${CPUDIR}/memory${OE}: ${CPUDIR}/memory.asm macros.mac -${CPUDIR}/memtable${OE}: ${CPUDIR}/memtable.c gblvars.h ${CPUDIR}/memtable.h -${CPUDIR}/spc700${OE}: ${CPUDIR}/spc700.asm macros.mac ${CPUDIR}/regsw.mac \ - ${CPUDIR}/spcaddr.inc ${CPUDIR}/spcdef.inc -${CPUDIR}/stable${OE}: ${CPUDIR}/stable.asm macros.mac ${CPUDIR}/s65816d.inc \ - ${CPUDIR}/saddress.inc ${CPUDIR}/saddrni.inc ${CPUDIR}/se65816.inc -${CPUDIR}/table${OE}: ${CPUDIR}/table.asm macros.mac ${CPUDIR}/65816d.inc \ - ${CPUDIR}/address.inc ${CPUDIR}/addrni.inc ${CPUDIR}/e65816.inc \ - ${CPUDIR}/regs.inc ${CPUDIR}/regs.mac ${CPUDIR}/regsw.inc \ - ${CPUDIR}/regsw.mac -${CPUDIR}/tablec${OE}: ${CPUDIR}/tablec.asm macros.mac ${CPUDIR}/65816dc.inc \ - ${CPUDIR}/address.inc ${CPUDIR}/addrni.inc ${CPUDIR}/e65816c.inc - -${DOSDIR}/debug${OE}: ${DOSDIR}/debug.asm macros.mac -${DOSDIR}/dosintrf${OE}: ${DOSDIR}/dosintrf.asm macros.mac -${DOSDIR}/gppro${OE}: ${DOSDIR}/gppro.asm macros.mac -${DOSDIR}/initvid${OE}: ${DOSDIR}/initvid.asm macros.mac ${DOSDIR}/vga.inc -${DOSDIR}/joy${OE}: ${DOSDIR}/joy.asm macros.mac -${DOSDIR}/lib${OE}: ${DOSDIR}/lib.c -${DOSDIR}/sound${OE}: ${DOSDIR}/sound.asm macros.mac -${DOSDIR}/sw${OE}: ${DOSDIR}/sw.asm macros.mac -${DOSDIR}/vesa12${OE}: ${DOSDIR}/vesa12.asm macros.mac -${DOSDIR}/vesa2${OE}: ${DOSDIR}/vesa2.asm macros.mac - -${EFFECTSDIR}/burn${OE}: ${EFFECTSDIR}/burn.c -${EFFECTSDIR}/smoke${OE}: ${EFFECTSDIR}/smoke.c -${EFFECTSDIR}/water${OE}: ${EFFECTSDIR}/water.c ${EFFECTSDIR}/fixsin.h - -${GUIDIR}/gui${OE}: ${GUIDIR}/gui.asm macros.mac ${GUIDIR}/guicheat.inc \ - ${GUIDIR}/guicombo.inc ${GUIDIR}/guikeys.inc ${GUIDIR}/guimisc.inc \ - ${GUIDIR}/guimouse.inc ${GUIDIR}/guitools.inc ${GUIDIR}/guiwindp.inc -${GUIDIR}/guifuncs${OE}: ${GUIDIR}/guifuncs.c asm_call.h cfg${OE} md${OE} \ - zloader.h zpath.h ${DOSDIR}/lib.h ${JMADIR}/zsnesjma.h ${WINDIR}/lib.h \ - ${ZIPDIR}/zunzip.h input${OE} -${GUIDIR}/menu${OE}: ${GUIDIR}/menu.asm macros.mac - -${JMADIR}/7zlzma${OE}: ${JMADIR}/7zlzma.cpp ${JMADIR}/7z.h \ - ${JMADIR}/aribitcd.h ${JMADIR}/ariconst.h ${JMADIR}/btreecd.h \ - ${JMADIR}/iiostrm.h ${JMADIR}/inbyte.h ${JMADIR}/lencoder.h \ - ${JMADIR}/litcoder.h ${JMADIR}/lzma.h ${JMADIR}/lzmadec.h \ - ${JMADIR}/portable.h ${JMADIR}/rcdefs.h ${JMADIR}/rngcoder.h \ - ${JMADIR}/winout.h -${JMADIR}/crc32${OE}: ${JMADIR}/crc32.cpp -${JMADIR}/iiostrm${OE}: ${JMADIR}/iiostrm.cpp ${JMADIR}/crc32.h \ - ${JMADIR}/iiostrm.h ${JMADIR}/portable.h -${JMADIR}/inbyte${OE}: ${JMADIR}/inbyte.cpp ${JMADIR}/iiostrm.h \ - ${JMADIR}/inbyte.h ${JMADIR}/portable.h -${JMADIR}/jma${OE}: ${JMADIR}/jma.cpp ${JMADIR}/7z.h ${JMADIR}/crc32.h \ - ${JMADIR}/iiostrm.h ${JMADIR}/jma.h ${JMADIR}/portable.h -${JMADIR}/lzma${OE}: ${JMADIR}/lzma.cpp ${JMADIR}/aribitcd.h \ - ${JMADIR}/ariconst.h ${JMADIR}/btreecd.h ${JMADIR}/iiostrm.h \ - ${JMADIR}/inbyte.h ${JMADIR}/lencoder.h ${JMADIR}/lzma.h \ - ${JMADIR}/portable.h ${JMADIR}/rcdefs.h ${JMADIR}/rngcoder.h -${JMADIR}/lzmadec${OE}: ${JMADIR}/lzmadec.cpp ${JMADIR}/aribitcd.h \ - ${JMADIR}/ariconst.h ${JMADIR}/btreecd.h ${JMADIR}/iiostrm.h \ - ${JMADIR}/inbyte.h ${JMADIR}/lencoder.h ${JMADIR}/litcoder.h \ - ${JMADIR}/lzma.h ${JMADIR}/lzmadec.h ${JMADIR}/portable.h \ - ${JMADIR}/rcdefs.h ${JMADIR}/rngcoder.h ${JMADIR}/winout.h -${JMADIR}/winout${OE}: ${JMADIR}/winout.cpp ${JMADIR}/iiostrm.h \ - ${JMADIR}/portable.h ${JMADIR}/winout.h -${JMADIR}/zsnesjma${OE}: ${JMADIR}/zsnesjma.cpp ${JMADIR}/jma.h \ - ${JMADIR}/zsnesjma.h - -${MMLIBDIR}/mm${OE}: ${MMLIBDIR}/mm.c ${MMLIBDIR}/mm.h -${MMLIBDIR}/windows${OE}: ${MMLIBDIR}/windows.c ${MMLIBDIR}/mm.h - -${VIDEODIR}/2xsaiw${OE}: ${VIDEODIR}/2xsaiw.asm macros.mac -${VIDEODIR}/hq2x16${OE}: ${VIDEODIR}/hq2x16.asm macros.mac -${VIDEODIR}/hq2x32${OE}: ${VIDEODIR}/hq2x32.asm macros.mac -${VIDEODIR}/hq3x16${OE}: ${VIDEODIR}/hq3x16.asm macros.mac -${VIDEODIR}/hq3x32${OE}: ${VIDEODIR}/hq3x32.asm macros.mac -${VIDEODIR}/hq4x16${OE}: ${VIDEODIR}/hq4x16.asm macros.mac -${VIDEODIR}/hq4x32${OE}: ${VIDEODIR}/hq4x32.asm macros.mac -${VIDEODIR}/m716text${OE}: ${VIDEODIR}/m716text.asm macros.mac -${VIDEODIR}/makev16b${OE}: ${VIDEODIR}/makev16b.asm macros.mac \ - ${VIDEODIR}/vidmacro.mac -${VIDEODIR}/makev16t${OE}: ${VIDEODIR}/makev16t.asm macros.mac \ - ${VIDEODIR}/vidmacro.mac -${VIDEODIR}/makevid${OE}: ${VIDEODIR}/makevid.asm macros.mac \ - ${VIDEODIR}/vidmacro.mac -${VIDEODIR}/mode7${OE}: ${VIDEODIR}/mode7.asm macros.mac ${VIDEODIR}/mode7.mac -${VIDEODIR}/mode716${OE}: ${VIDEODIR}/mode716.asm macros.mac \ - ${VIDEODIR}/mode716.mac -${VIDEODIR}/mode716b${OE}: ${VIDEODIR}/mode716b.asm macros.mac \ - ${VIDEODIR}/mode7.mac -${VIDEODIR}/mode716d${OE}: ${VIDEODIR}/mode716d.asm macros.mac \ - ${VIDEODIR}/mode7.mac -${VIDEODIR}/mode716e${OE}: ${VIDEODIR}/mode716e.asm macros.mac -${VIDEODIR}/mode716t${OE}: ${VIDEODIR}/mode716t.asm macros.mac \ - ${VIDEODIR}/mode7.mac -${VIDEODIR}/mode7ext${OE}: ${VIDEODIR}/mode7ext.asm macros.mac \ - ${VIDEODIR}/mode7.mac -${VIDEODIR}/mv16tms${OE}: ${VIDEODIR}/mv16tms.asm macros.mac \ - ${VIDEODIR}/vidmacro.mac -${VIDEODIR}/newg162${OE}: ${VIDEODIR}/newg162.asm macros.mac \ - ${VIDEODIR}/newg162.mac ${VIDEODIR}/newg16wn.mac ${VIDEODIR}/newgfx16.mac \ - ${VIDEODIR}/vidmacro.mac -${VIDEODIR}/newgfx${OE}: ${VIDEODIR}/newgfx.asm macros.mac \ - ${VIDEODIR}/newgfx.mac ${VIDEODIR}/newgfx2.mac ${VIDEODIR}/vidmacro.mac -${VIDEODIR}/newgfx16${OE}: ${VIDEODIR}/newgfx16.asm macros.mac \ - ${VIDEODIR}/newg162.mac ${VIDEODIR}/newgfx16.mac ${VIDEODIR}/vidmacro.mac -${VIDEODIR}/newgfx2${OE}: ${VIDEODIR}/newgfx2.asm macros.mac \ - ${VIDEODIR}/newgfx.mac ${VIDEODIR}/newgfx2.mac ${VIDEODIR}/newgfxwn.mac \ - ${VIDEODIR}/vidmacro.mac -${VIDEODIR}/ntsc${OE}: ${VIDEODIR}/ntsc.c ${VIDEODIR}/ntsc.h -${VIDEODIR}/procvid${OE}: ${VIDEODIR}/procvid.asm macros.mac \ - ${VIDEODIR}/2xsaimmx.inc ${VIDEODIR}/copyvid.inc -${VIDEODIR}/procvidc${OE}: ${VIDEODIR}/procvidc.c zpath.h \ - ${JMADIR}/zsnesjma.h ${VIDEODIR}/ntsc.h ${ZIPDIR}/zunzip.h zmovie.h -${VIDEODIR}/sw_draw${OE}: ${VIDEODIR}/sw_draw.asm macros.mac - -${WINDIR}/copyvwin${OE}: ${WINDIR}/copyvwin.asm macros.mac -${WINDIR}/lib${OE}: ${WINDIR}/lib.c zpath.h ${JMADIR}/zsnesjma.h \ - ${WINDIR}/lib.h ${ZIPDIR}/zunzip.h -${WINDIR}/safelib${OE}: ${WINDIR}/safelib.c argv.h -ifeq (${ENV},msvc) -${WINDIR}/winintrf${OE}: ${WINDIR}/winintrf.asm macros.mac -${WINDIR}/winlink.obj: ${WINDIR}/winlink.cpp cfg${OE} ${WINDIR}/resource.h input${OE} -${WINDIR}/zsnes.res: ${WINDIR}/zsnes.rc ${WINDIR}/resource.h - rc ${WINDIR}/zsnes.rc -else -${WINDIR}/winlink${OE}: ${WINDIR}/winlink.cpp cfg${OE} input${OE} ${WINDIR}/resource.h - ${CPPC} ${COPT} ${CFLAGS} -masm=intel -o $@ -c ${WINDIR}/winlink.cpp -${WINDIR}/zsnes${OE}: ${WINDIR}/zsnes.rc ${WINDIR}/resource.h - ${WINDRES} --include-dir ${WINDIR} ${WINDIR}/zsnes.rc -o${WINDIR}/zsnes${OE} -${OBJFIX}: objfix.c - gcc -O3 -s -o $@ objfix.c -endif -${PSR}: parsegen.cpp -ifeq (${ENV},msvc) - cl /nologo /EHsc /Fe$@ parsegen.cpp zlib.lib - ${DELETECOMMAND} parsegen.obj -else -ifeq (${ENV},dos) - gpp -O3 -s -o $@ parsegen.cpp -lz -else - g++ -O3 -s -o $@ parsegen.cpp -lz -endif -endif - -${ZIPDIR}/unzip${OE}: ${ZIPDIR}/unzip.c ${ZIPDIR}/zunzip.h -${ZIPDIR}/zpng${OE}: ${ZIPDIR}/zpng.c numconv.h zpath.h ${JMADIR}/zsnesjma.h \ - ${ZIPDIR}/zunzip.h - -else #else no ENV specified - @echo Please specify which platform to compile for with PLATFORM=platform_name -endif #endif on the ENV being empty - -clean: - -ifneq (${ENV},) -# Take care that the expanded text between pre and suf is less than 28 characters - ${DELPRE} ${EXE}${SEP} ${PSR}${DELSUF} - ${DELPRE} *${OE}${SEP} ${NETDIR}${SLASH}*${OE}${DELSUF} - ${DELPRE} ${CPUDIR}${SLASH}*${OE}${SEP} ${GUIDIR}${SLASH}*${OE}${DELSUF} - ${DELPRE} ${JMADIR}${SLASH}*${OE}${SEP} ${MMLIBDIR}${SLASH}*${OE}${DELSUF} - ${DELPRE} ${EFFECTSDIR}${SLASH}*${OE}${SEP} ${ZIPDIR}${SLASH}*${OE}${DELSUF} - ${DELPRE} ${DOSDIR}${SLASH}*${OE}${SEP} ${WINDIR}${SLASH}*${OE}${DELSUF} - ${DELPRE} ${CHIPDIR}${SLASH}*${OE}${SEP} ${VIDEODIR}${SLASH}*${OE}${DELSUF} -else - @echo Please specify which platform to clean for with PLATFORM=platform_name -endif diff --git a/tools/zsnes/src/md.psr b/tools/zsnes/src/md.psr deleted file mode 100644 index 0634b83..0000000 --- a/tools/zsnes/src/md.psr +++ /dev/null @@ -1,71 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 PSR_HASH - -md_raw_file times 50 db "rawvideo.bin" @ Only for Raw Videos -md_pcm_audio times 50 db "audio.wav" @ AVI dumping always dumps audio seperatly -md_compressed_audio times 50 db "audio.mp3" @ For when selecting compressed -md_logo times 50 db "" @If you want a logo, specify a logo file. It should be a series of frames 256x224x24. -@ -md_ntsc times 20 db "59649/995" -md_pal times 5 db "50/1" -@ -md_file times 50 db "video.avi" -md_prog times 50 db "mencoder" -md_raw times 150 db "-demuxer rawvideo -rawvideo format=0x42475218:w=256:h=224:size=172032:fps=$md_video_rate" -md_other times 75 db "-aspect 4:3 -mc 0" -md_no_sound times 25 db "-nosound" -md_sound times 100 db "-oac mp3lame -lameopts aq=0:preset=64:mode=1 -audiofile $md_pcm_audio" -md_compressed_sound times 100 db "-oac copy -audiofile $md_compressed_audio" -md_x264 times 100 db "-ovc x264 -x264encopts qp=0:frameref=15" -md_ffv1 times 100 db "-ovc lavc -lavcopts vcodec=ffv1:vstrict=-2:aspect=4/3" -md_xvid times 100 db "-ovc xvid -xvidencopts fixed_quant=2" -@ -@Valid variables to use in the next four lines are: -@$md_file, $md_prog, $md_raw, $md_other, $md_no_sound, $md_sound, $md_pcm_audio, $md_compressed_audio -@and $md_video_rate, $md_vcodec, $md_smode -@These variables are defined above. -@$md_video_rate is $md_ntsc or $md_pal depending on the game as needed -@$md_vcodec is $md_x264, $md_ffv1, or $md_xvid depending on the codec selected -@$md_smode is $md_no_sound, $md_sound, or $md_compressed_sound depending on the audio options selected -@ -md_command times 256 db "$md_prog $md_other $md_no_sound $md_raw $md_vcodec -o $md_file -" -md_audio_compress times 256 db "lame -m j --preset 64 -q 0 - $md_compressed_audio" -md_merge times 256 db "$md_prog $md_other $md_smode -force-avi-aspect 4:3 -ovc copy -o merged.avi $md_file" - -@ -@Code for how the custom option works. -@ -@ These are 3 temporary variables you can use with the various passes -md_custom_temp1 times 150 db "-ovc x264 -x264encopts bframes=0:keyint=300:partitions=all:me=umh:frameref=15:subq=7:8x8dct" -md_custom_temp2 times 150 db "bitrate=350" -md_custom_temp3 times 150 db "" - -@ -@ Can use the same vars as above in addition to these temp ones. -@ Also $null for the nul file. -@ - -md_custom_passes db 3 ;How many passes should be performed, make this at least 2 -md_custom_first_pass times 512 db "$md_prog $md_other $md_no_sound $md_raw $md_custom_temp1:turbo=1:pass=1 -o $null -" -md_custom_middle_passes times 512 db "$md_prog $md_other $md_no_sound $md_raw $md_custom_temp1:$md_custom_temp2:pass=3 -o $null -" -md_custom_last_pass times 512 db "$md_prog $md_other $md_smode $md_raw $md_custom_temp1:$md_custom_temp2:pass=2 -o custom.avi -" -md_custom_pass_log_file times 50 db "divx2pass.log" -md_custom_pass_log_file2 times 50 db "divx2pass.log.temp" diff --git a/tools/zsnes/src/mmlib/linux.c b/tools/zsnes/src/mmlib/linux.c deleted file mode 100644 index de8bd25..0000000 --- a/tools/zsnes/src/mmlib/linux.c +++ /dev/null @@ -1,369 +0,0 @@ -/* -Copyright (c) 2003-2007 Ryan C. Gordon and others. - -http://icculus.org/manymouse/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from -the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not -claim that you wrote the original software. If you use this software in a -product, an acknowledgment in the product documentation would be -appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. - - Ryan C. Gordon -*/ - -//Support for Linux evdevs...the /dev/input/event* devices. - -#include "mm.h" - -#ifdef __linux__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include /* evdev interface... */ - -#define test_bit(array, bit) (array[bit/8] & (1<<(bit%8))) - -/* linux allows 32 evdev nodes currently. */ -#define MAX_MICE 32 -typedef struct -{ - int fd; - int min_x; - int min_y; - int max_x; - int max_y; - char name[64]; -} MouseStruct; - -static MouseStruct mice[MAX_MICE]; -static unsigned int available_mice = 0; - - -static int poll_mouse(MouseStruct *mouse, ManyMouseEvent *outevent) -{ - int unhandled = 1; - while (unhandled) /* read until failure or valid event. */ - { - struct input_event event; - int br = read(mouse->fd, &event, sizeof (event)); - if (br == -1) - { - if (errno == EAGAIN) - return(0); /* just no new data at the moment. */ - - /* mouse was unplugged? */ - close(mouse->fd); /* stop reading from this mouse. */ - mouse->fd = -1; - outevent->type = MANYMOUSE_EVENT_DISCONNECT; - return(1); - } /* if */ - - if (br != sizeof (event)) - return(0); /* oh well. */ - - unhandled = 0; /* will reset if necessary. */ - outevent->value = event.value; - if (event.type == EV_REL) - { - outevent->type = MANYMOUSE_EVENT_RELMOTION; - if ((event.code == REL_X) || (event.code == REL_DIAL)) - outevent->item = 0; - else if (event.code == REL_Y) - outevent->item = 1; - - else if (event.code == REL_WHEEL) - { - outevent->type = MANYMOUSE_EVENT_SCROLL; - outevent->item = 0; - } /* else if */ - - else if (event.code == REL_HWHEEL) - { - outevent->type = MANYMOUSE_EVENT_SCROLL; - outevent->item = 1; - } /* else if */ - - else - { - unhandled = 1; - } /* else */ - } /* if */ - - else if (event.type == EV_ABS) - { - outevent->type = MANYMOUSE_EVENT_ABSMOTION; - if (event.code == ABS_X) - { - outevent->item = 0; - outevent->minval = mouse->min_x; - outevent->maxval = mouse->max_x; - } /* if */ - else if (event.code == ABS_Y) - { - outevent->item = 1; - outevent->minval = mouse->min_y; - outevent->maxval = mouse->max_y; - } /* if */ - else - { - unhandled = 1; - } /* else */ - } /* else if */ - - else if (event.type == EV_KEY) - { - outevent->type = MANYMOUSE_EVENT_BUTTON; - if ((event.code >= BTN_LEFT) && (event.code <= BTN_BACK)) - outevent->item = event.code - BTN_MOUSE; - - /* just in case some device uses this block of events instead... */ - else if ((event.code >= BTN_MISC) && (event.code <= BTN_LEFT)) - outevent->item = (event.code - BTN_MISC); - - else if (event.code == BTN_TOUCH) /* tablet... */ - outevent->item = 0; - else if (event.code == BTN_STYLUS) /* tablet... */ - outevent->item = 1; - else if (event.code == BTN_STYLUS2) /* tablet... */ - outevent->item = 2; - - else - { - /*printf("unhandled mouse button: 0x%X\n", event.code);*/ - unhandled = 1; - } /* else */ - } /* else if */ - else - { - unhandled = 1; - } /* else */ - } /* while */ - - return(1); /* got a valid event */ -} /* poll_mouse */ - - -static int init_mouse(const char *fname, int fd) -{ - MouseStruct *mouse = &mice[available_mice]; - int has_absolutes = 0; - int is_mouse = 0; - unsigned char relcaps[(REL_MAX / 8) + 1]; - unsigned char abscaps[(ABS_MAX / 8) + 1]; - unsigned char keycaps[(KEY_MAX / 8) + 1]; - - memset(relcaps, '\0', sizeof (relcaps)); - memset(abscaps, '\0', sizeof (abscaps)); - memset(keycaps, '\0', sizeof (keycaps)); - - if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof (keycaps)), keycaps) == -1) - return 0; /* gotta have some buttons! :) */ - - if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof (relcaps)), relcaps) != -1) - { - if ( (test_bit(relcaps, REL_X)) && (test_bit(relcaps, REL_Y)) ) - { - if (test_bit(keycaps, BTN_MOUSE)) - is_mouse = 1; - } /* if */ - - #if ALLOW_DIALS_TO_BE_MICE - if (test_bit(relcaps, REL_DIAL)) - is_mouse = 1; // griffin powermate? - #endif - } /* if */ - - if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof (abscaps)), abscaps) != -1) - { - if ( (test_bit(abscaps, ABS_X)) && (test_bit(abscaps, ABS_Y)) ) - { - /* might be a touchpad... */ - if (test_bit(keycaps, BTN_TOUCH)) - { - is_mouse = 1; /* touchpad, touchscreen, or tablet. */ - has_absolutes = 1; - } /* if */ - } /* if */ - } /* if */ - - if (!is_mouse) - return 0; - - mouse->min_x = mouse->min_y = mouse->max_x = mouse->max_y = 0; - if (has_absolutes) - { - struct - { - int value; - int minimum; - int maximum; - int fuzz; - int flat; - } absinfo; - if (ioctl(fd, EVIOCGABS(ABS_X), &absinfo) == -1) - return 0; - mouse->min_x = absinfo.minimum; - mouse->max_x = absinfo.maximum; - - if (ioctl(fd, EVIOCGABS(ABS_Y), &absinfo) == -1) - return 0; - mouse->min_y = absinfo.minimum; - mouse->max_y = absinfo.maximum; - } /* if */ - - if (ioctl(fd, EVIOCGNAME(sizeof (mouse->name)), mouse->name) == -1) - snprintf(mouse->name, sizeof (mouse->name), "Unknown device"); - - mouse->fd = fd; - - return 1; /* we're golden. */ -} /* init_mouse */ - - -/* Return a file descriptor if this is really a mouse, -1 otherwise. */ -static int open_if_mouse(const char *fname) -{ - struct stat statbuf; - int fd; - int devmajor, devminor; - - if (stat(fname, &statbuf) == -1) - return 0; - - if (S_ISCHR(statbuf.st_mode) == 0) - return 0; /* not a character device... */ - - /* evdev node ids are major 13, minor 64-96. Is this safe to check? */ - devmajor = (statbuf.st_rdev & 0xFF00) >> 8; - devminor = (statbuf.st_rdev & 0x00FF); - if ( (devmajor != 13) || (devminor < 64) || (devminor > 96) ) - return 0; /* not an evdev. */ - - if ((fd = open(fname, O_RDONLY | O_NONBLOCK)) == -1) - return 0; - - if (init_mouse(fname, fd)) - return 1; - - close(fd); - return 0; -} /* open_if_mouse */ - - -static int linux_evdev_init(void) -{ - DIR *dirp; - struct dirent *dent; - int i; - - for (i = 0; i < MAX_MICE; i++) - mice[i].fd = -1; - - dirp = opendir("/dev/input"); - if (!dirp) - return -1; - - while ((dent = readdir(dirp)) != NULL) - { - char fname[128]; - snprintf(fname, sizeof (fname), "/dev/input/%s", dent->d_name); - if (open_if_mouse(fname)) - available_mice++; - } /* while */ - - closedir(dirp); - - return available_mice; -} /* linux_evdev_init */ - - -static void linux_evdev_quit(void) -{ - while (available_mice) - { - int fd = mice[available_mice--].fd; - if (fd != -1) - close(fd); - } /* while */ -} /* linux_evdev_quit */ - - -static const char *linux_evdev_name(unsigned int index) -{ - if (index < available_mice) - return(mice[index].name); - return(NULL); -} /* linux_evdev_name */ - - -static int linux_evdev_poll(ManyMouseEvent *event) -{ - /* - * (i) is static so we iterate through all mice round-robin. This - * prevents a chatty mouse from dominating the queue. - */ - static unsigned int i = 0; - - if (i >= available_mice) - i = 0; /* handle reset condition. */ - - if (event != NULL) - { - while (i < available_mice) - { - MouseStruct *mouse = &mice[i]; - if (mouse->fd != -1) - { - if (poll_mouse(mouse, event)) - { - event->device = i; - return(1); - } /* if */ - } /* if */ - i++; - } /* while */ - } /* if */ - - return(0); /* no new events */ -} /* linux_evdev_poll */ - -#else - -static int linux_evdev_init(void) { return(-1); } -static void linux_evdev_quit(void) {} -static const char *linux_evdev_name(unsigned int index) { return(0); } -static int linux_evdev_poll(ManyMouseEvent *event) { return(0); } - -#endif /* defined __linux__ */ - -ManyMouseDriver ManyMouseDriver_evdev = -{ - linux_evdev_init, - linux_evdev_quit, - linux_evdev_name, - linux_evdev_poll -}; - -/* end of linux_evdev.c ... */ diff --git a/tools/zsnes/src/mmlib/mm.c b/tools/zsnes/src/mmlib/mm.c deleted file mode 100644 index 2cb356e..0000000 --- a/tools/zsnes/src/mmlib/mm.c +++ /dev/null @@ -1,114 +0,0 @@ -/* -Copyright (c) 2003-2007 Ryan C. Gordon and others. - -http://icculus.org/manymouse/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from -the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not -claim that you wrote the original software. If you use this software in a -product, an acknowledgment in the product documentation would be -appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. - - Ryan C. Gordon -*/ - -//ManyMouse foundation code; apps talks to this and it talks to the lowlevel -//code for various platforms. - -#include -#include "mm.h" - -static const char *manymouse_copyright = - "ManyMouse " MANYMOUSE_VERSION " (c) 2003-2007 Ryan C. Gordon."; - -extern const ManyMouseDriver ManyMouseDriver_windows; -extern const ManyMouseDriver ManyMouseDriver_evdev; -extern const ManyMouseDriver ManyMouseDriver_hidmanager; -extern const ManyMouseDriver ManyMouseDriver_xinput; - -static const ManyMouseDriver *mice_drivers[] = -{ - #if SUPPORT_XINPUT - &ManyMouseDriver_xinput, - #endif - #ifdef __linux__ - &ManyMouseDriver_evdev, - #endif - #if ((defined _WIN32) || defined(__CYGWIN__)) - &ManyMouseDriver_windows, - #endif - #if ((defined(__MACH__)) && (defined(__APPLE__))) - &ManyMouseDriver_hidmanager, - #endif - NULL -}; - - -static const ManyMouseDriver *driver = NULL; - -int ManyMouse_Init(void) -{ - int i; - int retval = -1; - - /* impossible test to keep manymouse_copyright linked into the binary. */ - if (manymouse_copyright == NULL) - return(-1); - - if (driver != NULL) - return(-1); - - for (i = 0; mice_drivers[i]; i++) - { - int mice = mice_drivers[i]->init(); - - if (mice > retval) - retval = mice; /* may just move from "error" to "no mice found". */ - - if (mice > 0) - { - driver = mice_drivers[i]; - break; - } /* if */ - } /* for */ - - return(retval); -} /* ManyMouse_Init */ - - -void ManyMouse_Quit(void) -{ - if (driver != NULL) - driver->quit(); - driver = NULL; -} /* ManyMouse_Quit */ - - -const char *ManyMouse_DeviceName(unsigned int index) -{ - if (driver != NULL) - return(driver->name(index)); - return(NULL); -} /* ManyMouse_PollEvent */ - - -int ManyMouse_PollEvent(ManyMouseEvent *event) -{ - if (driver != NULL) - return(driver->poll(event)); - return(0); -} /* ManyMouse_PollEvent */ - -/* end of manymouse.c ... */ diff --git a/tools/zsnes/src/mmlib/mm.h b/tools/zsnes/src/mmlib/mm.h deleted file mode 100644 index 3efd779..0000000 --- a/tools/zsnes/src/mmlib/mm.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright (c) 2003-2007 Ryan C. Gordon and others. - -http://icculus.org/manymouse/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from -the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not -claim that you wrote the original software. If you use this software in a -product, an acknowledgment in the product documentation would be -appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. - - Ryan C. Gordon -*/ - -//ManyMouse main header. Include this from your app. - -#ifndef _INCLUDE_MANYMOUSE_H_ -#define _INCLUDE_MANYMOUSE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#define MANYMOUSE_VERSION "0.0.1" - -typedef enum -{ - MANYMOUSE_EVENT_ABSMOTION = 0, - MANYMOUSE_EVENT_RELMOTION, - MANYMOUSE_EVENT_BUTTON, - MANYMOUSE_EVENT_SCROLL, - MANYMOUSE_EVENT_DISCONNECT, - MANYMOUSE_EVENT_MAX -} ManyMouseEventType; - -typedef struct -{ - ManyMouseEventType type; - unsigned int device; - unsigned int item; - int value; - int minval; - int maxval; -} ManyMouseEvent; - - -/* internal use only. */ -typedef struct -{ - int (*init)(void); - void (*quit)(void); - const char *(*name)(unsigned int index); - int (*poll)(ManyMouseEvent *event); -} ManyMouseDriver; - - -int ManyMouse_Init(void); -void ManyMouse_Quit(void); -const char *ManyMouse_DeviceName(unsigned int index); -int ManyMouse_PollEvent(ManyMouseEvent *event); - -#ifdef __cplusplus -} -#endif - -#endif /* !defined _INCLUDE_MANYMOUSE_H_ */ - -/* end of manymouse.h ... */ - diff --git a/tools/zsnes/src/mmlib/osx.c b/tools/zsnes/src/mmlib/osx.c deleted file mode 100644 index 13b354a..0000000 --- a/tools/zsnes/src/mmlib/osx.c +++ /dev/null @@ -1,1690 +0,0 @@ -/* -Copyright (c) 2003-2007 Ryan C. Gordon and others. - -http://icculus.org/manymouse/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from -the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not -claim that you wrote the original software. If you use this software in a -product, an acknowledgment in the product documentation would be -appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. - - Ryan C. Gordon -*/ - -//Support for MacOS X via the HID Manager APIs. - -#include "mm.h" - -#if ( (defined(__MACH__)) && (defined(__APPLE__)) ) - -/* - * This source is almost entirely lifted from Apple's HID Utilities - * example source code, written by George Warner: - * - * http://developer.apple.com/samplecode/HID_Utilities_Source/HID_Utilities_Source.html - * - * The source license to HID Utilities allows this sort of blatant stealing. - * - * Patches to HID Utilities have comments like "ryan added this", otherwise, - * I just tried to cut down that package to the smallest set of functions - * I needed. - * - * Scroll down for "-- END HID UTILITIES --" to see the ManyMouse glue code. - */ - -#include - -#include -// 10.0.x -//#include -// 10.1.x -#include -#include -#include -#include -#include - -#define USE_NOTIFICATIONS 1 - -#define HIDREPORTERRORNUM(s,n) do {} while (false) -#define HIDREPORTERROR(s) do {} while (false) - -typedef enum HIDElementTypeMask -{ - kHIDElementTypeInput = 1 << 1, - kHIDElementTypeOutput = 1 << 2, - kHIDElementTypeFeature = 1 << 3, - kHIDElementTypeCollection = 1 << 4, - kHIDElementTypeIO = kHIDElementTypeInput | kHIDElementTypeOutput | kHIDElementTypeFeature, - kHIDElementTypeAll = kHIDElementTypeIO | kHIDElementTypeCollection -}HIDElementTypeMask; - -enum -{ - kDefaultUserMin = 0, // default user min and max used for scaling - kDefaultUserMax = 255 -}; - -enum -{ - kDeviceQueueSize = 50 // this is wired kernel memory so should be set to as small as possible - // but should account for the maximum possible events in the queue - // USB updates will likely occur at 100 Hz so one must account for this rate of - // if states change quickly (updates are only posted on state changes) -}; - -struct recElement -{ - unsigned long type; // the type defined by IOHIDElementType in IOHIDKeys.h - long usagePage; // usage page from IOUSBHIDParser.h which defines general usage - long usage; // usage within above page from IOUSBHIDParser.h which defines specific usage - void * cookie; // unique value (within device of specific vendorID and productID) which identifies element, will NOT change - long min; // reported min value possible - long max; // reported max value possible - long scaledMin; // reported scaled min value possible - long scaledMax; // reported scaled max value possible - long size; // size in bits of data return from element - unsigned char relative; // are reports relative to last report (deltas) - unsigned char wrapping; // does element wrap around (one value higher than max is min) - unsigned char nonLinear; // are the values reported non-linear relative to element movement - unsigned char preferredState; // does element have a preferred state (such as a button) - unsigned char nullState; // does element have null state - long units; // units value is reported in (not used very often) - long unitExp; // exponent for units (also not used very often) - char name[256]; // name of element (c string) - -// runtime variables - long calMin; // min returned value - long calMax; // max returned value (calibrate call) - long userMin; // user set value to scale to (scale call) - long userMax; - - struct recElement * pPrevious; // previous element (NULL at list head) - struct recElement * pChild; // next child (only of collections) - struct recElement * pSibling; // next sibling (for elements and collections) - - long depth; -}; -typedef struct recElement recElement; -typedef recElement* pRecElement; - -// ryan added this. -typedef enum -{ - DISCONNECT_CONNECTED, - DISCONNECT_TELLUSER, - DISCONNECT_COMPLETE -} DisconnectState; - -struct recDevice -{ - void * interface; // interface to device, NULL = no interface - void * queue; // device queue, NULL = no queue - void * queueRunLoopSource; // device queue run loop source, NULL == no source - void * transaction; // output transaction interface, NULL == no interface - void * notification; // notifications - char transport[256]; // device transport (c string) - long vendorID; // id for device vendor, unique across all devices - long productID; // id for particular product, unique across all of a vendors devices - long version; // version of product - char manufacturer[256]; // name of manufacturer - char product[256]; // name of product - char serial[256]; // serial number of specific product, can be assumed unique across specific product or specific vendor (not used often) - long locID; // long representing location in USB (or other I/O) chain which device is pluged into, can identify specific device on machine - long usage; // usage page from IOUSBHID Parser.h which defines general usage - long usagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage - long totalElements; // number of total elements (should be total of all elements on device including collections) (calculated, not reported by device) - long features; // number of elements of type kIOHIDElementTypeFeature - long inputs; // number of elements of type kIOHIDElementTypeInput_Misc or kIOHIDElementTypeInput_Button or kIOHIDElementTypeInput_Axis or kIOHIDElementTypeInput_ScanCodes - long outputs; // number of elements of type kIOHIDElementTypeOutput - long collections; // number of elements of type kIOHIDElementTypeCollection - long axis; // number of axis (calculated, not reported by device) - long buttons; // number of buttons (calculated, not reported by device) - long hats; // number of hat switches (calculated, not reported by device) - long sliders; // number of sliders (calculated, not reported by device) - long dials; // number of dials (calculated, not reported by device) - long wheels; // number of wheels (calculated, not reported by device) - recElement* pListElements; // head of linked list of elements - DisconnectState disconnect; // (ryan added this.) - AbsoluteTime lastScrollTime; // (ryan added this.) - struct recDevice* pNext; // next device -}; -typedef struct recDevice recDevice; -typedef recDevice* pRecDevice; - - -#if USE_NOTIFICATIONS -static IONotificationPortRef gNotifyPort; -static io_iterator_t gAddedIter; -static CFRunLoopRef gRunLoop; -#endif USE_NOTIFICATIONS - -// for element retrieval -static pRecDevice gCurrentGetDevice = NULL; -static Boolean gAddAsChild = false; -static int gDepth = false; - -static pRecDevice gpDeviceList = NULL; -static UInt32 gNumDevices = 0; - -static Boolean HIDIsValidDevice(const pRecDevice pSearchDevice); -static pRecElement HIDGetFirstDeviceElement (pRecDevice pDevice, HIDElementTypeMask typeMask); -static pRecElement HIDGetNextDeviceElement (pRecElement pElement, HIDElementTypeMask typeMask); -static pRecDevice HIDGetFirstDevice (void); -static pRecDevice HIDGetNextDevice (pRecDevice pDevice); -static void HIDReleaseDeviceList (void); -static unsigned long HIDDequeueDevice (pRecDevice pDevice); -static void hid_GetElements (CFTypeRef refElementCurrent, pRecElement *ppCurrentElement); - - -static void HIDReportError(const char *err) {} -static void HIDReportErrorNum(const char *err, int num) {} - - -static void hid_GetCollectionElements (CFMutableDictionaryRef deviceProperties, pRecElement *ppCurrentCollection) -{ - CFTypeRef refElementTop = CFDictionaryGetValue (deviceProperties, CFSTR(kIOHIDElementKey)); - if (refElementTop) - hid_GetElements (refElementTop, ppCurrentCollection); - else - HIDReportError ("hid_GetCollectionElements: CFDictionaryGetValue error when creating CFTypeRef for kIOHIDElementKey."); -} - - -// extracts actual specific element information from each element CF dictionary entry -static void hid_GetElementInfo (CFTypeRef refElement, pRecElement pElement) -{ - long number; - CFTypeRef refType; - // type, usagePage, usage already stored - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementCookieKey)); - if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number)) - pElement->cookie = (IOHIDElementCookie) number; - else - pElement->cookie = (IOHIDElementCookie) 0; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementMinKey)); - if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number)) - pElement->min = number; - else - pElement->min = 0; - - pElement->calMax = pElement->min; - pElement->userMin = kDefaultUserMin; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementMaxKey)); - if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number)) - pElement->max = number; - else - pElement->max = 0; - - pElement->calMin = pElement->max; - pElement->userMax = kDefaultUserMax; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementScaledMinKey)); - if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number)) - pElement->scaledMin = number; - else - pElement->scaledMin = 0; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementScaledMaxKey)); - if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number)) - pElement->scaledMax = number; - else - pElement->scaledMax = 0; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementSizeKey)); - if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number)) - pElement->size = number; - else - pElement->size = 0; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsRelativeKey)); - if (refType) - pElement->relative = CFBooleanGetValue (refType); - else - pElement->relative = 0; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsWrappingKey)); - if (refType) - pElement->wrapping = CFBooleanGetValue (refType); - else - pElement->wrapping = false; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsNonLinearKey)); - if (refType) - pElement->nonLinear = CFBooleanGetValue (refType); - else - pElement->wrapping = false; - -#ifdef kIOHIDElementHasPreferredStateKey - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementHasPreferredStateKey)); -#else // Mac OS X 10.0 has spelling error - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementHasPreferedStateKey)); -#endif - if (refType) - pElement->preferredState = CFBooleanGetValue (refType); - else - pElement->preferredState = false; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementHasNullStateKey)); - if (refType) - pElement->nullState = CFBooleanGetValue (refType); - else - pElement->nullState = false; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementUnitKey)); - if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number)) - pElement->units = number; - else - pElement->units = 0; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementUnitExponentKey)); - if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number)) - pElement->unitExp = number; - else - pElement->unitExp = 0; - - refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementNameKey)); - if (refType) - if (!CFStringGetCString (refType, pElement->name, 256, CFStringGetSystemEncoding ())) - HIDReportError ("CFStringGetCString error retrieving pElement->name."); - - #if 0 - if (!*pElement->name) - { - // set name from vendor id, product id & usage info look up - if (!HIDGetElementNameFromVendorProductUsage (gCurrentGetDevice->vendorID, gCurrentGetDevice->productID, pElement->usagePage, pElement->usage, pElement->name)) - { - // set name from vendor id/product id look up - HIDGetElementNameFromVendorProductCookie (gCurrentGetDevice->vendorID, gCurrentGetDevice->productID, (long) pElement->cookie, pElement->name); - if (!*pElement->name) { // if no name - HIDGetUsageName (pElement->usagePage, pElement->usage, pElement->name); - if (!*pElement->name) // if not usage - sprintf (pElement->name, "Element"); - } - } - } - #endif -} - - -static void hid_AddElement (CFTypeRef refElement, pRecElement * ppElementCurrent) -{ - pRecDevice pDevice = gCurrentGetDevice; - pRecElement pElement = NULL; - long elementType, usagePage, usage; - CFTypeRef refElementType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementTypeKey)); - CFTypeRef refUsagePage = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementUsagePageKey)); - CFTypeRef refUsage = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementUsageKey)); - - if (refElementType) - CFNumberGetValue (refElementType, kCFNumberLongType, &elementType); - if (refUsagePage) - CFNumberGetValue (refUsagePage, kCFNumberLongType, &usagePage); - if (refUsage) - CFNumberGetValue (refUsage, kCFNumberLongType, &usage); - - if (NULL == pDevice) - return; - - if (elementType) - { - // look at types of interest - if (elementType != kIOHIDElementTypeCollection) - { - if (usagePage && usage) // if valid usage and page - { - switch (usagePage) // only interested in kHIDPage_GenericDesktop and kHIDPage_Button - { - case kHIDPage_GenericDesktop: - { - switch (usage) // look at usage to determine function - { - case kHIDUsage_GD_X: - case kHIDUsage_GD_Y: - case kHIDUsage_GD_Z: - case kHIDUsage_GD_Rx: - case kHIDUsage_GD_Ry: - case kHIDUsage_GD_Rz: - pElement = (pRecElement) malloc (sizeof (recElement)); - if (pElement) pDevice->axis++; - break; - case kHIDUsage_GD_Slider: - pElement = (pRecElement) malloc (sizeof (recElement)); - if (pElement) pDevice->sliders++; - break; - case kHIDUsage_GD_Dial: - pElement = (pRecElement) malloc (sizeof (recElement)); - if (pElement) pDevice->dials++; - break; - case kHIDUsage_GD_Wheel: - pElement = (pRecElement) malloc (sizeof (recElement)); - if (pElement) pDevice->wheels++; - break; - case kHIDUsage_GD_Hatswitch: - pElement = (pRecElement) malloc (sizeof (recElement)); - if (pElement) pDevice->hats++; - break; - default: - pElement = (pRecElement) malloc (sizeof (recElement)); - break; - } - } - break; - case kHIDPage_Button: - pElement = (pRecElement) malloc (sizeof (recElement)); - if (pElement) pDevice->buttons++; - break; - default: - // just add a generic element - pElement = (pRecElement) malloc (sizeof (recElement)); - break; - } - } -#if 0 - else - HIDReportError ("CFNumberGetValue error when getting value for refUsage or refUsagePage."); -#endif 0 - } - else // collection - pElement = (pRecElement) malloc (sizeof (recElement)); - } - else - HIDReportError ("CFNumberGetValue error when getting value for refElementType."); - - if (pElement) // add to list - { - // this code builds a binary tree based on the collection hierarchy of inherent in the device element layout - // it preserves the structure of the lements as collections have children and elements are siblings to each other - - // clear record - bzero(pElement,sizeof(recElement)); - - // get element info - pElement->type = elementType; - pElement->usagePage = usagePage; - pElement->usage = usage; - pElement->depth = 0; // assume root object - hid_GetElementInfo (refElement, pElement); - - // count elements - pDevice->totalElements++; - - switch (pElement->type) - { - case kIOHIDElementTypeInput_Misc: - case kIOHIDElementTypeInput_Button: - case kIOHIDElementTypeInput_Axis: - case kIOHIDElementTypeInput_ScanCodes: - pDevice->inputs++; - break; - case kIOHIDElementTypeOutput: - pDevice->outputs++; - break; - case kIOHIDElementTypeFeature: - pDevice->features++; - break; - case kIOHIDElementTypeCollection: - pDevice->collections++; - break; - default: - HIDReportErrorNum ("Unknown element type : ", pElement->type); - } - - if (NULL == *ppElementCurrent) // if at list head - { - pDevice->pListElements = pElement; // add current element - *ppElementCurrent = pElement; // set current element to element we just added - } - else // have exsiting structure - { - if (gAddAsChild) // if the previous element was a collection, let's add this as a child of the previous - { - // this iteration should not be needed but there maybe some untested degenerate case which this code will ensure works - while ((*ppElementCurrent)->pChild) // step down tree until free child node found - *ppElementCurrent = (*ppElementCurrent)->pChild; - (*ppElementCurrent)->pChild = pElement; // insert there - pElement->depth = (*ppElementCurrent)->depth + 1; - } - else // add as sibling - { - // this iteration should not be needed but there maybe some untested degenerate case which this code will ensure works - while ((*ppElementCurrent)->pSibling) // step down tree until free sibling node found - *ppElementCurrent = (*ppElementCurrent)->pSibling; - (*ppElementCurrent)->pSibling = pElement; // insert there - pElement->depth = (*ppElementCurrent)->depth; - } - pElement->pPrevious = *ppElementCurrent; // point to previous - *ppElementCurrent = pElement; // set current to our collection - } - - if (elementType == kIOHIDElementTypeCollection) // if this element is a collection of other elements - { - gAddAsChild = true; // add next set as children to this element - gDepth++; - hid_GetCollectionElements ((CFMutableDictionaryRef) refElement, &pElement); // recursively process the collection - gDepth--; - } - gAddAsChild = false; // add next as this elements sibling (when return from a collection or with non-collections) - } -#if 0 - else - HIDReportError ("hid_AddElement - no element added."); -#endif -} - - -static void hid_GetElementsCFArrayHandler (const void * value, void * parameter) -{ - if (CFGetTypeID (value) == CFDictionaryGetTypeID ()) - hid_AddElement ((CFTypeRef) value, (pRecElement *) parameter); -} - -// --------------------------------- -// handles retrieval of element information from arrays of elements in device IO registry information - -static void hid_GetElements (CFTypeRef refElementCurrent, pRecElement *ppCurrentElement) -{ - CFTypeID type = CFGetTypeID (refElementCurrent); - if (type == CFArrayGetTypeID()) // if element is an array - { - CFRange range = {0, CFArrayGetCount (refElementCurrent)}; - // CountElementsCFArrayHandler called for each array member - CFArrayApplyFunction (refElementCurrent, range, hid_GetElementsCFArrayHandler, ppCurrentElement); - } -} - -static void hid_TopLevelElementHandler (const void * value, void * parameter) -{ - CFTypeRef refCF = 0; - if ((NULL == value) || (NULL == parameter)) - return; // (kIOReturnBadArgument) - if (CFGetTypeID (value) != CFDictionaryGetTypeID ()) - return; // (kIOReturnBadArgument) - refCF = CFDictionaryGetValue (value, CFSTR(kIOHIDElementUsagePageKey)); - if (!CFNumberGetValue (refCF, kCFNumberLongType, &((pRecDevice) parameter)->usagePage)) - HIDReportError ("CFNumberGetValue error retrieving pDevice->usagePage."); - refCF = CFDictionaryGetValue (value, CFSTR(kIOHIDElementUsageKey)); - if (!CFNumberGetValue (refCF, kCFNumberLongType, &((pRecDevice) parameter)->usage)) - HIDReportError ("CFNumberGetValue error retrieving pDevice->usage."); -} - - -static void hid_GetDeviceInfo (io_object_t hidDevice, CFMutableDictionaryRef hidProperties, pRecDevice pDevice) -{ - CFMutableDictionaryRef usbProperties = 0; - io_registry_entry_t parent1, parent2; - - // Mac OS X currently is not mirroring all USB properties to HID page so need to look at USB device page also - // get dictionary for usb properties: step up two levels and get CF dictionary for USB properties - if ((KERN_SUCCESS == IORegistryEntryGetParentEntry (hidDevice, kIOServicePlane, &parent1)) && - (KERN_SUCCESS == IORegistryEntryGetParentEntry (parent1, kIOServicePlane, &parent2)) && - (KERN_SUCCESS == IORegistryEntryCreateCFProperties (parent2, &usbProperties, kCFAllocatorDefault, kNilOptions))) - { - if (usbProperties) - { - CFTypeRef refCF = 0; - // get device info - // try hid dictionary first, if fail then go to usb dictionary - - // get transport - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDTransportKey)); - if (refCF) - { - if (!CFStringGetCString (refCF, pDevice->transport, 256, CFStringGetSystemEncoding ())) - HIDReportError ("CFStringGetCString error retrieving pDevice->transport."); - } - - // get vendorID - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDVendorIDKey)); - if (!refCF) - refCF = CFDictionaryGetValue (usbProperties, CFSTR("idVendor")); - if (refCF) - { - if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->vendorID)) - HIDReportError ("CFNumberGetValue error retrieving pDevice->vendorID."); - } - - // get product ID - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDProductIDKey)); - if (!refCF) - refCF = CFDictionaryGetValue (usbProperties, CFSTR("idProduct")); - if (refCF) - { - if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->productID)) - HIDReportError ("CFNumberGetValue error retrieving pDevice->productID."); - } - - // get product version - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDVersionNumberKey)); - if (refCF) - { - if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->version)) - HIDReportError ("CFNumberGetValue error retrieving pDevice->version."); - } - - // get manufacturer name - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDManufacturerKey)); - if (!refCF) - refCF = CFDictionaryGetValue (usbProperties, CFSTR("USB Vendor Name")); - if (refCF) - { - if (!CFStringGetCString (refCF, pDevice->manufacturer, 256, CFStringGetSystemEncoding ())) - HIDReportError ("CFStringGetCString error retrieving pDevice->manufacturer."); - } - - // get product name - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDProductKey)); - if (!refCF) - refCF = CFDictionaryGetValue (usbProperties, CFSTR("USB Product Name")); - if (refCF) - { - if (!CFStringGetCString (refCF, pDevice->product, 256, CFStringGetSystemEncoding ())) - HIDReportError ("CFStringGetCString error retrieving pDevice->product."); - } - - // get serial - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDSerialNumberKey)); - if (refCF) - { - if (!CFStringGetCString (refCF, pDevice->serial, 256, CFStringGetSystemEncoding ())) - HIDReportError ("CFStringGetCString error retrieving pDevice->serial."); - } - - // get location ID - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDLocationIDKey)); - if (!refCF) - refCF = CFDictionaryGetValue (usbProperties, CFSTR("locationID")); - if (refCF) - { - if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->locID)) - HIDReportError ("CFNumberGetValue error retrieving pDevice->locID."); - } - - // get usage page and usage - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDPrimaryUsagePageKey)); - if (refCF) - { - if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->usagePage)) - HIDReportError ("CFNumberGetValue error retrieving pDevice->usagePage."); - refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDPrimaryUsageKey)); - if (refCF) - if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->usage)) - HIDReportError ("CFNumberGetValue error retrieving pDevice->usage."); - } - if (NULL == refCF) // get top level element HID usage page or usage - { - // use top level element instead - CFTypeRef refCFTopElement = 0; - refCFTopElement = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDElementKey)); - { - // refCFTopElement points to an array of element dictionaries - CFRange range = {0, CFArrayGetCount (refCFTopElement)}; - CFArrayApplyFunction (refCFTopElement, range, hid_TopLevelElementHandler, NULL); - } - } - } - else - HIDReportError ("IORegistryEntryCreateCFProperties failed to create usbProperties."); - - CFRelease (usbProperties); - if (kIOReturnSuccess != IOObjectRelease (parent2)) - HIDReportError ("IOObjectRelease error with parent2."); - if (kIOReturnSuccess != IOObjectRelease (parent1)) - HIDReportError ("IOObjectRelease error with parent1."); - } -} - - -static Boolean hid_MatchElementTypeMask (IOHIDElementType type, HIDElementTypeMask typeMask) -{ - if (typeMask & kHIDElementTypeInput) - if ((type == kIOHIDElementTypeInput_Misc) || (type == kIOHIDElementTypeInput_Button) || (type == kIOHIDElementTypeInput_Axis) || (type == kIOHIDElementTypeInput_ScanCodes)) - return true; - if (typeMask & kHIDElementTypeOutput) - if (type == kIOHIDElementTypeOutput) - return true; - if (typeMask & kHIDElementTypeFeature) - if (type == kIOHIDElementTypeFeature) - return true; - if (typeMask & kHIDElementTypeCollection) - if (type == kIOHIDElementTypeCollection) - return true; - return false; -} - -static pRecElement hid_GetDeviceElement (pRecElement pElement, HIDElementTypeMask typeMask) -{ - // we are asking for this element - if (NULL != pElement) - { - if (hid_MatchElementTypeMask (pElement->type, typeMask)) // if the type match what we are looking for - return pElement; // return the element - else - return HIDGetNextDeviceElement (pElement, typeMask); // else get the next one - } - return NULL; -} - -static unsigned long HIDCloseReleaseInterface (pRecDevice pDevice) -{ - IOReturn result = kIOReturnSuccess; - - if (HIDIsValidDevice(pDevice) && (NULL != pDevice->interface)) - { - // close the interface - result = (*(IOHIDDeviceInterface**) pDevice->interface)->close (pDevice->interface); - if (kIOReturnNotOpen == result) - { - // do nothing as device was not opened, thus can't be closed - } - else if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("HIDCloseReleaseInterface - Failed to close IOHIDDeviceInterface.", result); - //release the interface - result = (*(IOHIDDeviceInterface**) pDevice->interface)->Release (pDevice->interface); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("HIDCloseReleaseInterface - Failed to release interface.", result); - pDevice->interface = NULL; - } - return result; -} - - -// --------------------------------- -// count number of devices in global device list (gpDeviceList) -static UInt32 hid_CountCurrentDevices (void) -{ - pRecDevice pDevice = gpDeviceList; - UInt32 devices = 0; - while (pDevice) - { - devices++; - pDevice = pDevice->pNext; - } - return devices; -} - -static UInt32 HIDCountDevices (void) -{ - gNumDevices = hid_CountCurrentDevices (); - - return gNumDevices; -} - -static void hid_DisposeDeviceElements (pRecElement pElement) -{ - if (pElement) - { - if (pElement->pChild) - hid_DisposeDeviceElements (pElement->pChild); - if (pElement->pSibling) - hid_DisposeDeviceElements (pElement->pSibling); - free (pElement); - } -} - -static pRecDevice hid_DisposeDevice (pRecDevice pDevice) -{ - kern_return_t result = KERN_SUCCESS; - pRecDevice pDeviceNext = NULL; - - if (HIDIsValidDevice(pDevice)) - { - // save next device prior to disposing of this device - pDeviceNext = pDevice->pNext; - - result = HIDDequeueDevice (pDevice); -#if 0 - if (kIOReturnSuccess != result) - HIDReportErrorNum ("hid_DisposeDevice: HIDDequeueDevice error: 0x%8.8X.", result); -#endif 1 - - hid_DisposeDeviceElements (pDevice->pListElements); - pDevice->pListElements = NULL; - - result = HIDCloseReleaseInterface (pDevice); // function sanity checks interface value (now application does not own device) - if (kIOReturnSuccess != result) - HIDReportErrorNum ("hid_DisposeDevice: HIDCloseReleaseInterface error: 0x%8.8X.", result); - -#if USE_NOTIFICATIONS - if (pDevice->interface) - { - // replace (*pDevice->interface)->Release(pDevice->interface); - result = IODestroyPlugInInterface (pDevice->interface); - if (kIOReturnSuccess != result) - HIDReportErrorNum ("hid_DisposeDevice: IODestroyPlugInInterface error: 0x%8.8X.", result); - } - - if (pDevice->notification) - { - result = IOObjectRelease((io_object_t) pDevice->notification); - if (kIOReturnSuccess != result) - HIDReportErrorNum ("hid_DisposeDevice: IOObjectRelease error: 0x%8.8X.", result); - } -#endif USE_NOTIFICATIONS - - // remove this device from the device list - if (gpDeviceList == pDevice) // head of list? - gpDeviceList = pDeviceNext; - else - { - pRecDevice pDeviceTemp = pDeviceNext = gpDeviceList; // we're going to return this if we don't find ourselfs in the list - while (pDeviceTemp) - { - if (pDeviceTemp->pNext == pDevice) // found us! - { - // take us out of linked list - pDeviceTemp->pNext = pDeviceNext = pDevice->pNext; - break; - } - pDeviceTemp = pDeviceTemp->pNext; - } - } - free (pDevice); - } - - // update device count - gNumDevices = hid_CountCurrentDevices (); - - return pDeviceNext; -} - - -// --------------------------------- -// disposes and releases queue, sets queue to NULL,. -// Note: will have no effect if device or queue do not exist - -static IOReturn hid_DisposeReleaseQueue (pRecDevice pDevice) -{ - IOReturn result = kIOReturnError; // assume failure (pessimist!) - - if (HIDIsValidDevice(pDevice)) // need valid device - { - if (pDevice->queue) // and queue - { - // stop queue - result = (*(IOHIDQueueInterface**) pDevice->queue)->stop (pDevice->queue); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("hid_DisposeReleaseQueue - Failed to stop queue.", result); - // dispose of queue - result = (*(IOHIDQueueInterface**) pDevice->queue)->dispose (pDevice->queue); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("hid_DisposeReleaseQueue - Failed to dipose queue.", result); - // release the queue - result = (*(IOHIDQueueInterface**) pDevice->queue)->Release (pDevice->queue); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("hid_DisposeReleaseQueue - Failed to release queue.", result); - - pDevice->queue = NULL; - } - else - HIDREPORTERROR ("hid_DisposeReleaseQueue - no queue."); - } - else - HIDREPORTERROR ("hid_DisposeReleaseQueue - Invalid device."); - return result; -} - - -// --------------------------------- -// completely removes all elements from queue and releases queue and closes device interface -// does not release device interfaces, application must call HIDReleaseDeviceList on exit - -static unsigned long HIDDequeueDevice (pRecDevice pDevice) -{ - IOReturn result = kIOReturnSuccess; - - if (HIDIsValidDevice(pDevice)) - { - if ((pDevice->interface) && (pDevice->queue)) - { - // iterate through elements and if queued, remove - pRecElement pElement = HIDGetFirstDeviceElement (pDevice, kHIDElementTypeIO); - while (pElement) - { - if ((*(IOHIDQueueInterface**) pDevice->queue)->hasElement (pDevice->queue, pElement->cookie)) - { - result = (*(IOHIDQueueInterface**) pDevice->queue)->removeElement (pDevice->queue, pElement->cookie); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("HIDDequeueDevice - Failed to remove element from queue.", result); - } - pElement = HIDGetNextDeviceElement (pElement, kHIDElementTypeIO); - } - } - // ensure queue is disposed and released - // interface will be closed and released on call to HIDReleaseDeviceList - result = hid_DisposeReleaseQueue (pDevice); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("removeElement - Failed to dispose and release queue.", result); -#if USE_ASYNC_EVENTS - else if (NULL != pDevice->queueRunLoopSource) - { - if (CFRunLoopContainsSource(CFRunLoopGetCurrent(), pDevice->queueRunLoopSource, kCFRunLoopDefaultMode)) - CFRunLoopRemoveSource(CFRunLoopGetCurrent(), pDevice->queueRunLoopSource, kCFRunLoopDefaultMode); - CFRelease(pDevice->queueRunLoopSource); - pDevice->queueRunLoopSource = NULL; - } -#endif USE_ASYNC_EVENTS - } - else - { - HIDREPORTERROR ("HIDDequeueDevice - Invalid device."); - result = kIOReturnBadArgument; - } - return result; -} - -// --------------------------------- -// releases all device queues for quit or rebuild (must be called) -// does not release device interfaces, application must call HIDReleaseDeviceList on exit - -static unsigned long HIDReleaseAllDeviceQueues (void) -{ - IOReturn result = kIOReturnBadArgument; - pRecDevice pDevice = HIDGetFirstDevice (); - - while (pDevice) - { - result = HIDDequeueDevice (pDevice); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("HIDReleaseAllDeviceQueues - Could not dequeue device.", result); - pDevice = HIDGetNextDevice (pDevice); - } - return result; -} - - -// --------------------------------- -// Get the next event in the queue for a device -// elements or entire device should be queued prior to calling this with HIDQueueElement or HIDQueueDevice -// returns true if an event is avialable for the element and fills out *pHIDEvent structure, returns false otherwise -// Note: kIOReturnUnderrun returned from getNextEvent indicates an empty queue not an error condition -// Note: application should pass in a pointer to a IOHIDEventStruct cast to a void (for CFM compatibility) - -static unsigned char HIDGetEvent (pRecDevice pDevice, void * pHIDEvent) -{ - IOReturn result = kIOReturnBadArgument; - AbsoluteTime zeroTime = {0,0}; - - if (HIDIsValidDevice(pDevice)) - { - if (pDevice->queue) - { - result = (*(IOHIDQueueInterface**) pDevice->queue)->getNextEvent (pDevice->queue, (IOHIDEventStruct *)pHIDEvent, zeroTime, 0); - if (kIOReturnUnderrun == result) - return false; // no events in queue not an error per say - else if (kIOReturnSuccess != result) // actual error versus just an empty queue - HIDREPORTERRORNUM ("HIDGetEvent - Could not get HID event via getNextEvent.", result); - else - return true; - } - else - HIDREPORTERROR ("HIDGetEvent - queue does not exist."); - } - else - HIDREPORTERROR ("HIDGetEvent - invalid device."); - - return false; // did not get event -} - - -static unsigned long HIDCreateOpenDeviceInterface (UInt32 hidDevice, pRecDevice pDevice) -{ - IOReturn result = kIOReturnSuccess; - HRESULT plugInResult = S_OK; - SInt32 score = 0; - IOCFPlugInInterface ** ppPlugInInterface = NULL; - - if (NULL == pDevice->interface) - { - result = IOCreatePlugInInterfaceForService (hidDevice, kIOHIDDeviceUserClientTypeID, - kIOCFPlugInInterfaceID, &ppPlugInInterface, &score); - if (kIOReturnSuccess == result) - { - // Call a method of the intermediate plug-in to create the device interface - plugInResult = (*ppPlugInInterface)->QueryInterface (ppPlugInInterface, - CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), (void *) &(pDevice->interface)); - if (S_OK != plugInResult) - HIDReportErrorNum ("CouldnÕt query HID class device interface from plugInInterface", plugInResult); - IODestroyPlugInInterface (ppPlugInInterface); // replace (*ppPlugInInterface)->Release (ppPlugInInterface) - } - else - HIDReportErrorNum ("Failed to create **plugInInterface via IOCreatePlugInInterfaceForService.", result); - } - if (NULL != pDevice->interface) - { - result = (*(IOHIDDeviceInterface**)pDevice->interface)->open (pDevice->interface, 0); - if (kIOReturnSuccess != result) - HIDReportErrorNum ("Failed to open pDevice->interface via open.", result); - } - return result; -} - - -// --------------------------------- -// adds device to linked list of devices passed in (handles NULL lists properly) -// (returns where you just stored it) -static pRecDevice* hid_AddDevice (pRecDevice *ppListDeviceHead, pRecDevice pNewDevice) -{ - pRecDevice* result = NULL; - - if (NULL == *ppListDeviceHead) - result = ppListDeviceHead; - else - { - pRecDevice pDevicePrevious = NULL, pDevice = *ppListDeviceHead; - while (pDevice) - { - pDevicePrevious = pDevice; - pDevice = pDevicePrevious->pNext; - } - result = &pDevicePrevious->pNext; - } - pNewDevice->pNext = NULL; - - *result = pNewDevice; - - return result; -} - -static pRecDevice hid_BuildDevice (io_object_t hidDevice) -{ - pRecDevice pDevice = (pRecDevice) malloc (sizeof (recDevice)); - - if (NULL != pDevice) - { - // get dictionary for HID properties - CFMutableDictionaryRef hidProperties = 0; - kern_return_t result = IORegistryEntryCreateCFProperties (hidDevice, &hidProperties, kCFAllocatorDefault, kNilOptions); - - // clear record - bzero(pDevice, sizeof(recDevice)); - - if ((result == KERN_SUCCESS) && (NULL != hidProperties)) - { - pRecElement pCurrentElement = NULL; - // create device interface - result = HIDCreateOpenDeviceInterface (hidDevice, pDevice); - if (kIOReturnSuccess != result) - HIDReportErrorNum ("HIDCreateOpenDeviceInterface failed.", result); - hid_GetDeviceInfo (hidDevice, hidProperties, pDevice); // hidDevice used to find parents in registry tree - // set current device for use in getting elements - gCurrentGetDevice = pDevice; - // Add all elements - hid_GetCollectionElements (hidProperties, &pCurrentElement); - gCurrentGetDevice = NULL; - CFRelease (hidProperties); - } - else - HIDReportErrorNum ("IORegistryEntryCreateCFProperties error when creating deviceProperties.", result); - } - else - HIDReportError ("malloc error when allocating pRecDevice."); - return pDevice; -} - - - -#if USE_NOTIFICATIONS -//================================================================================================ -// -// hid_DeviceNotification -// -// This routine will get called whenever any kIOGeneralInterest notification happens. We are -// interested in the kIOMessageServiceIsTerminated message so that's what we look for. Other -// messages are defined in IOMessage.h. -// -//================================================================================================ -// -static void hid_DeviceNotification( void *refCon, - io_service_t service, - natural_t messageType, - void *messageArgument ) -{ - pRecDevice pDevice = (pRecDevice) refCon; - - if (messageType == kIOMessageServiceIsTerminated) - { - //printf("Device 0x%08x \"%s\"removed.\n", service, pDevice->product); - // ryan added this. - if (pDevice->disconnect == DISCONNECT_CONNECTED) - pDevice->disconnect = DISCONNECT_TELLUSER; - - // Free the data we're no longer using now that the device is going away - // ryan commented this out. - //hid_DisposeDevice (pDevice); - } -} -#else - -static void hid_RemovalCallbackFunction(void * target, IOReturn result, void * refcon, void * sender) -{ - // ryan commented this out. - //hid_DisposeDevice ((pRecDevice) target); - - // ryan added this. - pRecDevice = (pRecDevice) target; - if (pDevice->disconnect == DISCONNECT_CONNECTED) - pDevice->disconnect = DISCONNECT_TELLUSER; -} - -#endif USE_NOTIFICATIONS - - - -static void hid_AddDevices (void *refCon, io_iterator_t iterator) -{ - // NOTE: refcon passed in is used to point to the device list head - pRecDevice* pListDeviceHead = (pRecDevice*) refCon; - IOReturn result = kIOReturnSuccess; - io_object_t ioHIDDeviceObject = 0; - - while ((ioHIDDeviceObject = IOIteratorNext (iterator)) != 0) - { - pRecDevice* pNewDeviceAt = NULL; - pRecDevice pNewDevice = hid_BuildDevice (ioHIDDeviceObject); - if (pNewDevice) - { -#if 0 // set true for verbose output - printf("\nhid_AddDevices: pNewDevice = {t: \"%s\", v: %ld, p: %ld, v: %ld, m: \"%s\", " \ - "p: \"%s\", l: %ld, u: %4.4lX:%4.4lX, #e: %ld, #f: %ld, #i: %ld, #o: %ld, " \ - "#c: %ld, #a: %ld, #b: %ld, #h: %ld, #s: %ld, #d: %ld, #w: %ld}.", - pNewDevice->transport, - pNewDevice->vendorID, - pNewDevice->productID, - pNewDevice->version, - pNewDevice->manufacturer, - pNewDevice->product, - pNewDevice->locID, - pNewDevice->usagePage, - pNewDevice->usage, - pNewDevice->totalElements, - pNewDevice->features, - pNewDevice->inputs, - pNewDevice->outputs, - pNewDevice->collections, - pNewDevice->axis, - pNewDevice->buttons, - pNewDevice->hats, - pNewDevice->sliders, - pNewDevice->dials, - pNewDevice->wheels - ); - fflush(stdout); -#elif 0 // otherwise output brief description - printf("\nhid_AddDevices: pNewDevice = {m: \"%s\" p: \"%s\", vid: %ld, pid: %ld, loc: %8.8lX, usage: %4.4lX:%4.4lX}.", - pNewDevice->manufacturer, - pNewDevice->product, - pNewDevice->vendorID, - pNewDevice->productID, - pNewDevice->locID, - pNewDevice->usagePage, - pNewDevice->usage - ); - fflush(stdout); -#endif - pNewDeviceAt = hid_AddDevice (pListDeviceHead, pNewDevice); - } - -#if USE_NOTIFICATIONS - // Register for an interest notification of this device being removed. Use a reference to our - // private data as the refCon which will be passed to the notification callback. - result = IOServiceAddInterestNotification( gNotifyPort, // notifyPort - ioHIDDeviceObject, // service - kIOGeneralInterest, // interestType - hid_DeviceNotification, // callback - pNewDevice, // refCon - (io_object_t*) &pNewDevice->notification); // notification - if (KERN_SUCCESS != result) - HIDReportErrorNum ("hid_AddDevices: IOServiceAddInterestNotification error: x0%8.8lX.", result); -#else - result = (*(IOHIDDeviceInterface**)pNewDevice->interface)->setRemovalCallback (pNewDevice->interface, hid_RemovalCallbackFunction,pNewDeviceAt,0); -#endif USE_NOTIFICATIONS - - // release the device object, it is no longer needed - result = IOObjectRelease (ioHIDDeviceObject); - if (KERN_SUCCESS != result) - HIDReportErrorNum ("hid_AddDevices: IOObjectRelease error with ioHIDDeviceObject.", result); - } -} - - -static Boolean HIDBuildDeviceList (UInt32 usagePage, UInt32 usage) -{ - IOReturn result = kIOReturnSuccess; - mach_port_t masterPort = 0; - - if (NULL != gpDeviceList) - HIDReleaseDeviceList (); - - result = IOMasterPort (bootstrap_port, &masterPort); - if (kIOReturnSuccess != result) - HIDReportErrorNum ("IOMasterPort error with bootstrap_port.", result); - else - { - CFMutableDictionaryRef hidMatchDictionary = NULL; - - // Set up matching dictionary to search the I/O Registry for HID devices we are interested in. Dictionary reference is NULL if error. - { - CFNumberRef refUsage = NULL, refUsagePage = NULL; - - // Set up a matching dictionary to search I/O Registry by class name for all HID class devices. - hidMatchDictionary = IOServiceMatching (kIOHIDDeviceKey); - if (NULL != hidMatchDictionary) - { - if (usagePage) - { - // Add key for device type (joystick, in this case) to refine the matching dictionary. - refUsagePage = CFNumberCreate (kCFAllocatorDefault, kCFNumberLongType, &usagePage); - CFDictionarySetValue (hidMatchDictionary, CFSTR (kIOHIDPrimaryUsagePageKey), refUsagePage); - CFRelease (refUsagePage); - if (usage) - { - refUsage = CFNumberCreate (kCFAllocatorDefault, kCFNumberLongType, &usage); - CFDictionarySetValue (hidMatchDictionary, CFSTR (kIOHIDPrimaryUsageKey), refUsage); - CFRelease (refUsage); - } - } - CFRetain(hidMatchDictionary); - } - else - HIDReportError ("Failed to get HID CFMutableDictionaryRef via IOServiceMatching."); - } - -#if USE_NOTIFICATIONS - // Create a notification port and add its run loop event source to our run loop - // This is how async notifications get set up. - { - CFRunLoopSourceRef runLoopSource; - - gNotifyPort = IONotificationPortCreate(masterPort); - runLoopSource = IONotificationPortGetRunLoopSource(gNotifyPort); - - gRunLoop = CFRunLoopGetCurrent(); - CFRunLoopAddSource(gRunLoop, runLoopSource, kCFRunLoopDefaultMode); - - // Now set up a notification to be called when a device is first matched by I/O Kit. - result = IOServiceAddMatchingNotification(gNotifyPort, // notifyPort - kIOFirstMatchNotification, // notificationType - hidMatchDictionary, // matching - hid_AddDevices, // callback - &gpDeviceList, // refCon - &gAddedIter // notification - ); - - // call it now to add all existing devices - hid_AddDevices(&gpDeviceList,gAddedIter); - return true; - } -#else - { - io_iterator_t hidObjectIterator = NULL; - - // Now search I/O Registry for matching devices. - result = IOServiceGetMatchingServices (masterPort, hidMatchDictionary, &hidObjectIterator); - if (kIOReturnSuccess != result) - HIDReportErrorNum ("Failed to create IO object iterator, error:", result); - else if (NULL == hidObjectIterator) // likely no HID devices which matched selection criteria are connected - HIDReportError ("Warning: Could not find any matching devices, thus iterator creation failed."); - - if (NULL != hidObjectIterator) - { - hid_AddDevices(&gpDeviceList,hidObjectIterator); - - result = IOObjectRelease (hidObjectIterator); // release the iterator - if (kIOReturnSuccess != result) - HIDReportErrorNum ("IOObjectRelease error with hidObjectIterator.", result); - - gNumDevices = hid_CountCurrentDevices (); - return true; - } - } -#endif USE_NOTIFICATIONS - // IOServiceGetMatchingServices consumes a reference to the dictionary, so we don't need to release the dictionary ref. - hidMatchDictionary = NULL; - } - return false; -} - -// --------------------------------- -// release list built by above function -// MUST be called prior to application exit to properly release devices -// if not called (or app crashes) devices can be recovered by pluging into different location in USB chain - -static void HIDReleaseDeviceList (void) -{ - while (NULL != gpDeviceList) - gpDeviceList = hid_DisposeDevice (gpDeviceList); // dispose current device return next device will set gpDeviceList to NULL - gNumDevices = 0; -} - -// --------------------------------- -// get the first device in the device list -// returns NULL if no list exists - -static pRecDevice HIDGetFirstDevice (void) -{ - return gpDeviceList; -} - -// --------------------------------- -// get next device in list given current device as parameter -// returns NULL if end of list - -static pRecDevice HIDGetNextDevice (pRecDevice pDevice) -{ - if (NULL != pDevice) - return pDevice->pNext; - else - return NULL; -} - -// --------------------------------- -// get the first element of device passed in as parameter -// returns NULL if no list exists or device does not exists or is NULL -static pRecElement HIDGetFirstDeviceElement (pRecDevice pDevice, HIDElementTypeMask typeMask) -{ - if (HIDIsValidDevice(pDevice)) - { - if (hid_MatchElementTypeMask (pDevice->pListElements->type, typeMask)) // ensure first type matches - return pDevice->pListElements; - else - return HIDGetNextDeviceElement (pDevice->pListElements, typeMask); - } - else - return NULL; -} - -// --------------------------------- -// get next element of given device in list given current element as parameter -// will walk down each collection then to next element or collection (depthwise traverse) -// returns NULL if end of list -// uses mask of HIDElementTypeMask to restrict element found -// use kHIDElementTypeIO to get previous HIDGetNextDeviceElement functionality -static pRecElement HIDGetNextDeviceElement (pRecElement pElement, HIDElementTypeMask typeMask) -{ - // should only have elements passed in (though someone could mix calls and pass us a collection) - // collection means return the next child or sibling (in that order) - // element means returnt he next sibling (as elements can't have children - if (NULL != pElement) - { - if (pElement->pChild) - { - if (pElement->type != kIOHIDElementTypeCollection) - HIDReportError ("Malformed element list: found child of element."); - else - return hid_GetDeviceElement (pElement->pChild, typeMask); // return the child of this element - } - else if (pElement->pSibling) - { - return hid_GetDeviceElement (pElement->pSibling, typeMask); //return the sibling of this element - } - else // at end back up correctly - { - pRecElement pPreviousElement = NULL; - // malformed device ending in collection - if (pElement->type == kIOHIDElementTypeCollection) - HIDReportError ("Malformed device: found collection at end of element chain."); - // walk back up tree to element prior to first collection ecountered and take next element - while (NULL != pElement->pPrevious) - { - pPreviousElement = pElement; - pElement = pElement->pPrevious; // look at previous element - // if we have a collection and the previous element is the branch element (should have both a colection and next element attached to it) - // if we found a collection, which we are not at the sibling level that actually does have siblings - if (((pElement->type == kIOHIDElementTypeCollection) && (pPreviousElement != pElement->pSibling) && pElement->pSibling) || - // or if we are at the top - (NULL == pElement->pPrevious)) // at top of tree - break; - } - if (NULL == pElement->pPrevious) - return NULL; // got to top of list with only a collection as the first element - // now we must have been down the child route so go down the sibling route - pElement = pElement->pSibling; // element of interest - return hid_GetDeviceElement (pElement, typeMask); // otherwise return this element - } - } - return NULL; -} - - -// return true if this is a valid device pointer -Boolean HIDIsValidDevice(const pRecDevice pSearchDevice) -{ - pRecDevice pDevice = gpDeviceList; - - while (pDevice) - { - if (pDevice == pSearchDevice) - return true; - pDevice = pDevice->pNext; - } - return false; -} - - -static IOReturn hid_CreateQueue (pRecDevice pDevice) -{ - IOReturn result = kIOReturnError; // assume failure (pessimist!) - - if (HIDIsValidDevice(pDevice)) - { - if (NULL == pDevice->queue) // do we already have a queue - { - if (NULL != pDevice->interface) - { - pDevice->queue = (void *) (*(IOHIDDeviceInterface**) pDevice->interface)->allocQueue (pDevice->interface); // alloc queue - if (pDevice->queue) - { - result = (*(IOHIDQueueInterface**) pDevice->queue)->create (pDevice->queue, 0, kDeviceQueueSize); // create actual queue - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("hid_CreateQueue - Failed to create queue via create", result); - } - else - { - HIDREPORTERROR ("hid_CreateQueue - Failed to alloc IOHIDQueueInterface ** via allocQueue"); - result = kIOReturnError; // synthesis error - } - } - else - HIDREPORTERRORNUM ("hid_CreateQueue - Device inteface does not exist for queue creation", result); - } - } - else - HIDREPORTERRORNUM ("hid_CreateQueue - Invalid Device", result); - return result; -} - -static unsigned long HIDQueueDevice (pRecDevice pDevice) -{ - IOReturn result = kIOReturnError; // assume failure (pessimist!) - pRecElement pElement; - - if (HIDIsValidDevice(pDevice)) - { - // error checking - if (NULL == pDevice) - { - HIDREPORTERROR ("HIDQueueDevice - Device does not exist."); - return kIOReturnBadArgument; - } - if (NULL == pDevice->interface) // must have interface - { - HIDREPORTERROR ("HIDQueueDevice - Device does not have interface."); - return kIOReturnError; - } - if (NULL == pDevice->queue) // if no queue create queue - result = hid_CreateQueue (pDevice); - if ((kIOReturnSuccess != result) || (NULL == pDevice->queue)) - { - HIDREPORTERRORNUM ("HIDQueueDevice - problem creating queue.", result); - if (kIOReturnSuccess != result) - return result; - else - return kIOReturnError; - } - - // stop queue - result = (*(IOHIDQueueInterface**) pDevice->queue)->stop (pDevice->queue); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("HIDQueueDevice - Failed to stop queue.", result); - - // queue element - //Â¥ pElement = HIDGetFirstDeviceElement (pDevice, kHIDElementTypeIO); - pElement = HIDGetFirstDeviceElement (pDevice, kHIDElementTypeInput | kHIDElementTypeFeature); - - while (pElement) - { - if (!(*(IOHIDQueueInterface**) pDevice->queue)->hasElement (pDevice->queue, pElement->cookie)) - { - result = (*(IOHIDQueueInterface**) pDevice->queue)->addElement (pDevice->queue, pElement->cookie, 0); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("HIDQueueDevice - Failed to add element to queue.", result); - } - //Â¥ pElement = HIDGetNextDeviceElement (pElement, kHIDElementTypeIO); - pElement = HIDGetNextDeviceElement (pElement, kHIDElementTypeInput | kHIDElementTypeFeature); - } - - // start queue - result = (*(IOHIDQueueInterface**) pDevice->queue)->start (pDevice->queue); - if (kIOReturnSuccess != result) - HIDREPORTERRORNUM ("HIDQueueDevice - Failed to start queue.", result); - - } - else - HIDREPORTERROR ("HIDQueueDevice - Invalid device."); - - return result; -} - - -/* -- END HID UTILITIES -- */ - - -static int available_mice = 0; -static pRecDevice *devices = NULL; - - -/* returns non-zero if (a <= b). */ -typedef unsigned long long ui64; -static inline int oldEvent(const AbsoluteTime *a, const AbsoluteTime *b) -{ -#if 0 // !!! FIXME: doesn't work, timestamps aren't reliable. - const ui64 a64 = (((unsigned long long) a->hi) << 32) | a->lo; - const ui64 b64 = (((unsigned long long) b->hi) << 32) | b->lo; -#endif - return 0; -} /* oldEvent */ - -static int poll_mouse(pRecDevice mouse, ManyMouseEvent *outevent) -{ - int unhandled = 1; - while (unhandled) /* read until failure or valid event. */ - { - pRecElement recelem; - IOHIDEventStruct event; - - if (!HIDGetEvent(mouse, &event)) - return(0); /* no new event. */ - - unhandled = 0; /* will reset if necessary. */ - recelem = HIDGetFirstDeviceElement(mouse, kHIDElementTypeInput); - while (recelem != NULL) - { - if (recelem->cookie == event.elementCookie) - break; - recelem = HIDGetNextDeviceElement(recelem, kHIDElementTypeInput); - } /* while */ - - if (recelem == NULL) - continue; /* unknown device element. Can this actually happen? */ - - outevent->value = event.value; - if (recelem->usagePage == kHIDPage_GenericDesktop) - { - /* - * some devices (two-finger-scroll trackpads?) seem to give - * a flood of events with values of zero for every legitimate - * event. Throw these zero events out. - */ - if (outevent->value == 0) - unhandled = 1; - else - { - switch (recelem->usage) - { - case kHIDUsage_GD_X: - case kHIDUsage_GD_Y: - if (oldEvent(&event.timestamp, &mouse->lastScrollTime)) - unhandled = 1; - else - { - outevent->type = MANYMOUSE_EVENT_RELMOTION; - if (recelem->usage == kHIDUsage_GD_X) - outevent->item = 0; - else - outevent->item = 1; - } /* else */ - break; - - case kHIDUsage_GD_Wheel: - memcpy(&mouse->lastScrollTime, &event.timestamp, - sizeof (AbsoluteTime)); - outevent->type = MANYMOUSE_EVENT_SCROLL; - outevent->item = 0; /* !!! FIXME: horiz scroll? */ - break; - - default: /* !!! FIXME: absolute motion? */ - unhandled = 1; - } /* switch */ - } /* else */ - } /* if */ - - else if (recelem->usagePage == kHIDPage_Button) - { - outevent->type = MANYMOUSE_EVENT_BUTTON; - outevent->item = ((int) recelem->usage) - 1; - } /* else if */ - - else - { - unhandled = 1; - } /* else */ - } /* while */ - - return(1); /* got a valid event */ -} /* poll_mouse */ - - -static void macosx_hidmanager_quit(void) -{ - HIDReleaseAllDeviceQueues(); - HIDReleaseDeviceList(); - free(devices); - devices = NULL; - available_mice = 0; -} /* macosx_hidmanager_quit */ - - -static int macosx_hidmanager_init(void) -{ - macosx_hidmanager_quit(); /* just in case... */ - - if (!HIDBuildDeviceList(kHIDPage_GenericDesktop, kHIDUsage_GD_Mouse)) - return(-1); - - available_mice = HIDCountDevices(); - if (available_mice > 0) - { - int i; - pRecDevice dev = NULL; - - dev = HIDGetFirstDevice(); - devices = (pRecDevice *) malloc(sizeof (pRecDevice) * available_mice); - if ((devices == NULL) || (dev == NULL)) - { - macosx_hidmanager_quit(); - return(-1); - } /* if */ - - for (i = 0; i < available_mice; i++) - { - if (dev == NULL) /* what? list ended? Truncate final list... */ - available_mice = i; - - if (HIDQueueDevice(dev) == kIOReturnSuccess) - devices[i] = dev; - else /* failed? Chop this device from the list... */ - { - i--; - available_mice--; - } /* else */ - - dev = HIDGetNextDevice(dev); - } /* for */ - } /* if */ - - return(available_mice); -} /* macosx_hidmanager_init */ - - -static const char *macosx_hidmanager_name(unsigned int index) -{ - if (index >= available_mice) - return(NULL); - - return((const char *) devices[index]->product); -} /* macosx_hidmanager_name */ - - -static int macosx_hidmanager_poll(ManyMouseEvent *event) -{ - /* - * (i) is static so we iterate through all mice round-robin. This - * prevents a chatty mouse from dominating the queue. - */ - static unsigned int i = 0; - - if (i >= available_mice) - i = 0; /* handle reset condition. */ - - if (event != NULL) - { - while (i < available_mice) - { - pRecDevice dev = devices[i]; - if ((dev) && (dev->disconnect != DISCONNECT_COMPLETE)) - { - event->device = i; - - /* see if mouse was unplugged since last polling... */ - if (dev->disconnect == DISCONNECT_TELLUSER) - { - dev->disconnect = DISCONNECT_COMPLETE; - event->type = MANYMOUSE_EVENT_DISCONNECT; - return(1); - } /* if */ - - if (poll_mouse(dev, event)) - return(1); - } /* if */ - i++; - } /* while */ - } /* if */ - - return(0); /* no new events */ -} /* macosx_hidmanager_poll */ - -#else - -static int macosx_hidmanager_init(void) { return(-1); } -static void macosx_hidmanager_quit(void) {} -static const char *macosx_hidmanager_name(unsigned int index) { return(0); } -static int macosx_hidmanager_poll(ManyMouseEvent *event) { return(0); } - -#endif /* MacOSX blocker */ - -ManyMouseDriver ManyMouseDriver_hidmanager = -{ - macosx_hidmanager_init, - macosx_hidmanager_quit, - macosx_hidmanager_name, - macosx_hidmanager_poll -}; - -/* end of macosx_hidmanager.c ... */ - diff --git a/tools/zsnes/src/mmlib/windows.c b/tools/zsnes/src/mmlib/windows.c deleted file mode 100644 index e262bac..0000000 --- a/tools/zsnes/src/mmlib/windows.c +++ /dev/null @@ -1,759 +0,0 @@ -/* -Copyright (c) 2003-2007 Ryan C. Gordon and others. - -http://icculus.org/manymouse/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from -the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not -claim that you wrote the original software. If you use this software in a -product, an acknowledgment in the product documentation would be -appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. - - Ryan C. Gordon -*/ - -//Support for Windows via the WM_INPUT message. - -#include "mm.h" - -#if (defined(_WIN32) || defined(__CYGWIN__)) - -/* WinUser.h won't include rawinput stuff without this... */ -#if (_WIN32_WINNT < 0x0501) -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0501 -#endif - -#include -#include /* needed for alloca(). */ - -/* Cygwin's headers don't have WM_INPUT right now... */ -#ifndef WM_INPUT -#define WM_INPUT 0x00FF -#endif - -/* that should be enough, knock on wood. */ -#define MAX_MICE 32 - -/* - * Just trying to avoid malloc() here...we statically allocate a buffer - * for events and treat it as a ring buffer. - */ -/* !!! FIXME: tweak this? */ -#define MAX_EVENTS 1024 -static ManyMouseEvent input_events[MAX_EVENTS]; -static volatile int input_events_read = 0; -static volatile int input_events_write = 0; -static unsigned int available_mice = 0; -static int did_api_lookup = 0; -static HWND raw_hwnd = NULL; -static const char *class_name = "ManyMouseRawInputCatcher"; -static const char *win_name = "ManyMouseRawInputMsgWindow"; -static ATOM class_atom = 0; -static CRITICAL_SECTION mutex; - -typedef struct -{ - HANDLE handle; - char name[256]; -} MouseStruct; -static MouseStruct mice[MAX_MICE]; - - -/* - * The RawInput APIs only exist in Windows XP and later, so you want this - * to fail gracefully on earlier systems instead of refusing to start the - * process due to missing symbols. To this end, we do a symbol lookup on - * User32.dll, etc to get the entry points. - * - * A lot of these are available all the way back to the start of win32 in - * Windows 95 and WinNT 3.1, but just so you don't have to track down any - * import libraries, I've added those here, too. That fits well with the - * idea of just adding the sources to your build and going forward. - */ -static UINT (WINAPI *pGetRawInputDeviceList)( - PRAWINPUTDEVICELIST pRawInputDeviceList, - PUINT puiNumDevices, - UINT cbSize -); -/* !!! FIXME: use unicode version */ -static UINT (WINAPI *pGetRawInputDeviceInfoA)( - HANDLE hDevice, - UINT uiCommand, - LPVOID pData, - PUINT pcbSize -); -static BOOL (WINAPI *pRegisterRawInputDevices)( - PCRAWINPUTDEVICE pRawInputDevices, - UINT uiNumDevices, - UINT cbSize -); -static LRESULT (WINAPI *pDefRawInputProc)( - PRAWINPUT *paRawInput, - INT nInput, - UINT cbSizeHeader -); -static UINT (WINAPI *pGetRawInputBuffer)( - PRAWINPUT pData, - PUINT pcbSize, - UINT cbSizeHeader -); -static UINT (WINAPI *pGetRawInputData)( - HRAWINPUT hRawInput, - UINT uiCommand, - LPVOID pData, - PUINT pcbSize, - UINT cbSizeHeader -); -static LONG (WINAPI *pRegQueryValueExA)( - HKEY hKey, - LPCTSTR lpValueName, - LPDWORD lpReserved, - LPDWORD lpType, - LPBYTE lpData, - LPDWORD lpcbData -); -static LONG (WINAPI *pRegOpenKeyExA)( - HKEY hKey, - LPCTSTR lpSubKey, - DWORD ulOptions, - REGSAM samDesired, - PHKEY phkResult -); -static LONG (WINAPI *pRegCloseKey)( - HKEY hKey -); -static HWND (WINAPI *pCreateWindowExA)( - DWORD dwExStyle, - LPCTSTR lpClassName, - LPCTSTR lpWindowName, - DWORD dwStyle, - int x, - int y, - int nWidth, - int nHeight, - HWND hWndParent, - HMENU hMenu, - HINSTANCE hInstance, - LPVOID lpParam -); -static ATOM (WINAPI *pRegisterClassExA)( - CONST WNDCLASSEX *lpwcx -); -static LRESULT (WINAPI *pDefWindowProcA)( - HWND hWnd, - UINT Msg, - WPARAM wParam, - LPARAM lParam -); -static BOOL (WINAPI *pUnregisterClassA)( - LPCTSTR lpClassName, - HINSTANCE hInstance -); -static HMODULE (WINAPI *pGetModuleHandleA)( - LPCTSTR lpModuleName -); -static BOOL (WINAPI *pPeekMessageA)( - LPMSG lpMsg, - HWND hWnd, - UINT wMsgFilterMin, - UINT wMsgFilterMax, - UINT wRemoveMsg -); -static BOOL (WINAPI *pTranslateMessage)( - const MSG *lpMsg -); -static LRESULT (WINAPI *pDispatchMessageA)( - const MSG *lpmsg -); -static BOOL (WINAPI *pDestroyWindow)( - HWND hWnd -); -static void (WINAPI *pInitializeCriticalSection)( - LPCRITICAL_SECTION lpCriticalSection -); -static void (WINAPI *pEnterCriticalSection)( - LPCRITICAL_SECTION lpCriticalSection -); -static void (WINAPI *pLeaveCriticalSection)( - LPCRITICAL_SECTION lpCriticalSection -); -static void (WINAPI *pDeleteCriticalSection)( - LPCRITICAL_SECTION lpCriticalSection -); - -static int symlookup(HMODULE dll, void **addr, const char *sym) -{ - *addr = GetProcAddress(dll, sym); - if (*addr == NULL) - { - FreeLibrary(dll); - return(0); - } /* if */ - - return(1); -} /* symlookup */ - -static int find_api_symbols(void) -{ - HMODULE dll; - - if (did_api_lookup) - return(1); - - #define LOOKUP(x) { if (!symlookup(dll, (void **) &p##x, #x)) return(0); } - dll = LoadLibrary("user32.dll"); - if (dll == NULL) - return(0); - - LOOKUP(GetRawInputDeviceInfoA); - LOOKUP(RegisterRawInputDevices); - LOOKUP(GetRawInputDeviceList); - LOOKUP(DefRawInputProc); - LOOKUP(GetRawInputBuffer); - LOOKUP(GetRawInputData); - LOOKUP(CreateWindowExA); - LOOKUP(RegisterClassExA); - LOOKUP(UnregisterClassA); - LOOKUP(DefWindowProcA); - LOOKUP(PeekMessageA); - LOOKUP(TranslateMessage); - LOOKUP(DispatchMessageA); - LOOKUP(DestroyWindow); - - dll = LoadLibrary("advapi32.dll"); - if (dll == NULL) - return(0); - - LOOKUP(RegOpenKeyExA); - LOOKUP(RegQueryValueExA); - LOOKUP(RegCloseKey); - - dll = LoadLibrary("kernel32.dll"); - if (dll == NULL) - return(0); - - LOOKUP(GetModuleHandleA); - LOOKUP(InitializeCriticalSection); - LOOKUP(EnterCriticalSection); - LOOKUP(LeaveCriticalSection); - LOOKUP(DeleteCriticalSection); - - #undef LOOKUP - - did_api_lookup = 1; - return(1); -} /* find_api_symbols */ - - -static void queue_event(const ManyMouseEvent *event) -{ - /* copy the event info. We'll process it in ManyMouse_PollEvent(). */ - CopyMemory(&input_events[input_events_write], event, sizeof (ManyMouseEvent)); - - input_events_write = ((input_events_write + 1) % MAX_EVENTS); - - /* Ring buffer full? Lose oldest event. */ - if (input_events_write == input_events_read) - { - /* !!! FIXME: we need to not lose mouse buttons here. */ - input_events_read = ((input_events_read + 1) % MAX_EVENTS); - } /* if */ -} /* queue_event */ - - -static void queue_from_rawinput(const RAWINPUT *raw) -{ - unsigned int i; - const RAWINPUTHEADER *header = &raw->header; - const RAWMOUSE *mouse = &raw->data.mouse; - ManyMouseEvent event; - - if (raw->header.dwType != RIM_TYPEMOUSE) - return; - - for (i = 0; i < available_mice; i++) /* find the device for event. */ - { - if (mice[i].handle == header->hDevice) - break; - } /* for */ - - if (i == available_mice) - return; /* not found?! */ - - /* - * RAWINPUT packs a bunch of events into one, so we split it up into - * a bunch of ManyMouseEvents here and store them in an internal queue. - * Then ManyMouse_PollEvent() just shuffles items off that queue - * without any complicated processing. - */ - - event.device = i; - - pEnterCriticalSection(&mutex); - - if (mouse->usFlags & MOUSE_MOVE_ABSOLUTE) - { - /* !!! FIXME: How do we get the min and max values for absmotion? */ - event.type = MANYMOUSE_EVENT_ABSMOTION; - event.item = 0; - event.value = mouse->lLastX; - queue_event(&event); - event.item = 1; - event.value = mouse->lLastY; - queue_event(&event); - } /* if */ - - else /*if (mouse->usFlags & MOUSE_MOVE_RELATIVE)*/ - { - event.type = MANYMOUSE_EVENT_RELMOTION; - if (mouse->lLastX != 0) - { - event.item = 0; - event.value = mouse->lLastX; - queue_event(&event); - } /* if */ - - if (mouse->lLastY != 0) - { - event.item = 1; - event.value = mouse->lLastY; - queue_event(&event); - } /* if */ - } /* else if */ - - event.type = MANYMOUSE_EVENT_BUTTON; - - #define QUEUE_BUTTON(x) { \ - if (mouse->usButtonFlags & RI_MOUSE_BUTTON_##x##_DOWN) { \ - event.item = x-1; \ - event.value = 1; \ - queue_event(&event); \ - } \ - if (mouse->usButtonFlags & RI_MOUSE_BUTTON_##x##_UP) { \ - event.item = x-1; \ - event.value = 0; \ - queue_event(&event); \ - } \ - } - - QUEUE_BUTTON(1); - QUEUE_BUTTON(2); - QUEUE_BUTTON(3); - QUEUE_BUTTON(4); - QUEUE_BUTTON(5); - - #undef QUEUE_BUTTON - - if (mouse->usButtonFlags & RI_MOUSE_WHEEL) - { - if (mouse->usButtonData != 0) /* !!! FIXME: can this ever be zero? */ - { - event.type = MANYMOUSE_EVENT_SCROLL; - event.item = 0; /* !!! FIXME: horizontal wheel? */ - event.value = ( ((SHORT) mouse->usButtonData) > 0) ? 1 : -1; - queue_event(&event); - } /* if */ - } /* if */ - - pLeaveCriticalSection(&mutex); -} /* queue_from_rawinput */ - - -static void wminput_handler(WPARAM wParam, LPARAM lParam) -{ - UINT dwSize = 0; - LPBYTE lpb; - - pGetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &dwSize, - sizeof (RAWINPUTHEADER)); - - if (dwSize < sizeof (RAWINPUT)) - return; /* unexpected packet? */ - - lpb = (LPBYTE) alloca(dwSize); - if (lpb == NULL) - return; - if (pGetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &dwSize, - sizeof (RAWINPUTHEADER)) != dwSize) - return; - - queue_from_rawinput((RAWINPUT *) lpb); -} /* wminput_handler */ - - -static LRESULT CALLBACK RawWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - if (Msg == WM_INPUT) - wminput_handler(wParam, lParam); - - else if (Msg == WM_DESTROY) - return(0); - - return pDefWindowProcA(hWnd, Msg, wParam, lParam); -} /* RawWndProc */ - - -static int init_event_queue(void) -{ - HINSTANCE hInstance = pGetModuleHandleA(NULL); - WNDCLASSEX wce; - RAWINPUTDEVICE rid; - - ZeroMemory(input_events, sizeof (input_events)); - input_events_read = input_events_write = 0; - - ZeroMemory(&wce, sizeof (wce)); - wce.cbSize = sizeof(WNDCLASSEX); - wce.lpfnWndProc = RawWndProc; - wce.lpszClassName = class_name; - wce.hInstance = hInstance; - class_atom = pRegisterClassExA(&wce); - if (class_atom == 0) - return(0); - - raw_hwnd = pCreateWindowExA(0, class_name, win_name, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, HWND_MESSAGE, NULL, hInstance, NULL); - - if (raw_hwnd == NULL) - return(0); - - pInitializeCriticalSection(&mutex); - - ZeroMemory(&rid, sizeof (rid)); - rid.usUsagePage = 1; /* GenericDesktop page */ - rid.usUsage = 2; /* GeneralDestop Mouse usage. */ - rid.dwFlags = RIDEV_INPUTSINK; - rid.hwndTarget = raw_hwnd; - if (!pRegisterRawInputDevices(&rid, 1, sizeof (rid))) - { - pDeleteCriticalSection(&mutex); - return(0); - } /* if */ - - return(1); -} /* init_event_queue */ - - -static void cleanup_window(void) -{ - if (raw_hwnd) - { - MSG Msg; - pDestroyWindow(raw_hwnd); - while (pPeekMessageA(&Msg, raw_hwnd, 0, 0, PM_REMOVE)) - { - pTranslateMessage(&Msg); - pDispatchMessageA(&Msg); - } /* while */ - raw_hwnd = 0; - } /* if */ - - if (class_atom) - { - pUnregisterClassA(class_name, pGetModuleHandleA(NULL)); - class_atom = 0; - } /* if */ -} /* cleanup_window */ - - -static int accept_device(const RAWINPUTDEVICELIST *dev) -{ - const char rdp_ident[] = "\\??\\Root#RDP_MOU#0000#"; - char *buf = NULL; - UINT ct = 0; - - if (dev->dwType != RIM_TYPEMOUSE) - return(0); /* keyboard or some other fruity thing. */ - - if (pGetRawInputDeviceInfoA(dev->hDevice, RIDI_DEVICENAME, NULL, &ct) < 0) - return(0); - - /* ct == is chars, not bytes, but we used the ASCII version. */ - buf = (char *) alloca(ct); - if (buf == NULL) - return(0); - - if (pGetRawInputDeviceInfoA(dev->hDevice, RIDI_DEVICENAME, buf, &ct) < 0) - return(0); - - /* - * Apparently there's a fake "RDP" device...I guess this is - * "Remote Desktop Protocol" for controlling the system pointer - * remotely via Windows Remote Desktop, but that's just a guess. - * At any rate, we don't want that device, so skip it if detected. - * - * Idea for this found here: - * http://link.mywwwserver.com/~jstookey/arcade/rawmouse/raw_mouse.c - */ - - /* avoiding memcmp here so we don't get a C runtime dependency... */ - if (ct >= sizeof (rdp_ident) - 1) - { - int i; - for (i = 0; i < sizeof (rdp_ident) - 1; i++) - { - if (buf[i] != rdp_ident[i]) - break; - } /* for */ - - if (i == sizeof (rdp_ident) - 1) - return(0); /* this is an RDP thing. Skip this device. */ - } /* if */ - - return(1); /* we want this device. */ -} /* accept_device */ - - -/* !!! FIXME: this code sucks. */ -static void get_device_product_name(char *name, size_t namesize, - const RAWINPUTDEVICELIST *dev) -{ - const char regkeyroot[] = "System\\CurrentControlSet\\Enum\\"; - const char default_device_name[] = "Unidentified input device"; - DWORD outsize = namesize; - DWORD regtype = REG_SZ; - char *buf = NULL; - char *ptr = NULL; - char *keyname = NULL; - UINT i = 0; - UINT ct = 0; - LONG rc = 0; - HKEY hkey; - - *name = '\0'; /* really insane default. */ - if (sizeof (default_device_name) >= namesize) - return; - - /* in case we can't stumble upon something better... */ - CopyMemory(name, default_device_name, sizeof (default_device_name)); - - if (pGetRawInputDeviceInfoA(dev->hDevice, RIDI_DEVICENAME, NULL, &ct) < 0) - return; - - /* ct == is chars, not bytes, but we used the ASCII version. */ - buf = (char *) alloca(ct+1); - keyname = (char *) alloca(ct + sizeof (regkeyroot)); - if ((buf == NULL) || (keyname == NULL)) - return; - - if (pGetRawInputDeviceInfoA(dev->hDevice, RIDI_DEVICENAME, buf, &ct) < 0) - return; - - /* - * This string tap dancing gets us a registry keyname in this form: - * SYSTEM\CurrentControlSet\Enum\BUSTYPE\DEVICECLASS\DEVICEID - * (those are my best-guess for the actual elements, but the format - * appears to be sound.) - */ - ct -= 4; - buf += 4; /* skip the "\\??\\" on the front of the string. */ - for (i = 0, ptr = buf; i < ct; i++, ptr++) /* convert '#' to '\\' ... */ - { - if (*ptr == '#') - *ptr = '\\'; - else if (*ptr == '{') /* hit the GUID part of the string. */ - break; - } /* for */ - - *ptr = '\0'; - CopyMemory(keyname, regkeyroot, sizeof (regkeyroot) - 1); - CopyMemory(keyname + (sizeof (regkeyroot) - 1), buf, i + 1); - rc = pRegOpenKeyExA(HKEY_LOCAL_MACHINE, keyname, 0, KEY_READ, &hkey); - if (rc != ERROR_SUCCESS) - return; - - rc = pRegQueryValueExA(hkey, "DeviceDesc", NULL, ®type, name, &outsize); - pRegCloseKey(hkey); - if (rc != ERROR_SUCCESS) - { - /* msdn says failure may mangle the buffer, so default it again. */ - CopyMemory(name, default_device_name, sizeof (default_device_name)); - return; - } /* if */ - name[namesize-1] = '\0'; /* just in case. */ -} /* get_device_product_name */ - - -static void init_mouse(const RAWINPUTDEVICELIST *dev) -{ - MouseStruct *mouse = &mice[available_mice]; - - if (accept_device(dev)) - { - ZeroMemory(mouse, sizeof (MouseStruct)); - get_device_product_name(mouse->name, sizeof (mouse->name), dev); - mouse->handle = dev->hDevice; - available_mice++; /* we're good. */ - } /* if */ -} /* init_mouse */ - - -static int windows_wminput_init(void) -{ - RAWINPUTDEVICELIST *devlist = NULL; - UINT ct = 0; - UINT i; - - available_mice = 0; - - if (!find_api_symbols()) /* only supported on WinXP and later. */ - return(0); - - pGetRawInputDeviceList(NULL, &ct, sizeof (RAWINPUTDEVICELIST)); - if (ct == 0) /* no devices. */ - return(0); - - devlist = (PRAWINPUTDEVICELIST) alloca(sizeof (RAWINPUTDEVICELIST) * ct); - pGetRawInputDeviceList(devlist, &ct, sizeof (RAWINPUTDEVICELIST)); - for (i = 0; i < ct; i++) - init_mouse(&devlist[i]); - - if (!init_event_queue()) - { - cleanup_window(); - available_mice = 0; - } /* if */ - - return(available_mice); -} /* windows_wminput_init */ - - -static void windows_wminput_quit(void) -{ - /* unregister WM_INPUT devices... */ - RAWINPUTDEVICE rid; - ZeroMemory(&rid, sizeof (rid)); - rid.usUsagePage = 1; /* GenericDesktop page */ - rid.usUsage = 2; /* GeneralDestop Mouse usage. */ - rid.dwFlags |= RIDEV_REMOVE; - pRegisterRawInputDevices(&rid, 1, sizeof (rid)); - cleanup_window(); - available_mice = 0; - pDeleteCriticalSection(&mutex); -} /* windows_wminput_quit */ - - -static const char *windows_wminput_name(unsigned int index) -{ - if (index < available_mice) - return(mice[index].name); - return(NULL); -} /* windows_wminput_name */ - - -/* - * Windows doesn't send a WM_INPUT event when you unplug a mouse, - * so we try to do a basic query by device handle here; if the - * query fails, we assume the device has vanished and generate a - * disconnect. - */ -static int check_for_disconnects(ManyMouseEvent *ev) -{ - /* - * (i) is static so we iterate through all mice round-robin and check - * one mouse per call to ManyMouse_PollEvent(). This makes this test O(1). - */ - static unsigned int i = 0; - MouseStruct *mouse = NULL; - - if (++i >= available_mice) /* check first in case of redetect */ - i = 0; - - mouse = &mice[i]; - if (mouse->handle != NULL) /* not NULL == still plugged in. */ - { - UINT size = 0; - UINT rc = pGetRawInputDeviceInfoA(mouse->handle, RIDI_DEVICEINFO, - NULL, &size); - if (rc == (UINT) -1) /* failed...probably unplugged... */ - { - mouse->handle = NULL; - ev->type = MANYMOUSE_EVENT_DISCONNECT; - ev->device = i; - return(1); - } /* if */ - } /* if */ - - return(0); /* no disconnect event this time. */ -} /* check_for_disconnects */ - - -static int windows_wminput_poll(ManyMouseEvent *ev) -{ - MSG Msg; /* run the queue for WM_INPUT messages, etc ... */ - int found = 0; - - /* ...favor existing events in the queue... */ - pEnterCriticalSection(&mutex); - if (input_events_read != input_events_write) /* no events if equal. */ - { - CopyMemory(ev, &input_events[input_events_read], sizeof (*ev)); - input_events_read = ((input_events_read + 1) % MAX_EVENTS); - found = 1; - } /* if */ - pLeaveCriticalSection(&mutex); - - if (!found) - { - /* pump Windows for new hardware events... */ - while (pPeekMessageA(&Msg, raw_hwnd, 0, 0, PM_REMOVE)) - { - pTranslateMessage(&Msg); - pDispatchMessageA(&Msg); - } /* while */ - - /* In case something new came in, give it to the app... */ - pEnterCriticalSection(&mutex); - if (input_events_read != input_events_write) /* no events if equal. */ - { - CopyMemory(ev, &input_events[input_events_read], sizeof (*ev)); - input_events_read = ((input_events_read + 1) % MAX_EVENTS); - found = 1; - } /* if */ - pLeaveCriticalSection(&mutex); - } /* if */ - - /* - * Check for disconnects if queue is totally empty and Windows didn't - * report anything new at this time. This ensures that we don't send a - * disconnect event through ManyMouse and then later give a valid - * event to the app for a device that is now missing. - */ - if (!found) - found = check_for_disconnects(ev); - - return(found); -} /* windows_wminput_poll */ - -#else - -static int windows_wminput_init(void) { return(-1); } -static void windows_wminput_quit(void) {} -static const char *windows_wminput_name(unsigned int index) { return(0); } -static int windows_wminput_poll(ManyMouseEvent *event) { return(0); } - -#endif /* ifdef WINDOWS blocker */ - -ManyMouseDriver ManyMouseDriver_windows = -{ - windows_wminput_init, - windows_wminput_quit, - windows_wminput_name, - windows_wminput_poll -}; - -/* end of windows_wminput.c ... */ diff --git a/tools/zsnes/src/net/ztcp.c b/tools/zsnes/src/net/ztcp.c deleted file mode 100644 index fe0e495..0000000 --- a/tools/zsnes/src/net/ztcp.c +++ /dev/null @@ -1,1268 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - - -/**********************************************************\ -* ZSNES TCP/IP MODULE FOR NETWORK PLAY * -* * -* Coded by the ZSNES team * -* TCP/IP drivers coded by _Demo_, revised by Pharos * -* UDP drivers coded by _Demo_, revised by zsKnight * -* Gameplay netplay implementation by zsKnight * -* UDP Packet loss/out of order algorithm/implementation * -* by zsKnight, assistance on normal packets by Pharos * -\**********************************************************/ - -// UDP Algorithm: -// -// UDP Header (1 byte): 1 = Normal Packet w/ reply req, 2 = Reply Packet, -// 3 = Gameplay Packet (single byte), -// 4 = Gameplay Packet (larger packet), 5 = Re-request gameplay -// packet -// -// Normal Packets: -// Note: The actual implementation turned out to be quite different -// than the below descriptions. -// First byte contains the packet counter, followed by packet contents. -// Remote will send a Reply Packet (just contains packet counter) -// Each packet buffer will have a timer counter which decreases after -// every 1/60 seconds (value set at start is 60). If this reaches 0 -// that packet will be re-sent and reset the timer value back to 60. -// If the local side receives the reply packet, it will set the timer -// counter to -1. -// -// Gameplay Packets: -// Note: Gameplay counter is separate from normal packet counter. -// Note2: When referring to TCP/IP, it refers to the Normal Packets above. -// Each packet in TCP/IP will contain a byte counter when UDP is -// enabled. -// Each UDP packet will contain a byte counter, the number of packets, -// then each packet will contain a byte size only if there are > 1 -// packets. If the packet is just one byte long and contains a value<2, -// it will follow by a byte containing info on how many packets its has -// been like that for (it will not go beyond 32). If the packet is -// more than one byte long, it will repeat that packet as the extra -// packets for the next 3 packets, with the first byte of those packets -// as the byte counter of that packet, then the second as the size. -// Also, the send data will be stored in a 256*32 byte buffer in case -// of packet loss. -// When receiving, since no UDP packets will exceed 32bytes in length, -// there will be a 256*32 byte buffer and a 256 byte flag buffer. -// The flag clearing pointer will move at an offset of 128 from the -// actual point of the receive buffer. When it receives data from -// the UDP (or TCP), if the byte count of the data matches the -// receive pointer, it will just send the data directly and increase the -// receive pointer. Else it will fill the buffer accordingly based on -// the send data (for a maximum of 32 bytes). Then if the bit on the -// flag buffer is set for the current receive pointer, return the -// appropriate buffer and increase receive pointer. -// In case of packet loss, if no data has been received for every 500ms, the -// local side would send a re-send package request. What this would -// do is let the remote side build up a package containing all the -// data from the requested send point to the current receive point. -// A resend request will start off with 0x00,0xFF, then the counter -// number. A resent packet will start off with 0x00,0xFE, the # of -// packets, then the packet data (size of packet, data). A resend will -// only be done if the requested packet is within the past 64 packets. -// In-game chat will be moved to a separate packet in TCP/IP - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#define closesocket(A) close(A) -#define CopyMemory(A,B,C) memcpy(A,B,C) -#define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid()) -#define UINT unsigned int -#define WORD unsigned short -#define SOCKET int -#define SOCKADDR_IN struct sockaddr_in -#define LPSOCKADDR struct sockaddr* -#define LPHOSTENT struct hostent* -#define HOSTENT struct hostent -#define LPINADDR struct in_addr* -#define LPIN_ADDR struct in_addr* -#define SOCKET_ERROR -1 -#define INVALID_SOCKET -1 -#define ioctlsocket ioctl -#define FD_SET_VAR fd_set -#else -#include -#include -#include -#include -#define FD_SET_VAR FD_SET -#endif - -int RecvPtr; -int RecvPtr2; -unsigned char RecvFlags[256]; -unsigned char RecvBuffer[256*32]; -int RecvBufferSize[256]; - -int SendPtr; -int SendPtr2; -unsigned char SendBuffer[256*32]; -int SendBufferSize[256]; - -int SendRepeated; - -int PrevSPacket[16]; -int PrevSData[16*32]; -int PrevSSize[16]; -int PrevSPtr[16]; - -int tcperr; -unsigned short portval; -int UDPEnable = 1; -int UDPConfig = 1; -int UDPBackTrace = 6; -int blahblahblah = 0; -int CounterA = -1; -int CounterB = -1; -int UDPMode2 = 0; - -int packetnum,packetnumhead; -int packetrecvhead; -unsigned char packetdata[2048*16]; -unsigned char packetrdata[2048*32]; -int packetconfirm[256]; -int packetreceived[256]; -int packetreceivesize[256]; -int packetsize[256]; -unsigned char cpacketdata[2048+32]; -UINT ConnectAddr; -int packettimeleft[256]; -int packetresent[256]; -int PacketCounter=0; -unsigned char CLatencyVal=0; - - -SOCKET gamesocket; /* tcp socket for the game */ -SOCKET serversocket; /* tcp socket when the server is listening */ - -SOCKET ugamesocket; /* udp socket sending */ -SOCKET userversocket; /* udp socket listening */ - -SOCKADDR_IN serveraddress; /* address of the server */ -SOCKADDR_IN ugameaddress; /* address of the server */ -SOCKADDR_IN userveraddress; /* address of the server */ - -char blah[256]; -char remotehost[256]; -char hostname[50] = "IP N/A"; - -// Function Prototypes - -int SendData(int dsize,unsigned char *dptr); -int GetData(int dsize,unsigned char *dptr); -int GetLeftUDP(); - -/**********************************************************\ -* Initialize the zsnes tcpip module * -* - no parameters * -* - return 0 on success other value on error * -* * -* - no known side effects * -\**********************************************************/ - -int InitTCP() -{ -#ifndef __UNIXSDL__ - WORD versionneeded = MAKEWORD(2,2); - WSADATA wsadata; -#endif - - UDPEnable=0; - -#ifndef __UNIXSDL__ - /* Startup winsock */ - WSAStartup(versionneeded, &wsadata); - - /* Verify version number and exit on wrong version */ - if (wsadata.wVersion != versionneeded) - { - return(-1); - } - serversocket=INVALID_SOCKET; -#endif - return(0); -} - - -/**********************************************************\ -* Deinitialize the zsnes tcpip module * -* - no parameters * -* * -* - no known side effects * -\**********************************************************/ - -void DeInitTCP() -{ -#ifndef __UNIXSDL__ - WSACleanup(); -#endif -} - -/**********************************************************\ -* Gets UDP Status through sending data * -* - no parameters * -* * -* - no known side effects * -\**********************************************************/ - -void GetUDPStatus() { - int retval; - - UDPEnable=UDPConfig; - - if (!UDPEnable){ - blah[0]=0; - retval = send(gamesocket,blah,1,0); - gethostname(blah,255); - retval = send(gamesocket,blah,strlen(blah),0); - } - else { - blah[0]=1; - retval = send(gamesocket,blah,1,0); - gethostname(blah,255); - retval = send(gamesocket,blah,strlen(&blah[1])+1,0); - } - - retval = recv(gamesocket,blah,256,0); - if (blah[0]==0) UDPEnable=0; - retval = recv(gamesocket,blah,256,0); -} - -/**********************************************************\ -* Connect to game server * -* - parameters * -* - pointer server name * -* - server port * -* - return 0 on success other value on error * -* * -* - no known side effects * -\**********************************************************/ - -int isipval(char *name){ - int i=0; - - while(name[i]!=0){ - if (!((name[i]=='.') || ((name[i]>='0') && (name[i]<='9')))) - return(0); - i++; - } - return(1); -} - -int ConnectServer(char *servername, unsigned int port) -{ - char blah[255]; - int retval,i; - LPHOSTENT host1=NULL; - int yesip; - - packetnum = 0; - packetnumhead = 0; - packetrecvhead = 0; - RecvPtr = 0; - SendPtr = 0; - RecvPtr2 = 0; - SendPtr2 = 0; - - ConnectAddr = 0; - SendRepeated = 0; - for (i=0;i<16;i++) - PrevSPacket[i]=0; - - /* get host and verify if it is valid */ - yesip = isipval(servername); - if (!yesip){ - host1 = gethostbyname(servername); - if (host1 == NULL) - { - return(-1); - } - } - -// return(-1); - if (UDPConfig) UDPEnable = 1; - - if (UDPEnable) - { - PacketCounter=1; - for (i=0;i<256;i++) {packettimeleft[i]=-1; packetconfirm[i]=1; packetreceived[i]=0; RecvFlags[i]=0;} - - userveraddress.sin_family = AF_INET; - ugameaddress.sin_family = AF_INET; - - if (!yesip) - { - ugameaddress.sin_addr = *( (LPIN_ADDR) *host1->h_addr_list ); - } - else - { - ugameaddress.sin_addr.s_addr = inet_addr(servername); - } - - ConnectAddr = ugameaddress.sin_addr.s_addr; - - userveraddress.sin_addr.s_addr = INADDR_ANY; - -// port++; - ugameaddress.sin_port = htons((unsigned short) port); - userveraddress.sin_port = htons((unsigned short) port); -// port--; - - userversocket = socket(AF_INET, SOCK_DGRAM,0); - ugamesocket = socket(AF_INET, SOCK_DGRAM,0); - - if (ugamesocket == INVALID_SOCKET) - { -#ifdef __UNIXSDL__ - STUB_FUNCTION; -#else - tcperr=WSAGetLastError(); - sprintf(blah,"Could not initialize UDP(2) : %d",tcperr); - MessageBox(NULL,blah,"Error",MB_SYSTEMMODAL|MB_OK); -#endif - return(-2); - } - - if (userversocket == INVALID_SOCKET) - { -#ifdef __UNIXSDL__ - STUB_FUNCTION; -#else - tcperr=WSAGetLastError(); - sprintf(blah,"Could not initialize UDP(2.5) : %d",tcperr); - MessageBox(NULL,blah,"Error",MB_SYSTEMMODAL|MB_OK); -#endif - return(-2); - } - - if (bind(userversocket,(struct sockaddr*)&userveraddress,sizeof(userveraddress))== - SOCKET_ERROR) - { -#ifdef __UNIXSDL__ - STUB_FUNCTION; -#else - tcperr=WSAGetLastError(); - sprintf(blah,"Could not initialize UDP(16) : %d",tcperr); - MessageBox(NULL,blah,"Error",MB_SYSTEMMODAL|MB_OK); -#endif - return(-2); - } - - -// blah[0]=1; -// retval = sendto(ugamesocket,blah,1,0,(struct sockaddr*)&ugameaddress,sizeof(struct sockaddr)); -// if (retval == SOCKET_ERROR) return(-1); - - blah[0]=1; - SendData(1,blah); - -// retval = sendto(ugamesocket,blah,5,0,(struct sockaddr*)&ugameaddress,sizeof(struct sockaddr)); -// blah[0]=0; -// i = sizeof(struct sockaddr); -// retval = recvfrom(userversocket,blah,5,0,(struct sockaddr*)&userveraddress,&i); - -// MessageBox(NULL,blah, -// "Error", -// MB_SYSTEMMODAL|MB_OK); - - return(0); - -// retval = send(gamesocket,blah,1,0); -// retval = recv(gamesocket,blah,1,0); - } - - - /* create the game socket and verify if it is valid */ - gamesocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (gamesocket == INVALID_SOCKET) - { - return(-2); - } - - - /* initialize server address */ - serveraddress.sin_family = AF_INET; - if (!yesip) - serveraddress.sin_addr = *( (LPIN_ADDR) *host1->h_addr_list ); - else - serveraddress.sin_addr.s_addr = inet_addr(servername); - - serveraddress.sin_port = htons((unsigned short)port); - - - /* try to connect to the server */ - retval = connect( gamesocket, - (LPSOCKADDR)&serveraddress, - sizeof(struct sockaddr)); - if (retval == SOCKET_ERROR) - { -#ifdef __UNIXSDL__ - STUB_FUNCTION; -#else - sprintf(blah,"Could not connect to other side"); - MessageBox(NULL,blah, - "Error", - MB_SYSTEMMODAL|MB_OK); -#endif - - closesocket(gamesocket); - return(-3); - } - -// GetUDPStatus(); - - return(0); -} - -int WaitForServer(){ - int i; - - if (UDPEnable){ - if ((i=GetData(1,blah))){ - if ((i==1) && (blah[0]==1)) - return(1); - } - return(0); - } - return(1); -} - - -/**********************************************************\ -* Disconnect from game server * -* - no parameters * -* * -* - no known side effects * -\**********************************************************/ - -void Disconnect() -{ - if (UDPEnable) - { - closesocket(ugamesocket); - closesocket(userversocket); - return; - } - PacketCounter=0; - closesocket(gamesocket); -} - - -/**********************************************************\ -* Start the game server * -* - parameters * - - port number -* - return 0 on success other value on error * -* * -* - no known side effects * -\**********************************************************/ - -int StartServerCycle(unsigned short port) -{ - int retval,i; - - portval = port; - packetnum = 0; - packetnumhead = 0; - packetrecvhead = 0; - ConnectAddr = 0; - SendRepeated = 0; - RecvPtr = 0; - SendPtr = 0; - RecvPtr2 = 0; - SendPtr2 = 0; - - for (i=0;i<16;i++) - PrevSPacket[i]=0; - - - if (UDPConfig) UDPEnable = 1; - - if (UDPEnable) - { - /* get host and verify if it is valid */ - PacketCounter=1; - for (i=0;i<256;i++) {packettimeleft[i]=-1; packetconfirm[i]=1; packetreceived[i]=0; RecvFlags[i]=0;} - - userveraddress.sin_family = AF_INET; - ugameaddress.sin_family = AF_INET; - - userveraddress.sin_addr.s_addr = INADDR_ANY; - ugameaddress.sin_addr.s_addr = INADDR_ANY; - -// portval++; - ugameaddress.sin_port = htons((unsigned short) portval); - userveraddress.sin_port = htons((unsigned short) portval); -// portval--; - - userversocket = socket(AF_INET, SOCK_DGRAM,0); - ugamesocket = socket(AF_INET, SOCK_DGRAM,0); - - if (userversocket == INVALID_SOCKET) - { -#ifdef __UNIXSDL__ - STUB_FUNCTION; -#else - tcperr=WSAGetLastError(); - sprintf(blah,"Could not initialize UDP(5) : %d",tcperr); - MessageBox(NULL,blah,"Error",MB_SYSTEMMODAL|MB_OK); -#endif - return(-2); - } - if (bind(userversocket,(struct sockaddr*)&userveraddress,sizeof(userveraddress))== - SOCKET_ERROR) - { -#ifdef __UNIXSDL__ - STUB_FUNCTION; -#else - tcperr=WSAGetLastError(); - sprintf(blah,"Could not initialize UDP(6) : %d",tcperr); - MessageBox(NULL,blah,"Error",MB_SYSTEMMODAL|MB_OK); -#endif - return(-2); - } - - - blah[0]=2; - blah[1]='C'; - blah[2]='B'; - blah[3]='A'; - blah[4]=0; - - -// retval = recvfrom(userversocket,blah,5,0, -// (struct sockaddr *)&userveraddress,&socklen); - - ugameaddress.sin_addr.s_addr = userveraddress.sin_addr.s_addr; - - ugamesocket = socket(AF_INET, SOCK_DGRAM,0); - - return(0); - -// retval = send(gamesocket,blah,1,0); -// retval = recv(gamesocket,blah,1,0); - - } - - /* Create the listen socket */ - serversocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (serversocket == INVALID_SOCKET) - { -#ifndef __UNIXSDL__ - tcperr=WSAGetLastError(); -#endif - - return(-1); - } - - serveraddress.sin_family = AF_INET; - serveraddress.sin_addr.s_addr = INADDR_ANY; - serveraddress.sin_port = htons(port); - - /* bind name and socket */ - retval = bind(serversocket, - (LPSOCKADDR)&serveraddress, - sizeof(struct sockaddr)); - if (retval == SOCKET_ERROR) - { -#ifndef __UNIXSDL__ - tcperr=WSAGetLastError(); -#endif - closesocket(serversocket); - return(-2); - } - - /* setup socket to listen */ - retval = listen(serversocket, SOMAXCONN); - if (retval == SOCKET_ERROR) - { -#ifndef __UNIXSDL__ - tcperr=WSAGetLastError(); -#endif - closesocket(serversocket); - return(-3); - } - - return 0; -} - -int acceptzuser() -{ - if (UDPEnable) - { - return(0); - } - - /* wait for connection */ - - gamesocket = accept(serversocket, NULL, NULL); - if (gamesocket == INVALID_SOCKET) - { -#ifndef __UNIXSDL__ - tcperr=WSAGetLastError(); -#endif - closesocket(serversocket); - serversocket=-1; - return(-1); - } - -// GetUDPStatus(); - - return(0); -} - -int ServerCheckNewClient() -{ - FD_SET_VAR zrf; - struct timeval nto; - int r; - - if (UDPEnable) - { - r=GetData(256,blah); - if (r == -1) return(-1); - if (r > 0){ - ugameaddress.sin_addr.s_addr=userveraddress.sin_addr.s_addr; - ConnectAddr = ugameaddress.sin_addr.s_addr; - blah[0]=1; - r=SendData(1,blah); - return(1); - } - return(0); - } - - if(serversocket == INVALID_SOCKET) - { - return(-1); - } - nto.tv_sec=0; - nto.tv_usec=0; /* return immediately */ - - FD_ZERO(&zrf); - FD_SET(serversocket,&zrf); - r=select(serversocket+1,&zrf,0,0,&nto); - - if(r == -1) - { -#ifndef __UNIXSDL__ - tcperr=WSAGetLastError(); -#endif - return(-2); - } - if(r == 0) - { - return(0); - } - if(FD_ISSET(serversocket,&zrf)) - { - return 1; - } - return(0); - -} - - -/**********************************************************\ -* Stop the game server * -* - no parameters * -* * -* - no known side effects * -\**********************************************************/ - -void StopServer() -{ - if (UDPEnable) - { - closesocket(ugamesocket); - closesocket(userversocket); - return; - } - PacketCounter=0; - closesocket(gamesocket); - closesocket(serversocket); -} - - -/**********************************************************\ -* Send data * -* - parameters : * -* - size of data * -* - pointer to data * -* - return 0 on success other value on error * -* * -* - side effects : * -* - close the socket on error * -\**********************************************************/ - -int PacketReceive() -{ - int dataleft,i,i2,i3,i4,i5,i6,i7,retval; - - dataleft=GetLeftUDP(); - if (dataleft<=0) return(dataleft); - i = sizeof(userveraddress); - retval = recvfrom(userversocket,cpacketdata,2048+32,0,(struct sockaddr *)&userveraddress,&i); - if ((ConnectAddr!=0) && (ConnectAddr != userveraddress.sin_addr.s_addr)) return(0); - if (retval == SOCKET_ERROR) - { - closesocket(ugamesocket); - return(-1); - } - if ((cpacketdata[0]==1) && (retval>0)) { - i=(unsigned char)cpacketdata[1]; - blah[0]=2; - blah[1]=cpacketdata[1]; - sendto(ugamesocket,blah,2,0,(struct sockaddr *)&ugameaddress,sizeof(ugameaddress)); - if (!packetreceived[i]){ - packetreceived[i]=1; - packetreceivesize[i]=retval-2; - CopyMemory(&(packetrdata[2048*(i & 0x0F)]),&(cpacketdata[2]),retval-2); - } - } - if (cpacketdata[0]==2){ - packetconfirm[cpacketdata[1]]=1; - while ((packetconfirm[packetnumhead]) && (packetnum!=packetnumhead)) - packetnumhead=(packetnumhead+1) & 0xFF; - } - - if ((cpacketdata[0]==16) && (cpacketdata[1]!=SendPtr)){ - i=cpacketdata[1]; - cpacketdata[0]=17; - cpacketdata[2]=SendPtr; - i3=3; - while (i!=SendPtr){ - cpacketdata[i3]=SendBufferSize[i]; - i3++; - for (i4=0;i4=0) && (i3<=127))) { - - - CLatencyVal=cpacketdata[1]; - i=cpacketdata[2]; - i3=0; - - if ((cpacketdata[0] & 0x07)==4){ - for (i2=0;i2512) packettimeleft[packetnum]=60*3; - packetresent[i]++; - CopyMemory(&(cpacketdata[2]),&(packetdata[2048*(i & 0x0F)]),packetsize[i]); - cpacketdata[0]=1; - cpacketdata[1]=(char)i; - sendto(ugamesocket,cpacketdata,packetsize[i]+2,0,(struct sockaddr *)&ugameaddress,sizeof(ugameaddress)); - } - } -} - -extern void UpdateVFrame(void); - -int SendData(int dsize,unsigned char *dptr) -{ - int retval; - - if (UDPEnable){ -/* retval = sendto(ugamesocket,dptr,dsize,0,(struct sockaddr *)&ugameaddress,sizeof(ugameaddress)); - if (retval == SOCKET_ERROR) - { - closesocket(gamesocket); - return(-1); - } - return(0); */ - - if (((packetnum-packetnumhead) & 0xFF) >= 15){ -// sprintf(message1,"Packet Overflow."); -// MessageBox (NULL, message1, "Init Error" , MB_ICONERROR ); - - // wait for receive packet, call JoyRead while waiting - while (((packetnum-packetnumhead) & 0xFF) >= 15){ - PacketResend(); - PacketReceive(); - UpdateVFrame(); - while ((packetconfirm[packetnumhead]) && (packetnum!=packetnumhead)) - packetnumhead=(packetnumhead+1) & 0xFF; - } - } - CopyMemory(&(cpacketdata[2]),dptr,dsize); - CopyMemory(&(packetdata[2048*(packetnum & 0x0F)]),dptr,dsize); - packetsize[packetnum]=dsize; - packetconfirm[packetnum]=0; - cpacketdata[0]=1; - cpacketdata[1]=(char)packetnum; - retval = sendto(ugamesocket,cpacketdata,dsize+2,0,(struct sockaddr *)&ugameaddress,sizeof(ugameaddress)); - packettimeleft[packetnum]=60; - if (dsize>512) packettimeleft[packetnum]=90; - packetresent[packetnum]=1; - packetnum=(packetnum+1) & 0xFF; - if (retval == SOCKET_ERROR) - { - closesocket(ugamesocket); - return(-1); - } - return(0); - } - - /* send data with the socket */ - retval = send(gamesocket,dptr,dsize,0); - if (retval == SOCKET_ERROR) - { - closesocket(gamesocket); - return(-1); - } - return(0); -} - -extern int PacketSendSize; -extern unsigned char PacketSendArray[2048+256]; - -int SendDataNop() -{ - return (SendData(PacketSendSize,PacketSendArray)); -} - - -/**********************************************************\ -* Send data UDP * -* - parameters : * -* - size of data * -* - pointer to data * -* - return 0 on success other value on error * -* * -* - side effects : * -* - close the socket on error * -\**********************************************************/ - -int AttachEnd(int psb){ - int i,i2,i3,ps; -//int PrevSPacket[4]; -//int PrevSData[4*32]; -//int PrevSSize[4]; - - ps=psb; - i2=0; - for (i=0;i<(UDPBackTrace-1);i++){ - if (PrevSPacket[i]) i2++; - } -// if (PrevSPacket[0]) i2=0; - if (i2){ - cpacketdata[0]+=8; - cpacketdata[ps]=(char)i2; - ps++; - for (i=0;i<(UDPBackTrace-1);i++){ - if (PrevSPacket[i]){ - cpacketdata[ps]=PrevSPtr[i]; - cpacketdata[ps+1]=PrevSSize[i]; - ps+=2; - for (i3=0;i3h_addr)); - strcat(hostname,blah); - } -} - -void UDPWait1Sec(){ - CounterB=60; - while (CounterB>0) - UpdateVFrame(); -} - -void UDPClearVars(){ - int i; - CounterA=-1; - RecvPtr = 0; - SendPtr = 0; - for (i=0;i<16;i++) - PrevSPacket[i]=0; - for (i=0;i<256;i++) - RecvFlags[i]=0; -} - -void UDPEnableMode(){ - UDPMode2=1; -} - -void UDPDisableMode(){ - UDPMode2=0; -} - -void WinErrorA2(void){ -#ifdef __UNIXSDL__ - STUB_FUNCTION; -#else - char message1[256]; - sprintf(message1,"Failed waiting for checksum."); - MessageBox (NULL, message1, "Init Error" , MB_ICONERROR ); -#endif -} - -void WinErrorB2(void){ -#ifdef __UNIXSDL__ - STUB_FUNCTION; -#else - char message1[256]; - sprintf(message1,"Failed waiting for confirmation."); - MessageBox (NULL, message1, "Init Error" , MB_ICONERROR ); -#endif -} - -void WinErrorC2(void){ -#ifdef __UNIXSDL__ - STUB_FUNCTION; -#else - char message1[256]; - sprintf(message1,"Failed waiting for confirmation(B)."); - MessageBox (NULL, message1, "Init Error" , MB_ICONERROR ); -#endif -} - - - diff --git a/tools/zsnes/src/numconv.h b/tools/zsnes/src/numconv.h deleted file mode 100644 index 3980f78..0000000 --- a/tools/zsnes/src/numconv.h +++ /dev/null @@ -1,177 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef NUMCONV_H -#define NUMCONV_H - -#include - -//Get correct mask for particular bit -#define BIT(X) (1 << (X)) - -/* -Functions that the compiler should inline that will convert -uint32, uint24, uint16 to 4 byte, 3 byte, 2 byte arrays -and back. -Nach -*/ - -#if !defined(NUMCONV_BT16) && defined(NUMCONV_FR2) -#define NUMCONV_BT16 -#endif - -#if !defined(NUMCONV_BT24) && defined(NUMCONV_FR3) -#define NUMCONV_BT24 -#endif - -#if !defined(NUMCONV_BT32) && defined(NUMCONV_FR4) -#define NUMCONV_BT32 -#endif - - -#if !defined(NUMCONV_16TB) && defined(NUMCONV_FW2) -#define NUMCONV_16TB -#endif - -#if !defined(NUMCONV_24TB) && defined(NUMCONV_FW3) -#define NUMCONV_24TB -#endif - -#if !defined(NUMCONV_32TB) && defined(NUMCONV_FW4) -#define NUMCONV_32TB -#endif - - - -#ifdef NUMCONV_32TB -static unsigned char *uint32_to_bytes(unsigned int num) -{ - static unsigned char buffer[4]; - buffer[3] = (num >> 24) & 0xFF; - buffer[2] = (num >> 16) & 0xFF; - buffer[1] = (num >> 8) & 0xFF; - buffer[0] = num & 0xFF; - return(buffer); -} -#endif - -#ifdef NUMCONV_BT32 -static unsigned int bytes_to_uint32(const unsigned char buffer[4]) -{ - unsigned int num = (unsigned int)buffer[0]; - num |= ((unsigned int)buffer[1]) << 8; - num |= ((unsigned int)buffer[2]) << 16; - num |= ((unsigned int)buffer[3]) << 24; - return(num); -} -#endif - -#ifdef NUMCONV_24TB -static unsigned char *uint24_to_bytes(unsigned int num) -{ - static unsigned char buffer[3]; - buffer[2] = (num >> 16) & 0xFF; - buffer[1] = (num >> 8) & 0xFF; - buffer[0] = num & 0xFF; - return(buffer); -} -#endif - -#ifdef NUMCONV_BT24 -static unsigned int bytes_to_uint24(const unsigned char buffer[3]) -{ - unsigned int num = (unsigned int)buffer[0]; - num |= ((unsigned int)buffer[1]) << 8; - num |= ((unsigned int)buffer[2]) << 16; - return(num); -} -#endif - -#ifdef NUMCONV_16TB -static unsigned char *uint16_to_bytes(unsigned short num) -{ - static unsigned char buffer[2]; - buffer[1] = (num >> 8) & 0xFF; - buffer[0] = num & 0xFF; - return(buffer); -} -#endif - -#ifdef NUMCONV_BT16 -static unsigned short bytes_to_uint16(const unsigned char buffer[2]) -{ - unsigned short num = (unsigned short)buffer[0]; - num |= ((unsigned short)buffer[1]) << 8; - return(num); -} -#endif - - -//Functions to read 2, 3, 4 bytes and convert to uint16, uint24, uint32 -#ifdef NUMCONV_FR2 -static unsigned short fread2(FILE *fp) -{ - unsigned char uint16buf[2]; - fread(uint16buf, 2, 1, fp); - return(bytes_to_uint16(uint16buf)); -} -#endif - -#ifdef NUMCONV_FR3 -static unsigned int fread3(FILE *fp) -{ - unsigned char uint24buf[3]; - fread(uint24buf, 3, 1, fp); - return(bytes_to_uint24(uint24buf)); -} -#endif - -#ifdef NUMCONV_FR4 -static unsigned int fread4(FILE *fp) -{ - unsigned char uint32buf[4]; - fread(uint32buf, 4, 1, fp); - return(bytes_to_uint32(uint32buf)); -} -#endif - -//Functions to write uint16, uint24, uint32 as 2, 3, 4 bytes -#ifdef NUMCONV_FW2 -static void fwrite2(unsigned short var, FILE *fp) -{ - fwrite(uint16_to_bytes(var), 2, 1, fp); -} -#endif - -#ifdef NUMCONV_FW3 -static void fwrite3(unsigned int var, FILE *fp) -{ - fwrite(uint24_to_bytes(var), 3, 1, fp); -} -#endif - -#ifdef NUMCONV_FW4 -static void fwrite4(unsigned int var, FILE *fp) -{ - fwrite(uint32_to_bytes(var), 4, 1, fp); -} -#endif - -#endif diff --git a/tools/zsnes/src/objfix.c b/tools/zsnes/src/objfix.c deleted file mode 100644 index ad2535b..0000000 --- a/tools/zsnes/src/objfix.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -Copyright (c) 1998-2005 Charles Bilyue'. - -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 -#include - -int open_error(const char *filename, const char *mode) -{ - printf("Failure opening %s for %s\n",filename,mode); - return 1; -} - -int main(int argc, char **argv) -{ - int c; - int section_count; - FILE *in, *out; - unsigned char section_header[40]; - - if (argc < 2 || argc > 3) - { - printf("Fixes MS Win32 object files to be compatible with the incorrect\n"); - printf(" implementation in MinGW32.\n"); - printf("Usage: objfix infile [outfile]\n"); - return 1; - } - - in = fopen(argv[1], (argc == 2 ? "rb+" : "rb")); - if (!in) return open_error(argv[1], (argc == 2 ? "read" : "update")); - - if (argc == 3) - { - out = fopen(argv[2], "wb"); - if (!out) return open_error(argv[1], (argc == 2 ? "read" : "update")); - } - else - { - out = NULL; - } - - if (out) - { - fputc(fgetc(in), out); - fputc(fgetc(in), out); - - fputc(section_count = fgetc(in), out); - fputc(c = fgetc(in), out); - section_count += c << 8; - - for (c = 4; c < 0x14; c++) - { - fputc(fgetc(in), out); - } - - for (c = 0; c < section_count; c++) - { - fread(section_header, 1, 40, in); - - if (!strncmp(section_header, ".bss", 8)) - { - memcpy(section_header + 8, section_header + 16, 4); - memset(section_header + 16, 0, 4); - } - else - { - memset(section_header + 8, 0, 4); - } - - fwrite(section_header, 1, 40, out); - } - - while ((c = fgetc(in)) != EOF) - { - fputc(c, out); - } - } - else - { - fgetc(in); - fgetc(in); - - section_count = fgetc(in); - section_count += fgetc(in) << 8; - - fseek(in, 0x14, SEEK_SET); - - for (c = 0; c < section_count; c++) - { - fread(section_header, 1, 40, in); - - fseek(in, -40, SEEK_CUR); - - if (!strncmp(section_header, ".bss", 8)) - { - memcpy(section_header + 8, section_header + 16, 4); - memset(section_header + 16, 0, 4); - } - else - { - memset(section_header + 8, 0, 4); - } - - fwrite(section_header, 1, 40, in); - - fseek(in, 0, SEEK_CUR); - } - } - - fclose(in); - if (out) fclose(out); - - return 0; -} diff --git a/tools/zsnes/src/parsegen.cpp b/tools/zsnes/src/parsegen.cpp deleted file mode 100644 index e664dc5..0000000 --- a/tools/zsnes/src/parsegen.cpp +++ /dev/null @@ -1,1960 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach ( http://nsrt.edgeemu.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -/* -Config file handler creator by Nach (C) 2005-2007 -*/ - -#if !defined(__GNUC__) && !defined(_MSC_VER) -#error You are using an unsupported compiler -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -using namespace std; - -#include -#include - -#ifdef _MSC_VER //MSVC -typedef int ssize_t; -#define strcasecmp stricmp -#define strncasecmp strnicmp -#define __WIN32__ -#endif - -string gcc = "gcc"; -string cflags; - -#ifdef _MSC_VER //MSVC -static inline string COMPILE_OBJ(const string& obj, const string& c) -{ - return(string(string("cl /nologo /Fo")+obj+string(" ")+c)); -} -#else -static inline string COMPILE_OBJ(const string& obj, const string& c) -{ - return(string(gcc+(" ")+cflags+(" -o ")+obj+string(" -c ")+c)); -} -#endif - -#define LINE_LENGTH 2048*4 -char line[LINE_LENGTH]; - -string family_name = "cfg"; - -/* - -Line Tracking and Error Control - -*/ - -static struct -{ - size_t line_number; - size_t column_number; - - void error(const char *str) - { - cerr << "Error: parse problem occured at " << line_number << ":" << column_number << ". " << str << "." << endl; - } -} current_location; - -/* - -String Functions for various parsing - -*/ - -//Find next matching character which is not escaped -char *find_next_match(char *str, char match_char) -{ - char *pos = 0; - - while (*str) - { - if (*str == match_char) - { - pos = str; - break; - } - if (*str == '\\') - { - if (str[1]) - { - str++; - } - else - { - break; - } - } - str++; - } - return(pos); -} - -//This is like strtok(), except this understands quoted characters and updates error locations -char *get_token(char *str, const char *delim) -{ - static char *pos = 0; - char *token = 0; - - if (str) //Start a new string? - { - pos = str; - } - - if (pos) - { - //Skip delimiters - while (*pos && strchr(delim, *pos)) - { - pos++; - } - if (*pos) - { - token = pos; - - //Skip non-delimiters - while (*pos && !strchr(delim, *pos)) - { - //Skip quoted characters - if ((*pos == '\"') || (*pos == '\'')) - { - char *match_pos = 0; - if ((match_pos = find_next_match(pos+1, *pos))) - { - pos = match_pos; - } - } - pos++; - } - if (*pos) - { - *pos++ = '\0'; - } - } - } - - if (token) { current_location.column_number = token - line; } - return(token); -} - -//Like strchr() but understands quoted characters -char *find_chr(char *str, char match_char) -{ - char *pos = 0; - - while (*str) - { - if (*str == match_char) - { - pos = str; - break; - } - //Skip quoted characters - if ((*str == '\"') || (*str == '\'')) - { - char *match_pos = 0; - if ((match_pos = find_next_match(str+1, *str))) - { - str = match_pos; - } - } - str++; - } - return(pos); -} - -//Convert $AB12 and 0AB12h style hex to 0xAB12 hex -string asm2c_hex_convert(string str) -{ - size_t dollar_pos; - int start = -1; - while ((dollar_pos = str.find("$", start+1)) != string::npos) - { - if ((str.length()-dollar_pos > 1) && isxdigit(str[dollar_pos+1])) - { - str.replace(dollar_pos, 1, "0x"); - dollar_pos++; - } - start = dollar_pos; - } - - start = -1; - int h_pos; - while ((string::size_type)(h_pos = str.find_first_of("hH", start+1)) != string::npos) - { - int h_len = 1; - while ((h_pos-h_len > start) && isxdigit(str[h_pos-h_len])) - { - h_len++; - } - h_len--; - - if (isdigit(str[h_pos-h_len])) - { - str.erase(h_pos, 1); - str.insert(h_pos-h_len, "0x"); - h_pos++; - } - start = h_pos; - } - - return(str); -} - -//Convert 2EF to 751 -string c_hex_convert(string str) -{ - size_t hex_pos; - while ((hex_pos = str.find("0x")) != string::npos) - { - size_t len = 2, total = 0; - while (isxdigit(str[hex_pos+len]) && !(str[hex_pos+len] == '0' && str[hex_pos+len+1] == 'x')) - { - total *= 16; - total += isdigit(str[hex_pos+len]) ? str[hex_pos+len]-'0' : (toupper(str[hex_pos+len])-'A')+10; - len++; - } - - ostringstream converter; - converter << total; - str.replace(hex_pos, len, converter.str()); - } - return(str); -} - -//Ascii numbers to integer, with support for mathematics in the string -ssize_t enhanced_atoi(char *&s, int level = 0) -{ - const int max_level = 6; - if (level == max_level) - { - if (*s == '(') - { - ssize_t res = enhanced_atoi(++s); - if (*s != ')') { current_location.error("Missing ) in expression"); } - s++; - return(res); - } - else if (isdigit(*s)) - { - int numc, t; - sscanf(s, "%d%n", &t, &numc); - s += numc; - return((ssize_t)t); - } - else if (*s == '-') - { - return(-enhanced_atoi(++s, max_level)); - } - else if (*s == '~') - { - return(~enhanced_atoi(++s, max_level)); - } - } - ssize_t val = enhanced_atoi(s, level+1); - while (*s) - { - const char *org = s; - switch (level) - { - case 0: if (*s != '|') { return(val); } break; - case 1: if (*s != '^') { return(val); } break; - case 2: if (*s != '&') { return(val); } break; - case 3: if (!((s[0] == '<' && s[1] == '<') || (s[0] == '>' && s[1] == '>'))) { return(val); } else { ++s; } break; - case 4: if (!(*s == '+' || *s == '-')) { return(val); } break; - case 5: if (!(*s == '*' || *s == '/' || *s == '%')) { return(val); } break; - } - ssize_t res = enhanced_atoi(++s, level+1); - switch (*org) - { - case '|': val |= res; break; - case '^': val ^= res; break; - case '&': val &= res; break; - case '<': val <<= res; break; - case '>': val >>= res; break; - case '+': val += res; break; - case '-': val -= res; break; - case '*': val *= res; break; - case '/': val /= res; break; - case '%': val %= res; break; - } - } - return(val); -} - -//Standard atoi(), but shows error if string isn't all a number -ssize_t safe_atoi(string str) -{ - if (!str.length()) { str = "X"; } //Force error - - const char *p = str.c_str(); - for (p = ((*p == '-') ? p+1 : p); *p; p++) - { - if (!isdigit(*p)) - { - current_location.error("Not a number"); - } - } - - return(atoi(str.c_str())); -} - -bool all_spaces(const char *str) -{ - while (*str) - { - if (!isspace(*str)) { return(false); } - str++; - } - return(true); -} - -string encode_string(const string& str, bool quotes = true) -{ - string newstr(""); - if (quotes) { newstr += '\"'; } - - for (size_t i = 0; i < str.length(); i++) - { - if ((str[i] == '\\') || - (str[i] == '\"') || - (str[i] == '\'') || - (str[i] == '\n') || - (str[i] == '\t')) - { - newstr += '\\'; - } - newstr += str[i]; - } - - if (quotes) { newstr += '\"'; } - return(newstr); -} - -/* - -Structures used to store config data - -*/ - -template -class nstack -{ - public: - nstack() {} - ~nstack() {} - - void push(T data) { this->data.push_back(data); } - bool empty() { return(data.empty()); } - T top() { return(data.back()); } - void pop() { data.pop_back(); } - size_t size() { return(data.size()); } - - bool all_true() - { - for (typename vector::iterator i = data.begin(); i != data.end(); i++) - { - if (!*i) - { - return(false); - } - } - return(true); - } - - private: - vector data; -}; - -set defines, dependancies; -nstack ifs; - -typedef vector str_array; - -str_array memsets; - -namespace variable -{ - enum ctype { NT, UC, US, UD, SC, SS, SD, LT }; - - static struct - { - const char *CTypeSpace; - const char *CTypeUnderscore; - char FormatChar; - bool Signed; - } info[] = { - { "", "", 0, false }, - { "unsigned char", "unsigned_char", 'u', false }, - { "unsigned short", "unsigned_short", 'u', false }, - { "unsigned int", "unsigned_int", 'u', false }, - { "char", "char", 'd', true }, - { "short", "short", 'd', true }, - { "int", "int", 'd', true } - }; - - ctype GetCType(const char *str) - { - int i = NT; - for ( ; i < LT; i++) - { - if (!strcmp(info[i].CTypeSpace, str)) { break; } - } - i %= LT; - - if (i == NT) - { - cerr << "Invalid C type \"" << str << "\" when parsing line " << current_location.line_number << "." << endl; - } - - return((ctype)i); - } - - enum storage_format { none, single, quoted, mult, mult_packed, ptr }; - - struct config_data_element - { - string name; - storage_format format; - ctype type; - size_t length; - string dependancy; - string comment; - - bool operator==(const string& name) const { return(this->name == name); } - }; - - typedef vector config_data_array; - - static class - { - private: - config_data_array data_array; - - bool duplicate_name(const string& name) - { - if (find(data_array.begin(), data_array.end(), name) != data_array.end()) - { - cerr << "Duplicate definition of \"" << name << "\" found on line " << current_location.line_number << "." << endl; - return(true); - } - return(false); - } - - public: - void add_comment(const string& comment) - { - config_data_element new_element = { "", none, NT, 0, "", comment }; - data_array.push_back(new_element); - } - - void add_var_single(const string& name, ctype type, const string& dependancy, const string& comment = "") - { - if (!duplicate_name(name)) - { - config_data_element new_element = { name, single, type, 0, dependancy, comment }; - data_array.push_back(new_element); - } - } - void add_var_single(const string& name, const char *type, const string& dependancy, const string& comment = "") - { - add_var_single(name, GetCType(type), dependancy, comment); - } - - void add_var_quoted(const string& name, const string& dependancy, const string& comment = "") - { - if (!duplicate_name(name)) - { - config_data_element new_element = { name, quoted, NT, 0, dependancy, comment }; - data_array.push_back(new_element); - } - } - - void add_var_mult(const string& name, ctype type, size_t length, const string& dependancy, const string& comment = "") - { - if (!duplicate_name(name)) - { - config_data_element new_element = { name, mult, type, length, dependancy, comment }; - data_array.push_back(new_element); - } - } - void add_var_mult(const string& name, const char *type, size_t length, const string& dependancy, const string& comment = "") - { - add_var_mult(name, GetCType(type), length, dependancy, comment); - } - - void add_var_packed(const string& name, size_t length, const string& dependancy, const string& comment = "") - { - if (!duplicate_name(name)) - { - config_data_element new_element = { name, mult_packed, NT, length, dependancy, comment }; - data_array.push_back(new_element); - } - } - - void add_var_ptr(const string& name, ctype type, size_t length, const string& dependancy, const string& comment = "") - { - if (!duplicate_name(name)) - { - config_data_element new_element = { name, ptr, type, length, dependancy, comment }; - data_array.push_back(new_element); - } - } - void add_var_ptr(const string& name, const char *type, size_t length, const string& dependancy, const string& comment = "") - { - add_var_ptr(name, GetCType(type), length, dependancy, comment); - } - - - bool ctype_mult_used(ctype type) - { - for (config_data_array::iterator i = data_array.begin(); i != data_array.end(); i++) - { - if ((i->format == mult) && (i->type == type)) - { - return(true); - } - } - return(false); - } - - bool ctype_ptr_used(ctype type) - { - for (config_data_array::iterator i = data_array.begin(); i != data_array.end(); i++) - { - if ((i->format == ptr) && (i->type == type)) - { - return(true); - } - } - return(false); - } - - bool packed_used() - { - for (config_data_array::iterator i = data_array.begin(); i != data_array.end(); i++) - { - if (i->format == mult_packed) - { - return(true); - } - } - return(false); - } - - bool quoted_used() - { - for (config_data_array::iterator i = data_array.begin(); i != data_array.end(); i++) - { - if (i->format == quoted) - { - return(true); - } - } - return(false); - } - - bool unsigned_used() - { - for (config_data_array::iterator i = data_array.begin(); i != data_array.end(); i++) - { - if (!info[i->type].Signed) - { - return(true); - } - } - return(false); - } - - config_data_array::iterator begin() { return(data_array.begin()); } - config_data_array::iterator end() { return(data_array.end()); } - } config_data; -} - -/* - -Compiler with it's helper functions - -*/ - -#define var_type_is_char(var_type) !strcmp(var_type+strlen(var_type)-strlen("char"), "char") -#define var_type_is_short(var_type) !strcmp(var_type+strlen(var_type)-strlen("short"), "short") -#define var_type_is_int(var_type) !strcmp(var_type+strlen(var_type)-strlen("int"), "int") - -#define short_scale "*sizeof(short)" -#define int_scale "*sizeof(int)" - -//Convert asm types to C types -const char *convert_asm_type(const char *str, bool unsigned_var = true) -{ - const char *var_type = 0; - if (!strcasecmp(str, "dd")) - { - var_type = "unsigned int"; - } - else if (!strcasecmp(str, "dw")) - { - var_type = "unsigned short"; - } - else if (!strcasecmp(str, "db")) - { - var_type = "unsigned char"; - } - else if (!strcasecmp(str, "sd")) - { - var_type = "int"; - } - else if (!strcasecmp(str, "sw")) - { - var_type = "short"; - } - else if (!strcasecmp(str, "sb")) - { - var_type = "char"; - } - else - { - current_location.error("Not a valid type"); - } - - if (var_type && !strncmp(var_type, "unsigned ", strlen("unsigned ")) && !unsigned_var) - { - var_type += strlen("unsigned "); - } - - return(var_type); -} - -void output_parser_start(ostream& c_stream, const string& cheader_file) -{ - c_stream << "/*\n" - << "Config file handler generated by Nach's Config file handler creator.\n" - << "*/\n" - << "\n" - << "#include \n" - << "#include \n" - << "#include \n" - << "#include \n"; - if (defines.find("PSR_COMPRESSED") != defines.end()) - { - c_stream << "#include \n"; - } - if (cheader_file.length()) - { - c_stream << "#include \"" << cheader_file << "\"\n"; - } - c_stream << "\n" - << "\n" - << "#define LINE_LENGTH " << LINE_LENGTH << "\n" - << "static char line[LINE_LENGTH];\n" - << "\n"; - if (variable::config_data.quoted_used() || variable::config_data.packed_used()) - { - c_stream << "\n" - << "static char *encode_string(const char *str)\n" - << "{\n" - << " size_t i = 0;\n" - << " line[i++] = '\\\"';\n" - << " while (*str)\n" - << " {\n" - << " if ((*str == '\\\\') ||\n" - << " (*str == '\\\"') ||\n" - << " (*str == '\\\'') ||\n" - << " (*str == '\\n') ||\n" - << " (*str == '\\t'))\n" - << " {\n" - << " line[i++] = '\\\\';\n" - << " }\n" - << " line[i++] = *str++;\n" - << " }\n" - << " line[i++] = '\\\"';\n" - << " line[i] = 0;\n" - << " return(line);\n" - << "}\n" - << "\n" - << "static char *decode_string(char *str)\n" - << "{\n" - << " size_t str_len = strlen(str), i = 0;\n" - << " char *dest = str;\n" - << "\n" - << " if ((str_len > 1) && (*str == '\\\"') && (str[str_len-1] == '\\\"'))\n" - << " {\n" - << " memmove(str, str+1, str_len-2);\n" - << " str[str_len-2] = 0;\n" - << "\n" - << " while (*str)\n" - << " {\n" - << " if (*str == '\\\\')\n" - << " {\n" - << " str++;\n" - << " }\n" - << " dest[i++] = *str++;\n" - << " }\n" - << " }\n" - << " dest[i] = 0;\n" - << " return(dest);\n" - << "}\n"; - } - c_stream << "\n" - << "static char *find_next_match(char *str, char match_char)\n" - << "{\n" - << " char *pos = 0;\n" - << "\n" - << " while (*str)\n" - << " {\n" - << " if (*str == match_char)\n" - << " {\n" - << " pos = str;\n" - << " break;\n" - << " }\n" - << " if (*str == '\\\\')\n" - << " {\n" - << " if (str[1])\n" - << " {\n" - << " str++;\n" - << " }\n" - << " else\n" - << " {\n" - << " break;\n" - << " }\n" - << " }\n" - << " str++;\n" - << " }\n" - << " return(pos);\n" - << "}\n" - << "\n" - << "static char *find_str(char *str, char *match_str)\n" - << "{\n" - << " char *pos = 0;\n" - << "\n" - << " while (*str)\n" - << " {\n" - << " if (strchr(match_str, *str))\n" - << " {\n" - << " pos = str;\n" - << " break;\n" - << " }\n" - << " if ((*str == '\\\"') || (*str == '\\\''))\n" - << " {\n" - << " char *match_pos = 0;\n" - << " if ((match_pos = find_next_match(str+1, *str)))\n" - << " {\n" - << " str = match_pos;\n" - << " }\n" - << " }\n" - << " str++;\n" - << " }\n" - << " return(pos);\n" - << "}\n" - << "\n"; - if (variable::config_data.unsigned_used()) - { - c_stream << "\n" - << "static int atoui(const char *nptr)\n" - << "{\n" - << " return(strtoul(nptr, 0, 10));\n" - << "}\n"; - } - c_stream << "\n"; -} - -void output_cheader_start(ostream& cheader_stream) -{ - cheader_stream << "/*\n" - << "Config file handler header generated by Nach's Config file handler creator.\n" - << "*/\n" - << "\n" - << "#ifdef __cplusplus\n" - << " extern \"C\" {\n" - << "#endif\n" - << "\n" - << "unsigned char read_" << family_name << "_vars(const char *);\n" - << "unsigned char write_" << family_name << "_vars(const char *);\n"; - if (defines.find("PSR_COMPRESSED") != defines.end()) - { - cheader_stream << "unsigned char read_" << family_name << "_vars_compressed(const char *);\n" - << "unsigned char write_" << family_name << "_vars_compressed(const char *);\n"; - } - if (defines.find("PSR_MEMCPY") != defines.end()) - { - cheader_stream << "void read_" << family_name << "_vars_memory(unsigned char *);\n" - << "void write_" << family_name << "_vars_memory(unsigned char *);\n" - << "unsigned int size_" << family_name << "_vars_memory();\n"; - } - cheader_stream << "\n"; -} - -void output_cheader_end(ostream& cheader_stream) -{ - cheader_stream << "\n" - << "#ifdef __cplusplus\n" - << " }\n" - << "#endif\n" - << "\n"; -} - - -void output_extsym_dependancies(ostream& c_stream) -{ - c_stream << "\n"; - for (set::iterator i = dependancies.begin(); i != dependancies.end(); i++) - { - c_stream << "extern unsigned char " << *i << ";\n"; - } -} - -void output_init_var(ostream& c_stream) -{ - c_stream << "\n" - << "static unsigned char psr_init_done = 0;\n" - << "static void init_" << family_name << "_vars()\n" - << "{\n" - << " if (!psr_init_done)\n" - << " {\n" - << " psr_init_done = 1;\n" - << "\n"; - for (str_array::iterator i = memsets.begin(); i != memsets.end(); i++) - { - c_stream << " " << *i << "\n"; - } - c_stream << " }\n" - << "}\n"; -} - -void output_packed_write(ostream& c_stream) -{ - if (variable::config_data.packed_used()) - { - c_stream << "\n" - << "static char *base94_encode(size_t size)\n" - << "{\n" - << " unsigned int i;\n" - << " static char buffer[] = { 0, 0, 0, 0, 0, 0};\n" - << " for (i = 0; i < 5; i++)\n" - << " {\n" - << " buffer[i] = ' ' + (char)(size % 94);\n" - << " size /= 94;\n" - << " }\n" - << " return(buffer);\n" - << "}\n" - << "\n" - << "static char *char_array_pack(const char *str, size_t len)\n" - << "{\n" - << " char packed[LINE_LENGTH];\n" - << " char *p = packed;\n" - << " while (len)\n" - << " {\n" - << " if (*str)\n" - << " {\n" - << " size_t length = strlen(str);\n" - << " strcpy(p, encode_string(str));\n" - << " str += length;\n" - << " len -= length;\n" - << " p += strlen(p);\n" - << " }\n" - << " else\n" - << " {\n" - << " size_t i = 0;\n" - << " while (!*str && len)\n" - << " {\n" - << " i++;\n" - << " str++;\n" - << " len--;\n" - << " }\n" - << "\n" - << " sprintf(p, \"0%s\", encode_string(base94_encode(i)));\n" - << " p += strlen(p);\n" - << " }\n" - << " *p++ = '\\\\';\n" - << " }\n" - << " p[-1] = 0;\n" - << " strcpy(line, packed);" - << " return(line);\n" - << "}\n"; - } -} - -void output_array_write(ostream& c_stream, variable::ctype type) -{ - if (variable::config_data.ctype_mult_used(type) || variable::config_data.ctype_ptr_used(type)) - { - c_stream << "\n" - << "static void write_" << variable::info[type].CTypeUnderscore << "_array(int (*outf)(void *, const char *, ...), void *fp, const char *var_name, " << variable::info[type].CTypeSpace << " *var, size_t size, const char *comment)\n" - << "{\n" - << " size_t i;\n" - << " outf(fp, \"%s=%" << variable::info[type].FormatChar << "\", var_name, (int)*var);\n" - << " for (i = 1; i < size; i++)\n" - << " {\n" - << " outf(fp, \",%" << variable::info[type].FormatChar << "\", (int)(var[i]));\n" - << " }\n" - << " if (comment)\n" - << " {\n" - << " outf(fp, \" ;%s\", comment);\n" - << " }\n" - << " outf(fp, \"\\n\");\n" - << "}\n"; - } -} - -void output_write_var(ostream& c_stream) -{ - output_packed_write(c_stream); - output_array_write(c_stream, variable::UC); - output_array_write(c_stream, variable::US); - output_array_write(c_stream, variable::UD); - output_array_write(c_stream, variable::SC); - output_array_write(c_stream, variable::SS); - output_array_write(c_stream, variable::SD); - - c_stream << "\n" - << "static void write_" << family_name << "_vars_internal(void *fp, int (*outf)(void *, const char *, ...))\n" - << "{\n"; - for (variable::config_data_array::iterator i = variable::config_data.begin(); i != variable::config_data.end(); i++) - { - string dependancy_prefix, dependancy_suffix; - if (i->dependancy != "") - { - dependancy_prefix = string("if (") + string(i->dependancy, 0, i->dependancy.length()-1) + string(") { "); - dependancy_suffix = " }"; - } - - if (i->format == variable::none) - { - if (i->comment != "") - { - c_stream << " outf(fp, \";%s\\n\", " << encode_string(i->comment) << ");\n"; - } - else - { - c_stream << " outf(fp, \"\\n\");\n"; - } - } - else if ((i->format == variable::mult) || (i->format == variable::ptr)) - { - c_stream << " " << dependancy_prefix << "write_" << variable::info[i->type].CTypeUnderscore - << "_array(outf, fp, \"" << i->dependancy << i->name << "\", " << i->name << ", " << i->length << ", " << ((i->comment != "") ? encode_string(i->comment) : "0") << ");" << dependancy_suffix << "\n"; - } - else - { - string config_comment = (i->comment != "") ? (string(" ;") + encode_string(i->comment, false)) : ""; - c_stream << " " << dependancy_prefix << "outf(fp, \"" << i->dependancy << i->name << "="; - if (i->format == variable::single) - { - c_stream << "%" << variable::info[i->type].FormatChar << config_comment << "\\n\", " << i->name; - } - else if (i->format == variable::quoted) - { - c_stream << "%s" << config_comment << "\\n\", encode_string(" << i->name << ")"; - } - else if (i->format == variable::mult_packed) - { - c_stream << "%s" << config_comment << "\\n\", char_array_pack((char *)" << i->name << ", " << i->length << ")"; - } - c_stream << ");" << dependancy_suffix << "\n"; - } - } - if (defines.find("PSR_HASH") != defines.end()) - { - c_stream << " outf(fp, \"\\n\\n\\n;Do not modify the following, for internal use only.\\n\");\n" - << " outf(fp, \"PSR_HASH" << "=%u\\n\", PSR_HASH);\n"; - } - c_stream << "}\n" - << "\n" - << "unsigned char write_" << family_name << "_vars(const char *file)\n" - << "{\n" - << " FILE *fp = 0;\n" - << "\n"; - if (defines.find("PSR_EXTERN") == defines.end()) - { - c_stream << " init_" << family_name << "_vars();\n" - << "\n"; - } - c_stream << " if ((fp = fopen(file, \"w\")))\n" - << " {\n" - << " write_" << family_name << "_vars_internal(fp, (int (*)(void *, const char *, ...))fprintf);\n" - << " fclose(fp);\n" - << "\n" - << " return(1);\n" - << " }\n" - << " return(0);\n" - << "}\n"; - - if (defines.find("PSR_COMPRESSED") != defines.end()) - { - c_stream << "\n" - << "unsigned char write_" << family_name << "_vars_compressed(const char *file)\n" - << "{\n" - << " gzFile gzfp;\n" - << "\n"; - if (defines.find("PSR_EXTERN") == defines.end()) - { - c_stream << " init_" << family_name << "_vars();\n" - << "\n"; - } - c_stream << " if ((gzfp = gzopen(file, \"wb9\")))\n" - << " {\n" - << " write_" << family_name << "_vars_internal(gzfp, gzprintf);\n" - << " gzclose(gzfp);\n" - << "\n" - << " return(1);\n" - << " }\n" - << "\n" - << " return(0);\n" - << "}\n"; - } - - if (defines.find("PSR_MEMCPY") != defines.end()) - { - c_stream << "\n" - << "static unsigned int " << family_name << "_vars_memory(unsigned char *buffer, void *(*cpy)(void *, void *, size_t))\n" - << "{\n" - << " unsigned char *p = buffer;\n"; - for (variable::config_data_array::iterator i = variable::config_data.begin(); i != variable::config_data.end(); i++) - { - string dependancy_prefix, dependancy_suffix; - if (i->dependancy != "") - { - dependancy_prefix = string("if (") + string(i->dependancy, 0, i->dependancy.length()-1) + string(") { "); - dependancy_suffix = " }"; - } - - if (i->format == variable::ptr) - { - c_stream << " " << dependancy_prefix << "cpy(p, " << i->name << ", sizeof(" <type].CTypeSpace << ")*" << i->length << "); p += sizeof(" << variable::info[i->type].CTypeSpace << ")*" << i->length << ";" << dependancy_suffix << "\n"; - } - else if (i->format != variable::none) - { - c_stream << " " << dependancy_prefix << "cpy(p, " << ((i->format == variable::single) ? "&" : "") << i->name << ", sizeof(" << i->name << ")); p += sizeof(" << i->name << ");" << dependancy_suffix << "\n"; - } - } - c_stream << " return(p-buffer);\n" - << "}\n" - << "\n" - << "static void *cpynull(void *l, void *r, size_t len){ return(0); }\n" - << "\n" - << "unsigned int size_" << family_name << "_vars_memory()\n" - << "{\n" - << " return(" << family_name << "_vars_memory(0, cpynull));\n" - << "}\n" - << "\n" - << "void write_" << family_name << "_vars_memory(unsigned char *buffer)\n" - << "{\n" - << " " << family_name << "_vars_memory(buffer, (void *(*)(void *, void *, size_t))memcpy);\n" - << "}\n"; - } -} - -void output_packed_read(ostream& c_stream) -{ - if (variable::config_data.packed_used()) - { - c_stream << "\n" - << "static size_t base94_decode(const char *buffer)\n" - << "{\n" - << " size_t size = 0;\n" - << " int i;\n" - << " for (i = 4; i >= 0; i--)\n" - << " {\n" - << " size *= 94;\n" - << " size += (size_t)(buffer[i]-' ');\n" - << " }\n" - << " return(size);\n" - << "}\n" - << "\n" - << "static char *get_token(char *str, char *delim)\n" - << "{\n" - << " static char *pos = 0;\n" - << " char *token = 0;\n" - << "\n" - << " if (str) //Start a new string?\n" - << " {\n" - << " pos = str;\n" - << " }\n" - << "\n" - << " if (pos)\n" - << " {\n" - << " //Skip delimiters\n" - << " while (*pos && strchr(delim, *pos))\n" - << " {\n" - << " pos++;\n" - << " }\n" - << " if (*pos)\n" - << " {\n" - << " token = pos;\n" - << "\n" - << " //Skip non-delimiters\n" - << " while (*pos && !strchr(delim, *pos))\n" - << " {\n" - << " //Skip quoted characters\n" - << " if ((*pos == '\\\"') || (*pos == '\\''))\n" - << " {\n" - << " char *match_pos = 0;\n" - << " if ((match_pos = find_next_match(pos+1, *pos)))\n" - << " {\n" - << " pos = match_pos;\n" - << " }\n" - << " }\n" - << " pos++;\n" - << " }\n" - << " if (*pos)\n" - << " {\n" - << " *pos++ = '\\0';\n" - << " }\n" - << " }\n" - << " }\n" - << " return(token);\n" - << "}\n" - << "\n" - << "static char *char_array_unpack(char *str)\n" - << "{\n" - << " char packed[LINE_LENGTH];\n" - << " char *p = packed, *token;\n" - << " size_t len = 0;\n" - << " memset(packed, 0, sizeof(packed));\n" - << " for (token = get_token(str, \"\\\\\"); token; token = get_token(0, \"\\\\\"))\n" - << " {\n" - << " if (*token == '0')\n" - << " {\n" - << " size_t i = base94_decode(decode_string(token+1));\n" - << " len += i;\n" - << " if (len > sizeof(packed)) { break; }\n" - << " memset(p, 0, i);\n" - << " p += i;\n" - << " }\n" - << " else\n" - << " {\n" - << " char *decoded = decode_string(token);\n" - << " size_t decoded_length = strlen(decoded);\n" - << " len += decoded_length;\n" - << " if (len > sizeof(packed))\n" - << " {\n" - << " memcpy(p, decoded, sizeof(packed)-(len-decoded_length));\n" - << " break;\n" - << " }\n" - << " memcpy(p, decoded, decoded_length);\n" - << " p += decoded_length;\n" - << " }\n" - << " }\n" - << " memcpy(line, packed, sizeof(packed));" - << " return(line);\n" - << "}\n"; - } -} - -void output_array_read(ostream& c_stream, variable::ctype type) -{ - if (variable::config_data.ctype_mult_used(type) || variable::config_data.ctype_ptr_used(type)) - { - c_stream << "\n" - << "static void read_" << variable::info[type].CTypeUnderscore << "_array(char *line, " << variable::info[type].CTypeSpace << " *var, size_t size)\n" - << "{\n" - << " size_t i;\n" - << " char *token;\n" - << " *var = (" << variable::info[type].CTypeSpace << ")" << (variable::info[type].Signed ? "atoi" : "atoui") << "(strtok(line, \", \\t\\r\\n\"));\n" - << " for (i = 1; (i < size) && (token = strtok(0, \", \\t\\r\\n\")); i++)\n" - << " {\n" - << " var[i] = (" << variable::info[type].CTypeSpace << ")" << (variable::info[type].Signed ? "atoi" : "atoui") << "(token);\n" - << " }\n" - << "}\n"; - } -} - -void output_read_var(ostream& c_stream) -{ - output_packed_read(c_stream); - output_array_read(c_stream, variable::UC); - output_array_read(c_stream, variable::US); - output_array_read(c_stream, variable::UD); - output_array_read(c_stream, variable::SC); - output_array_read(c_stream, variable::SS); - output_array_read(c_stream, variable::SD); - - c_stream << "\n" - << "static void read_" << family_name << "_vars_internal(void *fp, char *(*fin)(char *, int, void *), int (*fend)(void *))\n" - << "{\n" - << " while (!fend(fp))\n" - << " {\n" - << " char *p, *var, *value;\n" - << "\n" - << " fin(line, LINE_LENGTH, fp);\n" - << " if ((p = find_str(line, \";\"))) { *p = 0; }\n" - << " if ((p = strchr(line, '=')))\n" - << " {\n" - << " *p = 0;\n" - << " var = line;\n" - << " value = p+1;\n" - << " while (isspace(*var)) { var++; }\n" - << " while (isspace(*value)) { value++; }\n" - << " if ((p = find_str(var, \" \\t\\r\\n\"))) { *p = 0; }\n" - << " if ((p = find_str(value, \" \\t\\r\\n\"))) { *p = 0; }\n" - << " if (!*var || !*value) { continue; }\n"; - if (dependancies.size()) - { - c_stream << " if ((p = strchr(var, ':')))\n" - << " {\n" - << " if (!strlen(p+1)) { continue; }\n"; - set::iterator i = dependancies.begin(); - c_stream << " if (!strncmp(var, \"" << *i << ":\", (p-var)+1)) { if (!" << *i << ") { continue; } }\n"; - for (i++; i != dependancies.end(); i++) - { - c_stream << " else if (!strncmp(var, \"" << *i << ":\", (p-var)+1)) { if (!" << *i << ") { continue; } }\n"; - } - c_stream << " else { continue; }\n" - << " }\n"; - } - c_stream << " }\n" - << " else\n" - << " {\n" - << " continue;\n" - << " }\n" - << "\n"; - for (variable::config_data_array::iterator i = variable::config_data.begin(); i != variable::config_data.end(); i++) - { - if (i->format != variable::none) - { - c_stream << " if (!strcmp(var, \"" << i->dependancy << i->name << "\")) { "; - if (i->format == variable::single) - { - c_stream << i->name << " = (" << variable::info[i->type].CTypeSpace << ")" << (variable::info[i->type].Signed ? "atoi" : "atoui") << "(value);"; - } - else if ((i->format == variable::mult) || (i->format == variable::ptr)) - { - c_stream << "read_" << variable::info[i->type].CTypeUnderscore - << "_array(value, " << i->name << ", " << i->length << ");"; - } - else if (i->format == variable::quoted) - { - c_stream << "*" << i->name << " = 0; " - << "strncat(" << i->name << ", decode_string(value), sizeof(" << i->name << ")-1);"; - } - else if (i->format == variable::mult_packed) - { - c_stream << "memcpy(" << i->name << ", char_array_unpack(value), " << i->length << ");"; - } - c_stream << " continue; }\n"; - } - } - if (defines.find("PSR_HASH") != defines.end()) - { - c_stream << " if (!strcmp(var, \"PSR_HASH\"))\n" - << " {\n" - << " if ((unsigned int)atoui(value) == PSR_HASH)\n" - << " {\n" - << " psr_init_done = 2;\n" - << " continue;\n" - << " }\n" - << " break;\n" - << " }\n"; - } - c_stream << " }\n"; - if (defines.find("PSR_HASH") != defines.end()) - { - c_stream << " if (psr_init_done == 2)\n" - << " {\n" - << " psr_init_done = 1;\n" - << " }\n" - << " else\n" - << " {\n" - << " psr_init_done = 0;\n" - << " init_" << family_name << "_vars();\n" - << " }\n"; - } - c_stream << "}\n" - << "\n" - << "unsigned char read_" << family_name << "_vars(const char *file)\n" - << "{\n" - << " FILE *fp = 0;\n" - << "\n"; - if (defines.find("PSR_EXTERN") == defines.end()) - { - c_stream << " init_" << family_name << "_vars();\n" - << "\n"; - } - c_stream << " if ((fp = fopen(file, \"r\")))\n" - << " {\n" - << " read_" << family_name << "_vars_internal(fp, (char *(*)(char *, int, void *))fgets, (int (*)(void *))feof);\n" - << " fclose(fp);\n"; - if (defines.find("PSR_NOUPDATE") == defines.end()) - { - c_stream << " write_" << family_name << "_vars(file);\n"; - } - c_stream << " return(1);\n" - << " }\n" - << "\n"; - if (defines.find("PSR_NOUPDATE") == defines.end()) - { - c_stream << " write_" << family_name << "_vars(file);\n"; - } - c_stream << " return(0);\n" - << "}\n"; - - if (defines.find("PSR_COMPRESSED") != defines.end()) - { - c_stream << "\n" - << "static char *gzgets_fix(char *buf, int len, void *file)\n" - << "{\n" - << " return(gzgets(file, buf, len));\n" - << "}\n" - << "\n" - << "unsigned char read_" << family_name << "_vars_compressed(const char *file)\n" - << "{\n" - << " gzFile gzfp;\n" - << "\n"; - if (defines.find("PSR_EXTERN") == defines.end()) - { - c_stream << " init_" << family_name << "_vars();\n" - << "\n"; - } - c_stream << " if ((gzfp = gzopen(file, \"rb\")))\n" - << " {\n" - << " read_" << family_name << "_vars_internal(gzfp, gzgets_fix, gzeof);\n" - << " gzclose(gzfp);\n"; - if (defines.find("PSR_NOUPDATE") == defines.end()) - { - c_stream << " write_" << family_name << "_vars_compressed(file);\n"; - } - c_stream << " return(1);\n" - << " }\n" - << "\n"; - if (defines.find("PSR_NOUPDATE") == defines.end()) - { - c_stream << " write_" << family_name << "_vars_compressed(file);\n"; - } - c_stream << " return(0);\n" - << "}\n"; - } - - if (defines.find("PSR_MEMCPY") != defines.end()) - { - c_stream << "\n" - << "static void *cpyright(void *src, void *dest, size_t len)\n" - << "{\n" - << " memcpy(dest, src, len);\n" - << " return(0);\n" - << "}\n" - << "\n" - << "void read_" << family_name << "_vars_memory(unsigned char *buffer)\n" - << "{\n" - << " " << family_name << "_vars_memory(buffer, cpyright);\n" - << "}\n"; - } -} - -void handle_directive(const char *instruction, const char *label) -{ - if (!strcasecmp(instruction, "define")) - { - if (label) - { - defines.insert(label); - } - else - { - current_location.error("Could not get define label"); - } - } - else if (!strcasecmp(instruction, "undef")) - { - if (label) - { - defines.erase(label); - } - else - { - current_location.error("Could not get undefine label"); - } - } - else if (!strcasecmp(instruction, "ifdef")) - { - if (label) - { - if (defines.find(label) != defines.end()) - { - ifs.push(true); - } - else - { - ifs.push(false); - } - } - else - { - current_location.error("Could not get ifdef label"); - } - } - else if (!strcasecmp(instruction, "ifndef")) - { - if (label) - { - if (defines.find(label) == defines.end()) - { - ifs.push(true); - } - else - { - ifs.push(false); - } - } - else - { - current_location.error("Could not get ifndef label"); - } - } - else if (!strcasecmp(instruction, "else")) - { - if (label) - { - current_location.error("Processor directive else does not accept labels"); - } - else - { - if (ifs.empty()) - { - current_location.error("Processor directive else without ifdef"); - } - else - { - bool process = !ifs.top(); - ifs.pop(); - ifs.push(process); - } - } - } - else if (!strcasecmp(instruction, "elifdef") || !strcasecmp(instruction, "elseifdef")) - { - if (label) - { - if (ifs.top()) - { - ifs.pop(); - ifs.push(false); - } - else if (defines.find(label) != defines.end()) - { - ifs.pop(); - ifs.push(true); - } - } - else - { - current_location.error("Could not get elseifdef label"); - } - - } - else if (!strcasecmp(instruction, "endif")) - { - if (label) - { - current_location.error("Processor directive endif does not accept labels"); - } - else - { - if (ifs.empty()) - { - current_location.error("Processor directive endif without ifdef"); - } - else - { - ifs.pop(); - } - } - } - else - { - current_location.error("Unknown processor directive"); - } -} - -//Return the comment from global line variable -char *get_comment(char comment_seperator) -{ - char *comment = find_chr(line, comment_seperator); - if (comment) - { - *comment = 0; - comment++; - if (isspace(comment[strlen(comment)-1])) - { - comment[strlen(comment)-1] = 0; - } - } - return(comment); -} - -void output_parser_comment(ostream& c_stream, const char *comment) -{ - if (comment) - { - c_stream << " //" << comment; - } - c_stream << "\n"; -} - -void output_header_conditional(ostream& cheader_stream, const char *instruction, const char *label) -{ - if ((!strcasecmp(instruction, "elifdef") || !strcasecmp(instruction, "elseifdef")) && label) - { - cheader_stream << "#elif defined(" << label << ")\n"; - } - else - { - cheader_stream << "#" << instruction; - if (label) - { - cheader_stream << " " << label; - } - cheader_stream << "\n"; - } -} - - -#define CONFIG_COMMENT (config_comment ? config_comment : "") - -void parser_generate(istream& psr_stream, ostream& c_stream, ostream& cheader_stream, const string& cheader_file = "") -{ - current_location.line_number = current_location.column_number = 0; - ostringstream cvars(""), hvars(""); - uLong psr_file_hash = crc32(0L, Z_NULL, 0); - - while (!psr_stream.eof()) - { - char *token; - const char *parser_comment; - const char *config_comment; - - - psr_stream.getline(line, LINE_LENGTH); - current_location.line_number++; - psr_file_hash = crc32(psr_file_hash, (const Bytef *)line, strlen(line)); - - parser_comment = get_comment(';'); - - if (all_spaces(line)) - { - if (ifs.all_true()) - { - output_parser_comment(cvars, parser_comment); - } - continue; - } - - config_comment = get_comment('@'); - - if (all_spaces(line) && config_comment) - { - if (ifs.all_true()) - { - variable::config_data.add_comment(config_comment); - } - continue; - } - - if ((token = get_token(line, " ")) && - (strcasecmp(token, "NEWSYM") || (token = get_token(0, " ,")))) - { - if ((*token == '#') || (*token == '%')) - { - const char *next_token = get_token(0, " "); - handle_directive(token+1, next_token); - - if (cheader_stream && (!next_token || strncasecmp(next_token, "PSR_", strlen("PSR_")))) - { - output_header_conditional(hvars, token+1, next_token); - } - continue; - } - - string varname; - string dependancy; - const char *d; - - if ((d = strchr(token, ':'))) - { - varname = d+1; - dependancy.assign(token, d-token); - dependancies.insert(dependancy); - dependancy += ':'; - } - else - { - varname = token; - } - - if ((token = get_token(0, " ,"))) - { - size_t array = 0; - bool is_array = !strcasecmp(token, "times"); - bool is_packed = !strcasecmp(token, "packed"); - bool is_ptr = !strcasecmp(token, "ptr"); - if ((!is_array && !is_packed && !is_ptr) || - ((token = get_token(0, " ")) && (array = enhanced_atoi(token)) && (token = get_token(0, " ")))) - { - const char *asm_type = token; - const char *var_type = convert_asm_type(asm_type); - - if (var_type) - { - string initial_value = get_token(0, " ,\n"); - ostringstream var_init(""); - - if (((initial_value[0] == '\"') && (initial_value[initial_value.length()-1] == '\"')) || - ((initial_value[0] == '\'') && (initial_value[initial_value.length()-1] == '\''))) - { - //Make sure it's double quoted - initial_value[0] = '\"'; - initial_value[initial_value.length()-1] = '\"'; - - if (!array) - { - array = initial_value.length()-1; //Size minus quotes plus null - } - - var_init << "char " << varname << "[" << array << "];"; - - if (ifs.all_true()) - { - ostringstream memset_line; - - if (initial_value.length()-2 < array) - { - memset_line << "strcpy(" << varname << ", " << initial_value << ");"; - } - else - { - memset_line << "strncpy(" << varname << ", " << initial_value << ", " << (array-1) << "); " - << varname << "[" << array << "] = 0;"; - } - memsets.push_back(memset_line.str()); - variable::config_data.add_var_quoted(varname, dependancy, CONFIG_COMMENT); - } - } - else if (is_ptr) - { - var_init << var_type << " *" << varname << ";"; - if (ifs.all_true()) - { - variable::config_data.add_var_ptr(varname, var_type, array, dependancy, CONFIG_COMMENT); - } - } - else - { - ssize_t init_value_num = safe_atoi(c_hex_convert(asm2c_hex_convert(initial_value))); - - if ((init_value_num < 0) && !strncmp(var_type, "unsigned ", strlen("unsigned "))) - { - var_type += strlen("unsigned "); - } - - var_init << var_type << " " << varname; - if (array) - { - if (var_type_is_char(var_type) || !init_value_num) - { - var_init << "[" << array << "]"; - - if (ifs.all_true()) - { - ostringstream memset_line; - memset_line << "memset(" << varname << ", " << init_value_num << ", " << array; - - if (var_type_is_short(var_type)) - { - memset_line << short_scale; - } - else if (var_type_is_int(var_type)) - { - memset_line << int_scale; - } - - memset_line << ");"; - memsets.push_back(memset_line.str()); - } - } - else - { - var_init << "[" << array << "] = {"; - for (size_t i = array; i > 1; i--) - { - var_init << init_value_num << ","; - } - var_init << init_value_num << "}"; - } - - if (ifs.all_true()) - { - if (is_array) - { - variable::config_data.add_var_mult(varname, var_type, array, dependancy, CONFIG_COMMENT); - } - else if (is_packed) - { - variable::config_data.add_var_packed(varname, array, dependancy, CONFIG_COMMENT); - } - } - } - else - { - if ((token = get_token(0, " ,\n"))) - { - array = 1; - var_init << "[] = {" << init_value_num; - do - { - var_init << "," << atoi(token); - array++; - } while((token = get_token(0, " ,\n"))); - var_init << "}"; - - if (ifs.all_true()) - { - variable::config_data.add_var_mult(varname, var_type, array, dependancy, CONFIG_COMMENT); - } - } - else - { - var_init << " = " << init_value_num; - - if (ifs.all_true()) - { - variable::config_data.add_var_single(varname, var_type, dependancy, CONFIG_COMMENT); - } - } - } - var_init << ";"; - } - - if (ifs.all_true()) - { - cvars << var_init.str(); - } - - if (cheader_stream) - { - string header_data = var_init.str(); - size_t equal_pos; - if ((equal_pos = header_data.find("=")) != string::npos) - { - header_data.erase(equal_pos-1); - header_data.append(";"); - } - hvars << "extern " << header_data << "\n"; - } - } - //Else already handled - } - else - { - current_location.error("Could not get array size"); - } - } - else - { - current_location.error("Could not get type"); - } - } - else - { - current_location.error("Could not get variable name"); - } - - if (ifs.all_true()) - { - output_parser_comment(cvars, parser_comment); - } - } - - output_parser_start(c_stream, cheader_file); - output_extsym_dependancies(c_stream); - if (defines.find("PSR_EXTERN") == defines.end()) - { - c_stream << cvars.str(); - output_init_var(c_stream); - } - else if (!cheader_file.length()) - { - cerr << "Error: Requested PSR_EXTERN yet no header file specified." << endl; - } - - if (defines.find("PSR_HASH") != defines.end()) - { - c_stream << "static unsigned int PSR_HASH = 0x" << hex << psr_file_hash << dec << ";\n"; - } - - output_write_var(c_stream); - output_read_var(c_stream); - c_stream << "\n"; - - - if (cheader_stream) - { - output_cheader_start(cheader_stream); - cheader_stream << hvars.str(); - output_cheader_end(cheader_stream); - } - - if (!ifs.empty()) - { - cerr << "Error: " << ifs.size() << " ifdef segments have no endif." << endl; - } -} - -int main(size_t argc, const char *const *const argv) -{ - const char *cheader_file = 0; - bool compile = false; - - size_t param_pos = 1; - for (; param_pos < argc; param_pos++) - { - if (!strncmp(argv[param_pos], "-D", 2)) - { - defines.insert(argv[param_pos]+2); - } - else if (!strcmp(argv[param_pos], "-cheader")) - { - param_pos++; - cheader_file = argv[param_pos]; - } - else if (!strcmp(argv[param_pos], "-compile")) - { - compile = true; - } - else if (!strcmp(argv[param_pos], "-flags")) - { - param_pos++; - cflags = argv[param_pos]; - } - else if (!strcmp(argv[param_pos], "-fname")) - { - param_pos++; - family_name = argv[param_pos]; - } - else if (!strcmp(argv[param_pos], "-gcc")) - { - param_pos++; - gcc = argv[param_pos]; - } - else - { - break; - } - } - - if ((argc-param_pos) != 2) - { - cout << "Config file handler creator by Nach (C) 2005-2007\n" - << "\n" - << "Usage:\n" - << "parsegen [options] \n" - << "\n" - << "\n" - << "Options:\n" - << "\n" - << " -Ddefine Define a processor director. Example: -D__WIN32__\n" - << " Can specify multiple defines.\n" - << "\n" - << " -cheader Create a C/C++ header with the following name.\n" - << " Example: -cheader cfgvars.h\n" - << "\n" - << " -fname Use the following name for the main functions.\n" - << " Example: -fname math\n" - << " Would make init_cfg_vars become init_math_vars the\n" - << " happens to write_cfg_vars and read_cfg_vars.\n" - << "\n" - << " -compile Compiles output instead of outputting C file.\n" - << "\n" - << " -gcc Use with -compile. Parameter passed in the name of\n" - << " the C compiler to use, it should be GCC based.\n" - << " It will not work with MSVC based compilers.\n" - << "\n" - << " -flags Use with -compile. Flags passed as next parameter\n" - << " are passed to the C compiler.\n" - << " Example: -flags \"-O3 -march=pentium3 -ggdb3\"\n" - << "\n" - << endl; - - return(1); - } - - string cname = family_name+string(".c"); - const char *psr_file = argv[param_pos+1], *c_file = compile ? cname.c_str() : argv[param_pos]; - const char *obj_file = compile ? argv[param_pos] : 0; - int ret_val = 0; - - ifstream psr_stream(psr_file); - if (psr_stream) - { - ofstream c_stream(c_file); - if (c_stream) - { - ofstream cheader_stream; - if (cheader_file) - { - cheader_stream.open(cheader_file); - if (cheader_stream) - { - parser_generate(psr_stream, c_stream, cheader_stream, cheader_file); - } - else - { - cerr << "Error opening " << cheader_file << " for writing." << endl; - ret_val |= 8; - } - - cheader_stream.close(); - } - else - { - parser_generate(psr_stream, c_stream, cheader_stream); - } - c_stream.close(); - } - else - { - cerr << "Error opening " << c_file << " for writing." << endl; - ret_val |= 2; - } - - psr_stream.close(); - } - else - { - cerr << "Error opening " << psr_file << " for reading." << endl; - ret_val |= 4; - } - - if (!ret_val && compile) - { - string command = COMPILE_OBJ(obj_file, cname); - cout << "parsegen: " << command << "\n"; - system(command.c_str()); - remove(cname.c_str()); - } - - return(ret_val); -} - diff --git a/tools/zsnes/src/patch.c b/tools/zsnes/src/patch.c deleted file mode 100644 index a6f0119..0000000 --- a/tools/zsnes/src/patch.c +++ /dev/null @@ -1,299 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#else -#include -#include -#include -#include -#endif -#include "zpath.h" - -#ifndef __GNUC__ -#define strcasecmp stricmp -#define strncasecmp strnicmp -#endif - -#define BUFFER_SIZE 2048 - -extern int maxromspace; -extern int curromspace; -extern int NumofBytes; -extern int NumofBanks; -extern unsigned int *romdata; -extern bool IPSPatched; -extern unsigned char Header512; -extern bool AutoPatch; - -struct -{ - unsigned int file_size; - unsigned char *data; - unsigned char *current; - unsigned int buffer_total; - unsigned int proccessed; - - unzFile zipfile; - FILE *fp; -} IPSPatch; - - -bool reloadBuffer() -{ - if (IPSPatch.proccessed == IPSPatch.file_size) { return(false); } - - IPSPatch.buffer_total = IPSPatch.fp ? - /* Regular Files */ fread(IPSPatch.data, 1, BUFFER_SIZE, IPSPatch.fp) : - /* Zip Files */ (unsigned int)unzReadCurrentFile(IPSPatch.zipfile, IPSPatch.data, BUFFER_SIZE); - - IPSPatch.current = IPSPatch.data; - if (IPSPatch.buffer_total && (IPSPatch.buffer_total <= BUFFER_SIZE)) - { - return(true); - } - - IPSPatch.buffer_total = 0; - return(false); -} - -int IPSget() -{ - int retVal; - if (IPSPatch.current == IPSPatch.data + IPSPatch.buffer_total) - { - if (!reloadBuffer()) { return(-1); } - } - IPSPatch.proccessed++; - retVal = *IPSPatch.current; - IPSPatch.current++; - return(retVal); -} - -bool initPatch(const char *ext) -{ - memset(&IPSPatch, 0, sizeof(IPSPatch)); - setextension(ZSaveName, ext); - - IPSPatch.fp = fopen_dir(ZSramPath, ZSaveName, "rb"); - if (!IPSPatch.fp) { IPSPatch.fp = fopen_dir(ZRomPath, ZSaveName, "rb"); } - if (!IPSPatch.fp) { return(false); } - - fseek(IPSPatch.fp, 0, SEEK_END); - IPSPatch.file_size = (unsigned int)ftell(IPSPatch.fp); - rewind(IPSPatch.fp); - - if ((IPSPatch.data = (unsigned char *)malloc(BUFFER_SIZE))) - { - return(reloadBuffer()); - } - return(false); -} - -void deinitPatch() -{ - if (IPSPatch.data) - { - free(IPSPatch.data); - IPSPatch.data = 0; - } - - if (IPSPatch.fp) - { - fclose(IPSPatch.fp); - IPSPatch.fp = 0; - } - - if (IPSPatch.zipfile) - { - unzCloseCurrentFile(IPSPatch.zipfile); - unzClose(IPSPatch.zipfile); - IPSPatch.zipfile = 0; - } -} - - -bool PatchUsingIPS(const char *ext) -{ - unsigned char *ROM = (unsigned char *)romdata; - int location = 0, length = 0, last = 0; - int sub = Header512 ? 512 : 0; - - if (!AutoPatch) - { - deinitPatch(); //Needed if the call to this function was done from findZipIPS() - return(false); - } - - if (!IPSPatch.zipfile) //Regular file, not Zip - { - if (!initPatch(ext)) - { - deinitPatch(); //Needed because if it didn't fully init, some things could have - return(false); - } - } - - //Yup, it's goto! :) - //See 'IPSDone:' for explanation - if (IPSget() != 'P') { goto IPSDone; } - if (IPSget() != 'A') { goto IPSDone; } - if (IPSget() != 'T') { goto IPSDone; } - if (IPSget() != 'C') { goto IPSDone; } - if (IPSget() != 'H') { goto IPSDone; } - - while (IPSPatch.proccessed != IPSPatch.file_size) - { - //Location is a 3 byte value (max 16MB) - int inloc = (IPSget() << 16) | (IPSget() << 8) | IPSget(); - - if (inloc == 0x454f46) //EOF - { - break; - } - - //Offset by size of ROM header - location = inloc - sub; - - //Length is a 2 byte value (max 64KB) - length = (IPSget() << 8) | IPSget(); - - if (length) // Not RLE - { - int i; - for (i = 0; i < length; i++, location++) - { - if (location >= 0) - { - if (location >= maxromspace) { goto IPSDone; } - ROM[location] = (unsigned char)IPSget(); - if (location > last) { last = location; } - } - else - { - IPSget(); //Need to skip the bytes that write to header - } - } - } - else //RLE - { - int i; - unsigned char newVal; - length = (IPSget() << 8) | IPSget(); - newVal = (unsigned char)IPSget(); - for (i = 0; i < length; i++, location++) - { - if (location >= 0) - { - if (location >= maxromspace) { goto IPSDone; } - ROM[location] = newVal; - if (location > last) { last = location; } - } - } - } - } - - //We use gotos to break out of the nested loops, - //as well as a simple way to check for 'PATCH' in - //some cases like this one, goto is the way to go. - IPSDone: - - deinitPatch(); - - IPSPatched = true; - - //Adjust size values if the ROM was expanded - if (last >= curromspace) - { - NumofBytes = curromspace = last+1; - NumofBanks = NumofBytes/32768; - } - - /* - //Write out patched ROM - { - FILE *fp = 0; - fp = fopen_dir(ZCfgPath, "zsnes.rom", "wb"); - if (!fp) { perror("zsnes.rom"); asm volatile("int $3"); } - fwrite(ROM, 1, curromspace, fp); - fclose(fp); - } - */ - - return(true); -} - -bool findZipIPS(char *compressedfile, const char *ext) -{ - bool FoundIPS = false; - unz_file_info cFileInfo; //Create variable to hold info for a compressed file - int cFile; - - memset(&IPSPatch, 0, sizeof(IPSPatch)); - - IPSPatch.zipfile = unzopen_dir(ZRomPath, compressedfile); //Open zip file - cFile = unzGoToFirstFile(IPSPatch.zipfile); //Set cFile to first compressed file - - while(cFile == UNZ_OK) //While not at end of compressed file list - { - //Temporary char array for file name - char cFileName[256]; - - //Gets info on current file, and places it in cFileInfo - unzGetCurrentFileInfo(IPSPatch.zipfile, &cFileInfo, cFileName, 256, NULL, 0, NULL, 0); - - //Find IPS file - if (isextension(cFileName, ext)) - { - FoundIPS = true; - break; - } - - //Go to next file in zip file - cFile = unzGoToNextFile(IPSPatch.zipfile); - } - - if (FoundIPS) - { - //Open file - unzOpenCurrentFile(IPSPatch.zipfile); - - IPSPatch.file_size = (unsigned int)cFileInfo.uncompressed_size; - if ((IPSPatch.data = (unsigned char *)malloc(BUFFER_SIZE))) - { - reloadBuffer(); - return(PatchUsingIPS(0)); - } - else - { - deinitPatch(); - } - } - else - { - unzClose(IPSPatch.zipfile); - IPSPatch.zipfile = 0; - } - return(false); -} diff --git a/tools/zsnes/src/tools/archopt.c b/tools/zsnes/src/tools/archopt.c deleted file mode 100644 index 5bb9db9..0000000 --- a/tools/zsnes/src/tools/archopt.c +++ /dev/null @@ -1,519 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 -#include -#include -#include - -#ifdef _M_X64 -#define __x86_64__ -#endif - -#ifdef __GNUC__ -#ifdef __x86_64__ -#define cpuid(in, a, b, c, d) asm volatile("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in)); -#else -#define cpuid(in, a, b, c, d) asm volatile("\ - pushl %%ebx;\ - movl %%edi,%%ebx;\ - cpuid;\ - movl %%ebx,%%edi;\ - popl %%ebx": "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (in)); -#endif -#else -char cpubuf[256]; -int z_in, z_a, z_b, z_c, z_d; -void cpuid_run() -{ - _asm { - mov eax,z_in - cpuid - mov z_a,eax - mov z_b,ebx - mov z_c,ecx - mov z_d,edx - }; -} -#define cpuid(in, a, b, c, d) z_in = in; cpuid_run(); a = z_a; b = z_b; c = z_c; d = z_d; -#endif - -char *x86_flags[] = -{ "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", - "cx8", "apic", 0, "sep", "mtrr", "pge", "mca", "cmov", - "pat", "pse36", "pn", "clflush", 0, "dts", "acpi", "mmx", - "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", - - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, "syscall", 0, 0, 0, 0, - 0, 0, 0, "mp", "nx", 0, "mmxext", 0, - 0, "fxsr_opt", "rdtscp", 0, 0, "lm", "3dnowext", "3dnow", - - "recovery", "longrun", 0, "lrti", 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - "pni", 0, 0, "monitor", "ds_cpl", "vmx", "smx", "est", - "tm2", "ssse3", "cid", 0, 0, "cx16", "xtpr", 0, - 0, 0, "dca", 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, "rng", "rng_en", 0, 0, "ace", "ace_en", - "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - "lahf_lm", "cmp_legacy", "svm", 0, "cr8legacy", 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - -void add_flags(char *flags, unsigned int reg, unsigned int offset) -{ - unsigned int i; - for (i = 0; i < 32; i++) - { - if ((reg & (1 << i)) && x86_flags[i+offset]) - { - strcat(flags, x86_flags[i+offset]); - strcat(flags, " "); - } - } -} - -int have_cpuid() -{ - int have = 0x200000; - #ifndef __x86_64__ - #ifdef __GNUC__ - asm volatile - ( - " pushfl;" - " pop %%eax;" - " movl %%eax,%%edx;" - " xorl %%ecx,%%eax;" - " push %%eax;" - " popfl;" - " pushfl;" - " pop %%eax;" - " xorl %%edx,%%eax;" - : "=a" (have) - : "c" (have) - ); - #else - z_c = have; - _asm { - mov ecx,z_c - pushfd - pop eax - mov edx,eax - xor eax,ecx - push eax - popfd - pushfd - pop eax - xor eax,edx - mov z_a,eax - }; - have = z_a; - #endif - #endif - return(have); -} - -int main(int argc, const char *const *const argv) -{ - char model_name[216]; - char flags[216]; - char cpu_family[216]; - char vendor_id[216]; - char model[216]; - - char *cpu = 0; - - FILE *fp; - - *model_name = 0; - *cpu_family = 0; - *vendor_id = 0; - *model = 0; - strcpy(flags, " "); - - if ((fp = fopen("/proc/cpuinfo", "r"))) - { - char line[256], key[40], arg[216]; - const char *pattern = " %39[^:]: %215[ -~]"; // for sscanf - - while (fgets(line, sizeof(line), fp) && sscanf(line, pattern, key, arg) == 2) - { - if (!strncmp(key, "model name", strlen("model name")) && !*model_name) - { - strcpy(model_name, arg); - } - else if (!strncmp(key, "flags", strlen("flags")) && !flags[1]) - { - strcat(flags, arg); - strcat(flags, " "); - } - else if (!strncmp(key, "cpu family", strlen("cpu family")) && !*cpu_family) - { - strcpy(cpu_family, arg); - } - else if (!strncmp(key, "vendor_id", strlen("vendor_id")) && !*vendor_id) - { - strcpy(vendor_id, arg); - } - else if (!strncmp(key, "model", strlen("model")) && !*model) - { - strcpy(model, arg); - } - } - fclose(fp); - } - else if (have_cpuid()) - { - unsigned int maxei, eax, ebx, ecx, edx, unused, i; - - cpuid(0, unused, ebx, ecx, edx); - strncat(vendor_id, (char *)&ebx, 4); - strncat(vendor_id, (char *)&edx, 4); - strncat(vendor_id, (char *)&ecx, 4); - - cpuid(1, eax, ebx, ecx, edx); - sprintf(model, "%u", (eax >> 4) & 0xf); - sprintf(cpu_family, "%u", (eax >> 8) & 0xf); - add_flags(flags, edx, 0); - add_flags(flags, ecx, 96); - - cpuid(0x80000000, maxei, unused, unused, unused); - - if (maxei >= 0x80000001) - { - cpuid(0x80000001, unused, unused, ecx, edx); - add_flags(flags, edx, 32); - add_flags(flags, ecx, 160); - } - - //Transmeta - cpuid(0x80860000, eax, unused, unused, unused); - if (((eax & 0xffff0000) == 0x80860000) && (eax > 0x80860001)) - { - cpuid(0x80860001, unused, unused, unused, edx); - add_flags(flags, edx, 64); - } - - //Centaur - cpuid(0xC0000000, eax, unused, unused, unused); - if (eax >= 0xC0000001) - { - cpuid(0xC0000001, unused, unused, unused, edx); - add_flags(flags, edx, 128); - } - - if (maxei >= 0x80000002) - { - for (i = 0x80000002; i <= 0x80000004; i++) - { - cpuid(i, eax, ebx, ecx, edx); - strncat(model_name, (char *)&eax, 4); - strncat(model_name, (char *)&ebx, 4); - strncat(model_name, (char *)&ecx, 4); - strncat(model_name, (char *)&edx, 4); - } - } - } - - if (argc > 1) - { - printf("vendor_id: %s\n", vendor_id); - printf("cpu family: %s\n", cpu_family); - printf("model: %s\n", model); - printf("model name: %s\n", model_name); - printf("flags:%s\n", flags); - } - -#if __GNUC__ > 3 -#if __GNUC__ > 4 || __GNUC_MINOR__ > 1 - cpu = "native"; -#endif -#endif - if (!cpu) - { - if (!cpu && *cpu_family && *vendor_id) - { - #ifdef __GNUC__ - if (!strcmp(vendor_id, "AuthenticAMD") || strstr(model_name, "AMD")) - { - if (strstr(flags, " mmx ")) - { - #if __GNUC__ > 2 - if (strstr(flags, " 3dnow ")) - { - if (strstr(flags, " 3dnowext ") && (atoi(cpu_family) > 5)) - { - #if __GNUC__ > 3 || __GNUC_MINOR__ > 0 - if (strstr(flags, " sse ")) - { - #if __GNUC__ > 3 || __GNUC_MINOR__ > 3 - if (strstr(flags, " sse2 ") && strstr(flags, " lm ")) //Need two checks to protect Semprons - { - if (strstr(model_name, "Opteron")) - { - cpu = "opteron"; - } - else if (strstr(model_name, "Athlon(tm) 64")) //Also athlon-fx - { - cpu = "athlon64"; - } - else - { - cpu = "k8"; - } - } - #endif - if (!cpu) - { - if (strstr(model_name, "Athlon(tm) 4")) - { - cpu = "athlon-4"; - } - else if (strstr(model_name, "Athlon(tm) MP")) - { - cpu = "athlon-mp"; - } - else - { - cpu = "athlon-xp"; - } - } - } - - if (!cpu && (atoi(model) > 3)) - { - cpu = "athlon-tbird"; - } - #endif - - if (!cpu) - { - cpu = "athlon"; - } - } - - #if __GNUC__ > 3 || __GNUC_MINOR__ > 0 - if (!cpu) - { - int model_num = atoi(model); - if ((model_num == 9) || (model_num >= 13)) - { - cpu = "k6-3"; - } - else - { - cpu = "k6-2"; - } - } - #endif - } - #endif - - if (!cpu) - { - cpu = "k6"; - } - } - } - else if (!strcmp(vendor_id, "GenuineIntel") || strstr(model_name, "Intel")) - { - #if __GNUC__ > 2 - if (strstr(flags, " mmx ")) - { - if (strstr(flags, " sse ")) - { - if (strstr(flags, " sse2 ")) - { - #if __GNUC__ > 3 || __GNUC_MINOR__ > 2 - if (strstr(flags, " pni ") && strcmp(cpu_family, "6")) - { - if (strstr(flags, " lm ")) - { - cpu = "nocona"; - } - else - { - cpu = "prescott"; - } - } - #endif - - if (!cpu) - { - if (!strcmp(cpu_family, "6")) - { - #if __GNUC__ > 3 || __GNUC_MINOR__ > 3 - cpu = "pentium-m"; - #else - cpu = "pentium3"; - #endif - } - else - { - #if __GNUC__ > 3 || __GNUC_MINOR__ > 3 - if (strstr(model_name, "Mobile")) - { - cpu = "pentium4m"; - } - #endif - - if (!cpu) - { - cpu = "pentium4"; - } - } - } - } - else - { - #if __GNUC__ > 3 || __GNUC_MINOR__ > 3 - if (strstr(model_name, "Mobile")) - { - cpu = "pentium3m"; - } - #endif - - if (!cpu) - { - cpu = "pentium3"; - } - } - } - else - { - if (!strcmp(cpu_family, "6")) - { - cpu = "pentium2"; - } - else - { - cpu = "pentium-mmx"; - } - } - } - #endif - - if (!cpu) - { - int family = atoi(cpu_family); - if (family > 5) - { - cpu = "pentiumpro"; - } - else if (family == 5) - { - cpu = "pentium"; - } - } - } - #if __GNUC__ > 2 - #if __GNUC__ > 3 || __GNUC_MINOR__ > 2 - else if (!strcmp(vendor_id, "CentaurHauls") && strstr(flags, " mmx ")) - { - if (strstr(flags, " 3dnow ")) - { - if (atoi(cpu_family) > 5) - { - cpu = "c3"; - } - else - { - cpu = "winchip2"; - } - } - #if __GNUC__ > 3 || __GNUC_MINOR__ > 3 - else if (strstr(flags, " sse ")) - { - cpu = "c3-2"; - } - #endif - - if (!cpu) - { - cpu = "winchip-c6"; - } - } - #endif - #endif - - if (!cpu) - { - int family = atoi(cpu_family); - if (family > 5) - { - cpu = "i686"; - } - else if (family == 5) - { - cpu = "i586"; - } - else if (family == 4) - { - cpu = "i486"; - } - else - { - cpu = "i386"; - } - } - #else //MSVC - cpu = cpubuf; - *cpu = 0; - - if (strstr(flags, " sse2 ")) - { - strcat(cpu, " /arch:SSE2"); - } - else if (strstr(flags, " sse ")) - { - strcat(cpu, " /arch:SSE"); - } - - #ifdef __x86_64__ - if (strstr(flags, " lm ")) //64 bit - { - if (!strcmp(vendor_id, "AuthenticAMD") || strstr(model_name, "AMD")) - { - strcat(cpu, " /favor:AMD64"); - } - else if (!strcmp(vendor_id, "GenuineIntel") || strstr(model_name, "Intel")) - { - strcat(cpu, " /favor:EM64T"); - } - } - #endif - #endif - } - else - { - puts("Could not open /proc/cpuinfo, and CPUID instruction not available."); - return(1); - } - } - puts(cpu); - - return(0); -} diff --git a/tools/zsnes/src/tools/compile.txt b/tools/zsnes/src/tools/compile.txt deleted file mode 100644 index c1c6f61..0000000 --- a/tools/zsnes/src/tools/compile.txt +++ /dev/null @@ -1,58 +0,0 @@ -How to compile the tools: - -First build the utility files used by the tools. - -g++ -Wall -O3 -o fileutil.o -c fileutil.cpp -g++ -Wall -O3 -o strutil.o -c strutil.cpp - - -Architecture detector: -gcc -Wall -O3 -o archopt.exe archopt.c - -Cut Redundant ASM Typecasts: -g++ -Wall -O3 -o cutrtype.exe cutrtype.cpp fileutil.o strutil.o - -Dependency Builder: -g++ -Wall -O3 -o depbuild.exe depbuild.cpp fileutil.o strutil.o - -Extra EXTSYMs: -g++ -Wall -O3 -o extraext.exe extraext.cpp fileutil.o strutil.o - -Minimize Whitespace: -g++ -Wall -O3 -o minwhite.exe minwhite.cpp fileutil.o - -Nach's Replacer: -g++ -Wall -O3 -o nreplace.exe nreplace.cpp fileutil.o - -Section Tester: -g++ -Wall -O3 -o sec-test.exe sec-test.cpp fileutil.o strutil.o - -Source Counter: -g++ -Wall -O3 -o srccount.exe srccount.cpp fileutil.o - -Macro Unroller: -g++ -Wall -O3 -o macroll.exe macroll.cpp fileutil.o strutil.o - -Variable Replacer: -g++ -Wall -O3 -o varrep.exe varrep.cpp fileutil.o strutil.o - -All the tools scan every compatible file they find from the directory they are -in. It also scans all sub directories recursively. - -Extra EXTSYMs accepts command line arguments. You can specify filenames to put -on the can't be opened ignore list. - -Nach's Replacer accept parameters for various files, and -r for recursive -directory support. - -Dependency Builder requires parameters for CC, CFLAGS, NASM, NASM_FLAGS. -Example: depbuild gcc "-I/usr/include -D__UNIXSDL__ -O3 -march=athlon64" nasm - "-D__UNIXSDL__ -f elf -DELF -D__OPENGL__ -O1" - -Macro Unroller has the macro as parameter passed to it. -Example: macroll DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - -Variable Replacer requires parameters for variable file, variable prefix -and suffix. It can also optionally take a file list. Variable file should -contain each variable on a line by itself. -Example: varrep vf.txt "DSP4_vars." "" chips/dsp4emu.c diff --git a/tools/zsnes/src/tools/cutrtype.cpp b/tools/zsnes/src/tools/cutrtype.cpp deleted file mode 100644 index 929e054..0000000 --- a/tools/zsnes/src/tools/cutrtype.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development - -This program removes redundant typecasting in reg<->memory transfers -*/ - -#include -#include -using namespace std; - -#include "fileutil.h" -#include "strutil.h" - -#define LINE_LENGTH 2048 - -static unsigned char getsize(const string_ci& token, const char mode) -{ - unsigned char val = 0; - - if (mode == 'r') - { - val = 0; - - if (token == "al" || token == "ah" || token == "bl" || token == "bh" || - token == "cl" || token == "ch" || token == "dl" || token == "dh" || - token == "di" || token == "si" || token == "bp") - { val = 1; } - else if (token == "ax" || token == "bx" || token == "cx" || token == "dx") - { val = 2; } - else if (token == "eax" || token == "ebx" || token == "ecx" || - token == "edx" || token == "edi" || token == "esi" || - token == "ebp") - { val = 4; } - } - - if (mode == 't') - { - val = 0xFF; - - if (token == "byte") { val = 1; } - if (token == "word") { val = 2; } - if (token == "dword") { val = 4; } - } - - return (val); -} - -static bool isredund(string_ci& cur_line, const vector& tokens, const char offset) -{ - if (getsize(tokens[offset], 't') == getsize(tokens[(offset+2)%3], 'r')) - { - size_t loc = cur_line.find(tokens[offset]); - cur_line.erase(loc, cur_line.find(tokens[offset+1])-loc-1); - return (true); - } - - return (false); -} - -void handle_file(const char *filename, size_t orig_fsize) -{ - bool modify_file = false; - vector file_buffer; - - ifstream file(filename, ios::in); - if (file) - { - char line[LINE_LENGTH]; - - while (file.getline(line, LINE_LENGTH)) - { - vector tokens; - string_ci mline(line); - char *p = line; - while (isspace(*p)) { p++; } - - if (!strncasecmp(p, "mov ", strlen("mov "))) - { - p += strlen("mov "); - while (isspace(*p)) { p++; } - Tokenize(p, tokens, ";"); - string_ci not_commented = tokens[0]; - tokens.clear(); - Tokenize(not_commented, tokens, ", []"); - - if (tokens.size()>2) - { - modify_file |= isredund(mline, tokens, 0) || - isredund(mline, tokens, 1); - } - } - - file_buffer.push_back(mline); - } - - file.close(); - } - else - { - cerr << "Could not open " << filename << "." << endl; - } - - if (modify_file) - { - ofstream file(filename, ios::out); - if (file) - { - for (vector::iterator i = file_buffer.begin(); i != file_buffer.end(); i++) - { - file.write(i->data(), i->length()); - file << "\n"; - } - size_t cur_fsize = file.tellp(); - file.close(); - cout << "Trimmed " << filename << " of " << orig_fsize-cur_fsize - << " bytes." << endl; - } - else - { - cerr << filename - << " has redundant typecasts, but a trimmed copy can't be saved." - << endl; - } - } -} - -void cut_redund(const char *filename, struct stat& stat_buffer) -{ - if (is_asm_file(filename)) - { - handle_file(filename, stat_buffer.st_size); - } -} - -int main() -{ - parse_dir(".", cut_redund); - return(0); -} diff --git a/tools/zsnes/src/tools/depbuild.cpp b/tools/zsnes/src/tools/depbuild.cpp deleted file mode 100644 index 5c332c4..0000000 --- a/tools/zsnes/src/tools/depbuild.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development - -This program generates dependencies for all C/C++/Assembly files -*/ - -#include -#include -#include -using namespace std; - -#include "fileutil.h" -#include "strutil.h" - -string cc; -string nasm; -string cflags; -string nflags; - -unsigned int count_slashes(const char *path) -{ - unsigned int slashes = 0; - const char *p = path; - while ((p = strchr(p, '/'))) - { - slashes++; - p++; - } - return(slashes); -} - -void fix_line(string &line, const char *filename) -{ - if (line.find(":") != string::npos) //If this is the first line outputed for this file - { - string fname(filename); - size_t last_slash = fname.find_last_of("/"); - if (last_slash != string::npos) //If it's in a subdirectory, add directory path to the object filename - { - line.replace(0, 3, fname, 0, last_slash+1); - } - else //Otherwise just remove the leading spaces - { - line.erase(0, 3); - } - } - else //Sequal lines need to make sure previous line ends with a \ and then go to next line - { - cout << " \\\n"; - } -} - -//This function is so crazy because GCC doesn't put in proper directories, and adds system headers -void dependency_calculate_c(const char *filename) -{ - string command = cc + " " + cflags + " -M -MG " + filename; - FILE *fp = popen(command.c_str(), "r"); - if (fp) - { - char line[256]; - string processed_line(" "); - bool line_read = false; - while (fgets(line, sizeof(line), fp)) //Process all lines of output - { - line_read = true; - vector tokens; - Tokenize(string(line), tokens, " \t\n\\"); //Break apart into each dependency - for (vector::iterator i = tokens.begin(); i != tokens.end(); i++) - { - if ((*i)[0] != '/') //If dependency isn't a system header (all system headers would begin with /) - { - //This if has to be before the dependency is added onto the processed line string - if (processed_line.length() > 50) //Let's wrap every time we go over 50 characters - { - fix_line(processed_line, filename); - cout << processed_line; - processed_line = " "; - } - string dependency = *i; - - //Now check if there is a needless dir/../ - size_t first_slash = dependency.find_first_of("/"); - if ((first_slash != string::npos) && dependency.compare(0, 2, "..") && !dependency.compare(first_slash, 4, "/../")) - { - dependency.erase(0, first_slash+strlen("/../")); - } - - //Now remove improper ../ from GCC output - unsigned int slashes = count_slashes(filename); - while (!dependency.compare(0, 3, "../") && slashes) - { - dependency.erase(0, strlen("../")); - slashes--; - } - - processed_line += " " + dependency; //Add dependency to current line. Output for overflow (wrapping) should be done before this - } - } - } - if (line_read) //Only output if there was dependency data - { - fix_line(processed_line, filename); - cout << processed_line << "\n"; - } - pclose(fp); - } - else - { - cerr << "Failed on: " << filename << "\n"; - } -} - -void dependency_calculate_asm(const char *filename) -{ - string command = nasm + " " + nflags + " -M " + filename; - system(command.c_str()); -} - -void dependency_calculate_psr(const char *filename) -{ - string fn_prefix(filename, strlen(filename)-4); - string o_suffix(fn_prefix+".o"); - string h_suffix(fn_prefix+".h"); - - cout << o_suffix << " " << h_suffix << ": " << filename << "\n"; -} - -void dependency_calculate(const char *filename, struct stat& stat_buffer) -{ - if (extension_match(filename, ".asm")) - { - dependency_calculate_asm(filename); - } - else if (extension_match(filename, ".c") || extension_match(filename, ".cpp")) - { - dependency_calculate_c(filename); - } - else if (extension_match(filename, ".psr")) - { - dependency_calculate_psr(filename); - } - else if (extension_match(filename, ".o")) - { - string fn_prefix(filename, strlen(filename)-2); - string asm_suffix(fn_prefix+".asm"); - string c_suffix(fn_prefix+".c"); - string cpp_suffix(fn_prefix+".cpp"); - string psr_suffix(fn_prefix+".psr"); - - if (!access(asm_suffix.c_str(), F_OK)) - { - dependency_calculate_asm(asm_suffix.c_str()); - } - else if (!access(c_suffix.c_str(), F_OK)) - { - dependency_calculate_c(c_suffix.c_str()); - } - else if (!access(cpp_suffix.c_str(), F_OK)) - { - dependency_calculate_c(cpp_suffix.c_str()); - } - else if (!access(psr_suffix.c_str(), F_OK)) - { - dependency_calculate_psr(psr_suffix.c_str()); - } - } -} - -int main(size_t argc, const char *const *const argv) -{ - if (argc < 5) - { - cout << "Usage: depbuild CC CFLAGS NASM NFLAGS\n" - << "\n" - << "Make sure to properly quote (and possibly escape) the 4 parameters being passed.\n" - << "\n" - << "If you don't pass anything else, current directory will be parsed for all\n" - << ".c, .cpp, .asm files. Otherwise only passed files will have dependencies built.\n" - << endl; - } - else - { - cc = argv[1]; - cflags = argv[2]; - nasm = argv[3]; - nflags = argv[4]; - - if (argc == 5) - { - parse_dir(".", dependency_calculate); - } - else - { - struct stat unused; - for (size_t i = 5; i < argc; i++) - { - dependency_calculate(argv[i], unused); - } - } - } - return(0); -} diff --git a/tools/zsnes/src/tools/extraext.cpp b/tools/zsnes/src/tools/extraext.cpp deleted file mode 100644 index eb211d6..0000000 --- a/tools/zsnes/src/tools/extraext.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development - -This program tells us if an assembly file has extra EXTSYMs. -*/ - -#include -#include -#include -#include -#include -#include "strutil.h" -using namespace std; - -#include - -#include "fileutil.h" - -#define LINE_LENGTH 500 - -set ignore_include_file; - -struct macro_var -{ - string macro_name; - unsigned int params; - vector lines; - - macro_var(string ¯o_name, unsigned int params) : macro_name(macro_name), params(params) {} - macro_var(string ¯o_name, unsigned int params, vector &lines) : macro_name(macro_name), params(params), lines(lines) {} - bool operator<(const macro_var &op2) const; -}; - -bool macro_var::operator<(const macro_var &op2) const -{ - if (macro_name < op2.macro_name) { return(true); } - if (macro_name == op2.macro_name) - { - return(params < op2.params); - } - return(false); -} - -bool macro_match(const macro_var macro, const string name) -{ - return(macro.macro_name == name); -} - -string replace_params(string line, vector ¶ms) -{ - string replaced; - const char *p = line.c_str(); - while (*p) - { - if (*p == '%') - { - if (isdigit(p[1])) - { - size_t num = 0; - p++; - while (isdigit(*p)) - { - num *= 10; - num += *p-'0'; - p++; - } - replaced += params[num]; - } - else - { - replaced += *p++; - if (*p) { replaced += *p++; } - } - } - else - { - replaced += *p; - p++; - } - } - return(replaced); -} - -void parse_line(string line, set &used_vars, set ¯o_vars) -{ - vector tokens; - - Tokenize(line, tokens, ", \t"); - - set::iterator macro = macro_vars.find(macro_var(tokens[0], tokens.size()-1)); - if (macro != macro_vars.end()) - { - for (vector::const_iterator i = macro->lines.begin(); i != macro->lines.end(); i++) - { - parse_line(replace_params(*i, tokens), used_vars, macro_vars); - } - } - else - { - tokens.clear(); - Tokenize(line, tokens, ", :[]+-*/\t"); - - for (vector::iterator i = tokens.begin()+1; i != tokens.end(); i++) - { - if (!isdigit(i[0][0]) && (i[0][0] != '$') && !((i[0][0] == '%') && (i[0][1] == '%'))) - { - used_vars.insert(*i); - } - } - } -} - -void process_file(string filename, set &extsyms, set &used_vars, set ¯o_vars) -{ - ifstream file(filename.c_str(), ios::in); - if (file) - { - char line[LINE_LENGTH]; - - //Parse file - while (file.getline(line, LINE_LENGTH)) - { - vector tokens; - char *p = line; - while (isspace(*p)) { p++; } - - if (!strncasecmp(p, "%include ", strlen("%include "))) - { - p += strlen("%include "); - Tokenize(p, tokens, ";"); - string not_commented = tokens[0]; - tokens.clear(); - Tokenize(not_commented, tokens, "\" \t"); - - string inc_fname(*(tokens.end()-1)); - if (inc_fname != "macros.mac") - { - size_t last_slash = filename.find_last_of("/"); - if (last_slash != string::npos) - { - inc_fname.insert(0, filename, 0, last_slash+1); - if (access(inc_fname.c_str(), F_OK)) - { - inc_fname.insert(last_slash+1, "../"); - } - } - process_file(inc_fname, extsyms, used_vars, macro_vars); - } - } - else if (!strncasecmp(p, "extsym ", strlen("extsym "))) - { - p += strlen("extsym "); - Tokenize(p, tokens, ";"); - string not_commented = tokens[0]; - tokens.clear(); - Tokenize(not_commented, tokens, ", "); - for (vector::iterator i = tokens.begin(); i != tokens.end(); i++) - { - extsyms.insert(*i); - } - } - else if (!strncasecmp(p, "%macro ", strlen("%macro "))) - { - p += strlen("%macro "); - Tokenize(p, tokens, ";"); - string not_commented = tokens[0]; - tokens.clear(); - Tokenize(not_commented, tokens, " "); - - string macro_name = tokens[0]; - unsigned int param_count = atoi(tokens[1].c_str()); - vector lines; - - while (file.getline(line, LINE_LENGTH)) - { - p = line; - while (isspace(*p)) { p++; } - - if (*p && (*p != ';')) - { - tokens.clear(); - Tokenize(p, tokens, ";"); - if (tokens[0] == "%endmacro") - { - break; - } - if (tokens[0].size() && !((tokens[0][0] == '%') && !isdigit(tokens[0][1]))) - { - lines.push_back(tokens[0]); - } - } - } - macro_vars.insert(macro_var(macro_name, param_count, lines)); - } - else if (*p && (*p != ';')) - { - Tokenize(p, tokens, ";"); - if (tokens.size()) - { - parse_line(tokens[0], used_vars, macro_vars); - } - tokens.clear(); - } - } - } - else if (ignore_include_file.find(filename) == ignore_include_file.end()) - { - cout << "Error opening: " << filename << endl; - } -} - -void handle_file(const char *filename) -{ - set extsyms; - set used_vars; - set macro_vars; - list not_used_extsyms; - - process_file(filename, extsyms, used_vars, macro_vars); - - set_difference(extsyms.begin(), extsyms.end(), used_vars.begin(), used_vars.end(), back_inserter(not_used_extsyms)); - - if (not_used_extsyms.size()) - { - cout << "Extra EXTSYMs found in " << filename << ":" << endl; - for (list::iterator i = not_used_extsyms.begin(); i != not_used_extsyms.end(); i++) - { - cout << " " << *i << "\n"; - } - cout << endl; - } -} - -void extra_check(const char *filename, struct stat& stat_buffer) -{ - if (extension_match(filename, ".asm")) - { - handle_file(filename); - } -} - -int main(size_t argc, char **argv) -{ - for (char **i = argv+1; *i; i++) - { - ignore_include_file.insert(*i); - } - - parse_dir(".", extra_check); - return(0); -} diff --git a/tools/zsnes/src/tools/fileutil.cpp b/tools/zsnes/src/tools/fileutil.cpp deleted file mode 100644 index 9168fe6..0000000 --- a/tools/zsnes/src/tools/fileutil.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development -*/ - -#include -#include -#include - -#include "fileutil.h" - -void parse_dir(const char *dir_loc, void (*func)(const char *, struct stat&)) -{ - char path[4096]; - - DIR *curDir = opendir(dir_loc); - dirent *curFile; - if (curDir) - { - while ((curFile = readdir(curDir))) - { - if (!strcmp(curFile->d_name, ".") || !strcmp(curFile->d_name, "..")) - { - continue; - } - - char *filename; - if (!strcmp(dir_loc, ".")) - { - filename = curFile->d_name; - } - else - { - sprintf(path, "%s/%s", dir_loc, curFile->d_name); - filename = path; - } - - struct stat stat_buffer; - if (stat(filename, &stat_buffer)) { continue; } - - //Directory - if (S_ISDIR(stat_buffer.st_mode)) - { - parse_dir(filename, func); - continue; - } - - func(filename, stat_buffer); - } - closedir(curDir); - } -} - -bool parse_path(const char *path, void (*func)(const char *, struct stat&)) -{ - struct stat stat_buffer; - if (!stat(path, &stat_buffer)) - { - if (S_ISDIR(stat_buffer.st_mode)) - { - parse_dir(path, func); - } - else - { - func(path, stat_buffer); - } - return(true); - } - return(false); -} diff --git a/tools/zsnes/src/tools/fileutil.h b/tools/zsnes/src/tools/fileutil.h deleted file mode 100644 index 1fac055..0000000 --- a/tools/zsnes/src/tools/fileutil.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development -*/ - -#ifndef FILEUTIL_H -#define FILEUTIL_H - -#include -#include - -void parse_dir(const char *, void (*func)(const char *, struct stat&)); -bool parse_path(const char *, void (*func)(const char *, struct stat&)); - -inline bool extension_match(const char *filename, const char *ext) -{ - size_t filen_len = strlen(filename); - size_t ext_len = strlen(ext); - return((filen_len > ext_len) && !strcasecmp(filename+filen_len-ext_len, ext)); -} - -inline bool is_c_file(const char *filename) -{ - return(extension_match(filename, ".c") || - extension_match(filename, ".h")); -} - -inline bool is_cpp_file(const char *filename) -{ - return(extension_match(filename, ".cpp")); -} - -inline bool is_psr_file(const char *filename) -{ - return(extension_match(filename, ".psr")); -} - -inline bool is_asm_file(const char *filename) -{ - return(extension_match(filename, ".asm") || - extension_match(filename, ".inc") || - extension_match(filename, ".mac")); -} - -#endif diff --git a/tools/zsnes/src/tools/macroll.cpp b/tools/zsnes/src/tools/macroll.cpp deleted file mode 100644 index bb3fd09..0000000 --- a/tools/zsnes/src/tools/macroll.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development - -This program prints out a macro with params passed on command line in expanded/unrolled form. -*/ - -#include -#include -#include -#include "strutil.h" -using namespace std; - -#include - -#include "fileutil.h" - -#define LINE_LENGTH 500 - -struct macro_var -{ - string macro_name; - unsigned int params; - vector lines; - - macro_var(string ¯o_name, unsigned int params) : macro_name(macro_name), params(params) {} - macro_var(string ¯o_name, unsigned int params, vector &lines) : macro_name(macro_name), params(params), lines(lines) {} - bool operator<(const macro_var &op2) const; -}; - -bool macro_var::operator<(const macro_var &op2) const -{ - if (macro_name < op2.macro_name) { return(true); } - if (macro_name == op2.macro_name) - { - return(params < op2.params); - } - return(false); -} - -bool macro_match(const macro_var macro, const string name) -{ - return(macro.macro_name == name); -} - -set macro_vars; -string prefix; - -string replace_params(string line, vector ¶ms) -{ - string replaced; - const char *p = line.c_str(); - while (*p) - { - if (*p == '%') - { - if (isdigit(p[1])) - { - size_t num = 0; - p++; - while (isdigit(*p)) - { - num *= 10; - num += *p-'0'; - p++; - } - replaced += params[num]; - } - else - { - replaced += *p++; - if (*p) { replaced += *p++; } - } - } - else - { - replaced += *p; - p++; - } - } - if (replaced == line) - { - cout << prefix << replaced << "\n"; - } - else - { - cout << prefix << replaced << " ; " << line << "\n"; - } - return(replaced); -} - -void parse_line(string line) -{ - vector tokens; - - Tokenize(line, tokens, ", \t"); - - set::iterator macro = macro_vars.find(macro_var(tokens[0], tokens.size()-1)); - if (macro != macro_vars.end()) - { - cout << prefix << ";Begin %macro " << tokens[0] << " " << tokens.size()-1 << "\n"; - prefix += " "; - for (vector::const_iterator i = macro->lines.begin(); i != macro->lines.end(); i++) - { - parse_line(replace_params(*i, tokens)); - } - prefix.erase(0, 2); - cout << prefix << ";End %macro " << tokens[0] << " " << tokens.size()-1 << "\n"; - } -} - -void process_file(string filename) -{ - ifstream file(filename.c_str(), ios::in); - if (file) - { - char line[LINE_LENGTH]; - - //Parse file - while (file.getline(line, LINE_LENGTH)) - { - vector tokens; - char *p = line; - while (isspace(*p)) { p++; } - - if (!strncasecmp(p, "%include ", strlen("%include "))) - { - p += strlen("%include "); - Tokenize(p, tokens, ";"); - string not_commented = tokens[0]; - tokens.clear(); - Tokenize(not_commented, tokens, "\" \t"); - - string inc_fname(*(tokens.end()-1)); - if (inc_fname != "macros.mac") - { - size_t last_slash = filename.find_last_of("/"); - if (last_slash != string::npos) - { - inc_fname.insert(0, filename, 0, last_slash+1); - if (access(inc_fname.c_str(), F_OK)) - { - inc_fname.insert(last_slash+1, "../"); - } - } - process_file(inc_fname); - } - } - else if (!strncasecmp(p, "%macro ", strlen("%macro "))) - { - p += strlen("%macro "); - Tokenize(p, tokens, ";"); - string not_commented = tokens[0]; - tokens.clear(); - Tokenize(not_commented, tokens, " "); - - string macro_name = tokens[0]; - unsigned int param_count = atoi(tokens[1].c_str()); - vector lines; - - while (file.getline(line, LINE_LENGTH)) - { - p = line; - while (isspace(*p)) { p++; } - - if (*p && (*p != ';')) - { - tokens.clear(); - Tokenize(p, tokens, ";"); - if (tokens[0] == "%endmacro") - { - break; - } - if (tokens[0].size()) - { - lines.push_back(tokens[0]); - } - } - } - macro_vars.insert(macro_var(macro_name, param_count, lines)); - } - } - } -} - -void build_macro(const char *filename, struct stat& stat_buffer) -{ - if (extension_match(filename, ".asm")) - { - process_file(filename); - } -} - -int main(size_t argc, char **argv) -{ - if (argc > 1) - { - parse_dir(".", build_macro); - - string line; - argv++; - while (*argv) - { - line += *argv++; - line += " "; - } - cout << line << "\n"; - parse_line(line); - cout << endl; - } - return(0); -} diff --git a/tools/zsnes/src/tools/minwhite.cpp b/tools/zsnes/src/tools/minwhite.cpp deleted file mode 100644 index 0faf8c2..0000000 --- a/tools/zsnes/src/tools/minwhite.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development - -This program trims unneeded at end of line whitespace. -*/ - -#include -#include -#include -#include -using namespace std; - -#include "fileutil.h" - -#define LINE_LENGTH 2048 - -void handle_file(const char *filename, size_t orig_file_size) -{ - bool file_modified = false; - vector file_buffer; - - ifstream file(filename, ios::in); - if (file) - { - char line[LINE_LENGTH]; - - while (file.getline(line, LINE_LENGTH)) - { - for (char *p = line+strlen(line)-1; p >= line; p--) - { - if (strchr(" \t\r", *p)) - { - *p = 0; - file_modified = true; - } - else - { - break; - } - } - file_buffer.push_back(line); - } - - file.close(); - } - else - { - cerr << "Could not open " << filename << "." << endl; - } - - if (file_modified) - { - ofstream file(filename, ios::out); - if (file) - { - for (vector::iterator i = file_buffer.begin(); i != file_buffer.end(); i++) - { - file.write(i->data(), i->length()); - file << "\n"; - } - size_t file_size = file.tellp(); - file.close(); - cout << "Trimmed " << filename << " of " << orig_file_size-file_size << " bytes." << endl; - } - else - { - cerr << filename << " has extra whitespace, but a trimmed copy can't be saved." << endl; - } - } -} - -void force_trim(const char *filename, struct stat& stat_buffer) -{ - handle_file(filename, stat_buffer.st_size); -} - -void trim_whitespace(const char *filename, struct stat& stat_buffer) -{ - if (is_c_file(filename) || - is_cpp_file(filename) || - is_asm_file(filename) || - is_psr_file(filename)) - { - handle_file(filename, stat_buffer.st_size); - } -} - -int main(size_t argc, char **argv) -{ - if (argc > 1) - { - for (char **i = argv+1; *i; i++) - { - parse_path(*i, force_trim); - } - } - else - { - parse_dir(".", trim_whitespace); - } - return(0); -} diff --git a/tools/zsnes/src/tools/nreplace.cpp b/tools/zsnes/src/tools/nreplace.cpp deleted file mode 100644 index dc002f3..0000000 --- a/tools/zsnes/src/tools/nreplace.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development - -This program is able to replace one list of data with another in multiple files. -Multiline replace is of course supported. -*/ - -#include -#include -#include -using namespace std; - -#include "fileutil.h" - -string SearchText, ReplaceText; - -void help() -{ - cout << "Usage: nreplace [-r] ...\n" << endl; - exit(1); -} - -void readin_file(istream& stream, string& buffer) -{ - char byte; - for (;;) - { - stream.get(byte); - if (!stream.eof()) - { - buffer += byte; - } - else - { - break; - } - } -} - -void handle_file(const char *filename, struct stat& stat_buffer) -{ - fstream ModifyFile(filename, ios::in | ios::out); - if (ModifyFile) - { - string ModifyText; - readin_file(ModifyFile, ModifyText); - - bool changed = false; - - for (size_t start_pos = 0;;) - { - size_t match_point = ModifyText.find(SearchText, start_pos); - if (match_point != string::npos) - { - ModifyText.replace(match_point, SearchText.size(), ReplaceText); - start_pos += ReplaceText.size(); - changed = true; - } - else - { - break; - } - } - - if (changed) - { - ModifyFile.clear(); - ModifyFile.seekp(0, ios::beg); - ModifyFile.write(ModifyText.data(), ModifyText.size()); - truncate(filename, ModifyText.size()); - } - - ModifyFile.close(); - } - else - { - cout << "Could not open " << filename << endl; - } -} - -int main(size_t argc, const char **argv) -{ - bool subdir_scan = false; - const char **argp = argv+1; - - if (*argp && !strcmp(*argp, "-r")) - { - if (argc < 5) { help(); } - - subdir_scan = true; - argp++; - } - else if (argc < 4) - { - help(); - } - - - ifstream SearchFile(*argp, ios::in); - if (SearchFile) - { - argp++; - } - else - { - cout << "Could not open " << *argp << endl; - return(2); - } - - ifstream ReplaceFile(*argp, ios::in); - if (ReplaceFile) - { - argp++; - } - else - { - cout << "Could not open " << *argp << endl; - return(2); - } - - readin_file(SearchFile, SearchText); SearchFile.close(); - readin_file(ReplaceFile, ReplaceText); ReplaceFile.close(); - - if (subdir_scan) - { - for (; *argp; argp++) - { - if (!parse_path(*argp, handle_file)) - { - cout << "Could not open " << *argp << endl; - } - } - } - else - { - struct stat stat_buffer; //Not used - for (; *argp; argp++) - { - handle_file(*argp, stat_buffer); - } - } - - return(0); -} diff --git a/tools/zsnes/src/tools/objprefx.cpp b/tools/zsnes/src/tools/objprefx.cpp deleted file mode 100644 index 0be31c3..0000000 --- a/tools/zsnes/src/tools/objprefx.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 program can add a prefix to every symbol in an object file. -*/ - -#include -#include -#include -#include -#include -using namespace std; - -#include "fileutil.h" -#include "strutil.h" - -string prefix; -string extension; - -vector files; -set symbols; -set sections; - - -const char *symbol_fname = "symbol.map"; -const char *section_fname = "section.map"; - -bool create_symbol_file() -{ - ofstream stream(symbol_fname, ios::out); - if (stream) - { - for (set::iterator i = symbols.begin(); i != symbols.end(); i++) - { - stream << *i << "\n"; - } - stream.close(); - return(true); - } - return(false); -} - -bool create_section_file() -{ - ofstream stream(section_fname, ios::out); - if (stream) - { - for (set::iterator i = sections.begin(); i != sections.end(); i++) - { - stream << "--rename-section " << *i << " "; - } - stream.close(); - return(true); - } - return(false); -} - -void handle_file(const char *filename) -{ - string command("nm "); - command += filename; - - FILE *pp = popen(command.c_str(), "r"); - if (pp) - { - files.push_back(filename); - char line[1024]; - while (fgets(line, sizeof(line), pp)) - { - vector tokens; - Tokenize(line, tokens, " \t\r\n"); - vector::iterator i = tokens.begin(); - if ((i->size() != 1) && isxdigit((*i)[0])) { i++; } - if (*i != "U") - { - i++; - if ((*i)[0] != '.') - { - symbols.insert(*i+" "+prefix+*i); - } - else - { - size_t p = i->find('$'); - if (p != string::npos) - { - string change(*i); - i->insert(p+1, prefix); - symbols.insert(change+" "+*i); - sections.insert(change+"="+*i); - } - } - } - } - pclose(pp); - } - else - { - cout << "Coult not execute " << command << "." << endl; - } -} - -void extra_check(const char *filename, struct stat& stat_buffer) -{ - if (extension_match(filename, extension.c_str())) - { - handle_file(filename); - } -} - -int main(size_t argc, char **argv) -{ - if (argc == 3) - { - prefix = argv[1]; - extension = argv[2]; - parse_dir(".", extra_check); - - if (create_symbol_file()) - { - string objcopy("objcopy "); - if (sections.size() && create_section_file()) - { - objcopy += "@"; - objcopy += section_fname; - objcopy += " "; - } - objcopy += "--redefine-syms "; - objcopy += symbol_fname; - objcopy += " "; - for (vector::iterator i = files.begin(); i != files.end(); i++) - { - string command(objcopy); - command += *i; - command += " "; - command += prefix; - command += *i; - system(command.c_str()); - } - } - else - { - cout << "Error creating: " << symbol_fname << endl; - } - } - return(0); -} diff --git a/tools/zsnes/src/tools/sec-test.cpp b/tools/zsnes/src/tools/sec-test.cpp deleted file mode 100644 index 9e0192b..0000000 --- a/tools/zsnes/src/tools/sec-test.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development - -This program tells us is a variable is declared in the wrong section. -Or if code is not in an executable section. -*/ - -#include -#include -#include "strutil.h" -using namespace std; - -#include "fileutil.h" - -#define LINE_LENGTH 500 - - - -bool contains_resx(const char *str) -{ - return(!strncmp(str, "resd ", strlen("resd ")) || - !strncmp(str, "resw ", strlen("resw ")) || - !strncmp(str, "resb ", strlen("resb ")) || - strstr(str, " resd ") || - strstr(str, " resw ") || - strstr(str, " resb ") || - strstr(str, ",resd ") || - strstr(str, ",resw ") || - strstr(str, ",resb ")); -} - -bool contains_dx(const char *str) -{ - return(!strncmp(str, "dd ", strlen("dd ")) || - !strncmp(str, "dw ", strlen("dw ")) || - !strncmp(str, "db ", strlen("db ")) || - strstr(str, " dd ") || - strstr(str, " dw ") || - strstr(str, " db ") || - strstr(str, ",dd ") || - strstr(str, ",dw ") || - strstr(str, ",db ")); -} - -bool label(const char *str) -{ - return(!strchr(str, ' ') && !strchr(str, '\t') && (str[strlen(str)-1] == ':')); -} - -void handle_file(const char *filename) -{ - enum sections { sec_unknown, sec_bss, sec_data, sec_text, sec_macro }; - - ifstream file(filename, ios::in); - if (file) - { - char buffer[LINE_LENGTH]; - sections cur_section = sec_unknown, prev_section = sec_unknown; - for (size_t i = 1; file.getline(buffer, LINE_LENGTH); i++) - { - char *line = buffer; - - char *comment_p = strchr(line, ';'); - if (comment_p) { *comment_p = 0; } - - if (all_whitespace(line)) { continue; } - - for (char *p = line+strlen(line)-1; isspace(*p); p--) { *p = 0; } - while (isspace(*line)) { line++; } - - - if (!strcasecmp(line, "SECTION .BSS")) - { - prev_section = cur_section; - cur_section = sec_bss; - continue; - } - - if (!strcasecmp(line, "SECTION .DATA")) - { - prev_section = cur_section; - cur_section = sec_data; - continue; - } - - if (!strcasecmp(line, "SECTION .text")) - { - prev_section = cur_section; - cur_section = sec_text; - continue; - } - - if (!strncmp(line, "%macro", strlen("%macro")) || - !strncmp(line, "%imacro", strlen("%imacro"))) - { - prev_section = cur_section; - cur_section = sec_macro; - continue; - } - - if (!strncmp(line, "%endmacro", strlen("%endmacro"))) - { - cur_section = prev_section; - continue; - } - - - if ((cur_section != sec_bss) && contains_resx(line)) - { - cout << filename << ": line " << i << ": Error, resx in non BSS section. \"" << line << "\"" << endl; - } - - if ((cur_section != sec_data) && contains_dx(line)) - { - cout << filename << ": line " << i << ": Error, dx in non DATA section. \"" << line << "\"" << endl; - } - - if ((cur_section != sec_text) && (cur_section != sec_macro)) - { - if (!contains_resx(line) && !contains_dx(line) && !label(line) && !strstr(line, "RMREGS") && - !strstr(line, "NEWSYM") && !strstr(line, "EXTSYM") && !strstr(line, " equ ") && - (*line != '%') && strncasecmp(line, "ALIGN", strlen("ALIGN")) && - strncasecmp(line, "bits ", strlen("bits "))) - { - cout << filename << ": line " << i << ": Error, code in non TEXT section. \"" << line << "\"" << endl; - } - } - } - } - else - { - cout << "Error opening: " << filename << endl; - } -} - -void section_test(const char *filename, struct stat& stat_buffer) -{ - if (is_asm_file(filename)) - { - handle_file(filename); - } -} - -int main() -{ - parse_dir(".", section_test); - return(0); -} diff --git a/tools/zsnes/src/tools/srccount.cpp b/tools/zsnes/src/tools/srccount.cpp deleted file mode 100644 index e383c1d..0000000 --- a/tools/zsnes/src/tools/srccount.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development - -This program tells us how far our port progress is. -*/ - -#include -#include -using namespace std; - -#include "fileutil.h" - -size_t c_count = 0; -size_t cpp_count = 0; -size_t asm_count = 0; -size_t psr_count = 0; - -void size_tally(const char *filename, struct stat& stat_buffer) -{ - if (is_c_file(filename)) { c_count += stat_buffer.st_size; } - else if (is_asm_file(filename)) { asm_count += stat_buffer.st_size; } - else if (is_cpp_file(filename)) { cpp_count += stat_buffer.st_size; } - else if (is_psr_file(filename)) { psr_count += stat_buffer.st_size; } -} - -int main() -{ - parse_dir(".", size_tally); - - unsigned int total_count = asm_count + c_count + cpp_count + psr_count; - - cout << "ASM code uses " << asm_count << " bytes. (" << (float)(asm_count*100)/total_count << ")\n" - << "C code uses " << c_count << " bytes. (" << (float)(c_count*100)/total_count << ")\n" - << "C++ code uses " << cpp_count << " bytes. (" << (float)(cpp_count*100)/total_count << ")\n" - << "PSR code uses " << psr_count << " bytes. (" << (float)(psr_count*100)/total_count << ")\n" - << endl; - return(0); -} diff --git a/tools/zsnes/src/tools/strutil.cpp b/tools/zsnes/src/tools/strutil.cpp deleted file mode 100644 index 50291f4..0000000 --- a/tools/zsnes/src/tools/strutil.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development -*/ - -#include "strutil.h" -using namespace std; - -void Tokenize(const string& str, vector& tokens, const string& delimiters) -{ - //Skip delimiters at beginning. - string::size_type lastPos = str.find_first_not_of(delimiters, 0); - - //Find first "non-delimiter". - string::size_type pos = str.find_first_of(delimiters, lastPos); - - while (string::npos != pos || string::npos != lastPos) - { - //Found a token, add it to the vector. - tokens.push_back(str.substr(lastPos, pos - lastPos)); - - //Skip delimiters. Note the "not_of" - lastPos = str.find_first_not_of(delimiters, pos); - - //Find next "non-delimiter" - pos = str.find_first_of(delimiters, lastPos); - } -} - -//Remove this at some point with a template -void Tokenize(const string_ci& str, vector& tokens, const string_ci& delimiters) -{ - //Skip delimiters at beginning. - string::size_type lastPos = str.find_first_not_of(delimiters, 0); - - //Find first "non-delimiter". - string::size_type pos = str.find_first_of(delimiters, lastPos); - - while (string::npos != pos || string::npos != lastPos) - { - //Found a token, add it to the vector. - tokens.push_back(str.substr(lastPos, pos - lastPos)); - - //Skip delimiters. Note the "not_of" - lastPos = str.find_first_not_of(delimiters, pos); - - //Find next "non-delimiter" - pos = str.find_first_of(delimiters, lastPos); - } -} - -bool all_whitespace(const char *str) -{ - for (; *str; str++) - { - if (!isspace(*str)) - { - return(false); - } - } - return(true); -} diff --git a/tools/zsnes/src/tools/strutil.h b/tools/zsnes/src/tools/strutil.h deleted file mode 100644 index cd32638..0000000 --- a/tools/zsnes/src/tools/strutil.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development -*/ - -#ifndef STRUTIL_H -#define STRUTIL_H - -#include -#include -#include - -struct ci_char_traits : public std::char_traits -{ - static bool eq(char c1, char c2) { return tolower(c1) == tolower(c2); } - static bool ne(char c1, char c2) { return tolower(c1) != tolower(c2); } - static bool lt(char c1, char c2) { return tolower(c1) < tolower(c2); } - static int compare(const char* s1, const char* s2, size_t n) { return strncasecmp( s1, s2, n ); } - - static const char* find( const char* s, int n, char a ) - { - while(n-- > 0 && tolower(*s) != tolower(a)) - { - ++s; - } - return n >= 0 ? s : 0; - } -}; - -typedef std::basic_string string_ci; - -void Tokenize(const std::string&, std::vector&, const std::string&); -void Tokenize(const string_ci&, std::vector&, const string_ci&); -bool all_whitespace(const char *); - -#endif diff --git a/tools/zsnes/src/tools/varrep.cpp b/tools/zsnes/src/tools/varrep.cpp deleted file mode 100644 index 33c138d..0000000 --- a/tools/zsnes/src/tools/varrep.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* -Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com ) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 is part of a toolkit used to assist in ZSNES development - -This program prefixes and suffixes variables in files. -*/ - -#include -#include -#include -#include -#include -using namespace std; - -#include "fileutil.h" -#include "strutil.h" - -#define LINE_LENGTH 2048 - -char line[LINE_LENGTH]; - -const char *variable_prefix, *variable_suffix; - -vector variables; - -void save_file(const char *filename, vector& file_buffer, const char *error_message) -{ - ofstream file(filename); - if (file) - { - for (vector::iterator i = file_buffer.begin(); i != file_buffer.end(); i++) - { - file.write(i->data(), i->length()); - file << "\n"; - } - } - else - { - cerr << filename << error_message << endl; - } -} - -bool is_cidentifier(char c) -{ - return(isalnum(c) || (c == '_') || (c == '$')); -} - -void handle_c_file(const char *filename) -{ - bool file_modified = false; - vector file_buffer; - - ifstream file(filename); - if (file) - { - while (file.getline(line, LINE_LENGTH)) - { - for (vector::iterator i = variables.begin(); i != variables.end(); i++) - { - char *start = line, *p; - while ((p = strstr(start, i->c_str()))) - { - if (((p == line) || !is_cidentifier(p[-1])) && (!is_cidentifier(p[i->length()]))) - { - char *end_ident = p+i->length(); - if (*variable_prefix) - { - size_t len = strlen(variable_prefix); - memmove(p+len, p, strlen(p)+1); - memcpy(p, variable_prefix, len); - end_ident += len; - } - if (*variable_suffix) - { - size_t len = strlen(variable_suffix); - memmove(end_ident+len, end_ident, strlen(end_ident)+1); - memcpy(end_ident, variable_suffix, len); - end_ident += len; - } - start = end_ident; - file_modified = true; - } - else - { - start += i->length(); - } - } - } - file_buffer.push_back(line); - } - file.close(); - } - else - { - cerr << "Could not open " << filename << "." << endl; - } - - if (file_modified) - { - save_file(filename, file_buffer, " has variables to be replaced, but a replaced version can't be saved."); - } -} - -void variable_replace(const char *filename, struct stat& stat_buffer) -{ - if (is_c_file(filename) || - is_cpp_file(filename)) - { - handle_c_file(filename); - } -} - -bool process_vars(const char *fname) -{ - ifstream stream(fname); - if (stream) - { - vector tokens; - while (stream.getline(line, sizeof(line))) - { - tokens.clear(); - Tokenize(line, tokens, ";, :[]+-*%^&|<>!/\t\n\r\\"); - variables.push_back(tokens[0]); - } - stream.close(); - return(true); - } - cerr << "Could not open " << fname << "." << endl; - return(false); -} - -int main(size_t argc, const char *const *const argv) -{ - if (argc >= 4) - { - if (process_vars(argv[1])) - { - variable_prefix = argv[2]; - variable_suffix = argv[3]; - - if (argc > 4) - { - for (const char *const *argp = argv+4; *argp; argp++) - { - parse_path(*argp, variable_replace); - } - } - else - { - parse_dir(".", variable_replace); - } - } - } - else - { - cout << "Usage: varrep \n" << endl; - } - - return(0); -} diff --git a/tools/zsnes/src/ui.c b/tools/zsnes/src/ui.c deleted file mode 100644 index 590e512..0000000 --- a/tools/zsnes/src/ui.c +++ /dev/null @@ -1,631 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#include -#else -#include -#include -#include -#include -#endif - -#include "asm_call.h" -#include "cfg.h" -#include "input.h" -#include "mmlib/mm.h" -#include "zpath.h" - -//C++ style code in C -#define bool unsigned char -#define true 1 -#define false 0 - -extern unsigned int xa, MessageOn, maxromspace; -extern unsigned char FPSOn, spcon, device1, device2; -extern char *Msgptr, CSStatus[], CSStatus2[], CSStatus3[]; - -unsigned short selc0040, selcA000, selcB800; - -unsigned char *vidbuffer; // video buffer (1024x239 = 244736) -unsigned char *ngwinptr; -unsigned char *vidbufferofsa; // offset 1 -unsigned char *vidbufferofsb; // offset 2 -unsigned char *headdata; -unsigned char *romdata; // rom data (4MB = 4194304) -unsigned char *sfxramdata; // SuperFX Ram Data -unsigned char *setaramdata; // Seta ST010/ST011 SRam Data -unsigned char *wramdata; // stack (64K = 65536) -unsigned char *ram7f; // ram @ 7f = 65536 -unsigned char *vram; // vram = 65536 -unsigned char *sram; // sram = 65536*2 = 131072 -#ifdef OLD_DEBUGGER -unsigned char *debugbuf; // debug buffer = 80x1000 = 80000 -#endif -unsigned char regptra[49152]; -unsigned char regptwa[49152]; -unsigned char *regptr = regptra; -unsigned char *regptw = regptwa; -unsigned char *vcache2b; // 2-bit video cache -unsigned char *vcache4b; // 4-bit video cache -unsigned char *vcache8b; // 8-bit video cache -unsigned char *SPC7110PackPtr; -unsigned char *SPC7110IndexPtr; -unsigned char romispal; // 0 = NTSC, 1 = PAL -unsigned char newgfx16b; - -unsigned char previdmode; // previous video mode -unsigned char cbitmode; // bit mode, 0=8bit, 1=16bit - -unsigned char opexec268 = 142; // # of opcodes/scanline in 2.68Mhz mode -unsigned char opexec358 = 167; // # of opcodes/scanline in 3.58Mhz mode (228/180) -unsigned char opexec268cph = 42; // # of opcodes/hblank in 2.68Mhz mode -unsigned char opexec358cph = 45; // # of opcodes/hblank in 3.58Mhz mode (56/50) -unsigned char opexec268b = 142; // # of opcodes/scanline in 2.68Mhz mode -unsigned char opexec358b = 167; // # of opcodes/scanline in 3.58Mhz mode (228/180) -unsigned char opexec268cphb = 42; // # of opcodes/hblank in 2.68Mhz mode -unsigned char opexec358cphb = 45; // # of opcodes/hblank in 3.58Mhz mode (56/50) -unsigned char debugdisble = 1; // debugger disable. 0 = no, 1 = yes -unsigned char gammalevel16b = 0; // gamma level (16-bit engine) -unsigned char AddSub256 = 0; // screen add/sub in 256 colors -unsigned char dmadeddis = 0; // DMA deduction -unsigned char OldStyle = 1; // Old style joystick on -unsigned char SecondPort = 0; // Secondary Joystick Port Enabled (209h) (DOS port only) - -unsigned char Doublevbuf = 1; // Double video buffer -unsigned char V8Mode = 0; // Vegetable mode! =) (Greyscale mode) -unsigned char fastmemptr = 0; -unsigned char ForcePal = 0; // 1 = NTSC, 2 = PAL -unsigned char finterleave = 0; -unsigned char DSPDisable = 0; // Disable DSP emulation -unsigned char MusicVol = 0; -unsigned char MMXextSupport = 0; - -void init(), WaitForKey(), MMXCheck(), InitSPC(), DosExit(); -void SystemInit(), StartUp(), MultiMouseInit(); - -void *alloc_ptr; -unsigned int alloc_size; - -void alloc_help() -{ - alloc_ptr=malloc(alloc_size); -} - -extern bool input1gp; -extern bool input1mouse; -extern bool input2gp; -extern bool input2mouse; -extern bool input2scope; -extern bool input2just; - -void cycleinputdevice1() -{ - for (;;) - { - device1++; - if (device1 >= 2) - { - device1 = 0; - } - if (device1 == 0) - { - if (input1gp) { return; } - device1++; - } - if (device1 == 1) - { - if (input1mouse) { return; } - } - } -} - -void cycleinputdevice2() -{ - for (;;) - { - device2++; - if (device2 >= 5) - { - device2 = 0; - } - if (device2 == 0) - { - if (input2gp) { return; } - device2++; - } - if (device2 == 1) - { - if (input2mouse) { return; } - device2++; - } - if (device2 == 2) - { - if (input2scope) { return; } - device2++; - } - if (device2 == 3) - { - if (input2just) { return; } - device2++; - } - if (device2 == 4) - { - if (input2just) { return; } - } - } -} - -unsigned char NoiseData[32768]; -const unsigned char samplenoise[128] = { - 27,232,234,138,187,246,176, 81, 25,241, 1,127,154,190,195,103, - 231,165,220,238,232,189, 57,201,123, 75, 63,143,145,159, 13,236, - 191,142, 56,164,222, 80, 88, 13,148,118,162,212,157,146,176, 0, - 241, 88,244,238, 51,235,149, 50, 77,212,186,241, 88, 32, 23,206, - 1, 24, 48,244,248,210,253, 77, 19,100, 83,222,108, 68, 11, 58, - 152,161,223,245, 4,105, 3, 82, 15,130,171,242,141, 2,172,218, - 152, 97,223,157, 93, 75, 83,238,104,238,131, 70, 22,252,180, 82, - 110,123,106,133,183,209, 48,230,157,205, 27, 21,107, 63, 85,164}; - -void setnoise() -{ - unsigned short ctr1, ctr2, ptr1=0; - unsigned char ptr2=0, ptr3=0; - - for(ctr1=256;ctr1>0;ctr1--) - { - for(ctr2=128;ctr2>0;ctr2--,ptr1++) - { - NoiseData[ptr1] = (samplenoise[ptr2] + samplenoise[ptr3]); - ptr2=(ptr2+1)&0x7f; - ptr3=(ptr3-1)&0x7f; - } - ptr3=(ptr3-1)&0x7f; - } -} - -static void outofmemory() -{ - puts("You don't have enough memory to run this program!"); - asm_call(DosExit); -} - -extern unsigned char wramdataa[65536], ram7fa[65536]; - -#ifndef __MSDOS__ -unsigned char *BitConv32Ptr = 0; -unsigned char *RGBtoYUVPtr = 0; -#endif -unsigned char *spcBuffera = 0; -unsigned char *spritetablea = 0; -unsigned char *vbufaptr = 0; -unsigned char *vbufeptr = 0; -unsigned char *ngwinptrb = 0; -unsigned char *vbufdptr = 0; -unsigned char *romaptr = 0; -unsigned char *vcache2bs = 0; // 2-bit video secondary cache -unsigned char *vcache4bs = 0; // 4-bit video secondary cache -unsigned char *vcache8bs = 0; // 8-bit video secondary cache - -unsigned char vrama[65536]; - -unsigned char mode7tab[65536]; - -unsigned short fulladdtab[65536]; -unsigned short VolumeConvTable[32768]; -unsigned int dspWptr[256]; -unsigned int dspRptr[256]; - -#define deallocmemhelp(p) if (p) { free(p); } - -void deallocmem() -{ -#ifndef __MSDOS__ - deallocmemhelp(BitConv32Ptr); - deallocmemhelp(RGBtoYUVPtr); -#endif - deallocmemhelp(spcBuffera); - deallocmemhelp(spritetablea); - deallocmemhelp(vbufaptr); - deallocmemhelp(vbufeptr); - deallocmemhelp(ngwinptrb); - deallocmemhelp(vbufdptr); - deallocmemhelp(romaptr); - deallocmemhelp(vcache2bs); - deallocmemhelp(vcache4bs); - deallocmemhelp(vcache8bs); - deallocmemhelp(vcache2b); - deallocmemhelp(vcache4b); - deallocmemhelp(vcache8b); -#ifdef OLD_DEBUGGER - deallocmemhelp(debugbuf); -#endif - deallocmemhelp(sram); - deallocmemhelp(SPC7110PackPtr); - deallocmemhelp(SPC7110IndexPtr); -} - -#define AllocmemFail(ptr, size) if (!(ptr = malloc(size))) { outofmemory(); } - -static void allocmem() -{ -#ifndef __MSDOS__ - AllocmemFail(BitConv32Ptr, 4096+65536*16); - AllocmemFail(RGBtoYUVPtr,65536*4+4096); -#endif - AllocmemFail(spcBuffera,65536*4+4096); - AllocmemFail(spritetablea,256*512+4096); - AllocmemFail(vbufaptr,512*296*4+4096+512*296); - AllocmemFail(vbufeptr,288*2*256+4096); - AllocmemFail(ngwinptrb,256*224+4096); - AllocmemFail(vbufdptr,1024*296); - AllocmemFail(vcache2bs,65536*4*4+4096); - AllocmemFail(vcache4bs,65536*4*2+4096); - AllocmemFail(vcache8bs,65536*4+4096); -#ifdef OLD_DEBUGGER - AllocmemFail(debugbuf,80000); -#endif - AllocmemFail(sram,65536*2); - AllocmemFail(vcache2b,262144+256); - AllocmemFail(vcache4b,131072+256); - AllocmemFail(vcache8b,65536+256); - - newgfx16b = 1; - if ((romaptr = malloc(0x600000+32768*2+4096))) - { - maxromspace = 0x600000; - } - else - { - if ((romaptr = malloc(0x400000+32768*2+4096))) - { - maxromspace = 0x400000; - } - else - { - if ((romaptr = malloc(0x200000+32768*2+4096))) - { - maxromspace = 0x200000; - } - else - { - outofmemory(); - } - } - } - - // Set up memory values - vidbuffer = vbufaptr; - vidbufferofsa = vbufaptr; - ngwinptr = ngwinptrb; - vidbufferofsb = vbufeptr; - - headdata = romaptr; - romdata = romaptr; - sfxramdata = romaptr+0x400000; - setaramdata = romaptr+0x400000; - - // Puts this ASM after the end of the ROM: - // CLI - // here: BRA here - // But why? - romdata[maxromspace+0] = 0x58; - romdata[maxromspace+1] = 0x80; - romdata[maxromspace+2] = 0xFE; - - wramdata = wramdataa; - ram7f = ram7fa; - vram = vrama; - - regptr -= 0x8000; - regptw -= 0x8000; -} - -const unsigned int versionNumber = 0x00000097; // 1.51 -char *ZVERSION = "1.51"; -unsigned char txtfailedalignd[] = "Data Alignment Failure : "; -unsigned char txtfailedalignc[] = "Code Alignment Failure : "; - -void zstart() -{ - unsigned int ptr; - - asm_call(MMXCheck); - asm_call(StartUp); - - // Print welcome message. - printf("ZSNES v%s, (c) 1997-2007, ZSNES Team\n", ZVERSION); - puts("Be sure to check http://www.zsnes.com/ for the latest version.\n"); - puts("ZSNES is written by the ZSNES Team (See AUTHORS.TXT)"); - puts("ZSNES comes with ABSOLUTELY NO WARRANTY. This is free software,"); - puts("and you are welcome to redistribute it under certain conditions;"); - puts("please read 'LICENSE.TXT' thoroughly before doing so.\n"); - puts("Use ZSNES -? for command line definitions.\n"); - -#ifndef __RELEASE__ - puts("This is a work in progress build. It contains code which"); - puts("May or may not be complete\n"); -#ifdef __UNIXSDL__ - puts("If this is supposed to be an official release, you forgot to"); - puts("run configure with --enable-release, go rebuild.\n"); -#endif -#endif - -#ifdef __UNIXSDL__ - MultiMouseInit(); -#endif - - asm_call(SystemInit); - - if (guioff && !*ZCartName) - { - puts("Will not start without a GUI unless a filename is supplied."); - exit(0); - } - else - { - extern bool romloadskip; - romloadskip = true; - } - -#ifdef OPENSPC - OSPC_Init(); -#else - setnoise(); - asm_call(InitSPC); -#endif - - allocmem(); - - if (!(spcon = !SPCDisable)) { soundon = 0; } - DSPDisable = !soundon; - - if (!frameskip) - { - FPSOn = FPSAtStart; - } - - gammalevel16b = gammalevel >> 1; - - ptr = (unsigned int)&init; - if ((ptr & 3)) - { - printf("%s%d", txtfailedalignc, (ptr & 0x1F)); - asm_call(WaitForKey); - } - - ptr = (unsigned int)&xa; - if ((ptr & 3)) - { - printf("%s%d", txtfailedalignd, (ptr & 0x1F)); - asm_call(WaitForKey); - } - - asm_call(init); -} - -static char *seconds_to_asc(unsigned int seconds) -{ - static char buffer[50]; - char *p = buffer; - unsigned int hours, minutes; - - minutes = seconds/60; - seconds -= minutes*60; - hours = minutes/60; - minutes -= hours*60; - *buffer = 0; - - if (hours) - { - sprintf(p, "%u hours ", hours); - p += strlen(p); - } - if (minutes) - { - sprintf(p, "%u min ", minutes); - p += strlen(p); - } - if (seconds) - { - sprintf(p, "%u sec", seconds); - p += strlen(p); - } - if (!*buffer) - { - strcpy(buffer, "0 sec"); - } - return(buffer); -} - -void DisplayBatteryStatus() -{ -#ifndef __MSDOS__ - int CheckBattery(); - int CheckBatteryTime(); - int CheckBatteryPercent(); - - *CSStatus2 = 0; - *CSStatus3 = 0; - - switch (CheckBattery()) - { - case -1: //No battery - strcpy(CSStatus, "No battery present"); - break; - - case 0: //Plugged in - { - int percent = CheckBatteryPercent(); - - strcpy(CSStatus, "PC is plugged in"); - if (percent > 0) - { - sprintf(CSStatus2, "%d%% charged", percent); - } - } - break; - - case 1: //Not plugged in - { - int percent = CheckBatteryPercent(); - int battery_time = CheckBatteryTime(); - - strcpy(CSStatus, "PC is running off of battery"); - if (battery_time > 0) - { - sprintf(CSStatus2, "Time remaining: %s", seconds_to_asc(battery_time)); - } - if (percent > 0) - { - sprintf(CSStatus3, "%d%% remaining", percent); - } - } - break; - } - - Msgptr = CSStatus; - MessageOn = 100; -#endif -} - -// Make use of multiple mice. - -#ifndef __MSDOS__ - -int MouseCount = 0; - -unsigned short MouseMoveX[2]; -unsigned short MouseMoveY[2]; -unsigned short MouseButtons[2]; - -static bool MouseWaiting[2]; - -void MultiMouseShutdown(void) -{ - MouseCount = 0; - ManyMouse_Quit(); -} - -void MultiMouseInit() -{ -#ifdef linux - DIR *input_dir; - - puts("Starting Mouse detection."); - input_dir = opendir("/dev/input"); - if (input_dir) - { - struct dirent *ent; - while ((ent = readdir(input_dir))) - { - if (!strncasecmp(ent->d_name, "event", strlen("event"))) - { - if (access_dir("/dev/input/", ent->d_name, R_OK)) - { - printf("Unable to poll /dev/input/%s. Make sure you have read permissions to it.\n", ent->d_name); - } - } - } - closedir(input_dir); - } - else - { - puts("/dev/input does not exist or is inaccessable"); - } -#endif - MouseCount = ManyMouse_Init(); - printf("ManyMouse: %d mice detected.\n", MouseCount); - - if (MouseCount > 1) - { - MouseMoveX[0] = MouseMoveX[1] = 0; - MouseMoveY[0] = MouseMoveY[1] = 0; - MouseButtons[0] = MouseButtons[1] = 0; - MouseWaiting[0] = MouseWaiting[1] = false; - atexit(MultiMouseShutdown); - - printf("Using ManyMouse for:\nMouse 0: %s\nMouse 1: %s\n", ManyMouse_DeviceName(0), ManyMouse_DeviceName(1)); - } - else - { - strcpy(CSStatus, "Dual mice not detected"); - strcpy(CSStatus2, ""); - strcpy(CSStatus3, ""); - Msgptr = CSStatus; - MessageOn = 100; - - MultiMouseShutdown(); - } -} - -#define BIT(x) (1 << (x)) -#define MOUSE_BUTTON_HANDLE(mouse, bit, value) \ - if (value) { mouse |= BIT(bit); } \ - else { mouse &= ~BIT(bit); } - -unsigned char mouse; -void MultiMouseProcess() -{ - ManyMouseEvent event; - if (MouseWaiting[mouse]) - { - MouseWaiting[mouse] = false; - } - else - { - MouseMoveX[mouse] = 0; - MouseMoveY[mouse] = 0; - - while (ManyMouse_PollEvent(&event)) - { - if (event.device != 0 && event.device != 1) - { - continue; - } - - //printf("Device: %d; Type: %d; Item: %d; Value: %d\n", event.device, event.type, event.item, event.value); - - if ((event.device == (mouse^1)) && !MouseWaiting[event.device]) - { - MouseMoveX[event.device] = 0; - MouseMoveY[event.device] = 0; - MouseWaiting[event.device] = true; - } - - if (event.type == MANYMOUSE_EVENT_RELMOTION) - { - if (event.item == 0) { MouseMoveX[event.device] = event.value; } - else { MouseMoveY[event.device] = event.value; } - } - else if (event.type == MANYMOUSE_EVENT_BUTTON) - { - if (event.item == 0) { MOUSE_BUTTON_HANDLE(MouseButtons[event.device], 0, event.value); } - else if (event.item == 1) { MOUSE_BUTTON_HANDLE(MouseButtons[event.device], 1, event.value); } - } - } - } -} - -#endif - diff --git a/tools/zsnes/src/vcache.asm b/tools/zsnes/src/vcache.asm deleted file mode 100644 index b80a27e..0000000 --- a/tools/zsnes/src/vcache.asm +++ /dev/null @@ -1,3971 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 MessageOn,MsgCount,Msgptr,Voice0Disable,Voice0Status,Voice1Disable -EXTSYM Voice1Status,Voice2Disable,Voice2Status,Voice3Disable,Voice3Status -EXTSYM Voice4Disable,Voice4Status,Voice5Disable,Voice5Status,Voice6Disable -EXTSYM Voice6Status,Voice7Disable,Voice7Status,bgcmsung,bgmode -EXTSYM cgmod,disableeffects,frameskip,frskipper,current_zst -EXTSYM maxbr,modeused,mousexloc,mouseyloc,newengen,KeyRTRCycle -EXTSYM nextdrawallng,pal16b,pal16bxcl,pressed,prevbright,prevpal -EXTSYM scaddsngb,scaddtngb,scaddtngbx,scfbl,scrndis,sprprdrn,t1cc -EXTSYM vidbright,vidbuffer,vidbufferofsa,vidmemch2,MZTForceRTR -EXTSYM GUIRClick,MousePRClick,ngmsdraw,cvidmode,fulladdtab -EXTSYM KeyDisableSC0,KeyDisableSC1,KeyDisableSC2,KeyDisableSC3,KeyDisableSC4 -EXTSYM KeyDisableSC5,KeyDisableSC6,KeyDisableSC7,KeyFastFrwrd,SRAMSave5Sec -EXTSYM KeyBGDisble0,KeyBGDisble1,KeyBGDisble2,KeyBGDisble3,KeySprDisble -EXTSYM KeyResetAll,KeyWinDisble,KeyNewGfxSwt,KeyOffsetMSw -EXTSYM KeyStateSlc0,KeyStateSlc1,KeyStateSlc2,KeyStateSlc3,KeyStateSlc4 -EXTSYM KeyStateSlc5,KeyStateSlc6,KeyStateSlc7,KeyStateSlc8,KeyStateSlc9 -EXTSYM KeyIncStateSlot,KeyDecStateSlot,KeyUsePlayer1234,maxskip,DSPMem -EXTSYM FastFwdToggle,SaveSramData,ngextbg,Mode7HiRes,Check60hz -EXTSYM Get_MouseData,Get_MousePositionDisplacement,scanlines -EXTSYM romispal,MusicRelVol,MusicVol,WDSPReg0C,WDSPReg1C,KeySlowDown -EXTSYM KeyFRateDown,KeyFRateUp,KeyVolUp,KeyVolDown,KeyDisplayFPS -EXTSYM FPSOn,pl12s34,bg1ptr,bg2ptr,bg3ptr,bg4ptr,cachebg1,resolutn,curypos -EXTSYM oamram,objhipr,objptr,objptrn,objsize1,objsize2,spritetablea,sprleftpr -EXTSYM sprlefttot,vcache4b,objadds1,objadds2,objmovs1,objmovs2,tltype4b -EXTSYM vidmemch4,vram,bgptr,bgptrc,bgptrd,curtileptr,vcache2b,vcache8b,vidmemch8 -EXTSYM offsetmshl,NextLineCache,tltype2b,tltype8b,objwlrpos -EXTSYM EmuSpeed,SDRatio,FFRatio,DisplayBatteryStatus,lhguimouse,SwapMouseButtons -EXTSYM KeyResetSpeed,KeyEmuSpeedUp,KeyEmuSpeedDown,KeyDisplayBatt,EMUPause -EXTSYM device1,device2,snesinputdefault1,snesinputdefault2 -EXTSYM KeyExtraEnab1,KeyExtraEnab2,cycleinputdevice1,cycleinputdevice2,MouseDis -EXTSYM KeyIncreaseGamma,KeyDecreaseGamma,gammalevel,gammalevel16b -EXTSYM RawDumpInProgress - -%ifndef NO_DEBUGGER -EXTSYM debuggeron -%else -EXTSYM SPCSave -%endif - -; Process stuff & Cache sprites - -SECTION .data -ALIGN32 - -NEWSYM fskipped, db 0 -NEWSYM sprprifix, db 1 -NEWSYM OMBGTestVal, dd 0 -NEWSYM ngptrdat2, dd 0 -NEWSYM ofshvaladd, dd 0 -NEWSYM ofsmtptrs, dd 0 -NEWSYM ofsmcptr2, dd 0 -NEWSYM sramb4save, dd 0 -NEWSYM hiresstuff, dd 0 -NEWSYM overalltimer, dd 0 - -SECTION .text - -%macro stateselcomp 2 - mov eax,[%1] - test byte[pressed+eax],1 - je %%nostsl - mov byte[pressed+eax],2 - mov eax,[current_zst] - mov cl,10 - div cl - mov ah,%2 - add al,'0' - add ah,'0' - mov [sselm+11],ax - sub al,'0' - mul cl - add al,%2 - mov [current_zst],eax - mov dword[Msgptr],sselm - mov eax,[MsgCount] - mov [MessageOn],eax -%%nostsl -%endmacro - -%macro soundselcomp 4 - mov eax,[%1] - test byte[pressed+eax],1 - je %%nosdis - xor byte[%2],01h - mov byte[%3],0 - mov byte[pressed+eax],2 - mov byte[sndchena+9],%4 - mov byte[sndchdis+9],%4 - mov dword[Msgptr],sndchena - test byte[%2],01h - jnz %%sen - mov dword[Msgptr],sndchdis -%%sen - mov eax,[MsgCount] - mov [MessageOn],eax -%%nosdis -%endmacro - -UpdateVolume: - pushad - xor eax,eax - mov al,[MusicRelVol] - shl eax,7 - mov ebx,0A3D70A3Dh - mul ebx - shr edx,6 - cmp dl,127 - jb .noof - mov dl,127 -.noof - mov [MusicVol],dl - - mov al,[DSPMem+0Ch] - call WDSPReg0C - mov al,[DSPMem+1Ch] - call WDSPReg1C - - mov dword[vollv+14],20202020h - mov edx,vollv+15 - mov al,[MusicRelVol] - cmp al,100 - jne .no100 - mov byte[edx],49 - mov byte[edx+1],48 - sub al,100 - add edx,2 -.no100 - xor ah,ah - mov bl,10 - div bl - cmp al,0 - je .no10 - add al,48 - mov [edx],al - inc edx -.no10 - add ah,48 - mov [edx],ah - mov dword[Msgptr],vollv - mov eax,[MsgCount] - mov [MessageOn],eax - popad - ret - -ClockCounter: - inc dword[overalltimer] - cmp byte[romispal],0 - jne .dopal - cmp dword[overalltimer],60 - jne .notimer - sub dword[overalltimer],60 - jmp .notimer -.dopal - cmp dword[overalltimer],50 - jne .notimer - sub dword[overalltimer],50 -.notimer - test byte[pressed+2Eh],1 - jz .noclear - mov dword[overalltimer],0 -.noclear - ret - -SECTION .bss -NEWSYM FastForwardLock, resb 1 -NEWSYM SlowDownLock, resb 1 -NEWSYM CSprWinPtr, resd 1 -NEWSYM SloMo, resb 1 ; number of extra times to draw a frame -section .text - -NEWSYM cachevideo - mov byte[NextLineCache],0 - mov dword[objwlrpos],0FFFFFFFFh - mov dword[CSprWinPtr],0 - mov byte[pressed],0 - mov dword[bgcmsung],0 - mov dword[modeused],0 - mov dword[modeused+4],0 - mov dword[scaddsngb],0 - mov dword[scaddtngb],0 - mov dword[sprprdrn],0 - mov dword[ngmsdraw],0 - mov dword[ngextbg],0 - mov dword[scaddtngbx],0FFFFFFFFh - mov byte[hiresstuff],0 - mov byte[Mode7HiRes],0 - - call ClockCounter - - cmp byte[scanlines],1 - je .nohires - cmp byte[cvidmode],9 - je .yeshires - cmp byte[cvidmode],15 - jne .nohires -.yeshires - mov byte[Mode7HiRes],1 -.nohires - mov dword[scfbl],1 - mov al,[vidbright] - mov [maxbr],al - mov byte[cgmod],1 - xor al,al - mov [curblank],al -%ifndef NO_DEBUGGER - cmp byte[debuggeron],0 - je .nodebugger - mov byte[curblank],40h - mov al,40h - jmp .nofrskip -.nodebugger -%else - cmp byte[SPCSave],1 - jne .nospcsave - mov byte[curblank],40h - mov al,40h - jmp .nofrskip -.nospcsave -%endif - - cmp dword[sramb4save],0 - je .nofocussave - cmp byte[SRAMSave5Sec],0 - je .nofocussaveb - dec dword[sramb4save] - cmp dword[sramb4save],1 - jne .nofocussave - pushad - call SaveSramData - popad - jmp .nofocussave -.nofocussaveb - mov dword[sramb4save],0 -.nofocussave - - ; if emulation paused, don't alter timing - mov ax,1 - cmp byte[EMUPause],1 - je near .ttldone - ; fast forward goes over all other throttles - ; don't fast forward while dumping a movie - cmp byte[RawDumpInProgress],1 - je .ffskip - cmp byte[FastFwdToggle],0 - jne .ffmode2 - mov eax,[KeyFastFrwrd] - test byte[pressed+eax],1 - jnz near .fastfor - jmp .ffskip -.ffmode2 - mov eax,[KeyFastFrwrd] - test byte[pressed+eax],1 - jz .nofastfor - mov byte[pressed+eax],2 - xor byte[FastForwardLock],1 -.nofastfor - cmp byte[FastForwardLock],1 - je near .fastfor -.ffskip - ; next up, check for slowdown - cmp byte[FastFwdToggle],0 - jne .sdmode2 - mov eax,[KeySlowDown] - test byte[pressed+eax],1 - jnz near .slowdwn - jmp .sdskip -.sdmode2 - mov eax,[KeySlowDown] - test byte[pressed+eax],1 - jz .noslowdwn - mov byte[pressed+eax],2 - xor byte[SlowDownLock],1 -.noslowdwn - cmp byte[SlowDownLock],1 - je near .slowdwn - jmp .sdskip -.slowdwn - mov al,[SDRatio] ; 0-28 - inc al ; 1-29 - mov [SloMo],al ; /2-/30 slowmotion - jmp .throttleskip -.sdskip - ; now we can look at emuspeed - cmp byte[EmuSpeed],30 ; 0-28 slow, 29 normal, 30-58 skip - jb .noskipping - inc byte[frskipper] - push ebx - mov bl,[EmuSpeed] - sub bl,29 ; 30-58 -> 1-29 frames to skip, 2x-30x speed - jmp .fastforb -.noskipping - mov byte[SloMo],29 - mov al,[EmuSpeed] - sub byte[SloMo],al ; 0-29 -> repeat 29-0 times, /30-1x speed -.throttleskip - mov ax,[SloMo] - inc ax ; total times frame is drawn -.ttldone - - cmp byte[frameskip],0 - jne near .frameskip - cmp word[t1cc],ax - jae .skipt1ccc -.noskip - push eax - call Check60hz - pop eax - cmp word[t1cc],ax - jb .noskip -.skipt1ccc - sub word[t1cc],ax - cmp word[t1cc],ax - jb .noskip2 - mov byte[curblank],40h - inc byte[fskipped] - mov cl,[maxskip] - cmp byte[fskipped],cl - jbe near .nofrskip - mov word[t1cc],0 - mov byte[curblank],0 -.noskip2 - mov byte[fskipped],0 - jmp .nofrskip -.fastfor - inc byte[frskipper] - push ebx - mov bl,[FFRatio] ; 0-28 - inc bl ; 1-29, 2x-30x fastmotion - jmp .fastforb -.frameskip - inc byte[frskipper] - push ebx - mov bl,[frameskip] -.fastforb - cmp byte[frskipper],bl - pop ebx - jae .nofrskip - mov byte[curblank],40h - jmp .frskip -.nofrskip - mov byte[frskipper],0 -.frskip - push ebx - push esi - push edi - push edx - cmp byte[MouseDis],1 - je .noclick - cmp byte[GUIRClick],0 - je .noclick - cmp byte[device1],0 - jne .noclick - cmp byte[device2],0 - jne .noclick - call Get_MouseData - cmp byte[lhguimouse],1 - jne .notlefthanded - call SwapMouseButtons -.notlefthanded - test bx,02h - jz .norclick - cmp byte[MousePRClick],0 - jne .noclick - mov byte[pressed+1],1 -.norclick - mov byte[MousePRClick],0 -.noclick - ; disable all necessary backgrounds - mov eax,[KeyBGDisble0] - test byte[pressed+eax],1 - je .nodis1 - xor byte[scrndis],01h - mov byte[pressed+eax],2 - mov dword[Msgptr],bg1layena - test byte[scrndis],01h - jz .en1 - mov dword[Msgptr],bg1laydis -.en1 - mov eax,[MsgCount] - mov [MessageOn],eax -.nodis1 - mov eax,[KeyBGDisble1] - test byte[pressed+eax],1 - je .nodis2 - xor byte[scrndis],02h - mov byte[pressed+eax],2 - mov dword[Msgptr],bg2layena - test byte[scrndis],02h - jz .en2 - mov dword[Msgptr],bg2laydis -.en2 - mov eax,[MsgCount] - mov [MessageOn],eax -.nodis2 - mov eax,[KeyBGDisble2] - test byte[pressed+eax],1 - je .nodis3 - xor byte[scrndis],04h - mov byte[pressed+eax],2 - mov dword[Msgptr],bg3layena - test byte[scrndis],04h - jz .en3 - mov dword[Msgptr],bg3laydis -.en3 - mov eax,[MsgCount] - mov [MessageOn],eax -.nodis3 - mov eax,[KeyBGDisble3] - test byte[pressed+eax],1 - je .nodis4 - xor byte[scrndis],08h - mov byte[pressed+eax],2 - mov dword[Msgptr],bg4layena - test byte[scrndis],08h - jz .en4 - mov dword[Msgptr],bg4laydis -.en4 - mov eax,[MsgCount] - mov [MessageOn],eax -.nodis4 - mov eax,[KeySprDisble] - test byte[pressed+eax],1 - je .nodis5 - xor byte[scrndis],10h - mov byte[pressed+eax],2 - mov dword[Msgptr],sprlayena - test byte[scrndis],10h - jz .en5 - mov dword[Msgptr],sprlaydis -.en5 - mov eax,[MsgCount] - mov [MessageOn],eax -.nodis5 - mov eax,[KeyEmuSpeedDown] - test byte[pressed+eax],1 - jz .nospeeddown - mov byte[pressed+eax],2 - cmp byte[EmuSpeed],0 - je .nospeeddown - dec byte[EmuSpeed] -.nospeeddown - mov eax,[KeyEmuSpeedUp] - test byte[pressed+eax],1 - jz .nospeedup - mov byte[pressed+eax],2 - cmp byte[EmuSpeed],58 - je .nospeedup - inc byte[EmuSpeed] -.nospeedup - mov eax,[KeyResetSpeed] - test byte[pressed+eax],1 - jz .nospeedreset - mov byte[pressed+eax],2 - mov byte[EmuSpeed],29 -.nospeedreset - mov eax,[KeyResetAll] - test byte[pressed+eax],1 - je near .nodis6 - mov byte[pressed+eax],2 - mov byte[Voice0Disable],1 - mov byte[Voice1Disable],1 - mov byte[Voice2Disable],1 - mov byte[Voice3Disable],1 - mov byte[Voice4Disable],1 - mov byte[Voice5Disable],1 - mov byte[Voice6Disable],1 - mov byte[Voice7Disable],1 - mov byte[scrndis],0 - mov byte[disableeffects],0 - mov byte[osm2dis],0 - mov byte[EmuSpeed],29 - mov al,[snesinputdefault1] - mov [device1],al - mov al,[snesinputdefault2] - mov [device2],al - mov dword[Msgptr],panickeyp - mov eax,[MsgCount] - mov [MessageOn],eax -.nodis6 - mov eax,[KeyRTRCycle] - test byte[pressed+eax],1 - je near .nortrcycle - mov byte[pressed+eax],2 - inc byte[MZTForceRTR] - cmp byte[MZTForceRTR],3 - jne .notrtrwrap - mov byte[MZTForceRTR],0 - mov dword[Msgptr],mztrtr0 - jmp .mztrtrmesg -.notrtrwrap - cmp byte[MZTForceRTR],1 - jne .nomztrtr1 - mov dword[Msgptr],mztrtr1 - jmp .mztrtrmesg -.nomztrtr1 - mov dword[Msgptr],mztrtr2 -.mztrtrmesg - mov eax,[MsgCount] - mov [MessageOn],eax -.nortrcycle - mov eax,[KeyExtraEnab1] - test byte[pressed+eax],1 - je near .nodisd1 - mov byte[pressed+eax],2 - pushad - call cycleinputdevice1 - popad - mov dword[Msgptr],snesmousep0 - cmp byte[device1],1 - jne .nom11 - mov dword[Msgptr],snesmousep1 -.nom11 - mov eax,[MsgCount] - mov [MessageOn],eax - call Get_MousePositionDisplacement -.nodisd1 - mov eax,[KeyExtraEnab2] - test byte[pressed+eax],1 - je near .nodisd2 - mov byte[pressed+eax],2 - pushad - call cycleinputdevice2 - popad - mov dword[Msgptr],snesmousep0 - cmp byte[device2],1 - jne .nom21 - mov dword[Msgptr],snesmousep2 -.nom21 - cmp byte[device2],2 - jne .nom22 - mov dword[Msgptr],snesss - mov word[mousexloc],128 - mov word[mouseyloc],112 -.nom22 - cmp byte[device2],3 - jne .nom23 - mov dword[Msgptr],snesle1 -.nom23 - cmp byte[device2],4 - jne .nom24 - mov dword[Msgptr],snesle2 -.nom24 - mov eax,[MsgCount] - mov [MessageOn],eax - call Get_MousePositionDisplacement -.nodisd2 - mov eax,[KeyNewGfxSwt] - test byte[pressed+eax],1 - je near .nodis8 - mov byte[pressed+eax],2 - mov byte[prevbright],16 - xor byte[newengen],1 - mov dword[Msgptr],ngena - cmp byte[newengen],1 - je .disng - mov dword[Msgptr],ngdis -.disng - mov eax,[MsgCount] - mov [MessageOn],eax - mov dword[nextdrawallng],1 - mov edi,vidmemch2 - mov ecx,1024*3 - mov eax,01010101h - rep stosd - mov edi,pal16b - mov ecx,256 - xor eax,eax - rep stosd - mov edi,prevpal - mov ecx,128 - rep stosd - mov eax,0FFFFh - cmp byte[newengen],1 - jne .noneweng - mov eax,0FFFFFFFFh -.noneweng - mov edi,pal16bxcl - mov ecx,256 - rep stosd - pushad - call genfulladdtab - popad -.yesng -.disng2 -.nodis8 - mov eax,[KeyWinDisble] - test byte[pressed+eax],1 - je .nodis9 - mov byte[pressed+eax],2 - xor byte[disableeffects],1 - mov dword[Msgptr],windissw - cmp byte[disableeffects],1 - je .disablew - mov dword[Msgptr],winenasw -.disablew - mov eax,[MsgCount] - mov [MessageOn],eax -.nodis9 - mov eax,[KeyOffsetMSw] - test byte[pressed+eax],1 - je .nodis10 - mov byte[pressed+eax],2 - xor byte[osm2dis],1 - mov dword[Msgptr],ofsdissw - cmp byte[osm2dis],1 - je .disableom - mov dword[Msgptr],ofsenasw -.disableom - mov eax,[MsgCount] - mov [MessageOn],eax -.nodis10 - mov eax,[KeyVolUp] - test byte[pressed+eax],1 - je .novolup - cmp byte[MusicRelVol],100 - jae .novolup - inc byte[MusicRelVol] - call UpdateVolume -.novolup - mov eax,[KeyVolDown] - test byte[pressed+eax],1 - je .novoldown - cmp byte[MusicRelVol],0 - je .novoldown - dec byte[MusicRelVol] - call UpdateVolume -.novoldown - mov eax,[KeyFRateUp] - test byte[pressed+eax],1 - je .nofrup - mov byte[pressed+eax],2 - cmp byte[frameskip],10 - je .nofrup - mov byte[FPSOn],0 - inc byte[frameskip] - mov al,[frameskip] - add al,47 - mov [frlev+18],al - mov dword[Msgptr],frlev - mov eax,[MsgCount] - mov [MessageOn],eax -.nofrup - mov eax,[KeyFRateDown] - test byte[pressed+eax],1 - je .nofrdown - mov byte[pressed+eax],2 - cmp byte[frameskip],0 - je .nofrdown - dec byte[frameskip] - cmp byte[frameskip],0 - je .min - mov al,[frameskip] - add al,47 - mov [frlev+18],al - mov dword[Msgptr],frlev - jmp .nomin -.min - mov dword[Msgptr],frlv0 - mov word[t1cc],0 -.nomin - mov eax,[MsgCount] - mov [MessageOn],eax -.nofrdown - mov eax,[KeyDisplayBatt] - test byte[pressed+eax],1 - je .nodisplaybatt - mov byte[pressed+eax],2 - pushad - call DisplayBatteryStatus - popad -.nodisplaybatt - mov eax,[KeyIncreaseGamma] - test byte[pressed+eax],1 - je .noincgamma - mov byte[pressed+eax],2 - cmp byte[gammalevel],15 - jge .noincgamma - inc byte[gammalevel] - mov al,[gammalevel] - mov [gammalevel16b],al - shr byte[gammalevel16b],1 - cmp byte[gammalevel],10 - jl .gammanot10 - mov byte[gammamsg+13],'1' - sub al,10 - jmp .postgamma -.gammanot10 - mov byte[gammamsg+13],' ' -.postgamma - add al,'0' - mov [gammamsg+14],al - mov dword[Msgptr],gammamsg - mov eax,[MsgCount] - mov [MessageOn],eax -.noincgamma - mov eax,[KeyDecreaseGamma] - test byte[pressed+eax],1 - je .nodecgamma - mov byte[pressed+eax],2 - cmp byte [gammalevel],0 - je .nodecgamma - dec byte[gammalevel] - mov eax,[gammalevel] - mov [gammalevel16b],eax - shr byte[gammalevel16b],1 - cmp byte[gammalevel],10 - jl .gamma2not10 - mov byte[gammamsg+13],'1' - sub al,10 - jmp .postgamma2 -.gamma2not10 - mov byte[gammamsg+13],' ' -.postgamma2 - add al,'0' - mov [gammamsg+14],al - mov dword[Msgptr],gammamsg - mov eax,[MsgCount] - mov [MessageOn],eax -.nodecgamma - mov eax,[KeyDisplayFPS] - test byte[pressed+eax],1 - je .nodisplayfps - mov byte[pressed+eax],2 - cmp byte[frameskip],0 - jne .nodisplayfps - xor byte[FPSOn],1 -.nodisplayfps - - ; do state selects - stateselcomp KeyStateSlc0,0 - stateselcomp KeyStateSlc1,1 - stateselcomp KeyStateSlc2,2 - stateselcomp KeyStateSlc3,3 - stateselcomp KeyStateSlc4,4 - stateselcomp KeyStateSlc5,5 - stateselcomp KeyStateSlc6,6 - stateselcomp KeyStateSlc7,7 - stateselcomp KeyStateSlc8,8 - stateselcomp KeyStateSlc9,9 - mov eax,[KeyStateSlc0] - test byte[pressed+eax],1 - je .nostsl0 - mov byte[pressed+eax],2 - mov byte[sselm+11],'0' - mov dword[Msgptr],sselm - mov eax,[MsgCount] - mov [MessageOn],eax -.nostsl0 - - mov eax,[KeyIncStateSlot] - test byte[pressed+eax],1 - je near .noincstateslot - mov byte[pressed+eax],2 - mov eax,[current_zst] - inc eax - cmp eax,100 - jne .notend - xor eax,eax -.notend - mov [current_zst],eax - mov dl,10 - div dl - add ah,'0' - add al,'0' - mov [sselm+11],ax - mov dword[Msgptr],sselm - mov eax,[MsgCount] - mov [MessageOn],eax - xor dx,dx -.noincstateslot - - mov eax,[KeyDecStateSlot] - test byte[pressed+eax],1 - je near .nodecstateslot - mov byte[pressed+eax],2 - mov eax,[current_zst] - cmp eax,0 - jne .notstart - mov eax,100 -.notstart - dec eax - mov [current_zst],eax - mov dl,10 - div dl - add ah,'0' - add al,'0' - mov [sselm+11],ax - mov dword[Msgptr],sselm - mov eax,[MsgCount] - mov [MessageOn],eax - xor dx,dx -.nodecstateslot - - mov eax,[KeyUsePlayer1234] - test byte[pressed+eax],1 - je .nousepl1234 - mov byte[pressed+eax],2 - xor byte[pl12s34],1 - mov dword[Msgptr],pluse1234en - cmp byte[pl12s34],1 - je .usepl1234 - mov dword[Msgptr],pluse1234dis -.usepl1234 - mov eax,[MsgCount] - mov [MessageOn],eax -.nousepl1234 - - ; do sound disables - soundselcomp KeyDisableSC0,Voice0Disable,Voice0Status,'1' - soundselcomp KeyDisableSC1,Voice1Disable,Voice1Status,'2' - soundselcomp KeyDisableSC2,Voice2Disable,Voice2Status,'3' - soundselcomp KeyDisableSC3,Voice3Disable,Voice3Status,'4' - soundselcomp KeyDisableSC4,Voice4Disable,Voice4Status,'5' - soundselcomp KeyDisableSC5,Voice5Disable,Voice5Status,'6' - soundselcomp KeyDisableSC6,Voice6Disable,Voice6Status,'7' - soundselcomp KeyDisableSC7,Voice7Disable,Voice7Status,'8' - - cmp byte[curblank],0h - jne near yesblank - ; Swap video addresses -; mov ebx,[vidbuffer] -; cmp ebx,[vidbufferofsa] -; je .useb - mov ebx,[vidbufferofsa] - mov [vidbuffer],ebx - -NEWSYM docache - xor ebx,ebx - mov bl,[bgmode] - shl bl,2 - add ebx,colormodedef - mov [colormodeofs],ebx - xor ebx,ebx - mov bl,[bgmode] - mov al,[colormodedef+ebx*4] - mov [curcolbg1],al - mov ah,[colormodedef+ebx*4+1] - mov [curcolbg2],ah - mov al,[colormodedef+ebx*4] - mov [curcolbg3],al - mov ah,[colormodedef+ebx*4+1] - mov [curcolbg4],ah - mov ax,[bg1ptr] - mov [curbgofs1],ax - mov ax,[bg2ptr] - mov [curbgofs2],ax - mov ax,[bg3ptr] - mov [curbgofs3],ax - mov ax,[bg4ptr] - mov [curbgofs4],ax - push es - mov ax,ds - mov es,ax - ; clear # of sprites & bg cache - mov edi,cachebg1 - mov ecx,64*5+16*4 - xor eax,eax - rep stosd -; cmp byte[sprprifix],0 -; je .nosprfix -; mov edi,sprlefttotb -; mov ecx,64*3 -; xor eax,eax -; rep stosd -;.nosprfix - ; do sprites -; test word[scrnon],1010h -; jz .nosprites - test byte[scrndis],10h - jnz .nosprites - call cachesprites - call processsprites -; mov byte[sprprncache],0 -; cmp byte[sprprifix],0 -; je .nosprites -; call processspritesb - -.nosprites - ; fill background with 0's unless 16-bit/new graphics engine mode is on - xor ecx,ecx - pop es -NEWSYM yesblank - pop edx - pop edi - pop esi - pop ebx - ret - -SECTION .data -NEWSYM osm2dis, db 0 -NEWSYM colormodedef, db 1,1,1,1, 2,2,1,0, 2,2,0,0, 3,2,0,0, - db 3,1,0,0, 2,1,0,0, 2,0,0,0, 0,0,0,0 -NEWSYM colormodeofs, dd 0 -NEWSYM curblank, db 80h ; current blank state (40h = skip fill) -NEWSYM addr2add, dd 0 -;cachebg1 times 64 db 0 -;cachebg2 times 64 db 0 -;cachebg3 times 64 db 0 -;cachebg4 times 64 db 0 -;sprlefttot times 256 db 0 ; total sprites left -;sprleftpr times 256 db 0 ; sprites left for priority 0 -;sprleftpr1 times 256 db 0 ; sprites left for priority 1 -;sprleftpr2 times 256 db 0 ; sprites left for priority 2 -;sprleftpr3 times 256 db 0 ; sprites left for priority 3 -;spritetable times 256*512 db 0 ; sprite table (flip/pal/xloc/vbufptr)38*7 -NEWSYM curbgofs1, dw 0 -NEWSYM curbgofs2, dw 0 -NEWSYM curbgofs3, dw 0 -NEWSYM curbgofs4, dw 0 -NEWSYM curcolbg1, db 0 -NEWSYM curcolbg2, db 0 -NEWSYM curcolbg3, db 0 -NEWSYM curcolbg4, db 0 -NEWSYM panickeyp, db 'ALL SWITCHES NORMAL',0 -NEWSYM mztrtr0, db 'LOAD MZT MODE - OFF',0 -NEWSYM mztrtr1, db 'LOAD MZT MODE - RECORD',0 -NEWSYM mztrtr2, db 'LOAD MZT MODE - REPLAY',0 -NEWSYM snesmousep0, db 'EXTRA DEVICES DISABLED',0 -NEWSYM snesmousep1, db 'MOUSE ENABLED IN PORT 1',0 -NEWSYM snesmousep2, db 'MOUSE ENABLED IN PORT 2',0 -NEWSYM snesss, db 'SUPER SCOPE ENABLED',0 -NEWSYM snesle1, db '1 JUSTIFIER ENABLED',0 -NEWSYM snesle2, db '2 JUSTIFIERS ENABLED',0 -NEWSYM windissw, db 'WINDOWING DISABLED',0 -NEWSYM winenasw, db 'WINDOWING ENABLED',0 -NEWSYM ofsdissw, db 'OFFSET MODE DISABLED',0 -NEWSYM ofsenasw, db 'OFFSET MODE ENABLED',0 -NEWSYM ngena, db 'NEW GFX ENGINE ENABLED',0 -NEWSYM ngdis, db 'NEW GFX ENGINE DISABLED',0 -NEWSYM sselm, db 'STATE SLOT 0 SELECTED',0 -NEWSYM vollv, db 'VOLUME LEVEL : ',0 -NEWSYM frlev, db 'FRAME SKIP SET TO ',0 -NEWSYM frlv0, db 'AUTO FRAMERATE ENABLED',0 -NEWSYM pluse1234en, db 'USE PLAYER 1/2 with 3/4 ON',0 -NEWSYM pluse1234dis, db 'USE PLAYER 1/2 with 3/4 OFF',0 -sndchena db 'SOUND CH ENABLED',0 -sndchdis db 'SOUND CH DISABLED',0 -bg1layena db 'BG1 LAYER ENABLED',0 -bg2layena db 'BG2 LAYER ENABLED',0 -bg3layena db 'BG3 LAYER ENABLED',0 -bg4layena db 'BG4 LAYER ENABLED',0 -sprlayena db 'SPRITE LAYER ENABLED',0 -bg1laydis db 'BG1 LAYER DISABLED',0 -bg2laydis db 'BG2 LAYER DISABLED',0 -bg3laydis db 'BG3 LAYER DISABLED',0 -bg4laydis db 'BG4 LAYER DISABLED',0 -sprlaydis db 'SPRITE LAYER DISABLED',0 -gammamsg db 'GAMMA LEVEL: ',0 -section .text - -;******************************************************* -; Process Sprites -;******************************************************* -; Use oamram for object table -NEWSYM processsprites -; cmp byte[cbitmode],1 -; je .skipnewspr -; cmp byte[newengen],1 -; je .skipnewspr - cmp byte[sprprifix],0 - jne near processspritesb -.skipnewspr - ; set obj pointers - cmp byte[objsize1],1 - jne .16dot1 - mov ebx,.process8x8sprite - mov [.size1ptr],ebx - jmp .fin1 -.16dot1 - cmp byte[objsize1],4 - jne .32dot1 - mov ebx,.process16x16sprite - mov [.size1ptr],ebx - jmp .fin1 -.32dot1 - cmp byte[objsize1],16 - jne .64dot1 - mov ebx,.process32x32sprite - mov [.size1ptr],ebx - jmp .fin1 -.64dot1 - mov ebx,.process64x64sprite - mov [.size1ptr],ebx -.fin1 - cmp byte[objsize2],1 - jne .16dot2 - mov ebx,.process8x8sprite - mov [.size2ptr],ebx - jmp .fin2 -.16dot2 - cmp byte[objsize2],4 - jne .32dot2 - mov ebx,.process16x16sprite - mov [.size2ptr],ebx - jmp .fin2 -.32dot2 - cmp byte[objsize2],16 - jne .64dot2 - mov ebx,.process32x32sprite - mov [.size2ptr],ebx - jmp .fin2 -.64dot2 - mov ebx,.process64x64sprite - mov [.size2ptr],ebx -.fin2 - ; set pointer adder - xor eax,eax - xor ebx,ebx - mov al,[objhipr] - shl ax,2 - mov ebx,eax - sub bx,4 - and bx,01FCh - mov dword[addr2add],0 - mov byte[.prileft],4 - mov byte[.curpri],0 - ; do 1st priority - mov ecx,[objptr] - shl ecx,1 - mov [.objvramloc],ecx - mov ecx,[objptrn] - sub ecx,[objptr] - shl ecx,1 - mov [.objvramloc2],ecx - push ebp - mov ebp,[spritetablea] -.startobject - mov byte[.objleft],128 -.objloop - xor ecx,ecx - mov cx,[oamram+ebx+2] - mov dl,ch - shr dl,4 - and dl,03h - cmp dl,[.curpri] - jne near .nextobj - ; get object information - push ebx - mov dl,[oamram+ebx+1] ; y - inc dl - ; set up pointer to esi - mov dh,ch - and ch,01h - shr dh,1 - shl ecx,6 - add ecx,[.objvramloc] - test byte[oamram+ebx+3],01h - jz .noloc2 - add ecx,[.objvramloc2] -.noloc2 - and ecx,01FFFFh - add ecx,[vcache4b] - mov esi,ecx - ; get x - mov al,[oamram+ebx] ; x - ; get double bits - mov cl,bl - shr ebx,4 ; /16 - shr cl,1 - and cl,06h - mov ah,[oamram+ebx+512] - shr ah,cl - and ah,03h - mov ch,ah - and ch,01h - mov cl,al - ; process object - ; esi = pointer to 8-bit object, dh = stats (1 shifted to right) - ; cx = x position, dl = y position - cmp cx,384 - jb .noadder - add cx,65535-511 -.noadder - cmp cx,256 - jge .returnfromptr - cmp cx,-64 - jle .returnfromptr - test ah,02h - jz .size1 - jmp dword near [.size2ptr] -.size1 - jmp dword near [.size1ptr] -.returnfromptr - pop ebx - ; next object -.nextobj - sub bx,4 - and bx,01FCh - dec byte[.objleft] - jnz near .objloop - add dword[addr2add],256 - inc byte[.curpri] - dec byte[.prileft] - jnz near .startobject - pop ebp - ret - -SECTION .bss -.objvramloc resd 1 -.objvramloc2 resd 1 -.curpri resd 1 -.trypri resd 1 -.objleft resd 1 -.prileft resd 1 -.size1ptr resd 1 -.size2ptr resd 1 -SECTION .text - -.reprocesssprite - cmp cx,-8 - jle .next - cmp cx,256 - jge .next - add cx,8 -.reprocessspriteb - cmp dl,[resolutn] - jae .overflow - xor ebx,ebx - mov bl,dl - xor eax,eax - cmp bx,[curypos] - jb .overflow - mov al,[sprlefttot+ebx] - cmp al,45 - ja near .overflow - inc byte[sprlefttot+ebx] - add ebx,[addr2add] - inc byte[sprleftpr+ebx] - sub ebx,[addr2add] - shl ebx,9 - shl eax,3 - add ebx,eax - mov [ebp+ebx],cx - mov [ebp+ebx+2],esi - mov al,[.statusbit] - mov [ebp+ebx+6],dh - mov [ebp+ebx+7],al -.overflow - inc dl - add esi,8 - dec byte[.numleft2do] - jnz .reprocessspriteb - sub cx,8 - ret -.next - add dl,8 - add esi,64 - ret - -.reprocessspriteflipy - cmp cx,-8 - jle .nextb - cmp cx,256 - jge .nextb - add cx,8 -.reprocessspriteflipyb - cmp dl,[resolutn] - jae .overflow2 - xor ebx,ebx - xor eax,eax - mov bl,dl - cmp bx,[curypos] - jb .overflow2 - mov al,[sprlefttot+ebx] - cmp al,45 - ja near .overflow2 - inc byte[sprlefttot+ebx] - add ebx,[addr2add] - inc byte[sprleftpr+ebx] - sub ebx,[addr2add] - shl ebx,9 - shl eax,3 - add ebx,eax - mov [ebp+ebx],cx - mov [ebp+ebx+2],esi - mov al,[.statusbit] - mov [ebp+ebx+6],dh - mov [ebp+ebx+7],al -.overflow2 - inc dl - sub esi,8 - dec byte[.numleft2do] - jnz .reprocessspriteflipyb - sub cx,8 - ret -.nextb - add dl,8 - sub esi,64 - ret - -section .bss -.statusbit resb 1 -section .text - -.process8x8sprite: - test dh,40h - jnz .8x8flipy - mov [.statusbit],dh - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - call .reprocesssprite - jmp .returnfromptr -.8x8flipy - mov [.statusbit],dh - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add esi,56 - call .reprocessspriteflipy - jmp .returnfromptr - -section .bss -.numleft2do resb 1 -section .text - -.process16x16sprite: - mov [.statusbit],dh - test dh,20h - jnz near .16x16flipx - test dh,40h - jnz .16x16flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - call .reprocesssprite - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - sub cx,8 - add esi,64*14 - mov byte[.numleft2do],8 - call .reprocesssprite - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - jmp .returnfromptr -.16x16flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add dl,8 - add esi,56 - call .reprocessspriteflipy - add esi,128 - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - add esi,128 - sub dl,16 - sub cx,8 - add esi,64*14 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - add esi,128 - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - jmp .returnfromptr -.16x16flipx - test dh,40h - jnz .16x16flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,8 - call .reprocesssprite - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - add esi,64*14 - add cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - jmp .returnfromptr -.16x16flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,8 - add dl,8 - add esi,56 - call .reprocessspriteflipy - add esi,128 - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - add esi,128 - add esi,64*14 - sub dl,16 - add cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - add esi,128 - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - jmp .returnfromptr - -;******************************************************* -; Sprite increment/draw macros -;******************************************************* - -%macro nextsprite2right 0 - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite -%endmacro - -%macro nextsprite2rightflipy 0 - add esi,128 - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy -%endmacro - -%macro nextsprite2rightflipx 0 - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite -%endmacro - -%macro nextsprite2rightflipyx 0 - add esi,128 - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy -%endmacro - -;******************************************************* -; 32x32 sprites routines -;******************************************************* - -%macro nextline32x32 0 - sub cx,24 - add esi,64*12 - mov byte[.numleft2do],8 - call .reprocesssprite - nextsprite2right - nextsprite2right - nextsprite2right -%endmacro - -.process32x32sprite: - mov [.statusbit],dh - test dh,20h - jnz near .32x32flipx - test dh,40h - jnz near .32x32flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - call .reprocesssprite - nextsprite2right - nextsprite2right - nextsprite2right - nextline32x32 - nextline32x32 - nextline32x32 - jmp .returnfromptr - -%macro nextline32x32flipy 0 - sub cx,24 - add esi,64*12+128 - sub dl,16 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy -%endmacro - -.32x32flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add dl,24 - add esi,56 - call .reprocessspriteflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextline32x32flipy - nextline32x32flipy - nextline32x32flipy - jmp .returnfromptr - -%macro nextline32x32flipx 0 - add cx,24 - add esi,64*12 - mov byte[.numleft2do],8 - call .reprocesssprite - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx -%endmacro - -.32x32flipx - test dh,40h - jnz near .32x32flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,24 - call .reprocesssprite - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextline32x32flipx - nextline32x32flipx - nextline32x32flipx - jmp .returnfromptr - -%macro nextline32x32flipyx 0 - add cx,24 - add esi,64*12+128 - sub dl,16 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx -%endmacro - -.32x32flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,24 - add dl,24 - add esi,56 - call .reprocessspriteflipy - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextline32x32flipyx - nextline32x32flipyx - nextline32x32flipyx - jmp .returnfromptr - -;******************************************************* -; 64x64 sprites routines -;******************************************************* - -%macro nextline64x64 0 - sub cx,56 - add esi,64*8 - mov byte[.numleft2do],8 - call .reprocesssprite - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right -%endmacro - -.process64x64sprite: - mov [.statusbit],dh - test dh,20h - jnz near .64x64flipx - test dh,40h - jnz near .64x64flipy - mov [.statusbit],dh - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - call .reprocesssprite - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextline64x64 - nextline64x64 - nextline64x64 - nextline64x64 - nextline64x64 - nextline64x64 - nextline64x64 - jmp .returnfromptr - -%macro nextline64x64flipy 0 - sub cx,56 - add esi,64*8+128 - sub dl,16 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy -%endmacro - -.64x64flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add dl,56 - add esi,56 - call .reprocessspriteflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - jmp .returnfromptr - -%macro nextline64x64flipx 0 - add cx,56 - add esi,64*8 - mov byte[.numleft2do],8 - call .reprocesssprite - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx -%endmacro - -.64x64flipx - test dh,40h - jnz near .64x64flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,56 - call .reprocesssprite - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - jmp .returnfromptr - -%macro nextline64x64flipyx 0 - add cx,56 - add esi,64*8+128 - sub dl,16 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx -%endmacro - -.64x64flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,56 - add dl,56 - add esi,56 - call .reprocessspriteflipy - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - jmp .returnfromptr - -;******************************************************* -; Process Sprites B - Process -;******************************************************* -; Use oamram for object table - -NEWSYM processspritesb - ; set obj pointers - cmp byte[objsize1],1 - jne .16dot1 - mov ebx,.process8x8sprite - mov [.size1ptr],ebx - jmp .fin1 -.16dot1 - cmp byte[objsize1],4 - jne .32dot1 - mov ebx,.process16x16sprite - mov [.size1ptr],ebx - jmp .fin1 -.32dot1 - cmp byte[objsize1],16 - jne .64dot1 - mov ebx,.process32x32sprite - mov [.size1ptr],ebx - jmp .fin1 -.64dot1 - mov ebx,.process64x64sprite - mov [.size1ptr],ebx -.fin1 - cmp byte[objsize2],1 - jne .16dot2 - mov ebx,.process8x8sprite - mov [.size2ptr],ebx - jmp .fin2 -.16dot2 - cmp byte[objsize2],4 - jne .32dot2 - mov ebx,.process16x16sprite - mov [.size2ptr],ebx - jmp .fin2 -.32dot2 - cmp byte[objsize2],16 - jne .64dot2 - mov ebx,.process32x32sprite - mov [.size2ptr],ebx - jmp .fin2 -.64dot2 - mov ebx,.process64x64sprite - mov [.size2ptr],ebx -.fin2 - ; set pointer adder - xor eax,eax - xor ebx,ebx - mov al,[objhipr] - shl ax,2 - mov ebx,eax - and bx,01FCh - mov dword[addr2add],0 - ; do 1st priority - mov ecx,[objptr] - shl ecx,1 - mov [.objvramloc],ecx - mov ecx,[objptrn] - sub ecx,[objptr] - shl ecx,1 - mov [.objvramloc2],ecx - push ebp - mov ebp,[spritetablea] -.startobject - mov byte[.objleft],128 -.objloop - xor ecx,ecx - mov cx,[oamram+ebx+2] - mov dl,ch - shr dl,4 - and edx,03h - mov [.cpri],dl - ; get object information - push ebx - mov dl,[oamram+ebx+1] ; y - inc dl - ; set up pointer to esi - mov dh,ch - and ch,01h - shr dh,1 - shl ecx,6 - add ecx,[.objvramloc] - test byte[oamram+ebx+3],01h - jz .noloc2 - add ecx,[.objvramloc2] -.noloc2 - and ecx,01FFFFh - add ecx,[vcache4b] - mov esi,ecx - ; get x - mov al,[oamram+ebx] ; x - ; get double bits - mov cl,bl - shr ebx,4 ; /16 - shr cl,1 - and cl,06h - mov ah,[oamram+ebx+512] - shr ah,cl - and ah,03h - mov ch,ah - and ch,01h - mov cl,al - ; process object - ; esi = pointer to 8-bit object, dh = stats (1 shifted to right) - ; cx = x position, dl = y position - cmp cx,384 - jb .noadder - add cx,65535-511 -.noadder - cmp cx,256 - jge .returnfromptr - cmp cx,-64 - jle .returnfromptr - test ah,02h - jz .size1 - jmp dword near [.size2ptr] -.size1 - jmp dword near [.size1ptr] -.returnfromptr - pop ebx - ; next object -.nextobj - add bx,4 - and bx,01FCh - dec byte[.objleft] - jnz near .objloop - pop ebp - ret - -SECTION .bss -.objvramloc resd 1 -.objvramloc2 resd 1 -.curpri resd 1 -.trypri resd 1 -.objleft resd 1 -.prileft resd 1 -.size1ptr resd 1 -.size2ptr resd 1 -.cpri resd 1 -SECTION .text - -.reprocesssprite - cmp cx,-8 - jle near .next - cmp cx,256 - jge .next - add cx,8 -.reprocessspriteb - cmp dl,[resolutn] - jae .overflow - xor ebx,ebx - xor eax,eax - mov bl,dl - cmp bx,[curypos] - jb .overflow - mov al,[sprlefttot+ebx] - cmp al,45 - ja near .overflow - inc byte[sprlefttot+ebx] - mov edi,[.cpri] - mov byte[sprleftpr+ebx*4+edi],1 - shl ebx,9 - shl eax,3 - add ebx,eax - mov [ebp+ebx],cx - mov [ebp+ebx+2],esi - mov al,[.statusbit] - and al,0F8h - or al,[.cpri] - mov [ebp+ebx+6],dh - mov [ebp+ebx+7],al -.overflow - inc dl - add esi,8 - dec byte[.numleft2do] - jnz .reprocessspriteb - sub cx,8 - ret -.next - add dl,8 - add esi,64 - ret - -.reprocessspriteflipy - cmp cx,-8 - jle near .nextb - cmp cx,256 - jge .nextb - add cx,8 -.reprocessspriteflipyb - cmp dl,[resolutn] - jae .overflow2 - xor ebx,ebx - xor eax,eax - mov bl,dl - cmp bx,[curypos] - jb .overflow - mov al,[sprlefttot+ebx] - cmp al,45 - ja near .overflow2 - inc byte[sprlefttot+ebx] - mov edi,[.cpri] - mov byte[sprleftpr+ebx*4+edi],1 - shl ebx,9 - shl eax,3 - add ebx,eax - mov [ebp+ebx],cx - mov [ebp+ebx+2],esi - mov al,[.statusbit] - and al,0F8h - or al,[.cpri] - mov [ebp+ebx+6],dh - mov [ebp+ebx+7],al -.overflow2 - inc dl - sub esi,8 - dec byte[.numleft2do] - jnz .reprocessspriteflipyb - sub cx,8 - ret -.nextb - add dl,8 - sub esi,64 - ret - -section .bss -.statusbit resb 1 -section .text - -.process8x8sprite: - test dh,40h - jnz .8x8flipy - mov [.statusbit],dh - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - call .reprocesssprite - jmp .returnfromptr -.8x8flipy - mov [.statusbit],dh - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add esi,56 - call .reprocessspriteflipy - jmp .returnfromptr - -section .bss -.numleft2do resb 1 -section .text - -.process16x16sprite: - mov [.statusbit],dh - test dh,20h - jnz near .16x16flipx - test dh,40h - jnz .16x16flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - call .reprocesssprite - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - sub cx,8 - add esi,64*14 - mov byte[.numleft2do],8 - call .reprocesssprite - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - jmp .returnfromptr -.16x16flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add dl,8 - add esi,56 - call .reprocessspriteflipy - add esi,128 - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - add esi,128 - sub dl,16 - sub cx,8 - add esi,64*14 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - add esi,128 - sub dl,8 - add cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - jmp .returnfromptr -.16x16flipx - test dh,40h - jnz .16x16flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,8 - call .reprocesssprite - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - add esi,64*14 - add cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocesssprite - jmp .returnfromptr -.16x16flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,8 - add dl,8 - add esi,56 - call .reprocessspriteflipy - add esi,128 - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - add esi,128 - add esi,64*14 - sub dl,16 - add cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - add esi,128 - sub dl,8 - sub cx,8 - mov byte[.numleft2do],8 - call .reprocessspriteflipy - jmp .returnfromptr - -;******************************************************* -; 32x32 sprites routines -;******************************************************* - -.process32x32sprite: - mov [.statusbit],dh - test dh,20h - jnz near .32x32flipx - test dh,40h - jnz near .32x32flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - call .reprocesssprite - nextsprite2right - nextsprite2right - nextsprite2right - nextline32x32 - nextline32x32 - nextline32x32 - jmp .returnfromptr - -.32x32flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add dl,24 - add esi,56 - call .reprocessspriteflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextline32x32flipy - nextline32x32flipy - nextline32x32flipy - jmp .returnfromptr - -.32x32flipx - test dh,40h - jnz near .32x32flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,24 - call .reprocesssprite - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextline32x32flipx - nextline32x32flipx - nextline32x32flipx - jmp .returnfromptr - -.32x32flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,24 - add dl,24 - add esi,56 - call .reprocessspriteflipy - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextline32x32flipyx - nextline32x32flipyx - nextline32x32flipyx - jmp .returnfromptr - -;******************************************************* -; 64x64 sprites routines -;******************************************************* - -.process64x64sprite: - mov [.statusbit],dh - test dh,20h - jnz near .64x64flipx - test dh,40h - jnz near .64x64flipy - mov [.statusbit],dh - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - call .reprocesssprite - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextsprite2right - nextline64x64 - nextline64x64 - nextline64x64 - nextline64x64 - nextline64x64 - nextline64x64 - nextline64x64 - jmp .returnfromptr - -.64x64flipy - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add dl,56 - add esi,56 - call .reprocessspriteflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextsprite2rightflipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - nextline64x64flipy - jmp .returnfromptr - -.64x64flipx - test dh,40h - jnz near .64x64flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,56 - call .reprocesssprite - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextsprite2rightflipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - nextline64x64flipx - jmp .returnfromptr - -.64x64flipyx - and dh,07h - mov byte[.numleft2do],8 - shl dh,4 - add dh,128 - add cx,56 - add dl,56 - add esi,56 - call .reprocessspriteflipy - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextsprite2rightflipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - nextline64x64flipyx - jmp .returnfromptr - -;******************************************************* -; Cache Process Macros, info from Nerlaska! -;******************************************************* - -%macro processcache2b 1 - xor al,al - add ch,ch - adc al,al - add cl,cl - adc al,al - mov [edi+%1],al -%endmacro - -%macro processcache4b 1 - xor al,al - add dh,dh - adc al,al - add dl,dl - adc al,al - add ch,ch - adc al,al - add cl,cl - adc al,al - mov [edi+%1],al -%endmacro - -;******************************************************* -; Cache Sprites -;******************************************************* -; Use oamram for object table, copy from vram -> vcache4b -; 16x16 sprite, to move = 2, to add = 14, 32x32 = 4,12, 64x64 = 8,8 - -%macro processcache4bs 1 - xor al,al - add dh,dh - adc al,al - add dl,dl - adc al,al - add ch,ch - adc al,al - add cl,cl - adc al,al - mov [edi+%1],al - or al,al - jz %%zeroed - and byte[tiletypec],1 - jmp %%nozeroed -%%zeroed - and byte[tiletypec],2 -%%nozeroed -%endmacro - -NEWSYM cachesprites - ; initialize obj size cache - mov dword[.objptr],oamram - add dword[.objptr],512 - mov esi,[.objptr] - mov al,[esi] - mov [.curobjtype],al - mov byte[.objleftinbyte],4 - ; Initialize oamram pointer - mov esi,oamram - add esi,2 - - ; process pointers (.objptra = source, .objptrb = dest) -.trynextgroup - xor ebx,ebx - mov bx,[objptr] - mov ecx,ebx - shr ecx,4 - mov [.nbg],cx - mov edi,[vram] - add edi,ebx - mov [.objptra],edi - shl ebx,1 - add ebx,[vcache4b] - mov [.objptrb],ebx - - xor ebx,ebx - mov bx,[objptrn] - mov ecx,ebx - shr ecx,4 - mov [.nbg2],cx - mov edi,[vram] - add edi,ebx - mov [.objptra2],edi - shl ebx,1 - add ebx,[vcache4b] - mov [.objptrb2],ebx - - xor ebx,ebx - - ; process objects - mov dword[.sprnum],3 - mov byte[.objleft],128 -.nextobj - ; process sprite sizes - test byte[.curobjtype],02h - jz .dosprsize1 - mov al,[objsize2] - mov [.num2do],al - mov ax,[objadds2] - mov [.byte2add],ax - mov al,[objmovs2] - mov [.byte2move],al - mov [.byteb4add],al - jmp .exitsprsize -.dosprsize1 - mov al,[objsize1] - mov [.num2do],al - mov ax,[objadds1] - mov [.byte2add],ax - mov al,[objmovs1] - mov [.byte2move],al - mov [.byteb4add],al -.exitsprsize - shr byte[.curobjtype],2 - dec byte[.objleftinbyte] - jnz .skipobjproc - mov byte[.objleftinbyte],4 - inc dword[.objptr] - mov ebx,[.objptr] - mov al,[ebx] - mov [.curobjtype],al -.skipobjproc - mov bx,[esi] - and bh,1h - mov [.curobj],bx -.nextobject - mov ebx,[.sprnum] - mov cl,[oamram+ebx-2] - mov ch,[curypos] - dec ch - cmp cl,ch - jb near .nocache - test byte[oamram+ebx],01h - jnz .namebase - xor ebx,ebx - mov bx,[.curobj] - mov cx,bx - add bx,bx - add bx,[.nbg] - and bx,4095 - test word[vidmemch4+ebx],0101h - jz near .nocache - mov word[vidmemch4+ebx],0000h - mov [.sprfillpl],ebx - push esi - shl bx,4 - mov esi,[vram] - add esi,ebx - add ebx,ebx - mov edi,[vcache4b] - add edi,ebx - jmp .nonamebase -.namebase - xor ebx,ebx - mov bx,[.curobj] - mov cx,bx - shl bx,1 - add bx,[.nbg2] - and bx,4095 - test word[vidmemch4+ebx],0101h - jz near .nocache - mov word[vidmemch4+ebx],0000h - mov [.sprfillpl],ebx - push esi - shl bx,4 - mov esi,[vram] - add esi,ebx - add ebx,ebx - mov edi,[vcache4b] - add edi,ebx -.nonamebase - ; convert from [esi] to [edi] - mov byte[.rowleft],8 - mov byte[tiletypec],3 -.donext - - mov cx,[esi] - mov dx,[esi+16] - - processcache4bs 0 - processcache4bs 1 - processcache4bs 2 - processcache4bs 3 - processcache4bs 4 - processcache4bs 5 - processcache4bs 6 - processcache4bs 7 - - add edi,8 - add esi,2 - dec byte[.rowleft] - jnz near .donext - mov ebx,[.sprfillpl] - mov al,[tiletypec] - shr ebx,1 - pop esi - mov [tltype4b+ebx],al -.nocache - inc word[.curobj] - dec byte[.byteb4add] - jnz .skipbyteadd - mov ax,[.byte2add] - add word[.curobj],ax - mov al,[.byte2move] - mov [.byteb4add],al -.skipbyteadd - dec byte[.num2do] - jnz near .nextobject - add esi,4 - add dword[.sprnum],4 - dec byte[.objleft] - jnz near .nextobj - ret - -SECTION .data -.num2do dd 1 -.byteb4add dd 2 - -SECTION .bss -.objptra resd 1 -.objptrb resd 1 -.nbg resd 1 -.objptra2 resd 1 -.objptrb2 resd 1 -.nbg2 resd 1 -.objleft resb 1 -.rowleft resb 1 -.a resd 1 -.objptr resd 1 -.objleftinbyte resd 1 -.curobjtype resd 1 -.curobj resd 1 -.byte2move resd 1 -.byte2add resd 1 -.sprnum resd 1 -.sprcheck resd 1 -.sprfillpl resd 1 - -section .text - -;******************************************************* -; Cache 2-Bit -;******************************************************* -NEWSYM cachetile2b - ; Keep high word ecx 0 - push eax - xor ecx,ecx - push edx - mov byte[.nextar],1 - push ebx - ; get tile info location - test al,20h - jnz .highptr - shl eax,6 ; x 64 for each line - add ax,[bgptr] - jmp .loptr -.highptr - and al,1Fh - shl eax,6 ; x 64 for each line - add ax,[bgptrc] -.loptr - add eax,[vram] - mov bx,[curtileptr] - shr bx,4 - mov byte[.count],32 - mov [.nbg],bx - ; do loop -.cacheloop - mov si,[eax] - and esi,03FFh - add si,[.nbg] - and esi,4095 - test byte[vidmemch2+esi],01h - jz near .nocache - mov byte[vidmemch2+esi],00h - mov edi,esi - shl esi,4 - shl edi,6 - add esi,[vram] - add edi,[vcache2b] - push eax - mov byte[.rowleft],8 -.donext - mov cx,[esi] - processcache2b 0 - processcache2b 1 - processcache2b 2 - processcache2b 3 - processcache2b 4 - processcache2b 5 - processcache2b 6 - processcache2b 7 - add edi,8 - add esi,2 - dec byte[.rowleft] - jnz near .donext - pop eax -.nocache - add eax,2 - dec byte[.count] - jnz near .cacheloop - - cmp byte[.nextar],0 - je .skipall - mov bx,[bgptrc] - cmp [bgptrd],bx - je .skipall - add eax,2048-64 - mov byte[.count],32 - mov byte[.nextar],0 - jmp .cacheloop -.skipall - pop ebx - pop edx - pop eax - ret - -section .bss - -.nbg resw 1 -.count resb 1 -.a resb 1 -.rowleft resb 1 -.nextar resb 1 - -section .text - -NEWSYM cache2bit - ret - -;******************************************************* -; Cache 4-Bit -;******************************************************* - -; esi = pointer to tile location vram -; edi = pointer to graphics data (cache & non-cache) -; ebx = external pointer -; tile value : bit 15 = flipy, bit 14 = flipx, bit 10-12 = palette, 0-9=tile# - -NEWSYM cachetile4b - ; Keep high word ecx 0 - push eax - xor ecx,ecx - push edx - mov byte[.nextar],1 - push ebx - ; get tile info location - test al,20h - jnz .highptr - shl eax,6 ; x 64 for each line - add ax,[bgptr] - jmp .loptr -.highptr - and al,1Fh - shl eax,6 ; x 64 for each line - add ax,[bgptrc] -.loptr - add eax,[vram] - mov bx,[curtileptr] - shr bx,5 - mov byte[.count],32 - mov [.nbg],bx - - ; do loop -.cacheloop - mov si,[eax] - and esi,03FFh - add si,[.nbg] - shl esi,1 - and esi,4095 - test word[vidmemch4+esi],0101h - jz near .nocache - mov word[vidmemch4+esi],0000h - mov edi,esi - shl esi,4 - shl edi,5 - add esi,[vram] - add edi,[vcache4b] - push eax - mov byte[.rowleft],8 -.donext - - mov cx,[esi] - mov dx,[esi+16] - processcache4b 0 - processcache4b 1 - processcache4b 2 - processcache4b 3 - processcache4b 4 - processcache4b 5 - processcache4b 6 - processcache4b 7 - - add edi,8 - add esi,2 - dec byte[.rowleft] - jnz near .donext - pop eax -.nocache - add eax,2 - dec byte[.count] - jnz near .cacheloop - - cmp byte[.nextar],0 - je .skipall - mov bx,[bgptrc] - cmp [bgptrd],bx - je .skipall - add eax,2048-64 - mov byte[.count],32 - mov byte[.nextar],0 - jmp .cacheloop -.skipall - pop ebx - pop edx - pop eax - ret - -section .bss - -.nbg resw 1 -.count resb 1 -.rowleft resb 1 -.nextar resb 1 - -section .text - -NEWSYM cache4bit - ret -;******************************************************* -; Cache 8-Bit -;******************************************************* -; tile value : bit 15 = flipy, bit 14 = flipx, bit 10-12 = palette, 0-9=tile# -NEWSYM cachetile8b - ; Keep high word ecx 0 - push eax - xor ecx,ecx - push edx - mov byte[.nextar],1 - push ebx - ; get tile info location - test al,20h - jnz .highptr - shl eax,6 ; x 64 for each line - add ax,[bgptr] - jmp .loptr -.highptr - and al,1Fh - shl eax,6 ; x 64 for each line - add ax,[bgptrc] -.loptr - add eax,[vram] - mov bx,[curtileptr] - shr bx,6 - mov byte[.count],32 - mov [.nbg],bx - - ; do loop -.cacheloop - mov si,[eax] - and esi,03FFh - add si,[.nbg] - shl esi,2 - and esi,4095 - test dword[vidmemch8+esi],01010101h - jz near .nocache - mov dword[vidmemch8+esi],00000000h - mov edi,esi - shl esi,4 - shl edi,4 - add esi,[vram] - add edi,[vcache8b] - push eax - mov byte[.rowleft],8 -.donext - xor ah,ah - xor ebx,ebx - xor ecx,ecx - xor edx,edx - mov byte[.a],0 - - mov al,[esi] ; bitplane 0 - cmp al,0 - je .skipconva - test al,01h - jz .skipa0 - or ah,01h -.skipa0 - test al,02h - jz .skipa1 - or bl,01h -.skipa1 - test al,04h - jz .skipa2 - or bh,01h -.skipa2 - test al,08h - jz .skipa3 - or cl,01h -.skipa3 - test al,10h - jz .skipa4 - or ch,01h -.skipa4 - test al,20h - jz .skipa5 - or dl,01h -.skipa5 - test al,40h - jz .skipa6 - or dh,01h -.skipa6 - test al,80h - jz .skipa7 - or byte[.a],01h -.skipa7 -.skipconva - - mov al,[esi+1] ; bitplane 1 - cmp al,0 - je .skipconvb - test al,01h - jz .skipb0 - or ah,02h -.skipb0 - test al,02h - jz .skipb1 - or bl,02h -.skipb1 - test al,04h - jz .skipb2 - or bh,02h -.skipb2 - test al,08h - jz .skipb3 - or cl,02h -.skipb3 - test al,10h - jz .skipb4 - or ch,02h -.skipb4 - test al,20h - jz .skipb5 - or dl,02h -.skipb5 - test al,40h - jz .skipb6 - or dh,02h -.skipb6 - test al,80h - jz .skipb7 - or byte[.a],02h -.skipb7 -.skipconvb - - mov al,[esi+16] ; bitplane 2 - cmp al,0 - je .skipconvc - test al,01h - jz .skipc0 - or ah,04h -.skipc0 - test al,02h - jz .skipc1 - or bl,04h -.skipc1 - test al,04h - jz .skipc2 - or bh,04h -.skipc2 - test al,08h - jz .skipc3 - or cl,04h -.skipc3 - test al,10h - jz .skipc4 - or ch,04h -.skipc4 - test al,20h - jz .skipc5 - or dl,04h -.skipc5 - test al,40h - jz .skipc6 - or dh,04h -.skipc6 - test al,80h - jz .skipc7 - or byte[.a],04h -.skipc7 -.skipconvc - - mov al,[esi+17] ; bitplane 3 - cmp al,0 - je .skipconvd - test al,01h - jz .skipd0 - or ah,08h -.skipd0 - test al,02h - jz .skipd1 - or bl,08h -.skipd1 - test al,04h - jz .skipd2 - or bh,08h -.skipd2 - test al,08h - jz .skipd3 - or cl,08h -.skipd3 - test al,10h - jz .skipd4 - or ch,08h -.skipd4 - test al,20h - jz .skipd5 - or dl,08h -.skipd5 - test al,40h - jz .skipd6 - or dh,08h -.skipd6 - test al,80h - jz .skipd7 - or byte[.a],08h -.skipd7 -.skipconvd - - mov al,[esi+32] ; bitplane 4 - cmp al,0 - je .skipconve - test al,01h - jz .skipe0 - or ah,10h -.skipe0 - test al,02h - jz .skipe1 - or bl,10h -.skipe1 - test al,04h - jz .skipe2 - or bh,10h -.skipe2 - test al,08h - jz .skipe3 - or cl,10h -.skipe3 - test al,10h - jz .skipe4 - or ch,10h -.skipe4 - test al,20h - jz .skipe5 - or dl,10h -.skipe5 - test al,40h - jz .skipe6 - or dh,10h -.skipe6 - test al,80h - jz .skipe7 - or byte[.a],10h -.skipe7 -.skipconve - - mov al,[esi+33] ; bitplane 5 - cmp al,0 - je .skipconvf - test al,01h - jz .skipf0 - or ah,20h -.skipf0 - test al,02h - jz .skipf1 - or bl,20h -.skipf1 - test al,04h - jz .skipf2 - or bh,20h -.skipf2 - test al,08h - jz .skipf3 - or cl,20h -.skipf3 - test al,10h - jz .skipf4 - or ch,20h -.skipf4 - test al,20h - jz .skipf5 - or dl,20h -.skipf5 - test al,40h - jz .skipf6 - or dh,20h -.skipf6 - test al,80h - jz .skipf7 - or byte[.a],20h -.skipf7 -.skipconvf - - mov al,[esi+48] ; bitplane 6 - cmp al,0 - je .skipconvg - test al,01h - jz .skipg0 - or ah,40h -.skipg0 - test al,02h - jz .skipg1 - or bl,40h -.skipg1 - test al,04h - jz .skipg2 - or bh,40h -.skipg2 - test al,08h - jz .skipg3 - or cl,40h -.skipg3 - test al,10h - jz .skipg4 - or ch,40h -.skipg4 - test al,20h - jz .skipg5 - or dl,40h -.skipg5 - test al,40h - jz .skipg6 - or dh,40h -.skipg6 - test al,80h - jz .skipg7 - or byte[.a],40h -.skipg7 -.skipconvg - - mov al,[esi+49] ; bitplane 7 - cmp al,0 - je .skipconvh - test al,01h - jz .skiph0 - or ah,80h -.skiph0 - test al,02h - jz .skiph1 - or bl,80h -.skiph1 - test al,04h - jz .skiph2 - or bh,80h -.skiph2 - test al,08h - jz .skiph3 - or cl,80h -.skiph3 - test al,10h - jz .skiph4 - or ch,80h -.skiph4 - test al,20h - jz .skiph5 - or dl,80h -.skiph5 - test al,40h - jz .skiph6 - or dh,80h -.skiph6 - test al,80h - jz .skiph7 - or byte[.a],80h -.skiph7 -.skipconvh - - ; move all bytes into [edi] - mov [edi+7],ah - mov [edi+6],bl - mov [edi+5],bh - mov [edi+4],cl - mov [edi+3],ch - mov [edi+2],dl - mov [edi+1],dh - mov al,[.a] - mov [edi],al - add edi,8 - add esi,2 - dec byte[.rowleft] - jnz near .donext - pop eax -.nocache - add eax,2 - dec byte[.count] - jnz near .cacheloop - - cmp byte[.nextar],0 - je .skipall - mov bx,[bgptrc] - cmp [bgptrd],bx - je .skipall - add eax,2048-64 - mov byte[.count],32 - mov byte[.nextar],0 - jmp .cacheloop -.skipall - pop ebx - pop edx - pop eax - ret - -section .bss - -.nbg resw 1 -.count resb 1 -.a resb 1 -.rowleft resb 1 -.nextar resb 1 - -section .text - -NEWSYM cache8bit - ret - -;******************************************************* -; Cache 2-Bit 16x16 tiles -;******************************************************* - -NEWSYM cachetile2b16x16 - ; Keep high word ecx 0 - push eax - xor ecx,ecx - push edx - mov byte[.nextar],1 - push ebx - ; get tile info location - test al,20h - jnz .highptr - shl eax,6 ; x 64 for each line - add ax,[bgptr] - jmp .loptr -.highptr - and al,1Fh - shl eax,6 ; x 64 for each line - add ax,[bgptrc] -.loptr - add eax,[vram] - mov bx,[curtileptr] - shr bx,4 - mov byte[.count],32 - mov [.nbg],bx - ; do loop -.cacheloop - mov si,[eax] - and esi,03FFh - add si,[.nbg] - mov byte[.tileleft],4 -.nextof4 - and esi,4095 - test byte[vidmemch2+esi],01h - jz near .nocache - mov byte[vidmemch2+esi],00h - push esi - mov edi,esi - shl esi,4 - shl edi,6 - add esi,[vram] - add edi,[vcache2b] - push eax - mov byte[.rowleft],8 -.donext - mov cx,[esi] - processcache2b 0 - processcache2b 1 - processcache2b 2 - processcache2b 3 - processcache2b 4 - processcache2b 5 - processcache2b 6 - processcache2b 7 - add edi,8 - add esi,2 - dec byte[.rowleft] - jnz near .donext - pop eax - pop esi -.nocache - inc esi - cmp byte[.tileleft],3 - jne .noadd - add esi,14 -.noadd - dec byte[.tileleft] - jnz near .nextof4 - add eax,2 - dec byte[.count] - jnz near .cacheloop - - cmp byte[.nextar],0 - je .skipall - mov bx,[bgptrc] - cmp [bgptrd],bx - je .skipall - add eax,2048-64 - mov byte[.count],32 - mov byte[.nextar],0 - jmp .cacheloop -.skipall - pop ebx - pop edx - pop eax - ret - -section .bss - -.nbg resw 1 -.count resb 1 -.a resb 1 -.rowleft resb 1 -.nextar resb 1 -.tileleft resb 1 - -section .text - -NEWSYM cache2bit16x16 - ret - -;******************************************************* -; Cache 4-Bit 16x16 tiles -;******************************************************* - -NEWSYM cachetile4b16x16 - ; Keep high word ecx 0 - push eax - xor ecx,ecx - push edx - mov byte[.nextar],1 - push ebx - ; get tile info location - test al,20h - jnz .highptr - shl eax,6 ; x 64 for each line - add ax,[bgptr] - jmp .loptr -.highptr - and al,1Fh - shl eax,6 ; x 64 for each line - add ax,[bgptrc] -.loptr - add eax,[vram] - mov bx,[curtileptr] - shr bx,5 - mov byte[.count],32 - mov [.nbg],bx - - ; do loop -.cacheloop - mov si,[eax] - and esi,03FFh - add si,[.nbg] - shl esi,1 - mov byte[.tileleft],4 -.nextof4 - and esi,4095 - test word[vidmemch4+esi],0101h - jz near .nocache - mov word[vidmemch4+esi],0000h - push esi - mov edi,esi - shl esi,4 - shl edi,5 - add esi,[vram] - add edi,[vcache4b] - push eax - mov byte[.rowleft],8 -.donext - mov cx,[esi] - mov dx,[esi+16] - - processcache4b 0 - processcache4b 1 - processcache4b 2 - processcache4b 3 - processcache4b 4 - processcache4b 5 - processcache4b 6 - processcache4b 7 - - add edi,8 - add esi,2 - dec byte[.rowleft] - jnz near .donext - pop eax - pop esi -.nocache - add esi,2 - cmp byte[.tileleft],3 - jne .noadd - add esi,28 -.noadd - dec byte[.tileleft] - jnz near .nextof4 - add eax,2 - dec byte[.count] - jnz near .cacheloop - - cmp byte[.nextar],0 - je .skipall - mov bx,[bgptrc] - cmp [bgptrd],bx - je .skipall - add eax,2048-64 - mov byte[.count],32 - mov byte[.nextar],0 - jmp .cacheloop -.skipall - pop ebx - pop edx - pop eax - ret - -section .bss - -.nbg resw 1 -.count resb 1 -.rowleft resb 1 -.nextar resb 1 -.tileleft resb 1 - -section .text - -NEWSYM cache4bit16x16 - ret - -;******************************************************* -; Cache 8-Bit 16x16 tiles -;******************************************************* - -NEWSYM cachetile8b16x16 - ; Keep high word ecx 0 - push eax - xor ecx,ecx - push edx - mov byte[.nextar],1 - push ebx - ; get tile info location - test al,20h - jnz .highptr - shl eax,6 ; x 64 for each line - add ax,[bgptr] - jmp .loptr -.highptr - and al,1Fh - shl eax,6 ; x 64 for each line - add ax,[bgptrc] -.loptr - add eax,[vram] - mov bx,[curtileptr] - shr bx,6 - mov byte[.count],32 - mov [.nbg],bx - - ; do loop -.cacheloop - mov si,[eax] - and esi,03FFh - add si,[.nbg] - shl esi,2 - mov byte[.tileleft],4 -.nextof4 - and esi,4095 - test dword[vidmemch8+esi],01010101h - jz near .nocache - mov dword[vidmemch8+esi],00000000h - push esi - mov edi,esi - shl esi,4 - shl edi,4 - add esi,[vram] - add edi,[vcache8b] - push eax - mov byte[.rowleft],8 -.donext - xor ah,ah - xor ebx,ebx - xor ecx,ecx - xor edx,edx - mov byte[.a],0 - - mov al,[esi] ; bitplane 0 - cmp al,0 - je .skipconva - test al,01h - jz .skipa0 - or ah,01h -.skipa0 - test al,02h - jz .skipa1 - or bl,01h -.skipa1 - test al,04h - jz .skipa2 - or bh,01h -.skipa2 - test al,08h - jz .skipa3 - or cl,01h -.skipa3 - test al,10h - jz .skipa4 - or ch,01h -.skipa4 - test al,20h - jz .skipa5 - or dl,01h -.skipa5 - test al,40h - jz .skipa6 - or dh,01h -.skipa6 - test al,80h - jz .skipa7 - or byte[.a],01h -.skipa7 -.skipconva - - mov al,[esi+1] ; bitplane 1 - cmp al,0 - je .skipconvb - test al,01h - jz .skipb0 - or ah,02h -.skipb0 - test al,02h - jz .skipb1 - or bl,02h -.skipb1 - test al,04h - jz .skipb2 - or bh,02h -.skipb2 - test al,08h - jz .skipb3 - or cl,02h -.skipb3 - test al,10h - jz .skipb4 - or ch,02h -.skipb4 - test al,20h - jz .skipb5 - or dl,02h -.skipb5 - test al,40h - jz .skipb6 - or dh,02h -.skipb6 - test al,80h - jz .skipb7 - or byte[.a],02h -.skipb7 -.skipconvb - - mov al,[esi+16] ; bitplane 2 - cmp al,0 - je .skipconvc - test al,01h - jz .skipc0 - or ah,04h -.skipc0 - test al,02h - jz .skipc1 - or bl,04h -.skipc1 - test al,04h - jz .skipc2 - or bh,04h -.skipc2 - test al,08h - jz .skipc3 - or cl,04h -.skipc3 - test al,10h - jz .skipc4 - or ch,04h -.skipc4 - test al,20h - jz .skipc5 - or dl,04h -.skipc5 - test al,40h - jz .skipc6 - or dh,04h -.skipc6 - test al,80h - jz .skipc7 - or byte[.a],04h -.skipc7 -.skipconvc - - mov al,[esi+17] ; bitplane 3 - cmp al,0 - je .skipconvd - test al,01h - jz .skipd0 - or ah,08h -.skipd0 - test al,02h - jz .skipd1 - or bl,08h -.skipd1 - test al,04h - jz .skipd2 - or bh,08h -.skipd2 - test al,08h - jz .skipd3 - or cl,08h -.skipd3 - test al,10h - jz .skipd4 - or ch,08h -.skipd4 - test al,20h - jz .skipd5 - or dl,08h -.skipd5 - test al,40h - jz .skipd6 - or dh,08h -.skipd6 - test al,80h - jz .skipd7 - or byte[.a],08h -.skipd7 -.skipconvd - - mov al,[esi+32] ; bitplane 4 - cmp al,0 - je .skipconve - test al,01h - jz .skipe0 - or ah,10h -.skipe0 - test al,02h - jz .skipe1 - or bl,10h -.skipe1 - test al,04h - jz .skipe2 - or bh,10h -.skipe2 - test al,08h - jz .skipe3 - or cl,10h -.skipe3 - test al,10h - jz .skipe4 - or ch,10h -.skipe4 - test al,20h - jz .skipe5 - or dl,10h -.skipe5 - test al,40h - jz .skipe6 - or dh,10h -.skipe6 - test al,80h - jz .skipe7 - or byte[.a],10h -.skipe7 -.skipconve - - mov al,[esi+33] ; bitplane 5 - cmp al,0 - je .skipconvf - test al,01h - jz .skipf0 - or ah,20h -.skipf0 - test al,02h - jz .skipf1 - or bl,20h -.skipf1 - test al,04h - jz .skipf2 - or bh,20h -.skipf2 - test al,08h - jz .skipf3 - or cl,20h -.skipf3 - test al,10h - jz .skipf4 - or ch,20h -.skipf4 - test al,20h - jz .skipf5 - or dl,20h -.skipf5 - test al,40h - jz .skipf6 - or dh,20h -.skipf6 - test al,80h - jz .skipf7 - or byte[.a],20h -.skipf7 -.skipconvf - - mov al,[esi+48] ; bitplane 6 - cmp al,0 - je .skipconvg - test al,01h - jz .skipg0 - or ah,40h -.skipg0 - test al,02h - jz .skipg1 - or bl,40h -.skipg1 - test al,04h - jz .skipg2 - or bh,40h -.skipg2 - test al,08h - jz .skipg3 - or cl,40h -.skipg3 - test al,10h - jz .skipg4 - or ch,40h -.skipg4 - test al,20h - jz .skipg5 - or dl,40h -.skipg5 - test al,40h - jz .skipg6 - or dh,40h -.skipg6 - test al,80h - jz .skipg7 - or byte[.a],40h -.skipg7 -.skipconvg - - mov al,[esi+49] ; bitplane 7 - cmp al,0 - je .skipconvh - test al,01h - jz .skiph0 - or ah,80h -.skiph0 - test al,02h - jz .skiph1 - or bl,80h -.skiph1 - test al,04h - jz .skiph2 - or bh,80h -.skiph2 - test al,08h - jz .skiph3 - or cl,80h -.skiph3 - test al,10h - jz .skiph4 - or ch,80h -.skiph4 - test al,20h - jz .skiph5 - or dl,80h -.skiph5 - test al,40h - jz .skiph6 - or dh,80h -.skiph6 - test al,80h - jz .skiph7 - or byte[.a],80h -.skiph7 -.skipconvh - - ; move all bytes into [edi] - mov [edi+7],ah - mov [edi+6],bl - mov [edi+5],bh - mov [edi+4],cl - mov [edi+3],ch - mov [edi+2],dl - mov [edi+1],dh - mov al,[.a] - mov [edi],al - add edi,8 - add esi,2 - dec byte[.rowleft] - jnz near .donext - pop eax - pop esi -.nocache - add esi,4 - cmp byte[.tileleft],3 - jne .noadd - add esi,56 -.noadd - dec byte[.tileleft] - jnz near .nextof4 - add eax,2 - dec byte[.count] - jnz near .cacheloop - - cmp byte[.nextar],0 - je .skipall - mov bx,[bgptrc] - cmp [bgptrd],bx - je .skipall - add eax,2048-64 - mov byte[.count],32 - mov byte[.nextar],0 - jmp .cacheloop -.skipall - pop ebx - pop edx - pop eax - ret - -section .bss - -.nbg resw 1 -.count resb 1 -.a resb 1 -.rowleft resb 1 -.nextar resb 1 -.tileleft resb 1 - -section .text - -NEWSYM cache8bit16x16 - ret - -NEWSYM cachesingle - cmp byte[offsetmshl],1 - je near cachesingle4b - cmp byte[offsetmshl],2 - je near cachesingle2b - ret - -%macro processcache4b2 1 - xor al,al - add dh,dh - adc al,al - add dl,dl - adc al,al - add ch,ch - adc al,al - add cl,cl - adc al,al - mov [edi+%1],al -%endmacro - -NEWSYM cachesingle4b - mov word[ebx],0 - sub ebx,vidmemch4 - push edi - mov edi,ebx - shl edi,5 ; cached ram - shl ebx,4 ; vram - add edi,[vcache4b] - add ebx,[vram] - push eax - push edx - mov byte[scacheloop],8 -.nextline - mov cx,[ebx] - mov dx,[ebx+16] - processcache4b2 0 - processcache4b2 1 - processcache4b2 2 - processcache4b2 3 - processcache4b2 4 - processcache4b2 5 - processcache4b2 6 - processcache4b2 7 - add ebx,2 - add edi,8 - dec byte[scacheloop] - jnz near .nextline - pop edx - pop eax - pop edi - ret - -NEWSYM cachesingle2b - ret - -section .bss - -NEWSYM scacheloop, resb 1 -NEWSYM tiletypec, resb 1 - -section .text - -%macro processcache4b3 1 - xor al,al - add dh,dh - adc al,al - add dl,dl - adc al,al - add bh,bh - adc al,al - add bl,bl - adc al,al - mov [edi+%1],al - or al,al - jz %%zeroed - and byte[tiletypec],1 - jmp %%nozeroed -%%zeroed - and byte[tiletypec],2 -%%nozeroed -%endmacro - -NEWSYM cachesingle4bng - mov word[vidmemch4+ecx*2],0 - mov byte[tiletypec],3 - push edi - push eax - push ecx - push ebx - push edx - mov edi,ecx - shl edi,6 ; cached ram - shl ecx,5 ; vram - add edi,[vcache4b] - add ecx,[vram] - mov byte[scacheloop],8 -.nextline - mov bx,[ecx] - mov dx,[ecx+16] - processcache4b3 0 - processcache4b3 1 - processcache4b3 2 - processcache4b3 3 - processcache4b3 4 - processcache4b3 5 - processcache4b3 6 - processcache4b3 7 - add ecx,2 - add edi,8 - dec byte[scacheloop] - jnz near .nextline - pop edx - pop ebx - pop ecx - mov al,[tiletypec] - mov [tltype4b+ecx],al - pop eax - pop edi - ret - -%macro processcache2b3 1 - xor al,al - add bh,bh - adc al,al - add bl,bl - adc al,al - mov [edi+%1],al - or al,al - jz %%zeroed - and byte[tiletypec],1 - jmp %%nozeroed -%%zeroed - and byte[tiletypec],2 -%%nozeroed -%endmacro - -NEWSYM cachesingle2bng - mov byte[vidmemch2+ecx],0 - mov byte[tiletypec],3 - push edi - push eax - push ecx - push ebx - push edx - mov edi,ecx - shl edi,6 ; cached ram - shl ecx,4 ; vram - add edi,[vcache2b] - add ecx,[vram] - mov byte[scacheloop],8 -.nextline - mov bx,[ecx] - processcache2b3 0 - processcache2b3 1 - processcache2b3 2 - processcache2b3 3 - processcache2b3 4 - processcache2b3 5 - processcache2b3 6 - processcache2b3 7 - add ecx,2 - add edi,8 - dec byte[scacheloop] - jnz near .nextline - pop edx - pop ebx - pop ecx - mov al,[tiletypec] - mov [tltype2b+ecx],al - pop eax - pop edi - ret - -%macro processcache8b3 1 - xor esi,esi - add ch,ch - adc esi,esi - add cl,cl - adc esi,esi - add dh,dh - adc esi,esi - add dl,dl - adc esi,esi - add ah,ah - adc esi,esi - add al,al - adc esi,esi - add bh,bh - adc esi,esi - add bl,bl - adc esi,esi - push eax - mov eax,esi - mov [edi+%1],al - or al,al - jz %%zeroed - and byte[tiletypec],1 - jmp %%nozeroed -%%zeroed - and byte[tiletypec],2 -%%nozeroed - pop eax -%endmacro - -NEWSYM cachesingle8bng - mov dword[vidmemch8+ecx*4],0 - mov byte[tiletypec],3 - push esi - push edi - push eax - push ecx - push ebx - push edx - mov edi,ecx - shl edi,6 ; cached ram - shl ecx,6 ; vram - add edi,[vcache8b] - add ecx,[vram] - mov byte[scacheloop],8 -.nextline - mov bx,[ecx] - mov ax,[ecx+16] - mov dx,[ecx+32] - push ecx - mov cx,[ecx+48] - processcache8b3 0 - processcache8b3 1 - processcache8b3 2 - processcache8b3 3 - processcache8b3 4 - processcache8b3 5 - processcache8b3 6 - processcache8b3 7 - pop ecx - add ecx,2 - add edi,8 - dec byte[scacheloop] - jnz near .nextline - pop edx - pop ebx - pop ecx - mov al,[tiletypec] - mov [tltype8b+ecx],al - pop eax - pop edi - pop esi - ret - -SECTION .bss -NEWSYM dcolortab, resd 256 - -SECTION .data -NEWSYM ExitFromGUI, db 0 -NEWSYM videotroub, dd 0 -NEWSYM TripBufAvail, db 0 -NEWSYM vesa2_clbit, dd 0 ; clear all bit 0's if AND is used -NEWSYM vesa2_rpos, dd 0 ; Red bit position -NEWSYM vesa2_gpos, dd 0 ; Green bit position -NEWSYM vesa2_bpos, dd 0 ; Blue bit position -NEWSYM vesa2_clbitng, dd 0 ; clear all bit 0's if AND is used -NEWSYM vesa2_clbitng2, dd 0,0 ; clear all bit 0's if AND is used -NEWSYM vesa2_clbitng3, dd 0 ; clear all bit 0's if AND is used -NEWSYM vesa2red10, dd 0 ; red position at bit 10 -NEWSYM vesa2_rtrcl, dd 0 ; red transparency clear (bit+4) -NEWSYM vesa2_rtrcla, dd 0 ; red transparency (AND) clear (not(bit+4)) -NEWSYM vesa2_rfull, dd 0 ; red max (or bit*1Fh) -NEWSYM vesa2_gtrcl, dd 0 ; red transparency clear (bit+4) -NEWSYM vesa2_gtrcla, dd 0 ; red transparency (AND) clear (not(bit+4)) -NEWSYM vesa2_gfull, dd 0 ; red max (or bit*1Fh) -NEWSYM vesa2_btrcl, dd 0 ; red transparency clear (bit+4) -NEWSYM vesa2_btrcla, dd 0 ; red transparency (AND) clear (not(bit+4)) -NEWSYM vesa2_bfull, dd 0 ; red max (or bit*1Fh) -NEWSYM vesa2_x, dd 320 ; Desired screen width -NEWSYM vesa2_y, dd 240 ; Height -NEWSYM vesa2_bits, dd 8 ; Bits per pixel -NEWSYM vesa2_rposng, dd 0 ; Red bit position -NEWSYM vesa2_gposng, dd 0 ; Green bit position -NEWSYM vesa2_bposng, dd 0 ; Blue bit position -NEWSYM vesa2_usbit, dd 0 ; Unused bit in proper bit location -NEWSYM ErrorPointer, dd 0 - -SECTION .text -NEWSYM genfulladdtab - ; Write to buffer - cmp byte[newengen],1 - jne .notneweng - cmp byte[vesa2red10],0 - jne near genfulladdtabred -.notneweng - xor ecx,ecx -.loopers - mov ax,cx - test [vesa2_rtrcl],cx - jz .nor - and ax,[vesa2_rtrcla] - or ax,[vesa2_rfull] -.nor - test [vesa2_gtrcl],cx - jz .nog - and ax,[vesa2_gtrcla] - or ax,[vesa2_gfull] -.nog - test [vesa2_btrcl],cx - jz .nob - and ax,[vesa2_btrcla] - or ax,[vesa2_bfull] -.nob - shl ax,1 - mov [fulladdtab+ecx*2],ax - dec cx - jnz .loopers - ret - -NEWSYM genfulladdtabred -NEWSYM genfulladdtabng - ; Write to buffer - xor ecx,ecx -.loopers - mov ax,cx - test cx,0100000000000000b - jz .nor - and ax,1011111111111111b - or ax, 0011110000000000b -.nor - test cx,0000001000000000b - jz .nog - and ax,1111110111111111b - or ax, 0000000111100000b -.nog - test cx,0000000000010000b - jz .nob - and ax,1111111111101111b - or ax, 0000000000001111b -.nob - shl ax,1 - mov [fulladdtab+ecx*2],ax - dec cx - jnz .loopers - ret diff --git a/tools/zsnes/src/version.c b/tools/zsnes/src/version.c deleted file mode 100644 index 59a1de1..0000000 --- a/tools/zsnes/src/version.c +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 -#include - -char *VERSION_STR; - -//Place compilation date at the end of VERSION_STR -void placedate() -{ - strcpy(VERSION_STR + - strlen(VERSION_STR) - - strlen(__DATE__), __DATE__); -} - -//Place compilation time at the end of VERSION_STR -void placetime() -{ - strcpy(VERSION_STR + - strlen(VERSION_STR) - - strlen(__TIME__), __TIME__); -} - -unsigned int version_hash() -{ - return(~crc32(0, (const unsigned char *)__DATE__, strlen(__DATE__))); -} - diff --git a/tools/zsnes/src/video/2xsaimmx.inc b/tools/zsnes/src/video/2xsaimmx.inc deleted file mode 100644 index 3bed4d2..0000000 --- a/tools/zsnes/src/video/2xsaimmx.inc +++ /dev/null @@ -1,2044 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - -;/*---------------------------------------------------------------------* -; * The following (piece of) code, (part of) the 2xSaI engine, * -; * copyright (c) 1999 by Derek Liauw Kie Fa. * -; * Non-Commercial use of the engine is allowed and is encouraged, * -; * provided that appropriate credit be given and that this copyright * -; * notice will not be removed under any circumstance. * -; * You may freely modify this code, but I request * -; * that any improvements to the engine be submitted to me, so * -; * that I can implement these improvements in newer versions of * -; * the engine. * -; * If you need more information, have any comments or suggestions, * -; * you can e-mail me. My e-mail: derek-liauw@usa.net. * -; *---------------------------------------------------------------------*/ - -;---------------------- -; 2xSaI version 0.59 WIP, soon to become version 0.60 -;---------------------- - -BITS 32 - -srcPtr equ 8 -deltaPtr equ 12 -srcPitch equ 16 -width equ 20 -dstOffset equ 24 -dstPitch equ 28 -dstSegment equ 32 - - -colorB0 equ -2 -colorB1 equ 0 -colorB2 equ 2 -colorB3 equ 4 - -color7 equ -2 -color8 equ 0 -color9 equ 2 - -color4 equ -2 -color5 equ 0 -color6 equ 2 -colorS2 equ 4 - -color1 equ -2 -color2 equ 0 -color3 equ 2 -colorS1 equ 4 - -colorA0 equ -2 -colorA1 equ 0 -colorA2 equ 2 -colorA3 equ 4 - - -SECTION .text - -NEWSYM _2xSaISuper2xSaILine -; Store some stuff - push ebp - mov ebp, esp - pushad - -; Prepare the destination -%ifdef __DJGPP__ - ; Set the selector - mov eax, [ebp+dstSegment] - mov fs, ax -%endif - mov edx, [ebp+dstOffset] ; edx points to the screen -; Prepare the source - ; eax points to colorA - mov eax, [ebp+srcPtr] ;eax points to colorA - mov ebx, [ebp+srcPitch] ;ebx contains the source pitch - mov ecx, [ebp+width] ;ecx contains the number of pixels to process - ; eax now points to colorB1 - sub eax, ebx ;eax points to B1 which is the base - -; Main Loop -.Loop: push ecx - - ;-----Check Delta------------------ - mov ecx, [ebp+deltaPtr] - - - ;load source img - movq mm0, [eax+colorB0] - movq mm1, [eax+colorB3] - movq mm2, [eax+ebx+color4] - movq mm3, [eax+ebx+colorS2] - movq mm4, [eax+ebx+ebx+color1] - movq mm5, [eax+ebx+ebx+colorS1] - push eax - add eax, ebx - movq mm6, [eax+ebx+ebx+colorA0] - movq mm7, [eax+ebx+ebx+colorA3] - pop eax - - ;compare to delta - pcmpeqw mm0, [ecx+2+colorB0] - pcmpeqw mm1, [ecx+2+colorB3] - pcmpeqw mm2, [ecx+ebx+2+color4] - pcmpeqw mm3, [ecx+ebx+2+colorS2] - pcmpeqw mm4, [ecx+ebx+ebx+2+color1] - pcmpeqw mm5, [ecx+ebx+ebx+2+colorS1] - add ecx, ebx - pcmpeqw mm6, [ecx+ebx+ebx+2+colorA0] - pcmpeqw mm7, [ecx+ebx+ebx+2+colorA3] - sub ecx, ebx - - - ;compose results - pand mm0, mm1 - pand mm2, mm3 - pand mm4, mm5 - pand mm6, mm7 - pand mm0, mm2 - pand mm4, mm6 - pxor mm7, mm7 - pand mm0, mm4 - movq mm6, [eax+colorB0] - pcmpeqw mm7, mm0 ;did any compare give us a zero ? - - movq [ecx+2+colorB0], mm6 - - packsswb mm7, mm7 - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_PROCESS ;no, so we can skip - - ;End Delta - - ;--------------------------------- - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+color6] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - movq [I56Pixel], mm0 - movq mm7, mm0 - - ;------------------- - movq mm0, mm7 - movq mm1, mm4 ;5,5,5,6 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - movq [I5556Pixel], mm0 - ;-------------------- - - movq mm0, mm7 - movq mm1, mm5 ;6,6,6,5 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I5666Pixel], mm0 - - ;------------------------- - ;------------------------- - movq mm0, [eax+ebx+ebx+color2] - movq mm1, [eax+ebx+ebx+color3] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I23Pixel], mm0 - movq mm7, mm0 - - ;--------------------- - movq mm0, mm7 - movq mm1, mm4 ;2,2,2,3 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I2223Pixel], mm0 - - ;---------------------- - movq mm0, mm7 - movq mm1, mm5 ;3,3,3,2 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I2333Pixel], mm0 - - - ;-------------------- -;//////////////////////////////// -; Decide which "branch" to take -;-------------------------------- - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+color6] - movq mm6, mm0 - movq mm7, mm1 - pcmpeqw mm0, [eax+ebx+ebx+color3] - pcmpeqw mm1, [eax+ebx+ebx+color2] - pcmpeqw mm6, mm7 - - movq mm2, mm0 - movq mm3, mm0 - - pand mm0, mm1 ;colorA == colorD && colorB == colorC - pxor mm7, mm7 - - pcmpeqw mm2, mm7 - pand mm6, mm0 - pand mm2, mm1 ;colorA != colorD && colorB == colorC - - pcmpeqw mm1, mm7 - - pand mm1, mm3 ;colorA == colorD && colorB != colorC - pxor mm0, mm6 - por mm1, mm6 - movq mm7, mm0 - movq [Mask26], mm2 - packsswb mm7, mm7 - movq [Mask35], mm1 - - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_GUESS - -;--------------------------------------------- - movq mm6, mm0 - movq mm4, [eax+ebx+colorA] - movq mm5, [eax+ebx+colorB] - pxor mm7, mm7 - pand mm6, [ONE] - - movq mm0, [eax+colorE] - movq mm1, [eax+ebx+colorG] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+colorF] - movq mm1, [eax+ebx+colorK] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - push eax - add eax, ebx - movq mm0, [eax+ebx+colorH] - movq mm1, [eax+ebx+ebx+colorN] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+ebx+colorL] - movq mm1, [eax+ebx+ebx+colorO] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - pop eax - movq mm1, mm7 - pxor mm0, mm0 - pcmpgtw mm7, mm0 - pcmpgtw mm0, mm1 - - por mm7, [Mask35] - por mm0, [Mask26] - movq [Mask35], mm7 - movq [Mask26], mm0 - -.SKIP_GUESS: - - ;Start the ASSEMBLY !!! eh... compose all the results together to form the final image... - - - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+ebx+color2] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - ;--------------------------- - - -; 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; - - movq mm7, [Mask26] - movq mm6, [eax+colorB2] - movq mm5, [eax+ebx+ebx+color2] - movq mm4, [eax+ebx+ebx+color1] - pcmpeqw mm4, mm5 - pcmpeqw mm6, mm5 - pxor mm5, mm5 - pand mm7, mm4 - pcmpeqw mm6, mm5 - pand mm7, mm6 - - - - movq mm6, [eax+ebx+ebx+color3] - movq mm5, [eax+ebx+ebx+color2] - movq mm4, [eax+ebx+ebx+color1] - movq mm2, [eax+ebx+color5] - movq mm1, [eax+ebx+color4] - movq mm3, [eax+colorB0] - - pcmpeqw mm2, mm4 - pcmpeqw mm6, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm3, mm5 - pxor mm5, mm5 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm6, mm1 - pand mm2, mm3 - pand mm6, mm2 - por mm7, mm6 - - - movq mm6, mm7 - pcmpeqw mm6, mm5 - pand mm7, mm0 - - movq mm1, [eax+ebx+color5] - pand mm6, mm1 - por mm7, mm6 - movq [final1a], mm7 ;finished 1a - - - - ;-------------------------------- - - movq mm7, [Mask35] - push eax - add eax, ebx - movq mm6, [eax+ebx+ebx+colorA2] - pop eax - movq mm5, [eax+ebx+color5] - movq mm4, [eax+ebx+color4] - pcmpeqw mm4, mm5 - pcmpeqw mm6, mm5 - pxor mm5, mm5 - pand mm7, mm4 - pcmpeqw mm6, mm5 - pand mm7, mm6 - - - - movq mm6, [eax+ebx+color6] - movq mm5, [eax+ebx+color5] - movq mm4, [eax+ebx+color4] - movq mm2, [eax+ebx+ebx+color2] - movq mm1, [eax+ebx+ebx+color1] - push eax - add eax, ebx - movq mm3, [eax+ebx+ebx+colorA0] - pop eax - - pcmpeqw mm2, mm4 - pcmpeqw mm6, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm3, mm5 - pxor mm5, mm5 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm6, mm1 - pand mm2, mm3 - pand mm6, mm2 - por mm7, mm6 - - - movq mm6, mm7 - pcmpeqw mm6, mm5 - pand mm7, mm0 - - movq mm1, [eax+ebx+ebx+color2] - pand mm6, mm1 - por mm7, mm6 - movq [final2a], mm7 ;finished 2a - - - ;-------------------------------------------- - - -; 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); - - push eax - add eax, ebx - pxor mm7, mm7 - movq mm0, [eax+ebx+ebx+colorA0] - movq mm1, [eax+ebx+ebx+colorA1] - movq mm2, [eax+ebx+ebx+colorA2] - movq mm3, [eax+ebx+ebx+colorA3] - pop eax - movq mm4, [eax+ebx+ebx+color2] - movq mm5, [eax+ebx+ebx+color3] - movq mm6, [eax+ebx+color6] - - pcmpeqw mm6, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm4, mm2 - pcmpeqw mm0, mm5 - pcmpeqw mm4, mm7 - pcmpeqw mm0, mm7 - pand mm0, mm4 - pand mm6, mm1 - pand mm0, mm6 - - movq mm4, [eax+ebx+color2] - movq mm5, [eax+ebx+ebx+color5] - movq mm6, [eax+ebx+ebx+color3] - - pcmpeqw mm5, mm4 - pcmpeqw mm2, mm4 - pcmpeqw mm1, mm6 - pcmpeqw mm3, mm4 - pcmpeqw mm1, mm7 - pcmpeqw mm3, mm7 - pand mm2, mm5 - pand mm1, mm3 - pand mm1, mm2 - - movq mm2, mm0 - movq mm7, [I2333Pixel] - movq mm6, [I2223Pixel] - movq mm5, [I23Pixel] - movq mm4, [Mask35] - movq mm3, [Mask26] - - por mm2, mm4 - pand mm4, [eax+ebx+ebx+color3] - por mm2, mm3 - pand mm3, [eax+ebx+ebx+color2] - por mm2, mm1 - pand mm0, mm7 - pand mm1, mm6 - pxor mm7, mm7 - pcmpeqw mm2, mm7 - por mm0, mm1 - por mm3, mm4 - pand mm2, mm5 - por mm0, mm3 - por mm0, mm2 - movq [final2b], mm0 - - ;----------------------------------- - - - pxor mm7, mm7 - movq mm0, [eax+colorB0] - movq mm1, [eax+colorB1] - movq mm2, [eax+colorB2] - movq mm3, [eax+colorB3] - movq mm4, [eax+ebx+color5] - movq mm5, [eax+ebx+color6] - movq mm6, [eax+ebx+ebx+color3] - - pcmpeqw mm6, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm4, mm2 - pcmpeqw mm0, mm5 - pcmpeqw mm4, mm7 - pcmpeqw mm0, mm7 - pand mm0, mm4 - pand mm6, mm1 - pand mm0, mm6 - - movq mm4, [eax+ebx+color5] - movq mm5, [eax+ebx+ebx+color2] - movq mm6, [eax+ebx+color6] - - pcmpeqw mm5, mm4 - pcmpeqw mm2, mm4 - pcmpeqw mm1, mm6 - pcmpeqw mm3, mm4 - pcmpeqw mm1, mm7 - pcmpeqw mm3, mm7 - pand mm2, mm5 - pand mm1, mm3 - pand mm1, mm2 - - movq mm2, mm0 - movq mm7, [I5666Pixel] - movq mm6, [I5556Pixel] - movq mm5, [I56Pixel] - movq mm4, [Mask35] - movq mm3, [Mask26] - - por mm2, mm4 - pand mm4, [eax+ebx+color5] - por mm2, mm3 - pand mm3, [eax+ebx+color6] - por mm2, mm1 - pand mm0, mm7 - pand mm1, mm6 - pxor mm7, mm7 - pcmpeqw mm2, mm7 - por mm0, mm1 - por mm3, mm4 - pand mm2, mm5 - por mm0, mm3 - por mm0, mm2 - movq [final1b], mm0 - - ;--------- - - movq mm0, [final1a] - movq mm4, [final2a] - movq mm2, [final1b] - movq mm6, [final2b] - - movq mm1, mm0 - movq mm5, mm4 - - - punpcklwd mm0, mm2 - punpckhwd mm1, mm2 - - punpcklwd mm4, mm6 - punpckhwd mm5, mm6 - - -%ifdef FAR_POINTER - movq [fs:edx], mm0 - movq [fs:edx+8], mm1 - push edx - add edx, [ebp+dstPitch] - movq [fs:edx], mm4 - movq [fs:edx+8], mm5 - pop edx -%else - movq [es:edx], mm0 - movq [es:edx+8], mm1 - push edx - add edx, [ebp+dstPitch] - movq [es:edx], mm4 - movq [es:edx+8], mm5 - pop edx -%endif -.SKIP_PROCESS: - mov ecx, [ebp+deltaPtr] - add ecx, 8 - mov [ebp+deltaPtr], ecx - add edx, 16 - add eax, 8 - - pop ecx - sub ecx, 4 - cmp ecx, 0 - jg near .Loop - -; Restore some stuff - popad - mov esp, ebp - pop ebp - emms - ret - - -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- - - - - - - - -NEWSYM _2xSaISuperEagleLine -; Store some stuff - push ebp - mov ebp, esp - pushad - -; Prepare the destination -%ifdef __DJGPP__ - ; Set the selector - mov eax, [ebp+dstSegment] - mov fs, ax -%endif - mov edx, [ebp+dstOffset] ; edx points to the screen -; Prepare the source - ; eax points to colorA - mov eax, [ebp+srcPtr] - mov ebx, [ebp+srcPitch] - mov ecx, [ebp+width] - ; eax now points to colorB1 - sub eax, ebx - -; Main Loop -.Loop: push ecx - - ;-----Check Delta------------------ - mov ecx, [ebp+deltaPtr] - - movq mm0, [eax+colorB0] - movq mm1, [eax+colorB3] - movq mm2, [eax+ebx+color4] - movq mm3, [eax+ebx+colorS2] - movq mm4, [eax+ebx+ebx+color1] - movq mm5, [eax+ebx+ebx+colorS1] - push eax - add eax, ebx - movq mm6, [eax+ebx+ebx+colorA0] - movq mm7, [eax+ebx+ebx+colorA3] - pop eax - - pcmpeqw mm0, [ecx+2+colorB0] - pcmpeqw mm1, [ecx+2+colorB3] - pcmpeqw mm2, [ecx+ebx+2+color4] - pcmpeqw mm3, [ecx+ebx+2+colorS2] - pcmpeqw mm4, [ecx+ebx+ebx+2+color1] - pcmpeqw mm5, [ecx+ebx+ebx+2+colorS1] - add ecx, ebx - pcmpeqw mm6, [ecx+ebx+ebx+2+colorA0] - pcmpeqw mm7, [ecx+ebx+ebx+2+colorA3] - sub ecx, ebx - - - pand mm0, mm1 - pand mm2, mm3 - pand mm4, mm5 - pand mm6, mm7 - pand mm0, mm2 - pand mm4, mm6 - pxor mm7, mm7 - pand mm0, mm4 - movq mm6, [eax+colorB0] - pcmpeqw mm7, mm0 - - movq [ecx+2+colorB0], mm6 - - packsswb mm7, mm7 - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_PROCESS - - ;End Delta - - ;--------------------------------- - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+color6] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - movq [I56Pixel], mm0 - movq mm7, mm0 - - ;------------------- - movq mm0, mm7 - movq mm1, mm4 ;5,5,5,6 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - movq [product1a], mm0 - ;-------------------- - - movq mm0, mm7 - movq mm1, mm5 ;6,6,6,5 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [product1b], mm0 - - ;------------------------- - ;------------------------- - movq mm0, [eax+ebx+ebx+color2] - movq mm1, [eax+ebx+ebx+color3] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I23Pixel], mm0 - movq mm7, mm0 - - ;--------------------- - movq mm0, mm7 - movq mm1, mm4 ;2,2,2,3 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [product2a], mm0 - - ;---------------------- - movq mm0, mm7 - movq mm1, mm5 ;3,3,3,2 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [product2b], mm0 - - - ;//////////////////////////////// - ; Decide which "branch" to take - ;-------------------------------- - movq mm4, [eax+ebx+color5] - movq mm5, [eax+ebx+color6] - movq mm6, [eax+ebx+ebx+color3] - movq mm7, [eax+ebx+ebx+color2] - - pxor mm3, mm3 - movq mm0, mm4 - movq mm1, mm5 - - pcmpeqw mm0, mm6 - pcmpeqw mm1, mm7 - pcmpeqw mm1, mm3 - pand mm0, mm1 - movq [Mask35], mm0 - - movq mm0, [eax+ebx+ebx+colorS1] - movq mm1, [eax+ebx+color4] - push eax - add eax, ebx - movq mm2, [eax+ebx+ebx+colorA2] - pop eax - movq mm3, [eax+colorB1] - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm4 - pcmpeqw mm3, mm4 - pand mm0, mm1 - pand mm2, mm3 - por mm0, mm2 - pand mm0, [Mask35] - movq [Mask35b], mm0 - - ;----------- - pxor mm3, mm3 - movq mm0, mm4 - movq mm1, mm5 - - pcmpeqw mm0, mm6 - pcmpeqw mm1, mm7 - pcmpeqw mm0, mm3 - pand mm0, mm1 - movq [Mask26], mm0 - - movq mm0, [eax+ebx+ebx+color1] - movq mm1, [eax+ebx+colorS2] - push eax - add eax, ebx - movq mm2, [eax+ebx+ebx+colorA1] - pop eax - movq mm3, [eax+colorB2] - pcmpeqw mm0, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm1 - pand mm2, mm3 - por mm0, mm2 - pand mm0, [Mask26] - movq [Mask26b], mm0 - - ;-------------------- - movq mm0, mm4 - movq mm1, mm5 - movq mm2, mm0 - - pcmpeqw mm2, mm1 - pcmpeqw mm0, mm6 - pcmpeqw mm1, mm7 - pand mm0, mm1 - pand mm2, mm0 - pxor mm0, mm2 - movq mm7, mm0 - - ;------------------ - packsswb mm7, mm7 - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_GUESS - -;--------------------------------------------- -; Map of the pixels: I|E F|J -; G|A B|K -; H|C D|L -; M|N O|P - movq mm6, mm0 - movq mm4, [eax+ebx+color5] - movq mm5, [eax+ebx+color6] - pxor mm7, mm7 - pand mm6, [ONE] - - movq mm0, [eax+colorB1] - movq mm1, [eax+ebx+color4] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+colorB2] - movq mm1, [eax+ebx+colorS2] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - push eax - add eax, ebx - movq mm0, [eax+ebx+color1] - movq mm1, [eax+ebx+ebx+colorA1] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+ebx+colorS1] - movq mm1, [eax+ebx+ebx+colorA2] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - pop eax - movq mm1, mm7 - pxor mm0, mm0 - pcmpgtw mm7, mm0 - pcmpgtw mm0, mm1 - - por mm7, [Mask35] - por mm1, [Mask26] - movq [Mask35], mm7 - movq [Mask26], mm1 - -.SKIP_GUESS: - ;Start the ASSEMBLY !!! - - movq mm4, [Mask35] - movq mm5, [Mask26] - movq mm6, [Mask35b] - movq mm7, [Mask26b] - - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+color6] - movq mm2, [eax+ebx+ebx+color2] - movq mm3, [eax+ebx+ebx+color3] - pcmpeqw mm0, mm2 - pcmpeqw mm1, mm3 - movq mm2, mm4 - movq mm3, mm5 - por mm0, mm1 - por mm2, mm3 - pand mm2, mm0 - pxor mm0, mm2 - movq mm3, mm0 - - movq mm2, mm0 - pxor mm0, mm0 - por mm2, mm4 - pxor mm4, mm6 - por mm2, mm5 - pxor mm5, mm7 - pcmpeqw mm2, mm0 - ;---------------- - - movq mm0, [eax+ebx+color5] - movq mm1, mm3 - por mm1, mm4 - por mm1, mm6 - pand mm0, mm1 - movq mm1, mm5 - pand mm1, [I56Pixel] - por mm0, mm1 - movq mm1, mm7 - pand mm1, [product1b] - por mm0, mm1 - movq mm1, mm2 - pand mm1, [product1a] - por mm0, mm1 - movq [final1a], mm0 - - movq mm0, [eax+ebx+color6] - movq mm1, mm3 - por mm1, mm5 - por mm1, mm7 - pand mm0, mm1 - movq mm1, mm4 - pand mm1, [I56Pixel] - por mm0, mm1 - movq mm1, mm6 - pand mm1, [product1a] - por mm0, mm1 - movq mm1, mm2 - pand mm1, [product1b] - por mm0, mm1 - movq [final1b], mm0 - - movq mm0, [eax+ebx+ebx+color2] - movq mm1, mm3 - por mm1, mm5 - por mm1, mm7 - pand mm0, mm1 - movq mm1, mm4 - pand mm1, [I23Pixel] - por mm0, mm1 - movq mm1, mm6 - pand mm1, [product2b] - por mm0, mm1 - movq mm1, mm2 - pand mm1, [product2a] - por mm0, mm1 - movq [final2a], mm0 - - movq mm0, [eax+ebx+ebx+color3] - movq mm1, mm3 - por mm1, mm4 - por mm1, mm6 - pand mm0, mm1 - movq mm1, mm5 - pand mm1, [I23Pixel] - por mm0, mm1 - movq mm1, mm7 - pand mm1, [product2a] - por mm0, mm1 - movq mm1, mm2 - pand mm1, [product2b] - por mm0, mm1 - movq [final2b], mm0 - - - movq mm0, [final1a] - movq mm2, [final1b] - movq mm1, mm0 - movq mm4, [final2a] - movq mm6, [final2b] - movq mm5, mm4 - punpcklwd mm0, mm2 - punpckhwd mm1, mm2 - punpcklwd mm4, mm6 - punpckhwd mm5, mm6 - - - - -%ifdef __DJGPP__ - movq [fs:edx], mm0 - movq [fs:edx+8], mm1 - push edx - add edx, [ebp+dstPitch] - movq [fs:edx], mm4 - movq [fs:edx+8], mm5 - pop edx -%else - movq [es:edx], mm0 - movq [es:edx+8], mm1 - push edx - add edx, [ebp+dstPitch] - movq [es:edx], mm4 - movq [es:edx+8], mm5 - pop edx -%endif -.SKIP_PROCESS: - mov ecx, [ebp+deltaPtr] - add ecx, 8 - mov [ebp+deltaPtr], ecx - add edx, 16 - add eax, 8 - - pop ecx - sub ecx, 4 - cmp ecx, 0 - jg near .Loop - -; Restore some stuff - popad - mov esp, ebp - pop ebp - emms - ret - - -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- - - -;This is version 0.50 -colorI equ -2 -colorE equ 0 -colorF equ 2 -colorJ equ 4 - -colorG equ -2 -colorA equ 0 -colorB equ 2 -colorK equ 4 - -colorH equ -2 -colorC equ 0 -colorD equ 2 -colorL equ 4 - -colorM equ -2 -colorN equ 0 -colorO equ 2 -colorP equ 4 - -NEWSYM _2xSaILine -; Store some stuff - push ebp - mov ebp, esp - pushad - -; Prepare the destination -%ifdef __DJGPP__ - ; Set the selector - mov eax, [ebp+dstSegment] - mov fs, ax -%endif - mov edx, [ebp+dstOffset] ; edx points to the screen -; Prepare the source - ; eax points to colorA - mov eax, [ebp+srcPtr] - mov ebx, [ebp+srcPitch] - mov ecx, [ebp+width] - ; eax now points to colorE - sub eax, ebx - - -; Main Loop -.Loop: push ecx - - ;-----Check Delta------------------ - mov ecx, [ebp+deltaPtr] - - movq mm0, [eax+colorI] - movq mm1, [eax+colorJ] - movq mm2, [eax+ebx+colorG] - movq mm3, [eax+ebx+colorK] - movq mm4, [eax+ebx+ebx+colorH] - movq mm5, [eax+ebx+ebx+colorL] - push eax - add eax, ebx - movq mm6, [eax+ebx+ebx+colorM] - movq mm7, [eax+ebx+ebx+colorP] - pop eax - - pcmpeqw mm0, [ecx+2+colorI] - pcmpeqw mm1, [ecx+2+colorK] - pcmpeqw mm2, [ecx+ebx+2+colorG] - pcmpeqw mm3, [ecx+ebx+2+colorK] - pcmpeqw mm4, [ecx+ebx+ebx+2+colorH] - pcmpeqw mm5, [ecx+ebx+ebx+2+colorL] - add ecx, ebx - pcmpeqw mm6, [ecx+ebx+ebx+2+colorM] - pcmpeqw mm7, [ecx+ebx+ebx+2+colorP] - sub ecx, ebx - - - pand mm0, mm1 - pand mm2, mm3 - pand mm4, mm5 - pand mm6, mm7 - pand mm0, mm2 - pand mm4, mm6 - pxor mm7, mm7 - pand mm0, mm4 - movq mm6, [eax+colorI] - pcmpeqw mm7, mm0 - - movq [ecx+2+colorI], mm6 - - packsswb mm7, mm7 - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_PROCESS - - ;End Delta - - ;--------------------------------- - - -;1 - ;if ((colorA == colorD) && (colorB != colorC) && (colorA == colorE) && (colorB == colorL) - movq mm0, [eax+ebx+colorA] ;mm0 and mm1 contain colorA - movq mm2, [eax+ebx+colorB] ;mm2 and mm3 contain colorB - - movq mm1, mm0 - movq mm3, mm2 - - pcmpeqw mm0, [eax+ebx+ebx+colorD] - pcmpeqw mm1, [eax+colorE] - pcmpeqw mm2, [eax+ebx+ebx+colorL] - pcmpeqw mm3, [eax+ebx+ebx+colorC] - - pand mm0, mm1 - pxor mm1, mm1 - pand mm0, mm2 - pcmpeqw mm3, mm1 - pand mm0, mm3 ;result in mm0 - - ;if ((colorA == colorC) && (colorB != colorE) && (colorA == colorF) && (colorB == colorJ) - movq mm4, [eax+ebx+colorA] ;mm4 and mm5 contain colorA - movq mm6, [eax+ebx+colorB] ;mm6 and mm7 contain colorB - movq mm5, mm4 - movq mm7, mm6 - - pcmpeqw mm4, [eax+ebx+ebx+colorC] - pcmpeqw mm5, [eax+colorF] - pcmpeqw mm6, [eax+colorJ] - pcmpeqw mm7, [eax+colorE] - - pand mm4, mm5 - pxor mm5, mm5 - pand mm4, mm6 - pcmpeqw mm7, mm5 - pand mm4, mm7 ;result in mm4 - - por mm0, mm4 ;combine the masks - movq [Mask1], mm0 - - ;-------------------------------------------- - -;2 - ;if ((colorB == colorC) && (colorA != colorD) && (colorB == colorF) && (colorA == colorH) - movq mm0, [eax+ebx+colorB] ;mm0 and mm1 contain colorB - movq mm2, [eax+ebx+colorA] ;mm2 and mm3 contain colorA - movq mm1, mm0 - movq mm3, mm2 - - pcmpeqw mm0, [eax+ebx+ebx+colorC] - pcmpeqw mm1, [eax+colorF] - pcmpeqw mm2, [eax+ebx+ebx+colorH] - pcmpeqw mm3, [eax+ebx+ebx+colorD] - - pand mm0, mm1 - pxor mm1, mm1 - pand mm0, mm2 - pcmpeqw mm3, mm1 - pand mm0, mm3 ;result in mm0 - - ;if ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI) - movq mm4, [eax+ebx+colorB] ;mm4 and mm5 contain colorB - movq mm6, [eax+ebx+colorA] ;mm6 and mm7 contain colorA - movq mm5, mm4 - movq mm7, mm6 - - pcmpeqw mm4, [eax+ebx+ebx+colorD] - pcmpeqw mm5, [eax+colorE] - pcmpeqw mm6, [eax+colorI] - pcmpeqw mm7, [eax+colorF] - - pand mm4, mm5 - pxor mm5, mm5 - pand mm4, mm6 - pcmpeqw mm7, mm5 - pand mm4, mm7 ;result in mm4 - - por mm0, mm4 ;combine the masks - movq [Mask2], mm0 - - -;interpolate colorA and colorB - movq mm0, [eax+ebx+colorA] - movq mm1, [eax+ebx+colorB] - - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - - ;assemble the pixels - movq mm1, [eax+ebx+colorA] - movq mm2, [eax+ebx+colorB] - - movq mm3, [Mask1] - movq mm5, mm1 - movq mm4, [Mask2] - movq mm6, mm1 - - pand mm1, mm3 - por mm3, mm4 - pxor mm7, mm7 - pand mm2, mm4 - - pcmpeqw mm3, mm7 - por mm1, mm2 - pand mm0, mm3 - - por mm0, mm1 - - punpcklwd mm5, mm0 - punpckhwd mm6, mm0 - -%ifdef __DJGPP__ - movq [fs:edx], mm5 - movq [fs:edx+8], mm6 -%else - movq [es:edx], mm5 - movq [es:edx+8], mm6 -%endif - -;------------------------------------------------ -; Create the Nextline -;------------------------------------------------ -;3 ;if ((colorA == colorD) && (colorB != colorC) && (colorA == colorG) && (colorC == colorO) - movq mm0, [eax+ebx+colorA] ;mm0 and mm1 contain colorA - movq mm2, [eax+ebx+ebx+colorC] ;mm2 and mm3 contain colorC - movq mm1, mm0 - movq mm3, mm2 - - push eax - add eax, ebx - pcmpeqw mm0, [eax+ebx+colorD] - pcmpeqw mm1, [eax+colorG] - pcmpeqw mm2, [eax+ebx+ebx+colorO] - pcmpeqw mm3, [eax+colorB] - pop eax - - pand mm0, mm1 - pxor mm1, mm1 - pand mm0, mm2 - pcmpeqw mm3, mm1 - pand mm0, mm3 ;result in mm0 - - ;if ((colorA == colorB) && (colorG != colorC) && (colorA == colorH) && (colorC == colorM) - movq mm4, [eax+ebx+colorA] ;mm4 and mm5 contain colorA - movq mm6, [eax+ebx+ebx+colorC] ;mm6 and mm7 contain colorC - movq mm5, mm4 - movq mm7, mm6 - - push eax - add eax, ebx - pcmpeqw mm4, [eax+ebx+colorH] - pcmpeqw mm5, [eax+colorB] - pcmpeqw mm6, [eax+ebx+ebx+colorM] - pcmpeqw mm7, [eax+colorG] - pop eax - - pand mm4, mm5 - pxor mm5, mm5 - pand mm4, mm6 - pcmpeqw mm7, mm5 - pand mm4, mm7 ;result in mm4 - - por mm0, mm4 ;combine the masks - movq [Mask1], mm0 - ;-------------------------------------------- - -;4 - ;if ((colorB == colorC) && (colorA != colorD) && (colorC == colorH) && (colorA == colorF) - movq mm0, [eax+ebx+ebx+colorC] ;mm0 and mm1 contain colorC - movq mm2, [eax+ebx+colorA] ;mm2 and mm3 contain colorA - movq mm1, mm0 - movq mm3, mm2 - - pcmpeqw mm0, [eax+ebx+colorB] - pcmpeqw mm1, [eax+ebx+ebx+colorH] - pcmpeqw mm2, [eax+colorF] - pcmpeqw mm3, [eax+ebx+ebx+colorD] - - pand mm0, mm1 - pxor mm1, mm1 - pand mm0, mm2 - pcmpeqw mm3, mm1 - pand mm0, mm3 ;result in mm0 - - ;if ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI) - movq mm4, [eax+ebx+ebx+colorC] ;mm4 and mm5 contain colorC - movq mm6, [eax+ebx+colorA] ;mm6 and mm7 contain colorA - movq mm5, mm4 - movq mm7, mm6 - - pcmpeqw mm4, [eax+ebx+ebx+colorD] - pcmpeqw mm5, [eax+ebx+colorG] - pcmpeqw mm6, [eax+colorI] - pcmpeqw mm7, [eax+ebx+ebx+colorH] - - pand mm4, mm5 - pxor mm5, mm5 - pand mm4, mm6 - pcmpeqw mm7, mm5 - pand mm4, mm7 ;result in mm4 - - por mm0, mm4 ;combine the masks - movq [Mask2], mm0 - ;---------------------------------------------- - -;interpolate colorA and colorC - movq mm0, [eax+ebx+colorA] - movq mm1, [eax+ebx+ebx+colorC] - - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - ;------------- - - ;assemble the pixels - movq mm1, [eax+ebx+colorA] - movq mm2, [eax+ebx+ebx+colorC] - - movq mm3, [Mask1] - movq mm4, [Mask2] - - pand mm1, mm3 - pand mm2, mm4 - - por mm3, mm4 - pxor mm7, mm7 - por mm1, mm2 - - pcmpeqw mm3, mm7 - pand mm0, mm3 - por mm0, mm1 - movq [ACPixel], mm0 - -;//////////////////////////////// -; Decide which "branch" to take -;-------------------------------- - movq mm0, [eax+ebx+colorA] - movq mm1, [eax+ebx+colorB] - movq mm6, mm0 - movq mm7, mm1 - pcmpeqw mm0, [eax+ebx+ebx+colorD] - pcmpeqw mm1, [eax+ebx+ebx+colorC] - pcmpeqw mm6, mm7 - - movq mm2, mm0 - movq mm3, mm0 - - pand mm0, mm1 ;colorA == colorD && colorB == colorC - pxor mm7, mm7 - - pcmpeqw mm2, mm7 - pand mm6, mm0 - pand mm2, mm1 ;colorA != colorD && colorB == colorC - - pcmpeqw mm1, mm7 - - pand mm1, mm3 ;colorA == colorD && colorB != colorC - pxor mm0, mm6 - por mm1, mm6 - movq mm7, mm0 - movq [Mask2], mm2 - packsswb mm7, mm7 - movq [Mask1], mm1 - - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_GUESS -;--------------------------------------------- -; Map of the pixels: I|E F|J -; G|A B|K -; H|C D|L -; M|N O|P - movq mm6, mm0 - movq mm4, [eax+ebx+colorA] - movq mm5, [eax+ebx+colorB] - pxor mm7, mm7 - pand mm6, [ONE] - - movq mm0, [eax+colorE] - movq mm1, [eax+ebx+colorG] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+colorF] - movq mm1, [eax+ebx+colorK] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - push eax - add eax, ebx - movq mm0, [eax+ebx+colorH] - movq mm1, [eax+ebx+ebx+colorN] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+ebx+colorL] - movq mm1, [eax+ebx+ebx+colorO] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - pop eax - movq mm1, mm7 - pxor mm0, mm0 - pcmpgtw mm7, mm0 - pcmpgtw mm0, mm1 - - por mm7, [Mask1] - por mm1, [Mask2] - movq [Mask1], mm7 - movq [Mask2], mm1 - -.SKIP_GUESS: - ;---------------------------- - ;interpolate A, B, C and D - movq mm0, [eax+ebx+colorA] - movq mm1, [eax+ebx+colorB] - movq mm4, mm0 - movq mm2, [eax+ebx+ebx+colorC] - movq mm5, mm1 - movq mm3, [qcolorMask] - movq mm6, mm2 - movq mm7, [qlowpixelMask] - - pand mm0, mm3 - pand mm1, mm3 - pand mm2, mm3 - pand mm3, [eax+ebx+ebx+colorD] - - psrlw mm0, 2 - pand mm4, mm7 - psrlw mm1, 2 - pand mm5, mm7 - psrlw mm2, 2 - pand mm6, mm7 - psrlw mm3, 2 - pand mm7, [eax+ebx+ebx+colorD] - - paddw mm0, mm1 - paddw mm2, mm3 - - paddw mm4, mm5 - paddw mm6, mm7 - - paddw mm4, mm6 - paddw mm0, mm2 - psrlw mm4, 2 - pand mm4, [qlowpixelMask] - paddw mm0, mm4 ;mm0 contains the interpolated value of A, B, C and D - -;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ - ;assemble the pixels - movq mm1, [Mask1] - movq mm2, [Mask2] - movq mm4, [eax+ebx+colorA] - movq mm5, [eax+ebx+colorB] - pand mm4, mm1 - pand mm5, mm2 - - pxor mm7, mm7 - por mm1, mm2 - por mm4, mm5 - pcmpeqw mm1, mm7 - pand mm0, mm1 - por mm4, mm0 ;mm4 contains the diagonal pixels - - movq mm0, [ACPixel] - movq mm1, mm0 - punpcklwd mm0, mm4 - punpckhwd mm1, mm4 - - push edx - add edx, [ebp+dstPitch] - -%ifdef __DJGPP__ - movq [fs:edx], mm0 - movq [fs:edx+8], mm1 -%else - movq [es:edx], mm0 - movq [es:edx+8], mm1 -%endif - pop edx - -.SKIP_PROCESS: - mov ecx, [ebp+deltaPtr] - add ecx, 8 - mov [ebp+deltaPtr], ecx - add edx, 16 - add eax, 8 - - pop ecx - sub ecx, 4 - cmp ecx, 0 - jg near .Loop - -; Restore some stuff - popad - mov esp, ebp - pop ebp - emms - ret - -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- - -NEWSYM Init_2xSaIMMX -; Store some stuff - push ebp - mov ebp, esp - push edx - - -;Damn thing doesn't work -; mov eax,1 -; cpuid -; test edx, 0x00800000 ;test bit 23 -; jz end2 ;bit not set => no MMX detected - - mov eax, [ebp+8] ;PixelFormat - cmp eax, 555 - jz Bits555 - cmp eax, 565 - jz Bits565 -end2: - mov eax, 1 - jmp end1 -Bits555: - mov edx, 0x7BDE7BDE - mov eax, colorMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x04210421 - mov eax, lowPixelMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x739C739C - mov eax, qcolorMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x0C630C63 - mov eax, qlowpixelMask - mov [eax], edx - mov [eax+4], edx - mov eax, 0 - jmp end1 -Bits565: - mov edx, 0xF7DEF7DE - mov eax, colorMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x08210821 - mov eax, lowPixelMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0xE79CE79C - mov eax, qcolorMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x18631863 - mov eax, qlowpixelMask - mov [eax], edx - mov [eax+4], edx - mov eax, 0 - jmp end1 -end1: - pop edx - mov esp, ebp - pop ebp - ret - - -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- - -SECTION .data -;Some constants -colorMask dd 0xF7DEF7DE, 0xF7DEF7DE -lowPixelMask dd 0x08210821, 0x08210821 - -qcolorMask dd 0xE79CE79C, 0xE79CE79C -qlowpixelMask dd 0x18631863, 0x18631863 - -FALSE dd 0x00000000, 0x00000000 -TRUE dd 0xffffffff, 0xffffffff -ONE dd 0x00010001, 0x00010001 - - -SECTION .bss -ACPixel resb 8 -Mask1 resb 8 -Mask2 resb 8 - -I56Pixel resb 8 -I23Pixel resb 8 -I5556Pixel resb 8 -I2223Pixel resb 8 -I5666Pixel resb 8 -I2333Pixel resb 8 -Mask26 resb 8 -Mask35 resb 8 -Mask26b resb 8 -Mask35b resb 8 -product1a resb 8 -product1b resb 8 -product2a resb 8 -product2b resb 8 -final1a resb 8 -final1b resb 8 -final2a resb 8 -final2b resb 8 diff --git a/tools/zsnes/src/video/2xsaiw.asm b/tools/zsnes/src/video/2xsaiw.asm deleted file mode 100644 index efd8220..0000000 --- a/tools/zsnes/src/video/2xsaiw.asm +++ /dev/null @@ -1,2072 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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" - -;/*---------------------------------------------------------------------* -; * The following (piece of) code, (part of) the 2xSaI engine, * -; * copyright (c) 1999 by Derek Liauw Kie Fa. * -; * Non-Commercial use of the engine is allowed and is encouraged, * -; * provided that appropriate credit be given and that this copyright * -; * notice will not be removed under any circumstance. * -; * You may freely modify this code, but I request * -; * that any improvements to the engine be submitted to me, so * -; * that I can implement these improvements in newer versions of * -; * the engine. * -; * If you need more information, have any comments or suggestions, * -; * you can e-mail me. My e-mail: derek-liauw@usa.net. * -; *---------------------------------------------------------------------*/ - -;---------------------- -; 2xSaI version 0.59 WIP, soon to become version 0.60 -;---------------------- - -BITS 32 - -SECTION .text - -srcPtr equ 8 -deltaPtr equ 12 -srcPitch equ 16 -width equ 20 -dstOffset equ 24 -dstPitch equ 28 -dstSegment equ 32 - - -colorB0 equ -2 -colorB1 equ 0 -colorB2 equ 2 -colorB3 equ 4 - -color7 equ -2 -color8 equ 0 -color9 equ 2 - -color4 equ -2 -color5 equ 0 -color6 equ 2 -colorS2 equ 4 - -color1 equ -2 -color2 equ 0 -color3 equ 2 -colorS1 equ 4 - -colorA0 equ -2 -colorA1 equ 0 -colorA2 equ 2 -colorA3 equ 4 - - -NEWSYM _2xSaISuper2xSaILineW -; Store some stuff - push ebp - mov ebp, esp - pushad - -; Prepare the destination -%ifdef __DJGPP__ - ; Set the selector - mov eax, [ebp+dstSegment] - mov fs, ax -%endif - mov edx, [ebp+dstOffset] ; edx points to the screen -; Prepare the source - ; eax points to colorA - mov eax, [ebp+srcPtr] ;eax points to colorA - mov ebx, [ebp+srcPitch] ;ebx contains the source pitch - mov ecx, [ebp+width] ;ecx contains the number of pixels to process - ; eax now points to colorB1 - sub eax, ebx ;eax points to B1 which is the base - -; Main Loop -.Loop: push ecx - - ;-----Check Delta------------------ - mov ecx, [ebp+deltaPtr] - - - ;load source img - movq mm0, [eax+colorB0] - movq mm1, [eax+colorB3] - movq mm2, [eax+ebx+color4] - movq mm3, [eax+ebx+colorS2] - movq mm4, [eax+ebx+ebx+color1] - movq mm5, [eax+ebx+ebx+colorS1] - push eax - add eax, ebx - movq mm6, [eax+ebx+ebx+colorA0] - movq mm7, [eax+ebx+ebx+colorA3] - pop eax - - ;compare to delta - pcmpeqw mm0, [ecx+2+colorB0] - pcmpeqw mm1, [ecx+2+colorB3] - pcmpeqw mm2, [ecx+ebx+2+color4] - pcmpeqw mm3, [ecx+ebx+2+colorS2] - pcmpeqw mm4, [ecx+ebx+ebx+2+color1] - pcmpeqw mm5, [ecx+ebx+ebx+2+colorS1] - add ecx, ebx - pcmpeqw mm6, [ecx+ebx+ebx+2+colorA0] - pcmpeqw mm7, [ecx+ebx+ebx+2+colorA3] - sub ecx, ebx - - - ;compose results - pand mm0, mm1 - pand mm2, mm3 - pand mm4, mm5 - pand mm6, mm7 - pand mm0, mm2 - pand mm4, mm6 - pxor mm7, mm7 - pand mm0, mm4 - movq mm6, [eax+colorB0] - pcmpeqw mm7, mm0 ;did any compare give us a zero ? - - movq [ecx+2+colorB0], mm6 - - packsswb mm7, mm7 - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_PROCESS ;no, so we can skip - - ;End Delta - - ;--------------------------------- - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+color6] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - movq [I56Pixel], mm0 - movq mm7, mm0 - - ;------------------- - movq mm0, mm7 - movq mm1, mm4 ;5,5,5,6 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - movq [I5556Pixel], mm0 - ;-------------------- - - movq mm0, mm7 - movq mm1, mm5 ;6,6,6,5 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I5666Pixel], mm0 - - ;------------------------- - ;------------------------- - movq mm0, [eax+ebx+ebx+color2] - movq mm1, [eax+ebx+ebx+color3] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I23Pixel], mm0 - movq mm7, mm0 - - ;--------------------- - movq mm0, mm7 - movq mm1, mm4 ;2,2,2,3 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I2223Pixel], mm0 - - ;---------------------- - movq mm0, mm7 - movq mm1, mm5 ;3,3,3,2 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I2333Pixel], mm0 - - ;-------------------- -;//////////////////////////////// -; Decide which "branch" to take -;-------------------------------- - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+color6] - movq mm6, mm0 - movq mm7, mm1 - pcmpeqw mm0, [eax+ebx+ebx+color3] - pcmpeqw mm1, [eax+ebx+ebx+color2] - pcmpeqw mm6, mm7 - - movq mm2, mm0 - movq mm3, mm0 - - pand mm0, mm1 ;colorA == colorD && colorB == colorC - pxor mm7, mm7 - - pcmpeqw mm2, mm7 - pand mm6, mm0 - pand mm2, mm1 ;colorA != colorD && colorB == colorC - - pcmpeqw mm1, mm7 - - pand mm1, mm3 ;colorA == colorD && colorB != colorC - pxor mm0, mm6 - por mm1, mm6 - movq mm7, mm0 - movq [Mask26], mm2 - packsswb mm7, mm7 - movq [Mask35], mm1 - - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_GUESS - -;--------------------------------------------- - movq mm6, mm0 - movq mm4, [eax+ebx+colorA] - movq mm5, [eax+ebx+colorB] - pxor mm7, mm7 - pand mm6, [ONE] - - movq mm0, [eax+colorE] - movq mm1, [eax+ebx+colorG] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+colorF] - movq mm1, [eax+ebx+colorK] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - push eax - add eax, ebx - movq mm0, [eax+ebx+colorH] - movq mm1, [eax+ebx+ebx+colorN] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+ebx+colorL] - movq mm1, [eax+ebx+ebx+colorO] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - pop eax - movq mm1, mm7 - pxor mm0, mm0 - pcmpgtw mm7, mm0 - pcmpgtw mm0, mm1 - - por mm7, [Mask35] - por mm0, [Mask26] - movq [Mask35], mm7 - movq [Mask26], mm0 - -.SKIP_GUESS: - - ;Start the ASSEMBLY !!! eh... compose all the results together to form the final image... - - - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+ebx+color2] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - ;--------------------------- - - -; 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; - - movq mm7, [Mask26] - movq mm6, [eax+colorB2] - movq mm5, [eax+ebx+ebx+color2] - movq mm4, [eax+ebx+ebx+color1] - pcmpeqw mm4, mm5 - pcmpeqw mm6, mm5 - pxor mm5, mm5 - pand mm7, mm4 - pcmpeqw mm6, mm5 - pand mm7, mm6 - - - movq mm6, [eax+ebx+ebx+color3] - movq mm5, [eax+ebx+ebx+color2] - movq mm4, [eax+ebx+ebx+color1] - movq mm2, [eax+ebx+color5] - movq mm1, [eax+ebx+color4] - movq mm3, [eax+colorB0] - - pcmpeqw mm2, mm4 - pcmpeqw mm6, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm3, mm5 - pxor mm5, mm5 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm6, mm1 - pand mm2, mm3 - pand mm6, mm2 - por mm7, mm6 - - - movq mm6, mm7 - pcmpeqw mm6, mm5 - pand mm7, mm0 - - movq mm1, [eax+ebx+color5] - pand mm6, mm1 - por mm7, mm6 - movq [final1a], mm7 ;finished 1a - - - - ;-------------------------------- - - movq mm7, [Mask35] - push eax - add eax, ebx - movq mm6, [eax+ebx+ebx+colorA2] - pop eax - movq mm5, [eax+ebx+color5] - movq mm4, [eax+ebx+color4] - pcmpeqw mm4, mm5 - pcmpeqw mm6, mm5 - pxor mm5, mm5 - pand mm7, mm4 - pcmpeqw mm6, mm5 - pand mm7, mm6 - - - - movq mm6, [eax+ebx+color6] - movq mm5, [eax+ebx+color5] - movq mm4, [eax+ebx+color4] - movq mm2, [eax+ebx+ebx+color2] - movq mm1, [eax+ebx+ebx+color1] - push eax - add eax, ebx - movq mm3, [eax+ebx+ebx+colorA0] - pop eax - - pcmpeqw mm2, mm4 - pcmpeqw mm6, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm3, mm5 - pxor mm5, mm5 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm6, mm1 - pand mm2, mm3 - pand mm6, mm2 - por mm7, mm6 - - - movq mm6, mm7 - pcmpeqw mm6, mm5 - pand mm7, mm0 - - movq mm1, [eax+ebx+ebx+color2] - pand mm6, mm1 - por mm7, mm6 - movq [final2a], mm7 ;finished 2a - - - ;-------------------------------------------- - - -; 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); - - push eax - add eax, ebx - pxor mm7, mm7 - movq mm0, [eax+ebx+ebx+colorA0] - movq mm1, [eax+ebx+ebx+colorA1] - movq mm2, [eax+ebx+ebx+colorA2] - movq mm3, [eax+ebx+ebx+colorA3] - pop eax - movq mm4, [eax+ebx+ebx+color2] - movq mm5, [eax+ebx+ebx+color3] - movq mm6, [eax+ebx+color6] - - pcmpeqw mm6, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm4, mm2 - pcmpeqw mm0, mm5 - pcmpeqw mm4, mm7 - pcmpeqw mm0, mm7 - pand mm0, mm4 - pand mm6, mm1 - pand mm0, mm6 - - - push eax - add eax, ebx - movq mm1, [eax+ebx+ebx+colorA1] - pop eax - movq mm4, [eax+ebx+ebx+color2] - movq mm5, [eax+ebx+color5] - movq mm6, [eax+ebx+ebx+color3] - - pcmpeqw mm5, mm4 - pcmpeqw mm2, mm4 - pcmpeqw mm1, mm6 - pcmpeqw mm3, mm4 - pcmpeqw mm1, mm7 - pcmpeqw mm3, mm7 - pand mm2, mm5 - pand mm1, mm3 - pand mm1, mm2 - - - movq mm7, mm0 - por mm7, mm1 - - movq mm4, [Mask35] - movq mm3, [Mask26] - - movq mm6, mm4 - pand mm6, mm7 - pxor mm4, mm6 - - movq mm6, mm3 - pand mm6, mm7 - pxor mm3, mm6 - - movq mm2, mm0 - movq mm7, [I2333Pixel] - movq mm6, [I2223Pixel] - movq mm5, [I23Pixel] - - - por mm2, mm4 - pand mm4, [eax+ebx+ebx+color3] - por mm2, mm3 - pand mm3, [eax+ebx+ebx+color2] - por mm2, mm1 - pand mm0, mm7 - pand mm1, mm6 - pxor mm7, mm7 - pcmpeqw mm2, mm7 - por mm0, mm1 - por mm3, mm4 - pand mm2, mm5 - por mm0, mm3 - por mm0, mm2 - movq [final2b], mm0 - - ;----------------------------------- - - - pxor mm7, mm7 - movq mm0, [eax+colorB0] - movq mm1, [eax+colorB1] - movq mm2, [eax+colorB2] - movq mm3, [eax+colorB3] - movq mm4, [eax+ebx+color5] - movq mm5, [eax+ebx+color6] - movq mm6, [eax+ebx+ebx+color3] - - pcmpeqw mm6, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm4, mm2 - pcmpeqw mm0, mm5 - pcmpeqw mm4, mm7 - pcmpeqw mm0, mm7 - pand mm0, mm4 - pand mm6, mm1 - pand mm0, mm6 - - movq mm1, [eax+colorB1] - movq mm4, [eax+ebx+color5] - movq mm5, [eax+ebx+ebx+color2] - movq mm6, [eax+ebx+color6] - - pcmpeqw mm5, mm4 - pcmpeqw mm2, mm4 - pcmpeqw mm1, mm6 - pcmpeqw mm3, mm4 - pcmpeqw mm1, mm7 - pcmpeqw mm3, mm7 - pand mm2, mm5 - pand mm1, mm3 - pand mm1, mm2 - - - movq mm7, mm0 - por mm7, mm1 - - movq mm4, [Mask35] - movq mm3, [Mask26] - - movq mm6, mm4 - pand mm6, mm7 - pxor mm4, mm6 - - movq mm6, mm3 - pand mm6, mm7 - pxor mm3, mm6 - - movq mm2, mm0 - movq mm7, [I5666Pixel] - movq mm6, [I5556Pixel] - movq mm5, [I56Pixel] - - - por mm2, mm4 - pand mm4, [eax+ebx+color5] - por mm2, mm3 - pand mm3, [eax+ebx+color6] - por mm2, mm1 - pand mm0, mm7 - pand mm1, mm6 - pxor mm7, mm7 - pcmpeqw mm2, mm7 - por mm0, mm1 - por mm3, mm4 - pand mm2, mm5 - por mm0, mm3 - por mm0, mm2 - movq [final1b], mm0 - - ;--------- - - movq mm0, [final1a] - movq mm4, [final2a] - movq mm2, [final1b] - movq mm6, [final2b] - - - movq mm1, mm0 - movq mm5, mm4 - - - punpcklwd mm0, mm2 - punpckhwd mm1, mm2 - - punpcklwd mm4, mm6 - punpckhwd mm5, mm6 - - -%ifdef __DJGPP__ - movq [fs:edx], mm0 - movq [fs:edx+8], mm1 - push edx - add edx, [ebp+dstPitch] - movq [fs:edx], mm4 - movq [fs:edx+8], mm5 - pop edx -%else - movq [edx], mm0 - movq [edx+8], mm1 - push edx - add edx, [ebp+dstPitch] - movq [edx], mm4 - movq [edx+8], mm5 - pop edx -%endif -.SKIP_PROCESS: - mov ecx, [ebp+deltaPtr] - add ecx, 8 - mov [ebp+deltaPtr], ecx - add edx, 16 - add eax, 8 - - pop ecx - sub ecx, 4 - cmp ecx, 0 - jg .Loop - -; Restore some stuff - popad - mov esp, ebp - pop ebp - emms - ret - - -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- - - - - -NEWSYM _2xSaISuperEagleLineW - -; Store some stuff - push ebp - mov ebp, esp - pushad - -; Prepare the destination -%ifdef __DJGPP__ - ; Set the selector - mov eax, [ebp+dstSegment] - mov fs, ax -%endif - mov edx, [ebp+dstOffset] ; edx points to the screen -; Prepare the source - ; eax points to colorA - mov eax, [ebp+srcPtr] - mov ebx, [ebp+srcPitch] - mov ecx, [ebp+width] - ; eax now points to colorB1 - sub eax, ebx - -; Main Loop -.Loop: push ecx - - ;-----Check Delta------------------ - mov ecx, [ebp+deltaPtr] - - movq mm0, [eax+colorB0] - movq mm1, [eax+colorB3] - movq mm2, [eax+ebx+color4] - movq mm3, [eax+ebx+colorS2] - movq mm4, [eax+ebx+ebx+color1] - movq mm5, [eax+ebx+ebx+colorS1] - push eax - add eax, ebx - movq mm6, [eax+ebx+ebx+colorA0] - movq mm7, [eax+ebx+ebx+colorA3] - pop eax - - pcmpeqw mm0, [ecx+2+colorB0] - pcmpeqw mm1, [ecx+2+colorB3] - pcmpeqw mm2, [ecx+ebx+2+color4] - pcmpeqw mm3, [ecx+ebx+2+colorS2] - pcmpeqw mm4, [ecx+ebx+ebx+2+color1] - pcmpeqw mm5, [ecx+ebx+ebx+2+colorS1] - add ecx, ebx - pcmpeqw mm6, [ecx+ebx+ebx+2+colorA0] - pcmpeqw mm7, [ecx+ebx+ebx+2+colorA3] - sub ecx, ebx - - - pand mm0, mm1 - pand mm2, mm3 - pand mm4, mm5 - pand mm6, mm7 - pand mm0, mm2 - pand mm4, mm6 - pxor mm7, mm7 - pand mm0, mm4 - movq mm6, [eax+colorB0] - pcmpeqw mm7, mm0 - - movq [ecx+2+colorB0], mm6 - - packsswb mm7, mm7 - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_PROCESS - - ;End Delta - - ;--------------------------------- - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+color6] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - movq [I56Pixel], mm0 - movq mm7, mm0 - - ;------------------- - movq mm0, mm7 - movq mm1, mm4 ;5,5,5,6 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - movq [product1a], mm0 - ;-------------------- - - movq mm0, mm7 - movq mm1, mm5 ;6,6,6,5 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [product1b], mm0 - - ;------------------------- - ;------------------------- - movq mm0, [eax+ebx+ebx+color2] - movq mm1, [eax+ebx+ebx+color3] - movq mm2, mm0 - movq mm3, mm1 - movq mm4, mm0 - movq mm5, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [I23Pixel], mm0 - movq mm7, mm0 - - ;--------------------- - movq mm0, mm7 - movq mm1, mm4 ;2,2,2,3 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [product2a], mm0 - - ;---------------------- - movq mm0, mm7 - movq mm1, mm5 ;3,3,3,2 - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 - movq [product2b], mm0 - - - ;//////////////////////////////// - ; Decide which "branch" to take - ;-------------------------------- - movq mm4, [eax+ebx+color5] - movq mm5, [eax+ebx+color6] - movq mm6, [eax+ebx+ebx+color3] - movq mm7, [eax+ebx+ebx+color2] - - pxor mm3, mm3 - movq mm0, mm4 - movq mm1, mm5 - - pcmpeqw mm0, mm6 - pcmpeqw mm1, mm7 - pcmpeqw mm1, mm3 - pand mm0, mm1 - movq [Mask35], mm0 - - movq mm0, [eax+ebx+ebx+colorS1] - movq mm1, [eax+ebx+color4] - push eax - add eax, ebx - movq mm2, [eax+ebx+ebx+colorA2] - pop eax - movq mm3, [eax+colorB1] - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm4 - pcmpeqw mm3, mm4 - pand mm0, mm1 - pand mm2, mm3 - por mm0, mm2 - pand mm0, [Mask35] - movq [Mask35b], mm0 - - ;----------- - pxor mm3, mm3 - movq mm0, mm4 - movq mm1, mm5 - - pcmpeqw mm0, mm6 - pcmpeqw mm1, mm7 - pcmpeqw mm0, mm3 - pand mm0, mm1 - movq [Mask26], mm0 - - movq mm0, [eax+ebx+ebx+color1] - movq mm1, [eax+ebx+colorS2] - push eax - add eax, ebx - movq mm2, [eax+ebx+ebx+colorA1] - pop eax - movq mm3, [eax+colorB2] - pcmpeqw mm0, mm5 - pcmpeqw mm1, mm5 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm1 - pand mm2, mm3 - por mm0, mm2 - pand mm0, [Mask26] - movq [Mask26b], mm0 - - ;-------------------- - movq mm0, mm4 - movq mm1, mm5 - movq mm2, mm0 - - pcmpeqw mm2, mm1 - pcmpeqw mm0, mm6 - pcmpeqw mm1, mm7 - pand mm0, mm1 - pand mm2, mm0 - pxor mm0, mm2 - movq mm7, mm0 - - ;------------------ - packsswb mm7, mm7 - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_GUESS - -;--------------------------------------------- -; Map of the pixels: I|E F|J -; G|A B|K -; H|C D|L -; M|N O|P - movq mm6, mm0 - movq mm4, [eax+ebx+color5] - movq mm5, [eax+ebx+color6] - pxor mm7, mm7 - pand mm6, [ONE] - - movq mm0, [eax+colorB1] - movq mm1, [eax+ebx+color4] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+colorB2] - movq mm1, [eax+ebx+colorS2] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - push eax - add eax, ebx - movq mm0, [eax+ebx+color1] - movq mm1, [eax+ebx+ebx+colorA1] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+ebx+colorS1] - movq mm1, [eax+ebx+ebx+colorA2] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - pop eax - movq mm1, mm7 - pxor mm0, mm0 - pcmpgtw mm7, mm0 - pcmpgtw mm0, mm1 - - por mm7, [Mask35] - por mm0, [Mask26] - movq [Mask35], mm7 - movq [Mask26], mm0 - -.SKIP_GUESS: - ;Start the ASSEMBLY !!! - - movq mm4, [Mask35] - movq mm5, [Mask26] - movq mm6, [Mask35b] - movq mm7, [Mask26b] - - movq mm0, [eax+ebx+color5] - movq mm1, [eax+ebx+color6] - movq mm2, [eax+ebx+ebx+color2] - movq mm3, [eax+ebx+ebx+color3] - pcmpeqw mm0, mm2 - pcmpeqw mm1, mm3 - movq mm2, mm4 - movq mm3, mm5 - por mm0, mm1 - por mm2, mm3 - pand mm2, mm0 - pxor mm0, mm2 - movq mm3, mm0 - - movq mm2, mm0 - pxor mm0, mm0 - por mm2, mm4 - pxor mm4, mm6 - por mm2, mm5 - pxor mm5, mm7 - pcmpeqw mm2, mm0 - ;---------------- - - movq mm0, [eax+ebx+color5] - movq mm1, mm3 - por mm1, mm4 - por mm1, mm6 - pand mm0, mm1 - movq mm1, mm5 - pand mm1, [I56Pixel] - por mm0, mm1 - movq mm1, mm7 - pand mm1, [product1b] - por mm0, mm1 - movq mm1, mm2 - pand mm1, [product1a] - por mm0, mm1 - movq [final1a], mm0 - - movq mm0, [eax+ebx+color6] - movq mm1, mm3 - por mm1, mm5 - por mm1, mm7 - pand mm0, mm1 - movq mm1, mm4 - pand mm1, [I56Pixel] - por mm0, mm1 - movq mm1, mm6 - pand mm1, [product1a] - por mm0, mm1 - movq mm1, mm2 - pand mm1, [product1b] - por mm0, mm1 - movq [final1b], mm0 - - movq mm0, [eax+ebx+ebx+color2] - movq mm1, mm3 - por mm1, mm5 - por mm1, mm7 - pand mm0, mm1 - movq mm1, mm4 - pand mm1, [I23Pixel] - por mm0, mm1 - movq mm1, mm6 - pand mm1, [product2b] - por mm0, mm1 - movq mm1, mm2 - pand mm1, [product2a] - por mm0, mm1 - movq [final2a], mm0 - - movq mm0, [eax+ebx+ebx+color3] - movq mm1, mm3 - por mm1, mm4 - por mm1, mm6 - pand mm0, mm1 - movq mm1, mm5 - pand mm1, [I23Pixel] - por mm0, mm1 - movq mm1, mm7 - pand mm1, [product2a] - por mm0, mm1 - movq mm1, mm2 - pand mm1, [product2b] - por mm0, mm1 - movq [final2b], mm0 - - - movq mm0, [final1a] - movq mm2, [final1b] - movq mm1, mm0 - movq mm4, [final2a] - movq mm6, [final2b] - movq mm5, mm4 - punpcklwd mm0, mm2 - punpckhwd mm1, mm2 - punpcklwd mm4, mm6 - punpckhwd mm5, mm6 - - - - -%ifdef __DJGPP__ - movq [fs:edx], mm0 - movq [fs:edx+8], mm1 - push edx - add edx, [ebp+dstPitch] - movq [fs:edx], mm4 - movq [fs:edx+8], mm5 - pop edx -%else - movq [edx], mm0 - movq [edx+8], mm1 - push edx - add edx, [ebp+dstPitch] - movq [edx], mm4 - movq [edx+8], mm5 - pop edx -%endif -.SKIP_PROCESS: - mov ecx, [ebp+deltaPtr] - add ecx, 8 - mov [ebp+deltaPtr], ecx - add edx, 16 - add eax, 8 - - pop ecx - sub ecx, 4 - cmp ecx, 0 - jg .Loop - -; Restore some stuff - popad - mov esp, ebp - pop ebp - emms - ret - - -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- - - -;This is version 0.50 -colorI equ -2 -colorE equ 0 -colorF equ 2 -colorJ equ 4 - -colorG equ -2 -colorA equ 0 -colorB equ 2 -colorK equ 4 - -colorH equ -2 -colorC equ 0 -colorD equ 2 -colorL equ 4 - -colorM equ -2 -colorN equ 0 -colorO equ 2 -colorP equ 4 - -NEWSYM _2xSaILineW -; Store some stuff - push ebp - mov ebp, esp - pushad - -; Prepare the destination -%ifdef __DJGPP__ - ; Set the selector - mov eax, [ebp+dstSegment] - mov fs, ax -%endif - mov edx, [ebp+dstOffset] ; edx points to the screen -; Prepare the source - ; eax points to colorA - mov eax, [ebp+srcPtr] - mov ebx, [ebp+srcPitch] - mov ecx, [ebp+width] - ; eax now points to colorE - sub eax, ebx - - -; Main Loop -.Loop: push ecx - - ;-----Check Delta------------------ - mov ecx, [ebp+deltaPtr] - - movq mm0, [eax+colorI] - movq mm1, [eax+colorJ] - movq mm2, [eax+ebx+colorG] - movq mm3, [eax+ebx+colorK] - movq mm4, [eax+ebx+ebx+colorH] - movq mm5, [eax+ebx+ebx+colorL] - push eax - add eax, ebx - movq mm6, [eax+ebx+ebx+colorM] - movq mm7, [eax+ebx+ebx+colorP] - pop eax - - pcmpeqw mm0, [ecx+2+colorI] - pcmpeqw mm1, [ecx+2+colorK] - pcmpeqw mm2, [ecx+ebx+2+colorG] - pcmpeqw mm3, [ecx+ebx+2+colorK] - pcmpeqw mm4, [ecx+ebx+ebx+2+colorH] - pcmpeqw mm5, [ecx+ebx+ebx+2+colorL] - add ecx, ebx - pcmpeqw mm6, [ecx+ebx+ebx+2+colorM] - pcmpeqw mm7, [ecx+ebx+ebx+2+colorP] - sub ecx, ebx - - - pand mm0, mm1 - pand mm2, mm3 - pand mm4, mm5 - pand mm6, mm7 - pand mm0, mm2 - pand mm4, mm6 - pxor mm7, mm7 - pand mm0, mm4 - movq mm6, [eax+colorI] - pcmpeqw mm7, mm0 - - movq [ecx+2+colorI], mm6 - - packsswb mm7, mm7 - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_PROCESS - - ;End Delta - - ;--------------------------------- - - -;1 - ;if ((colorA == colorD) && (colorB != colorC) && (colorA == colorE) && (colorB == colorL) - movq mm0, [eax+ebx+colorA] ;mm0 and mm1 contain colorA - movq mm2, [eax+ebx+colorB] ;mm2 and mm3 contain colorB - - movq mm1, mm0 - movq mm3, mm2 - - pcmpeqw mm0, [eax+ebx+ebx+colorD] - pcmpeqw mm1, [eax+colorE] - pcmpeqw mm2, [eax+ebx+ebx+colorL] - pcmpeqw mm3, [eax+ebx+ebx+colorC] - - pand mm0, mm1 - pxor mm1, mm1 - pand mm0, mm2 - pcmpeqw mm3, mm1 - pand mm0, mm3 ;result in mm0 - - ;if ((colorA == colorC) && (colorB != colorE) && (colorA == colorF) && (colorB == colorJ) - movq mm4, [eax+ebx+colorA] ;mm4 and mm5 contain colorA - movq mm6, [eax+ebx+colorB] ;mm6 and mm7 contain colorB - movq mm5, mm4 - movq mm7, mm6 - - pcmpeqw mm4, [eax+ebx+ebx+colorC] - pcmpeqw mm5, [eax+colorF] - pcmpeqw mm6, [eax+colorJ] - pcmpeqw mm7, [eax+colorE] - - pand mm4, mm5 - pxor mm5, mm5 - pand mm4, mm6 - pcmpeqw mm7, mm5 - pand mm4, mm7 ;result in mm4 - - por mm0, mm4 ;combine the masks - movq [Mask1], mm0 - - ;-------------------------------------------- - -;2 - ;if ((colorB == colorC) && (colorA != colorD) && (colorB == colorF) && (colorA == colorH) - movq mm0, [eax+ebx+colorB] ;mm0 and mm1 contain colorB - movq mm2, [eax+ebx+colorA] ;mm2 and mm3 contain colorA - movq mm1, mm0 - movq mm3, mm2 - - pcmpeqw mm0, [eax+ebx+ebx+colorC] - pcmpeqw mm1, [eax+colorF] - pcmpeqw mm2, [eax+ebx+ebx+colorH] - pcmpeqw mm3, [eax+ebx+ebx+colorD] - - pand mm0, mm1 - pxor mm1, mm1 - pand mm0, mm2 - pcmpeqw mm3, mm1 - pand mm0, mm3 ;result in mm0 - - ;if ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI) - movq mm4, [eax+ebx+colorB] ;mm4 and mm5 contain colorB - movq mm6, [eax+ebx+colorA] ;mm6 and mm7 contain colorA - movq mm5, mm4 - movq mm7, mm6 - - pcmpeqw mm4, [eax+ebx+ebx+colorD] - pcmpeqw mm5, [eax+colorE] - pcmpeqw mm6, [eax+colorI] - pcmpeqw mm7, [eax+colorF] - - pand mm4, mm5 - pxor mm5, mm5 - pand mm4, mm6 - pcmpeqw mm7, mm5 - pand mm4, mm7 ;result in mm4 - - por mm0, mm4 ;combine the masks - movq [Mask2], mm0 - - -;interpolate colorA and colorB - movq mm0, [eax+ebx+colorA] - movq mm1, [eax+ebx+colorB] - - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - - ;assemble the pixels - movq mm1, [eax+ebx+colorA] - movq mm2, [eax+ebx+colorB] - - movq mm3, [Mask1] - movq mm5, mm1 - movq mm4, [Mask2] - movq mm6, mm1 - - pand mm1, mm3 - por mm3, mm4 - pxor mm7, mm7 - pand mm2, mm4 - - pcmpeqw mm3, mm7 - por mm1, mm2 - pand mm0, mm3 - - por mm0, mm1 - - punpcklwd mm5, mm0 - punpckhwd mm6, mm0 - -%ifdef __DJGPP__ - movq [fs:edx], mm5 - movq [fs:edx+8], mm6 -%else - movq [edx], mm5 - movq [edx+8], mm6 -%endif - -;------------------------------------------------ -; Create the Nextline -;------------------------------------------------ -;3 ;if ((colorA == colorD) && (colorB != colorC) && (colorA == colorG) && (colorC == colorO) - movq mm0, [eax+ebx+colorA] ;mm0 and mm1 contain colorA - movq mm2, [eax+ebx+ebx+colorC] ;mm2 and mm3 contain colorC - movq mm1, mm0 - movq mm3, mm2 - - push eax - add eax, ebx - pcmpeqw mm0, [eax+ebx+colorD] - pcmpeqw mm1, [eax+colorG] - pcmpeqw mm2, [eax+ebx+ebx+colorO] - pcmpeqw mm3, [eax+colorB] - pop eax - - pand mm0, mm1 - pxor mm1, mm1 - pand mm0, mm2 - pcmpeqw mm3, mm1 - pand mm0, mm3 ;result in mm0 - - ;if ((colorA == colorB) && (colorG != colorC) && (colorA == colorH) && (colorC == colorM) - movq mm4, [eax+ebx+colorA] ;mm4 and mm5 contain colorA - movq mm6, [eax+ebx+ebx+colorC] ;mm6 and mm7 contain colorC - movq mm5, mm4 - movq mm7, mm6 - - push eax - add eax, ebx - pcmpeqw mm4, [eax+ebx+colorH] - pcmpeqw mm5, [eax+colorB] - pcmpeqw mm6, [eax+ebx+ebx+colorM] - pcmpeqw mm7, [eax+colorG] - pop eax - - pand mm4, mm5 - pxor mm5, mm5 - pand mm4, mm6 - pcmpeqw mm7, mm5 - pand mm4, mm7 ;result in mm4 - - por mm0, mm4 ;combine the masks - movq [Mask1], mm0 - ;-------------------------------------------- - -;4 - ;if ((colorB == colorC) && (colorA != colorD) && (colorC == colorH) && (colorA == colorF) - movq mm0, [eax+ebx+ebx+colorC] ;mm0 and mm1 contain colorC - movq mm2, [eax+ebx+colorA] ;mm2 and mm3 contain colorA - movq mm1, mm0 - movq mm3, mm2 - - pcmpeqw mm0, [eax+ebx+colorB] - pcmpeqw mm1, [eax+ebx+ebx+colorH] - pcmpeqw mm2, [eax+colorF] - pcmpeqw mm3, [eax+ebx+ebx+colorD] - - pand mm0, mm1 - pxor mm1, mm1 - pand mm0, mm2 - pcmpeqw mm3, mm1 - pand mm0, mm3 ;result in mm0 - - ;if ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI) - movq mm4, [eax+ebx+ebx+colorC] ;mm4 and mm5 contain colorC - movq mm6, [eax+ebx+colorA] ;mm6 and mm7 contain colorA - movq mm5, mm4 - movq mm7, mm6 - - pcmpeqw mm4, [eax+ebx+ebx+colorD] - pcmpeqw mm5, [eax+ebx+colorG] - pcmpeqw mm6, [eax+colorI] - pcmpeqw mm7, [eax+ebx+ebx+colorH] - - pand mm4, mm5 - pxor mm5, mm5 - pand mm4, mm6 - pcmpeqw mm7, mm5 - pand mm4, mm7 ;result in mm4 - - por mm0, mm4 ;combine the masks - movq [Mask2], mm0 - ;---------------------------------------------- - -;interpolate colorA and colorC - movq mm0, [eax+ebx+colorA] - movq mm1, [eax+ebx+ebx+colorC] - - movq mm2, mm0 - movq mm3, mm1 - - pand mm0, [colorMask] - pand mm1, [colorMask] - - psrlw mm0, 1 - psrlw mm1, 1 - - pand mm3, [lowPixelMask] - paddw mm0, mm1 - - pand mm3, mm2 - paddw mm0, mm3 ;mm0 contains the interpolated values - ;------------- - - ;assemble the pixels - movq mm1, [eax+ebx+colorA] - movq mm2, [eax+ebx+ebx+colorC] - - movq mm3, [Mask1] - movq mm4, [Mask2] - - pand mm1, mm3 - pand mm2, mm4 - - por mm3, mm4 - pxor mm7, mm7 - por mm1, mm2 - - pcmpeqw mm3, mm7 - pand mm0, mm3 - por mm0, mm1 - movq [ACPixel], mm0 - -;//////////////////////////////// -; Decide which "branch" to take -;-------------------------------- - movq mm0, [eax+ebx+colorA] - movq mm1, [eax+ebx+colorB] - movq mm6, mm0 - movq mm7, mm1 - pcmpeqw mm0, [eax+ebx+ebx+colorD] - pcmpeqw mm1, [eax+ebx+ebx+colorC] - pcmpeqw mm6, mm7 - - movq mm2, mm0 - movq mm3, mm0 - - pand mm0, mm1 ;colorA == colorD && colorB == colorC - pxor mm7, mm7 - - pcmpeqw mm2, mm7 - pand mm6, mm0 - pand mm2, mm1 ;colorA != colorD && colorB == colorC - - pcmpeqw mm1, mm7 - - pand mm1, mm3 ;colorA == colorD && colorB != colorC - pxor mm0, mm6 - por mm1, mm6 - movq mm7, mm0 - movq [Mask2], mm2 - packsswb mm7, mm7 - movq [Mask1], mm1 - - movd ecx, mm7 - test ecx, ecx - jz near .SKIP_GUESS -;--------------------------------------------- -; Map of the pixels: I|E F|J -; G|A B|K -; H|C D|L -; M|N O|P - movq mm6, mm0 - movq mm4, [eax+ebx+colorA] - movq mm5, [eax+ebx+colorB] - pxor mm7, mm7 - pand mm6, [ONE] - - movq mm0, [eax+colorE] - movq mm1, [eax+ebx+colorG] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+colorF] - movq mm1, [eax+ebx+colorK] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - push eax - add eax, ebx - movq mm0, [eax+ebx+colorH] - movq mm1, [eax+ebx+ebx+colorN] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - movq mm0, [eax+ebx+colorL] - movq mm1, [eax+ebx+ebx+colorO] - movq mm2, mm0 - movq mm3, mm1 - pcmpeqw mm0, mm4 - pcmpeqw mm1, mm4 - pcmpeqw mm2, mm5 - pcmpeqw mm3, mm5 - pand mm0, mm6 - pand mm1, mm6 - pand mm2, mm6 - pand mm3, mm6 - paddw mm0, mm1 - paddw mm2, mm3 - - pxor mm3, mm3 - pcmpgtw mm0, mm6 - pcmpgtw mm2, mm6 - pcmpeqw mm0, mm3 - pcmpeqw mm2, mm3 - pand mm0, mm6 - pand mm2, mm6 - paddw mm7, mm0 - psubw mm7, mm2 - - pop eax - movq mm1, mm7 - pxor mm0, mm0 - pcmpgtw mm7, mm0 - pcmpgtw mm0, mm1 - - por mm7, [Mask1] - por mm0, [Mask2] - movq [Mask1], mm7 - movq [Mask2], mm0 - -.SKIP_GUESS: - ;---------------------------- - ;interpolate A, B, C and D - movq mm0, [eax+ebx+colorA] - movq mm1, [eax+ebx+colorB] - movq mm4, mm0 - movq mm2, [eax+ebx+ebx+colorC] - movq mm5, mm1 - movq mm3, [qcolorMask] - movq mm6, mm2 - movq mm7, [qlowpixelMask] - - pand mm0, mm3 - pand mm1, mm3 - pand mm2, mm3 - pand mm3, [eax+ebx+ebx+colorD] - - psrlw mm0, 2 - pand mm4, mm7 - psrlw mm1, 2 - pand mm5, mm7 - psrlw mm2, 2 - pand mm6, mm7 - psrlw mm3, 2 - pand mm7, [eax+ebx+ebx+colorD] - - paddw mm0, mm1 - paddw mm2, mm3 - - paddw mm4, mm5 - paddw mm6, mm7 - - paddw mm4, mm6 - paddw mm0, mm2 - psrlw mm4, 2 - pand mm4, [qlowpixelMask] - paddw mm0, mm4 ;mm0 contains the interpolated value of A, B, C and D - -;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ - ;assemble the pixels - movq mm1, [Mask1] - movq mm2, [Mask2] - movq mm4, [eax+ebx+colorA] - movq mm5, [eax+ebx+colorB] - pand mm4, mm1 - pand mm5, mm2 - - pxor mm7, mm7 - por mm1, mm2 - por mm4, mm5 - pcmpeqw mm1, mm7 - pand mm0, mm1 - por mm4, mm0 ;mm4 contains the diagonal pixels - - movq mm0, [ACPixel] - movq mm1, mm0 - punpcklwd mm0, mm4 - punpckhwd mm1, mm4 - - push edx - add edx, [ebp+dstPitch] - -%ifdef __DJGPP__ - movq [fs:edx], mm0 - movq [fs:edx+8], mm1 -%else - movq [edx], mm0 - movq [edx+8], mm1 -%endif - pop edx - -.SKIP_PROCESS: - mov ecx, [ebp+deltaPtr] - add ecx, 8 - mov [ebp+deltaPtr], ecx - add edx, 16 - add eax, 8 - - pop ecx - sub ecx, 4 - cmp ecx, 0 - jg .Loop - -; Restore some stuff - popad - mov esp, ebp - pop ebp - emms - ret - -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- - -NEWSYM Init_2xSaIMMXW -; Store some stuff - push ebp - mov ebp, esp - push edx - - -;Damn thing doesn't work -; mov eax,1 -; cpuid -; test edx, 0x00800000 ;test bit 23 -; jz end2 ;bit not set => no MMX detected - - mov eax, [ebp+8] ;PixelFormat - cmp eax, 555 - jz Bits555 - cmp eax, 565 - jz Bits565 -end2: - mov eax, 1 - jmp end1 -Bits555: - mov edx, 0x7BDE7BDE - mov eax, colorMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x04210421 - mov eax, lowPixelMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x739C739C - mov eax, qcolorMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x0C630C63 - mov eax, qlowpixelMask - mov [eax], edx - mov [eax+4], edx - mov eax, 0 - jmp end1 -Bits565: - mov edx, 0xF7DEF7DE - mov eax, colorMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x08210821 - mov eax, lowPixelMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0xE79CE79C - mov eax, qcolorMask - mov [eax], edx - mov [eax+4], edx - mov edx, 0x18631863 - mov eax, qlowpixelMask - mov [eax], edx - mov [eax+4], edx - mov eax, 0 - jmp end1 -end1: - pop edx - mov esp, ebp - pop ebp - ret - - -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- -;------------------------------------------------------------------------- - -SECTION .data -;Some constants -colorMask dd 0xF7DEF7DE, 0xF7DEF7DE -lowPixelMask dd 0x08210821, 0x08210821 - -qcolorMask dd 0xE79CE79C, 0xE79CE79C -qlowpixelMask dd 0x18631863, 0x18631863 - -FALSE dd 0x00000000, 0x00000000 -TRUE dd 0xffffffff, 0xffffffff -ONE dd 0x00010001, 0x00010001 - - -SECTION .bss -ACPixel resb 8 -Mask1 resb 8 -Mask2 resb 8 - -I56Pixel resb 8 -I23Pixel resb 8 -I5556Pixel resb 8 -I2223Pixel resb 8 -I5666Pixel resb 8 -I2333Pixel resb 8 -Mask26 resb 8 -Mask35 resb 8 -Mask26b resb 8 -Mask35b resb 8 -product1a resb 8 -product1b resb 8 -product2a resb 8 -product2b resb 8 -final1a resb 8 -final1b resb 8 -final2a resb 8 -final2b resb 8 diff --git a/tools/zsnes/src/video/copyvid.inc b/tools/zsnes/src/video/copyvid.inc deleted file mode 100644 index e6e9d9d..0000000 --- a/tools/zsnes/src/video/copyvid.inc +++ /dev/null @@ -1,6605 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 MMXStuff 0 -%%1 - movq mm0,[esi] - movq [es:edi],mm0 - movq mm1,[esi+8] - movq [es:edi+8],mm1 - add esi,16 - add edi,16 - dec ecx - jnz %%1 -%endmacro - -%macro FilterTest 1 - cmp byte[GUIOn],1 - jne %%nogui - cmp byte[FilteredGUI],1 - jne %%nofilter -%%nogui - cmp byte[antienab],1 - je near %1 -%%nofilter -%endmacro - - -; Blends two 16-bit pixels at 50%. - -; ax = first pixel, bx = second pixel -; ax (after) = resulting pixel - -%macro SSHalfBlend 0 - shr eax,byte 1 - shr ebx,byte 1 - and eax,7befh - and ebx,7befh - add eax,ebx -%endmacro - - -; Horizontal recursive anti-aliasing, -; blurs edges without increasing size. - -; ax = current pixel, bx = working pixel -; ecx = number of pixels (passed) - -%macro SSInterpLineH 0 - mov ax,[esi] - mov [es:edi],ax - add esi,byte 2 - add edi,byte 2 - mov ecx,254 -%%loop - mov ax,[esi] - mov bx,[esi-2] - cmp ax,bx - jne %%loop2 - mov [es:edi],ax - mov [es:edi-2],bx - jmp %%loop3 -%%loop2 - SSHalfBlend - mov [es:edi],ax - mov [es:edi-2],ax -%%loop3 - add esi,byte 2 - add edi,byte 2 - dec ecx - jnz %%loop - mov ax,[esi] - mov [es:edi],ax - add esi,byte 2 - add edi,byte 2 -%endmacro - - -; Used for 640x400 16bit... - -; Kills the vertical stretch effect. - -; ax = current pixel, bx = working pixel -; ecx = number of pixels (passed) - -%macro SSInterpLineV 0 -%%loop - mov ax,[esi] - mov bx,[esi-(288*2)] - cmp ax,bx - je %%loop2 - SSHalfBlend -%%loop2 - mov [es:edi],ax - mov [es:edi+2],ax - add esi,byte 2 - add edi,byte 4 - dec ecx - jnz %%loop -%endmacro - - -; True high-resolution interpolation. - -; Don't forget to skip every other line -; (on the screen, not in vidbuffer). - -; ax = current pixel, bx = working pixel -; ecx = number of pixels (passed) - -%macro SSInterpFull 1 -%%loop - mov ax,[esi] - mov [es:edi],ax - mov bx,[esi+2] - SSHalfBlend - mov [es:edi+2],ax - mov ax,[esi] - mov bx,[esi+(288*2)] - SSHalfBlend - mov [es:edi+(%1*2)],ax - mov ax,[esi] - mov bx,[esi+(288*2)+2] - SSHalfBlend - mov [es:edi+(%1*2)+2],ax - add esi,byte 2 - add edi,byte 4 - dec ecx - jnz %%loop -%endmacro - - -%macro FlipCheck 0 - cmp byte[FlipWait],0 - je %%noflip - mov edx,3DAh ;VGA status port - in al,dx - test al,8 - jz %%noflip - mov eax,4F07h - mov bh,00h - mov bl,00h - xor ecx,ecx - mov dx,[NextLineStart] - mov [LastLineStart],dx - int 10h - mov byte[FlipWait],0 -%%noflip -%endmacro - - -SECTION .text - -NEWSYM ResetTripleBuf - mov byte[FlipWait],0 - mov dword[VidStartDraw],0 - mov byte[CVidStartAd],0 - ret - -%ifdef __MSDOS__ -GUITripleBuffer: - cmp byte[TriplebufTech],0 - je near .tech2 - cmp byte[ApplyStart],0 - je .notstartedb - mov byte[ApplyStart],0 - cmp word[LastLineStart],0 - je .notstartedb - mov eax,4F07h - mov bh,00h - mov bl,00h - xor ecx,ecx - xor edx,edx - int 10h -.notstartedb - mov byte[FlipWait],0 - mov dword[VidStartDraw],0 - mov byte[CVidStartAd],0 - mov dword[LastLineStart],0 - ret - -.tech2 - xor ecx,ecx - mov cl,[cvidmode] - cmp byte[VidModeComp+ecx],0 - je .notbuf - cmp byte[Triplebufen],0 - je .notbuf - jmp .yestbuf -.notbuf - ret -.yestbuf - cmp byte[ApplyStart],0 - je .notstarted - mov eax,4F07h - mov bh,00h - mov bl,02h - xor ecx,ecx - xor edx,edx - int 10h - cmp byte[ApplyStart],4 - jne .nocheck - cmp al,4Fh - jne .failed - cmp ah,0 - ja .failed -.nocheck - mov dword[VidStartDraw],0 - mov byte[CVidStartAd],0 - mov byte[ApplyStart],0 -.notstarted - ret -.failed - mov byte[TriplebufTech],1 - ret - -PostTripleBuffer: - xor ecx,ecx - mov cl,[cvidmode] - cmp byte[VidModeComp+ecx],0 - je .notbuf - cmp byte[Triplebufen],0 - je .notbuf - jmp .yestbuf -.notbuf - ret -.yestbuf - xor ecx,ecx - cmp byte[CVidStartAd],2 - je .nooffset0 - mov cl,[cvidmode] - mov ecx,[VidModeSize+ecx*4] - cmp byte[CVidStartAd],0 - je .nooffset0 - add ecx,ecx -.nooffset0 - mov [VidStartDraw],ecx - inc byte[CVidStartAd] - cmp byte[CVidStartAd],3 - jne .notof - mov byte[CVidStartAd],0 -.notof - ret - -PreTripleBuffer2: - cmp byte[TriplebufTech],0 - je near PreTripleBuffer - xor ecx,ecx - mov cl,[cvidmode] - cmp byte[VidModeComp+ecx],0 - je .notbuf - cmp byte[Triplebufen],0 - jne .yestbuf -.notbuf - ret -.yestbuf - cmp byte[FlipWait],0 - je .noflip - mov edx,3DAh ;VGA status port -.loop - in al,dx - test al,8 - jz .loop - mov eax,4F07h - mov bh,00h - mov bl,00h - xor ecx,ecx - mov dx,[NextLineStart] - mov [LastLineStart],dx - int 10h - mov byte[FlipWait],0 -.noflip - xor ecx,ecx - cmp byte[CVidStartAd],2 - je .nooffset0 - mov cl,[cvidmode] - mov ecx,[VidModeLine+ecx*4] - cmp byte[CVidStartAd],0 - je .nooffset0 - add ecx,ecx -.nooffset0 - mov [NextLineStart],ecx - mov byte[ApplyStart],1 - mov byte[FlipWait],1 - ret - -PreTripleBuffer: - xor ecx,ecx - mov cl,[cvidmode] - cmp byte[VidModeComp+ecx],0 - je .notbuf - cmp byte[Triplebufen],0 - jne .yestbuf -.notbuf - ret -.yestbuf - cmp byte[ApplyStart],2 - jne .noflip -.notflipped -; *** I have no idea why this code doesn't work (freezes on NVidia cards) -; mov eax,4F07h -; mov bx,04h -; int 10h -; or ah,ah -; jnz .noflip -; or cx,cx -; jz .notflipped -.noflip - mov eax,4F07h - mov bh,00h - mov bl,02h - xor ecx,ecx - cmp byte[CVidStartAd],0 - je .nooffset0 - mov cl,[cvidmode] - mov ecx,[VidModeSize+ecx*4] - cmp byte[CVidStartAd],1 - je .nooffset0 - add ecx,ecx -.nooffset0 - xor edx,edx - int 10h - cmp byte[ApplyStart],4 - jne .nocheck - cmp al,4Fh - jne .failed - cmp ah,0 - ja .failed - mov byte[ApplyStart],0 -.nocheck - cmp byte[ApplyStart],2 - je .skipcheckb - inc byte[ApplyStart] -.skipcheckb - ret -.failed - mov byte[Triplebufen],0 - ret -%endif - -SECTION .data -; Please don't break this again. :) -VidModeSize dd 0,0,0,0,0,0,0,320*240,320*240*2,320*480,320*480*2,512*384 - dd 512*384*2,640*400,640*400*2,640*480,640*480*2,800*600,800*600*2 -VidModeLine dd 0,0,0,0,0,0,0,240,240,480,480,384,384,400,400,480,480,600,600 -NEWSYM VidStartDraw, dd 0 -VidModeComp db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1 -CVidStartAd db 0 -ApplyStart db 4 - -SECTION .bss -NEWSYM NextLineStart, resd 1 -NEWSYM LastLineStart, resd 1 -NEWSYM FlipWait, resb 1 -NEWSYM TriplebufTech, resb 1 -SECTION .text - -%ifdef __MSDOS__ -NEWSYM DosDrawScreen - cmp byte[curblank],40h - je .nocopy - call PreTripleBuffer2 - call PostTripleBuffer -.nocopy - call ScreenShow - FlipCheck - ret - -NEWSYM DosDrawScreenB - cmp byte[curblank],40h - je .nocopy - call GUITripleBuffer -.nocopy - call ScreenShow - ret - -ScreenShow: - cmp byte[debugdisble],0 - je .debug - cmp byte[cvidmode],2 - je near copymodeq256 -.debug - cmp byte[cvidmode],0 - je near copymodeq224 - cmp byte[cvidmode],1 - je near copymodeq240 - cmp byte[cvidmode],3 - je near copymodex224 - cmp byte[cvidmode],4 - je near copymodex240 - cmp byte[cvidmode],5 - je near copymodex256 - cmp byte[cvidmode],6 - je near copyvesa12640x480x16b - cmp byte[cvidmode],7 - je near copyvesa2320x240x8b - cmp byte[cvidmode],8 - je near copyvesa2320x240x16b - cmp byte[cvidmode],9 - je near copyvesa2320x480x8b - cmp byte[cvidmode],10 - je near copyvesa2320x480x16b - cmp byte[cvidmode],11 - je near copyvesa2512x384x8b - cmp byte[cvidmode],12 - je near copyvesa2512x384x16b - cmp byte[cvidmode],13 - je near copyvesa2640x400x8b - cmp byte[cvidmode],14 - je near copyvesa2640x400x16b - cmp byte[cvidmode],15 - je near copyvesa2640x480x8b - cmp byte[cvidmode],16 - je near copyvesa2640x480x16b - cmp byte[cvidmode],17 - je near copyvesa2800x600x8b - cmp byte[cvidmode],18 - je near copyvesa2800x600x16b - cmp byte[curblank],40h - jne .startcopy - inc byte[curfps2] -; call sounddisplay - call hextestoutput -.startcopy - jmp copymodeq256 - -;NEWSYM dosvidpastecopyscr -; cmp byte[curblank],40h -; je .nocopy -; call GUITripleBuffer -;.nocopy -; call ScreenShowGUI -; ret - -;ScreenShowGUI: -; cmp byte[cvidmode],0 -; je near copymodeq224 -; cmp byte[cvidmode],1 -; je near copymodeq240 -; cmp byte[cvidmode],2 -; je near copymodeq256 -; cmp byte[cvidmode],3 -; je near copymodex224 -; cmp byte[cvidmode],4 -; je near copymodex240 -; cmp byte[cvidmode],5 -; je near copymodex256 -; cmp byte[cvidmode],6 -; je near copyvesa12640x480x16bgui -; cmp byte[cvidmode],7 -; je near copyvesa2320x240x8b -; cmp byte[cvidmode],8 -; je near copyvesa2320x240x16bgui -; cmp byte[cvidmode],9 -; je near copyvesa2320x480x8bgui -; cmp byte[cvidmode],10 -; je near copyvesa2320x480x16bgui -; cmp byte[cvidmode],11 -; je near copyvesa2512x384x8b -; cmp byte[cvidmode],12 -; je near copyvesa2512x384x16bgui -; cmp byte[cvidmode],13 -; je near copyvesa2640x400x8b -; cmp byte[cvidmode],14 -; je near copyvesa2640x400x16b -; cmp byte[cvidmode],15 -; je near copyvesa2640x480x8bgui -; cmp byte[cvidmode],16 -; je near copyvesa2640x480x16bgui -; cmp byte[cvidmode],17 -; je near copyvesa2800x600x8b -; cmp byte[cvidmode],18 -; je near copyvesa2800x600x16b -; jmp copymodeq256 -%endif - - -%ifdef __MSDOS__ -;******************************************************* -; CopyModeX 224 Copies buffer into unchained 320x224 -;******************************************************* - -NEWSYM copymodex224 - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - - ; video memory selector - push es - mov ax,[selcA000] - mov es,ax - - mov esi,[vidbuffer] - - ; center on output screen - mov edi,(320-256)/2/4 - - ; address of first source line to copy - add esi,(16+256+16)+16 - - ; 2nd page address - mov eax,(320*225)/4 - - mov bl,224-2 - jmp copymodexloop - -;******************************************************* -; CopyModeX 240 Copies buffer into unchained 320x240 -;******************************************************* - -NEWSYM copymodex240 - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - - ; video memory selector - push es - mov ax,[selcA000] - mov es,ax - - mov esi,[vidbuffer] - - ; center on output screen - mov edi,(320-256)/2/4 - - cmp word[resolutn],224 - jne .res239 - mov edi,(8*320+32)/4 -.res239 - - ; address of first source line to copy - add esi,(16+256+16)+16 - - ; 2nd page address - mov eax,(320*240)/4 - - mov bl,[resolutn] - sub bl,2 - jmp copymodexloop - -;******************************************************* -; CopyModeX 256 Copies buffer into unchained 320x256 -;******************************************************* - -NEWSYM copymodex256 - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - - ; video memory selector - push es - mov ax,[selcA000] - mov es,ax - - mov esi,[vidbuffer] - - ; center on output screen - mov edi,(8*320+(320-256)/2)/4 - - cmp word[resolutn],224 - jne .res239 - mov edi,(16*320+(320-256)/2)/4 -.res239 - - ; address of first source line to copy - add esi,(16+256+16)+16 - - ; 2nd page address - mov eax,(320*256)/4 - - mov bl,[resolutn] - sub bl,2 - -;eax = VGA address of 2nd page -;edi = offset in current page of first line -;esi = address of first line to be copied -;bl = number of lines to copy -copymodexloop: - ; select output video page - mov bh,[whichpage] - test bh,bh - mov bh,1 - jz .pagea - xor eax,eax - mov bh,0 -.pagea - - mov [whichpage],bh - add edi,eax - mov [.pageaddress],eax - -; register allocation -; bl = line counter (0-total lines) -; bh = other line counter (descriptive, eh?) (0-8) -; ebp = plane counter -; ch = plane enable bit -; cl = 4-pixel copy counter -; edx = pixel processing & I/O address -; eax = pixel processing & I/O data - - mov edx,03C4h - -.loopa - mov ebp,4 - mov ch,1 - cmp bl,8 - mov bh,bl - jb .loopb - mov bh,8 - -.loopb - ; set write plane - mov ah,ch - add ch,ch - mov al,02h - out dx,ax - - push ebx - push edi - push esi - -.loopc - ; loop count - mov cl,16 -.loopd - mov al,[esi+8] - mov ah,[esi+12] - shl eax,16 - mov al,[esi+0] - mov ah,[esi+4] - add esi,byte 16 - mov [es:edi],eax - add edi,byte 4 - dec cl - jnz .loopd - - add esi,byte 16+16 - add edi,byte (320-256)/4 - dec bh - jnz .loopc - - pop esi - pop edi - pop ebx - - inc esi - dec ebp - jnz .loopb - - ; next line - add esi,(16+256+16)*8-4 - add edi,320*8/4 - sub bl,bh - jnz .loopa - - pop es - - ; flip pages by setting new offset - mov edx,03D4h - mov al,0Ch - mov ah,[.pageaddress+1] - out dx,ax - mov al,0Dh - mov ah,[.pageaddress] - out dx,ax - - ret - -SECTION .bss -.startesi resd 1 -.startedi resd 1 -.pageaddress resd 1 -.linecount resd 1 - -NEWSYM whichpage, resb 1 ; active page and visual page locations -SECTION .text - -;******************************************************* -; CopyModeQ 224 Copies buffer into chained 256x224 -;******************************************************* - -NEWSYM copymodeq224 - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - - ; video memory selector - push es - mov ax,[selcA000] - mov es,ax - - mov esi,[vidbuffer] - - ; center on output screen - mov edi,256 - - ; address of first source line to copy - add esi,(16+256+16)+16 - - mov bl,224-2 - jmp copymodeqloop - - -;******************************************************* -; CopyModeQ 240 Copies buffer into chained 256x240 -;******************************************************* - -NEWSYM copymodeq240 - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - - ; video memory selector - push es - mov ax,[selcA000] - mov es,ax - - mov esi,[vidbuffer] - - ; center on output screen - mov edi,256 - - cmp word[resolutn],224 - jne .res239 - mov edi,8*256+256 -.res239 - - ; address of first source line to copy - add esi,(16+256+16)+16 - - mov bl,[resolutn] - sub bl,2 - jmp copymodeqloop - - -;******************************************************** -; CopyModeQ 256 Copies buffer into chained 256x256 -;******************************************************** - -NEWSYM copymodeq256 - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - - ; video memory selector - push es - mov ax,[selcA000] - mov es,ax - - mov esi,[vidbuffer] - - ; center on output screen - mov edi,8*256+256 - - cmp word[resolutn],224 - jne .res239 - mov edi,16*256+256 -.res239 - - ; address of first source line to copy - add esi,(16+256+16)+16 - - mov bl,[resolutn] - sub bl,2 - -;edi = offset in output of first line -;esi = address of first line to be copied -;bl = number of lines to copy*dl -copymodeqloop: - cmp byte[MMXSupport],1 - je near .loopb -.loopa - mov ecx,256/4 - rep movsd - add esi,16+16 - dec bl - jnz .loopa - jmp .done -.loopb - mov ecx,256/16 - MMXStuff - add esi,16+16 - dec bl - jnz .loopb - emms - -.done - pop es - ret - - -;******************************************************* -; Copy VESA2 320x240x8b Copies buffer to 320x240x8bVBE2 -;******************************************************* -; Input: AX = 4F07h VBE Set/Get Display Start Control -; BH = 00h Reserved and must be 00h -; BL = 00h Set Display Start -; = 01h Get Display Start -; = 80h Set Display Start during Vertical -; Retrace -; CX = First Displayed Pixel In Scan Line -; (Set Display Start only) -; DX = First Displayed Scan Line (Set Display Start -; only) - -NEWSYM copyvesa2320x240x8b - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,320+32 - cmp word[resolutn],224 - jne .res239 - add edi,8*320 -.res239 - add edi,[VidStartDraw] - add esi,16+256+16+16 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[ScreenScale],1 - je .fullscreen - - cmp byte[MMXSupport],1 - je near .loopb -.loopa - mov ecx,256/4 - rep movsd - add esi,16+16 - add edi,32+32 - dec dl - jnz .loopa - jmp .done -.loopb - mov ecx,256/16 - MMXStuff - add esi,16+16 - add edi,32+32 - dec dl - jnz .loopb - emms - jmp .done - -.fullscreen - sub edi,32 -.fsloopa - mov ecx,256/4 - jmp .fsloopb -.fsloopb - mov eax,[esi] - mov [es:edi],al - mov [es:edi+1],eax - add esi,byte 4 - add edi,byte 5 - dec ecx - jnz .fsloopb - add esi,16+16 - dec dl - jnz .fsloopa - -.done - pop es - ret - - -;******************************************************* -; Copy VESA2 320x480x8b Copies buffer to 320x480x8bVBE2 -;******************************************************* - -;NEWSYM copyvesa2320x480x8bgui -; jmp copyvesa2320x480x8b -; mov byte[CurrentGUIOn],1 -; jmp copyvesa2320x480x8b.nogui - -NEWSYM copyvesa2320x480x8b -; mov byte[CurrentGUIOn],0 -; .nogui - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,320*2+32 - cmp word[resolutn],224 - jne .res239 - add edi,8*320 -.res239 - add edi,[VidStartDraw] - add esi,16+256+16+16 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[ScreenScale],1 - je near .fullscreen - cmp byte[scanlines],1 - je near .scanlines - -; cmp byte[GUIOn],1 -; je .loopa -; cmp byte[f3menuen],1 -; je .loopa -; cmp byte[ForceNewGfxOff],1 -; je .loopa -; cmp byte[newengen],1 -; je near copyvesa2320x480x8ng - - cmp byte[MMXSupport],1 - je .loopb -.loopa - mov ecx,256/4 - rep movsd - sub esi,256 - add edi,32+32 - mov ecx,256/4 - rep movsd - add esi,16+16 - add edi,32+32 - dec dl - jnz .loopa - jmp .done -.loopb - mov ecx,256/16 - MMXStuff - sub esi,256 - add edi,32+32 - mov ecx,256/16 - MMXStuff - add esi,16+16 - add edi,32+32 - dec dl - jnz .loopb - emms - jmp .done - -.scanlines - cmp byte[MMXSupport],1 - je .sloopb -.sloopa - mov ecx,256/4 - rep movsd - add esi,16+16 - add edi,32+320+32 - dec dl - jnz .sloopa - jmp .done -.sloopb - mov ecx,256/16 - MMXStuff - add esi,16+16 - add edi,32+320+32 - dec dl - jnz .sloopb - emms - jmp .done - -.fullscreen - sub edi,32 - cmp byte[scanlines],1 - je .fsloopb -.fsloopa - mov ecx,256/4 - call .fsloopc - sub esi,256 - mov ecx,256/4 - call .fsloopc - add esi,16+16 - dec dl - jnz .fsloopa - jmp .done -.fsloopb - mov ecx,256/4 - call .fsloopc - add esi,16+16 - add edi,320 - dec dl - jnz .fsloopb - jmp .done -.fsloopc - mov eax,[esi] - mov [es:edi],al - mov [es:edi+1],eax - add esi,byte 4 - add edi,byte 5 - dec ecx - jnz .fsloopc - ret - -.done - pop es - ret - - -;copyvesa2320x480x8ng: -; jmp .mode7hires -; mov ebx,1 -;.loopa -; cmp dword[ignor512],0 -; je .ignore -; test byte[intrlng+ebx],01h -; jnz near .interlaced -;.ignore -; cmp byte[Mode7HiRes],0 -; je .nomode7hires -; test byte[mosenng+ebx],1 -; jz .yesmode7hires -; cmp byte[mosszng+ebx],0 -; jne .nomode7hires -;.yesmode7hires -; test byte[intrlng+ebx],40h -; jnz .nomode7hires -; cmp byte[BGMA+ebx],7 -; jne .nomode7hires -; cmp byte[BGMA+ebx+1],7 -; je near .mode7hires -;.nomode7hires -; mov ecx,64 -;.a -; mov eax,[esi] -; mov [es:edi],eax -; add esi,4 -; add edi,4 -; dec ecx -; jnz .a -; mov ecx,64 -; add edi,64 -; sub esi,256 -;.a2r -; mov eax,[esi] -; mov [es:edi],eax -; add esi,4 -; add edi,4 -; dec ecx -; jnz .a2r -;.returnloop -; add esi,32 -; add edi,64 -; inc ebx -; dec dl -; jnz near .loopa -; pop es -; ret -; -;.mode7hires -; mov ecx,64 -;.a7 -; mov eax,[esi] -; mov [es:edi],eax -; add esi,4 -; add edi,4 -; dec ecx -; jnz .a7 -; mov ecx,64 -; add edi,64 -; add esi,75036-256 -;.a2r7 -; mov eax,[esi] -; mov [es:edi],eax -; add esi,4 -; add edi,4 -; dec ecx -; jnz .a2r7 -; sub esi,75036 -; jmp .returnloop -; -;.interlaced -; test byte[cfield],1 -; jz .b -; add edi,320 -;.b -; mov ecx,64 -;.ai -; mov eax,[esi] -; mov [es:edi],eax -; add esi,4 -; add edi,4 -; dec ecx -; jnz .ai -; test byte[cfield],1 -; jnz .bi -; add edi,320 -;.bi -; jmp .returnloop - - -;******************************************************* -; Copy VESA2 800x600x8b Copies buffer to 800x600x8bVBE2 -;******************************************************* - -NEWSYM copyvesa2800x600x8b - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,60*800+144 - cmp word[resolutn],224 - jne .res239 - add edi,8*800 -.res239 - add edi,[VidStartDraw] - add esi,16+256+16+16 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[smallscreenon],1 - je near .smallscreen - - cmp byte[scanlines],1 - je .loopa2 -.loopa - mov ecx,256/2 - call .loopa3 - sub esi,256 - add edi,144+144 - mov ecx,256/2 - call .loopa3 - add esi,16+16 - add edi,144+144 - dec dl - jnz .loopa - jmp .done -.loopa2 - mov ecx,256/2 - call .loopa3 - add esi,16+16 - add edi,144+800+144 - dec dl - jnz .loopa2 - jmp .done -.loopa3 - mov al,[esi] - mov bl,[esi+1] - mov ah,al - mov bh,bl - mov [es:edi],ax - mov [es:edi+2],bx - add esi,byte 2 - add edi,byte 4 - dec ecx - jnz .loopa3 - ret - -.smallscreen - add edi,120*800+128 - cmp byte[MMXSupport],1 - je .ssloopb -.ssloopa - mov ecx,256/4 - rep movsd - add esi,16+16 - add edi,272+272 - dec dl - jnz .ssloopa - jmp .done -.ssloopb - mov ecx,256/16 - MMXStuff - add esi,16+16 - add edi,272+272 - dec dl - jnz .ssloopb - jmp .done - -.done - pop es - ret - - -;********************************************************* -; Copy VESA2 800x600x16b Copies buffer to 800x600x16bVBE2 -;********************************************************* - -NEWSYM copyvesa2800x600x16b - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,60*800*2+144*2 - cmp word[resolutn],224 - jne .res239 - add edi,8*800*2 -.res239 - add edi,[VidStartDraw] - add esi,16*2+256*2+16*2+16*2 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[smallscreenon],1 - je near .smallscreen - - FilterTest .interpolate - - cmp byte[scanlines],1 - je .loopa2 -.loopa - mov ecx,256/2 - call .loopa3 - sub esi,256*2 - add edi,144*2+144*2 - mov ecx,256/2 - call .loopa3 - add esi,16*2+16*2 - add edi,144*2+144*2 - dec dl - jnz .loopa - jmp .done -.loopa2 - mov ecx,256/2 - call .loopa3 - add esi,16*2+16*2 - add edi,144*2+800*2+144*2 - dec dl - jnz .loopa2 - jmp .done -.loopa3 - mov ax,[esi] - mov bx,[esi+2] - mov [es:edi],ax - mov [es:edi+2],ax - mov [es:edi+4],bx - mov [es:edi+6],bx - add esi,byte 4 - add edi,byte 8 - dec ecx - jnz .loopa3 - ret - -.smallscreen - add edi,120*800*2+128*2 - cmp byte[MMXSupport],1 - je .ssloopb -.ssloopa - mov ecx,256/4*2 - rep movsd - add esi,16*2+16*2 - add edi,272*2+272*2 - dec dl - jnz .ssloopa - jmp .done -.ssloopb - mov ecx,256/16*2 - MMXStuff - add esi,16*2+16*2 - add edi,272*2+272*2 - dec dl - jnz .ssloopb - jmp .done - -.interpolate - mov ecx,256 - SSInterpFull 800 - add esi,16*2+16*2 - add edi,144*2+800*2+144*2 - dec dl - jnz near .interpolate - -.done - pop es - ret - - -;******************************************************* -; Copy VESA2 640x400x8b Copies buffer to 640x400x8bVBE2 -;******************************************************* - -NEWSYM copyvesa2640x400x8b - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,640+20*640+64 - cmp word[resolutn],224 - jne .res239 - add edi,12*640 -.res239 - add edi,[VidStartDraw] - add esi,16+256+16+16 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[ScreenScale],1 - je near .fullscreen - cmp byte[smallscreenon],1 - je near .smallscreen - -.loopa - mov ecx,256 - call .loopa2 - sub esi,256 - add edi,64+64 - mov ecx,256 - call .loopa2 - add esi,16+16 - add edi,64+64 - dec dl - jz near .done - mov ecx,256 - call .loopa2 - add esi,16+16 - add edi,64+64 - dec dl - jnz .loopa - jmp .done -.loopa2 - mov al,[esi+1] - xor ebx,ebx - mov ah,al - mov bl,[esi] - shl eax,16 - mov bh,bl - add esi,byte 2 - add eax,ebx - mov [es:edi],eax - sub ecx,byte 2 - lea edi,[edi+4] - jnz .loopa2 - ret - -.smallscreen - add edi,60*640+128 - cmp byte[MMXSupport],1 - je .ssloopb -.ssloopa - mov ecx,256/4 - rep movsd - add esi,16+16 - add edi,192+192 - dec dl - jnz .ssloopa - jmp .done -.ssloopb - mov ecx,256/16 - MMXStuff - add esi,16+16 - add edi,192+192 - dec dl - jnz .ssloopb - emms - jmp .done - -.fullscreen - sub edi,64 -.fsloopa - mov ecx,256/4 - call .fsloopb - add esi,16+16 - mov ecx,256/4 - call .fsloopb - sub esi,256 - mov ecx,256/4 - dec dl - jz near .done - call .fsloopb - add esi,16+16 - dec dl - jnz .fsloopa - jmp .done -.fsloopb - mov ebx,1 - call .fsloopc - sub esi,byte 1 - mov ebx,4 - call .fsloopc - dec ecx - jnz .fsloopb - ret -.fsloopc - mov al,[esi] - mov [es:edi],al - inc esi - mov [es:edi+1],al - add edi,byte 2 - dec ebx - jnz .fsloopc - ret - -.done - pop es - ret - - -NEWSYM copyvesa2640x400x16b - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,640*2+20*640*2+64*2 - cmp word[resolutn],224 - jne .res239 - add edi,12*640*2 -.res239 - add edi,[VidStartDraw] - add esi,16*2+256*2+16*2+16*2 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[ScreenScale],1 - je near .fullscreen - cmp byte[smallscreenon],1 - je near .smallscreen - -.loopa - mov ecx,256 - call .loopa2 - add esi,16*2+16*2 - add edi,64*2+64*2 - mov ecx,256 - SSInterpLineV - sub esi,256*2 - add edi,64*2+64*2 - dec dl - jz near .done - mov ecx,256 - call .loopa2 - add esi,16*2+16*2 - add edi,64*2+64*2 - dec dl - jnz near .loopa - jmp .done -.loopa2 - mov ax,[esi] - mov [es:edi],ax - mov [es:edi+2],ax - add esi,byte 2 - add edi,byte 4 - dec ecx - jnz .loopa2 - ret - -.smallscreen - add edi,60*640*2+128*2 - cmp byte[MMXSupport],1 - je .ssloopb -.ssloopa - mov ecx,256/4*2 - rep movsd - add esi,16*2+16*2 - add edi,192*2+192*2 - dec dl - jnz .ssloopa - jmp .done -.ssloopb - mov ecx,256/16*2 - MMXStuff - add esi,16*2+16*2 - add edi,192*2+192*2 - dec dl - jnz .ssloopb - emms - jmp .done - -.fullscreen - sub edi,64*2 -.fsloopa - mov ecx,256/4 - call .fsloopb - sub esi,256*2 - mov ecx,256/4 - call .fsloopb - add esi,16*2+16*2 - dec dl - jz near .done - mov ecx,256/4 - call .fsloopb - add esi,16*2+16*2 - dec dl - jnz .fsloopa - jmp .done -.fsloopb - mov ebx,1 - call .fsloopc - sub esi,byte 2 - mov ebx,4 - call .fsloopc - dec ecx - jnz .fsloopb - ret -.fsloopc - mov ax,[esi] - mov [es:edi],ax - mov [es:edi+2],ax - add esi,byte 2 - add edi,byte 4 - dec ebx - jnz .fsloopc - ret - -.done - pop es - ret - -;******************************************************* -; Copy VESA2 640x480x8b Copies buffer to 640x480x8bVBE2 -;******************************************************* -%endif - -SECTION .bss -NEWSYM res640, resb 1 -NEWSYM res480, resb 1 - -SECTION .data - -NEWSYM EagleHold, dd 0 -NEWSYM CurrentGUIOn, dd 0 -vesavaland dd 0,0 -mmxvalanda dd 11111111110000001111111111000000b,11111111110000001111111111000000b -mmxvalandb dd 00000000000111110000000000011111b,00000000000111110000000000011111b -SECTION .text - -%ifdef __MSDOS__ -NEWSYM copyvesa2640x480x8bgui - mov byte[CurrentGUIOn],1 - cmp byte[smallscreenon],1 - je near smallscreen640x480x8b - cmp byte[ScreenScale],1 - je near smallscreen640x480x8b.fullscreen - cmp byte[antienab],1 - je near proceagle - cmp byte[scanlines],1 - je near copyvesa2640x480x8bs - mov byte[res640],1 - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - jmp copyvesa2640x480x8b.startcopy2 - -NEWSYM copyvesa2640x480x8b - mov byte[CurrentGUIOn],0 - cmp byte[smallscreenon],1 - je near smallscreen640x480x8b - cmp byte[ScreenScale],1 - je near smallscreen640x480x8b.fullscreen - - FilterTest proceagle - - cmp byte[scanlines],1 - je near copyvesa2640x480x8bs - mov byte[res640],1 - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - cmp byte[f3menuen],1 - je .startcopy2 - cmp byte[ForceNewGfxOff],0 - jne .startcopy2 - cmp byte[newengen],0 - jne near copyvesa2640x480x8ng -.startcopy2 - mov dword[ignor512],0 - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,32*2 ; Draw @ Y from 9 to 247 - cmp word[resolutn],224 - jne .res239 - mov edi,8*640+32*2 -.res239 - add edi,[VidStartDraw] - add esi,16+256+32 - xor eax,eax - mov ebx,hirestiledat+1 - mov dl,[resolutn] - dec dl - dec dl -.loopa - cmp byte[Triplebufen],1 - je .ignorehr - cmp byte[ebx],1 - je near .yeshires -.ignorehr - mov ecx,128 -.a - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a - mov ecx,128 - add edi,64*2 - sub esi,256 -.a2r - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a2r -.returnloop - add esi,32 - add edi,64*2 - inc ebx - dec dl - jnz .loopa - pop es - cmp byte[Triplebufen],1 - je .ignorehr2 - xor byte[res512switch],1 -.ignorehr2 - ret -.yeshires - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightside - mov ecx,256 -.b - mov al,[esi] - mov [es:edi],al - mov [es:edi+640],al - inc esi - add edi,byte 2 - dec ecx - jnz .b - add edi,640 - jmp .returnloop -.rightside - mov ecx,256 -.b2 - mov al,[esi] - mov [es:edi+1],al - mov [es:edi+641],al - inc esi - add edi,byte 2 - dec ecx - jnz .b2 - add edi,640 - jmp .returnloop - -NEWSYM copyvesa2640x480x8ng - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,32*2 ; Draw @ Y from 9 to 247 - cmp word[resolutn],224 - jne .res239 - mov edi,8*640+32*2 -.res239 - add edi,[VidStartDraw] - add esi,16+256+32 - xor eax,eax - mov ebx,1 - mov dl,[resolutn] - dec dl - dec dl -.loopa - mov ecx,256 - cmp dword[ignor512],0 - je .ignore - test byte[intrlng+ebx],01h - jnz near .interlaced - cmp byte[BGMA+ebx],5 - je near .hires - cmp byte[BGMA+ebx],6 - je near .hires - cmp byte[Mode7HiRes],0 - je .nomode7hires - test byte[mosenng+ebx],1 - jz .yesmode7hires - cmp byte[mosszng+ebx],0 - jne .nomode7hires -.yesmode7hires - test byte[intrlng+ebx],40h - jnz .nomode7hires - cmp byte[BGMA+ebx],7 - jne .nomode7hires - cmp byte[BGMA+ebx+1],7 - je near .mode7hires -.nomode7hires -.ignore - mov ecx,128 -.a - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a - mov ecx,128 - add edi,64*2 - sub esi,256 -.a2r - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a2r -.returnloop - add esi,32 - add edi,64*2 ;+640 - inc ebx - dec dl - jnz near .loopa - mov dword[ignor512],0 - pop es - ret -.hires - mov ecx,128 -.a3 - mov al,[esi+1] - mov ah,[esi+75037] - shl eax,16 - mov al,[esi] - mov ah,[esi+75036] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a3 - add edi,64*2 - sub esi,256 - mov ecx,128 -.a6 - mov al,[esi+1] - mov ah,[esi+75037] - shl eax,16 - mov al,[esi] - mov ah,[esi+75036] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a6 - jmp .returnloop - -.interlaced - mov ecx,128 - cmp byte[BGMA+ebx],5 - je .hiresi - cmp byte[BGMA+ebx],6 - je .hiresi - test byte[cfield],1 - jz .b - add edi,640 -.b -.a2 - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a2 - test byte[cfield],1 - jnz .bi - add edi,640 -.bi - jmp .returnloop - -.hiresi - test byte[cfield],1 - jz .b2 - add edi,640 -.b2 -.a4 - mov al,[esi+1] - mov ah,[esi+75037] - shl eax,16 - mov al,[esi] - mov ah,[esi+75036] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a4 - test byte[cfield],1 - jnz .bi2 - add edi,640 -.bi2 - jmp .returnloop - -.mode7hires - cmp byte[mode7hr+ebx],1 - je near .mode7hiresb - mov ecx,128 -.a7 - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a7 - mov ecx,128 - add edi,64*2 - add esi,75036-256 -.a7r - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a7r - sub esi,75036 - jmp .returnloop - -.mode7hiresb - mov ecx,64 -.a7hr - mov eax,[esi] - mov [es:edi],eax - add esi,4 - add edi,4 - dec ecx - jnz .a7hr - mov ecx,64 - add esi,75036*2-256 -.a7hrb - mov eax,[esi] - mov [es:edi],eax - add esi,4 - add edi,4 - dec ecx - jnz .a7hrb - sub esi,75036*2 - add edi,64*2 - add esi,75036-256 - mov ecx,64 -.a7hrr - mov eax,[esi] - mov [es:edi],eax - add esi,4 - add edi,4 - dec ecx - jnz .a7hrr - mov ecx,64 - add esi,75036*2-256 -.a7hrbr - mov eax,[esi] - mov [es:edi],eax - add esi,4 - add edi,4 - dec ecx - jnz .a7hrbr - sub esi,75036*3 - jmp .returnloop - -NEWSYM smallscreen640x480x8b - mov byte[res640],0 - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,32*2 ; Draw @ Y from 9 to 247 - cmp word[resolutn],224 - jne .res239 - mov edi,8*640+32*2 -.res239 - add edi,[VidStartDraw] - add edi,128+120*640 - add esi,16+256+32 - xor eax,eax - mov ebx,hirestiledat+1 - mov dl,[resolutn] - dec dl - dec dl -.loopa - mov ecx,64 - rep movsd - add esi,32 - add edi,640-256 - inc ebx - dec dl - jnz .loopa - pop es - ret - -.fullscreen - cmp byte[curblank],40h - jne .startcopy2 - ret -.startcopy2 - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - xor edi,edi - cmp word[resolutn],224 - jne .res239b - mov edi,8*640 -.res239b - add edi,[VidStartDraw] - add esi,16+256+32 - xor eax,eax - mov ebx,hirestiledat+1 - mov dl,[resolutn] - dec dl - dec dl - cmp byte[scanlines],1 - je near .scanlines -.loopa3 - mov ecx,128 -.loopa2 - mov al,[esi] - mov [es:edi],al - mov [es:edi+1],al - mov [es:edi+640],al - mov [es:edi+641],al - mov al,[esi+1] - mov [es:edi+2],al - mov [es:edi+3],al - mov [es:edi+4],al - mov [es:edi+642],al - mov [es:edi+643],al - mov [es:edi+644],al - add esi,byte 2 - add edi,5 - dec ecx - jnz .loopa2 - add esi,32 - add edi,640 - inc ebx - dec dl - jnz .loopa3 - pop es - ret - -.scanlines -.loopa5 - mov ecx,128 -.loopa4 - mov al,[esi] - mov [es:edi],al - mov [es:edi+1],al - mov al,[esi+1] - mov [es:edi+2],al - mov [es:edi+3],al - mov [es:edi+4],al - add esi,byte 2 - add edi,5 - dec ecx - jnz .loopa4 - add esi,32 - add edi,640 - inc ebx - dec dl - jnz .loopa5 - pop es - ret - -NEWSYM copyvesa2640x480x8bs - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - mov byte[res640],2 - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,32*2 ; Draw @ Y from 9 to 247 - cmp word[resolutn],224 - jne .res239 - mov edi,8*640+32*2 -.res239 - add edi,[VidStartDraw] - add esi,16+256+32 - xor eax,eax - mov ebx,hirestiledat+1 - mov dl,[resolutn] - dec dl - dec dl - cmp byte[CurrentGUIOn],1 - je .loopa - cmp byte[ForceNewGfxOff],0 - jne .loopa - cmp byte[newengen],0 - jne near copyvesa2640x480x8bsng -.loopa - cmp byte[Triplebufen],1 - je .ignorehr - cmp byte[ebx],1 - je .yeshires -.ignorehr - mov ecx,256 -.a - mov al,[esi] - mov [es:edi],al - inc esi - mov [es:edi+1],al - add edi,byte 2 - dec ecx - jnz .a -.returnloop - add esi,32 - add edi,64*2+640 - inc ebx - dec dl - jnz .loopa - pop es - cmp byte[Triplebufen],1 - je .ignorehr2 - xor byte[res512switch],1 -.ignorehr2 - ret -.yeshires - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightside - mov ecx,256 -.b - mov al,[esi] - inc esi - mov [es:edi],al - add edi,byte 2 - dec ecx - jnz .b - jmp .returnloop -.rightside - mov ecx,256 -.b2 - mov al,[esi] - inc esi - mov [es:edi+1],al - add edi,byte 2 - dec ecx - jnz .b2 - jmp .returnloop - -copyvesa2640x480x8bsng: - xor ebx,ebx -.loopa - cmp byte[BGMA+ebx],5 - je near .hires - cmp byte[BGMA+ebx],6 - je near .hires - mov ecx,128 -.a - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a -.returnloop - add esi,32 - add edi,64*2+640 - inc ebx - dec dl - jnz .loopa - pop es - xor byte[res512switch],1 - ret -.hires - mov ecx,128 -.a2 - mov al,[esi+1] - mov ah,[esi+75037] - shl eax,16 - mov al,[esi] - mov ah,[esi+75036] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a2 - jmp .returnloop - -NEWSYM proceagle - mov byte[res640],0 - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - add esi,16+256+32 - mov dl,237 - mov edi,32*2 ; Draw @ Y from 9 to 247 - cmp word[resolutn],224 - jne .res239 - mov edi,8*640+32*2 - add edi,[VidStartDraw] - mov dl,222 -.res239 - call draweagle - pop es - ret - -NEWSYM draweagle - ; copies a buffer from esi to es:edi with dl # of lines - ; This only works under vesa 2 640x480x8b mode - mov [lineleft],dl - - ; copy the first line directly - mov ecx,128 -.drawnext - mov al,[esi] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .drawnext - - dec byte[lineleft] - add edi,128 ; 512 + 128 = 640 - add esi,32 ; There are 32 extra pixels in the buffer used - ; for clipping - - xor eax,eax - xor ebx,ebx - mov edx,[spritetablea] -.drawloop - ; process EAGLE on the bottom line - ; process the first pixel - ; copy to the left pixel - mov al,[esi] - mov [edx],al - ; draw the right pixel depending on the pixels right & below - mov al,[esi+1] - mov ah,al - mov bx,[esi+288] - cmp ebx,eax - je .matchf - mov al,[esi] -.matchf - mov [edx+1],al - inc esi - add edx,2 - - ; Start drawing the in-between pixels - mov ecx,256-2 - mov bx,[esi+287] -.lineloopd - ; draw the left pixel depending on the pixels left & below - mov al,[esi-1] - mov ah,al - cmp ebx,eax - je .matchlp - mov al,[esi] -.matchlp - mov [edx],al - - ; draw the right pixel depending on the pixels right & below - mov al,[esi+1] - mov ah,al - mov bx,[esi+288] - cmp ebx,eax - je .matchrp - mov al,[esi] -.matchrp - mov [edx+1],al - ;increment the addresses - add edx,2 - inc esi - dec ecx - jnz .lineloopd - - ; process the last pixel - ; draw the left pixel depending on the pixels left & below - mov al,[esi-1] - mov ah,al - mov bx,[esi+287] - cmp ebx,eax - je .matchl - mov al,[esi] -.matchl - mov [edx],al - ; copy to the right pixel - mov al,[esi] - mov [edx+1],al - inc esi - - sub edx,510 - mov ecx,128 -.copyloop - mov eax,[edx] - mov [es:edi],eax - add edx,4 - add edi,4 - dec ecx - jnz .copyloop - xor eax,eax - - ; process EAGLE on the upper line - add edi,128 - add esi,32 - - mov edx,[spritetablea] - ; process the first pixel - ; copy to the left pixel - mov al,[esi] - mov [edx],al - ; draw the right pixel depending on the pixels right & above - mov al,[esi+1] - mov ah,al - mov bx,[esi-288] - cmp ebx,eax - je .matchf2 - mov al,[esi] -.matchf2 - mov [edx+1],al - inc esi - add edx,2 - - ; Start drawing the in-between pixels - mov ecx,256-2 - mov bx,[esi-289] - -.lineloopd2 - ; draw the left pixel depending on the pixels left & above - mov al,[esi-1] - mov ah,al - cmp ebx,eax - je .matchlp2 - mov al,[esi] -.matchlp2 - mov [edx],al - ; draw the right pixel depending on the pixels right & below - mov al,[esi+1] - mov ah,al - mov bx,[esi-288] - cmp ebx,eax - je .matchrp2 - mov al,[esi] -.matchrp2 - mov [edx+1],al - ;increment the addresses - add edx,2 - inc esi - dec ecx - jnz .lineloopd2 - - ; process the last pixel - ; draw the left pixel depending on the pixels left & above - mov al,[esi-1] - mov ah,al - mov bx,[esi-289] - cmp ebx,eax - je .matchl2 - mov al,[esi] -.matchl2 - mov [edx],al - ; copy to the right pixel - mov al,[esi] - mov [edx+1],al - inc esi - - sub edx,510 - mov ecx,128 -.copyloop2 - mov eax,[edx] - mov [es:edi],eax - add edx,4 - add edi,4 - dec ecx - jnz .copyloop2 - xor eax,eax - - sub esi,256 ; move esi back to left side of the line - add edi,128 - dec byte[lineleft] - jnz near .drawloop - - ; copy the last line directly - mov ecx,128 -.drawlast - mov al,[esi] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .drawlast - ret - -;******************************************************* -; Copy VESA2 512x384x8b Copies buffer to 512x384x8bVBE2 -;******************************************************* - -NEWSYM copyvesa2512x384x8b - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - cmp byte[smallscreenon],1 - je near .smallscreen - cmp byte[ForceNewGfxOff],0 - jne .nong16b - cmp byte[newengen],0 - jne near copyvesa2512x384x8ng -.nong16b - mov dword[ignor512],0 - push es - mov byte[.lastrep],0 - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov byte[.scratio],61 ; 60.6695 - cmp word[resolutn],224 - jne .res239 - mov byte[.scratio],72 ; 72.4286 -.res239 - mov edi,[VidStartDraw] - add esi,16+256+32 - xor eax,eax - mov ebx,hirestiledat+1 - mov dl,[resolutn] - dec dl - dec dl - xor dh,dh -.loopa - mov al,[ebx] - mov [.p512],al - cmp byte[Triplebufen],1 - je .ignorehr - cmp al,1 - je near .yeshires -.ignorehr - mov ecx,128 -.a - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a -.returnloop - cmp byte[.lastrep],1 - je .no2 - sub dh,[.scratio] - jnc .no2 - add dh,100 - sub esi,256 - mov al,[.p512] - mov [ebx],al - inc dl - dec ebx - mov byte[.lastrep],1 - jmp .yes2 -.no2 - mov byte[.lastrep],0 - add esi,32 -.yes2 - inc ebx - dec dl - jnz .loopa - pop es - cmp byte[Triplebufen],1 - je .ignorehr2 - xor byte[res512switch],1 -.ignorehr2 - ret -.yeshires - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightside - mov ecx,256 -.b - mov al,[esi] - inc esi - mov [es:edi],al - add edi,byte 2 - dec ecx - jnz .b - jmp .returnloop -.rightside - mov ecx,256 -.b2 - mov al,[esi] - inc esi - mov [es:edi+1],al - add edi,byte 2 - dec ecx - jnz .b2 - jmp .returnloop - -.smallscreen - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,[VidStartDraw] - add esi,16+256+32 - add edi,72*512+128 - cmp byte[resolutn],224 - jne .ssres239 - add edi,8*512 -.ssres239 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[MMXSupport],1 - je .ssloopb -.ssloopa - mov ecx,64 - rep movsd - add esi,32 - add edi,128*2 - dec dl - jnz .ssloopa - jmp .done -.ssloopb - mov ecx,16 - MMXStuff - add esi,32 - add edi,128*2 - dec dl - jnz .ssloopb - emms -.done - pop es - ret - -SECTION .bss -.scratio resb 1 -.lastrep resb 1 -.p512 resb 1 -SECTION .text - -NEWSYM copyvesa2512x384x8ng - push es - mov byte[.lastrep],0 - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov byte[.scratio],61 ; 60.6695 - cmp word[resolutn],224 - jne .res239 - mov byte[.scratio],72 ; 72.4286 -.res239 - mov edi,[VidStartDraw] - add esi,16+256+32 - xor eax,eax - mov ebx,1 - mov dl,[resolutn] - dec dl - dec dl - xor dh,dh -.loopa - cmp dword[ignor512],0 - je .a2 - cmp byte[BGMA+ebx],5 - je near .hires - cmp byte[BGMA+ebx],6 - je near .hires -.a2 - mov ecx,128 -.a - mov al,[esi+1] - mov ah,al - shl eax,16 - mov al,[esi] - mov ah,al - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a -.returnloop - cmp byte[.lastrep],1 - je .no2 - sub dh,[.scratio] - jnc .no2 - add dh,100 - sub esi,256 - mov al,[.p512] - mov [ebx],al - inc dl - dec ebx - mov byte[.lastrep],1 - jmp .yes2 -.no2 - mov byte[.lastrep],0 - add esi,32 -.yes2 - inc ebx - dec dl - jnz near .loopa - pop es - mov dword[ignor512],0 - ret -.hires - mov ecx,256 -.b - mov al,[esi] - mov ah,[esi+75036] - inc esi - mov [es:edi],ax - add edi,byte 2 - dec ecx - jnz .b - jmp .returnloop - -SECTION .bss -.scratio resb 1 -.lastrep resb 1 -.p512 resb 1 -SECTION .text - -;******************************************************* -; Copy VESA2 320x240x16b Copies buffer to 320x240x16bVB2 -;******************************************************* - - -;copyvesa2320x240x16bgui: -; cmp byte[curblank],40h -; jne .startcopy -; ret -;.startcopy -; cmp byte[ScreenScale],1 -; je near .scalescreen -; push es -; mov ax,[vesa2selec] -; mov es,ax -; mov esi,[vidbuffer] -; mov edi,32*2 ; Draw @ Y from 9 to 247 -; cmp word[resolutn],224 -; jne .res239 -; mov edi,8*320*2+32*2 -;.res239 -; add edi,[VidStartDraw] -; add esi,16+256+32 -; xor eax,eax -; mov dl,[resolutn] -; sub dl,2 -;.loopa -; mov ecx,256 -; xor eax,eax -;.loopa2 -; mov al,[esi] -; inc esi -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; add edi,byte 2 -; dec ecx -; jnz .loopa2 -; add esi,32 -; add edi,128 -; dec dl -; jnz .loopa -; pop es -; ret -;.scalescreen -; push es -; mov ax,[vesa2selec] -; mov es,ax -; mov esi,[vidbuffer] -; xor edi,edi -; cmp word[resolutn],224 -; jne .res239b -; mov edi,8*320*2 -;.res239b -; add edi,[VidStartDraw] -; add esi,16+256+32 -; xor eax,eax -; mov dl,[resolutn] -; sub dl,2 -;.loopab -; mov ecx,64 -; xor eax,eax -;.loopbb -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; mov al,[esi+1] -; mov bx,[GUICPC+eax*2] -; mov [es:edi+4],bx -; mov al,[esi+2] -; mov bx,[GUICPC+eax*2] -; mov [es:edi+6],bx -; mov al,[esi+3] -; mov bx,[GUICPC+eax*2] -; mov [es:edi+8],bx -; add esi,4 -; add edi,10 -; dec ecx -; jnz .loopbb -; add esi,32 -; dec dl -; jnz .loopab -; pop es -; ret - -NEWSYM copyvesa2320x240x16b -; cmp byte[vesa2red10],1 -; jne .notbr -; call ConvertToAFormat -;.notbr -; je near copyvesa2320x240x16br - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,320*2+32*2 - cmp word[resolutn],224 - jne .res239 - add edi,8*320*2 -.res239 - add edi,[VidStartDraw] - add esi,16*2+256*2+16*2+16*2 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[ScreenScale],1 - je near .fullscreen - - FilterTest .interpolate - - cmp byte[MMXSupport],1 - je near .loopb -.loopa - mov ecx,256/4*2 - rep movsd - add esi,16*2+16*2 - add edi,32*2+32*2 - dec dl - jnz .loopa - jmp .done -.loopb - mov ecx,256/16*2 - MMXStuff - add esi,16*2+16*2 - add edi,32*2+32*2 - dec dl - jnz .loopb - emms - jmp .done - -.fullscreen - sub edi,32*2 -.fsloopa - mov ecx,256/4 -.fsloopb - mov eax,[esi] - mov [es:edi],ax - mov [es:edi+2],eax - add esi,byte 4 - add edi,byte 6 - movsd - dec ecx - jnz .fsloopb - add esi,16*2+16*2 - dec dl - jnz .fsloopa - jmp .done - -.interpolate - SSInterpLineH - add esi,16*2+16*2 - add edi,32*2+32*2 - dec dl - jnz .interpolate - -.done - pop es - ret - -%endif - -SECTION .bss -NEWSYM rescompareng, resd 1 -NEWSYM nextdrawallng, resd 1 -NEWSYM prevcol0ng, resd 1 -NEWSYM numbytelng, resd 1 -NEWSYM lineleft, resd 1 -NEWSYM lineleft2, resd 1 -bankpos resd 1 -SECTION .text - -%ifdef __MSDOS__ -;******************************************************* -; Copy VESA2 320x480x16b Copies buffer to 320x480x16bVB2 -;******************************************************* - -;NEWSYM copyvesa2320x480x16bgui -; cmp byte[curblank],40h -; jne .startcopy -; ret -;.startcopy -; push es -; mov ax,[vesa2selec] -; mov es,ax -; mov esi,[vidbuffer] -; mov edi,32*2 ; Draw @ Y from 9 to 247 -; cmp word[resolutn],224 -; jne .res239 -; mov edi,8*320*2+32*2 -;.res239 -; add edi,[VidStartDraw] -; add esi,16+256+32 -; xor eax,eax -; mov dl,[resolutn] -; sub dl,2 -; cmp byte[scanlines],3 -; je near .halfscanlines -; cmp byte[scanlines],2 -; je near .quarterscanlines -; cmp byte[scanlines],1 -; je near .scanlines -;.loopa -; mov ecx,256 -; xor eax,eax -;.a -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; inc esi -; add edi,byte 2 -; dec ecx -; jnz .a -; sub esi,256 -; add edi,64*2 -; mov ecx,256 -; xor eax,eax -;.a2 -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; inc esi -; add edi,byte 2 -; dec ecx -; jnz .a2 -; add esi,32 -; add edi,64*2 -; dec dl -; jnz .loopa -; pop es -; ret -; -;.scanlines -;.loopab -; mov ecx,256 -; xor eax,eax -;.ab -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; inc esi -; add edi,byte 2 -; dec ecx -; jnz .ab -;.returnb -; add esi,32 -; add edi,64*2+320*2 -; dec dl -; jnz .loopab -; pop es -; ret -; -;.halfscanlines -;.loopabh -; mov ecx,256 -; xor eax,eax -;.abh -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; inc esi -; add edi,byte 2 -; dec ecx -; jnz .abh -; add edi,64*2 -; mov ecx,128 -; sub esi,256 -;.abh2 -; mov al,[esi+1] -; mov bx,[GUICPC+eax*2] -; mov al,[esi] -; shl ebx,16 -; mov bx,[GUICPC+eax*2] -; and ebx,[vesa2_clbitng2] -; shr ebx,1 -; mov [es:edi],ebx -; add esi,byte 2 -; add edi,4 -; dec ecx -; jnz .abh2 -; add esi,32 -; add edi,64*2 -; dec dl -; jnz .loopabh -; pop es -; ret -; -;.quarterscanlines -;.loopabhq -; mov ecx,256 -; xor eax,eax -;.abhq -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; inc esi -; add edi,byte 2 -; dec ecx -; jnz .abhq -; add edi,64*2 -; mov ecx,128 -; sub esi,256 -;.abh2q -; mov al,[esi+1] -; mov bx,[GUICPC+eax*2] -; mov al,[esi] -; shl ebx,16 -; mov bx,[GUICPC+eax*2] -; and ebx,[vesa2_clbitng2] -; shr ebx,1 -; mov eax,ebx -; and eax,[vesa2_clbitng2] -; shr eax,1 -; add ebx,eax -; mov [es:edi],ebx -; xor eax,eax -; add esi,byte 2 -; add edi,4 -; dec ecx -; jnz .abh2q -; add esi,32 -; add edi,64*2 -; dec dl -; jnz .loopabhq -; pop es -; ret -%endif - -NEWSYM ConvertToAFormat - cmp byte[GUIOn],1 - je .nonewgfx - cmp byte[newengen],0 - je .nonewgfx - ret -.nonewgfx - mov eax,[vesa2_clbitng2] - mov ebx,eax - and eax,11111111110000001111111111000000b - and ebx,00000000000111110000000000011111b - or eax,ebx - mov [vesavaland],eax - mov [vesavaland+4],eax - mov esi,[vidbuffer] - add esi,16*2+256*2+32*2 - mov dl,[resolutn] - dec dl - dec dl - cmp byte[MMXSupport],1 - je near .mmxconv -.crgbloop - mov ecx,128 -.crgbloop2 - mov eax,[esi] - mov ebx,eax - and eax,11111111110000001111111111000000b - and ebx,00000000000111110000000000011111b - shr eax,1 - or ebx,eax - mov [esi],ebx - add esi,4 - dec ecx - jnz .crgbloop2 - add esi,64 - dec dl - jnz .crgbloop - jmp .nocopyvesa2r -.mmxconv -.crgbloopm - mov ecx,64 - movq mm6,[mmxvalanda] - movq mm7,[mmxvalandb] -.crgbloop2m - movq mm0,[esi] - movq mm1,mm0 - pand mm0,mm6 - pand mm1,mm7 - psrlw mm0,1 - por mm0,mm1 - movq [esi],mm0 - add esi,8 - dec ecx - jnz .crgbloop2m - add esi,64 - dec dl - jnz .crgbloopm - emms -.nocopyvesa2r - ret - -NEWSYM UnConvertToAFormat - mov esi,[vidbuffer] - add esi,16*2+256*2+32*2 - mov dl,[resolutn] - dec dl - dec dl -.crgbloop - mov ecx,128 -.crgbloop2 - mov eax,[esi] - mov ebx,eax - and eax,01111111111000000111111111100000b - and ebx,00000000000111110000000000011111b - shl eax,1 - or ebx,eax - mov [esi],ebx - add esi,4 - dec ecx - jnz .crgbloop2 - add esi,64 - dec dl - jnz .crgbloop - ret - -%ifdef __MSDOS__ -NEWSYM copyvesa2320x480x16b - cmp byte[curblank],40h - jne .startcopy - ret - -.startcopy -; mov eax,[vesa2_clbitng2] -; mov [vesavaland],eax -; mov [vesavaland+4],eax -; cmp byte[vesa2red10],1 -; jne .nocopyvesa2r -; call ConvertToAFormat -;.nocopyvesa2r - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,320*2*2+32*2 - cmp word[resolutn],224 - jne .res239 - add edi,8*320*2 -.res239 - add edi,[VidStartDraw] - add esi,16*2+256*2+16*2+16*2 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[ScreenScale],1 - je near .fullscreen - - FilterTest .interpolate - - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],3 - je near .halfscanlines - cmp byte[scanlines],2 - je near .quartscanlines - - cmp byte[MMXSupport],1 - je .loopb -.loopa - mov ecx,256/4*2 - rep movsd - sub esi,256*2 - add edi,32*2+32*2 - mov ecx,256/4*2 - rep movsd - add esi,16*2+16*2 - add edi,32*2+32*2 - dec dl - jnz .loopa - jmp .done -.loopb - mov ecx,256/16*2 - MMXStuff - sub esi,256*2 - add edi,32*2+32*2 - mov ecx,256/16*2 - MMXStuff - add esi,16*2+16*2 - add edi,32*2+32*2 - dec dl - jnz .loopb - emms - jmp .done - -.scanlines - cmp byte[MMXSupport],1 - je .sloopb -.sloopa - mov ecx,256/4*2 - rep movsd - add esi,16*2+16*2 - add edi,32*2+320*2+32*2 - dec dl - jnz .sloopa - jmp .done -.sloopb - mov ecx,256/16*2 - MMXStuff - add esi,16*2+16*2 - add edi,32*2+320*2+32*2 - dec dl - jnz .sloopb - emms - jmp .done - -.halfscanlines - ;cmp byte[MMXSupport] - ;je near .hsloopb -.hsloopa - mov ecx,256/4*2 - rep movsd - sub esi,256*2 - add edi,32*2+32*2 - mov ecx,256/2 -.hsloopa2 - mov ax,[esi] - mov bx,[esi+2] - shr ax,byte 1 - shr bx,byte 1 - and ax,7befh - and bx,7befh - mov [es:edi],ax - mov [es:edi+2],bx - add esi,byte 4 - add edi,byte 4 - dec ecx - jnz .hsloopa2 - add esi,16*2+16*2 - add edi,32*2+32*2 - dec dl - jnz .hsloopa - jmp .done - -.quartscanlines - ;cmp byte[MMXSupport],1 - ;je .qsloopb -.qsloopa - mov ecx,256/4*2 - rep movsd - sub esi,256*2 - add edi,32*2+32*2 - mov ecx,256/2 -.qsloopa2 - push ecx - push edx - mov ax,[esi] - mov bx,[esi+2] - mov cx,ax - mov dx,bx - shr cx,byte 2 - shr dx,byte 2 - and cx,39e7h - and dx,39e7h - sub ax,cx - sub bx,dx - mov [es:edi],ax - mov [es:edi+2],bx - pop edx - pop ecx - add esi,byte 4 - add edi,byte 4 - dec ecx - jnz .qsloopa2 - add esi,16*2+16*2 - add edi,32*2+32*2 - dec dl - jnz .qsloopa - jmp .done - -.fullscreen - sub edi,32*2 - cmp byte[scanlines],1 - je .fsloopa2 - cmp byte[scanlines],3 - je .fsloopa3 - cmp byte[scanlines],2 - je .fsloopa4 -.fsloopa - mov ecx,256/4 - call .fsloopb - sub esi,256*2 - mov ecx,256/4 - call .fsloopb - add esi,16*2+16*2 - dec dl - jnz .fsloopa - jmp .done -.fsloopa2 - mov ecx,256/4 - call .fsloopb - add esi,16*2+16*2 - add edi,320*2 - dec dl - jnz .fsloopa2 - jmp .done -.fsloopa3 - mov ecx,256/4 - call .fsloopb - sub esi,256*2 - mov ecx,256/4 - call .fsloopb2 - add esi,16*2+16*2 - dec dl - jnz .fsloopa3 - jmp .done -.fsloopa4 - mov ecx,256/4 - call .fsloopb - sub esi,256*2 - mov ecx,256/4 - call .fsloopb3 - add esi,16*2+16*2 - dec dl - jnz .fsloopa4 - jmp .done -.fsloopb - mov eax,[esi] - mov [es:edi],ax - mov [es:edi+2],eax - add esi,byte 4 - add edi,byte 6 - movsd - dec ecx - jnz .fsloopb - ret -.fsloopb2 - mov ax,[esi] - mov bx,[esi+2] - shr ax,byte 1 - shr bx,byte 1 - and ax,7befh - and bx,7befh - mov [es:edi],ax - mov [es:edi+2],ax - mov [es:edi+4],bx - add esi,byte 4 - add edi,byte 6 - mov ax,[esi] - mov bx,[esi+2] - shr ax,byte 1 - shr bx,byte 1 - and ax,7befh - and bx,7befh - mov [es:edi],ax - mov [es:edi+2],bx - add esi,byte 4 - add edi,byte 4 - dec ecx - jnz .fsloopb2 - ret -.fsloopb3 - push ecx - push edx - mov ax,[esi] - mov bx,[esi+2] - mov cx,ax - mov dx,bx - shr cx,byte 2 - shr dx,byte 2 - and cx,39e7h - and dx,39e7h - sub ax,cx - sub bx,dx - mov [es:edi],ax - mov [es:edi+2],ax - mov [es:edi+4],bx - add esi,byte 4 - add edi,byte 6 - mov ax,[esi] - mov bx,[esi+2] - mov cx,ax - mov dx,bx - shr cx,byte 2 - shr dx,byte 2 - and cx,39e7h - and dx,39e7h - sub ax,cx - sub bx,dx - mov [es:edi],ax - mov [es:edi+2],bx - add esi,byte 4 - add edi,byte 4 - pop edx - pop ecx - dec ecx - jnz .fsloopb3 - ret - -.interpolate - cmp byte[scanlines],1 - je near .inloopa2 -.inloopa - SSInterpLineH - sub esi,256*2 - add edi,32*2+32*2 - SSInterpLineH - add esi,16*2+16*2 - add edi,32*2+32*2 - dec dl - jnz near .inloopa - jmp .done -.inloopa2 - SSInterpLineH - add esi,16*2+16*2 - add edi,32*2+320*2+32*2 - dec dl - jnz .inloopa2 - -.done - pop es - ret - -;******************************************************* -; Copy VESA2 640x480x16b Copies buffer to 640x480x16bVB2 -;******************************************************* - -%macro copya640x480 0 - mov [es:edi],dx - mov [es:edi+2],dx - mov [es:edi+640*2],dx - mov [es:edi+640*2+2],dx -%endmacro - -%macro copyb640x480 0 - mov [es:edi+4],dx - mov [es:edi+6],dx - mov [es:edi+640*2+4],dx - mov [es:edi+640*2+6],dx -%endmacro - -%macro copya640x480sl 0 - mov [es:edi],dx - mov [es:edi+2],dx -%endmacro - -%macro copyb640x480sl 0 - mov [es:edi+4],dx - mov [es:edi+6],dx -%endmacro - -%macro precheckvesa12 1 - cmp edx,%1 - ja %%a - mov ecx,edx -%%a -%endmacro - -%macro postcheckvesa12 4 - cmp edx,%3 - ja %%a - call VESA12Bankswitch - mov ecx,%3 - sub ecx,edx - add edx,%4 - or ecx,ecx - jz %%a - jmp %1 -%%a - sub edx,%3 - sub edx,%2 - jg %%nobankswitch - add edx,%4 - call VESA12Bankswitch -%%nobankswitch -%endmacro - -;NEWSYM copyvesa12640x480x16bgui -; cmp byte[curblank],40h -; jne .startcopy -; ret -;.startcopy -; push es -; mov word[bankpos],0 -; call VESA12Bankswitch -; mov ax,[selcA000] -; mov es,ax -; mov esi,[vidbuffer] -; mov edi,32*2*2 ; Draw @ Y from 9 to 247 -; cmp word[resolutn],224 -; jne .res239 -; mov edi,8*320*2*2+32*2*2 -;.res239 -; add esi,16+256+32 -; xor eax,eax -; mov dl,[resolutn] -; sub dl,2 -; mov [lineleft],dl -; mov edx,65536 -; sub edx,edi -; shr edx,2 -; cmp byte[smallscreenon],1 -; je near .smallscreen -; cmp byte[scanlines],1 -; je near .scanlines -;.loopa -; mov ecx,256 -; xor eax,eax -; precheckvesa12 256 -;.a -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; inc esi -; add edi,4 -; dec ecx -; jnz .a -; postcheckvesa12 .a,64,256,16384 -; sub esi,256 -; add edi,128*2 -; mov ecx,256 -; xor eax,eax -; precheckvesa12 256 -;.a2 -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; inc esi -; add edi,4 -; dec ecx -; jnz .a2 -; postcheckvesa12 .a2,64,256,16384 -; add esi,32 -; add edi,128*2 -; dec byte[lineleft] -; jnz near .loopa -; pop es -; ret -; -;.scanlines -;.loopa2 -; mov ecx,256 -; xor eax,eax -; precheckvesa12 256 -;.ab -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; inc esi -; add edi,4 -; dec ecx -; jnz .ab -; postcheckvesa12 .ab,64+320,256,16384 -; add esi,32 -; add edi,128*2+640*2 -; dec byte[lineleft] -; jnz near .loopa2 -; pop es -; ret -; -;.smallscreen -; add edx,edx -;.loopa3 -; mov ecx,256 -; xor eax,eax -; precheckvesa12 256 -;.ac -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; inc esi -; add edi,byte 2 -; dec ecx -; jnz .ac -; postcheckvesa12 .ac,128+256,256,32768 -; add esi,32 -; add edi,128*2+256*2 -; dec byte[lineleft] -; jnz near .loopa3 -; pop es -; ret - - -VESA12Bankswitch: - pushad - mov ax,4F05h - mov bx,0 - mov dx,[bankpos] - int 10h - mov ax,[granadd] - add word[bankpos],ax - popad - sub edi,65536 - ret - -;NEWSYM copyvesa2640x480x16bgui -; je near smallscreen640x480x16bgui.fullscreen -; cmp byte[curblank],40h -; jne .startcopy -; ret -;.startcopy -; push es -; mov ax,[vesa2selec] -; mov es,ax -; mov esi,[vidbuffer] -; mov edi,32*2*2 ; Draw @ Y from 9 to 247 -; cmp word[resolutn],224 -; jne .res239 -; mov edi,8*320*2*2+32*2*2 -;.res239 -; add edi,[VidStartDraw] -; add esi,16+256+32 -; xor eax,eax -; mov dl,[resolutn] -; sub dl,2 -; cmp byte[scanlines],3 -; je near .halfscanlines -; cmp byte[scanlines],2 -; je near .quarterscanlines -; cmp byte[scanlines],1 -; je near .scanlines -;.loopa -; mov ecx,256 -; xor eax,eax -;.a -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; inc esi -; add edi,4 -; dec ecx -; jnz .a -; sub esi,256 -; add edi,128*2 -; mov ecx,256 -; xor eax,eax -;.a2 -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; inc esi -; add edi,4 -; dec ecx -; jnz .a2 -; add esi,32 -; add edi,128*2 -; dec dl -; jnz .loopa -; pop es -; ret -; -;.scanlines -;.loopab -; mov ecx,256 -; xor eax,eax -;.ab -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; inc esi -; add edi,4 -; dec ecx -; jnz .ab -;.returnb -; add esi,32 -; add edi,128*2+640*2 -; dec dl -; jnz .loopab -; pop es -; ret -; -;.halfscanlines -;.loopabh -; mov ecx,256 -; xor eax,eax -;.abh -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; inc esi -; add edi,4 -; dec ecx -; jnz .abh -; add edi,128*2 -; mov ecx,256 -; sub esi,256 -;.abh2 -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; shl ebx,16 -; mov bx,[GUICPC+eax*2] -; and ebx,[vesa2_clbitng2] -; shr ebx,1 -; mov [es:edi],ebx -; inc esi -; add edi,4 -; dec ecx -; jnz .abh2 -; add esi,32 -; add edi,128*2 -; dec dl -; jnz .loopabh -; pop es -; ret -; -;.quarterscanlines -;.loopabhq -; mov ecx,256 -; xor eax,eax -;.abhq -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; inc esi -; add edi,4 -; dec ecx -; jnz .abhq -; add edi,128*2 -; mov ecx,256 -; sub esi,256 -;.abh2q -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; shl ebx,16 -; mov bx,[GUICPC+eax*2] -; and ebx,[vesa2_clbitng2] -; shr ebx,1 -; mov eax,ebx -; and eax,[vesa2_clbitng2] -; shr eax,1 -; add ebx,eax -; mov [es:edi],ebx -; xor eax,eax -; inc esi -; add edi,4 -; dec ecx -; jnz .abh2q -; add esi,32 -; add edi,128*2 -; dec dl -; jnz .loopabhq -; pop es -; ret -; -;NEWSYM smallscreen640x480x16bgui -; cmp byte[curblank],40h -; jne .startcopy -; ret -;.startcopy -; push es -; mov ax,[vesa2selec] -; mov es,ax -; mov esi,[vidbuffer] -; mov edi,32*2*2 ; Draw @ Y from 9 to 247 -; cmp word[resolutn],224 -; jne .res239 -; mov edi,8*640*2+32*2*2 -;.res239 -; add edi,[VidStartDraw] -; add edi,128*2+120*640*2 -; add esi,16+256+32 -; xor eax,eax -; mov ebx,hirestiledat+1 -; mov dl,[resolutn] -; sub dl,2 -;.loopa -; mov ecx,256 -; xor eax,eax -;.a3 -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; inc esi -; add edi,byte 2 -; dec ecx -; jnz .a3 -; add esi,32 -; add edi,640*2-256*2 -; inc ebx -; dec dl -; jnz .loopa -; pop es -; ret -; -;.fullscreen -; cmp byte[curblank],40h -; jne .startcopy2 -; ret -;.startcopy2 -; push es -; mov ax,[vesa2selec] -; mov es,ax -; mov esi,[vidbuffer] -; xor edi,edi -; cmp word[resolutn],224 -; jne .res239b -; mov edi,8*320*2*2 -;.res239b -; add edi,[VidStartDraw] -; add esi,16+256+32 -; xor eax,eax -; mov dl,[resolutn] -; sub dl,2 -; cmp byte[scanlines],1 -; je near .scanlines -;.loopa2 -; mov ecx,128 -; xor eax,eax -;.a -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; mov al,[esi+1] -; mov bx,[GUICPC+eax*2] -; mov [es:edi+4],bx -; mov [es:edi+6],bx -; mov [es:edi+8],bx -; add esi,byte 2 -; add edi,10 -; dec ecx -; jnz .a -; sub esi,256 -; mov ecx,128 -;.a2 -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; mov al,[esi+1] -; mov bx,[GUICPC+eax*2] -; mov [es:edi+4],bx -; mov [es:edi+6],bx -; mov [es:edi+8],bx -; add esi,byte 2 -; add edi,10 -; dec ecx -; jnz .a2 -; add esi,32 -; dec dl -; jnz near .loopa2 -; pop es -; ret -; -;.scanlines -;.loopab -; mov ecx,128 -; xor eax,eax -;.ab -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; mov al,[esi+1] -; mov bx,[GUICPC+eax*2] -; mov [es:edi+4],bx -; mov [es:edi+6],bx -; mov [es:edi+8],bx -; add esi,byte 2 -; add edi,10 -; dec ecx -; jnz .ab -; add esi,32 -; add edi,640*2 -; dec dl -; jnz .loopab -; pop es -; ret - -NEWSYM copyvesa2640x480x16b -; cmp byte[vesa2red10],1 -; je near copyvesa2640x480x16br - cmp byte[vesa2red10],1 - jne .notbr - call ConvertToAFormat -; call UnConvertToAFormat -.notbr - cmp byte[smallscreenon],1 - je near smallscreen640x480x16b - cmp byte[ScreenScale],1 - je near smallscreen640x480x16b.fullscreen - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,32*2*2 ; Draw @ Y from 9 to 247 - cmp word[resolutn],224 - jne .res239 - mov edi,8*320*2*2+32*2*2 -.res239 - add edi,[VidStartDraw] - add esi,16*2+256*2+32*2 - xor eax,eax - ; Check if interpolation mode - cmp byte[FilteredGUI],0 - jne .yi - cmp byte[GUIOn],1 - je .nointerp -.yi - cmp byte[MMXSupport],1 - jne .nommx - cmp byte[newgfx16b],0 - je .nommx - cmp byte[En2xSaI],0 - jne near Process2xSaI -.nommx - cmp byte[antienab],1 - je near interpolate640x480x16b -.nointerp - mov dl,[resolutn] - dec dl - dec dl - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],3 - je near .halfscanlines - cmp byte[scanlines],2 - je near .quartscanlines - mov ebx,hirestiledat+1 - cmp byte[newengen],0 - je .loopa - mov ebx,SpecialLine+1 -.loopa - mov ecx,256 - cmp byte[Triplebufen],1 - je .ignorehr - cmp byte[ebx],1 - je near .yeshires - cmp byte[GUIOn],1 - je .ignorehr - cmp byte[ebx],1 - ja near .yeshiresng -.ignorehr - cmp byte[MMXSupport],1 - je near .mmx -.a - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a - sub esi,256*2 - add edi,128*2 - mov ecx,256 -.a2 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a2 -.return - add esi,64 - add edi,128*2 - inc ebx - dec dl - jnz near .loopa - pop es - cmp byte[Triplebufen],1 - je .ignorehr2 - xor byte[res512switch],1 -.ignorehr2 - cmp byte[MMXSupport],1 - je .mmx2 - ret -.mmx2 - emms - ret -.yeshires - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightside -.b - mov ax,[esi] - mov [es:edi],ax - mov [es:edi+1280],ax - add esi,byte 2 - add edi,4 - dec ecx - jnz .b - add edi,640*2 - jmp .return -.rightside -.c - mov ax,[esi] - mov [es:edi+2],ax - mov [es:edi+1282],ax - add esi,byte 2 - add edi,4 - dec ecx - jnz .c - add edi,640*2 - jmp .return -.mmx - mov eax,[spritetablea] - mov ecx,64 - add eax,512 -.mmxr - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [es:edi],mm0 - punpckhwd mm1,mm1 - movq [es:edi+8],mm1 - movq [eax],mm0 - movq [eax+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxr -.nextmmx - mov eax,[spritetablea] - mov ecx,32 - add eax,512 - add edi,128*2 -.mmxr2 - movq mm0,[eax] - movq [es:edi],mm0 - movq mm1,[eax+8] - movq [es:edi+8],mm1 - movq mm2,[eax+16] - movq [es:edi+16],mm2 - movq mm3,[eax+24] - movq [es:edi+24],mm3 - add eax,32 - add edi,32 - dec ecx - jnz .mmxr2 - jmp .return -.yeshiresng - call HighResProc - jmp .return - -.scanlines - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopab - cmp byte[newengen],0 - je .loopab - mov ebx,SpecialLine+1 -.loopab - mov ecx,256 - cmp byte[Triplebufen],1 - je .ignorehrb - cmp byte[ebx],1 - je .yeshiresb - cmp byte[ebx],1 - jbe .ignorehrb - call HighResProc - jmp .returnb -.ignorehrb - cmp byte[MMXSupport],1 - je near .mmxsl -.ab - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .ab -.returnb - add esi,64 - add edi,128*2+640*2 - inc ebx - dec dl - jnz .loopab - pop es - cmp byte[Triplebufen],1 - je .ignorehr2b - xor byte[res512switch],1 -.ignorehr2b - cmp byte[MMXSupport],1 - je near .mmx2 - ret -.yeshiresb - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightsideb -.bb - mov ax,[esi] - mov [es:edi],ax - add esi,byte 2 - add edi,4 - dec ecx - jnz .bb - jmp .returnb -.rightsideb -.cb - mov ax,[esi] - mov [es:edi+2],ax - add esi,byte 2 - add edi,4 - dec ecx - jnz .cb - jmp .returnb -.mmxsl - mov ecx,64 -.mmxrsl - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - punpckhwd mm1,mm1 - movq [es:edi],mm0 - movq [es:edi+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxrsl - jmp .returnb - -.halfscanlines - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabh - cmp byte[newengen],0 - je .loopabh - mov ebx,SpecialLine+1 -.loopabh - cmp byte[ebx],1 - jbe .ignorehrbh - call HighResProc - jmp .returnbh -.ignorehrbh - cmp byte[MMXSupport],1 - je near .mmxslh - mov ecx,256 -.abh - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .abh - mov ecx,256 - sub esi,512 - add edi,128*2 -.abhs - mov ax,[esi] - shl eax,16 - mov ax,[esi] - and eax,[vesa2_clbitng2] - shr eax,1 - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .abhs -.returnbh - add esi,64 - add edi,128*2 - inc ebx - dec dl - jnz near .loopabh - pop es - cmp byte[MMXSupport],1 - je near .mmx2 - ret -.mmxslh - mov eax,[spritetablea] - mov ecx,64 - add eax,512 -.mmxrslh - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - punpckhwd mm1,mm1 - movq [es:edi],mm0 - movq [es:edi+8],mm1 - movq [eax],mm0 - movq [eax+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxrslh - mov eax,[spritetablea] - mov ecx,32 - add eax,512 - add edi,128*2 - movq mm4,[vesa2_clbitng2] -.mmxr2h - movq mm0,[eax] - movq mm1,[eax+8] - movq mm2,[eax+16] - movq mm3,[eax+24] - pand mm0,mm4 - pand mm1,mm4 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm0,1 - psrlw mm1,1 - psrlw mm2,1 - psrlw mm3,1 - movq [es:edi],mm0 - movq [es:edi+8],mm1 - movq [es:edi+16],mm2 - movq [es:edi+24],mm3 - add eax,32 - add edi,32 - dec ecx - jnz .mmxr2h - jmp .returnbh - -.quartscanlines - mov [lineleft],dl - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabh2 - cmp byte[newengen],0 - je .loopabh2 - mov ebx,SpecialLine+1 -.loopabh2 - cmp byte[ebx],1 - jbe .ignorehrbh2 - call HighResProc - jmp .returnbh2 -.ignorehrbh2 - cmp byte[MMXSupport],1 - je near .mmxslh2 - mov ecx,256 -.abh2 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .abh2 - mov ecx,256 - sub esi,512 - add edi,128*2 -.abhs2 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - and eax,[vesa2_clbitng2] - shr eax,1 - mov edx,eax - and edx,[vesa2_clbitng2] - shr edx,1 - add eax,edx - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .abhs2 -.returnbh2 - add esi,64 - add edi,128*2 - inc ebx - dec byte[lineleft] - jnz near .loopabh2 - pop es - cmp byte[MMXSupport],1 - je near .mmx2 - ret -.mmxslh2 - mov eax,[spritetablea] - mov ecx,64 - add eax,512 -.mmxrslh2 - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - punpckhwd mm1,mm1 - movq [es:edi],mm0 - movq [es:edi+8],mm1 - movq [eax],mm0 - movq [eax+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxrslh2 - mov eax,[spritetablea] - mov ecx,64 - add eax,512 - add edi,128*2 - movq mm4,[vesa2_clbitng2] -.mmxr2h2 - movq mm0,[eax] - movq mm1,[eax+8] - pand mm0,mm4 - pand mm1,mm4 - psrlw mm0,1 - psrlw mm1,1 - movq mm2,mm0 - movq mm3,mm1 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm2,1 - psrlw mm3,1 - paddd mm0,mm2 - paddd mm1,mm3 - movq [es:edi],mm0 - movq [es:edi+8],mm1 - add eax,16 - add edi,16 - dec ecx - jnz .mmxr2h2 - jmp .returnbh2 - -HighResProc: - mov ecx,256 - cmp byte[ebx],3 - je near .hiresmode7 - cmp byte[ebx],7 - je near .hiresmode7 - test byte[ebx],4 - jz .nofield - cmp byte[scanlines],0 - jne .nofield - test byte[cfield],1 - jz .nofield - add edi,640*2 -.nofield - test byte[ebx],3 - jnz near .hires -.a - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a - cmp byte[scanlines],0 - jne .nofield - test byte[cfield],1 - jnz .nofielde - add edi,640*2 -.nofielde - ret -.hiresmode7 - cmp byte[MMXSupport],1 - je .yeshiresngmmxmode7 -.a2 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a2 - add edi,128*2 - sub esi,512 - mov ecx,256 - add esi,75036*4 -.a2b - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a2b - sub esi,75036*4 - ret -.yeshiresngmmxmode7 - mov ecx,64 -.mmxr - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [es:edi],mm0 - punpckhwd mm1,mm1 - movq [es:edi+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxr - add edi,128*2 - sub esi,512 - add esi,75036*4 - mov ecx,64 -.mmxrb - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [es:edi],mm0 - punpckhwd mm1,mm1 - movq [es:edi+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxrb - sub esi,75036*4 - ret -.hires - cmp byte[MMXSupport],1 - je near .yeshiresngmmx -.bng - mov eax,[esi+75036*4-2] - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .bng - test byte[ebx],4 - jz .nofieldb - cmp byte[scanlines],0 - jne .nofieldb - test byte[cfield],1 - jnz .lowerfield - add edi,640*2 -.lowerfield - ret -.nofieldb - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],3 - je near .halfscanlines - cmp byte[scanlines],2 - je near .quartscanlines - add edi,128*2 - sub esi,256*2 - mov ecx,256 -.bngb - mov eax,[esi+75036*4-2] - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .bngb - ret -.scanlines - ret -.yeshiresngmmx - mov eax,[spritetablea] - mov ecx,64 - add eax,512 -.ngal - movq mm0,[esi] - movq mm1,[esi+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - movq [es:edi],mm0 - punpckhwd mm2,mm1 - movq [es:edi+8],mm2 - movq [eax],mm0 - movq [eax+8],mm2 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .ngal - test byte[ebx],4 - jz .nofieldc - cmp byte[scanlines],0 - jne .nofieldc - test byte[cfield],1 - jnz .lowerfieldb - add edi,640*2 -.lowerfieldb - ret -.nofieldc - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],3 - je near .halfscanlinesmmx - cmp byte[scanlines],2 - je near .quartscanlinesmmx - test byte[ebx+1],3 - jz .noaa - cmp byte[En2xSaI],0 - jne near .antialias - cmp byte[antienab],0 - jne near .antialias -.noaa - add edi,128*2 - mov eax,[spritetablea] - mov ecx,32 - add eax,512 -.mmxr2 - movq mm0,[eax] - movq [es:edi],mm0 - movq mm1,[eax+8] - movq [es:edi+8],mm1 - movq mm2,[eax+16] - movq [es:edi+16],mm2 - movq mm3,[eax+24] - movq [es:edi+24],mm3 - add eax,32 - add edi,32 - dec ecx - jnz .mmxr2 - ret -.antialias - add edi,128*2 - mov eax,[spritetablea] - mov ecx,64 - add eax,512 - movq mm4,[vesa2_clbitng2] - sub esi,256*2 -.mmxr2aa - movq mm0,[esi+288*2] - movq mm1,[esi+288*2+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - punpckhwd mm2,mm1 - movq mm1,[eax] - movq mm3,[eax+8] - pand mm0,mm4 - pand mm1,mm4 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm0,1 - psrlw mm1,1 - psrlw mm2,1 - psrlw mm3,1 - paddd mm0,mm1 - paddd mm2,mm3 - movq [es:edi],mm0 - movq [es:edi+8],mm2 - add eax,16 - add edi,16 - add esi,8 - dec ecx - jnz .mmxr2aa - ret -.halfscanlines - add edi,128*2 - sub esi,256*2 - mov ecx,256 -.abhs - mov eax,[esi+75036*4-2] - mov ax,[esi] - and eax,[vesa2_clbitng2] - shr eax,1 - mov edx,eax - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .abhs - ret -.quartscanlines - add edi,128*2 - sub esi,256*2 - mov ecx,256 -.abhs2 - mov eax,[esi+75036*4-2] - mov ax,[esi] - and eax,[vesa2_clbitng2] - shr eax,1 - mov edx,eax - and edx,[vesa2_clbitng2] - shr edx,1 - add eax,edx - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .abhs2 - ret -.halfscanlinesmmx - mov eax,[spritetablea] - mov ecx,32 - add eax,512 - add edi,128*2 - movq mm4,[vesa2_clbitng2] -.mmxr2h - movq mm0,[eax] - movq mm1,[eax+8] - movq mm2,[eax+16] - movq mm3,[eax+24] - pand mm0,mm4 - pand mm1,mm4 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm0,1 - psrlw mm1,1 - psrlw mm2,1 - psrlw mm3,1 - movq [es:edi],mm0 - movq [es:edi+8],mm1 - movq [es:edi+16],mm2 - movq [es:edi+24],mm3 - add eax,32 - add edi,32 - dec ecx - jnz .mmxr2h - ret -.quartscanlinesmmx - mov eax,[spritetablea] - mov ecx,64 - add eax,512 - add edi,128*2 - movq mm4,[HalfTransC] -.mmxr2h2 - movq mm0,[eax] - movq mm1,[eax+8] - pand mm0,mm4 - pand mm1,mm4 - psrlw mm0,1 - psrlw mm1,1 - movq mm2,mm0 - movq mm3,mm1 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm2,1 - psrlw mm3,1 - paddd mm0,mm2 - paddd mm1,mm3 - movq [es:edi],mm0 - movq [es:edi+8],mm1 - add eax,16 - add edi,16 - dec ecx - jnz .mmxr2h2 - ret - -Process2xSaI: - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabi - cmp byte[newengen],0 - je .loopabi - mov ebx,SpecialLine+1 -.loopabi - mov [InterPtr],ebx - -; add edi,[VESAAddr] - mov dl,[resolutn] - dec dl - dec dl ; Compensate for top/bottom line + 2 lines in 2xSaI - mov [lineleft],dl - mov dword[esi+512],0 - mov dword[esi+512+576*2],0 - mov ebx,[vidbufferofsb] - add ebx,288*2 - -.next - mov dword[esi+512+576*3],0 - - mov eax,[InterPtr] - cmp byte[eax],1 - jbe .ignorehr - push ebx - mov ebx,[InterPtr] - call HighResProc - pop ebx - push ebx - mov ecx,144 -.nextb - mov dword[ebx],0FFFFFFFFh - add ebx,4 - dec ecx - jnz .nextb - pop ebx - jmp .returninterp -.ignorehr - -;srcPtr equ 8 -;deltaPtr equ 12 -;srcPitch equ 16 -;width equ 20 -;dstOffset equ 24 -;dstPitch equ 28 -;dstSegment equ 32 - -%ifdef asdfasdfasdfsafdasdf - cmp byte[En2xSaI],3 - je .super2xsai -%endif - mov eax,1280 ; destination pitch - push eax - mov eax,edi ; destination offset - push eax - mov eax,256 ; width - push eax - mov eax,576 ; source pitch - push eax - push ebx - mov eax,esi ; source pointer - push eax - cmp byte[En2xSaI],2 - je .supereagle - call _2xSaILine - jmp .normal -.supereagle - call _2xSaISuperEagleLine - jmp .normal - -%ifdef asdgawe65egfdgfdg -.super2xsai - pushad - mov eax,1280 ; destination pitch - push eax - mov eax,[spritetablea] ; destination offset - add eax,512 - push eax - mov eax,256 ; width - push eax - mov eax,576 ; source pitch - push eax - push ebx - mov eax,esi ; source pointer - push eax - call Super2xSaI - add esp,24 - popad - ; blit to screen - mov eax,edi - mov edx,[spritetablea] - add edx,512 - mov ecx,128 -.s2xsailoop - movq mm0,[edx] - movq [es:eax],mm0 - add edx,8 - add eax,8 - dec ecx - jnz .s2xsailoop - mov edx,[spritetablea] - add edx,512+1280 - add eax,128*2 - mov ecx,128 -.s2xsailoop2 - movq mm0,[edx] - movq [es:eax],mm0 - add edx,8 - add eax,8 - dec ecx - jnz .s2xsailoop2 - jmp .dones2xsai -%endif - - -.normal - add esp,24 -.dones2xsai - add esi,576 - inc dword[InterPtr] - add edi,1280*2 - add ebx,576 - dec dword[lineleft] - jnz near .next - mov ecx,256 - sub edi,640*2 -.loop - mov dword[es:edi],0 - add edi,4 - dec ecx - jnz .loop - emms - pop es - ret -.returninterp - add esi,64 - inc dword[InterPtr] - add edi,128*2 - dec byte[lineleft] - jnz near .next - emms - pop es - ret - -NEWSYM smallscreen640x480x16b - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,32*2*2 ; Draw @ Y from 9 to 247 - cmp word[resolutn],224 - jne .res239 - mov edi,8*640*2+32*2*2 -.res239 - add edi,[VidStartDraw] - add edi,128*2+120*640*2 - add esi,16*2+256*2+32*2 - xor eax,eax - mov ebx,hirestiledat+1 - mov dl,[resolutn] - dec dl - dec dl -.loopa - mov ecx,128 - rep movsd - add esi,32*2 - add edi,640*2-256*2 - inc ebx - dec dl - jnz .loopa - pop es - ret - -.fullscreen - cmp byte[curblank],40h - jne .startcopy2 - ret -.startcopy2 - cmp byte[GUIOn],1 - je .nointerpolat - cmp byte[antienab],1 - jne .nointerpolat - cmp byte[MMXSupport],1 - je near MMXInterpolFS -.nointerpolat - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - xor edi,edi - cmp word[resolutn],224 - jne .res239b - mov edi,8*320*2*2 -.res239b - add edi,[VidStartDraw] - add esi,16*2+256*2+32*2 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[scanlines],1 - je near .scanlines -.loopa2 - mov ecx,128 -.a - mov ax,[esi] - mov [es:edi],ax - mov [es:edi+2],ax - mov ax,[esi+2] - mov [es:edi+4],ax - mov [es:edi+6],ax - mov [es:edi+8],ax - add esi,4 - add edi,10 - dec ecx - jnz .a - sub esi,256*2 - mov ecx,128 -.a2 - mov ax,[esi] - mov [es:edi],ax - mov [es:edi+2],ax - mov ax,[esi+2] - mov [es:edi+4],ax - mov [es:edi+6],ax - mov [es:edi+8],ax - add esi,4 - add edi,10 - dec ecx - jnz .a2 - add esi,64 - inc ebx - dec dl - jnz .loopa2 - pop es - ret - -.scanlines -.loopab - mov ecx,128 -.ab - mov ax,[esi] - mov [es:edi],ax - mov [es:edi+2],ax - mov ax,[esi+2] - mov [es:edi+4],ax - mov [es:edi+6],ax - mov [es:edi+8],ax - add esi,4 - add edi,10 - dec ecx - jnz .ab - add esi,64 - add edi,640*2 - inc ebx - dec dl - jnz .loopab - pop es - ret - -MMXInterpolFS: - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - add esi,16*2+256*2+32*2 - xor edi,edi - add edi,[VidStartDraw] - mov dword[lineleft2],0FFFFh - cmp word[resolutn],224 - jne .res239 - mov dword[lineleft2],14 -.res239 - mov dl,[resolutn] - sub dl,3 - movq mm2,[HalfTrans] - mov [lineleft],dl - mov edx,[spritetablea] - mov ecx,64 - mov eax,[esi+510] - add edx,512 - mov [esi+512],eax -.a2 - movq mm0,[esi] - movq mm4,mm0 - movq mm1,[esi+2] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 -; movq [es:edi],mm4 -; movq [es:edi+8],mm5 - movq [edx],mm4 - movq [edx+8],mm5 - add esi,8 - add edi,16 - add edx,16 - dec ecx - jnz .a2 - add esi,64 - add edi,128*2 -.a5 - mov eax,[esi+510] - mov ecx,32 - mov [esi+512],eax - mov edx,[spritetablea] - add edx,512 - ; Process next line -.a3 - ; aaaa/abbb/bbcc/cccd/dddd/ - ; aaaa/bbbA/ccBb/dCcc/Dddd/ - ; a / a >> 48, b << 16 / b >> 48, b >> 32 & 0xFFFF0000, c << 32 / - ; c >> 32, c >> 16 & 0xFFFF00000000, d << 48 / d >> 16, d &0xFFFF000000000000 - movq mm0,[esi] - movq mm4,mm0 - movq mm1,[esi+2] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - movq mm5,mm4 - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq mm6,[edx] - movq mm7,[edx+8] - movq [edx],mm4 - movq [edx+8],mm5 - pand mm6,mm2 - pand mm7,mm2 - pand mm4,mm2 - pand mm5,mm2 - psrlw mm6,1 - psrlw mm7,1 - psrlw mm4,1 - psrlw mm5,1 - paddd mm4,mm6 - paddd mm5,mm7 - movq [es:edi],mm4 - movq [.interpspad],mm4 - movq [.interpspad+8],mm5 - movq mm4,[.interpspad+6] - movq [es:edi+8],mm4 - movq [.interpspad+6],mm5 - - movq mm0,[esi+8] - movq mm4,mm0 - movq mm1,[esi+10] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - movq mm5,mm4 - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq mm6,[edx+16] - movq mm7,[edx+24] - movq [edx+16],mm4 - movq [edx+24],mm5 - pand mm6,mm2 - pand mm7,mm2 - pand mm4,mm2 - pand mm5,mm2 - psrlw mm6,1 - psrlw mm7,1 - psrlw mm4,1 - psrlw mm5,1 - paddd mm4,mm6 - paddd mm5,mm7 - movq [.interpspad+16],mm4 - movq mm7,[.interpspad+12] - movq [es:edi+16],mm7 - movq [.interpspad+14],mm4 - movq [.interpspad+24],mm5 - movq mm7,[.interpspad+18] - movq [es:edi+24],mm7 - movq [.interpspad+22],mm5 - movq mm7,[.interpspad+24] - movq [es:edi+32],mm7 - - add esi,16 - add edi,40 - add edx,32 - dec ecx - jnz near .a3 -; add edi,128*2 - - mov edx,[spritetablea] - add edx,512 - mov ecx,32 -.a4 - movq mm4,[edx] - movq mm5,[edx+8] - movq [es:edi],mm4 - movq [.interpspad],mm4 - movq [.interpspad+8],mm5 - movq mm4,[.interpspad+6] - movq [es:edi+8],mm4 - movq [.interpspad+6],mm5 - movq mm4,[edx+16] - movq mm5,[edx+24] - movq [.interpspad+16],mm4 - movq mm7,[.interpspad+12] - movq [es:edi+16],mm7 - movq [.interpspad+14],mm4 - movq [.interpspad+24],mm5 - movq mm7,[.interpspad+18] - movq [es:edi+24],mm7 - movq [.interpspad+22],mm5 - movq mm7,[.interpspad+24] - movq [es:edi+32],mm7 - add edi,40 - add edx,32 - dec ecx - jnz near .a4 - - add esi,64 -; add edi,128*2 - - dec dword[lineleft2] - cmp dword[lineleft2],0 - jne near .norepeat - mov dword[lineleft2],14 - mov edx,[spritetablea] - add edx,512 - mov ecx,32 -.a6 - movq mm4,[edx] - movq mm5,[edx+8] - movq [es:edi],mm4 - movq [.interpspad],mm4 - movq [.interpspad+8],mm5 - movq mm4,[.interpspad+6] - movq [es:edi+8],mm4 - movq [.interpspad+6],mm5 - movq mm4,[edx+16] - movq mm5,[edx+24] - movq [.interpspad+16],mm4 - movq mm7,[.interpspad+12] - movq [es:edi+16],mm7 - movq [.interpspad+14],mm4 - movq [.interpspad+24],mm5 - movq mm7,[.interpspad+18] - movq [es:edi+24],mm7 - movq [.interpspad+22],mm5 - movq mm7,[.interpspad+24] - movq [es:edi+32],mm7 - add edi,40 - add edx,32 - dec ecx - jnz near .a6 -; add edi,128*2 -.norepeat - - dec byte[lineleft] - jnz near .a5 - emms - pop es - ret - -SECTION .bss -.interpspad resd 8 -SECTION .text - - -MMXInterpol: - mov dl,[resolutn] - sub dl,3 - movq mm2,[HalfTransC] - - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopab - cmp byte[newengen],0 - je .loopab - mov ebx,SpecialLine+1 -.loopab - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],2 - je near .scanlinesquart - cmp byte[scanlines],3 - je near .scanlineshalf - inc ebx - mov [lineleft],dl - ; do scanlines - mov edx,[spritetablea] - mov ecx,64 - mov eax,[esi+510] - add edx,512 - mov [esi+512],eax -.a2 - movq mm0,[esi] - movq mm3,mm0 - movq mm4,mm0 - movq mm1,[esi+2] - por mm3,mm1 - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - pand mm3,[HalfTransB] - paddw mm0,mm3 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [es:edi],mm4 - movq [es:edi+8],mm5 - movq [edx],mm4 - movq [edx+8],mm5 - add esi,8 - add edi,16 - add edx,16 - dec ecx - jnz .a2 - add esi,64 - add edi,128*2 -.a5 - cmp byte[ebx],1 - jbe .ignorehr - call HighResProc - movq mm2,[HalfTransC] -.nothrcopy - jmp .returninterp -.ignorehr - mov eax,[esi+510] - mov ecx,64 - mov [esi+512],eax - mov edx,[spritetablea] - add edx,512 - ; Process next line -.a3 - movq mm0,[esi] - movq mm3,mm0 - movq mm4,mm0 - movq mm1,[esi+2] - por mm3,mm1 - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - pand mm3,[HalfTransB] - paddw mm0,mm3 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - movq mm6,[edx] - movq mm7,[edx+8] - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [edx],mm4 - movq [edx+8],mm5 - por mm0,mm4 - movq mm0,mm6 - pand mm4,mm2 - pand mm6,mm2 - psrlw mm4,1 - psrlw mm6,1 - pand mm0,[HalfTransB] - paddd mm4,mm6 - paddw mm4,mm0 - movq mm0,mm5 - por mm0,mm7 - pand mm5,mm2 - pand mm7,mm2 - psrlw mm5,1 - pand mm0,[HalfTransB] - psrlw mm7,1 - paddd mm5,mm7 - paddw mm5,mm0 - movq [es:edi],mm4 - movq [es:edi+8],mm5 - add esi,8 - add edi,16 - add edx,16 - dec ecx - jnz near .a3 - add edi,128*2 - mov edx,[spritetablea] - add edx,512 - mov ecx,64 -.a4 - movq mm0,[edx] - movq mm1,[edx+8] - movq [es:edi],mm0 - movq [es:edi+8],mm1 - add edi,16 - add edx,16 - dec ecx - jnz .a4 -.returninterp - add esi,64 - add edi,128*2 - inc ebx - dec byte[lineleft] - jnz near .a5 - emms - pop es - ret -SECTION .bss -.blank resd 2 -SECTION .text - -.scanlines - inc dl - mov [lineleft],dl - ; do scanlines - mov eax,[esi+510] - mov ecx,64 - mov [esi+512],eax -.asl - cmp byte[ebx],1 - jbe .ignorehrs - call HighResProc - movq mm2,[HalfTrans] - jmp .returninterps -.ignorehrs -.a - movq mm0,[esi] - movq mm4,mm0 - movq mm1,[esi+2] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [es:edi],mm4 - movq [es:edi+8],mm5 - add esi,8 - add edi,16 - dec ecx - jnz .a - mov eax,[esi+510+64] - mov [esi+512+64],eax -.returninterps - add esi,64 - add edi,128*2 - add edi,640*2 - inc ebx - mov ecx,64 - dec byte[lineleft] - jnz near .asl - emms - pop es - ret - -.scanlineshalf - inc dl - mov [lineleft],dl - ; do scanlines -.ahb - cmp byte[ebx],1 - jbe .ignorehrhs - call HighResProc - movq mm2,[HalfTrans] - jmp .returninterphs -.ignorehrhs - mov eax,[esi+510] - mov ecx,64 - mov [esi+512],eax - mov edx,[spritetablea] - add edx,512 -.ah - movq mm0,[esi] - movq mm4,mm0 - movq mm1,[esi+2] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [edx],mm4 - movq [edx+8],mm5 - movq [es:edi],mm4 - movq [es:edi+8],mm5 - add esi,8 - add edi,16 - add edx,16 - dec ecx - jnz .ah - add edi,128*2 - sub edx,16*64 - mov ecx,64 -.ahc - movq mm0,[edx] - movq mm1,[edx+8] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - movq [es:edi],mm0 - movq [es:edi+8],mm1 - add edi,16 - add edx,16 - dec ecx - jnz .ahc -.returninterphs - add edi,128*2 - add esi,64 - inc ebx - dec byte[lineleft] - jnz near .ahb - emms - pop es - ret - -.scanlinesquart - inc dl - mov [lineleft],dl - ; do scanlines -.ahb2 - cmp byte[ebx],1 - jbe .ignorehrqs - call HighResProc - movq mm2,[HalfTransC] - jmp .returninterpqs -.ignorehrqs - mov eax,[esi+510] - mov ecx,64 - mov [esi+512],eax - mov edx,[spritetablea] - add edx,512 -.ah2 - movq mm0,[esi] - movq mm3,mm0 - movq mm4,mm0 - movq mm1,[esi+2] - por mm3,mm1 - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - pand mm3,[HalfTransB] - paddw mm0,mm3 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [edx],mm4 - movq [edx+8],mm5 - movq [es:edi],mm4 - movq [es:edi+8],mm5 - add esi,8 - add edi,16 - add edx,16 - dec ecx - jnz .ah2 - add edi,128*2 - sub edx,16*64 - mov ecx,64 -.ahc2 - movq mm0,[edx] - movq mm1,[edx+8] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - movq mm4,mm0 - movq mm5,mm1 - pand mm4,mm2 - pand mm5,mm2 - psrlw mm4,1 - psrlw mm5,1 - paddd mm0,mm4 - paddd mm1,mm5 - movq [es:edi],mm0 - movq [es:edi+8],mm1 - add edi,16 - add edx,16 - dec ecx - jnz .ahc2 -.returninterpqs - add esi,64 - add edi,128*2 - inc ebx - dec byte[lineleft] - jnz near .ahb2 - emms - pop es - ret - -SECTION .bss -NEWSYM InterPtr, resd 1 -SECTION .text - -NEWSYM interpolate640x480x16b - cmp byte[MMXSupport],1 - je near MMXInterpol - mov byte[MMXSupport],0 - - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabi - cmp byte[newengen],0 - je .loopabi - mov ebx,SpecialLine+1 -.loopabi - mov [InterPtr],ebx - - mov dl,[resolutn] - sub dl,3 - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],2 - je near .scanlinesquart - cmp byte[scanlines],3 - je near .scanlineshalf - inc dword[InterPtr] - mov [lineleft],dl - ; do first line - mov ecx,255 - mov edx,[spritetablea] -.a - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov bx,[esi] - mov [es:edi],ebx - mov [edx],ebx - add esi,byte 2 - add edi,4 - add edx,4 - dec ecx - jnz .a - add esi,66 - add edi,130*2 -.loopb - mov ebx,[InterPtr] - cmp byte[ebx],1 - jbe .ignorehr - call HighResProc - jmp .returninterp -.ignorehr - mov ecx,255 - mov edx,[spritetablea] -.c - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov eax,[edx] - mov bx,[esi] - and eax,[HalfTrans] - mov [edx],ebx - and ebx,[HalfTrans] - shr eax,1 - shr ebx,1 - add eax,ebx - mov [es:edi],eax - add esi,byte 2 - add edi,4 - add edx,4 - dec ecx - jnz .c - add edi,130*2 - mov edx,[spritetablea] - mov ecx,255 -.d - mov eax,[edx] - mov [es:edi],eax - add edx,4 - add edi,4 - dec ecx - jnz .d - inc dword[InterPtr] - add esi,66 - add edi,130*2 - dec byte[lineleft] - jnz near .loopb - pop es - ret -.returninterp - inc dword[InterPtr] - add esi,64 - add edi,128*2 - dec byte[lineleft] - jnz near .loopb - pop es - ret - -.scanlines - xor eax,eax - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabis - cmp byte[newengen],0 - je .loopabis - mov ebx,SpecialLine+1 -.loopabis -.loopab - mov ecx,255 - cmp byte[Triplebufen],1 - je .ignorehrb - cmp byte[ebx],1 - jbe .ignorehrs - call HighResProc - jmp .returninterps -.ignorehrs - cmp byte[ebx],1 - je .yeshiresb -.ignorehrb - push ebx -.ab - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov bx,[esi] - mov [es:edi],ebx - add esi,byte 2 - add edi,4 - dec ecx - jnz .ab - pop ebx -.returnb - add esi,66 - add edi,130*2+640*2 - inc ebx - dec dl - jnz .loopab - pop es - cmp byte[Triplebufen],1 - je .ignorehr2b - xor byte[res512switch],1 -.ignorehr2b - ret -.yeshiresb - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightsideb -.bb - mov ax,[esi] - mov [es:edi],ax - add esi,byte 2 - add edi,4 - dec ecx - jnz .bb - jmp .returnb -.rightsideb -.cb - mov ax,[esi] - mov [es:edi+2],ax - add esi,byte 2 - add edi,4 - dec ecx - jnz .cb - jmp .returnb -.returninterps - add esi,64 - inc dword[InterPtr] - add edi,128*2+640*2 - inc ebx - dec byte[lineleft] - jnz near .loopab - pop es - ret - -.scanlineshalf - xor eax,eax - mov [lineleft],dl -.loopab2 - mov ebx,[InterPtr] - cmp byte[ebx],1 - jbe .ignorehrhs - call HighResProc - jmp .returninterphs -.ignorehrhs - mov ecx,255 - mov edx,[spritetablea] - add edx,512 -.ab2 - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov bx,[esi] - mov [edx],ebx - mov [es:edi],ebx - add esi,byte 2 - add edi,4 - add edx,4 - dec ecx - jnz .ab2 - add edi,130*2 - mov ecx,255 - mov edx,[spritetablea] - add edx,512 -.ab2b - mov eax,[edx] - and eax,[HalfTrans] - shr eax,1 - mov [es:edi],eax - add edi,4 - add edx,4 - dec ecx - jnz .ab2b - inc dword[InterPtr] - add esi,66 - add edi,130*2 - dec byte[lineleft] - jnz near .loopab2 - pop es - ret -.returninterphs - add esi,64 - inc dword[InterPtr] - add edi,128*2 - dec byte[lineleft] - jnz near .loopab2 - pop es - ret - -.scanlinesquart - xor eax,eax - mov [lineleft],dl -.loopab3 - mov ebx,[InterPtr] - cmp byte[ebx],1 - jbe .ignorehrqs - call HighResProc - jmp .returninterpqs -.ignorehrqs - mov ecx,255 - mov edx,[spritetablea] - add edx,512 -.ab3 - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov bx,[esi] - mov [edx],ebx - mov [es:edi],ebx - add esi,byte 2 - add edi,4 - add edx,4 - dec ecx - jnz .ab3 - add edi,130*2 - mov ecx,255 - mov edx,[spritetablea] - add edx,512 -.ab3b - mov eax,[edx] - and eax,[HalfTrans] - shr eax,1 - mov ebx,eax - and ebx,[HalfTrans] - shr ebx,1 - add eax,ebx - mov [es:edi],eax - add edi,4 - add edx,4 - dec ecx - jnz .ab3b - inc dword[InterPtr] - add esi,66 - add edi,130*2 - dec byte[lineleft] - jnz near .loopab3 - pop es - ret -.returninterpqs - add esi,64 - inc dword[InterPtr] - add edi,128*2 - dec byte[lineleft] - jnz near .loopab2 - pop es - ret - -;******************************************************* -; Copy VESA2 640x480x16b, bit setting 1:5:5:5 -;******************************************************* - -SECTION .bss -.interpspad resd 8 - -SECTION .text - -;******************************************************* -; Copy VESA2 512x384x16b Copies buffer to 512x384x16bV2 -;******************************************************* - -;NEWSYM copyvesa2512x384x16bgui -; cmp byte[curblank],40h -; jne .startcopy -; ret -;.startcopy -; push es -; mov byte[.lastrep],0 -; mov ax,[vesa2selec] -; mov es,ax -; mov esi,[vidbuffer] -; mov byte[.scratio],61 ; 60.6695 -; cmp word[resolutn],224 -; jne .res239 -; mov byte[.scratio],72 ; 72.4286 -;.res239 -; mov edi,[VidStartDraw] -; add esi,16+256+32 -; xor eax,eax -; mov dl,[resolutn] -; sub dl,2 -; xor dh,dh -;.loopa -; mov ecx,256 -; xor eax,eax -;.a -; mov al,[esi] -; mov bx,[GUICPC+eax*2] -; mov [es:edi],bx -; mov [es:edi+2],bx -; inc esi -; add edi,4 -; dec ecx -; jnz .a -; cmp byte[.lastrep],1 -; je .no2 -; sub dh,[.scratio] -; jnc .no2 -; add dh,100 -; sub esi,256 -; inc dl -; dec ebx -; mov byte[.lastrep],1 -; jmp .yes2 -;.no2 -; mov byte[.lastrep],0 -; add esi,32 -;.yes2 -; dec dl -; jnz .loopa -; pop es -; ret -; - -NEWSYM copyvesa2512x384x16b - cmp byte[vesa2red10],1 - jne .noconvertr - call ConvertToAFormat -.noconvertr - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - cmp byte[smallscreenon],1 - je near .smallscreen - push es - mov byte[.lastrep],0 - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov byte[.scratio],61 ; 60.6695 - cmp word[resolutn],224 - jne .res239 - mov byte[.scratio],72 ; 72.4286 -.res239 - mov edi,[VidStartDraw] - add esi,16*2+256*2+32*2 - xor eax,eax - mov ebx,hirestiledat+1 - mov dl,[resolutn] - dec dl - dec dl - xor dh,dh -.loopa - mov al,[ebx] - mov [.p512],al - cmp byte[Triplebufen],1 - je .ignorehr - cmp al,1 - je near .yeshires -.ignorehr - mov ecx,256 -.a - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a -.returnloop - cmp byte[.lastrep],1 - je .no2 - sub dh,[.scratio] - jnc .no2 - add dh,100 - sub esi,512 - inc dl - mov al,[.p512] - mov [ebx],al - dec ebx - mov byte[.lastrep],1 - jmp .yes2 -.no2 - mov byte[.lastrep],0 - add esi,64 -.yes2 - inc ebx - dec dl - jnz .loopa - pop es - cmp byte[Triplebufen],1 - je .ignorehr2 - xor byte[res512switch],1 -.ignorehr2 - ret -.yeshires - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightside - mov ecx,256 -.b - mov ax,[esi] - mov [es:edi],ax - add esi,byte 2 - add edi,4 - dec ecx - jnz .b - jmp .returnloop -.rightside - mov ecx,256 -.b2 - mov ax,[esi] - mov [es:edi+2],ax - add esi,byte 2 - add edi,4 - dec ecx - jnz .b2 - jmp .returnloop - -.smallscreen - push es - mov ax,[vesa2selec] - mov es,ax - mov esi,[vidbuffer] - mov edi,[VidStartDraw] - add esi,16*2+256*2+32*2 - add edi,72*512*2+128*2 - cmp byte[resolutn],224 - jne .ssres239 - add edi,8*512*2 -.ssres239 - xor eax,eax - mov dl,[resolutn] - dec dl - dec dl - cmp byte[MMXSupport],1 - je .ssloopb -.ssloopa - mov ecx,64*2 - rep movsd - add esi,32*2 - add edi,128*2*2 - dec dl - jnz .ssloopa - jmp .done -.ssloopb - mov ecx,16*2 - MMXStuff - add esi,32*2 - add edi,128*2*2 - dec dl - jnz .ssloopb - emms -.done - pop es - ret - -SECTION .bss -.scratio resb 1 -.lastrep resb 1 -.p512 resb 1 -SECTION .text - -; Temporary - -NEWSYM tempcopy - cmp byte[pressed+12],1 - jne .nocolch - mov byte[pressed+12],2 - add byte[.cocol],16 -.nocolch - cmp byte[pressed+13],1 - jne .nocolch2 - mov byte[pressed+13],2 - add dword[.startbuf],512*64 - cmp dword[.startbuf],512*64*4 - jne .nores - mov dword[.startbuf],0 -.nores -.nocolch2 - ; cache all sprites - call allcache - pusha - ; copy [vcache4b]+bg1objptr*2 into - xor ebx,ebx - mov bx,[objptr] - shl ebx,1 - add ebx,[vcache4b] - add ebx,[.startbuf] - mov edi,[vidbuffer] - add edi,16 - mov esi,edi - mov dh,16 -.loopd - mov dl,32 -.loopc - mov ch,8 -.loopb - mov cl,8 -.loopa - mov al,[ebx] - add al,[.cocol] - mov [edi],al - inc edi - inc ebx - dec cl - jnz .loopa - add edi,248+32 - dec ch - jnz .loopb - add esi,8 - mov edi,esi - dec dl - jnz .loopc - add esi,288*8-32*8 - mov edi,esi - dec dh - jnz .loopd - popa - ret - -SECTION .bss -.cocol resb 1 -.startbuf resd 1 -SECTION .text - -NEWSYM allcache - pushad - mov esi,[vram] - mov edi,[vcache4b] - mov ecx,2048 -.nextcache - ; convert from [esi] to [edi] - ; use ah = color 0, bl = color 1, bh = color 2, cl = color 3 - ; ch = color 4, dl = color 5, dh = color 6, .a = color 7 - push edi - push esi - push ecx - - mov byte[.rowleft],8 -.donext - xor ah,ah - xor ebx,ebx - xor ecx,ecx - xor edx,edx - mov byte[.a],0 - mov al,[esi] ; bitplane 0 - cmp al,0 - je .skipconva - test al,01h - jz .skipa0 - or ah,01h -.skipa0 - test al,02h - jz .skipa1 - or bl,01h -.skipa1 - test al,04h - jz .skipa2 - or bh,01h -.skipa2 - test al,08h - jz .skipa3 - or cl,01h -.skipa3 - test al,10h - jz .skipa4 - or ch,01h -.skipa4 - test al,20h - jz .skipa5 - or dl,01h -.skipa5 - test al,40h - jz .skipa6 - or dh,01h -.skipa6 - test al,80h - jz .skipa7 - or byte[.a],01h -.skipa7 -.skipconva - - mov al,[esi+1] ; bitplane 1 - cmp al,0 - je .skipconvb - test al,01h - jz .skipb0 - or ah,02h -.skipb0 - test al,02h - jz .skipb1 - or bl,02h -.skipb1 - test al,04h - jz .skipb2 - or bh,02h -.skipb2 - test al,08h - jz .skipb3 - or cl,02h -.skipb3 - test al,10h - jz .skipb4 - or ch,02h -.skipb4 - test al,20h - jz .skipb5 - or dl,02h -.skipb5 - test al,40h - jz .skipb6 - or dh,02h -.skipb6 - test al,80h - jz .skipb7 - or byte[.a],02h -.skipb7 -.skipconvb - - mov al,[esi+16] ; bitplane 2 - cmp al,0 - je .skipconvc - test al,01h - jz .skipc0 - or ah,04h -.skipc0 - test al,02h - jz .skipc1 - or bl,04h -.skipc1 - test al,04h - jz .skipc2 - or bh,04h -.skipc2 - test al,08h - jz .skipc3 - or cl,04h -.skipc3 - test al,10h - jz .skipc4 - or ch,04h -.skipc4 - test al,20h - jz .skipc5 - or dl,04h -.skipc5 - test al,40h - jz .skipc6 - or dh,04h -.skipc6 - test al,80h - jz .skipc7 - or byte[.a],04h -.skipc7 -.skipconvc - - mov al,[esi+17] ; bitplane 3 - cmp al,0 - je .skipconvd - test al,01h - jz .skipd0 - or ah,08h -.skipd0 - test al,02h - jz .skipd1 - or bl,08h -.skipd1 - test al,04h - jz .skipd2 - or bh,08h -.skipd2 - test al,08h - jz .skipd3 - or cl,08h -.skipd3 - test al,10h - jz .skipd4 - or ch,08h -.skipd4 - test al,20h - jz .skipd5 - or dl,08h -.skipd5 - test al,40h - jz .skipd6 - or dh,08h -.skipd6 - test al,80h - jz .skipd7 - or byte[.a],08h -.skipd7 -.skipconvd - - ; move all bytes into [edi] - mov [edi+7],ah - mov [edi+6],bl - mov [edi+5],bh - mov [edi+4],cl - mov [edi+3],ch - mov [edi+2],dl - mov [edi+1],dh - mov al,[.a] - mov [edi],al - add edi,8 - add esi,byte 2 - dec byte[.rowleft] - jnz near .donext - - pop ecx - pop esi - pop edi - - add esi,32 - add edi,64 - dec cx - jnz near .nextcache - popad - ret - -SECTION .bss -.nbg resw 1 -.a resb 1 -.rowleft resb 1 -SECTION .text - -;******************************************************* -; Copy VESA1.2 640x480x16b -;******************************************************* - -NEWSYM copyvesa12640x480x16b - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - cmp byte[vesa2red10],1 - jne .nocopyvesa2r - call ConvertToAFormat -.nocopyvesa2r - push es - mov word[bankpos],0 - call VESA12Bankswitch - mov ax,[selcA000] - mov es,ax - mov esi,[vidbuffer] - mov edi,32*2*2 ; Draw @ Y from 9 to 247 - cmp word[resolutn],224 - jne .res239 - mov edi,8*320*2*2+32*2*2 -.res239 - add esi,16*2+256*2+32*2 - xor eax,eax - ; Check if interpolation mode -.nommx - mov dl,[resolutn] - dec dl - dec dl - mov [lineleft],dl - mov edx,65536 - sub edx,edi - shr edx,2 - cmp byte[smallscreenon],1 - je near .smallscreen - cmp byte[scanlines],1 - je near .scanlines -.loopa - mov ecx,256 - precheckvesa12 256 -.a - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a - postcheckvesa12 .a,64,256,16384 - sub esi,256*2 - add edi,128*2 - mov ecx,256 - precheckvesa12 256 -.a2 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .a2 - postcheckvesa12 .a2,64,256,16384 - add esi,64 - add edi,128*2 - inc ebx - dec byte[lineleft] - jnz near .loopa - pop es - ret - -.scanlines -.loopab - mov ecx,256 - precheckvesa12 256 -.ab - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [es:edi],eax - add esi,byte 2 - add edi,4 - dec ecx - jnz .ab - postcheckvesa12 .ab,64+320,256,16384 - mov ecx,256 - add esi,64 - add edi,128*2+640*2 - inc ebx - dec byte[lineleft] - jnz near .loopab - pop es - ret - -.smallscreen -.loopac - mov ecx,128 - precheckvesa12 128 -.ac - movsd - dec ecx - jnz .ac - postcheckvesa12 .ac,64+128,128,16384 - mov ecx,128 - add esi,64 - add edi,128*2+256*2 - inc ebx - dec byte[lineleft] - jnz near .loopac - pop es - ret -%endif -;******************************************************* -; Clear Screen -;******************************************************* -%ifdef __MSDOS__ -NEWSYM DOSClearScreen - cmp byte[cvidmode],0 - je near cscopymodeq - cmp byte[cvidmode],1 - je near cscopymodeq - cmp byte[cvidmode],2 - je near cscopymodeq - cmp byte[cvidmode],3 - je near cscopymodex - cmp byte[cvidmode],4 - je near cscopymodex - cmp byte[cvidmode],5 - je near cscopymodex - cmp byte[cvidmode],6 - je near cscopyvesa12640x480x16b - cmp byte[cvidmode],7 - je near cscopyvesa2320x240x8b - cmp byte[cvidmode],8 - je near cscopyvesa2320x240x16b - cmp byte[cvidmode],9 - je near cscopyvesa2320x480x8b - cmp byte[cvidmode],10 - je near cscopyvesa2320x480x16b - cmp byte[cvidmode],11 - je near cscopyvesa2512x384x8b - cmp byte[cvidmode],12 - je near cscopyvesa2512x384x16b - cmp byte[cvidmode],13 - je near cscopyvesa2640x400x8b - cmp byte[cvidmode],14 - je near cscopyvesa2640x400x16b - cmp byte[cvidmode],15 - je near cscopyvesa2640x480x8b - cmp byte[cvidmode],16 - je near cscopyvesa2640x480x16b - cmp byte[cvidmode],17 - je near cscopyvesa2800x600x8b - cmp byte[cvidmode],18 - je near cscopyvesa2800x600x16b - ret -%endif - -%macro TripleBufferClear 0 - cmp byte[Triplebufen],0 - je %%noclear - push ebx - mov ebx,ecx - add ecx,ebx - add ecx,ebx - pop ebx -%%noclear -%endmacro - -%ifdef __MSDOS__ -NEWSYM cscopymodeq - push es - mov ax,[selcA000] - mov es,ax - xor eax,eax - mov ecx,16384 - xor edi,edi - rep stosd - pop es - ret - -NEWSYM cscopymodex - ; select all planes - mov edx,03C4h - mov eax,0F02h - out dx,ax - push es - mov ax,[selcA000] - mov es,ax - xor edi,edi - mov ecx,65536/4 - xor eax,eax - rep stosd - pop es - ret - -NEWSYM cscopyvesa2320x240x8b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,320*240 - TripleBufferClear -.loop - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loop - pop es - ret - -NEWSYM cscopyvesa2320x240x16b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,320*240*2 - TripleBufferClear -.loop - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loop - pop es - ret - -NEWSYM cscopyvesa2640x480x8b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,640*480 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -NEWSYM cscopyvesa2640x480x16b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,640*480*2 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -NEWSYM cscopyvesa2800x600x8b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,800*600 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -NEWSYM cscopyvesa2800x600x16b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,800*600*2 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -NEWSYM cscopyvesa2640x400x8b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,640*400 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -NEWSYM cscopyvesa2640x400x16b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,640*400*2 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -NEWSYM cscopyvesa2320x480x8b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,320*480 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -NEWSYM cscopyvesa2320x480x16b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,320*480*2 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -NEWSYM cscopyvesa2512x384x8b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,512*384 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret - -NEWSYM cscopyvesa2512x384x16b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,[VidStartDraw] - mov ecx,512*384*2 - TripleBufferClear -.loopb - mov byte[es:edi],0 - inc edi - dec ecx - jnz .loopb - pop es - ret -%endif - -NEWSYM GetScreen -%ifdef __MSDOS__ - cmp byte[cvidmode],9 - je near getcopyvesa2320x240x16b - cmp byte[cvidmode],14 -; je near getcopyvesa2640x480x16b - cmp byte[cvidmode],12 -; je near getcopyvesa2512x384x16b -%endif - ret - -%ifdef __MSDOS__ -NEWSYM getcopyvesa2320x240x16b - push es - mov ax,[vesa2selec] - mov es,ax - mov edi,32*2 ; Draw @ Y from 9 to 247 - cmp word[resolutn],224 - jne .res239 - mov edi,8*320*2+32*2 -.res239 - add edi,[VidStartDraw] - xor ebx,ebx - mov bx,[resolutn] - mov esi,[vidbuffer] - add esi,32+288*2 - mov ecx,256 -.loop - mov ax,[es:edi] - mov [esi],ax - add edi,byte 2 - add esi,byte 2 - dec ecx - jnz .loop - add edi,128 - add esi,64 - mov ecx,256 - dec ebx - jnz .loop - pop es - cmp byte[vesa2red10],0 - jne .redvalue - ret -.redvalue - call ConvertImageDatared10 - ret - -ConvertImageDatared10: - xor ebx,ebx - mov bx,[resolutn] - mov esi,[vidbuffer] - add esi,32+288*2 - mov ecx,256 -.loop - mov ax,[esi] - mov dx,ax - and ax,0000000000011111b - and dx,0111111111100000b - shl dx,1 - or ax,dx - mov [esi],ax - add esi,byte 2 - dec ecx - jnz .loop - add esi,64 - mov ecx,256 - dec ebx - jnz .loop - ret - -NEWSYM cscopyvesa12640x480x16b - push es - mov word[bankpos],0 - call VESA12Bankswitch - mov ax,[selcA000] - mov es,ax - mov edi,32*2*2 ; Draw @ Y from 9 to 247 - xor eax,eax - mov dl,239 - dec dl - dec dl - mov [lineleft],dl - mov edx,65536 - sub edx,edi - shr edx,2 -.loopa - mov ecx,256 - precheckvesa12 256 - xor eax,eax -.a - mov [es:edi],eax - add edi,4 - dec ecx - jnz .a - postcheckvesa12 .a,64,256,16384 - add edi,128*2 - mov ecx,256 - precheckvesa12 256 - xor eax,eax -.a2 - mov [es:edi],eax - add edi,4 - dec ecx - jnz .a2 - postcheckvesa12 .a2,64,256,16384 - add edi,128*2 - inc ebx - dec byte[lineleft] - jnz near .loopa - pop es - ret -%endif - - diff --git a/tools/zsnes/src/video/copyvwin.asm b/tools/zsnes/src/video/copyvwin.asm deleted file mode 100644 index 65450dc..0000000 --- a/tools/zsnes/src/video/copyvwin.asm +++ /dev/null @@ -1,1554 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 vidbuffer,GUIOn,MMXSupport,resolutn,En2xSaI,antienab,scanlines -EXTSYM hirestiledat,res512switch,curblank,spritetablea,lineleft,_2xSaILineW -EXTSYM _2xSaISuperEagleLineW,_2xSaISuper2xSaILineW,newengen,cfield,HalfTrans -EXTSYM GUIOn2,FilteredGUI,SpecialLine,vidbufferofsb,HalfTransB,HalfTransC - -ALIGN32 -SECTION .bss -NEWSYM AddEndBytes, resd 1 ; Number of bytes between each line -NEWSYM NumBytesPerLine, resd 1 ; Total number of bytes per line (1024+AddEndBytes) -NEWSYM WinVidMemStart, resd 1 -SECTION .text - -NEWSYM copy640x480x16bwin - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - mov ax,ds - mov es,ax - mov esi,[vidbuffer] - mov edi,[WinVidMemStart] - add esi,16*2+256*2+32*2 -%ifdef __UNIXSDL__ - cmp byte[GUIOn],1 - je .not239 - cmp byte[resolutn],239 - jne .not239 - add esi,8*288*2 -.not239 -%endif - xor eax,eax - ; Check if interpolation mode - cmp byte[FilteredGUI],0 - jne .yi - cmp byte[GUIOn2],1 - je .nointerp -.yi - cmp byte[MMXSupport],1 - jne .nommx - cmp byte[En2xSaI],0 - jne near Process2xSaIwin -.nommx - cmp byte[antienab],1 - je near interpolate640x480x16bwin -.nointerp -%ifdef __UNIXSDL__ - mov dl,224 -%else - mov dl,[resolutn] -%endif - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],3 - je near .halfscanlines - cmp byte[scanlines],2 - je near .quartscanlines - - mov ebx,hirestiledat+1 - cmp byte[newengen],0 - je .loopa - mov ebx,SpecialLine+1 -.loopa - mov ecx,256 - cmp byte[ebx],1 - je near .yeshires - cmp byte[GUIOn],1 - je .ignorehr - cmp byte[ebx],1 - ja near .yeshiresng -.ignorehr - cmp byte[MMXSupport],1 - je near .mmx -.a - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .a - sub esi,256*2 - add edi,[AddEndBytes] - mov ecx,256 -.a2 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .a2 -.return - add esi,64 - add edi,[AddEndBytes] - inc ebx - dec dl - jnz near .loopa - xor byte[res512switch],1 - cmp byte[MMXSupport],1 - je .mmx2 - ret -.mmx2 - emms - ret -.yeshires - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightside - push ebx - mov ebx,[NumBytesPerLine] -.b - mov ax,[esi] - mov [edi],ax - mov [edi+ebx],ax - add esi,2 - add edi,4 - dec ecx - jnz .b - pop ebx - add edi,[NumBytesPerLine] - jmp .return -.rightside - push ebx - mov ebx,[NumBytesPerLine] -.c - mov ax,[esi] - mov [edi+2],ax - mov [edi+2+ebx],ax - add esi,2 - add edi,4 - dec ecx - jnz .c - pop ebx - add edi,[NumBytesPerLine] - jmp .return -.mmx - mov eax,[spritetablea] - mov ecx,64 - add eax,512 -.mmxr - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [edi],mm0 - punpckhwd mm1,mm1 - movq [edi+8],mm1 - movq [eax],mm0 - movq [eax+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxr - mov eax,[spritetablea] - mov ecx,32 - add eax,512 - add edi,[AddEndBytes] -.mmxr2 - movq mm0,[eax] - movq [edi],mm0 - movq mm1,[eax+8] - movq [edi+8],mm1 - movq mm2,[eax+16] - movq [edi+16],mm2 - movq mm3,[eax+24] - movq [edi+24],mm3 - add eax,32 - add edi,32 - dec ecx - jnz .mmxr2 - jmp .return -.yeshiresng - call HighResProc - jmp .return - -.bng - mov eax,[esi+75036*4-2] - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .bng - add edi,[AddEndBytes] - sub esi,256*2 - mov ecx,256 -.bngb - mov eax,[esi+75036*4-2] - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .bngb - jmp .return - -.scanlines - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopab - cmp byte[newengen],0 - je .loopab - mov ebx,SpecialLine+1 -.loopab - mov ecx,256 - cmp byte[ebx],1 - je .yeshiresb - cmp byte[ebx],1 - jbe .ignorehrb - call HighResProc - jmp .returnb -.ignorehrb - cmp byte[MMXSupport],1 - je near .mmxsl -.ab - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .ab -.returnb - add esi,64 - add edi,[AddEndBytes] - mov ecx,256 -.fslloop - mov dword[edi],0 - add edi,4 - dec ecx - jnz .fslloop - add edi,[AddEndBytes] - inc ebx - dec dl - jnz .loopab - xor byte[res512switch],1 - cmp byte[MMXSupport],1 - je near .mmx2 - ret -.yeshiresb - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightsideb -.bb - mov ax,[esi] - mov [edi],ax - add esi,2 - add edi,4 - dec ecx - jnz .bb - jmp .returnb -.rightsideb -.cb - mov ax,[esi] - mov [edi+2],ax - add esi,2 - add edi,4 - dec ecx - jnz .cb - jmp .returnb -.mmxsl - mov ecx,64 -.mmxrsl - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - punpckhwd mm1,mm1 - movq [edi],mm0 - movq [edi+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxrsl - jmp .returnb - -.halfscanlines - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabh - cmp byte[newengen],0 - je .loopabh - mov ebx,SpecialLine+1 -.loopabh - cmp byte[ebx],1 - jbe .ignorehrbh - call HighResProc - jmp .returnbh -.ignorehrbh - cmp byte[MMXSupport],1 - je near .mmxslh - mov ecx,256 -.abh - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .abh - mov ecx,256 - sub esi,512 - add edi,[AddEndBytes] -.abhs - mov ax,[esi] - shl eax,16 - mov ax,[esi] - and eax,[HalfTrans] - shr eax,1 - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .abhs -.returnbh - add esi,64 - add edi,[AddEndBytes] - inc ebx - dec dl - jnz near .loopabh - cmp byte[MMXSupport],1 - je near .mmx2 - ret -.mmxslh - mov eax,[spritetablea] - mov ecx,64 - add eax,512 -.mmxrslh - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - punpckhwd mm1,mm1 - movq [edi],mm0 - movq [edi+8],mm1 - movq [eax],mm0 - movq [eax+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxrslh - mov eax,[spritetablea] - mov ecx,32 - add eax,512 - add edi,[AddEndBytes] - movq mm4,[HalfTrans] -.mmxr2h - movq mm0,[eax] - movq mm1,[eax+8] - movq mm2,[eax+16] - movq mm3,[eax+24] - pand mm0,mm4 - pand mm1,mm4 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm0,1 - psrlw mm1,1 - psrlw mm2,1 - psrlw mm3,1 - movq [edi],mm0 - movq [edi+8],mm1 - movq [edi+16],mm2 - movq [edi+24],mm3 - add eax,32 - add edi,32 - dec ecx - jnz .mmxr2h - jmp .returnbh - -.quartscanlines - mov [lineleft],dl - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabh2 - cmp byte[newengen],0 - je .loopabh2 - mov ebx,SpecialLine+1 -.loopabh2 - cmp byte[ebx],1 - jbe .ignorehrbh2 - call HighResProc - jmp .returnbh2 -.ignorehrbh2 - cmp byte[MMXSupport],1 - je near .mmxslh2 - mov ecx,256 -.abh2 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .abh2 - mov ecx,256 - sub esi,512 - add edi,[AddEndBytes] -.abhs2 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - and eax,[HalfTrans] - shr eax,1 - mov edx,eax - and edx,[HalfTrans] - shr edx,1 - add eax,edx - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .abhs2 -.returnbh2 - add esi,64 - add edi,[AddEndBytes] - inc ebx - dec byte[lineleft] - jnz near .loopabh2 - cmp byte[MMXSupport],1 - je near .mmx2 - ret -.mmxslh2 - mov eax,[spritetablea] - mov ecx,64 - add eax,512 -.mmxrslh2 - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - punpckhwd mm1,mm1 - movq [edi],mm0 - movq [edi+8],mm1 - movq [eax],mm0 - movq [eax+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxrslh2 - mov eax,[spritetablea] - mov ecx,64 - add eax,512 - add edi,[AddEndBytes] - movq mm4,[HalfTrans] -.mmxr2h2 - movq mm0,[eax] - movq mm1,[eax+8] - pand mm0,mm4 - pand mm1,mm4 - psrlw mm0,1 - psrlw mm1,1 - movq mm2,mm0 - movq mm3,mm1 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm2,1 - psrlw mm3,1 - paddd mm0,mm2 - paddd mm1,mm3 - movq [edi],mm0 - movq [edi+8],mm1 - add eax,16 - add edi,16 - dec ecx - jnz .mmxr2h2 - jmp .returnbh2 - -HighResProc: - mov ecx,256 - cmp byte[ebx],3 - je near .hiresmode7 - cmp byte[ebx],7 - je near .hiresmode7 - test byte[ebx],4 - jz .nofield - cmp byte[scanlines],0 - jne .nofield - test byte[cfield],1 - jz .nofield - add edi,[NumBytesPerLine] -.nofield - test byte[ebx],3 - jnz near .hires -.a - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .a - cmp byte[scanlines],0 - jne .nofield - test byte[cfield],1 - jnz .nofielde - add edi,[NumBytesPerLine] -.nofielde - ret -.hiresmode7 - cmp byte[MMXSupport],1 - je .yeshiresngmmxmode7 -.a2 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .a2 - add edi,[AddEndBytes] - sub esi,512 - mov ecx,256 - add esi,75036*4 -.a2b - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .a2b - sub esi,75036*4 - ret -.yeshiresngmmxmode7 - mov ecx,64 -.mmxr - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [edi],mm0 - punpckhwd mm1,mm1 - movq [edi+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxr - add edi,[AddEndBytes] - sub esi,512 - add esi,75036*4 - mov ecx,64 -.mmxrb - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [edi],mm0 - punpckhwd mm1,mm1 - movq [edi+8],mm1 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .mmxrb - sub esi,75036*4 - ret -.hires - cmp byte[MMXSupport],1 - je near .yeshiresngmmx -.bng - mov eax,[esi+75036*4-2] - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .bng - test byte[ebx],4 - jz .nofieldb - cmp byte[scanlines],0 - jne .nofieldb - test byte[cfield],1 - jnz .lowerfield - add edi,[NumBytesPerLine] -.lowerfield - ret -.nofieldb - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],3 - je near .halfscanlines - cmp byte[scanlines],2 - je near .quartscanlines - add edi,[AddEndBytes] - sub esi,256*2 - mov ecx,256 -.bngb - mov eax,[esi+75036*4-2] - mov ax,[esi] - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .bngb - ret -.scanlines - ret -.yeshiresngmmx - mov eax,[spritetablea] - mov ecx,64 - add eax,512 -.ngal - movq mm0,[esi] - movq mm1,[esi+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - movq [edi],mm0 - punpckhwd mm2,mm1 - movq [edi+8],mm2 - movq [eax],mm0 - movq [eax+8],mm2 - add esi,8 - add edi,16 - add eax,16 - dec ecx - jnz .ngal - test byte[ebx],4 - jz .nofieldc - cmp byte[scanlines],0 - jne .nofieldc - test byte[cfield],1 - jnz .lowerfieldb - add edi,[NumBytesPerLine] -.lowerfieldb - ret -.nofieldc - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],3 - je near .halfscanlinesmmx - cmp byte[scanlines],2 - je near .quartscanlinesmmx - test byte[ebx+1],3 - jz .noaa - cmp byte[En2xSaI],0 - jne near .antialias - cmp byte[antienab],0 - jne near .antialias -.noaa - add edi,[AddEndBytes] - mov eax,[spritetablea] - mov ecx,32 - add eax,512 -.mmxr2 - movq mm0,[eax] - movq [edi],mm0 - movq mm1,[eax+8] - movq [edi+8],mm1 - movq mm2,[eax+16] - movq [edi+16],mm2 - movq mm3,[eax+24] - movq [edi+24],mm3 - add eax,32 - add edi,32 - dec ecx - jnz .mmxr2 - ret -.antialias - add edi,[AddEndBytes] - mov eax,[spritetablea] - mov ecx,64 - add eax,512 - movq mm4,[HalfTrans] - sub esi,256*2 -.mmxr2aa - movq mm0,[esi+288*2] - movq mm1,[esi+288*2+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - punpckhwd mm2,mm1 - movq mm1,[eax] - movq mm3,[eax+8] - pand mm0,mm4 - pand mm1,mm4 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm0,1 - psrlw mm1,1 - psrlw mm2,1 - psrlw mm3,1 - paddd mm0,mm1 - paddd mm2,mm3 - movq [edi],mm0 - movq [edi+8],mm2 - add eax,16 - add edi,16 - add esi,8 - dec ecx - jnz .mmxr2aa - ret -.halfscanlines - add edi,[AddEndBytes] - sub esi,256*2 - mov ecx,256 -.abhs - mov eax,[esi+75036*4-2] - mov ax,[esi] - and eax,[HalfTrans] - shr eax,1 - mov edx,eax - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .abhs - ret -.quartscanlines - add edi,[AddEndBytes] - sub esi,256*2 - mov ecx,256 -.abhs2 - mov eax,[esi+75036*4-2] - mov ax,[esi] - and eax,[HalfTrans] - shr eax,1 - mov edx,eax - and edx,[HalfTrans] - shr edx,1 - add eax,edx - mov [edi],eax - add esi,2 - add edi,4 - dec ecx - jnz .abhs2 - ret -.halfscanlinesmmx - mov eax,[spritetablea] - mov ecx,32 - add eax,512 - add edi,[AddEndBytes] - movq mm4,[HalfTrans] -.mmxr2h - movq mm0,[eax] - movq mm1,[eax+8] - movq mm2,[eax+16] - movq mm3,[eax+24] - pand mm0,mm4 - pand mm1,mm4 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm0,1 - psrlw mm1,1 - psrlw mm2,1 - psrlw mm3,1 - movq [edi],mm0 - movq [edi+8],mm1 - movq [edi+16],mm2 - movq [edi+24],mm3 - add eax,32 - add edi,32 - dec ecx - jnz .mmxr2h - ret -.quartscanlinesmmx - mov eax,[spritetablea] - mov ecx,64 - add eax,512 - add edi,[AddEndBytes] - movq mm4,[HalfTransC] -.mmxr2h2 - movq mm0,[eax] - movq mm1,[eax+8] - pand mm0,mm4 - pand mm1,mm4 - psrlw mm0,1 - psrlw mm1,1 - movq mm2,mm0 - movq mm3,mm1 - pand mm2,mm4 - pand mm3,mm4 - psrlw mm2,1 - psrlw mm3,1 - paddd mm0,mm2 - paddd mm1,mm3 - movq [edi],mm0 - movq [edi+8],mm1 - add eax,16 - add edi,16 - dec ecx - jnz .mmxr2h2 - ret - -Process2xSaIwin: - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabi - cmp byte[newengen],0 - je .loopabi - mov ebx,SpecialLine+1 -.loopabi - mov [InterPtr],ebx - -; add edi,[VESAAddr] -%ifdef __UNIXSDL__ - mov dl,223 -%else - mov dl,[resolutn] - sub dl,1 ; Compensate for top/bottom line + 2 lines in 2xSaI -%endif - mov [lineleft],dl - mov dword[esi+512],0 - mov dword[esi+512+576*2],0 - mov ebx,[vidbufferofsb] - add ebx,288*2 - -.next - mov dword[esi+512+576*3],0 - - mov eax,[InterPtr] - cmp byte[eax],1 - jbe .ignorehr - push ebx - mov ebx,[InterPtr] - call HighResProc - pop ebx - push ebx - mov ecx,144 -.nextb - mov dword[ebx],0FFFFFFFFh - add ebx,4 - dec ecx - jnz .nextb - pop ebx - jmp .returninterp -.ignorehr - -;srcPtr equ 8 -;deltaPtr equ 12 -;srcPitch equ 16 -;width equ 20 -;dstOffset equ 24 -;dstPitch equ 28 -;dstSegment equ 32 - - - push ebx - mov eax,[NumBytesPerLine] - push eax - mov eax,edi ; destination offset - push eax - mov eax,256 ; width - push eax - mov eax,576 ; source pitch - push eax - push ebx - mov eax,esi ; source pointer - push eax - cmp byte[En2xSaI],2 - je .supereagle - cmp byte[En2xSaI],3 - je .super2xSaI - call _2xSaILineW - jmp .normal -.supereagle - call _2xSaISuperEagleLineW - jmp .normal -.super2xSaI - call _2xSaISuper2xSaILineW -.normal - add esp,24 - pop ebx - add esi,576 - add edi,[NumBytesPerLine] - add edi,[NumBytesPerLine] - add ebx,576 - inc dword[InterPtr] - dec dword[lineleft] - jnz near .next - mov ecx,256 - sub edi,[NumBytesPerLine] -.loop - mov dword[es:edi],0 - add edi,4 - dec ecx - jnz .loop - emms - ret -.returninterp - add esi,64 - inc dword[InterPtr] - add edi,[AddEndBytes] - add ebx,576 - dec byte[lineleft] - jnz near .next - emms - ret - -MMXInterpolwin: - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopab - cmp byte[newengen],0 - je .loopab - mov ebx,SpecialLine+1 -.loopab - -%ifdef __UNIXSDL__ - mov dl,224 -%else - mov dl,[resolutn] -%endif - movq mm2,[HalfTransC] - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],2 - je near .scanlinesquart - cmp byte[scanlines],3 - je near .scanlineshalf - inc ebx - mov [lineleft],dl - ; do scanlines - mov edx,[spritetablea] - mov ecx,64 - mov eax,[esi+510] - add edx,512 - mov [esi+512],eax -.a2 - movq mm0,[esi] - movq mm3,mm0 - movq mm4,mm0 - movq mm1,[esi+2] - por mm3,mm1 - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - pand mm3,[HalfTransB] - paddw mm0,mm3 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [edi],mm4 - movq [edi+8],mm5 - movq [edx],mm4 - movq [edx+8],mm5 - add esi,8 - add edi,16 - add edx,16 - dec ecx - jnz .a2 - add esi,64 - add edi,[AddEndBytes] -.a5 - cmp byte[ebx],1 - jbe .ignorehr - call HighResProc - movq mm2,[HalfTransC] - jmp .returninterp -.ignorehr - mov eax,[esi+510] - mov ecx,64 - mov [esi+512],eax - mov edx,[spritetablea] - add edx,512 - ; Process next line -.a3 - movq mm0,[esi] - movq mm3,mm0 - movq mm4,mm0 - movq mm1,[esi+2] - por mm3,mm1 - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - pand mm3,[HalfTransB] - paddw mm0,mm3 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - movq mm6,[edx] - movq mm7,[edx+8] - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [edx],mm4 - movq [edx+8],mm5 - movq mm0,mm6 - por mm0,mm4 - pand mm4,mm2 - pand mm6,mm2 - psrlw mm4,1 - psrlw mm6,1 - pand mm0,[HalfTransB] - paddd mm4,mm6 - paddw mm4,mm0 - movq mm0,mm5 - por mm0,mm7 - pand mm5,mm2 - pand mm7,mm2 - psrlw mm5,1 - pand mm0,[HalfTransB] - psrlw mm7,1 - paddd mm5,mm7 - paddw mm5,mm0 - movq [edi],mm4 - movq [edi+8],mm5 - add esi,8 - add edi,16 - add edx,16 - dec ecx - jnz near .a3 - add edi,[AddEndBytes] - mov edx,[spritetablea] - add edx,512 - mov ecx,64 -.a4 - movq mm0,[edx] - movq mm1,[edx+8] - movq [edi],mm0 - movq [edi+8],mm1 - add edi,16 - add edx,16 - dec ecx - jnz .a4 -.returninterp - add esi,64 - add edi,[AddEndBytes] - inc ebx - dec byte[lineleft] - jnz near .a5 - emms - ret - -.scanlines - inc dl - mov [lineleft],dl - ; do scanlines - mov eax,[esi+510] - mov ecx,64 - mov [esi+512],eax -.asl - cmp byte[ebx],1 - jbe .ignorehrs - call HighResProc - movq mm2,[HalfTrans] - jmp .returninterps -.ignorehrs -.a - movq mm0,[esi] - movq mm4,mm0 - movq mm1,[esi+2] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [edi],mm4 - movq [edi+8],mm5 - add esi,8 - add edi,16 - dec ecx - jnz .a -.returninterps - add esi,64 - add edi,[AddEndBytes] - mov ecx,256 -.fslloop - mov dword[edi],0 - add edi,4 - dec ecx - jnz .fslloop - add edi,[AddEndBytes] - inc ebx - mov ecx,64 - dec byte[lineleft] - jnz near .asl - emms - ret - -.scanlineshalf - inc dl - mov [lineleft],dl - ; do scanlines -.ahb - cmp byte[ebx],1 - jbe .ignorehrhs - call HighResProc - movq mm2,[HalfTrans] - jmp .returninterphs -.ignorehrhs - mov eax,[esi+510] - mov ecx,64 - mov [esi+512],eax - mov edx,[spritetablea] - add edx,512 -.ah - movq mm0,[esi] - movq mm4,mm0 - movq mm1,[esi+2] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [edx],mm4 - movq [edx+8],mm5 - movq [edi],mm4 - movq [edi+8],mm5 - add esi,8 - add edi,16 - add edx,16 - dec ecx - jnz .ah - add edi,[AddEndBytes] - sub edx,16*64 - mov ecx,64 -.ahc - movq mm0,[edx] - movq mm1,[edx+8] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - movq [edi],mm0 - movq [edi+8],mm1 - add edi,16 - add edx,16 - dec ecx - jnz .ahc -.returninterphs - add edi,[AddEndBytes] - add esi,64 - inc ebx - dec byte[lineleft] - jnz near .ahb - emms - ret - -.scanlinesquart - inc dl - mov [lineleft],dl - ; do scanlines -.ahb2 - cmp byte[ebx],1 - jbe .ignorehrqs - call HighResProc - movq mm2,[HalfTransC] - jmp .returninterpqs -.ignorehrqs - mov eax,[esi+510] - mov ecx,64 - mov [esi+512],eax - mov edx,[spritetablea] - add edx,512 -.ah2 - movq mm0,[esi] - movq mm3,mm0 - movq mm4,mm0 - movq mm1,[esi+2] - por mm3,mm1 - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - paddd mm0,mm1 - pand mm3,[HalfTransB] - paddw mm0,mm3 - movq mm5,mm4 - ; mm4/mm5 contains original values, mm0 contains mixed values - punpcklwd mm4,mm0 - punpckhwd mm5,mm0 - movq [edx],mm4 - movq [edx+8],mm5 - movq [edi],mm4 - movq [edi+8],mm5 - add esi,8 - add edi,16 - add edx,16 - dec ecx - jnz .ah2 - add edi,[AddEndBytes] - sub edx,16*64 - mov ecx,64 - movq mm3,mm2 -.ahc2 - movq mm0,[edx] - movq mm1,[edx+8] - pand mm0,mm2 - pand mm1,mm2 - psrlw mm0,1 - psrlw mm1,1 - movq mm4,mm0 - movq mm5,mm1 - pand mm4,mm2 - pand mm5,mm2 - psrlw mm4,1 - psrlw mm5,1 - paddd mm0,mm4 - paddd mm1,mm5 - movq [edi],mm0 - movq [edi+8],mm1 - add edi,16 - add edx,16 - dec ecx - jnz .ahc2 -.returninterpqs - add esi,64 - add edi,[AddEndBytes] - inc ebx - dec byte[lineleft] - jnz near .ahb2 - emms - ret - -NEWSYM interpolate640x480x16bwin - cmp byte[MMXSupport],1 - je near MMXInterpolwin - - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabi - cmp byte[newengen],0 - je .loopabi - mov ebx,SpecialLine+1 -.loopabi - mov [InterPtr],ebx - -%ifdef __UNIXSDL__ - mov dl,224 -%else - mov dl,[resolutn] -%endif - cmp byte[scanlines],1 - je near .scanlines - cmp byte[scanlines],2 - je near .scanlinesquart - cmp byte[scanlines],3 - je near .scanlineshalf - inc dword[InterPtr] - mov [lineleft],dl - ; do first line - mov ecx,255 - mov edx,[spritetablea] -.a - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov bx,[esi] - mov [edi],ebx - mov [edx],ebx - add esi,2 - add edi,4 - add edx,4 - dec ecx - jnz .a - add esi,66 - add edi,[AddEndBytes] - add edi,4 -.loopb - mov ebx,[InterPtr] - cmp byte[ebx],1 - jbe .ignorehr - call HighResProc - jmp .returninterp -.ignorehr - mov ecx,255 - mov edx,[spritetablea] -.c - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov eax,[edx] - mov bx,[esi] - and eax,[HalfTrans] - mov [edx],ebx - and ebx,[HalfTrans] - shr eax,1 - shr ebx,1 - add eax,ebx - mov [edi],eax - add esi,2 - add edi,4 - add edx,4 - dec ecx - jnz .c - add edi,4 - add edi,[AddEndBytes] - mov edx,[spritetablea] - mov ecx,255 -.d - mov eax,[edx] - mov [edi],eax - add edx,4 - add edi,4 - dec ecx - jnz .d - add esi,66 - inc dword[InterPtr] - add edi,[AddEndBytes] - add edi,4 - dec byte[lineleft] - jnz near .loopb - ret -.returninterp - add esi,64 - inc dword[InterPtr] - add edi,[AddEndBytes] - dec byte[lineleft] - jnz near .loopb - ret - -.scanlines - xor eax,eax - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopabis - cmp byte[newengen],0 - je .loopabis - mov ebx,SpecialLine+1 -.loopabis -.loopab - mov ecx,255 - cmp byte[ebx],1 - jbe .ignorehrs - call HighResProc - jmp .returninterps -.ignorehrs - cmp byte[ebx],1 - je .yeshiresb -.ignorehrb - push ebx -.ab - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov bx,[esi] - mov [edi],ebx - add esi,2 - add edi,4 - dec ecx - jnz .ab - pop ebx -.returnb - add esi,66 - add edi,4 - add edi,[AddEndBytes] - mov ecx,256 -.fslloop - mov dword[edi],0 - add edi,4 - dec ecx - jnz .fslloop - add edi,[AddEndBytes] - inc ebx - dec dl - jnz .loopab - xor byte[res512switch],1 - ret -.yeshiresb - mov byte[ebx],0 - test byte[res512switch],1 - jnz .rightsideb -.bb - mov ax,[esi] - mov [edi],ax - add esi,2 - add edi,4 - dec ecx - jnz .bb - jmp .returnb -.rightsideb -.cb - mov ax,[esi] - mov [edi+2],ax - add esi,2 - add edi,4 - dec ecx - jnz .cb - jmp .returnb -.returninterps - add esi,64 - inc dword[InterPtr] - add edi,[AddEndBytes] - mov ecx,256 -.fslloop2 - mov dword[edi],0 - add edi,4 - dec ecx - jnz .fslloop2 - add edi,[AddEndBytes] - dec byte[lineleft] - jnz near .loopab - ret - -.scanlineshalf - xor eax,eax - mov [lineleft],dl -.loopab2 - mov ebx,[InterPtr] - cmp byte[ebx],1 - jbe .ignorehrhs - call HighResProc - jmp .returninterphs -.ignorehrhs - mov ecx,255 - mov edx,[spritetablea] - add edx,512 -.ab2 - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov bx,[esi] - mov [edx],ebx - mov [edi],ebx - add esi,2 - add edi,4 - add edx,4 - dec ecx - jnz .ab2 - add edi,4 - add edi,[AddEndBytes] - mov ecx,255 - mov edx,[spritetablea] - add edx,512 -.ab2b - mov eax,[edx] - and eax,[HalfTrans] - shr eax,1 - mov [edi],eax - add edi,4 - add edx,4 - dec ecx - jnz .ab2b - inc dword[InterPtr] - add esi,66 - add edi,4 - add edi,[AddEndBytes] - dec byte[lineleft] - jnz near .loopab2 - ret -.returninterphs - add esi,64 - inc dword[InterPtr] - add edi,[AddEndBytes] - dec byte[lineleft] - jnz near .loopab2 - ret - -.scanlinesquart - xor eax,eax - mov [lineleft],dl -.loopab3 - mov ebx,[InterPtr] - cmp byte[ebx],1 - jbe .ignorehrqs - call HighResProc - jmp .returninterpqs -.ignorehrqs - mov ecx,255 - mov edx,[spritetablea] - add edx,512 -.ab3 - mov ax,[esi] - mov bx,[esi+2] - and ebx,[HalfTrans+6] - and eax,[HalfTrans+6] - add ebx,eax - shl ebx,15 - mov bx,[esi] - mov [edx],ebx - mov [edi],ebx - add esi,2 - add edi,4 - add edx,4 - dec ecx - jnz .ab3 - add edi,[AddEndBytes] - add edi,4 - mov ecx,255 - mov edx,[spritetablea] - add edx,512 -.ab3b - mov eax,[edx] - and eax,[HalfTrans] - shr eax,1 - mov ebx,eax - and ebx,[HalfTrans] - shr ebx,1 - add eax,ebx - mov [edi],eax - add edi,4 - add edx,4 - dec ecx - jnz .ab3b - inc dword[InterPtr] - add esi,66 - add edi,4 - add edi,[AddEndBytes] - dec byte[lineleft] - jnz near .loopab3 - ret -.returninterpqs - add esi,64 - inc dword[InterPtr] - add edi,[AddEndBytes] - dec byte[lineleft] - jnz near .loopab3 - ret - -SECTION .data -InterPtr dd 0 -SECTION .text diff --git a/tools/zsnes/src/video/hq2x16.asm b/tools/zsnes/src/video/hq2x16.asm deleted file mode 100644 index abde5fd..0000000 --- a/tools/zsnes/src/video/hq2x16.asm +++ /dev/null @@ -1,2162 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -;---------------------------------------------------------- -; hq2x filter -; Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -;---------------------------------------------------------- - - - -%include "macros.mac" - -EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2,vidbufferofsb,FilteredGUI -EXTSYM resolutn,lineleft,cfield,hirestiledat,newengen,SpecialLine,HalfTrans -EXTSYM hqFilter,AddEndBytes,NumBytesPerLine,WinVidMemStart,BitConv32Ptr -EXTSYM RGBtoYUVPtr - -SECTION .bss -NEWSYM prevline, resd 1 -NEWSYM nextline, resd 1 -NEWSYM deltaptr, resd 1 -NEWSYM xcounter, resd 1 -NEWSYM w1, resd 1 -NEWSYM w2, resd 1 -NEWSYM w3, resd 1 -NEWSYM w4, resd 1 -NEWSYM w5, resd 1 -NEWSYM w6, resd 1 -NEWSYM w7, resd 1 -NEWSYM w8, resd 1 -NEWSYM w9, resd 1 -NEWSYM cross, resd 1 - -SECTION .data -NEWSYM reg_blank, dd 0,0 -NEWSYM const3, dd 0x00030003,0x00000003 -NEWSYM const5, dd 0x00050005,0x00000005 -NEWSYM const6, dd 0x00060006,0x00000006 -NEWSYM const7, dd 0x00070007,0x00000007 -NEWSYM const14, dd 0x000E000E,0x0000000E -NEWSYM threshold, dd 0x00300706,0x00000000 - -SECTION .text - -%macro TestDiff 2 - xor ecx,ecx - mov edx,[%1] - cmp edx,[%2] - je %%fin - mov ecx,[RGBtoYUVPtr] - movd mm1,[ecx+edx*4] - movq mm5,mm1 - mov edx,[%2] - movd mm2,[ecx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd ecx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 6 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - jmp %%fin -%%same: - %5 - %6 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - mov ecx,%3 - cmp edx,ecx - je %%fin - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro Interp2 4 - mov edx,%3 - mov ecx,%4 - cmp edx,ecx - je %%fin1 - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 -%%fin1 - mov edx,%2 - cmp edx,ecx - je %%fin2 - and ecx,[HalfTrans] - and edx,[HalfTrans] - add edx,ecx - shr edx,1 -%%fin2 - mov %1,dx -%endmacro - -%macro Interp5 3 - mov edx,%2 - mov ecx,%3 - cmp edx,ecx - je %%fin - and edx,[HalfTrans] - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro Interp6 3 - mov ecx, [BitConv32Ptr] - movd mm1, [ecx+eax*4] - mov edx, %2 - movd mm2, [ecx+edx*4] - mov edx, %3 - movd mm3, [ecx+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const5] - psllw mm2, 1 - paddw mm1, mm3 - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp7 3 - mov ecx, [BitConv32Ptr] - movd mm1, [ecx+eax*4] - mov edx, %2 - movd mm2, [ecx+edx*4] - mov edx, %3 - movd mm3, [ecx+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const6] - paddw mm2, mm3 - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp9 3 - mov ecx, [BitConv32Ptr] - movd mm1, [ecx+eax*4] - mov edx, %2 - movd mm2, [ecx+edx*4] - mov edx, %3 - movd mm3, [ecx+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - psllw mm1, 1 - paddw mm2, mm3 - pmullw mm2, [const3] - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp10 3 - mov ecx, [BitConv32Ptr] - movd mm1, [ecx+eax*4] - mov edx, %2 - movd mm2, [ecx+edx*4] - mov edx, %3 - movd mm3, [ecx+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const14] - paddw mm2, mm3 - paddw mm1, mm2 - psrlw mm1, 6 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro PIXEL00_0 0 - mov [edi],ax -%endmacro - -%macro PIXEL00_10 0 - Interp1 [edi],eax,[w1] -%endmacro - -%macro PIXEL00_11 0 - Interp1 [edi],eax,[w4] -%endmacro - -%macro PIXEL00_12 0 - Interp1 [edi],eax,[w2] -%endmacro - -%macro PIXEL00_20 0 - Interp2 [edi],eax,[w4],[w2] -%endmacro - -%macro PIXEL00_21 0 - Interp2 [edi],eax,[w1],[w2] -%endmacro - -%macro PIXEL00_22 0 - Interp2 [edi],eax,[w1],[w4] -%endmacro - -%macro PIXEL00_60 0 - Interp6 [edi],[w2],[w4] -%endmacro - -%macro PIXEL00_61 0 - Interp6 [edi],[w4],[w2] -%endmacro - -%macro PIXEL00_70 0 - Interp7 [edi],[w4],[w2] -%endmacro - -%macro PIXEL00_90 0 - Interp9 [edi],[w4],[w2] -%endmacro - -%macro PIXEL00_100 0 - Interp10 [edi],[w4],[w2] -%endmacro - -%macro PIXEL01_0 0 - mov [edi+2],ax -%endmacro - -%macro PIXEL01_10 0 - Interp1 [edi+2],eax,[w3] -%endmacro - -%macro PIXEL01_11 0 - Interp1 [edi+2],eax,[w2] -%endmacro - -%macro PIXEL01_12 0 - Interp1 [edi+2],eax,[w6] -%endmacro - -%macro PIXEL01_20 0 - Interp2 [edi+2],eax,[w2],[w6] -%endmacro - -%macro PIXEL01_21 0 - Interp2 [edi+2],eax,[w3],[w6] -%endmacro - -%macro PIXEL01_22 0 - Interp2 [edi+2],eax,[w3],[w2] -%endmacro - -%macro PIXEL01_60 0 - Interp6 [edi+2],[w6],[w2] -%endmacro - -%macro PIXEL01_61 0 - Interp6 [edi+2],[w2],[w6] -%endmacro - -%macro PIXEL01_70 0 - Interp7 [edi+2],[w2],[w6] -%endmacro - -%macro PIXEL01_90 0 - Interp9 [edi+2],[w2],[w6] -%endmacro - -%macro PIXEL01_100 0 - Interp10 [edi+2],[w2],[w6] -%endmacro - -%macro PIXEL10_0 0 - mov [edi+ebx],ax -%endmacro - -%macro PIXEL10_10 0 - Interp1 [edi+ebx],eax,[w7] -%endmacro - -%macro PIXEL10_11 0 - Interp1 [edi+ebx],eax,[w8] -%endmacro - -%macro PIXEL10_12 0 - Interp1 [edi+ebx],eax,[w4] -%endmacro - -%macro PIXEL10_20 0 - Interp2 [edi+ebx],eax,[w8],[w4] -%endmacro - -%macro PIXEL10_21 0 - Interp2 [edi+ebx],eax,[w7],[w4] -%endmacro - -%macro PIXEL10_22 0 - Interp2 [edi+ebx],eax,[w7],[w8] -%endmacro - -%macro PIXEL10_60 0 - Interp6 [edi+ebx],[w4],[w8] -%endmacro - -%macro PIXEL10_61 0 - Interp6 [edi+ebx],[w8],[w4] -%endmacro - -%macro PIXEL10_70 0 - Interp7 [edi+ebx],[w8],[w4] -%endmacro - -%macro PIXEL10_90 0 - Interp9 [edi+ebx],[w8],[w4] -%endmacro - -%macro PIXEL10_100 0 - Interp10 [edi+ebx],[w8],[w4] -%endmacro - -%macro PIXEL11_0 0 - mov [edi+ebx+2],ax -%endmacro - -%macro PIXEL11_10 0 - Interp1 [edi+ebx+2],eax,[w9] -%endmacro - -%macro PIXEL11_11 0 - Interp1 [edi+ebx+2],eax,[w6] -%endmacro - -%macro PIXEL11_12 0 - Interp1 [edi+ebx+2],eax,[w8] -%endmacro - -%macro PIXEL11_20 0 - Interp2 [edi+ebx+2],eax,[w6],[w8] -%endmacro - -%macro PIXEL11_21 0 - Interp2 [edi+ebx+2],eax,[w9],[w8] -%endmacro - -%macro PIXEL11_22 0 - Interp2 [edi+ebx+2],eax,[w9],[w6] -%endmacro - -%macro PIXEL11_60 0 - Interp6 [edi+ebx+2],[w8],[w6] -%endmacro - -%macro PIXEL11_61 0 - Interp6 [edi+ebx+2],[w6],[w8] -%endmacro - -%macro PIXEL11_70 0 - Interp7 [edi+ebx+2],[w6],[w8] -%endmacro - -%macro PIXEL11_90 0 - Interp9 [edi+ebx+2],[w6],[w8] -%endmacro - -%macro PIXEL11_100 0 - Interp10 [edi+ebx+2],[w6],[w8] -%endmacro - -NEWSYM hq2x_16b - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - pushad - mov ax,ds - mov es,ax - mov esi,[vidbuffer] - mov edi,[WinVidMemStart] - add esi,16*2+256*2+32*2 - mov ecx,[vidbufferofsb] - mov [deltaptr],ecx - cmp byte[FilteredGUI],0 - jne .filtergui - cmp byte[GUIOn2],1 - je nointerp -.filtergui - cmp byte[MMXSupport],0 - je nointerp - cmp byte[hqFilter],0 - jne hq2x - -;----------------------------; -nointerp: - mov dl,[resolutn] - mov ebx,[NumBytesPerLine] -.loopy - mov ecx,256 -.loopx - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - mov [edi+ebx],eax - add esi,2 - add edi,4 - dec ecx - jnz .loopx - add edi,[AddEndBytes] - add edi,ebx - add esi,64 - dec dl - jnz near .loopy - popad - ret - -;----------------------------; -hq2x: - mov dl,[resolutn] - mov [lineleft],dl - mov dword[prevline],0 - mov dword[nextline],576 - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopy - cmp byte[newengen],0 - je .loopy - mov ebx,SpecialLine+1 -.loopy - mov [InterPtr],ebx - cmp byte[ebx],1 - jbe .nohires - call HighResProc - mov edx,[deltaptr] - mov ecx,128 - mov eax,0xAAAAAAAA -.a - mov [edx],eax - add edx,4 - dec ecx - jnz .a - mov [deltaptr],edx - jmp .nexty -.nohires - mov dword[xcounter],254 ; x={Xres-2, Xres-1} are special cases. - ; x=0 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx] - movq mm3,[esi] - movq mm4,[esi+eax] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx] - pcmpeqw mm3,[edx] - pcmpeqw mm4,[edx+eax] - pand mm2,mm3 - pand mm2,mm4 - movd eax,mm2 - inc eax - jz near .loopx_end - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-2] - movq mm3,[esi-2] - movq mm4,[esi+eax-2] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-2] - pcmpeqw mm3,[edx-2] - pcmpeqw mm4,[edx+eax-2] - pand mm2,mm3 - pand mm2,mm4 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz near .loopx_end - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,[RGBtoYUVPtr] - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - test ecx,ecx - jnz .testflag1 - mov ecx,[cross] - mov ebx,[NumBytesPerLine] - jmp [FuncTable2+ecx*4] -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,[NumBytesPerLine] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 - PIXEL00_20 - PIXEL01_20 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - PIXEL00_22 - PIXEL01_21 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - PIXEL00_20 - PIXEL01_22 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - PIXEL00_20 - PIXEL01_20 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - PIXEL00_21 - PIXEL01_20 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - PIXEL00_11 - PIXEL01_21 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - PIXEL00_22 - PIXEL01_12 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - PIXEL00_20 - PIXEL01_11 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - PIXEL00_20 - PIXEL01_22 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - PIXEL00_20 - PIXEL01_20 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - PIXEL00_20 - PIXEL01_20 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - PIXEL00_21 - PIXEL01_20 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - PIXEL00_12 - PIXEL01_20 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag18 -..@flag50 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_20 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag80 -..@flag81 - PIXEL00_20 - PIXEL01_22 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_20 - jmp .loopx_end -..@flag72 -..@flag76 - PIXEL00_21 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag10 -..@flag138 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_20 - PIXEL01_21 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag66 - PIXEL00_22 - PIXEL01_21 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag24 - PIXEL00_21 - PIXEL01_22 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - PIXEL00_11 - PIXEL01_12 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - PIXEL00_20 - PIXEL01_11 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - PIXEL00_20 - PIXEL01_20 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - PIXEL00_12 - PIXEL01_20 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag22 -..@flag54 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag208 -..@flag209 - PIXEL00_20 - PIXEL01_22 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag104 -..@flag108 - PIXEL00_21 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag11 -..@flag139 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag19 -..@flag51 - DiffOrNot w2,w6,PIXEL00_11,PIXEL01_10,PIXEL00_60,PIXEL01_90 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag146 -..@flag178 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_10,PIXEL11_12,PIXEL01_90,PIXEL11_61 - PIXEL10_20 - jmp .loopx_end -..@flag84 -..@flag85 - PIXEL00_20 - DiffOrNot w6,w8,PIXEL01_11,PIXEL11_10,PIXEL01_60,PIXEL11_90 - PIXEL10_21 - jmp .loopx_end -..@flag112 -..@flag113 - PIXEL00_20 - PIXEL01_22 - DiffOrNot w6,w8,PIXEL10_12,PIXEL11_10,PIXEL10_61,PIXEL11_90 - jmp .loopx_end -..@flag200 -..@flag204 - PIXEL00_21 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_10,PIXEL11_11,PIXEL10_90,PIXEL11_60 - jmp .loopx_end -..@flag73 -..@flag77 - DiffOrNot w8,w4,PIXEL00_12,PIXEL10_10,PIXEL00_61,PIXEL10_90 - PIXEL01_20 - PIXEL11_22 - jmp .loopx_end -..@flag42 -..@flag170 - DiffOrNot w4,w2,PIXEL00_10,PIXEL10_11,PIXEL00_90,PIXEL10_60 - PIXEL01_21 - PIXEL11_20 - jmp .loopx_end -..@flag14 -..@flag142 - DiffOrNot w4,w2,PIXEL00_10,PIXEL01_12,PIXEL00_90,PIXEL01_61 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag67 - PIXEL00_11 - PIXEL01_21 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag70 - PIXEL00_22 - PIXEL01_12 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag28 - PIXEL00_21 - PIXEL01_11 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag152 - PIXEL00_21 - PIXEL01_22 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag194 - PIXEL00_22 - PIXEL01_21 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag98 - PIXEL00_22 - PIXEL01_21 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag56 - PIXEL00_21 - PIXEL01_22 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag25 - PIXEL00_12 - PIXEL01_22 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag26 -..@flag31 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag82 -..@flag214 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag88 -..@flag248 - PIXEL00_21 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag74 -..@flag107 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag27 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag86 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_21 - PIXEL11_10 - jmp .loopx_end -..@flag216 - PIXEL00_21 - PIXEL01_22 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag106 - PIXEL00_10 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag30 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag210 - PIXEL00_22 - PIXEL01_10 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag120 - PIXEL00_21 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag75 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - PIXEL10_10 - PIXEL11_22 - jmp .loopx_end -..@flag29 - PIXEL00_12 - PIXEL01_11 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag198 - PIXEL00_22 - PIXEL01_12 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag184 - PIXEL00_21 - PIXEL01_22 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag99 - PIXEL00_11 - PIXEL01_21 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag57 - PIXEL00_12 - PIXEL01_22 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag71 - PIXEL00_11 - PIXEL01_12 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag156 - PIXEL00_21 - PIXEL01_11 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag226 - PIXEL00_22 - PIXEL01_21 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag60 - PIXEL00_21 - PIXEL01_11 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag195 - PIXEL00_11 - PIXEL01_21 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag102 - PIXEL00_22 - PIXEL01_12 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag153 - PIXEL00_12 - PIXEL01_22 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag58 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag83 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag92 - PIXEL00_21 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag202 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_11 - jmp .loopx_end -..@flag78 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_22 - jmp .loopx_end -..@flag154 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag114 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag89 - PIXEL00_12 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag90 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag55 -..@flag23 - DiffOrNot w2,w6,PIXEL00_11,PIXEL01_0,PIXEL00_60,PIXEL01_90 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag182 -..@flag150 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL11_12,PIXEL01_90,PIXEL11_61 - PIXEL10_20 - jmp .loopx_end -..@flag213 -..@flag212 - PIXEL00_20 - DiffOrNot w6,w8,PIXEL01_11,PIXEL11_0,PIXEL01_60,PIXEL11_90 - PIXEL10_21 - jmp .loopx_end -..@flag241 -..@flag240 - PIXEL00_20 - PIXEL01_22 - DiffOrNot w6,w8,PIXEL10_12,PIXEL11_0,PIXEL10_61,PIXEL11_90 - jmp .loopx_end -..@flag236 -..@flag232 - PIXEL00_21 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL11_11,PIXEL10_90,PIXEL11_60 - jmp .loopx_end -..@flag109 -..@flag105 - DiffOrNot w8,w4,PIXEL00_12,PIXEL10_0,PIXEL00_61,PIXEL10_90 - PIXEL01_20 - PIXEL11_22 - jmp .loopx_end -..@flag171 -..@flag43 - DiffOrNot w4,w2,PIXEL00_0,PIXEL10_11,PIXEL00_90,PIXEL10_60 - PIXEL01_21 - PIXEL11_20 - jmp .loopx_end -..@flag143 -..@flag15 - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_12,PIXEL00_90,PIXEL01_61 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag124 - PIXEL00_21 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag203 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - PIXEL10_10 - PIXEL11_11 - jmp .loopx_end -..@flag62 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag211 - PIXEL00_11 - PIXEL01_10 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag118 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_12 - PIXEL11_10 - jmp .loopx_end -..@flag217 - PIXEL00_12 - PIXEL01_22 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag110 - PIXEL00_10 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag155 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag188 - PIXEL00_21 - PIXEL01_11 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag185 - PIXEL00_12 - PIXEL01_22 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag61 - PIXEL00_12 - PIXEL01_11 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag157 - PIXEL00_12 - PIXEL01_11 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag103 - PIXEL00_11 - PIXEL01_12 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag227 - PIXEL00_11 - PIXEL01_21 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag230 - PIXEL00_22 - PIXEL01_12 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag199 - PIXEL00_11 - PIXEL01_12 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag220 - PIXEL00_21 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag158 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag234 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_11 - jmp .loopx_end -..@flag242 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag59 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag121 - PIXEL00_12 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag87 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag79 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_22 - jmp .loopx_end -..@flag122 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag94 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag218 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag91 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag229 - PIXEL00_20 - PIXEL01_20 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag167 - PIXEL00_11 - PIXEL01_12 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag173 - PIXEL00_12 - PIXEL01_20 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag181 - PIXEL00_20 - PIXEL01_11 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag186 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag115 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag93 - PIXEL00_12 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag206 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_11 - jmp .loopx_end -..@flag205 -..@flag201 - PIXEL00_12 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_11 - jmp .loopx_end -..@flag174 -..@flag46 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_12 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag179 -..@flag147 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag117 -..@flag116 - PIXEL00_20 - PIXEL01_11 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag189 - PIXEL00_12 - PIXEL01_11 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag231 - PIXEL00_11 - PIXEL01_12 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag126 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag219 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag125 - DiffOrNot w8,w4,PIXEL00_12,PIXEL10_0,PIXEL00_61,PIXEL10_90 - PIXEL01_11 - PIXEL11_10 - jmp .loopx_end -..@flag221 - PIXEL00_12 - DiffOrNot w6,w8,PIXEL01_11,PIXEL11_0,PIXEL01_60,PIXEL11_90 - PIXEL10_10 - jmp .loopx_end -..@flag207 - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_12,PIXEL00_90,PIXEL01_61 - PIXEL10_10 - PIXEL11_11 - jmp .loopx_end -..@flag238 - PIXEL00_10 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_0,PIXEL11_11,PIXEL10_90,PIXEL11_60 - jmp .loopx_end -..@flag190 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL11_12,PIXEL01_90,PIXEL11_61 - PIXEL10_11 - jmp .loopx_end -..@flag187 - DiffOrNot w4,w2,PIXEL00_0,PIXEL10_11,PIXEL00_90,PIXEL10_60 - PIXEL01_10 - PIXEL11_12 - jmp .loopx_end -..@flag243 - PIXEL00_11 - PIXEL01_10 - DiffOrNot w6,w8,PIXEL10_12,PIXEL11_0,PIXEL10_61,PIXEL11_90 - jmp .loopx_end -..@flag119 - DiffOrNot w2,w6,PIXEL00_11,PIXEL01_0,PIXEL00_60,PIXEL01_90 - PIXEL10_12 - PIXEL11_10 - jmp .loopx_end -..@flag237 -..@flag233 - PIXEL00_12 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - PIXEL11_11 - jmp .loopx_end -..@flag175 -..@flag47 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - PIXEL01_12 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag183 -..@flag151 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag245 -..@flag244 - PIXEL00_20 - PIXEL01_11 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag250 - PIXEL00_10 - PIXEL01_10 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag123 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag95 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_10 - PIXEL11_10 - jmp .loopx_end -..@flag222 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag252 - PIXEL00_21 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag249 - PIXEL00_12 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag235 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - PIXEL11_11 - jmp .loopx_end -..@flag111 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag63 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag159 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag215 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag246 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag254 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag253 - PIXEL00_12 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag251 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag239 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - PIXEL11_11 - jmp .loopx_end -..@flag127 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag191 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag223 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag247 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag255 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end - - -..@cross0 - mov edx,eax - shl eax,16 - or eax,edx - mov [edi],eax - mov [edi+ebx],eax - jmp .loopx_end -..@cross1 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w2] - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 - mov ecx,edx - shl edx,16 - or edx,ecx - mov [edi],edx - mov [edi+ebx],eax - jmp .loopx_end -..@cross2 - shl eax,16 - mov ecx,[w4] - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 - or eax,edx - mov [edi],eax - mov [edi+ebx],eax - jmp .loopx_end -..@cross4 - mov ecx,[w6] - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 - shl edx,16 - or eax,edx - mov [edi],eax - mov [edi+ebx],eax - jmp .loopx_end -..@cross8 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w8] - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 - mov ecx,edx - shl edx,16 - or edx,ecx - mov [edi],eax - mov [edi+ebx],edx - jmp .loopx_end - -.loopx_end - add esi,2 - add dword[deltaptr],2 - add edi,4 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl near .xres_1 - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-4] - movq mm3,[esi-4] - movq mm4,[esi+eax-4] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-4] - pcmpeqw mm3,[edx-4] - pcmpeqw mm4,[edx+eax-4] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,16 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz .loopx_end - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl near .endofline - ; x=Xres-1 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-6] - movq mm3,[esi-6] - movq mm4,[esi+eax-6] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-6] - pcmpeqw mm3,[edx-6] - pcmpeqw mm4,[edx+eax-6] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,32 - movd eax,mm2 - inc eax - jz .loopx_end - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - mov [edx+ecx-2],eax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.endofline - mov ebx,[NumBytesPerLine] -.nexty - add esi,64 - add dword[deltaptr],64 - add edi,[AddEndBytes] - add edi,ebx - mov ebx,[InterPtr] - inc ebx - dec byte[lineleft] - jz .fin - cmp byte[lineleft],1 - je .lastline - mov dword[nextline],576 - mov dword[prevline],-576 - jmp .loopy -.lastline - mov dword[nextline],0 - mov dword[prevline],-576 - jmp .loopy -.fin - emms - popad - ret - -HighResProc: - mov ecx,64 - cmp byte[ebx],3 - je near .hiresmode7 - cmp byte[ebx],7 - je near .hiresmode7 - test byte[ebx],3 - jnz near .hires - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1 -.cfield0 - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [edi],mm0 - punpckhwd mm1,mm1 - movq [edi+8],mm1 - add esi,8 - add edi,16 - dec ecx - jnz .cfield0 - ret -.cfield1 - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [edi+ebx],mm0 - punpckhwd mm1,mm1 - movq [edi+ebx+8],mm1 - add esi,8 - add edi,16 - dec ecx - jnz .cfield1 - ret -.hiresmode7 - mov ebx,[NumBytesPerLine] -.a - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [edi],mm0 - punpckhwd mm1,mm1 - movq [edi+8],mm1 - movq mm0,[esi+75036*4] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq [edi+ebx],mm0 - punpckhwd mm1,mm1 - movq [edi+ebx+8],mm1 - add esi,8 - add edi,16 - dec ecx - jnz .a - ret -.hires - test byte[ebx],4 - jnz .m56 - mov ebx,[NumBytesPerLine] -.bng - movq mm0,[esi] - movq mm1,[esi+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - movq [edi],mm0 - punpckhwd mm2,mm1 - movq [edi+8],mm2 - movq [edi+ebx],mm0 - movq [edi+ebx+8],mm2 - add esi,8 - add edi,16 - dec ecx - jnz .bng - ret -.m56 - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1hr -.cfield0hr - movq mm0,[esi] - movq mm1,[esi+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - movq [edi],mm0 - punpckhwd mm2,mm1 - movq [edi+8],mm2 - add esi,8 - add edi,16 - dec ecx - jnz .cfield0hr - ret -.cfield1hr - movq mm0,[esi] - movq mm1,[esi+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - movq [edi+ebx],mm0 - punpckhwd mm2,mm1 - movq [edi+ebx+8],mm2 - add esi,8 - add edi,16 - dec ecx - jnz .cfield1hr - ret - -SECTION .data -FuncTable: - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - -FuncTable2: - dd ..@cross0, ..@cross1, ..@cross2, ..@flag0, - dd ..@cross4, ..@flag0, ..@flag0, ..@flag0, - dd ..@cross8, ..@flag0, ..@flag0, ..@flag0, - dd ..@flag0, ..@flag0, ..@flag0, ..@flag0 - -SECTION .bss -InterPtr resd 1 -SECTION .text diff --git a/tools/zsnes/src/video/hq2x32.asm b/tools/zsnes/src/video/hq2x32.asm deleted file mode 100644 index c154191..0000000 --- a/tools/zsnes/src/video/hq2x32.asm +++ /dev/null @@ -1,2133 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -;---------------------------------------------------------- -;hq2x filter -;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -;---------------------------------------------------------- - - - -%include "macros.mac" - -EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2,vidbufferofsb,FilteredGUI -EXTSYM resolutn,lineleft,cfield,hirestiledat,newengen,SpecialLine,hqFilter -EXTSYM AddEndBytes,NumBytesPerLine,WinVidMemStart,BitConv32Ptr,RGBtoYUVPtr -EXTSYM prevline,nextline,deltaptr,xcounter,w1,w2,w3,w4,w5,w6,w7,w8,w9 -EXTSYM reg_blank,const3,const5,const6,const14,cross,threshold - -SECTION .bss -NEWSYM c1, resd 1 -NEWSYM c2, resd 1 -NEWSYM c3, resd 1 -NEWSYM c4, resd 1 -NEWSYM c5, resd 1 -NEWSYM c6, resd 1 -NEWSYM c7, resd 1 -NEWSYM c8, resd 1 -NEWSYM c9, resd 1 - -SECTION .text - -%macro TestDiff 2 - xor ecx,ecx - mov edx,[%1] - cmp edx,[%2] - je %%fin - mov ecx,[RGBtoYUVPtr] - movd mm1,[ecx+edx*4] - movq mm5,mm1 - mov edx,[%2] - movd mm2,[ecx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd ecx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 6 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - jmp %%fin -%%same: - %5 - %6 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - shl edx,2 - add edx,%3 - sub edx,%2 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp2 4 - mov edx,%2 - shl edx,1 - add edx,%3 - add edx,%4 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp5 3 - mov edx,%2 - add edx,%3 - shr edx,1 - mov %1,edx -%endmacro - -%macro Interp6 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const5] - psllw mm2, 1 - paddw mm1, mm3 - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp7 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const6] - paddw mm2, mm3 - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp9 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - psllw mm1, 1 - paddw mm2, mm3 - pmullw mm2, [const3] - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp10 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const14] - paddw mm2, mm3 - paddw mm1, mm2 - psrlw mm1, 4 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro PIXEL00_0 0 - mov [edi],eax -%endmacro - -%macro PIXEL00_10 0 - Interp1 [edi],eax,[c1] -%endmacro - -%macro PIXEL00_11 0 - Interp1 [edi],eax,[c4] -%endmacro - -%macro PIXEL00_12 0 - Interp1 [edi],eax,[c2] -%endmacro - -%macro PIXEL00_20 0 - Interp2 [edi],eax,[c4],[c2] -%endmacro - -%macro PIXEL00_21 0 - Interp2 [edi],eax,[c1],[c2] -%endmacro - -%macro PIXEL00_22 0 - Interp2 [edi],eax,[c1],[c4] -%endmacro - -%macro PIXEL00_60 0 - Interp6 [edi],[c2],[c4] -%endmacro - -%macro PIXEL00_61 0 - Interp6 [edi],[c4],[c2] -%endmacro - -%macro PIXEL00_70 0 - Interp7 [edi],[c4],[c2] -%endmacro - -%macro PIXEL00_90 0 - Interp9 [edi],[c4],[c2] -%endmacro - -%macro PIXEL00_100 0 - Interp10 [edi],[c4],[c2] -%endmacro - -%macro PIXEL01_0 0 - mov [edi+4],eax -%endmacro - -%macro PIXEL01_10 0 - Interp1 [edi+4],eax,[c3] -%endmacro - -%macro PIXEL01_11 0 - Interp1 [edi+4],eax,[c2] -%endmacro - -%macro PIXEL01_12 0 - Interp1 [edi+4],eax,[c6] -%endmacro - -%macro PIXEL01_20 0 - Interp2 [edi+4],eax,[c2],[c6] -%endmacro - -%macro PIXEL01_21 0 - Interp2 [edi+4],eax,[c3],[c6] -%endmacro - -%macro PIXEL01_22 0 - Interp2 [edi+4],eax,[c3],[c2] -%endmacro - -%macro PIXEL01_60 0 - Interp6 [edi+4],[c6],[c2] -%endmacro - -%macro PIXEL01_61 0 - Interp6 [edi+4],[c2],[c6] -%endmacro - -%macro PIXEL01_70 0 - Interp7 [edi+4],[c2],[c6] -%endmacro - -%macro PIXEL01_90 0 - Interp9 [edi+4],[c2],[c6] -%endmacro - -%macro PIXEL01_100 0 - Interp10 [edi+4],[c2],[c6] -%endmacro - -%macro PIXEL10_0 0 - mov [edi+ebx],eax -%endmacro - -%macro PIXEL10_10 0 - Interp1 [edi+ebx],eax,[c7] -%endmacro - -%macro PIXEL10_11 0 - Interp1 [edi+ebx],eax,[c8] -%endmacro - -%macro PIXEL10_12 0 - Interp1 [edi+ebx],eax,[c4] -%endmacro - -%macro PIXEL10_20 0 - Interp2 [edi+ebx],eax,[c8],[c4] -%endmacro - -%macro PIXEL10_21 0 - Interp2 [edi+ebx],eax,[c7],[c4] -%endmacro - -%macro PIXEL10_22 0 - Interp2 [edi+ebx],eax,[c7],[c8] -%endmacro - -%macro PIXEL10_60 0 - Interp6 [edi+ebx],[c4],[c8] -%endmacro - -%macro PIXEL10_61 0 - Interp6 [edi+ebx],[c8],[c4] -%endmacro - -%macro PIXEL10_70 0 - Interp7 [edi+ebx],[c8],[c4] -%endmacro - -%macro PIXEL10_90 0 - Interp9 [edi+ebx],[c8],[c4] -%endmacro - -%macro PIXEL10_100 0 - Interp10 [edi+ebx],[c8],[c4] -%endmacro - -%macro PIXEL11_0 0 - mov [edi+ebx+4],eax -%endmacro - -%macro PIXEL11_10 0 - Interp1 [edi+ebx+4],eax,[c9] -%endmacro - -%macro PIXEL11_11 0 - Interp1 [edi+ebx+4],eax,[c6] -%endmacro - -%macro PIXEL11_12 0 - Interp1 [edi+ebx+4],eax,[c8] -%endmacro - -%macro PIXEL11_20 0 - Interp2 [edi+ebx+4],eax,[c6],[c8] -%endmacro - -%macro PIXEL11_21 0 - Interp2 [edi+ebx+4],eax,[c9],[c8] -%endmacro - -%macro PIXEL11_22 0 - Interp2 [edi+ebx+4],eax,[c9],[c6] -%endmacro - -%macro PIXEL11_60 0 - Interp6 [edi+ebx+4],[c8],[c6] -%endmacro - -%macro PIXEL11_61 0 - Interp6 [edi+ebx+4],[c6],[c8] -%endmacro - -%macro PIXEL11_70 0 - Interp7 [edi+ebx+4],[c6],[c8] -%endmacro - -%macro PIXEL11_90 0 - Interp9 [edi+ebx+4],[c6],[c8] -%endmacro - -%macro PIXEL11_100 0 - Interp10 [edi+ebx+4],[c6],[c8] -%endmacro - -NEWSYM hq2x_32b - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - pushad - mov ax,ds - mov es,ax - mov esi,[vidbuffer] - mov edi,[WinVidMemStart] - add esi,16*2+256*2+32*2 - mov ecx,[vidbufferofsb] - mov [deltaptr],ecx - cmp byte[FilteredGUI],0 - jne .filtergui - cmp byte[GUIOn2],1 - je nointerp -.filtergui - cmp byte[MMXSupport],0 - je nointerp - cmp byte[hqFilter],0 - jne hq2x - -;----------------------------; -nointerp: - mov dl,[resolutn] - mov [lineleft],dl - mov ebx,[NumBytesPerLine] - mov edx,[BitConv32Ptr] -.loopy - mov ecx,256 -.loopx - movzx eax,word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - add esi,2 - add edi,8 - dec ecx - jnz .loopx - add edi,[AddEndBytes] - add edi,ebx - add esi,64 - dec byte[lineleft] - jnz near .loopy - popad - ret - -;----------------------------; -hq2x: - mov dl,[resolutn] - mov [lineleft],dl - mov dword[prevline],0 - mov dword[nextline],576 - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopy - cmp byte[newengen],0 - je .loopy - mov ebx,SpecialLine+1 -.loopy - mov [InterPtr],ebx - cmp byte[ebx],1 - jbe .nohires - call HighResProc - mov edx,[deltaptr] - mov ecx,128 - mov eax,0xAAAAAAAA -.a - mov [edx],eax - add edx,4 - dec ecx - jnz .a - mov [deltaptr],edx - jmp .nexty -.nohires - mov dword[xcounter],254 ; x={Xres-2, Xres-1} are special cases. - ; x=0 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx] - movq mm3,[esi] - movq mm4,[esi+eax] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx] - pcmpeqw mm3,[edx] - pcmpeqw mm4,[edx+eax] - pand mm2,mm3 - pand mm2,mm4 - movd eax,mm2 - inc eax - jz near .loopx_end - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-2] - movq mm3,[esi-2] - movq mm4,[esi+eax-2] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-2] - pcmpeqw mm3,[edx-2] - pcmpeqw mm4,[edx+eax-2] - pand mm2,mm3 - pand mm2,mm4 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz near .loopx_end - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,[RGBtoYUVPtr] - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - test ecx,ecx - jnz .testflag1 - mov ecx,[cross] - mov ebx,[BitConv32Ptr] - mov eax,[ebx+eax*4] - jmp [FuncTable2+ecx*4] -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,[BitConv32Ptr] - mov eax,[ebx+eax*4] - mov edx,[w2] - mov edx,[ebx+edx*4] - mov [c2],edx - mov edx,[w4] - mov edx,[ebx+edx*4] - mov [c4],edx - mov edx,[w6] - mov edx,[ebx+edx*4] - mov [c6],edx - mov edx,[w8] - mov edx,[ebx+edx*4] - mov [c8],edx - test ecx,0x005A - jz .switch - mov edx,[w1] - mov edx,[ebx+edx*4] - mov [c1],edx - mov edx,[w3] - mov edx,[ebx+edx*4] - mov [c3],edx - mov edx,[w7] - mov edx,[ebx+edx*4] - mov [c7],edx - mov edx,[w9] - mov edx,[ebx+edx*4] - mov [c9],edx -.switch - mov ebx,[NumBytesPerLine] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 -; PIXEL00_20 -; PIXEL01_20 -; PIXEL10_20 -; PIXEL11_20 - -; the same, only optimized - shl eax,1 - mov ecx,eax - add ecx,[c2] - mov edx,ecx - add edx,[c4] - shr edx,2 - mov [edi],edx - add ecx,[c6] - shr ecx,2 - mov [edi+4],ecx - mov ecx,eax - add ecx,[c8] - mov edx,ecx - add edx,[c4] - shr edx,2 - mov [edi+ebx],edx - add ecx,[c6] - shr ecx,2 - mov [edi+ebx+4],ecx - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - PIXEL00_22 - PIXEL01_21 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - PIXEL00_20 - PIXEL01_22 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - PIXEL00_20 - PIXEL01_20 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - PIXEL00_21 - PIXEL01_20 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - PIXEL00_11 - PIXEL01_21 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - PIXEL00_22 - PIXEL01_12 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - PIXEL00_20 - PIXEL01_11 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - PIXEL00_20 - PIXEL01_22 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - PIXEL00_20 - PIXEL01_20 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - PIXEL00_20 - PIXEL01_20 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - PIXEL00_21 - PIXEL01_20 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - PIXEL00_12 - PIXEL01_20 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag18 -..@flag50 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_20 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag80 -..@flag81 - PIXEL00_20 - PIXEL01_22 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_20 - jmp .loopx_end -..@flag72 -..@flag76 - PIXEL00_21 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag10 -..@flag138 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_20 - PIXEL01_21 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag66 - PIXEL00_22 - PIXEL01_21 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag24 - PIXEL00_21 - PIXEL01_22 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - PIXEL00_11 - PIXEL01_12 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - PIXEL00_20 - PIXEL01_11 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - PIXEL00_20 - PIXEL01_20 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - PIXEL00_12 - PIXEL01_20 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag22 -..@flag54 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag208 -..@flag209 - PIXEL00_20 - PIXEL01_22 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag104 -..@flag108 - PIXEL00_21 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag11 -..@flag139 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag19 -..@flag51 - DiffOrNot w2,w6,PIXEL00_11,PIXEL01_10,PIXEL00_60,PIXEL01_90 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag146 -..@flag178 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_10,PIXEL11_12,PIXEL01_90,PIXEL11_61 - PIXEL10_20 - jmp .loopx_end -..@flag84 -..@flag85 - PIXEL00_20 - DiffOrNot w6,w8,PIXEL01_11,PIXEL11_10,PIXEL01_60,PIXEL11_90 - PIXEL10_21 - jmp .loopx_end -..@flag112 -..@flag113 - PIXEL00_20 - PIXEL01_22 - DiffOrNot w6,w8,PIXEL10_12,PIXEL11_10,PIXEL10_61,PIXEL11_90 - jmp .loopx_end -..@flag200 -..@flag204 - PIXEL00_21 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_10,PIXEL11_11,PIXEL10_90,PIXEL11_60 - jmp .loopx_end -..@flag73 -..@flag77 - DiffOrNot w8,w4,PIXEL00_12,PIXEL10_10,PIXEL00_61,PIXEL10_90 - PIXEL01_20 - PIXEL11_22 - jmp .loopx_end -..@flag42 -..@flag170 - DiffOrNot w4,w2,PIXEL00_10,PIXEL10_11,PIXEL00_90,PIXEL10_60 - PIXEL01_21 - PIXEL11_20 - jmp .loopx_end -..@flag14 -..@flag142 - DiffOrNot w4,w2,PIXEL00_10,PIXEL01_12,PIXEL00_90,PIXEL01_61 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag67 - PIXEL00_11 - PIXEL01_21 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag70 - PIXEL00_22 - PIXEL01_12 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag28 - PIXEL00_21 - PIXEL01_11 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag152 - PIXEL00_21 - PIXEL01_22 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag194 - PIXEL00_22 - PIXEL01_21 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag98 - PIXEL00_22 - PIXEL01_21 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag56 - PIXEL00_21 - PIXEL01_22 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag25 - PIXEL00_12 - PIXEL01_22 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag26 -..@flag31 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag82 -..@flag214 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag88 -..@flag248 - PIXEL00_21 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag74 -..@flag107 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag27 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag86 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_21 - PIXEL11_10 - jmp .loopx_end -..@flag216 - PIXEL00_21 - PIXEL01_22 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag106 - PIXEL00_10 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag30 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag210 - PIXEL00_22 - PIXEL01_10 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag120 - PIXEL00_21 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag75 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - PIXEL10_10 - PIXEL11_22 - jmp .loopx_end -..@flag29 - PIXEL00_12 - PIXEL01_11 - PIXEL10_22 - PIXEL11_21 - jmp .loopx_end -..@flag198 - PIXEL00_22 - PIXEL01_12 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag184 - PIXEL00_21 - PIXEL01_22 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag99 - PIXEL00_11 - PIXEL01_21 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag57 - PIXEL00_12 - PIXEL01_22 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag71 - PIXEL00_11 - PIXEL01_12 - PIXEL10_21 - PIXEL11_22 - jmp .loopx_end -..@flag156 - PIXEL00_21 - PIXEL01_11 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag226 - PIXEL00_22 - PIXEL01_21 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag60 - PIXEL00_21 - PIXEL01_11 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag195 - PIXEL00_11 - PIXEL01_21 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag102 - PIXEL00_22 - PIXEL01_12 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag153 - PIXEL00_12 - PIXEL01_22 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag58 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag83 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag92 - PIXEL00_21 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag202 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_11 - jmp .loopx_end -..@flag78 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_22 - jmp .loopx_end -..@flag154 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag114 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag89 - PIXEL00_12 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag90 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag55 -..@flag23 - DiffOrNot w2,w6,PIXEL00_11,PIXEL01_0,PIXEL00_60,PIXEL01_90 - PIXEL10_20 - PIXEL11_21 - jmp .loopx_end -..@flag182 -..@flag150 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL11_12,PIXEL01_90,PIXEL11_61 - PIXEL10_20 - jmp .loopx_end -..@flag213 -..@flag212 - PIXEL00_20 - DiffOrNot w6,w8,PIXEL01_11,PIXEL11_0,PIXEL01_60,PIXEL11_90 - PIXEL10_21 - jmp .loopx_end -..@flag241 -..@flag240 - PIXEL00_20 - PIXEL01_22 - DiffOrNot w6,w8,PIXEL10_12,PIXEL11_0,PIXEL10_61,PIXEL11_90 - jmp .loopx_end -..@flag236 -..@flag232 - PIXEL00_21 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL11_11,PIXEL10_90,PIXEL11_60 - jmp .loopx_end -..@flag109 -..@flag105 - DiffOrNot w8,w4,PIXEL00_12,PIXEL10_0,PIXEL00_61,PIXEL10_90 - PIXEL01_20 - PIXEL11_22 - jmp .loopx_end -..@flag171 -..@flag43 - DiffOrNot w4,w2,PIXEL00_0,PIXEL10_11,PIXEL00_90,PIXEL10_60 - PIXEL01_21 - PIXEL11_20 - jmp .loopx_end -..@flag143 -..@flag15 - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_12,PIXEL00_90,PIXEL01_61 - PIXEL10_22 - PIXEL11_20 - jmp .loopx_end -..@flag124 - PIXEL00_21 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag203 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - PIXEL10_10 - PIXEL11_11 - jmp .loopx_end -..@flag62 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag211 - PIXEL00_11 - PIXEL01_10 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag118 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_12 - PIXEL11_10 - jmp .loopx_end -..@flag217 - PIXEL00_12 - PIXEL01_22 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag110 - PIXEL00_10 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag155 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag188 - PIXEL00_21 - PIXEL01_11 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag185 - PIXEL00_12 - PIXEL01_22 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag61 - PIXEL00_12 - PIXEL01_11 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag157 - PIXEL00_12 - PIXEL01_11 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag103 - PIXEL00_11 - PIXEL01_12 - PIXEL10_12 - PIXEL11_22 - jmp .loopx_end -..@flag227 - PIXEL00_11 - PIXEL01_21 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag230 - PIXEL00_22 - PIXEL01_12 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag199 - PIXEL00_11 - PIXEL01_12 - PIXEL10_21 - PIXEL11_11 - jmp .loopx_end -..@flag220 - PIXEL00_21 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag158 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag234 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_11 - jmp .loopx_end -..@flag242 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag59 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag121 - PIXEL00_12 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag87 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag79 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_22 - jmp .loopx_end -..@flag122 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag94 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag218 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag91 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag229 - PIXEL00_20 - PIXEL01_20 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag167 - PIXEL00_11 - PIXEL01_12 - PIXEL10_20 - PIXEL11_20 - jmp .loopx_end -..@flag173 - PIXEL00_12 - PIXEL01_20 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag181 - PIXEL00_20 - PIXEL01_11 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag186 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag115 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag93 - PIXEL00_12 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag206 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_11 - jmp .loopx_end -..@flag205 -..@flag201 - PIXEL00_12 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_10,PIXEL10_70 - PIXEL11_11 - jmp .loopx_end -..@flag174 -..@flag46 - DiffOrNot w4,w2,PIXEL00_10,PIXEL00_70 - PIXEL01_12 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag179 -..@flag147 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_10,PIXEL01_70 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag117 -..@flag116 - PIXEL00_20 - PIXEL01_11 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_10,PIXEL11_70 - jmp .loopx_end -..@flag189 - PIXEL00_12 - PIXEL01_11 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag231 - PIXEL00_11 - PIXEL01_12 - PIXEL10_12 - PIXEL11_11 - jmp .loopx_end -..@flag126 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag219 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag125 - DiffOrNot w8,w4,PIXEL00_12,PIXEL10_0,PIXEL00_61,PIXEL10_90 - PIXEL01_11 - PIXEL11_10 - jmp .loopx_end -..@flag221 - PIXEL00_12 - DiffOrNot w6,w8,PIXEL01_11,PIXEL11_0,PIXEL01_60,PIXEL11_90 - PIXEL10_10 - jmp .loopx_end -..@flag207 - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_12,PIXEL00_90,PIXEL01_61 - PIXEL10_10 - PIXEL11_11 - jmp .loopx_end -..@flag238 - PIXEL00_10 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_0,PIXEL11_11,PIXEL10_90,PIXEL11_60 - jmp .loopx_end -..@flag190 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL11_12,PIXEL01_90,PIXEL11_61 - PIXEL10_11 - jmp .loopx_end -..@flag187 - DiffOrNot w4,w2,PIXEL00_0,PIXEL10_11,PIXEL00_90,PIXEL10_60 - PIXEL01_10 - PIXEL11_12 - jmp .loopx_end -..@flag243 - PIXEL00_11 - PIXEL01_10 - DiffOrNot w6,w8,PIXEL10_12,PIXEL11_0,PIXEL10_61,PIXEL11_90 - jmp .loopx_end -..@flag119 - DiffOrNot w2,w6,PIXEL00_11,PIXEL01_0,PIXEL00_60,PIXEL01_90 - PIXEL10_12 - PIXEL11_10 - jmp .loopx_end -..@flag237 -..@flag233 - PIXEL00_12 - PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - PIXEL11_11 - jmp .loopx_end -..@flag175 -..@flag47 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - PIXEL01_12 - PIXEL10_11 - PIXEL11_20 - jmp .loopx_end -..@flag183 -..@flag151 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_20 - PIXEL11_12 - jmp .loopx_end -..@flag245 -..@flag244 - PIXEL00_20 - PIXEL01_11 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag250 - PIXEL00_10 - PIXEL01_10 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag123 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag95 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_10 - PIXEL11_10 - jmp .loopx_end -..@flag222 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag252 - PIXEL00_21 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag249 - PIXEL00_12 - PIXEL01_22 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag235 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_21 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - PIXEL11_11 - jmp .loopx_end -..@flag111 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_22 - jmp .loopx_end -..@flag63 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_11 - PIXEL11_21 - jmp .loopx_end -..@flag159 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_22 - PIXEL11_12 - jmp .loopx_end -..@flag215 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_21 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag246 - PIXEL00_22 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag254 - PIXEL00_10 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag253 - PIXEL00_12 - PIXEL01_11 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag251 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_10 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag239 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - PIXEL01_12 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - PIXEL11_11 - jmp .loopx_end -..@flag127 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_20 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_20 - PIXEL11_10 - jmp .loopx_end -..@flag191 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_11 - PIXEL11_12 - jmp .loopx_end -..@flag223 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_10 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_20 - jmp .loopx_end -..@flag247 - PIXEL00_11 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - PIXEL10_12 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end -..@flag255 - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_100 - DiffOrNot w2,w6,PIXEL01_0,PIXEL01_100 - DiffOrNot w8,w4,PIXEL10_0,PIXEL10_100 - DiffOrNot w6,w8,PIXEL11_0,PIXEL11_100 - jmp .loopx_end - - -..@cross0 - mov ebx,[NumBytesPerLine] - mov [edi],eax - mov [edi+4],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - jmp .loopx_end -..@cross1 - mov ecx,[w2] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[NumBytesPerLine] - mov [edi],edx - mov [edi+4],edx - mov [edi+ebx],eax - mov [edi+ebx+4],eax - jmp .loopx_end -..@cross2 - mov ecx,[w4] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[NumBytesPerLine] - mov [edi],edx - mov [edi+4],eax - mov [edi+ebx],edx - mov [edi+ebx+4],eax - jmp .loopx_end -..@cross4 - mov ecx,[w6] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[NumBytesPerLine] - mov [edi],eax - mov [edi+4],edx - mov [edi+ebx],eax - mov [edi+ebx+4],edx - jmp .loopx_end -..@cross8 - mov ecx,[w8] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[NumBytesPerLine] - mov [edi],eax - mov [edi+4],eax - mov [edi+ebx],edx - mov [edi+ebx+4],edx - jmp .loopx_end -..@crossN - mov edx,[w2] - mov ecx,[ebx+edx*4] - mov [c2],ecx - mov edx,[w4] - mov ecx,[ebx+edx*4] - mov [c4],ecx - mov edx,[w6] - mov ecx,[ebx+edx*4] - mov [c6],ecx - mov edx,[w8] - mov ecx,[ebx+edx*4] - mov [c8],ecx - mov ebx,[NumBytesPerLine] - jmp ..@flag0 - -.loopx_end - add esi,2 - add dword[deltaptr],2 - add edi,8 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl near .xres_1 - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-4] - movq mm3,[esi-4] - movq mm4,[esi+eax-4] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-4] - pcmpeqw mm3,[edx-4] - pcmpeqw mm4,[edx+eax-4] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,16 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz .loopx_end - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl near .endofline - ; x=Xres-1 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-6] - movq mm3,[esi-6] - movq mm4,[esi+eax-6] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-6] - pcmpeqw mm3,[edx-6] - pcmpeqw mm4,[edx+eax-6] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,32 - movd eax,mm2 - inc eax - jz .loopx_end - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - mov [edx+ecx-2],eax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.endofline - mov ebx,[NumBytesPerLine] -.nexty - add esi,64 - add dword[deltaptr],64 - add edi,[AddEndBytes] - add edi,ebx - mov ebx,[InterPtr] - inc ebx - dec byte[lineleft] - jz .fin - cmp byte[lineleft],1 - je .lastline - mov dword[nextline],576 - mov dword[prevline],-576 - jmp .loopy -.lastline - mov dword[nextline],0 - mov dword[prevline],-576 - jmp .loopy -.fin - emms - popad - ret - -HighResProc: - mov ecx,256 - mov edx,[BitConv32Ptr] - cmp byte[ebx],3 - je near .hiresmode7 - cmp byte[ebx],7 - je near .hiresmode7 - test byte[ebx],3 - jnz near .hires - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1 -.cfield0 - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - add esi,2 - add edi,8 - dec ecx - jnz .cfield0 - ret -.cfield1 - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi+ebx],eax - mov [edi+ebx+4],eax - add esi,2 - add edi,8 - dec ecx - jnz .cfield1 - ret -.hiresmode7 - mov ebx,[NumBytesPerLine] -.a - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - movzx eax, word[esi+75036*4] - mov eax,[edx+eax*4] - mov [edi+ebx],eax - mov [edi+ebx+4],eax - add esi,2 - add edi,8 - dec ecx - jnz .a - ret -.hires - test byte[ebx],4 - jnz .m56 - mov ebx,[NumBytesPerLine] -.bng - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+ebx],eax - movzx eax, word[esi+75036*4] - mov eax,[edx+eax*4] - mov [edi+4],eax - mov [edi+ebx+4],eax - add esi,2 - add edi,8 - dec ecx - jnz .bng - ret -.m56 - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1hr -.cfield0hr - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - movzx eax, word[esi+75036*4] - mov eax,[edx+eax*4] - mov [edi+4],eax - add esi,2 - add edi,8 - dec ecx - jnz .cfield0hr - ret -.cfield1hr - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi+ebx],eax - movzx eax, word[esi+75036*4] - mov eax,[edx+eax*4] - mov [edi+ebx+4],eax - add esi,2 - add edi,8 - dec ecx - jnz .cfield1hr - ret - -SECTION .data -FuncTable: - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - -FuncTable2: - dd ..@cross0, ..@cross1, ..@cross2, ..@crossN, - dd ..@cross4, ..@crossN, ..@crossN, ..@crossN, - dd ..@cross8, ..@crossN, ..@crossN, ..@crossN, - dd ..@crossN, ..@crossN, ..@crossN, ..@crossN - -SECTION .bss -InterPtr resd 1 -SECTION .text diff --git a/tools/zsnes/src/video/hq3x16.asm b/tools/zsnes/src/video/hq3x16.asm deleted file mode 100644 index 5007511..0000000 --- a/tools/zsnes/src/video/hq3x16.asm +++ /dev/null @@ -1,2749 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -;---------------------------------------------------------- -; hq3x filter -; Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -;---------------------------------------------------------- - - - -%include "macros.mac" - -EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2,vidbufferofsb,FilteredGUI -EXTSYM resolutn,lineleft,cfield,hirestiledat,newengen,SpecialLine,HalfTrans -EXTSYM hqFilter,AddEndBytes,NumBytesPerLine,WinVidMemStart,BitConv32Ptr -EXTSYM RGBtoYUVPtr,prevline,nextline,deltaptr,xcounter,w1,w2,w3,w4,w5,w6,w7,w8 -EXTSYM w9,reg_blank,const7,cross,threshold - -SECTION .text - -%macro TestDiff 2 - xor ecx,ecx - mov edx,[%1] - cmp edx,[%2] - je %%fin - mov ecx,[RGBtoYUVPtr] - movd mm1,[ecx+edx*4] - movq mm5,mm1 - mov edx,[%2] - movd mm2,[ecx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd ecx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 6 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - jmp %%fin -%%same: - %5 - %6 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - mov ecx,%3 - cmp edx,ecx - je %%fin - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro Interp2 4 - mov edx,%3 - mov ecx,%4 - cmp edx,ecx - je %%fin1 - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 -%%fin1 - mov edx,%2 - cmp edx,ecx - je %%fin2 - and ecx,[HalfTrans] - and edx,[HalfTrans] - add edx,ecx - shr edx,1 -%%fin2 - mov %1,dx -%endmacro - -%macro Interp3 2 - mov ecx, [BitConv32Ptr] - movd mm1, [ecx+eax*4] - mov edx, %2 - movd mm2, [ecx+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const7] - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp4 3 - mov ecx, [BitConv32Ptr] - movd mm1, [ecx+eax*4] - mov edx, %2 - movd mm2, [ecx+edx*4] - mov edx, %3 - movd mm3, [ecx+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - psllw mm1, 1 - paddw mm2, mm3 - pmullw mm2, [const7] - paddw mm1, mm2 - psrlw mm1, 6 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp5 3 - mov edx,%2 - mov ecx,%3 - cmp edx,ecx - je %%fin - and edx,[HalfTrans] - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro PIXEL00_1M 0 - Interp1 [edi],eax,[w1] -%endmacro - -%macro PIXEL00_1U 0 - Interp1 [edi],eax,[w2] -%endmacro - -%macro PIXEL00_1L 0 - Interp1 [edi],eax,[w4] -%endmacro - -%macro PIXEL00_2 0 - Interp2 [edi],eax,[w4],[w2] -%endmacro - -%macro PIXEL00_4 0 - Interp4 [edi],[w4],[w2] -%endmacro - -%macro PIXEL00_5 0 - Interp5 [edi],[w4],[w2] -%endmacro - -%macro PIXEL00_C 0 - mov [edi],ax -%endmacro - -%macro PIXEL01_1 0 - Interp1 [edi+2],eax,[w2] -%endmacro - -%macro PIXEL01_3 0 - Interp3 [edi+2],[w2] -%endmacro - -%macro PIXEL01_6 0 - Interp1 [edi+2],[w2],eax -%endmacro - -%macro PIXEL01_C 0 - mov [edi+2],ax -%endmacro - -%macro PIXEL02_1M 0 - Interp1 [edi+4],eax,[w3] -%endmacro - -%macro PIXEL02_1U 0 - Interp1 [edi+4],eax,[w2] -%endmacro - -%macro PIXEL02_1R 0 - Interp1 [edi+4],eax,[w6] -%endmacro - -%macro PIXEL02_2 0 - Interp2 [edi+4],eax,[w2],[w6] -%endmacro - -%macro PIXEL02_4 0 - Interp4 [edi+4],[w2],[w6] -%endmacro - -%macro PIXEL02_5 0 - Interp5 [edi+4],[w2],[w6] -%endmacro - -%macro PIXEL02_C 0 - mov [edi+4],ax -%endmacro - -%macro PIXEL10_1 0 - Interp1 [edi+ebx],eax,[w4] -%endmacro - -%macro PIXEL10_3 0 - Interp3 [edi+ebx],[w4] -%endmacro - -%macro PIXEL10_6 0 - Interp1 [edi+ebx],[w4],eax -%endmacro - -%macro PIXEL10_C 0 - mov [edi+ebx],ax -%endmacro - -%macro PIXEL11 0 - mov [edi+ebx+2],ax -%endmacro - -%macro PIXEL12_1 0 - Interp1 [edi+ebx+4],eax,[w6] -%endmacro - -%macro PIXEL12_3 0 - Interp3 [edi+ebx+4],[w6] -%endmacro - -%macro PIXEL12_6 0 - Interp1 [edi+ebx+4],[w6],eax -%endmacro - -%macro PIXEL12_C 0 - mov [edi+ebx+4],ax -%endmacro - -%macro PIXEL20_1M 0 - Interp1 [edi+ebx*2],eax,[w7] -%endmacro - -%macro PIXEL20_1D 0 - Interp1 [edi+ebx*2],eax,[w8] -%endmacro - -%macro PIXEL20_1L 0 - Interp1 [edi+ebx*2],eax,[w4] -%endmacro - -%macro PIXEL20_2 0 - Interp2 [edi+ebx*2],eax,[w8],[w4] -%endmacro - -%macro PIXEL20_4 0 - Interp4 [edi+ebx*2],[w8],[w4] -%endmacro - -%macro PIXEL20_5 0 - Interp5 [edi+ebx*2],[w8],[w4] -%endmacro - -%macro PIXEL20_C 0 - mov [edi+ebx*2],ax -%endmacro - -%macro PIXEL21_1 0 - Interp1 [edi+ebx*2+2],eax,[w8] -%endmacro - -%macro PIXEL21_3 0 - Interp3 [edi+ebx*2+2],[w8] -%endmacro - -%macro PIXEL21_6 0 - Interp1 [edi+ebx*2+2],[w8],eax -%endmacro - -%macro PIXEL21_C 0 - mov [edi+ebx*2+2],ax -%endmacro - -%macro PIXEL22_1M 0 - Interp1 [edi+ebx*2+4],eax,[w9] -%endmacro - -%macro PIXEL22_1D 0 - Interp1 [edi+ebx*2+4],eax,[w8] -%endmacro - -%macro PIXEL22_1R 0 - Interp1 [edi+ebx*2+4],eax,[w6] -%endmacro - -%macro PIXEL22_2 0 - Interp2 [edi+ebx*2+4],eax,[w6],[w8] -%endmacro - -%macro PIXEL22_4 0 - Interp4 [edi+ebx*2+4],[w6],[w8] -%endmacro - -%macro PIXEL22_5 0 - Interp5 [edi+ebx*2+4],[w6],[w8] -%endmacro - -%macro PIXEL22_C 0 - mov [edi+ebx*2+4],ax -%endmacro - -NEWSYM hq3x_16b - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - pushad - mov ax,ds - mov es,ax - mov esi,[vidbuffer] - mov edi,[WinVidMemStart] - add esi,16*2+256*2+32*2 - mov ecx,[vidbufferofsb] - mov [deltaptr],ecx - cmp byte[FilteredGUI],0 - jne .filtergui - cmp byte[GUIOn2],1 - je nointerp -.filtergui - cmp byte[MMXSupport],0 - je nointerp - cmp byte[hqFilter],0 - jne hq3x - -;----------------------------; -nointerp: - mov dl,[resolutn] - mov ebx,[NumBytesPerLine] -.loopy - mov ecx,256 -.loopx - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - mov [edi+ebx],eax - mov [edi+ebx*2],eax - mov [edi+4],ax - mov [edi+ebx+4],ax - mov [edi+ebx*2+4],ax - add esi,2 - add edi,6 - dec ecx - jnz .loopx - add edi,[AddEndBytes] - add edi,ebx - add edi,ebx - add esi,64 - dec dl - jnz near .loopy - popad - ret - -;----------------------------; -hq3x: - mov dl,[resolutn] - mov [lineleft],dl - mov dword[prevline],0 - mov dword[nextline],576 - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopy - cmp byte[newengen],0 - je .loopy - mov ebx,SpecialLine+1 -.loopy - mov [InterPtr],ebx - cmp byte[ebx],1 - jbe .nohires - call HighResProc - mov edx,[deltaptr] - mov ecx,128 - mov eax,0xAAAAAAAA -.a - mov [edx],eax - add edx,4 - dec ecx - jnz .a - mov [deltaptr],edx - jmp .nexty -.nohires - mov dword[xcounter],254 ; x={Xres-2, Xres-1} are special cases. - ; x=0 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx] - movq mm3,[esi] - movq mm4,[esi+eax] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx] - pcmpeqw mm3,[edx] - pcmpeqw mm4,[edx+eax] - pand mm2,mm3 - pand mm2,mm4 - movd eax,mm2 - inc eax - jz near .loopx_end - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-2] - movq mm3,[esi-2] - movq mm4,[esi+eax-2] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-2] - pcmpeqw mm3,[edx-2] - pcmpeqw mm4,[edx+eax-2] - pand mm2,mm3 - pand mm2,mm4 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz near .loopx_end - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,[RGBtoYUVPtr] - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - test ecx,ecx - jnz .testflag1 - mov ecx,[cross] - mov ebx,[NumBytesPerLine] - jmp [FuncTable2+ecx*4] -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,[NumBytesPerLine] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag18 -..@flag50 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag80 -..@flag81 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag72 -..@flag76 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag10 -..@flag138 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag66 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag24 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag22 -..@flag54 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag208 -..@flag209 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag104 -..@flag108 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag11 -..@flag139 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag19 -..@flag51 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag146 -..@flag178 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - jmp .loopx_end -..@flag84 -..@flag85 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag112 -..@flag113 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_1M,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag200 -..@flag204 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag73 -..@flag77 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - PIXEL22_1M - jmp .loopx_end -..@flag42 -..@flag170 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag14 -..@flag142 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag67 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag70 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag28 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag152 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag194 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag98 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag56 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag25 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag26 -..@flag31 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag82 -..@flag214 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag88 -..@flag248 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag74 -..@flag107 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag27 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag86 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag216 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag106 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag30 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag210 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag120 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag75 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag29 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag198 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag184 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag99 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag57 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag71 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag156 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag226 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag60 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag195 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag102 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag153 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag58 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag83 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag92 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag202 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag78 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag154 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag114 - PIXEL00_1M - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag89 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag90 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag55 -..@flag23 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag182 -..@flag150 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - jmp .loopx_end -..@flag213 -..@flag212 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag241 -..@flag240 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag236 -..@flag232 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag109 -..@flag105 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - PIXEL22_1M - jmp .loopx_end -..@flag171 -..@flag43 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag143 -..@flag15 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag124 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag203 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag62 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag211 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag118 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag217 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag110 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag155 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag188 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag185 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag61 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag157 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag103 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag227 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag230 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag199 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag220 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag158 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag234 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1M - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1R - jmp .loopx_end -..@flag242 - PIXEL00_1M - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag59 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag121 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag87 - PIXEL00_1L - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag79 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1R - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag122 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag94 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag218 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag91 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag229 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag167 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag173 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag181 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag186 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag115 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag93 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag206 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag205 -..@flag201 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag174 -..@flag46 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag179 -..@flag147 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag117 -..@flag116 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag189 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag231 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag126 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag219 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag125 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - PIXEL22_1M - jmp .loopx_end -..@flag221 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_1U - PIXEL01_1 - PIXEL10_C - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag207 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag238 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag190 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - jmp .loopx_end -..@flag187 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag243 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag119 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag237 -..@flag233 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag175 -..@flag47 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag183 -..@flag151 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag245 -..@flag244 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag250 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag123 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag95 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag222 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag252 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag249 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag235 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag111 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag63 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag159 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag215 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag246 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag254 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_2 - jmp .loopx_end -..@flag253 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag251 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_2,PIXEL21_3 - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag239 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag127 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_2,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag191 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag223 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_2,PIXEL12_3 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag247 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag255 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end - -..@cross0 - mov edx,eax - shl eax,16 - or eax,edx - mov [edi],eax - mov [edi+4],ax - mov [edi+ebx],eax - mov [edi+ebx+4],ax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],ax - jmp .loopx_end -..@cross1 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w2] - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 - mov [edi],dx - mov [edi+2],dx - mov [edi+4],dx - mov [edi+ebx],eax - mov [edi+ebx+4],ax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],ax - jmp .loopx_end -..@cross2 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w4] - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 - mov [edi],dx - mov [edi+2],eax - mov [edi+ebx],dx - mov [edi+ebx+2],eax - mov [edi+ebx*2],dx - mov [edi+ebx*2+2],eax - jmp .loopx_end -..@cross4 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w6] - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 - mov [edi],eax - mov [edi+4],dx - mov [edi+ebx],eax - mov [edi+ebx+4],dx - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],dx - jmp .loopx_end -..@cross8 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w8] - and edx,[HalfTrans] - and ecx,[HalfTrans] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[HalfTrans] - add edx,ecx - shr edx,1 - mov [edi],eax - mov [edi+4],ax - mov [edi+ebx],eax - mov [edi+ebx+4],ax - mov [edi+ebx*2],dx - mov [edi+ebx*2+2],dx - mov [edi+ebx*2+4],dx - jmp .loopx_end - -.loopx_end - add esi,2 - add dword[deltaptr],2 - add edi,6 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl near .xres_1 - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-4] - movq mm3,[esi-4] - movq mm4,[esi+eax-4] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-4] - pcmpeqw mm3,[edx-4] - pcmpeqw mm4,[edx+eax-4] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,16 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz .loopx_end - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl near .endofline - ; x=Xres-1 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-6] - movq mm3,[esi-6] - movq mm4,[esi+eax-6] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-6] - pcmpeqw mm3,[edx-6] - pcmpeqw mm4,[edx+eax-6] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,32 - movd eax,mm2 - inc eax - jz .loopx_end - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - mov [edx+ecx-2],eax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.endofline - mov ebx,[NumBytesPerLine] -.nexty - add esi,64 - add dword[deltaptr],64 - add edi,[AddEndBytes] - add edi,ebx - add edi,ebx - mov ebx,[InterPtr] - inc ebx - dec byte[lineleft] - jz .fin - cmp byte[lineleft],1 - je .lastline - mov dword[nextline],576 - mov dword[prevline],-576 - jmp .loopy -.lastline - mov dword[nextline],0 - mov dword[prevline],-576 - jmp .loopy -.fin - emms - popad - ret - -HighResProc: - mov ecx,256 - cmp byte[ebx],3 - je near .hiresmode7 - cmp byte[ebx],7 - je near .hiresmode7 - test byte[ebx],3 - jnz near .hires - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1 -.cfield0 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - mov [edi+ebx],eax - mov [edi+4],ax - mov [edi+ebx+4],ax - add esi,2 - add edi,6 - dec ecx - jnz .cfield0 - ret -.cfield1 - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],ax - add esi,2 - add edi,6 - dec ecx - jnz .cfield1 - ret -.hiresmode7 - mov ebx,[NumBytesPerLine] -.a - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - mov [edi+4],ax - mov dx,[esi+75036*4] - shl edx,16 - mov dx,[esi+75036*4] - mov [edi+ebx*2],edx - mov [edi+ebx*2+4],dx - and edx,[HalfTrans] - and eax,[HalfTrans] - add edx,eax - shr edx,1 - mov [edi+ebx],edx - mov [edi+ebx+4],dx - add esi,2 - add edi,6 - dec ecx - jnz .a - ret -.hires - test byte[ebx],4 - jnz .m56 - mov ebx,[NumBytesPerLine] -.bng - movzx eax, word[esi+75036*4] - mov [edi+4],ax - mov [edi+ebx+4],ax - mov [edi+ebx*2+4],ax - movzx edx, word[esi] - and edx,[HalfTrans] - and eax,[HalfTrans] - add edx,eax - shl edx,15 - mov dx,[esi] - mov [edi],edx - mov [edi+ebx],edx - mov [edi+ebx*2],edx - add esi,2 - add edi,6 - dec ecx - jnz .bng - ret -.m56 - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1hr -.cfield0hr - movzx eax, word[esi+75036*4] - mov [edi+4],ax - mov [edi+ebx+4],ax - movzx edx, word[esi] - and edx,[HalfTrans] - and eax,[HalfTrans] - add edx,eax - shl edx,15 - mov dx,[esi] - mov [edi],edx - mov [edi+ebx],edx - add esi,2 - add edi,6 - dec ecx - jnz .cfield0hr - ret -.cfield1hr - movzx eax, word[esi+75036*4] - mov [edi+ebx*2+4],ax - movzx edx, word[esi] - and edx,[HalfTrans] - and eax,[HalfTrans] - add edx,eax - shl edx,15 - mov dx,[esi] - mov [edi+ebx*2],edx - add esi,2 - add edi,6 - dec ecx - jnz .cfield1hr - ret - -SECTION .data -FuncTable: - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - -FuncTable2: - dd ..@cross0, ..@cross1, ..@cross2, ..@flag0, - dd ..@cross4, ..@flag0, ..@flag0, ..@flag0, - dd ..@cross8, ..@flag0, ..@flag0, ..@flag0, - dd ..@flag0, ..@flag0, ..@flag0, ..@flag0 - -SECTION .bss -InterPtr resd 1 -SECTION .text diff --git a/tools/zsnes/src/video/hq3x32.asm b/tools/zsnes/src/video/hq3x32.asm deleted file mode 100644 index 81f469e..0000000 --- a/tools/zsnes/src/video/hq3x32.asm +++ /dev/null @@ -1,2811 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -;---------------------------------------------------------- -;hq3x filter -;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -;---------------------------------------------------------- - - - -%include "macros.mac" - -EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2,vidbufferofsb,FilteredGUI -EXTSYM resolutn,lineleft,cfield,hirestiledat,newengen,SpecialLine,hqFilter -EXTSYM AddEndBytes,NumBytesPerLine,WinVidMemStart,BitConv32Ptr,RGBtoYUVPtr -EXTSYM prevline,nextline,deltaptr,xcounter,w1,w2,w3,w4,w5,w6,w7,w8,w9 -EXTSYM c1,c2,c3,c4,c6,c7,c8,c9,reg_blank,const7,cross,threshold - -SECTION .text - -%macro TestDiff 2 - xor ecx,ecx - mov edx,[%1] - cmp edx,[%2] - je %%fin - mov ecx,[RGBtoYUVPtr] - movd mm1,[ecx+edx*4] - movq mm5,mm1 - mov edx,[%2] - movd mm2,[ecx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd ecx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 6 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - jmp %%fin -%%same: - %5 - %6 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - shl edx,2 - add edx,%3 - sub edx,%2 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp2 4 - mov edx,%2 - shl edx,1 - add edx,%3 - add edx,%4 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp3 2 - movd mm1, eax - movd mm2, %2 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const7] - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp4 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - psllw mm1, 1 - paddw mm2, mm3 - pmullw mm2, [const7] - paddw mm1, mm2 - psrlw mm1, 4 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp5 3 - mov edx,%2 - add edx,%3 - shr edx,1 - mov %1,edx -%endmacro - -%macro PIXEL00_1M 0 - Interp1 [edi],eax,[c1] -%endmacro - -%macro PIXEL00_1U 0 - Interp1 [edi],eax,[c2] -%endmacro - -%macro PIXEL00_1L 0 - Interp1 [edi],eax,[c4] -%endmacro - -%macro PIXEL00_2 0 - Interp2 [edi],eax,[c4],[c2] -%endmacro - -%macro PIXEL00_4 0 - Interp4 [edi],[c4],[c2] -%endmacro - -%macro PIXEL00_5 0 - Interp5 [edi],[c4],[c2] -%endmacro - -%macro PIXEL00_C 0 - mov [edi],eax -%endmacro - -%macro PIXEL01_1 0 - Interp1 [edi+4],eax,[c2] -%endmacro - -%macro PIXEL01_3 0 - Interp3 [edi+4],[c2] -%endmacro - -%macro PIXEL01_6 0 - Interp1 [edi+4],[c2],eax -%endmacro - -%macro PIXEL01_C 0 - mov [edi+4],eax -%endmacro - -%macro PIXEL02_1M 0 - Interp1 [edi+8],eax,[c3] -%endmacro - -%macro PIXEL02_1U 0 - Interp1 [edi+8],eax,[c2] -%endmacro - -%macro PIXEL02_1R 0 - Interp1 [edi+8],eax,[c6] -%endmacro - -%macro PIXEL02_2 0 - Interp2 [edi+8],eax,[c2],[c6] -%endmacro - -%macro PIXEL02_4 0 - Interp4 [edi+8],[c2],[c6] -%endmacro - -%macro PIXEL02_5 0 - Interp5 [edi+8],[c2],[c6] -%endmacro - -%macro PIXEL02_C 0 - mov [edi+8],eax -%endmacro - -%macro PIXEL10_1 0 - Interp1 [edi+ebx],eax,[c4] -%endmacro - -%macro PIXEL10_3 0 - Interp3 [edi+ebx],[c4] -%endmacro - -%macro PIXEL10_6 0 - Interp1 [edi+ebx],[c4],eax -%endmacro - -%macro PIXEL10_C 0 - mov [edi+ebx],eax -%endmacro - -%macro PIXEL11 0 - mov [edi+ebx+4],eax -%endmacro - -%macro PIXEL12_1 0 - Interp1 [edi+ebx+8],eax,[c6] -%endmacro - -%macro PIXEL12_3 0 - Interp3 [edi+ebx+8],[c6] -%endmacro - -%macro PIXEL12_6 0 - Interp1 [edi+ebx+8],[c6],eax -%endmacro - -%macro PIXEL12_C 0 - mov [edi+ebx+8],eax -%endmacro - -%macro PIXEL20_1M 0 - Interp1 [edi+ebx*2],eax,[c7] -%endmacro - -%macro PIXEL20_1D 0 - Interp1 [edi+ebx*2],eax,[c8] -%endmacro - -%macro PIXEL20_1L 0 - Interp1 [edi+ebx*2],eax,[c4] -%endmacro - -%macro PIXEL20_2 0 - Interp2 [edi+ebx*2],eax,[c8],[c4] -%endmacro - -%macro PIXEL20_4 0 - Interp4 [edi+ebx*2],[c8],[c4] -%endmacro - -%macro PIXEL20_5 0 - Interp5 [edi+ebx*2],[c8],[c4] -%endmacro - -%macro PIXEL20_C 0 - mov [edi+ebx*2],eax -%endmacro - -%macro PIXEL21_1 0 - Interp1 [edi+ebx*2+4],eax,[c8] -%endmacro - -%macro PIXEL21_3 0 - Interp3 [edi+ebx*2+4],[c8] -%endmacro - -%macro PIXEL21_6 0 - Interp1 [edi+ebx*2+4],[c8],eax -%endmacro - -%macro PIXEL21_C 0 - mov [edi+ebx*2+4],eax -%endmacro - -%macro PIXEL22_1M 0 - Interp1 [edi+ebx*2+8],eax,[c9] -%endmacro - -%macro PIXEL22_1D 0 - Interp1 [edi+ebx*2+8],eax,[c8] -%endmacro - -%macro PIXEL22_1R 0 - Interp1 [edi+ebx*2+8],eax,[c6] -%endmacro - -%macro PIXEL22_2 0 - Interp2 [edi+ebx*2+8],eax,[c6],[c8] -%endmacro - -%macro PIXEL22_4 0 - Interp4 [edi+ebx*2+8],[c6],[c8] -%endmacro - -%macro PIXEL22_5 0 - Interp5 [edi+ebx*2+8],[c6],[c8] -%endmacro - -%macro PIXEL22_C 0 - mov [edi+ebx*2+8],eax -%endmacro - -NEWSYM hq3x_32b - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - pushad - mov ax,ds - mov es,ax - mov esi,[vidbuffer] - mov edi,[WinVidMemStart] - add esi,16*2+256*2+32*2 - mov ecx,[vidbufferofsb] - mov [deltaptr],ecx - cmp byte[FilteredGUI],0 - jne .filtergui - cmp byte[GUIOn2],1 - je nointerp -.filtergui - cmp byte[MMXSupport],0 - je nointerp - cmp byte[hqFilter],0 - jne hq3x - -;----------------------------; -nointerp: - mov dl,[resolutn] - mov [lineleft],dl - mov ebx,[NumBytesPerLine] - mov edx,[BitConv32Ptr] -.loopy - mov ecx,256 -.loopx - movzx eax,word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],eax - add esi,2 - add edi,12 - dec ecx - jnz .loopx - add edi,[AddEndBytes] - add edi,ebx - add edi,ebx - add esi,64 - dec byte[lineleft] - jnz near .loopy - popad - ret - -;----------------------------; -hq3x: - mov dl,[resolutn] - mov [lineleft],dl - mov dword[prevline],0 - mov dword[nextline],576 - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopy - cmp byte[newengen],0 - je .loopy - mov ebx,SpecialLine+1 -.loopy - mov [InterPtr],ebx - cmp byte[ebx],1 - jbe .nohires - call HighResProc - mov edx,[deltaptr] - mov ecx,128 - mov eax,0xAAAAAAAA -.a - mov [edx],eax - add edx,4 - dec ecx - jnz .a - mov [deltaptr],edx - jmp .nexty -.nohires - mov dword[xcounter],254 ; x={Xres-2, Xres-1} are special cases. - ; x=0 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx] - movq mm3,[esi] - movq mm4,[esi+eax] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx] - pcmpeqw mm3,[edx] - pcmpeqw mm4,[edx+eax] - pand mm2,mm3 - pand mm2,mm4 - movd eax,mm2 - inc eax - jz near .loopx_end - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-2] - movq mm3,[esi-2] - movq mm4,[esi+eax-2] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-2] - pcmpeqw mm3,[edx-2] - pcmpeqw mm4,[edx+eax-2] - pand mm2,mm3 - pand mm2,mm4 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz near .loopx_end - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,[RGBtoYUVPtr] - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - test ecx,ecx - jnz .testflag1 - mov ecx,[cross] - mov ebx,[BitConv32Ptr] - mov eax,[ebx+eax*4] - jmp [FuncTable2+ecx*4] -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,[BitConv32Ptr] - mov eax,[ebx+eax*4] - mov edx,[w2] - mov edx,[ebx+edx*4] - mov [c2],edx - mov edx,[w4] - mov edx,[ebx+edx*4] - mov [c4],edx - mov edx,[w6] - mov edx,[ebx+edx*4] - mov [c6],edx - mov edx,[w8] - mov edx,[ebx+edx*4] - mov [c8],edx - test ecx,0x005A - jz .switch - mov edx,[w1] - mov edx,[ebx+edx*4] - mov [c1],edx - mov edx,[w3] - mov edx,[ebx+edx*4] - mov [c3],edx - mov edx,[w7] - mov edx,[ebx+edx*4] - mov [c7],edx - mov edx,[w9] - mov edx,[ebx+edx*4] - mov [c9],edx -.switch - mov ebx,[NumBytesPerLine] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 -; PIXEL00_2 -; PIXEL01_1 -; PIXEL02_2 -; PIXEL10_1 -; PIXEL11 -; PIXEL12_1 -; PIXEL20_2 -; PIXEL21_1 -; PIXEL22_2 - -; the same, only optimized - mov ecx,eax - shl ecx,1 - add ecx,[c2] - mov edx,ecx - add edx,[c4] - shr edx,2 - mov [edi],edx - mov edx,ecx - add edx,eax - shr edx,2 - mov [edi+4],edx - add ecx,[c6] - shr ecx,2 - mov [edi+8],ecx - mov ecx,eax - shl ecx,2 - sub ecx,eax - mov edx,ecx - add edx,[c4] - shr edx,2 - mov [edi+ebx],edx - mov [edi+ebx+4],eax - add ecx,[c6] - shr ecx,2 - mov [edi+ebx+8],ecx - mov ecx,eax - shl ecx,1 - add ecx,[c8] - mov edx,ecx - add edx,[c4] - shr edx,2 - mov [edi+ebx*2],edx - mov edx,ecx - add edx,eax - shr edx,2 - mov [edi+ebx*2+4],edx - add ecx,[c6] - shr ecx,2 - mov [edi+ebx*2+8],ecx - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag18 -..@flag50 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag80 -..@flag81 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag72 -..@flag76 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag10 -..@flag138 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag66 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag24 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag22 -..@flag54 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag208 -..@flag209 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag104 -..@flag108 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag11 -..@flag139 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag19 -..@flag51 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag146 -..@flag178 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - jmp .loopx_end -..@flag84 -..@flag85 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag112 -..@flag113 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_1M,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag200 -..@flag204 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag73 -..@flag77 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - PIXEL22_1M - jmp .loopx_end -..@flag42 -..@flag170 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag14 -..@flag142 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag67 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag70 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag28 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag152 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag194 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag98 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag56 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag25 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag26 -..@flag31 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag82 -..@flag214 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag88 -..@flag248 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag74 -..@flag107 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag27 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag86 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag216 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag106 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag30 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag210 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag120 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag75 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag29 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag198 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag184 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag99 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag57 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag71 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag156 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag226 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag60 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag195 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag102 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag153 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag58 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag83 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag92 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag202 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag78 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag154 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag114 - PIXEL00_1M - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag89 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag90 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag55 -..@flag23 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag182 -..@flag150 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - jmp .loopx_end -..@flag213 -..@flag212 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag241 -..@flag240 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag236 -..@flag232 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag109 -..@flag105 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - PIXEL22_1M - jmp .loopx_end -..@flag171 -..@flag43 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag143 -..@flag15 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag124 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag203 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag62 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag211 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag118 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag217 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag110 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag155 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag188 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag185 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag61 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag157 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag103 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag227 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag230 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag199 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag220 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag158 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag234 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1M - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1R - jmp .loopx_end -..@flag242 - PIXEL00_1M - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag59 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag121 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag87 - PIXEL00_1L - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag79 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1R - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag122 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag94 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag218 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag91 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag229 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag167 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag173 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag181 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag186 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag115 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag93 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag206 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag205 -..@flag201 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag174 -..@flag46 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag179 -..@flag147 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag117 -..@flag116 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag189 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag231 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag126 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag219 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag125 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - PIXEL22_1M - jmp .loopx_end -..@flag221 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_1U - PIXEL01_1 - PIXEL10_C - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag207 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag238 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag190 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - jmp .loopx_end -..@flag187 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag243 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag119 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag237 -..@flag233 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag175 -..@flag47 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag183 -..@flag151 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag245 -..@flag244 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag250 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag123 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag95 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag222 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag252 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag249 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag235 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag111 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag63 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag159 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag215 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag246 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag254 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_2 - jmp .loopx_end -..@flag253 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag251 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_2,PIXEL21_3 - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag239 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag127 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_2,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag191 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag223 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_2,PIXEL12_3 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag247 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag255 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end - -..@cross0 - mov ebx,[NumBytesPerLine] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],eax - jmp .loopx_end -..@cross1 - mov ecx,[w2] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[NumBytesPerLine] - mov [edi],edx - mov [edi+4],edx - mov [edi+8],edx - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],eax - jmp .loopx_end -..@cross2 - mov ecx,[w4] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[NumBytesPerLine] - mov [edi],edx - mov [edi+4],eax - mov [edi+8],eax - mov [edi+ebx],edx - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2],edx - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],eax - jmp .loopx_end -..@cross4 - mov ecx,[w6] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[NumBytesPerLine] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],edx - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],edx - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],edx - jmp .loopx_end -..@cross8 - mov ecx,[w8] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[NumBytesPerLine] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2],edx - mov [edi+ebx*2+4],edx - mov [edi+ebx*2+8],edx - jmp .loopx_end -..@crossN - mov edx,[w2] - mov ecx,[ebx+edx*4] - mov [c2],ecx - mov edx,[w4] - mov ecx,[ebx+edx*4] - mov [c4],ecx - mov edx,[w6] - mov ecx,[ebx+edx*4] - mov [c6],ecx - mov edx,[w8] - mov ecx,[ebx+edx*4] - mov [c8],ecx - mov ebx,[NumBytesPerLine] - jmp ..@flag0 - -.loopx_end - add esi,2 - add dword[deltaptr],2 - add edi,12 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl near .xres_1 - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-4] - movq mm3,[esi-4] - movq mm4,[esi+eax-4] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-4] - pcmpeqw mm3,[edx-4] - pcmpeqw mm4,[edx+eax-4] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,16 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz .loopx_end - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl near .endofline - ; x=Xres-1 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-6] - movq mm3,[esi-6] - movq mm4,[esi+eax-6] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-6] - pcmpeqw mm3,[edx-6] - pcmpeqw mm4,[edx+eax-6] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,32 - movd eax,mm2 - inc eax - jz .loopx_end - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - mov [edx+ecx-2],eax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.endofline - mov ebx,[NumBytesPerLine] -.nexty - add esi,64 - add dword[deltaptr],64 - add edi,[AddEndBytes] - add edi,ebx - add edi,ebx - mov ebx,[InterPtr] - inc ebx - dec byte[lineleft] - jz .fin - cmp byte[lineleft],1 - je .lastline - mov dword[nextline],576 - mov dword[prevline],-576 - jmp .loopy -.lastline - mov dword[nextline],0 - mov dword[prevline],-576 - jmp .loopy -.fin - emms - popad - ret - -HighResProc: - mov ecx,256 - cmp byte[ebx],3 - je near .hiresmode7 - cmp byte[ebx],7 - je near .hiresmode7 - test byte[ebx],3 - jnz near .hires - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1 -.cfield0 - movzx eax,word[esi] - shl eax,2 - add eax,[BitConv32Ptr] - mov eax,[eax] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - add esi,2 - add edi,12 - dec ecx - jnz .cfield0 - ret -.cfield1 - movzx eax,word[esi] - shl eax,2 - add eax,[BitConv32Ptr] - mov eax,[eax] - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],eax - add esi,2 - add edi,12 - dec ecx - jnz .cfield1 - ret -.hiresmode7 - mov ebx,[NumBytesPerLine] -.a - movzx eax,word[esi] - shl eax,2 - add eax,[BitConv32Ptr] - mov eax,[eax] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - movzx edx,word[esi+75036*4] - shl edx,2 - add edx,[BitConv32Ptr] - mov edx,[edx] - mov [edi+ebx*2],edx - mov [edi+ebx*2+4],edx - mov [edi+ebx*2+8],edx - add edx,eax - shr edx,1 - mov [edi+ebx],edx - mov [edi+ebx+4],edx - mov [edi+ebx+8],edx - add esi,2 - add edi,12 - dec ecx - jnz .a - ret -.hires - test byte[ebx],4 - jnz .m56 - mov ebx,[NumBytesPerLine] -.bng - movzx eax, word[esi+75036*4] - shl eax,2 - add eax,[BitConv32Ptr] - mov eax,[eax] - mov [edi+8],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2+8],eax - movzx edx, word[esi] - shl edx,2 - add edx,[BitConv32Ptr] - mov edx,[edx] - mov [edi],edx - mov [edi+ebx],edx - mov [edi+ebx*2],edx - add edx,eax - shr edx,1 - mov [edi+4],edx - mov [edi+ebx+4],edx - mov [edi+ebx*2+4],edx - add esi,2 - add edi,12 - dec ecx - jnz .bng - ret -.m56 - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1hr -.cfield0hr - movzx eax, word[esi+75036*4] - shl eax,2 - add eax,[BitConv32Ptr] - mov eax,[eax] - mov [edi+8],eax - mov [edi+ebx+8],eax - movzx edx, word[esi] - shl edx,2 - add edx,[BitConv32Ptr] - mov edx,[edx] - mov [edi],edx - mov [edi+ebx],edx - add edx,eax - shr edx,1 - mov [edi+4],edx - mov [edi+ebx+4],edx - add esi,2 - add edi,12 - dec ecx - jnz .cfield0hr - ret -.cfield1hr - movzx eax, word[esi+75036*4] - shl eax,2 - add eax,[BitConv32Ptr] - mov eax,[eax] - mov [edi+ebx*2+8],eax - movzx edx, word[esi] - shl edx,2 - add edx,[BitConv32Ptr] - mov edx,[edx] - mov [edi+ebx*2],edx - add edx,eax - shr edx,1 - mov [edi+ebx*2+4],edx - add esi,2 - add edi,12 - dec ecx - jnz .cfield1hr - ret - -SECTION .data -FuncTable: - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - -FuncTable2: - dd ..@cross0, ..@cross1, ..@cross2, ..@crossN, - dd ..@cross4, ..@crossN, ..@crossN, ..@crossN, - dd ..@cross8, ..@crossN, ..@crossN, ..@crossN, - dd ..@crossN, ..@crossN, ..@crossN, ..@crossN - -SECTION .bss -InterPtr resd 1 -SECTION .text diff --git a/tools/zsnes/src/video/hq4x16.asm b/tools/zsnes/src/video/hq4x16.asm deleted file mode 100644 index 07ab790..0000000 --- a/tools/zsnes/src/video/hq4x16.asm +++ /dev/null @@ -1,4279 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -;---------------------------------------------------------- -; hq4x filter -; Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -;---------------------------------------------------------- - - - -%include "macros.mac" - -EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2,vidbufferofsb,FilteredGUI -EXTSYM resolutn,lineleft,cfield,hirestiledat,newengen,SpecialLine,HalfTrans -EXTSYM hqFilter,AddEndBytes,NumBytesPerLine,WinVidMemStart,BitConv32Ptr -EXTSYM RGBtoYUVPtr,prevline,nextline,deltaptr,xcounter,w1,w2,w3,w4,w5,w6,w7,w8 -EXTSYM w9,reg_blank,const3,const5,const6,const7,cross,threshold - -SECTION .text - -%macro AUXADDRESS 0 - mov ecx, edi - add ecx, ebx - add ecx, ebx -%endmacro - -%macro TestDiff 2 - mov edx,[%1] - sub edx,[%2] - jz %%fin - mov edx,[%1] - shl edx,2 - add edx,[RGBtoYUVPtr] - movd mm1,[edx] - movq mm5,mm1 - mov edx,[%2] - shl edx,2 - add edx,[RGBtoYUVPtr] - movd mm2,[edx] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test edx,edx - jz near %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro DiffOrNot 14 - TestDiff %1,%2 - test edx,edx - jz near %%same - %3 - %4 - %5 - %6 - %7 - %8 - jmp %%fin -%%same: - %9 - %10 - %11 - %12 - %13 - %14 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - mov eax,%3 - cmp edx,eax - je %%fin - and edx,[HalfTrans] - and eax,[HalfTrans] - add eax,edx - shr eax,1 - add eax,0x0821 - and eax,[HalfTrans] - add edx,eax - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro Interp2 4 - mov edx,%3 - mov eax,%4 - cmp edx,eax - je %%fin1 - and edx,[HalfTrans] - and eax,[HalfTrans] - add eax,edx - shr eax,1 - add eax,0x0821 -%%fin1 - mov edx,%2 - cmp edx,eax - je %%fin2 - and eax,[HalfTrans] - and edx,[HalfTrans] - add edx,eax - shr edx,1 -%%fin2 - mov %1,dx -%endmacro - -%macro Interp3 3 - mov eax, [BitConv32Ptr] - mov edx, %2 - movd mm1, [eax+edx*4] - mov edx, %3 - movd mm2, [eax+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const7] - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp5 3 - mov edx,%2 - mov eax,%3 - cmp edx,eax - je %%fin - and edx,[HalfTrans] - and eax,[HalfTrans] - add edx,eax - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro Interp6 4 - mov eax, [BitConv32Ptr] - mov edx, %2 - movd mm1, [eax+edx*4] - mov edx, %3 - movd mm2, [eax+edx*4] - mov edx, %4 - movd mm3, [eax+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const5] - psllw mm2, 1 - paddw mm1, mm3 - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp7 4 - mov eax, [BitConv32Ptr] - mov edx, %2 - movd mm1, [eax+edx*4] - mov edx, %3 - movd mm2, [eax+edx*4] - mov edx, %4 - movd mm3, [eax+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const6] - paddw mm2, mm3 - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp8 3 - mov eax, [BitConv32Ptr] - mov edx, %2 - movd mm1, [eax+edx*4] - mov edx, %3 - movd mm2, [eax+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const5] - pmullw mm2, [const3] - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro PIXEL00_0 0 - mov eax,[w5] - mov [edi],ax -%endmacro - -%macro PIXEL00_11 0 - Interp1 [edi],[w5],[w4] -%endmacro - -%macro PIXEL00_12 0 - Interp1 [edi],[w5],[w2] -%endmacro - -%macro PIXEL00_20 0 - Interp2 [edi],[w5],[w2],[w4] -%endmacro - -%macro PIXEL00_50 0 - Interp5 [edi],[w2],[w4] -%endmacro - -%macro PIXEL00_80 0 - Interp8 [edi],[w5],[w1] -%endmacro - -%macro PIXEL00_81 0 - Interp8 [edi],[w5],[w4] -%endmacro - -%macro PIXEL00_82 0 - Interp8 [edi],[w5],[w2] -%endmacro - -%macro PIXEL01_0 0 - mov eax,[w5] - mov [edi+2],ax -%endmacro - -%macro PIXEL01_10 0 - Interp1 [edi+2],[w5],[w1] -%endmacro - -%macro PIXEL01_12 0 - Interp1 [edi+2],[w5],[w2] -%endmacro - -%macro PIXEL01_14 0 - Interp1 [edi+2],[w2],[w5] -%endmacro - -%macro PIXEL01_21 0 - Interp2 [edi+2],[w2],[w5],[w4] -%endmacro - -%macro PIXEL01_31 0 - Interp3 [edi+2],[w5],[w4] -%endmacro - -%macro PIXEL01_50 0 - Interp5 [edi+2],[w2],[w5] -%endmacro - -%macro PIXEL01_60 0 - Interp6 [edi+2],[w5],[w2],[w4] -%endmacro - -%macro PIXEL01_61 0 - Interp6 [edi+2],[w5],[w2],[w1] -%endmacro - -%macro PIXEL01_82 0 - Interp8 [edi+2],[w5],[w2] -%endmacro - -%macro PIXEL01_83 0 - Interp8 [edi+2],[w2],[w4] -%endmacro - -%macro PIXEL02_0 0 - mov eax,[w5] - mov [edi+4],ax -%endmacro - -%macro PIXEL02_10 0 - Interp1 [edi+4],[w5],[w3] -%endmacro - -%macro PIXEL02_11 0 - Interp1 [edi+4],[w5],[w2] -%endmacro - -%macro PIXEL02_13 0 - Interp1 [edi+4],[w2],[w5] -%endmacro - -%macro PIXEL02_21 0 - Interp2 [edi+4],[w2],[w5],[w6] -%endmacro - -%macro PIXEL02_32 0 - Interp3 [edi+4],[w5],[w6] -%endmacro - -%macro PIXEL02_50 0 - Interp5 [edi+4],[w2],[w5] -%endmacro - -%macro PIXEL02_60 0 - Interp6 [edi+4],[w5],[w2],[w6] -%endmacro - -%macro PIXEL02_61 0 - Interp6 [edi+4],[w5],[w2],[w3] -%endmacro - -%macro PIXEL02_81 0 - Interp8 [edi+4],[w5],[w2] -%endmacro - -%macro PIXEL02_83 0 - Interp8 [edi+4],[w2],[w6] -%endmacro - -%macro PIXEL03_0 0 - mov eax,[w5] - mov [edi+6],ax -%endmacro - -%macro PIXEL03_11 0 - Interp1 [edi+6],[w5],[w2] -%endmacro - -%macro PIXEL03_12 0 - Interp1 [edi+6],[w5],[w6] -%endmacro - -%macro PIXEL03_20 0 - Interp2 [edi+6],[w5],[w2],[w6] -%endmacro - -%macro PIXEL03_50 0 - Interp5 [edi+6],[w2],[w6] -%endmacro - -%macro PIXEL03_80 0 - Interp8 [edi+6],[w5],[w3] -%endmacro - -%macro PIXEL03_81 0 - Interp8 [edi+6],[w5],[w2] -%endmacro - -%macro PIXEL03_82 0 - Interp8 [edi+6],[w5],[w6] -%endmacro - -%macro PIXEL10_0 0 - mov eax,[w5] - mov [edi+ebx],ax -%endmacro - -%macro PIXEL10_10 0 - Interp1 [edi+ebx],[w5],[w1] -%endmacro - -%macro PIXEL10_11 0 - Interp1 [edi+ebx],[w5],[w4] -%endmacro - -%macro PIXEL10_13 0 - Interp1 [edi+ebx],[w4],[w5] -%endmacro - -%macro PIXEL10_21 0 - Interp2 [edi+ebx],[w4],[w5],[w2] -%endmacro - -%macro PIXEL10_32 0 - Interp3 [edi+ebx],[w5],[w2] -%endmacro - -%macro PIXEL10_50 0 - Interp5 [edi+ebx],[w4],[w5] -%endmacro - -%macro PIXEL10_60 0 - Interp6 [edi+ebx],[w5],[w4],[w2] -%endmacro - -%macro PIXEL10_61 0 - Interp6 [edi+ebx],[w5],[w4],[w1] -%endmacro - -%macro PIXEL10_81 0 - Interp8 [edi+ebx],[w5],[w4] -%endmacro - -%macro PIXEL10_83 0 - Interp8 [edi+ebx],[w4],[w2] -%endmacro - -%macro PIXEL11_0 0 - mov eax,[w5] - mov [edi+ebx+2],ax -%endmacro - -%macro PIXEL11_30 0 - Interp3 [edi+ebx+2],[w5],[w1] -%endmacro - -%macro PIXEL11_31 0 - Interp3 [edi+ebx+2],[w5],[w4] -%endmacro - -%macro PIXEL11_32 0 - Interp3 [edi+ebx+2],[w5],[w2] -%endmacro - -%macro PIXEL11_70 0 - Interp7 [edi+ebx+2],[w5],[w4],[w2] -%endmacro - -%macro PIXEL12_0 0 - mov eax,[w5] - mov [edi+ebx+4],ax -%endmacro - -%macro PIXEL12_30 0 - Interp3 [edi+ebx+4],[w5],[w3] -%endmacro - -%macro PIXEL12_31 0 - Interp3 [edi+ebx+4],[w5],[w2] -%endmacro - -%macro PIXEL12_32 0 - Interp3 [edi+ebx+4],[w5],[w6] -%endmacro - -%macro PIXEL12_70 0 - Interp7 [edi+ebx+4],[w5],[w6],[w2] -%endmacro - -%macro PIXEL13_0 0 - mov eax,[w5] - mov [edi+ebx+6],ax -%endmacro - -%macro PIXEL13_10 0 - Interp1 [edi+ebx+6],[w5],[w3] -%endmacro - -%macro PIXEL13_12 0 - Interp1 [edi+ebx+6],[w5],[w6] -%endmacro - -%macro PIXEL13_14 0 - Interp1 [edi+ebx+6],[w6],[w5] -%endmacro - -%macro PIXEL13_21 0 - Interp2 [edi+ebx+6],[w6],[w5],[w2] -%endmacro - -%macro PIXEL13_31 0 - Interp3 [edi+ebx+6],[w5],[w2] -%endmacro - -%macro PIXEL13_50 0 - Interp5 [edi+ebx+6],[w6],[w5] -%endmacro - -%macro PIXEL13_60 0 - Interp6 [edi+ebx+6],[w5],[w6],[w2] -%endmacro - -%macro PIXEL13_61 0 - Interp6 [edi+ebx+6],[w5],[w6],[w3] -%endmacro - -%macro PIXEL13_82 0 - Interp8 [edi+ebx+6],[w5],[w6] -%endmacro - -%macro PIXEL13_83 0 - Interp8 [edi+ebx+6],[w6],[w2] -%endmacro - -%macro PIXEL20_0 0 - mov eax,[w5] - mov [ecx],ax -%endmacro - -%macro PIXEL20_10 0 - Interp1 [ecx],[w5],[w7] -%endmacro - -%macro PIXEL20_12 0 - Interp1 [ecx],[w5],[w4] -%endmacro - -%macro PIXEL20_14 0 - Interp1 [ecx],[w4],[w5] -%endmacro - -%macro PIXEL20_21 0 - Interp2 [ecx],[w4],[w5],[w8] -%endmacro - -%macro PIXEL20_31 0 - Interp3 [ecx],[w5],[w8] -%endmacro - -%macro PIXEL20_50 0 - Interp5 [ecx],[w4],[w5] -%endmacro - -%macro PIXEL20_60 0 - Interp6 [ecx],[w5],[w4],[w8] -%endmacro - -%macro PIXEL20_61 0 - Interp6 [ecx],[w5],[w4],[w7] -%endmacro - -%macro PIXEL20_82 0 - Interp8 [ecx],[w5],[w4] -%endmacro - -%macro PIXEL20_83 0 - Interp8 [ecx],[w4],[w8] -%endmacro - -%macro PIXEL21_0 0 - mov eax,[w5] - mov [ecx+2],ax -%endmacro - -%macro PIXEL21_30 0 - Interp3 [ecx+2],[w5],[w7] -%endmacro - -%macro PIXEL21_31 0 - Interp3 [ecx+2],[w5],[w8] -%endmacro - -%macro PIXEL21_32 0 - Interp3 [ecx+2],[w5],[w4] -%endmacro - -%macro PIXEL21_70 0 - Interp7 [ecx+2],[w5],[w4],[w8] -%endmacro - -%macro PIXEL22_0 0 - mov eax,[w5] - mov [ecx+4],ax -%endmacro - -%macro PIXEL22_30 0 - Interp3 [ecx+4],[w5],[w9] -%endmacro - -%macro PIXEL22_31 0 - Interp3 [ecx+4],[w5],[w6] -%endmacro - -%macro PIXEL22_32 0 - Interp3 [ecx+4],[w5],[w8] -%endmacro - -%macro PIXEL22_70 0 - Interp7 [ecx+4],[w5],[w6],[w8] -%endmacro - -%macro PIXEL23_0 0 - mov eax,[w5] - mov [ecx+6],ax -%endmacro - -%macro PIXEL23_10 0 - Interp1 [ecx+6],[w5],[w9] -%endmacro - -%macro PIXEL23_11 0 - Interp1 [ecx+6],[w5],[w6] -%endmacro - -%macro PIXEL23_13 0 - Interp1 [ecx+6],[w6],[w5] -%endmacro - -%macro PIXEL23_21 0 - Interp2 [ecx+6],[w6],[w5],[w8] -%endmacro - -%macro PIXEL23_32 0 - Interp3 [ecx+6],[w5],[w8] -%endmacro - -%macro PIXEL23_50 0 - Interp5 [ecx+6],[w6],[w5] -%endmacro - -%macro PIXEL23_60 0 - Interp6 [ecx+6],[w5],[w6],[w8] -%endmacro - -%macro PIXEL23_61 0 - Interp6 [ecx+6],[w5],[w6],[w9] -%endmacro - -%macro PIXEL23_81 0 - Interp8 [ecx+6],[w5],[w6] -%endmacro - -%macro PIXEL23_83 0 - Interp8 [ecx+6],[w6],[w8] -%endmacro - -%macro PIXEL30_0 0 - mov eax,[w5] - mov [ecx+ebx],ax -%endmacro - -%macro PIXEL30_11 0 - Interp1 [ecx+ebx],[w5],[w8] -%endmacro - -%macro PIXEL30_12 0 - Interp1 [ecx+ebx],[w5],[w4] -%endmacro - -%macro PIXEL30_20 0 - Interp2 [ecx+ebx],[w5],[w8],[w4] -%endmacro - -%macro PIXEL30_50 0 - Interp5 [ecx+ebx],[w8],[w4] -%endmacro - -%macro PIXEL30_80 0 - Interp8 [ecx+ebx],[w5],[w7] -%endmacro - -%macro PIXEL30_81 0 - Interp8 [ecx+ebx],[w5],[w8] -%endmacro - -%macro PIXEL30_82 0 - Interp8 [ecx+ebx],[w5],[w4] -%endmacro - -%macro PIXEL31_0 0 - mov eax,[w5] - mov [ecx+ebx+2],ax -%endmacro - -%macro PIXEL31_10 0 - Interp1 [ecx+ebx+2],[w5],[w7] -%endmacro - -%macro PIXEL31_11 0 - Interp1 [ecx+ebx+2],[w5],[w8] -%endmacro - -%macro PIXEL31_13 0 - Interp1 [ecx+ebx+2],[w8],[w5] -%endmacro - -%macro PIXEL31_21 0 - Interp2 [ecx+ebx+2],[w8],[w5],[w4] -%endmacro - -%macro PIXEL31_32 0 - Interp3 [ecx+ebx+2],[w5],[w4] -%endmacro - -%macro PIXEL31_50 0 - Interp5 [ecx+ebx+2],[w8],[w5] -%endmacro - -%macro PIXEL31_60 0 - Interp6 [ecx+ebx+2],[w5],[w8],[w4] -%endmacro - -%macro PIXEL31_61 0 - Interp6 [ecx+ebx+2],[w5],[w8],[w7] -%endmacro - -%macro PIXEL31_81 0 - Interp8 [ecx+ebx+2],[w5],[w8] -%endmacro - -%macro PIXEL31_83 0 - Interp8 [ecx+ebx+2],[w8],[w4] -%endmacro - -%macro PIXEL32_0 0 - mov eax,[w5] - mov [ecx+ebx+4],ax -%endmacro - -%macro PIXEL32_10 0 - Interp1 [ecx+ebx+4],[w5],[w9] -%endmacro - -%macro PIXEL32_12 0 - Interp1 [ecx+ebx+4],[w5],[w8] -%endmacro - -%macro PIXEL32_14 0 - Interp1 [ecx+ebx+4],[w8],[w5] -%endmacro - -%macro PIXEL32_21 0 - Interp2 [ecx+ebx+4],[w8],[w5],[w6] -%endmacro - -%macro PIXEL32_31 0 - Interp3 [ecx+ebx+4],[w5],[w6] -%endmacro - -%macro PIXEL32_50 0 - Interp5 [ecx+ebx+4],[w8],[w5] -%endmacro - -%macro PIXEL32_60 0 - Interp6 [ecx+ebx+4],[w5],[w8],[w6] -%endmacro - -%macro PIXEL32_61 0 - Interp6 [ecx+ebx+4],[w5],[w8],[w9] -%endmacro - -%macro PIXEL32_82 0 - Interp8 [ecx+ebx+4],[w5],[w8] -%endmacro - -%macro PIXEL32_83 0 - Interp8 [ecx+ebx+4],[w8],[w6] -%endmacro - -%macro PIXEL33_0 0 - mov eax,[w5] - mov [ecx+ebx+6],ax -%endmacro - -%macro PIXEL33_11 0 - Interp1 [ecx+ebx+6],[w5],[w6] -%endmacro - -%macro PIXEL33_12 0 - Interp1 [ecx+ebx+6],[w5],[w8] -%endmacro - -%macro PIXEL33_20 0 - Interp2 [ecx+ebx+6],[w5],[w8],[w6] -%endmacro - -%macro PIXEL33_50 0 - Interp5 [ecx+ebx+6],[w8],[w6] -%endmacro - -%macro PIXEL33_80 0 - Interp8 [ecx+ebx+6],[w5],[w9] -%endmacro - -%macro PIXEL33_81 0 - Interp8 [ecx+ebx+6],[w5],[w6] -%endmacro - -%macro PIXEL33_82 0 - Interp8 [ecx+ebx+6],[w5],[w8] -%endmacro - -NEWSYM hq4x_16b - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - pushad - mov ax,ds - mov es,ax - mov esi,[vidbuffer] - mov edi,[WinVidMemStart] - add esi,16*2+256*2+32*2 - mov ecx,[vidbufferofsb] - mov [deltaptr],ecx - cmp byte[FilteredGUI],0 - jne .filtergui - cmp byte[GUIOn2],1 - je nointerp -.filtergui - cmp byte[MMXSupport],0 - je nointerp - cmp byte[hqFilter],0 - jne hq4x - -;----------------------------; -nointerp: - mov dl,[resolutn] - mov [lineleft],dl - mov ebx,[NumBytesPerLine] -.loopy - mov ecx,256 - mov edx,edi - add edx,ebx - add edx,ebx -.loopx - mov ax,[esi] - shl eax,16 - mov ax,[esi] - mov [edi],eax - mov [edi+4],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edx],eax - mov [edx+4],eax - mov [edx+ebx],eax - mov [edx+ebx+4],eax - add esi,2 - add edi,8 - add edx,8 - dec ecx - jnz .loopx - add edi,[AddEndBytes] - add edi,ebx - add edi,ebx - add edi,ebx - add esi,64 - dec byte[lineleft] - jnz near .loopy - popad - ret - -;----------------------------; -hq4x: - mov dl,[resolutn] - mov [lineleft],dl - mov dword[prevline],0 - mov dword[nextline],576 - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopy - cmp byte[newengen],0 - je .loopy - mov ebx,SpecialLine+1 -.loopy - mov [InterPtr],ebx - cmp byte[ebx],1 - jbe .nohires - call HighResProc - mov edx,[deltaptr] - mov ecx,128 - mov eax,0xAAAAAAAA -.a - mov [edx],eax - add edx,4 - dec ecx - jnz .a - mov [deltaptr],edx - jmp .nexty -.nohires - mov dword[xcounter],254 ; x={Xres-2, Xres-1} are special cases. - ; x=0 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx] - movq mm3,[esi] - movq mm4,[esi+eax] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx] - pcmpeqw mm3,[edx] - pcmpeqw mm4,[edx+eax] - pand mm2,mm3 - pand mm2,mm4 - movd eax,mm2 - inc eax - jz near .loopx_end - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-2] - movq mm3,[esi-2] - movq mm4,[esi+eax-2] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-2] - pcmpeqw mm3,[edx-2] - pcmpeqw mm4,[edx+eax-2] - pand mm2,mm3 - pand mm2,mm4 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz near .loopx_end - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,[RGBtoYUVPtr] - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - cmp dword[cross],0 - jnz .testflag1 - mov ebx,[NumBytesPerLine] - mov edx,eax - shl eax,16 - or eax,edx - AUXADDRESS - mov [edi],eax - mov [edi+4],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [ecx],eax - mov [ecx+4],eax - mov [ecx+ebx],eax - mov [ecx+ebx+4],eax - jmp .loopx_end -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,[NumBytesPerLine] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag18 -..@flag50 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_50,PIXEL03_50,PIXEL12_0,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag80 -..@flag81 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag72 -..@flag76 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_50,PIXEL21_0,PIXEL30_50,PIXEL31_50 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag10 -..@flag138 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_50,PIXEL10_50,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag66 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag24 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag22 -..@flag54 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag208 -..@flag209 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag104 -..@flag108 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag11 -..@flag139 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag19 -..@flag51 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag146 -..@flag178 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - jmp .loopx_end -..@flag84 -..@flag85 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag112 -..@flag113 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL30_82,PIXEL31_32,PIXEL32_10,PIXEL33_80,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag200 -..@flag204 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag73 -..@flag77 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag42 -..@flag170 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag14 -..@flag142 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL02_32,PIXEL03_82,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag67 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag70 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag28 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag152 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag194 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag98 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag56 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag25 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag26 -..@flag31 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag82 -..@flag214 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag88 -..@flag248 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag74 -..@flag107 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag27 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag86 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag216 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag106 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag30 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag210 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag120 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag75 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag29 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag198 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag184 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag99 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag57 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag71 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag156 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag226 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag60 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag195 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag102 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag153 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag58 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag83 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag92 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag202 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag78 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag154 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag114 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag89 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag90 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag55 -..@flag23 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag182 -..@flag150 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - jmp .loopx_end -..@flag213 -..@flag212 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag241 -..@flag240 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag236 -..@flag232 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag109 -..@flag105 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag171 -..@flag43 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag143 -..@flag15 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag124 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag203 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag62 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag211 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag118 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag217 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag110 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag155 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag188 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag185 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag61 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag157 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag103 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag227 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag230 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag199 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag220 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag158 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag234 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag242 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag59 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL11_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag121 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag87 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag79 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_32 - PIXEL03_82 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag122 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag94 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag218 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag91 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL11_0 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag229 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag167 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag173 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag181 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag186 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag115 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag93 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag206 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag205 -..@flag201 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag174 -..@flag46 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag179 -..@flag147 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag117 -..@flag116 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag189 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag231 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag126 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag219 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag125 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag221 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag207 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag238 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag190 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_10 - PIXEL11_30 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - jmp .loopx_end -..@flag187 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag243 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag119 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag237 -..@flag233 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag175 -..@flag47 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag183 -..@flag151 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag245 -..@flag244 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag250 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag123 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag95 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag222 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag252 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag249 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - jmp .loopx_end -..@flag235 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag111 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag63 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag159 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag215 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag246 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag254 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag253 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag251 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - jmp .loopx_end -..@flag239 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag127 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag191 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag223 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag247 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag255 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end - -.loopx_end - add esi,2 - add dword[deltaptr],2 - add edi,8 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl near .xres_1 - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-4] - movq mm3,[esi-4] - movq mm4,[esi+eax-4] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-4] - pcmpeqw mm3,[edx-4] - pcmpeqw mm4,[edx+eax-4] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,16 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz .loopx_end - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl near .endofline - ; x=Xres-1 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-6] - movq mm3,[esi-6] - movq mm4,[esi+eax-6] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-6] - pcmpeqw mm3,[edx-6] - pcmpeqw mm4,[edx+eax-6] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,32 - movd eax,mm2 - inc eax - jz .loopx_end - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - mov [edx+ecx-2],eax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.endofline - mov ebx,[NumBytesPerLine] -.nexty - add esi,64 - add dword[deltaptr],64 - add edi,[AddEndBytes] - add edi,ebx - add edi,ebx - add edi,ebx - mov ebx,[InterPtr] - inc ebx - dec byte[lineleft] - jz .fin - cmp byte[lineleft],1 - je .lastline - mov dword[nextline],576 - mov dword[prevline],-576 - jmp .loopy -.lastline - mov dword[nextline],0 - mov dword[prevline],-576 - jmp .loopy -.fin - emms - popad - ret - -HighResProc: - mov ecx,64 - cmp byte[ebx],3 - je near .hiresmode7 - cmp byte[ebx],7 - je near .hiresmode7 - test byte[ebx],3 - jnz near .hires - mov ebx,[NumBytesPerLine] - mov eax,edi - add eax,ebx - add eax,ebx - test byte[cfield],1 - jnz .cfield1 -.cfield0 - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq mm2,mm0 - punpcklwd mm0,mm2 - movq [edi],mm0 - movq [edi+ebx],mm0 - punpckhwd mm2,mm2 - movq [edi+8],mm2 - movq [edi+ebx+8],mm2 - punpckhwd mm1,mm1 - movq mm3,mm1 - punpcklwd mm1,mm3 - movq [edi+16],mm1 - movq [edi+ebx+16],mm1 - punpckhwd mm3,mm3 - movq [edi+24],mm3 - movq [edi+ebx+24],mm3 - add esi,8 - add edi,32 - add eax,32 - dec ecx - jnz .cfield0 - ret -.cfield1 - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq mm2,mm0 - punpcklwd mm0,mm2 - movq [eax],mm0 - movq [eax+ebx],mm0 - punpckhwd mm2,mm2 - movq [eax+8],mm2 - movq [eax+ebx+8],mm2 - punpckhwd mm1,mm1 - movq mm3,mm1 - punpcklwd mm1,mm3 - movq [eax+16],mm1 - movq [eax+ebx+16],mm1 - punpckhwd mm3,mm3 - movq [eax+24],mm3 - movq [eax+ebx+24],mm3 - add esi,8 - add edi,32 - add eax,32 - dec ecx - jnz .cfield1 - ret -.hiresmode7 - mov ebx,[NumBytesPerLine] - mov eax,edi - add eax,ebx - add eax,ebx -.a - movq mm0,[esi] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq mm2,mm0 - punpcklwd mm0,mm2 - movq [edi],mm0 - movq [edi+ebx],mm0 - punpckhwd mm2,mm2 - movq [edi+8],mm2 - movq [edi+ebx+8],mm2 - punpckhwd mm1,mm1 - movq mm3,mm1 - punpcklwd mm1,mm3 - movq [edi+16],mm1 - movq [edi+ebx+16],mm1 - punpckhwd mm3,mm3 - movq [edi+24],mm3 - movq [edi+ebx+24],mm3 - movq mm0,[esi+75036*4] - movq mm1,mm0 - punpcklwd mm0,mm1 - movq mm2,mm0 - punpcklwd mm0,mm2 - movq [eax],mm0 - movq [eax+ebx],mm0 - punpckhwd mm2,mm2 - movq [eax+8],mm2 - movq [eax+ebx+8],mm2 - punpckhwd mm1,mm1 - movq mm3,mm1 - punpcklwd mm1,mm3 - movq [eax+16],mm1 - movq [eax+ebx+16],mm1 - punpckhwd mm3,mm3 - movq [eax+24],mm3 - movq [eax+ebx+24],mm3 - add esi,8 - add edi,32 - add eax,32 - dec ecx - jnz .a - ret -.hires - test byte[ebx],4 - jnz near .m56 - mov ebx,[NumBytesPerLine] - mov eax,edi - add eax,ebx - add eax,ebx -.bng - movq mm0,[esi] - movq mm1,[esi+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - movq mm3,mm0 - punpcklwd mm0,mm3 - punpckhwd mm3,mm3 - movq [edi],mm0 - movq [edi+8],mm3 - movq [edi+ebx],mm0 - movq [edi+ebx+8],mm3 - movq [eax],mm0 - movq [eax+8],mm3 - movq [eax+ebx],mm0 - movq [eax+ebx+8],mm3 - punpckhwd mm2,mm1 - movq mm3,mm2 - punpcklwd mm2,mm3 - punpckhwd mm3,mm3 - movq [edi+16],mm2 - movq [edi+24],mm3 - movq [edi+ebx+16],mm2 - movq [edi+ebx+24],mm3 - movq [eax+16],mm2 - movq [eax+24],mm3 - movq [eax+ebx+16],mm2 - movq [eax+ebx+24],mm3 - add esi,8 - add edi,32 - add eax,32 - dec ecx - jnz .bng - ret -.m56 - mov ebx,[NumBytesPerLine] - mov eax,edi - add eax,ebx - add eax,ebx - test byte[cfield],1 - jnz .cfield1hr -.cfield0hr - movq mm0,[esi] - movq mm1,[esi+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - movq mm3,mm0 - punpcklwd mm0,mm3 - punpckhwd mm3,mm3 - movq [edi],mm0 - movq [edi+8],mm3 - movq [edi+ebx],mm0 - movq [edi+ebx+8],mm3 - punpckhwd mm2,mm1 - movq mm3,mm2 - punpcklwd mm2,mm3 - punpckhwd mm3,mm3 - movq [edi+16],mm2 - movq [edi+24],mm3 - movq [edi+ebx+16],mm2 - movq [edi+ebx+24],mm3 - add esi,8 - add edi,32 - add eax,32 - dec ecx - jnz .cfield0hr - ret -.cfield1hr - movq mm0,[esi] - movq mm1,[esi+75036*4] - movq mm2,mm0 - punpcklwd mm0,mm1 - movq mm3,mm0 - punpcklwd mm0,mm3 - punpckhwd mm3,mm3 - movq [eax],mm0 - movq [eax+8],mm3 - movq [eax+ebx],mm0 - movq [eax+ebx+8],mm3 - punpckhwd mm2,mm1 - movq mm3,mm2 - punpcklwd mm2,mm3 - punpckhwd mm3,mm3 - movq [eax+16],mm2 - movq [eax+24],mm3 - movq [eax+ebx+16],mm2 - movq [eax+ebx+24],mm3 - add esi,8 - add edi,32 - add eax,32 - dec ecx - jnz .cfield1hr - ret - -SECTION .data -FuncTable: - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - -SECTION .bss -InterPtr resd 1 -SECTION .text diff --git a/tools/zsnes/src/video/hq4x32.asm b/tools/zsnes/src/video/hq4x32.asm deleted file mode 100644 index ceac724..0000000 --- a/tools/zsnes/src/video/hq4x32.asm +++ /dev/null @@ -1,4199 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - -;---------------------------------------------------------- -;hq4x filter -;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -;---------------------------------------------------------- - - - -%include "macros.mac" - -EXTSYM vidbuffer,curblank,MMXSupport,GUIOn,GUIOn2,vidbufferofsb,FilteredGUI -EXTSYM resolutn,lineleft,cfield,hirestiledat,newengen,SpecialLine,hqFilter -EXTSYM AddEndBytes,NumBytesPerLine,WinVidMemStart,BitConv32Ptr,RGBtoYUVPtr -EXTSYM prevline,nextline,deltaptr,xcounter,w1,w2,w3,w4,w5,w6,w7,w8,w9 -EXTSYM c1,c2,c3,c4,c6,c7,c8,c9,reg_blank,const3,const5,const6,const7,cross,threshold - -SECTION .text - -%macro AUXADDRESS 0 - mov ecx, edi - add ecx, ebx - add ecx, ebx -%endmacro - -%macro TestDiff 2 - mov edx,[%1] - sub edx,[%2] - jz %%fin - mov edx,[%1] - shl edx,2 - add edx,[RGBtoYUVPtr] - movd mm1,[edx] - movq mm5,mm1 - mov edx,[%2] - shl edx,2 - add edx,[RGBtoYUVPtr] - movd mm2,[edx] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test edx,edx - jz near %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro DiffOrNot 14 - TestDiff %1,%2 - test edx,edx - jz near %%same - %3 - %4 - %5 - %6 - %7 - %8 - jmp %%fin -%%same: - %9 - %10 - %11 - %12 - %13 - %14 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - shl edx,2 - add edx,%3 - sub edx,%2 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp2 4 - mov edx,%2 - shl edx,1 - add edx,%3 - add edx,%4 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp3 2 - movd mm1, eax - movd mm2, %2 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const7] - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp5 3 - mov edx,%2 - add edx,%3 - shr edx,1 - mov %1,edx -%endmacro - -%macro Interp6 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const5] - psllw mm2, 1 - paddw mm1, mm3 - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp7 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const6] - paddw mm2, mm3 - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp8 3 - movd mm1, %2 - movd mm2, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const5] - pmullw mm2, [const3] - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro PIXEL00_0 0 - mov [edi],eax -%endmacro - -%macro PIXEL00_11 0 - Interp1 [edi],eax,[c4] -%endmacro - -%macro PIXEL00_12 0 - Interp1 [edi],eax,[c2] -%endmacro - -%macro PIXEL00_20 0 - Interp2 [edi],eax,[c2],[c4] -%endmacro - -%macro PIXEL00_50 0 - Interp5 [edi],[c2],[c4] -%endmacro - -%macro PIXEL00_80 0 - Interp8 [edi],eax,[c1] -%endmacro - -%macro PIXEL00_81 0 - Interp8 [edi],eax,[c4] -%endmacro - -%macro PIXEL00_82 0 - Interp8 [edi],eax,[c2] -%endmacro - -%macro PIXEL01_0 0 - mov [edi+4],eax -%endmacro - -%macro PIXEL01_10 0 - Interp1 [edi+4],eax,[c1] -%endmacro - -%macro PIXEL01_12 0 - Interp1 [edi+4],eax,[c2] -%endmacro - -%macro PIXEL01_14 0 - Interp1 [edi+4],[c2],eax -%endmacro - -%macro PIXEL01_21 0 - Interp2 [edi+4],[c2],eax,[c4] -%endmacro - -%macro PIXEL01_31 0 - Interp3 [edi+4],[c4] -%endmacro - -%macro PIXEL01_50 0 - Interp5 [edi+4],[c2],eax -%endmacro - -%macro PIXEL01_60 0 - Interp6 [edi+4],[c2],[c4] -%endmacro - -%macro PIXEL01_61 0 - Interp6 [edi+4],[c2],[c1] -%endmacro - -%macro PIXEL01_82 0 - Interp8 [edi+4],eax,[c2] -%endmacro - -%macro PIXEL01_83 0 - Interp8 [edi+4],[c2],[c4] -%endmacro - -%macro PIXEL02_0 0 - mov [edi+8],eax -%endmacro - -%macro PIXEL02_10 0 - Interp1 [edi+8],eax,[c3] -%endmacro - -%macro PIXEL02_11 0 - Interp1 [edi+8],eax,[c2] -%endmacro - -%macro PIXEL02_13 0 - Interp1 [edi+8],[c2],eax -%endmacro - -%macro PIXEL02_21 0 - Interp2 [edi+8],[c2],eax,[c6] -%endmacro - -%macro PIXEL02_32 0 - Interp3 [edi+8],[c6] -%endmacro - -%macro PIXEL02_50 0 - Interp5 [edi+8],[c2],eax -%endmacro - -%macro PIXEL02_60 0 - Interp6 [edi+8],[c2],[c6] -%endmacro - -%macro PIXEL02_61 0 - Interp6 [edi+8],[c2],[c3] -%endmacro - -%macro PIXEL02_81 0 - Interp8 [edi+8],eax,[c2] -%endmacro - -%macro PIXEL02_83 0 - Interp8 [edi+8],[c2],[c6] -%endmacro - -%macro PIXEL03_0 0 - mov [edi+12],eax -%endmacro - -%macro PIXEL03_11 0 - Interp1 [edi+12],eax,[c2] -%endmacro - -%macro PIXEL03_12 0 - Interp1 [edi+12],eax,[c6] -%endmacro - -%macro PIXEL03_20 0 - Interp2 [edi+12],eax,[c2],[c6] -%endmacro - -%macro PIXEL03_50 0 - Interp5 [edi+12],[c2],[c6] -%endmacro - -%macro PIXEL03_80 0 - Interp8 [edi+12],eax,[c3] -%endmacro - -%macro PIXEL03_81 0 - Interp8 [edi+12],eax,[c2] -%endmacro - -%macro PIXEL03_82 0 - Interp8 [edi+12],eax,[c6] -%endmacro - -%macro PIXEL10_0 0 - mov [edi+ebx],eax -%endmacro - -%macro PIXEL10_10 0 - Interp1 [edi+ebx],eax,[c1] -%endmacro - -%macro PIXEL10_11 0 - Interp1 [edi+ebx],eax,[c4] -%endmacro - -%macro PIXEL10_13 0 - Interp1 [edi+ebx],[c4],eax -%endmacro - -%macro PIXEL10_21 0 - Interp2 [edi+ebx],[c4],eax,[c2] -%endmacro - -%macro PIXEL10_32 0 - Interp3 [edi+ebx],[c2] -%endmacro - -%macro PIXEL10_50 0 - Interp5 [edi+ebx],[c4],eax -%endmacro - -%macro PIXEL10_60 0 - Interp6 [edi+ebx],[c4],[c2] -%endmacro - -%macro PIXEL10_61 0 - Interp6 [edi+ebx],[c4],[c1] -%endmacro - -%macro PIXEL10_81 0 - Interp8 [edi+ebx],eax,[c4] -%endmacro - -%macro PIXEL10_83 0 - Interp8 [edi+ebx],[c4],[c2] -%endmacro - -%macro PIXEL11_0 0 - mov [edi+ebx+4],eax -%endmacro - -%macro PIXEL11_30 0 - Interp3 [edi+ebx+4],[c1] -%endmacro - -%macro PIXEL11_31 0 - Interp3 [edi+ebx+4],[c4] -%endmacro - -%macro PIXEL11_32 0 - Interp3 [edi+ebx+4],[c2] -%endmacro - -%macro PIXEL11_70 0 - Interp7 [edi+ebx+4],[c4],[c2] -%endmacro - -%macro PIXEL12_0 0 - mov [edi+ebx+8],eax -%endmacro - -%macro PIXEL12_30 0 - Interp3 [edi+ebx+8],[c3] -%endmacro - -%macro PIXEL12_31 0 - Interp3 [edi+ebx+8],[c2] -%endmacro - -%macro PIXEL12_32 0 - Interp3 [edi+ebx+8],[c6] -%endmacro - -%macro PIXEL12_70 0 - Interp7 [edi+ebx+8],[c6],[c2] -%endmacro - -%macro PIXEL13_0 0 - mov [edi+ebx+12],eax -%endmacro - -%macro PIXEL13_10 0 - Interp1 [edi+ebx+12],eax,[c3] -%endmacro - -%macro PIXEL13_12 0 - Interp1 [edi+ebx+12],eax,[c6] -%endmacro - -%macro PIXEL13_14 0 - Interp1 [edi+ebx+12],[c6],eax -%endmacro - -%macro PIXEL13_21 0 - Interp2 [edi+ebx+12],[c6],eax,[c2] -%endmacro - -%macro PIXEL13_31 0 - Interp3 [edi+ebx+12],[c2] -%endmacro - -%macro PIXEL13_50 0 - Interp5 [edi+ebx+12],[c6],eax -%endmacro - -%macro PIXEL13_60 0 - Interp6 [edi+ebx+12],[c6],[c2] -%endmacro - -%macro PIXEL13_61 0 - Interp6 [edi+ebx+12],[c6],[c3] -%endmacro - -%macro PIXEL13_82 0 - Interp8 [edi+ebx+12],eax,[c6] -%endmacro - -%macro PIXEL13_83 0 - Interp8 [edi+ebx+12],[c6],[c2] -%endmacro - -%macro PIXEL20_0 0 - mov [ecx],eax -%endmacro - -%macro PIXEL20_10 0 - Interp1 [ecx],eax,[c7] -%endmacro - -%macro PIXEL20_12 0 - Interp1 [ecx],eax,[c4] -%endmacro - -%macro PIXEL20_14 0 - Interp1 [ecx],[c4],eax -%endmacro - -%macro PIXEL20_21 0 - Interp2 [ecx],[c4],eax,[c8] -%endmacro - -%macro PIXEL20_31 0 - Interp3 [ecx],[c8] -%endmacro - -%macro PIXEL20_50 0 - Interp5 [ecx],[c4],eax -%endmacro - -%macro PIXEL20_60 0 - Interp6 [ecx],[c4],[c8] -%endmacro - -%macro PIXEL20_61 0 - Interp6 [ecx],[c4],[c7] -%endmacro - -%macro PIXEL20_82 0 - Interp8 [ecx],eax,[c4] -%endmacro - -%macro PIXEL20_83 0 - Interp8 [ecx],[c4],[c8] -%endmacro - -%macro PIXEL21_0 0 - mov [ecx+4],eax -%endmacro - -%macro PIXEL21_30 0 - Interp3 [ecx+4],[c7] -%endmacro - -%macro PIXEL21_31 0 - Interp3 [ecx+4],[c8] -%endmacro - -%macro PIXEL21_32 0 - Interp3 [ecx+4],[c4] -%endmacro - -%macro PIXEL21_70 0 - Interp7 [ecx+4],[c4],[c8] -%endmacro - -%macro PIXEL22_0 0 - mov [ecx+8],eax -%endmacro - -%macro PIXEL22_30 0 - Interp3 [ecx+8],[c9] -%endmacro - -%macro PIXEL22_31 0 - Interp3 [ecx+8],[c6] -%endmacro - -%macro PIXEL22_32 0 - Interp3 [ecx+8],[c8] -%endmacro - -%macro PIXEL22_70 0 - Interp7 [ecx+8],[c6],[c8] -%endmacro - -%macro PIXEL23_0 0 - mov [ecx+12],eax -%endmacro - -%macro PIXEL23_10 0 - Interp1 [ecx+12],eax,[c9] -%endmacro - -%macro PIXEL23_11 0 - Interp1 [ecx+12],eax,[c6] -%endmacro - -%macro PIXEL23_13 0 - Interp1 [ecx+12],[c6],eax -%endmacro - -%macro PIXEL23_21 0 - Interp2 [ecx+12],[c6],eax,[c8] -%endmacro - -%macro PIXEL23_32 0 - Interp3 [ecx+12],[c8] -%endmacro - -%macro PIXEL23_50 0 - Interp5 [ecx+12],[c6],eax -%endmacro - -%macro PIXEL23_60 0 - Interp6 [ecx+12],[c6],[c8] -%endmacro - -%macro PIXEL23_61 0 - Interp6 [ecx+12],[c6],[c9] -%endmacro - -%macro PIXEL23_81 0 - Interp8 [ecx+12],eax,[c6] -%endmacro - -%macro PIXEL23_83 0 - Interp8 [ecx+12],[c6],[c8] -%endmacro - -%macro PIXEL30_0 0 - mov [ecx+ebx],eax -%endmacro - -%macro PIXEL30_11 0 - Interp1 [ecx+ebx],eax,[c8] -%endmacro - -%macro PIXEL30_12 0 - Interp1 [ecx+ebx],eax,[c4] -%endmacro - -%macro PIXEL30_20 0 - Interp2 [ecx+ebx],eax,[c8],[c4] -%endmacro - -%macro PIXEL30_50 0 - Interp5 [ecx+ebx],[c8],[c4] -%endmacro - -%macro PIXEL30_80 0 - Interp8 [ecx+ebx],eax,[c7] -%endmacro - -%macro PIXEL30_81 0 - Interp8 [ecx+ebx],eax,[c8] -%endmacro - -%macro PIXEL30_82 0 - Interp8 [ecx+ebx],eax,[c4] -%endmacro - -%macro PIXEL31_0 0 - mov [ecx+ebx+4],eax -%endmacro - -%macro PIXEL31_10 0 - Interp1 [ecx+ebx+4],eax,[c7] -%endmacro - -%macro PIXEL31_11 0 - Interp1 [ecx+ebx+4],eax,[c8] -%endmacro - -%macro PIXEL31_13 0 - Interp1 [ecx+ebx+4],[c8],eax -%endmacro - -%macro PIXEL31_21 0 - Interp2 [ecx+ebx+4],[c8],eax,[c4] -%endmacro - -%macro PIXEL31_32 0 - Interp3 [ecx+ebx+4],[c4] -%endmacro - -%macro PIXEL31_50 0 - Interp5 [ecx+ebx+4],[c8],eax -%endmacro - -%macro PIXEL31_60 0 - Interp6 [ecx+ebx+4],[c8],[c4] -%endmacro - -%macro PIXEL31_61 0 - Interp6 [ecx+ebx+4],[c8],[c7] -%endmacro - -%macro PIXEL31_81 0 - Interp8 [ecx+ebx+4],eax,[c8] -%endmacro - -%macro PIXEL31_83 0 - Interp8 [ecx+ebx+4],[c8],[c4] -%endmacro - -%macro PIXEL32_0 0 - mov [ecx+ebx+8],eax -%endmacro - -%macro PIXEL32_10 0 - Interp1 [ecx+ebx+8],eax,[c9] -%endmacro - -%macro PIXEL32_12 0 - Interp1 [ecx+ebx+8],eax,[c8] -%endmacro - -%macro PIXEL32_14 0 - Interp1 [ecx+ebx+8],[c8],eax -%endmacro - -%macro PIXEL32_21 0 - Interp2 [ecx+ebx+8],[c8],eax,[c6] -%endmacro - -%macro PIXEL32_31 0 - Interp3 [ecx+ebx+8],[c6] -%endmacro - -%macro PIXEL32_50 0 - Interp5 [ecx+ebx+8],[c8],eax -%endmacro - -%macro PIXEL32_60 0 - Interp6 [ecx+ebx+8],[c8],[c6] -%endmacro - -%macro PIXEL32_61 0 - Interp6 [ecx+ebx+8],[c8],[c9] -%endmacro - -%macro PIXEL32_82 0 - Interp8 [ecx+ebx+8],eax,[c8] -%endmacro - -%macro PIXEL32_83 0 - Interp8 [ecx+ebx+8],[c8],[c6] -%endmacro - -%macro PIXEL33_0 0 - mov [ecx+ebx+12],eax -%endmacro - -%macro PIXEL33_11 0 - Interp1 [ecx+ebx+12],eax,[c6] -%endmacro - -%macro PIXEL33_12 0 - Interp1 [ecx+ebx+12],eax,[c8] -%endmacro - -%macro PIXEL33_20 0 - Interp2 [ecx+ebx+12],eax,[c8],[c6] -%endmacro - -%macro PIXEL33_50 0 - Interp5 [ecx+ebx+12],[c8],[c6] -%endmacro - -%macro PIXEL33_80 0 - Interp8 [ecx+ebx+12],eax,[c9] -%endmacro - -%macro PIXEL33_81 0 - Interp8 [ecx+ebx+12],eax,[c6] -%endmacro - -%macro PIXEL33_82 0 - Interp8 [ecx+ebx+12],eax,[c8] -%endmacro - -NEWSYM hq4x_32b - cmp byte[curblank],40h - jne .startcopy - ret -.startcopy - pushad - mov ax,ds - mov es,ax - mov esi,[vidbuffer] - mov edi,[WinVidMemStart] - add esi,16*2+256*2+32*2 - mov ecx,[vidbufferofsb] - mov [deltaptr],ecx - cmp byte[FilteredGUI],0 - jne .filtergui - cmp byte[GUIOn2],1 - je nointerp -.filtergui - cmp byte[MMXSupport],0 - je nointerp - cmp byte[hqFilter],0 - jne near hq4x - -;----------------------------; -nointerp: - mov dl,[resolutn] - mov [lineleft],dl - mov ebx,[NumBytesPerLine] -.loopy - mov ecx,256 -.loopx - movzx eax,word[esi] - mov edx,[BitConv32Ptr] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - mov edx,edi - add edx,ebx - add edx,ebx - mov [edx],eax - mov [edx+4],eax - mov [edx+8],eax - mov [edx+12],eax - mov [edx+ebx],eax - mov [edx+ebx+4],eax - mov [edx+ebx+8],eax - mov [edx+ebx+12],eax - add esi,2 - add edi,16 - dec ecx - jnz .loopx - add edi,[AddEndBytes] - add edi,ebx - add edi,ebx - add edi,ebx - add esi,64 - dec byte[lineleft] - jnz near .loopy - popad - ret - -;----------------------------; -hq4x: - mov dl,[resolutn] - mov [lineleft],dl - mov dword[prevline],0 - mov dword[nextline],576 - mov ebx,hirestiledat+1 - cmp byte[GUIOn],1 - je .loopy - cmp byte[newengen],0 - je .loopy - mov ebx,SpecialLine+1 -.loopy - mov [InterPtr],ebx - cmp byte[ebx],1 - jbe .nohires - call HighResProc - mov edx,[deltaptr] - mov ecx,128 - mov eax,0xAAAAAAAA -.a - mov [edx],eax - add edx,4 - dec ecx - jnz .a - mov [deltaptr],edx - jmp .nexty -.nohires - mov dword[xcounter],254 ; x={Xres-2, Xres-1} are special cases. - ; x=0 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx] - movq mm3,[esi] - movq mm4,[esi+eax] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx] - pcmpeqw mm3,[edx] - pcmpeqw mm4,[edx+eax] - pand mm2,mm3 - pand mm2,mm4 - movd eax,mm2 - inc eax - jz near .loopx_end - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-2] - movq mm3,[esi-2] - movq mm4,[esi+eax-2] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-2] - pcmpeqw mm3,[edx-2] - pcmpeqw mm4,[edx+eax-2] - pand mm2,mm3 - pand mm2,mm4 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz near .loopx_end - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,[RGBtoYUVPtr] - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - cmp dword[cross],0 - jnz .testflag1 - mov ebx,[BitConv32Ptr] - mov eax,[ebx+eax*4] - mov ebx,[NumBytesPerLine] - AUXADDRESS - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - mov [ecx],eax - mov [ecx+4],eax - mov [ecx+8],eax - mov [ecx+12],eax - mov [ecx+ebx],eax - mov [ecx+ebx+4],eax - mov [ecx+ebx+8],eax - mov [ecx+ebx+12],eax - jmp .loopx_end -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,[BitConv32Ptr] - mov eax,[ebx+eax*4] - mov edx,[w2] - mov edx,[ebx+edx*4] - mov [c2],edx - mov edx,[w4] - mov edx,[ebx+edx*4] - mov [c4],edx - mov edx,[w6] - mov edx,[ebx+edx*4] - mov [c6],edx - mov edx,[w8] - mov edx,[ebx+edx*4] - mov [c8],edx - test ecx,0x005A - jz .switch - mov edx,[w1] - mov edx,[ebx+edx*4] - mov [c1],edx - mov edx,[w3] - mov edx,[ebx+edx*4] - mov [c3],edx - mov edx,[w7] - mov edx,[ebx+edx*4] - mov [c7],edx - mov edx,[w9] - mov edx,[ebx+edx*4] - mov [c9],edx -.switch - mov ebx,[NumBytesPerLine] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag18 -..@flag50 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_50,PIXEL03_50,PIXEL12_0,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag80 -..@flag81 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag72 -..@flag76 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_50,PIXEL21_0,PIXEL30_50,PIXEL31_50 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag10 -..@flag138 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_50,PIXEL10_50,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag66 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag24 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag22 -..@flag54 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag208 -..@flag209 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag104 -..@flag108 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag11 -..@flag139 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag19 -..@flag51 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag146 -..@flag178 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - jmp .loopx_end -..@flag84 -..@flag85 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag112 -..@flag113 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL30_82,PIXEL31_32,PIXEL32_10,PIXEL33_80,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag200 -..@flag204 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag73 -..@flag77 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag42 -..@flag170 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag14 -..@flag142 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL02_32,PIXEL03_82,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag67 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag70 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag28 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag152 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag194 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag98 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag56 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag25 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag26 -..@flag31 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag82 -..@flag214 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag88 -..@flag248 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag74 -..@flag107 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag27 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag86 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag216 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag106 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag30 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag210 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag120 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag75 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag29 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag198 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag184 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag99 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag57 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag71 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag156 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag226 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag60 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag195 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag102 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag153 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag58 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag83 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag92 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag202 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag78 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag154 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag114 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag89 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag90 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag55 -..@flag23 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag182 -..@flag150 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - jmp .loopx_end -..@flag213 -..@flag212 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag241 -..@flag240 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag236 -..@flag232 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag109 -..@flag105 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag171 -..@flag43 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag143 -..@flag15 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag124 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag203 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag62 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag211 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag118 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag217 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag110 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag155 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag188 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag185 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag61 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag157 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag103 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag227 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag230 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag199 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag220 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag158 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag234 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag242 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag59 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL11_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag121 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag87 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag79 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_32 - PIXEL03_82 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag122 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag94 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag218 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag91 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL11_0 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag229 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag167 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag173 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag181 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag186 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag115 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag93 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag206 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag205 -..@flag201 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag174 -..@flag46 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag179 -..@flag147 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag117 -..@flag116 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag189 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag231 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag126 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag219 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag125 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag221 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag207 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag238 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag190 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_10 - PIXEL11_30 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - jmp .loopx_end -..@flag187 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag243 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag119 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag237 -..@flag233 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag175 -..@flag47 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag183 -..@flag151 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag245 -..@flag244 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag250 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag123 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag95 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag222 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag252 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag249 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - jmp .loopx_end -..@flag235 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag111 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag63 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag159 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag215 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag246 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag254 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag253 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag251 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - jmp .loopx_end -..@flag239 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag127 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag191 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag223 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag247 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag255 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end - -.loopx_end - add esi,2 - add dword[deltaptr],2 - add edi,16 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl near .xres_1 - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-4] - movq mm3,[esi-4] - movq mm4,[esi+eax-4] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-4] - pcmpeqw mm3,[edx-4] - pcmpeqw mm4,[edx+eax-4] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,16 - movd ebx,mm2 - psrlq mm2,32 - movd eax,mm2 - cwde - and eax,ebx - inc eax - jz .loopx_end - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - mov [edx+ecx-2],ax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl near .endofline - ; x=Xres-1 - special case - mov edx,[deltaptr] - mov ecx,[prevline] - mov eax,[nextline] - movq mm2,[esi+ecx-6] - movq mm3,[esi-6] - movq mm4,[esi+eax-6] - movq mm5,mm2 - movq mm6,mm3 - movq mm7,mm4 - pcmpeqw mm2,[edx+ecx-6] - pcmpeqw mm3,[edx-6] - pcmpeqw mm4,[edx+eax-6] - pand mm2,mm3 - pand mm2,mm4 - psrlq mm2,32 - movd eax,mm2 - inc eax - jz .loopx_end - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - mov [edx+ecx-2],eax - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.endofline - mov ebx,[NumBytesPerLine] -.nexty - add esi,64 - add dword[deltaptr],64 - add edi,[AddEndBytes] - add edi,ebx - add edi,ebx - add edi,ebx - mov ebx,[InterPtr] - inc ebx - dec byte[lineleft] - jz .fin - cmp byte[lineleft],1 - je .lastline - mov dword[nextline],576 - mov dword[prevline],-576 - jmp .loopy -.lastline - mov dword[nextline],0 - mov dword[prevline],-576 - jmp .loopy -.fin - emms - popad - ret - -HighResProc: - mov ecx,256 - mov edx,[BitConv32Ptr] - cmp byte[ebx],3 - je near .hiresmode7 - cmp byte[ebx],7 - je near .hiresmode7 - test byte[ebx],3 - jnz near .hires - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1 -.cfield0 - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - add esi,2 - add edi,16 - dec ecx - jnz .cfield0 - ret -.cfield1 - add edi,ebx - add edi,ebx -.cfield1a - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - add esi,2 - add edi,16 - dec ecx - jnz .cfield1a - sub edi,ebx - sub edi,ebx - ret -.hiresmode7 - mov ebx,[NumBytesPerLine] -.a - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - add esi,2 - add edi,16 - dec ecx - jnz .a - mov ecx,256 - sub esi,512 - sub edi,4096 - add edi,ebx - add edi,ebx -.a2 - movzx eax, word[esi+75036*4] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - add esi,2 - add edi,16 - dec ecx - jnz .a2 - sub edi,ebx - sub edi,ebx - ret -.hires - test byte[ebx],4 - jnz .m56 - mov ebx,[NumBytesPerLine] -.bng - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - add edi,ebx - mov [edi],eax - mov [edi+4],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],eax - movzx eax, word[esi+75036*4] - mov eax,[edx+eax*4] - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - mov [edi+ebx*2+8],eax - mov [edi+ebx*2+12],eax - sub edi,ebx - mov [edi+8],eax - mov [edi+12],eax - add esi,2 - add edi,16 - dec ecx - jnz .bng - ret -.m56 - mov ebx,[NumBytesPerLine] - test byte[cfield],1 - jnz .cfield1hr -.cfield0hr - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - movzx eax, word[esi+75036*4] - mov eax,[edx+eax*4] - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - add esi,2 - add edi,16 - dec ecx - jnz .cfield0hr - ret -.cfield1hr - add edi,ebx - add edi,ebx -.cfield1hra - movzx eax, word[esi] - mov eax,[edx+eax*4] - mov [edi],eax - mov [edi+4],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - movzx eax, word[esi+75036*4] - mov eax,[edx+eax*4] - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - add esi,2 - add edi,16 - dec ecx - jnz .cfield1hra - sub edi,ebx - sub edi,ebx - ret - -SECTION .data -FuncTable: - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - -SECTION .bss -InterPtr resd 1 -SECTION .text diff --git a/tools/zsnes/src/video/m716text.asm b/tools/zsnes/src/video/m716text.asm deleted file mode 100644 index 3cd224b..0000000 --- a/tools/zsnes/src/video/m716text.asm +++ /dev/null @@ -1,1000 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%include "macros.mac" - -EXTSYM coladdr,curmosaicsz,curvidoffset,domosaic16b,mode7A,mode7B,mode7C,mode7D -EXTSYM mode7X0,mode7Y0,mode7set,mode7tab,pal16b,pal16bcl,pal16bxcl,scaddtype -EXTSYM scrnon,transpbuf,vesa2_clbit,vram,vrama,winon,xtravbuf,winptrref -EXTSYM fulladdtab,cwinptr - -;******************************************************* -; Processes & Draws Mode 7 -;******************************************************* - -%macro mode7halfadd 0 - mov [esi+288*2],dl - test dl,80h - jnz %%nodraw - or dl,dl - jz %%nodraw - mov ecx,[ebp] - mov ebx,[pal16bcl+edx*4] - cmp cx,0 - je %%noadd - and ebx,[vesa2_clbit] - and ecx,[vesa2_clbit] - add ebx,ecx - shr ebx,1 -%%noadd - mov [esi],bx - xor ecx,ecx -%%nodraw -%endmacro - -%macro mode7fulladd 0 - mov [esi+288*2],dl - test dl,80h - jnz %%nodraw - or dl,dl - jz %%nodraw - mov ecx,[ebp] - mov ebx,[pal16bcl+edx*4] - and ecx,[vesa2_clbit] - add ebx,ecx - shr ebx,1 - mov ebx,[fulladdtab+ebx*2] - mov [esi],bx -%%nodraw -%endmacro - -%macro mode7fullsub 0 - mov [esi+288*2],dl - test dl,80h - jnz %%nodraw - or dl,dl - jz %%nodraw - mov ecx,[ebp] - mov ebx,[pal16bxcl+edx*4] - and ecx,[vesa2_clbit] - add ebx,ecx - shr ebx,1 - mov ebx,[fulladdtab+ebx*2] - xor ebx,0FFFFh - mov [esi],bx -%%nodraw -%endmacro - -%macro mode7mainsub 0 - mov [esi+288*2],dl - test dl,80h - jnz %%nodraw - or dl,dl - jz %%nodraw - mov ecx,[pal16b+edx*4] - mov [esi],cx - mov [ebp],cx -%%nodraw -%endmacro - -%macro mode7halfaddwinon 0 - mov [esi+288*2],dl - mov eax,[cwinptr] - test dl,80h - jnz %%nodraw - or dl,dl - jz %%nodraw - test byte[eax],0FFh - jnz %%nodraw - mov ecx,[ebp] - mov ebx,[pal16bcl+edx*4] - cmp cx,0 - je %%noadd - and ebx,[vesa2_clbit] - and ecx,[vesa2_clbit] - add ebx,ecx - shr ebx,1 -%%noadd - mov [esi],bx - xor ecx,ecx -%%nodraw - inc dword[cwinptr] -%endmacro - -%macro mode7fulladdwinon 0 - mov [esi+288*2],dl - mov eax,[cwinptr] - test dl,80h - jnz %%nodraw - or dl,dl - jz %%nodraw - test byte[eax],0FFh - jnz %%nodraw - mov ecx,[ebp] - mov ebx,[pal16bcl+edx*4] - and ecx,[vesa2_clbit] - add ebx,ecx - shr ebx,1 - mov ebx,[fulladdtab+ebx*2] - mov [esi],bx -%%nodraw - inc dword[cwinptr] -%endmacro - -%macro mode7fullsubwinon 0 - mov [esi+288*2],dl - mov eax,[cwinptr] - test dl,80h - jnz %%nodraw - or dl,dl - jz %%nodraw - test byte[eax],0FFh - jnz %%nodraw - mov ecx,[ebp] - mov ebx,[pal16bxcl+edx*4] - and ecx,[vesa2_clbit] - add ebx,ecx - shr ebx,1 - mov ebx,[fulladdtab+ebx*2] - xor ebx,0FFFFh - mov [esi],bx -%%nodraw - inc dword[cwinptr] -%endmacro - -%macro mode7mainsubwinon 0 - mov [esi+288*2],dl - mov eax,[cwinptr] - test dl,80h - jnz %%nodraw - or dl,dl - jz %%nodraw - test byte[eax],0FFh - jnz %%nodraw - mov ecx,[pal16b+edx*4] - mov [esi],cx - mov [ebp],cx -%%nodraw - inc dword[cwinptr] -%endmacro - -%macro mode716tmacro 1 - ; mode 7, ax = curyposition, dx = curxposition (left side) - ; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen - ; center map coordinates = (X0,Y0) - ; 1.) cx=X0-bg1scrolx, cy =Y0-ax - - mov bx,[mode7X0] - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonega - or bx,1110000000000000b -.nonega - mov [.cxloc],bx - mov bx,dx - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegb - or bx,1110000000000000b -.nonegb - sub [.cxloc],bx - mov bx,ax - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegc - or bx,1110000000000000b -.nonegc - mov [.cyloc],bx - mov bx,[mode7Y0] - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegd - or bx,1110000000000000b -.nonegd - sub word[.cyloc],bx - - ; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D) - - movsx ebx,word[.cyloc] - movsx eax,word[mode7C] - imul eax,ebx - neg eax - mov [.mode7xpos],eax - mov bx,[mode7X0] - add [.mode7xpos+1],bx - - movsx ebx,word[.cyloc] - movsx eax,word[mode7D] - imul eax,ebx -; neg ax - mov [.mode7ypos],eax - mov bx,[mode7Y0] - add [.mode7ypos+1],bx - - ; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B) - - movsx ebx,word[.cxloc] - movsx eax,word[mode7A] - mov [.mode7xadder],eax - imul eax,ebx - neg eax - add [.mode7xpos],eax - - movsx ebx,word[.cxloc] - movsx eax,word[mode7B] - mov [.mode7yadder],eax - imul eax,ebx - add [.mode7ypos],eax - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov edi,[vram] - - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 -.nomosaic - mov ebp,transpbuf+32 - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - mov byte[.temp],0 - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - mov edi,[vram] - - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - - test byte[mode7set],80h - jnz near .norep2 - - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - -.nextval - test byte[.mode7xrpos+1],08h - jnz near .rposoffx -.nextposx - test byte[.mode7yrpos+1],08h - jnz near .rposoffy -.nextposy - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[edi+edx] - sub [.mode7yrpos],eax - %1 - add esi,2 - add ebp,2 - dec byte[.temp] - jnz near .nextval - jmp .finishmode7 -.rposoffx - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp .nextposx -.rposoffy - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - and byte[.mode7ptr+1],7Fh - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp .nextposy -.finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -.norep2 - test byte[mode7set],40h - jnz .tilerep2 -.nextvalb2 - cmp byte[.mode7ypos+2],3 - ja .offscr2 - cmp byte[.mode7xpos+2],3 - jbe near .offscr3 -.offscr2 - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,2 - add ebp,2 - dec byte[.temp] - jnz near .nextvalb2 - jmp .finishmode7 -.tilerep2 -.nextvalb3 - cmp byte[.mode7ypos+2],3 - ja .offscr2b - cmp byte[.mode7xpos+2],3 - jbe near .offscr3 -.offscr2b - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - %1 - add esi,2 - add ebp,2 - dec byte[.temp] - jnz near .nextvalb3 - jmp .finishmode7 -.offscr3 - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - -.nextvalr - test byte[.mode7xrpos+1],08h - jnz near .rposoffxr -.nextposxr - test byte[.mode7yrpos+1],08h - jnz near .rposoffyr -.nextposyr - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[edi+edx] - sub [.mode7yrpos],eax - %1 - add esi,2 - add ebp,2 - dec byte[.temp] - jnz near .nextvalr - jmp .finishmode7 -.rposoffxr - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - jz .roff - cmp byte[.mode7ptr],0FEh - je .roff -.roffxretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp .nextposxr -.rposoffyr - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js .roff -.roffyretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp .nextposyr -.roff - test byte[mode7set],40h - jnz .tilerep3 - jmp .finishmode7 -.tilerep3 - and byte[.mode7yrpos+1],07h - and byte[.mode7xrpos+1],07h - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[vrama+edx] - sub [.mode7yrpos],eax - %1 - add esi,2 - add ebp,2 - dec byte[.temp] - jnz near .tilerep3 - jmp .finishmode7 - -;********************************************************** -; Mode 7, old routines -;********************************************************** - -.nextval3 - test byte[mode7set],80h - jnz near .norep -.nextval2 - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov dl,[edi+ecx] - sub [.mode7ypos],eax - %1 - add esi,2 - add ebp,2 - dec byte[.temp] - jnz near .nextval2 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - ; Color repetition -.norep - test byte[mode7set],40h - jnz near .tilerep -.nextvalb - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscr - cmp byte[.mode7xpos+2],3 - ja near .offscr -.offscrb - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov dl,[edi+ecx] - sub [.mode7ypos],eax - %1 - add esi,2 - add ebp,2 - dec byte[.temp] - jnz near .nextvalb - jmp .goon -.offscrc - cmp byte[.mode7ypos+2],3 - ja .offscr - cmp byte[.mode7xpos+2],3 - jbe near .offscrb -.offscr - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,2 - add ebp,2 - dec byte[.temp] - jnz .offscrc -.goon - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -.tilerep -.nextvalbtr - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscrtr - cmp byte[.mode7xpos+2],3 - ja near .offscrtr -.offscrtrb - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov dl,[edi+ecx] - sub [.mode7ypos],eax - %1 - add esi,2 - add ebp,2 - dec byte[.temp] - jnz near .nextvalbtr - jmp .goon -.offscrtrc - cmp byte[.mode7ypos+2],3 - ja .offscrtr - cmp byte[.mode7xpos+2],3 - jbe near .offscrtrb -.offscrtr - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - %1 - add esi,2 - add ebp,2 - dec byte[.temp] - jnz near .offscrtrc - jmp .goon - -SECTION .data -ALIGN32 -.temp dd 0 ; for byte move left -.mode7xpos dd 0 ; x position -.tempa2 dd 0 ; keep this blank! -.mode7xrpos dd 0 ; x position -.tempa dd 0 ; keep this blank! -.mode7ypos dd 0 ; y position -.tempb2 dd 0 ; keep this blank! -.mode7yrpos dd 0 ; y position -.tempb dd 0 ; keep this blank! -.mode7xadder dd 0 ; number to add for x -.tempc2 dd 0 ; keep this blank! -.mode7xadd2 dd 0 ; number to add for x -.tempc dd 0 ; keep this blank! -.mode7yadder dd 0 ; number to add for y -.tempd2 dd 0 ; keep this blank! -.mode7yadd2 dd 0 ; number to add for y -.tempd dd 0 ; keep this blank! -.mode7ptr dd 0 ; pointer value -.mode7xinc dd 0 ; number to add for x -.mode7yinc dd 0 ; number to add for y -.mode7xsloc dd 0 ; which screen x -.mode7ysloc dd 0 ; which screen y -.mode7xsrl dd 0 ; which relative screen x -.mode7ysrl dd 0 ; which relative screen y -.cxloc dd 0 ; cx location -.cyloc dd 0 ; cy location - -SECTION .text -%endmacro - -SECTION .text -;******************************************************* -; Processes & Draws Mode 7 half Addition -;******************************************************* -NEWSYM drawmode716textbg -; test byte[scaddset],1 -; jnz near drawmode7dcolor - mov esi,[cwinptr] - mov [winptrref],esi - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near drawmode716twinonextbg -.domosaic - test byte[scaddtype],80h - jnz near drawmode716tsubextbg - test byte[scaddtype],40h - jz near drawmode716tfulladdextbg - cmp byte[scrnon+1],0 - je near drawmode716tfulladdextbg - cmp dword[coladdr],0 - jnz near drawmode716tfulladdextbg - mode716tmacro mode7halfadd - - -;******************************************************* -; Processes & Draws Mode 7 Full Addition -;******************************************************* -NEWSYM drawmode716tfulladdextbg - mode716tmacro mode7fulladd - -;********************************************************** -; Processes and draws Mode 7 subtract -;********************************************************** - -drawmode716tsubextbg: - mode716tmacro mode7fullsub - -;********************************************************** -; Mode 7, main & sub mode -;********************************************************** - -NEWSYM drawmode716tbextbg - mode716tmacro mode7mainsub - -;******************************************************* -; Processes & Draws Mode 7 half Addition, Window on -;******************************************************* -NEWSYM drawmode716twinonextbg - test byte[scaddtype],80h - jnz near drawmode716tsubwinonextbg - test byte[scaddtype],40h - jz near drawmode716tfulladdwinonextbg - cmp byte[scrnon+1],0 - je near drawmode716tfulladdwinonextbg - cmp dword[coladdr],0 - jnz near drawmode716tfulladdwinonextbg - mode716tmacro mode7halfaddwinon - - -;******************************************************* -; Processes & Draws Mode 7 Full Addition, Window on -;******************************************************* - -NEWSYM drawmode716tfulladdwinonextbg - mode716tmacro mode7fulladdwinon - -;********************************************************** -; Processes and draws Mode 7 subtract, Window on -;********************************************************** - -NEWSYM drawmode716tsubwinonextbg - mode716tmacro mode7fullsubwinon - -;********************************************************** -; Mode 7, main & sub mode, Window on -;********************************************************** - -NEWSYM drawmode716tbwinonextbg - mode716tmacro mode7mainsubwinon - - -NEWSYM drawmode716textbg2 - mov esi,[cwinptr] - mov [winptrref],esi - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov edi,[vram] - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 -.nomosaic - - mov edi,transpbuf+32 - test byte[scaddtype],80h - jnz near extbg2sub - test byte[scaddtype],40h - jz near extbg2add - - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawwin -.domosaic - mov ecx,256 - xor eax,eax -.loop - mov al,[esi+288*2] - test al,80h - jz .nopr2 - and al,7Fh - mov edx,[edi] - mov ebx,[pal16bcl+eax*4] - cmp dx,0 - je .noadd - and ebx,[vesa2_clbit] - and edx,[vesa2_clbit] - add ebx,edx - shr ebx,1 -.noadd - mov [esi],bx -.nopr2 - add esi,2 - add edi,2 - dec ecx - jnz .loop - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret -.drawwin - mov ebp,[cwinptr] - mov [esi],cl -.nodrawbw - mov ecx,256 - xor eax,eax -.loop2 - mov al,[esi+288*2] - test byte[ebp],0FFh - jnz .nopr2b - test al,80h - jz .nopr2b - and al,7Fh - mov edx,[edi] - mov ebx,[pal16bcl+eax*4] - cmp dx,0 - je .noadd2 - and ebx,[vesa2_clbit] - and edx,[vesa2_clbit] - add ebx,edx - shr ebx,1 -.noadd2 - mov [esi],bx -.nopr2b - add esi,2 - add edi,2 - inc ebp - dec ecx - jnz .loop2 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -extbg2add: - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawwin -.domosaic - mov ecx,256 - xor eax,eax -.loop - mov al,[esi+288*2] - test al,80h - jz .nopr2 - and al,7Fh - mov edx,[edi] - mov ebx,[pal16bcl+eax*4] - and edx,[vesa2_clbit] - add ebx,edx - shr ebx,1 - mov ebx,[fulladdtab+ebx*2] - mov [esi],bx -.nopr2 - add esi,2 - add edi,2 - dec ecx - jnz .loop - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret -.drawwin - mov ebp,[cwinptr] - mov [esi],cl -.nodrawbw - mov ecx,256 - xor eax,eax -.loop2 - mov al,[esi+288*2] - test byte[ebp],0FFh - jnz .nopr2b - test al,80h - jz .nopr2b - and al,7Fh - mov edx,[edi] - mov ebx,[pal16bcl+eax*4] - and edx,[vesa2_clbit] - add ebx,edx - shr ebx,1 - mov ebx,[fulladdtab+ebx*2] - mov [esi],bx -.nopr2b - add esi,2 - add edi,2 - inc ebp - dec ecx - jnz .loop2 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -extbg2sub: - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawwin -.domosaic - mov ecx,256 - xor eax,eax -.loop - mov al,[esi+288*2] - test al,80h - jz .nopr2 - and al,7Fh - mov edx,[edi] - mov ebx,[pal16bxcl+eax*4] - and edx,[vesa2_clbit] - add ebx,edx - shr ebx,1 - mov ebx,[fulladdtab+ebx*2] - xor ebx,0FFFFh - mov [esi],bx -.nopr2 - add esi,2 - add edi,2 - dec ecx - jnz .loop - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret -.drawwin - mov ebp,[cwinptr] - mov [esi],cl -.nodrawbw - mov ecx,256 - xor eax,eax -.loop2 - mov al,[esi+288*2] - test byte[ebp],0FFh - jnz .nopr2b - test al,80h - jz .nopr2b - and al,7Fh - mov edx,[edi] - mov ebx,[pal16bxcl+eax*4] - and edx,[vesa2_clbit] - add ebx,edx - shr ebx,1 - mov ebx,[fulladdtab+ebx*2] - xor ebx,0FFFFh - mov [esi],bx -.nopr2b - add esi,2 - add edi,2 - inc ebp - dec ecx - jnz .loop2 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret diff --git a/tools/zsnes/src/video/makev16b.asm b/tools/zsnes/src/video/makev16b.asm deleted file mode 100644 index 25d1b2e..0000000 --- a/tools/zsnes/src/video/makev16b.asm +++ /dev/null @@ -1,3105 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 cursprloc,curypos,scrndis,scrnon,winon,winonsp,drawmode716extbg -EXTSYM drawmode716extbg2,alreadydrawn,bg1cachloc,bg1tdabloc,bg1tdatloc -EXTSYM bg1vbufloc,bg1xposloc,bg1yaddval,bgcoloradder,bgmode,bgtilesz,curbgnum -EXTSYM drawn,makewindow,winbg1en,winenabs,mosaicon,winenabm,vidbuffer,bg3high2 -EXTSYM colormodedef,colormodeofs,curbgpr,curblank,currentobjptr,curvidoffset -EXTSYM cwinenabm,drawline16t,forceblnk,makewindowsp,maxbr,newengen,newengine16b -EXTSYM preparesprpr,procbackgrnd,scaddset,scaddtype,spritetablea,sprleftpr -EXTSYM ForceNewGfxOff,bg1scrolx,bg1scroly,drawmode716b,mode7set,mosaicsz -EXTSYM sprleftpr1,sprleftpr2,sprleftpr3,sprlefttot,sprprifix,interlval,extbgdone -EXTSYM coladdb,coladdg,coladdr,pal16b,vesa2_bpos,V8Mode,doveg,pal16bcl,pal16bxcl -EXTSYM prevbright,prevpal,vesa2_clbit,vesa2_gpos,vesa2_rpos,vidbright,cgmod -EXTSYM cgram,gammalevel16b,dovegrest,winspdata,csprbit,csprprlft,sprclprio -EXTSYM sprsingle,sprpriodata,bgofwptr,bgsubby,bshifter,curmosaicsz,cwinptr -EXTSYM osm2dis,temp,tempcach,temptile,winptrref,xtravbuf,yadder,yrevadder -EXTSYM vcache2b,vcache4b,vcache8b,hirestiledat,res512switch,numwin,windowdata -EXTSYM bg1objptr,bg1ptr,bg3ptr,bg3scrolx,bg3scroly,vidmemch4,vram,ofsmcptr -EXTSYM ofsmady,ofsmadx,yposngom,flipyposngom,ofsmtptr,ofsmmptr,ofsmcyps,bgtxadd -EXTSYM bg1ptrx,bg1ptry,a16x16xinc,a16x16yinc,bg1scrolx_m7,bg1scroly_m7,ngptrdat2 -EXTSYM OMBGTestVal,Testval,cachesingle4bng,m7starty,ofsmtptrs,ofsmcptr2 -EXTSYM ofshvaladd - -%include "video/vidmacro.mac" - -;drawspritesprio - -SECTION .bss -NEWSYM tempstuff, resd 1 - -;ALIGN16 -.stuff resd 1 -.stuff2 resb 2 - -SECTION .text - -%macro procmode716bextbg 3 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz %%noflip - neg ax - add ax,255 -%%noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],%3 - jz %%nomos - mov bl,[mosaicsz] - cmp bl,0 - je %%nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -%%nomos - mov [m7starty],ax - mov ax,%1 - mov dx,%2 - call drawmode716extbg -%endmacro - -%macro procmode716bextbg2 3 - xor eax,eax - xor edx,edx - mov ax,[curypos] - mov byte[curmosaicsz],1 - test byte[mosaicon],%3 - jz %%nomos - mov bl,[mosaicsz] - cmp bl,0 - je %%nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -%%nomos - call drawmode716extbg2 -%endmacro - -NEWSYM procspritessub16b - test byte[scrndis],10h - jnz .nosprites - test byte[scrnon+1],10h - jz .nosprites - test byte[scrnon],10h - jnz .nosprites - cmp byte[winonsp],0FFh - je .nosprites - xor ebx,ebx - mov bl,[curypos] - add ebx,[cursprloc] - mov cl,[ebx] - cmp byte[sprprifix],0 - jne .sprprio - add dword[cursprloc],256 -.sprprio - cmp cl,0 - je .nosprites - call drawsprites16b -.nosprites - ret - -NEWSYM procspritesmain16b - test byte[scrndis],10h - jnz .nosprites - test byte[scrnon],10h - jz .nosprites - cmp byte[winonsp],0FFh - je .nosprites - xor ebx,ebx - mov bl,[curypos] - add ebx,[cursprloc] - mov cl,[ebx] - cmp byte[sprprifix],0 - jne .sprprio - add dword[cursprloc],256 -.sprprio - cmp cl,0 - je .nosprites - call drawsprites16b -.nosprites - ret - -NEWSYM drawbackgrndsub16b - mov esi,[colormodeofs] - mov bl,[esi+ebp] - cmp bl,0 - je near .noback - mov al,[curbgnum] - test byte[scrnon+1],al - jz near .noback - test byte[scrnon],al - jnz near .noback - test byte[alreadydrawn],al - jnz near .noback - test byte[scrndis],al - jnz near .noback - mov byte[winon],0 - test byte[winenabs],al - jz near .nobackwin -; procwindow [winbg1en+ebp] - mov al,[winbg1en+ebp] - call makewindow - cmp byte[winon],0FFh - je near .noback -.nobackwin - mov bl,[curbgnum] - mov byte[curmosaicsz],1 - test byte[mosaicon],bl - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl -.nomos - mov byte[bgcoloradder],0 - cmp byte[bgmode],0 - jne .nomode0 - mov eax,ebp - mov bl,20h - mul bl - mov [bgcoloradder],al -.nomode0 - mov esi,[bg1vbufloc+ebp*4] - mov edi,[bg1tdatloc+ebp*4] - mov edx,[bg1tdabloc+ebp*4] - mov ebx,[bg1cachloc+ebp*4] - mov eax,[bg1xposloc+ebp*4] - mov cl,[curbgnum] - test byte[bgtilesz],cl - jnz .16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw8x816b - cmp byte[drawn],33 - jne .notalldrawn - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawn - jmp .noback -.16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616b - cmp byte[drawn],33 - jne .notalldrawnb - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnb -.noback - ret - -NEWSYM drawbackgrndmain16b - mov esi,[colormodeofs] - mov bl,[esi+ebp] - cmp bl,0 - je near .noback - mov al,[curbgnum] - test byte[scrnon],al - jz near .noback - test byte[alreadydrawn],al - jnz near .noback - test byte[scrndis],al - jnz near .noback - mov byte[winon],0 - test byte[winenabm],al - jz near .nobackwin -; procwindow [winbg1en+ebp] - mov al,[winbg1en+ebp] - call makewindow - cmp byte[winon],0FFh - je near .noback -.nobackwin - mov bl,[curbgnum] - mov byte[curmosaicsz],1 - test byte[mosaicon],bl - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl -.nomos - mov byte[bgcoloradder],0 - cmp byte[bgmode],0 - jne .nomode0 - mov eax,ebp - mov bl,20h - mul bl - mov [bgcoloradder],al -.nomode0 - mov esi,[bg1vbufloc+ebp*4] - mov edi,[bg1tdatloc+ebp*4] - mov edx,[bg1tdabloc+ebp*4] - mov ebx,[bg1cachloc+ebp*4] - mov eax,[bg1xposloc+ebp*4] - mov cl,[curbgnum] - test byte[bgtilesz],cl - jnz .16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw8x816b - cmp byte[drawn],33 - jne .notalldrawn - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawn - jmp .noback -.16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616b - cmp byte[drawn],33 - jne .notalldrawnb - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnb -.noback - ret -NEWSYM blanker16b - ; calculate current video offset - push ebx - push esi - xor ebx,ebx - mov bx,[curypos] - mov esi,ebx - shl esi,9 - shl ebx,6 - add esi,ebx - add esi,32 - add esi,[vidbuffer] - mov bl,128 -.next - mov dword[esi],0 - add esi,4 - dec bl - jnz .next - pop esi - pop ebx - ret - -NEWSYM drawline16b - cmp byte[ForceNewGfxOff],0 - jne .nonewgfx - cmp byte[newengen],1 - je near newengine16b -.nonewgfx - cmp byte[curblank],0 - jne near nodrawline16b - mov al,[vidbright] - cmp al,[maxbr] - jbe .nochange - mov [maxbr],al -.nochange - cmp byte[forceblnk],0 - jne blanker16b - mov byte[alreadydrawn],0 - push ebx - xor ebx,ebx - mov bl,[bgmode] - shl bl,2 - add ebx,colormodedef - mov [colormodeofs],ebx - pop ebx - - cmp word[scrnon],1317h - jne .noscrnona - cmp byte[scaddtype],0 - jne .noscrnona - mov word[scrnon],1317h - mov byte[scaddtype],44h - mov byte[scaddset],02h -.noscrnona - cmp word[scrnon],0117h - jne .notransph - cmp word[scaddset],8202h - jne .notransph - mov word[scrnon],0116h -.notransph - - test byte[scaddset],02h - jnz near drawline16t - cmp dword[coladdr],0 - je .nocoladd - test byte[scaddtype],3Fh - jnz near drawline16t -.nocoladd - cmp byte[bgmode],7 - je near processmode716b - push esi - push edi - push ebx - push edx - push ebp - ; calculate current video offset - xor ebx,ebx - mov bx,[curypos] - mov esi,ebx - shl esi,9 - shl ebx,6 - add esi,ebx - add esi,32 - add esi,[vidbuffer] - mov [curvidoffset],esi - ; do sprite windowing - call makewindowsp - ; set palette - call setpalette16b - ; clear back area w/ back color - call clearback16b - ; clear registers - xor eax,eax - xor ecx,ecx - ; get current sprite table - xor ebx,ebx - mov bl,[curypos] - shl ebx,9 - add ebx,[spritetablea] - mov [currentobjptr],ebx - mov dword[cursprloc],sprleftpr - ; setup priorities - cmp byte[sprprifix],0 - je .nosprprio - mov dword[cursprloc],sprlefttot - call preparesprpr -.nosprprio -; process backgrounds -; do background 2 - mov byte[curbgnum],02h - mov ebp,01h - call procbackgrnd -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call procbackgrnd -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call procbackgrnd -; do background 3 - mov byte[curbgnum],04h - mov ebp,02h - call procbackgrnd - - cmp byte[bgmode],1 - ja near priority216b - mov al,[winenabm] - mov [cwinenabm],al - mov byte[curbgpr],0h -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndmain16b -; do background 3 - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndmain16b - mov ebp,0 - call procspritesmain16b - mov byte[curbgpr],20h -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndmain16b -; do background 3 - cmp byte[bg3high2],1 - je .bg3nothighb - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndmain16b -.bg3nothighb - mov ebp,1 - call procspritesmain16b -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain16b -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain16b - mov ebp,2 - call procspritesmain16b -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain16b -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain16b - mov ebp,3 - call procspritesmain16b - cmp byte[bg3high2],1 - jne .bg3highb -; do background 3 - mov byte[curbgpr],20h - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndmain16b -.bg3highb - pop ebp - pop edx - pop ebx - pop edi - pop esi - xor eax,eax - xor ecx,ecx -NEWSYM nodrawline16b - ret - -NEWSYM priority216b - mov al,[winenabm] - mov [cwinenabm],al -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain16b - mov ebp,0 - call procspritesmain16b -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain16b - mov ebp,1 - call procspritesmain16b -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain16b - mov ebp,2 - call procspritesmain16b -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain16b - mov ebp,3 - call procspritesmain16b - cmp byte[bg3high2],1 - pop ebp - pop edx - pop ebx - pop edi - pop esi - xor eax,eax - xor ecx,ecx - ret - - -NEWSYM processmode716b - mov al,[winenabm] - mov [cwinenabm],al - push esi - push edi - push ebx - push edx - push ebp - ; get current sprite table - xor ebx,ebx - mov bl,[curypos] - shl ebx,9 - add ebx,[spritetablea] - mov [currentobjptr],ebx - ; setup priorities - cmp byte[sprprifix],0 - je .nosprprio - mov dword[cursprloc],sprlefttot - call preparesprpr -.nosprprio - ; calculate current video offset - xor ebx,ebx - mov bx,[curypos] - mov esi,ebx - shl esi,9 - shl ebx,6 - add esi,ebx - add esi,32 - add esi,[vidbuffer] - mov [curvidoffset],esi - ; do sprite windowing - call makewindowsp - ; set palette - call setpalette16b - ; clear back area w/ back color - call clearback16b - ; clear registers - xor eax,eax - xor ecx,ecx - - mov byte[extbgdone],0 - ; mode 7 extbg - test byte[interlval],40h - jz near .noback0 - test byte[scrndis],02h - jnz near .noback0 - ; do background 1 - test word[scrnon],0202h - jz near .noback0 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin0 - test word[winenabm],0100h - jnz near .nobackwin0 - mov al,[winbg1en] - call makewindow - cmp byte[winon],0FFh - je near .noback0 -.nobackwin0 - mov byte[extbgdone],1 - procmode716bextbg [bg1scroly_m7],[bg1scrolx_m7],1 -.noback0 - - ; do objects - test byte[scrndis],10h - jnz near .nosprites1 - test word[scrnon],1010h - jz near .nosprites1 - cmp byte[winonsp],0FFh - je .nosprites1 - xor ebx,ebx - mov bl,[curypos] - mov cl,[sprleftpr+ebx] - cmp byte[sprprifix],0 - je .nosprprio2 - mov cl,[sprlefttot+ebx] -.nosprprio2 - cmp cl,0 - je .nosprites1 - mov ebp,0 - call drawsprites16b -.nosprites1 - - ; display mode7 - test byte[interlval],40h - jnz near .noback1 - test byte[scrndis],01h - jnz near .noback1 - ; do background 1 - test word[scrnon],0101h - jz near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 - mov al,[winbg1en] - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - procmode716b [bg1scroly_m7],[bg1scrolx_m7],1 -.noback1 - - ; do objects - test byte[scrndis],10h - jnz near .nosprites2 - test word[scrnon],1010h - jz near .nosprites2 - cmp byte[winonsp],0FFh - je .nosprites2 - xor ebx,ebx - mov bl,[curypos] - mov cl,[sprleftpr1+ebx] - cmp byte[sprprifix],0 - je .nosprprio3 - mov cl,[sprlefttot+ebx] -.nosprprio3 - cmp cl,0 - je .nosprites2 - mov ebp,1 - call drawsprites16b -.nosprites2 - - test byte[interlval],40h - jz near .noback0b - test byte[scrndis],01h - jnz near .noback0b - cmp byte[extbgdone],0 - jne near .noback0b - ; do background 1 - test word[scrnon],0101h - jz near .noback0b - mov byte[winon],0 - test word[winenabm],0002h - jz near .nobackwin0b - test word[winenabm],0200h - jnz near .nobackwin0b - mov al,[winbg1en] - call makewindow - cmp byte[winon],0FFh - je near .noback0b -.nobackwin0b - mov byte[extbgdone],1 - procmode716bextbg [bg1scroly_m7],[bg1scrolx_m7],1 -.noback0b - - ; mode 7 extbg - test byte[interlval],40h - jz near .noback2 - cmp byte[extbgdone],0 - je near .noback2 - test byte[scrndis],01h - jnz near .noback2 - ; do background 1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin2 - test word[winenabm],0100h - jnz near .nobackwin2 - mov al,[winbg1en] - call makewindow - cmp byte[winon],0FFh - je near .noback2 -.nobackwin2 - procmode716bextbg2 [bg1scroly_m7],[bg1scrolx_m7],1 -.noback2 - - ; do objects - test byte[scrndis],10h - jnz near .nosprites3 - test word[scrnon],1010h - jz near .nosprites3 - cmp byte[winonsp],0FFh - je .nosprites3 - xor ebx,ebx - mov bl,[curypos] - mov cl,[sprleftpr2+ebx] - cmp byte[sprprifix],0 - je .nosprprio4 - mov cl,[sprlefttot+ebx] -.nosprprio4 - cmp cl,0 - je .nosprites3 - mov ebp,2 - call drawsprites16b -.nosprites3 - ; do objects - test byte[scrndis],10h - jnz near .nosprites4 - test word[scrnon],1010h - jz near .nosprites4 - cmp byte[winonsp],0FFh - je .nosprites4 - xor ebx,ebx - mov bl,[curypos] - mov cl,[sprleftpr3+ebx] - cmp byte[sprprifix],0 - je .nosprprio5 - mov cl,[sprlefttot+ebx] -.nosprprio5 - cmp cl,0 - je .nosprites4 - mov ebp,3 - call drawsprites16b -.nosprites4 - pop ebp - pop edx - pop ebx - pop edi - pop esi - xor eax,eax - xor ecx,ecx - ret - -;******************************************************* -; Clear Backarea, 16-bit mode -;******************************************************* -NEWSYM clearback16b - test byte[scaddtype],00100000b - jz near .noaddition - test byte[scaddtype],10000000b - jnz near .noaddition - mov dx,[cgram] - mov ax,dx - and ax,001Fh - add al,[coladdr] - cmp al,01Fh - jb .noadd - mov al,01Fh -.noadd - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_rpos] - shl ax,cl - mov bx,ax - mov ax,dx - shr ax,5 - and ax,001Fh - add al,[coladdg] - cmp al,01Fh - jb .noaddb - mov al,01Fh -.noaddb - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_gpos] - shl ax,cl - add bx,ax - mov ax,dx - shr ax,10 - and ax,001Fh - add al,[coladdb] - cmp al,01Fh - jb .noaddc - mov al,01Fh -.noaddc - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_bpos] - shl ax,cl - add bx,ax - mov ax,bx - shl eax,16 - mov ax,bx - mov edi,[curvidoffset] - mov ecx,128 - rep stosd - xor eax,eax - ret -.noaddition - mov edi,[curvidoffset] - mov ax,[pal16b] - shl eax,16 - mov ax,[pal16b] - mov ecx,128 - rep stosd - xor eax,eax - ret - -;******************************************************* -; Set palette 16bit -;******************************************************* -NEWSYM setpalall - cmp byte[V8Mode],1 - jne .noveg - call doveg -.noveg - xor esi,esi - mov byte[colleft16b],0 -.loopa - mov dx,[cgram+esi] - mov [prevpal+esi],dx - mov ax,dx - and al,01Fh - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_rpos] - xor bx,bx - shl ax,cl - add bx,ax - mov ax,dx - shr ax,5 - and al,01Fh - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_gpos] - shl ax,cl - add bx,ax - mov ax,dx - shr ax,10 - and al,01Fh - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_bpos] - shl ax,cl - add bx,ax - cmp bx,0 - jne .col0 - cmp byte[vidbright],0 - je .col0 - or bx,0000000000100000b -.col0 - mov ax,bx - mov [pal16b+esi*2],bx - and bx,[vesa2_clbit] - mov [pal16bcl+esi*2],bx - xor ax,0FFFFh - and ax,[vesa2_clbit] - mov [pal16bxcl+esi*2],ax - add esi,2 - inc byte[colleft16b] - jnz near .loopa - mov al,[vidbright] - mov [prevbright],al - cmp byte[V8Mode],1 - jne .noveg2 - call dovegrest -.noveg2 - ret - -SECTION .bss -NEWSYM colleft16b, resb 1 -SECTION .text - -NEWSYM setpalette16b - cmp byte[gammalevel16b],0 - jne near setpalette16bgamma - cmp byte[V8Mode],1 - jne .noveg - call doveg -.noveg - mov al,[vidbright] - cmp al,[prevbright] - jne near setpalall - cmp byte[cgmod],0 - je near .skipall - mov byte[cgmod],0 - xor esi,esi - mov byte[colleft16b],0 -.loopa - mov dx,[cgram+esi] - cmp [prevpal+esi],dx - je near .skipa - mov [prevpal+esi],dx - mov ax,dx - and al,01Fh - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_rpos] - xor bx,bx - shl ax,cl - add bx,ax - mov ax,dx - shr ax,5 - and al,01Fh - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_gpos] - shl ax,cl - add bx,ax - mov ax,dx - shr ax,10 - and al,01Fh - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_bpos] - shl ax,cl - add bx,ax - cmp bx,0 - jne .col0 - cmp byte[vidbright],0 - je .col0 - or bx,0000000000100000b -.col0 - mov [pal16b+esi*2],bx - mov ax,bx - and bx,[vesa2_clbit] - mov [pal16bcl+esi*2],bx - xor ax,0FFFFh - and ax,[vesa2_clbit] - mov [pal16bxcl+esi*2],ax -.skipa - add esi,2 - inc byte[colleft16b] - jnz near .loopa -.skipall - cmp byte[V8Mode],1 - jne .noveg2 - call dovegrest -.noveg2 - ret - -NEWSYM setpalallgamma - xor esi,esi - mov byte[colleft16b],0 -.loopa - mov dx,[cgram+esi] - mov [prevpal+esi],dx - mov ax,dx - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .norr - mov al,31 -.norr - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_rpos] - xor bx,bx - shl ax,cl - add bx,ax - mov ax,dx - shr ax,5 - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .nogr - mov al,31 -.nogr - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_gpos] - shl ax,cl - add bx,ax - mov ax,dx - shr ax,10 - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .nobr - mov al,31 -.nobr - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_bpos] - shl ax,cl - add bx,ax - cmp bx,0 - jne .col0 - cmp byte[vidbright],0 - je .col0 - or bx,0000000000100000b -.col0 - mov ax,bx - mov [pal16b+esi*2],bx - and bx,[vesa2_clbit] - mov [pal16bcl+esi*2],bx - xor ax,0FFFFh - and ax,[vesa2_clbit] - mov [pal16bxcl+esi*2],ax - add esi,2 - inc byte[colleft16b] - jnz near .loopa - mov al,[vidbright] - mov [prevbright],al - ret - -NEWSYM setpalette16bgamma - mov al,[vidbright] - cmp al,[prevbright] - jne near setpalallgamma - cmp byte[cgmod],0 - je near .skipall - mov byte[cgmod],0 - xor esi,esi - mov byte[colleft16b],0 -.loopa - mov dx,[cgram+esi] - cmp [prevpal+esi],dx - je near .skipa - mov [prevpal+esi],dx - mov ax,dx - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .norb - mov al,31 -.norb - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_rpos] - xor bx,bx - shl ax,cl - add bx,ax - mov ax,dx - shr ax,5 - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .norr - mov al,31 -.norr - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_gpos] - shl ax,cl - add bx,ax - mov ax,dx - shr ax,10 - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .norg - mov al,31 -.norg - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_bpos] - shl ax,cl - add bx,ax - cmp bx,0 - jne .col0 - cmp byte[vidbright],0 - je .col0 - or bx,0000000000100000b -.col0 - mov [pal16b+esi*2],bx - mov ax,bx - and bx,[vesa2_clbit] - mov [pal16bcl+esi*2],bx - xor ax,0FFFFh - and ax,[vesa2_clbit] - mov [pal16bxcl+esi*2],ax -.skipa - add esi,2 - inc byte[colleft16b] - jnz near .loopa -.skipall - ret - -;******************************************************* -; Processes & Draws 4-bit sprites -;******************************************************* - -NEWSYM drawsprites16b - cmp byte[sprprifix],1 - je near drawsprites16bprio - test byte[cwinenabm],10h - jz .drawnowin - cmp byte[winonsp],0 - jne near drawsprites16bwinon -.drawnowin - mov esi,[currentobjptr] - mov edi,[curvidoffset] - xor ebx,ebx - xor eax,eax -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - shl bx,1 - mov al,[esi] - test al,0Fh - jz .skipa - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-16],dx -.skipa - mov al,[esi+1] - test al,0Fh - jz .skipb - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-14],dx -.skipb - mov al,[esi+2] - test al,0Fh - jz .skipc - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-12],dx -.skipc - mov al,[esi+3] - test al,0Fh - jz .skipd - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-10],dx -.skipd - mov al,[esi+4] - test al,0Fh - jz .skipe - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-8],dx -.skipe - mov al,[esi+5] - test al,0Fh - jz .skipf - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-6],dx -.skipf - mov al,[esi+6] - test al,0Fh - jz .skipg - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-4],dx -.skipg - mov al,[esi+7] - test al,0Fh - jz .skiph - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-2],dx -.skiph - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - shl bx,1 - mov al,[esi+7] - test al,0Fh - jz .skipa2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-16],dx -.skipa2 - mov al,[esi+6] - test al,0Fh - jz .skipb2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-14],dx -.skipb2 - mov al,[esi+5] - test al,0Fh - jz .skipc2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-12],dx -.skipc2 - mov al,[esi+4] - test al,0Fh - jz .skipd2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-10],dx -.skipd2 - mov al,[esi+3] - test al,0Fh - jz .skipe2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-8],dx -.skipe2 - mov al,[esi+2] - test al,0Fh - jz .skipf2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-6],dx -.skipf2 - mov al,[esi+1] - test al,0Fh - jz .skipg2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-4],dx -.skipg2 - mov al,[esi] - test al,0Fh - jz .skiph2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-2],dx -.skiph2 - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -NEWSYM drawsprites16bwinon - mov esi,[currentobjptr] - mov edi,[curvidoffset] - xor ebx,ebx - xor eax,eax -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - mov al,[esi] - test al,0Fh - jz .skipa - cmp byte[winspdata+ebx-8+16],0 - jne .skipa - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-16],dx -.skipa - mov al,[esi+1] - test al,0Fh - jz .skipb - cmp byte[winspdata+ebx-7+16],0 - jne .skipb - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-14],dx -.skipb - mov al,[esi+2] - test al,0Fh - jz .skipc - cmp byte[winspdata+ebx-6+16],0 - jne .skipc - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-12],dx -.skipc - mov al,[esi+3] - test al,0Fh - jz .skipd - cmp byte[winspdata+ebx-5+16],0 - jne .skipd - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-10],dx -.skipd - mov al,[esi+4] - test al,0Fh - jz .skipe - cmp byte[winspdata+ebx-4+16],0 - jne .skipe - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-8],dx -.skipe - mov al,[esi+5] - test al,0Fh - jz .skipf - cmp byte[winspdata+ebx-3+16],0 - jne .skipf - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-6],dx -.skipf - mov al,[esi+6] - test al,0Fh - jz .skipg - cmp byte[winspdata+ebx-2+16],0 - jne .skipg - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-4],dx -.skipg - mov al,[esi+7] - test al,0Fh - jz .skiph - cmp byte[winspdata+ebx-1+16],0 - jne .skiph - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-2],dx -.skiph - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - mov al,[esi+7] - test al,0Fh - jz .skipa2 - cmp byte[winspdata+ebx-8+16],0 - jne .skipa2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-16],dx -.skipa2 - mov al,[esi+6] - test al,0Fh - jz .skipb2 - cmp byte[winspdata+ebx-7+16],0 - jne .skipb2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-14],dx -.skipb2 - mov al,[esi+5] - test al,0Fh - jz .skipc2 - cmp byte[winspdata+ebx-6+16],0 - jne .skipc2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-12],dx -.skipc2 - mov al,[esi+4] - test al,0Fh - jz .skipd2 - cmp byte[winspdata+ebx-5+16],0 - jne .skipd2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-10],dx -.skipd2 - mov al,[esi+3] - test al,0Fh - jz .skipe2 - cmp byte[winspdata+ebx-4+16],0 - jne .skipe2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-8],dx -.skipe2 - mov al,[esi+2] - test al,0Fh - jz .skipf2 - cmp byte[winspdata+ebx-3+16],0 - jne .skipf2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-6],dx -.skipf2 - mov al,[esi+1] - test al,0Fh - jz .skipg2 - cmp byte[winspdata+ebx-2+16],0 - jne .skipg2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-4],dx -.skipg2 - mov al,[esi] - test al,0Fh - jz .skiph2 - cmp byte[winspdata+ebx-1+16],0 - jne .skiph2 - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-2],dx -.skiph2 - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -NEWSYM drawsprites16bprio - cmp byte[sprclprio+ebp],0 - je near .endobj - test byte[cwinenabm],10h - jz .drawnowin - cmp byte[winonsp],0 - jne near drawspritesprio16bwinon -.drawnowin - cmp dword[sprsingle],1 - je near .drawsingle - mov [csprprlft],cl - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push esi - mov ch,[esi+6] - mov dl,[esi+7] - xor eax,eax - and edx,03h - cmp edx,ebp - jne near .notprio - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawa16b sprdrawpra16b - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.drawspriteflipx - mov bx,[esi] - push esi - mov ch,[esi+6] - mov dl,[esi+7] - xor eax,eax - and edx,03h - cmp edx,ebp - jne near .notpriof - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawaf16b sprdrawpra16b - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - ret -.drawsingle - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,ecx - and edx,0FFh - xor eax,eax - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - mov bx,[esi] - push esi - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawa16b sprdrawprb16b - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret -.drawspriteflipx2 - mov bx,[esi] - push esi - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawaf16b sprdrawprb16b - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret - -NEWSYM drawspritesprio16bwinon - cmp dword[sprsingle],1 - je near .drawsingle - mov [csprprlft],cl - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push esi - mov ch,[esi+6] - mov dl,[esi+7] - xor eax,eax - and edx,03h - cmp edx,ebp - jne near .notprio - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawa16b sprdrawpraw16b - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.drawspriteflipx - mov bx,[esi] - push esi - mov ch,[esi+6] - mov dl,[esi+7] - xor eax,eax - and edx,03h - cmp edx,ebp - jne near .notpriof - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawaf16b sprdrawpraw16b - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - ret -.drawsingle - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,ecx - and edx,0FFh - xor eax,eax - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - mov bx,[esi] - push esi - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawa16b sprdrawprbw16b - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret -.drawspriteflipx2 - mov bx,[esi] - push esi - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawaf16b sprdrawprbw16b - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret - - -NEWSYM draw8x816b - cmp byte[osm2dis],1 - je .osm2dis - cmp byte[bgmode],2 - je near draw8x816boffset -.osm2dis - cmp byte[bgmode],5 - je near draw16x816 - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw8x816bwinon -.domosaic - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - cmp dword[ebx],0 - je .loopd4 - Draw8x816bmacro 0 - Draw8x816bmacro 1 - Draw8x816bmacro 2 - Draw8x816bmacro 3 -.loopd4 - cmp dword[ebx+4],0 - je .loopd8 - Draw8x816bmacro 4 - Draw8x816bmacro 5 - Draw8x816bmacro 6 - Draw8x816bmacro 7 -.loopd8 -.hprior - add esi,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - cmp dword[ebx+4],0 - je .loopd4b - Draw8x816bflipmacro 0 - Draw8x816bflipmacro 1 - Draw8x816bflipmacro 2 - Draw8x816bflipmacro 3 -.loopd4b - cmp dword[ebx],0 - je .loopd8b - Draw8x816bflipmacro 4 - Draw8x816bflipmacro 5 - Draw8x816bflipmacro 6 - Draw8x816bflipmacro 7 -.loopd8b - add esi,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -SECTION .bss -NEWSYM tileleft16b, resb 1 -SECTION .text - -NEWSYM draw8x816bwinon - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] - mov ebp,[winptrref] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - cmp dword[ebx],0 - je .loopd4 - Draw8x816bwinmacro 0 - Draw8x816bwinmacro 1 - Draw8x816bwinmacro 2 - Draw8x816bwinmacro 3 -.loopd4 - cmp dword[ebx+4],0 - je .loopd8 - Draw8x816bwinmacro 4 - Draw8x816bwinmacro 5 - Draw8x816bwinmacro 6 - Draw8x816bwinmacro 7 -.loopd8 -.hprior - add esi,16 - add ebp,8 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - cmp dword[ebx+4],0 - je .loopd4b - Draw8x816bwinflipmacro 0 - Draw8x816bwinflipmacro 1 - Draw8x816bwinflipmacro 2 - Draw8x816bwinflipmacro 3 -.loopd4b - cmp dword[ebx],0 - je .loopd8b - Draw8x816bwinflipmacro 4 - Draw8x816bwinflipmacro 5 - Draw8x816bwinflipmacro 6 - Draw8x816bwinflipmacro 7 -.loopd8b - add esi,16 - add ebp,8 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw16x816 - push eax - xor eax,eax - mov al,[curypos] - mov byte[hirestiledat+eax],1 - pop eax - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x816bwinon -.domosaic - cmp byte[res512switch],0 - jne near draw16x816b - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - drawpixel16b8x8 0, .loopd1, 0 - drawpixel16b8x8 2, .loopd3, 2 - drawpixel16b8x8 4, .loopd5, 4 - drawpixel16b8x8 6, .loopd7, 6 - add ebx,64 - ; Start loop - drawpixel16b8x8 0, .loopd1c, 8 - drawpixel16b8x8 2, .loopd3c, 10 - drawpixel16b8x8 4, .loopd5c, 12 - drawpixel16b8x8 6, .loopd7c, 14 -.hprior - add esi,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - ; reversed loop -.rloop - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - drawpixel16b8x8 1, .loopd1b, 14 - drawpixel16b8x8 3, .loopd3b, 12 - drawpixel16b8x8 5, .loopd5b, 10 - drawpixel16b8x8 7, .loopd7b, 8 - add ebx,64 - ; Start loop - drawpixel16b8x8 1, .loopd1d, 6 - drawpixel16b8x8 3, .loopd3d, 4 - drawpixel16b8x8 5, .loopd5d, 2 - drawpixel16b8x8 7, .loopd7d, 0 - add esi,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw16x816b - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - drawpixel16b8x8 1, .loopd1, 0 - drawpixel16b8x8 3, .loopd3, 2 - drawpixel16b8x8 5, .loopd5, 4 - drawpixel16b8x8 7, .loopd7, 6 - add ebx,64 - ; Start loop - drawpixel16b8x8 1, .loopd1c, 8 - drawpixel16b8x8 3, .loopd3c, 10 - drawpixel16b8x8 5, .loopd5c, 12 - drawpixel16b8x8 7, .loopd7c, 14 -.hprior - add esi,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - ; reversed loop -.rloop - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - drawpixel16b8x8 0, .loopd1b, 14 - drawpixel16b8x8 2, .loopd3b, 12 - drawpixel16b8x8 4, .loopd5b, 10 - drawpixel16b8x8 6, .loopd7b, 8 - add ebx,64 - ; Start loop - drawpixel16b8x8 0, .loopd1d, 6 - drawpixel16b8x8 2, .loopd3d, 4 - drawpixel16b8x8 4, .loopd5d, 2 - drawpixel16b8x8 6, .loopd7d, 0 - add esi,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw16x816bwinon - cmp byte[res512switch],0 - jne near draw16x816winonb - mov ebp,[winptrref] - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - drawpixel16b8x8winon 0, .loopd1, 0, 0 - drawpixel16b8x8winon 2, .loopd3, 2, 1 - drawpixel16b8x8winon 4, .loopd5, 4, 2 - drawpixel16b8x8winon 6, .loopd7, 6, 3 - add ebx,64 - ; Start loop - drawpixel16b8x8winon 0, .loopd1c, 8, 4 - drawpixel16b8x8winon 2, .loopd3c, 10, 5 - drawpixel16b8x8winon 4, .loopd5c, 12, 6 - drawpixel16b8x8winon 6, .loopd7c, 14, 7 -.hprior - add esi,16 - add ebp,8 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - ; reversed loop -.rloop - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - drawpixel16b8x8winon 1, .loopd1b, 14, 0 - drawpixel16b8x8winon 3, .loopd3b, 12, 1 - drawpixel16b8x8winon 5, .loopd5b, 10, 2 - drawpixel16b8x8winon 7, .loopd7b, 8, 3 - add ebx,64 - ; Start loop - drawpixel16b8x8winon 1, .loopd1d, 6, 4 - drawpixel16b8x8winon 3, .loopd3d, 4, 5 - drawpixel16b8x8winon 5, .loopd5d, 2, 6 - drawpixel16b8x8winon 7, .loopd7d, 0, 7 - add esi,16 - add ebp,8 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw16x816winonb - mov ebp,[winptrref] - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - drawpixel16b8x8winon 1, .loopd1, 0, 0 - drawpixel16b8x8winon 3, .loopd3, 2, 1 - drawpixel16b8x8winon 5, .loopd5, 4, 2 - drawpixel16b8x8winon 7, .loopd7, 6, 3 - add ebx,64 - ; Start loop - drawpixel16b8x8winon 1, .loopd1c, 8, 4 - drawpixel16b8x8winon 3, .loopd3c, 10, 5 - drawpixel16b8x8winon 5, .loopd5c, 12, 6 - drawpixel16b8x8winon 7, .loopd7c, 14, 7 -.hprior - add esi,16 - add ebp,8 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - ; reversed loop -.rloop - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - drawpixel16b8x8winon 0, .loopd1b, 14, 0 - drawpixel16b8x8winon 2, .loopd3b, 12, 1 - drawpixel16b8x8winon 4, .loopd5b, 10, 2 - drawpixel16b8x8winon 6, .loopd7b, 8, 3 - add ebx,64 - ; Start loop - drawpixel16b8x8winon 0, .loopd1d, 6, 4 - drawpixel16b8x8winon 2, .loopd3d, 4, 5 - drawpixel16b8x8winon 4, .loopd5d, 2, 6 - drawpixel16b8x8winon 6, .loopd7d, 0, 7 - add esi,16 - add ebp,8 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM domosaic16b - mov esi,xtravbuf+32 - mov edi,[curvidoffset] - mov dl,dh - mov cl,0 - mov ax,[esi] - cmp byte[winon],0 - jne near domosaicwin16b - test ax,0FFFFh - jz .zeroloop -.loopm - mov [edi],ax - add esi,2 - add edi,2 - dec cl - jz .doneloop - dec dl - jnz .loopm - mov ax,[esi] - mov dl,dh - test ax,0FFFFh - jnz .loopm -.zeroloop - add esi,2 - add edi,2 - dec cl - jz .doneloop - dec dl - jnz .zeroloop - mov ax,[esi] - mov dl,dh - test ax,0FFFFh - jnz .loopm - jmp .zeroloop -.doneloop - ret - -NEWSYM domosaicwin16b - mov ebp,[winptrref] - test ax,0FFFFh - jz .zeroloop -.loopm - cmp byte[ebp],0 - jne .nozero - mov [edi],ax -.nozero - add esi,2 - add edi,2 - inc ebp - dec cl - jz .doneloop - dec dl - jnz .loopm - mov ax,[esi] - mov dl,dh - test ax,0FFFFh - jnz .loopm -.zeroloop - add esi,2 - add edi,2 - inc ebp - dec cl - jz .doneloop - dec dl - jnz .zeroloop - mov ax,[esi] - mov dl,dh - test ax,0FFFFh - jnz .loopm - jmp .zeroloop -.doneloop - ret - -NEWSYM dowindow16b - mov ebx,windowdata - mov esi,xtravbuf+32 - mov edi,[curvidoffset] - xor edx,edx - xor ch,ch -.getnext - mov cl,[ebx] - cmp dl,cl - je .procnext -.dorest - sub cl,dl - cmp ch,0 - ja .nodraw -.loopa - mov ax,[esi+edx*2] - test ax,0FFFFh - jz .nocopy - mov [edi+edx*2],ax -.nocopy - inc dl - dec cl - jnz .loopa -.procnext - add ch,[ebx+1] - add ebx,2 - test byte[numwin],0FFh - jz .finishwin - dec byte[numwin] - jnz .getnext - xor cl,cl - jmp .dorest -.nodraw - add dl,cl - jmp .procnext -.finishwin - xor eax,eax - ret - -;******************************************************* -; Processes & Draws 8x8 tiles, offset mode -;******************************************************* - -NEWSYM draw8x816boffset - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - initoffsetmode - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw8x816bwinonoffset -.domosaic - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - cmp dword[ebx],0 - je .loopd4 - Draw8x816bmacro 0 - Draw8x816bmacro 1 - Draw8x816bmacro 2 - Draw8x816bmacro 3 -.loopd4 - cmp dword[ebx+4],0 - je .loopd8 - Draw8x816bmacro 4 - Draw8x816bmacro 5 - Draw8x816bmacro 6 - Draw8x816bmacro 7 -.loopd8 -.hprior - procoffsetmode - add esi,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - cmp dword[ebx+4],0 - je .loopd4b - Draw8x816bflipmacro 0 - Draw8x816bflipmacro 1 - Draw8x816bflipmacro 2 - Draw8x816bflipmacro 3 -.loopd4b - cmp dword[ebx],0 - je .loopd8b - Draw8x816bflipmacro 4 - Draw8x816bflipmacro 5 - Draw8x816bflipmacro 6 - Draw8x816bflipmacro 7 -.loopd8b - procoffsetmode - add esi,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw8x816bwinonoffset - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] - mov ebp,[winptrref] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - cmp dword[ebx],0 - je .loopd4 - Draw8x816bwinmacro 0 - Draw8x816bwinmacro 1 - Draw8x816bwinmacro 2 - Draw8x816bwinmacro 3 -.loopd4 - cmp dword[ebx+4],0 - je .loopd8 - Draw8x816bwinmacro 4 - Draw8x816bwinmacro 5 - Draw8x816bwinmacro 6 - Draw8x816bwinmacro 7 -.loopd8 -.hprior - procoffsetmode - add esi,16 - add ebp,8 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - cmp dword[ebx+4],0 - je .loopd4b - Draw8x816bwinflipmacro 0 - Draw8x816bwinflipmacro 1 - Draw8x816bwinflipmacro 2 - Draw8x816bwinflipmacro 3 -.loopd4b - cmp dword[ebx],0 - je .loopd8b - Draw8x816bwinflipmacro 4 - Draw8x816bwinflipmacro 5 - Draw8x816bwinflipmacro 6 - Draw8x816bwinflipmacro 7 -.loopd8b - procoffsetmode - add esi,16 - add ebp,8 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - -NEWSYM draw16x1616b - mov byte[drawn],0 - mov [temp],eax - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - xor ebx,ebx - mov bl,[curypos] - mov [temptile],edx - ; set up y adders - test byte[a16x16yinc],01h - jz .noincrc - mov word[.yadd],16 - mov word[.yflipadd],0 - jmp .yesincrc -.noincrc - mov word[.yadd],0 - mov word[.yflipadd],16 -.yesincrc - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x1616bwinon -.domosaic - mov byte[tileleft16b],33 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[.yadd] - jmp .yesyflip -.noyflip - add ax,word[.yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - - ; Start loop - Draw16x1616b 0, 0 - Draw16x1616b 1, 2 - Draw16x1616b 2, 4 - Draw16x1616b 3, 6 - Draw16x1616b 4, 8 - Draw16x1616b 5, 10 - Draw16x1616b 6, 12 - Draw16x1616b 7, 14 -.hprior - add esi,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - Draw16x1616b 7, 0 - Draw16x1616b 6, 2 - Draw16x1616b 5, 4 - Draw16x1616b 4, 6 - Draw16x1616b 3, 8 - Draw16x1616b 2, 10 - Draw16x1616b 1, 12 - Draw16x1616b 0, 14 -.skiploop2b - add esi,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -SECTION .bss -.yadd resw 1 -.yflipadd resw 1 -SECTION .text - -draw16x1616bwinon: - mov byte[tileleft16b],33 - mov dl,[temp] - mov ebp,[winptrref] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[draw16x1616b.yadd] - jmp .yesyflip -.noyflip - add ax,word[draw16x1616b.yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - - ; Start loop - Draw16x1616bwin 0, 0, 0 - Draw16x1616bwin 1, 2, 1 - Draw16x1616bwin 2, 4, 2 - Draw16x1616bwin 3, 6, 3 - Draw16x1616bwin 4, 8, 4 - Draw16x1616bwin 5, 10, 5 - Draw16x1616bwin 6, 12, 6 - Draw16x1616bwin 7, 14, 7 -.hprior - add esi,16 - add ebp,8 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - Draw16x1616bwin 7, 0, 0 - Draw16x1616bwin 6, 2, 1 - Draw16x1616bwin 5, 4, 2 - Draw16x1616bwin 4, 6, 3 - Draw16x1616bwin 3, 8, 4 - Draw16x1616bwin 2, 10, 5 - Draw16x1616bwin 1, 12, 6 - Draw16x1616bwin 0, 14, 7 -.skiploop2b - add esi,16 - add ebp,8 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret diff --git a/tools/zsnes/src/video/makev16t.asm b/tools/zsnes/src/video/makev16t.asm deleted file mode 100644 index d2f38f5..0000000 --- a/tools/zsnes/src/video/makev16t.asm +++ /dev/null @@ -1,5363 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%include "macros.mac" - -EXTSYM cwinptr,dualstartprocess,dualwinbg,dualwinsp,dwinptrproc,pwinbgenab -EXTSYM pwinbgtype,pwinspenab,pwinsptype,winbgdata,winlogicb,winonbtype -EXTSYM winonstype,winspdata,interlval,MMXSupport,bg1scrolx,bg1scroly,curmosaicsz -EXTSYM curypos,drawmode716t,makewindow,mode7set,mosaicon,mosaicsz,scrnon -EXTSYM winbg1en,winenabm,drawmode716textbg,drawmode716textbg2,extbgdone -EXTSYM drawmode716tb,drawmode716b,drawmode716extbg,drawmode716extbg2,cursprloc -EXTSYM drawsprites16b,scrndis,sprprifix,winonsp,bgfixer,bgfixer2,scaddtype -EXTSYM alreadydrawn,bg1cachloc,bg1tdabloc,bg1tdatloc,bg1vbufloc,bg1xposloc -EXTSYM bg1yaddval,bgcoloradder,bgmode,bgtilesz,colormodeofs,curbgnum -EXTSYM draw16x1616b,draw8x816b,drawn,winenabs,curbgpr,draw16x1616tms,ngptrdat2 -EXTSYM draw8x816tms,bg3high2,currentobjptr,curvidoffset,cwinenabm,makewindowsp -EXTSYM preparesprpr,procbackgrnd,setpalette16b,spritetablea,sprleftpr,sprlefttot -EXTSYM numwin,scaddset,wincolen,windowdata,winl1,winl2,winon,winr1,winr2 -EXTSYM vidbuffer,coladdb,coladdg,coladdr,vesa2_bpos,vesa2_gpos,vesa2_rpos -EXTSYM vidbright,winptrref,fulladdtab,pal16b,vesa2_clbit,csprbit,sprclprio -EXTSYM csprprlft,sprsingle,sprpriodata,pal16bcl,pal16bxcl,bgofwptr,bgsubby -EXTSYM bshifter,domosaic16b,temp,tempcach,temptile,tileleft16b,xtravbuf,yadder -EXTSYM yrevadder,vcache2b,vcache4b,vcache8b,draw8x816boffset,osm2dis -EXTSYM hirestiledat,res512switch,bg1objptr,bg1ptr,bg3ptr,bg3scrolx,bg3scroly -EXTSYM vidmemch4,vram,ofsmcptr,ofsmady,ofsmadx,yposngom,flipyposngom,ofsmtptr -EXTSYM ofsmmptr,ofsmcyps,bgtxadd,bg1ptrx,bg1ptry,a16x16xinc,a16x16yinc -EXTSYM bg1scrolx_m7,bg1scroly_m7,OMBGTestVal,Testval,cachesingle4bng,m7starty -EXTSYM ofsmtptrs,ofsmcptr2,ofshvaladd - -%include "video/vidmacro.mac" - -; clearback16bts clearback16bdual - -;******************************************************* -; DrawLine 16bit Transparent Draws the current line -;******************************************************* -; use curypos+bg1scroly for y location and bg1scrolx for x location -; use bg1ptr(b,c,d) for the pointer to the tile number contents -; use bg1objptr for the pointer to the object tile contents - -SECTION .text - -NEWSYM makedualwincol - mov dl,[winlogicb] - shr dl,2 - and dl,03h - mov cl,dl - mov byte[winon],1 - mov ebx,[winl1] - ; check if data matches previous sprite data - cmp cl,[dualwinsp] - jne .skipsprcheck - cmp al,[pwinspenab] - jne .skipsprcheck - cmp ebx,[pwinsptype] - jne .skipsprcheck - mov dword[cwinptr],winspdata+16 - mov al,[winonstype] - mov [winon],al - ret -.skipsprcheck - ; check if data matches previous data - cmp cl,[dualwinbg] - jne .skipenab3 - cmp al,[pwinbgenab] - jne .skipenab - cmp ebx,[pwinbgtype] - jne .skipenab2 - mov dword[cwinptr],winbgdata+16 - mov al,[winonbtype] - mov [winon],al - ret -.skipenab3 - mov [dualwinbg],cl -.skipenab - mov [pwinbgenab],al - mov ebx,[winl1] -.skipenab2 - mov [pwinbgtype],ebx - mov dword[dwinptrproc],winbgdata+16 - mov dword[cwinptr],winbgdata+16 - mov byte[winon],1 - mov byte[winonbtype],1 - jmp dualstartprocess - -NEWSYM procmode716tsub - test word[scrnon+1],01h - jz near .noback1 - test word[scrnon],01h - jnz near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 -; procwindow [winbg1en] - mov al,[winbg1en] - mov ebp,0 - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz .noflip - neg ax - add ax,255 -.noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],1 - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -.nomos - mov [m7starty],ax - mov ax,[bg1scroly_m7] - mov dx,[bg1scrolx_m7] - call drawmode716t -.noback1 - ret - - - -NEWSYM procmode716tsubextbg - test word[scrnon+1],02h - jz near .noback1 - test word[scrnon],02h - jnz near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 -; procwindow [winbg1en] - mov al,[winbg1en] - mov ebp,0 - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz .noflip - neg ax - add ax,255 -.noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],1 - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -.nomos - mov [m7starty],ax - mov ax,[bg1scroly_m7] - mov dx,[bg1scrolx_m7] - mov byte[extbgdone],1 - call drawmode716extbg -.noback1 - ret - -NEWSYM procmode716tsubextbgb - cmp byte[extbgdone],0 - jne near .noback1 - test word[scrnon+1],01h - jz near .noback1 - test word[scrnon],01h - jnz near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 -; procwindow [winbg1en] - mov al,[winbg1en] - mov ebp,0 - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz .noflip - neg ax - add ax,255 -.noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],1 - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -.nomos - mov [m7starty],ax - mov ax,[bg1scroly_m7] - mov dx,[bg1scrolx_m7] - mov byte[extbgdone],1 - call drawmode716textbg -.noback1 - ret - -NEWSYM procmode716tsubextbg2 - cmp byte[extbgdone],0 - je near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 - mov al,[winbg1en] - mov ebp,0 - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - xor eax,eax - xor edx,edx - mov ax,[curypos] - mov byte[curmosaicsz],1 - test byte[mosaicon],1 - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -.nomos - call drawmode716extbg2 -.noback1 - ret - -NEWSYM procmode716tmain - test word[scrnon],01h - jz near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 -; procwindow [winbg1en] - mov al,[winbg1en] - mov ebp,0 - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz .noflip - neg ax - add ax,255 -.noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],1 - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -.nomos - mov [m7starty],ax - mov ax,[bg1scroly_m7] - mov dx,[bg1scrolx_m7] - test byte[scaddset],02h - jz .noscrnadd - test word[scrnon+1],01h - jnz near .mode7b -.noscrnadd - test byte[scaddtype],01h - jz .notransp - call drawmode716t -.noback1 - ret -.notransp - call drawmode716b - ret -.mode7b - call drawmode716tb - ret - -NEWSYM procmode716tmainextbg - test word[scrnon],02h - jz near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 -; procwindow [winbg1en] - mov al,[winbg1en] - mov ebp,0 - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz .noflip - neg ax - add ax,255 -.noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],1 - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -.nomos - mov [m7starty],ax - mov ax,[bg1scroly_m7] - mov dx,[bg1scrolx_m7] - test byte[scaddtype],01h - jz .notransp - mov byte[extbgdone],1 - call drawmode716textbg -.noback1 - ret -.notransp - mov byte[extbgdone],1 - call drawmode716extbg - ret - -NEWSYM procmode716tmainextbgb - cmp byte[extbgdone],0 - jne near .noback1 - test word[scrnon],01h - jz near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 -; procwindow [winbg1en] - mov al,[winbg1en] - mov ebp,0 - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz .noflip - neg ax - add ax,255 -.noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],1 - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -.nomos - mov [m7starty],ax - mov ax,[bg1scroly_m7] - mov dx,[bg1scrolx_m7] - test byte[scaddtype],01h - jz .notransp - mov byte[extbgdone],1 - call drawmode716textbg -.noback1 - ret -.notransp - mov byte[extbgdone],1 - call drawmode716extbg - ret - -NEWSYM procmode716tmainextbg2 - cmp byte[extbgdone],0 - je near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 -; procwindow [winbg1en] - mov al,[winbg1en] - mov ebp,0 - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz .noflip - neg ax - add ax,255 -.noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],1 - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -.nomos - mov [m7starty],ax - mov ax,[bg1scroly_m7] - mov dx,[bg1scrolx_m7] - test byte[scaddtype],01h - jz .notransp - call drawmode716textbg2 -.noback1 - ret -.notransp - call drawmode716extbg2 - ret - -NEWSYM procspritessub16t - cmp byte[bgfixer],1 - je near procspritessub16tfix - cmp byte[bgfixer2],1 - je near procspritessub16tfix - test byte[scrndis],10h - jnz .nosprites - test byte[scrnon+1],10h - jz .nosprites - test byte[scrnon],10h - jnz .nosprites - cmp byte[winonsp],0FFh - je .nosprites - xor ebx,ebx - mov bl,[curypos] - add ebx,[cursprloc] - mov cl,[ebx] - cmp byte[sprprifix],0 - jne .sprprio - add dword[cursprloc],256 -.sprprio - cmp cl,0 - je .nosprites - call drawsprites16b -.nosprites - ret - -NEWSYM procspritesmain16t - cmp byte[bgfixer],1 - je near procspritesmain16tfix - cmp byte[bgfixer2],1 - je near procspritesmain16tfix - test byte[scrndis],10h - jnz .nosprites - test byte[scrnon],10h - jz .nosprites - cmp byte[winonsp],0FFh - je .nosprites - xor ebx,ebx - mov bl,[curypos] - add ebx,[cursprloc] - mov cl,[ebx] - cmp byte[sprprifix],0 - jne .sprprio - add dword[cursprloc],256 -.sprprio - cmp cl,0 - je .nosprites - test byte[scrnon+1],10h - jnz .spritesubmain - test byte[scaddtype],10h - jz .nospriteadd - call drawsprites16t -.nosprites - ret -.nospriteadd - call drawsprites16b - xor eax,eax - ret -.spritesubmain - call drawsprites16bt - ret - -NEWSYM drawbackgrndsub16t - cmp byte[bgfixer],1 - je near drawbackgrndsub16tfix - cmp byte[bgfixer2],1 - je near drawbackgrndsub16tfix - mov esi,[colormodeofs] - mov bl,[esi+ebp] - cmp bl,0 - je near .noback - mov al,[curbgnum] - test byte[scrnon+1],al - jz near .noback - test byte[scrnon],al - jnz near .noback - test byte[alreadydrawn],al - jnz near .noback - test byte[scrndis],al - jnz near .noback - mov byte[winon],0 - test byte[winenabs],al - jz near .nobackwin -; procwindow [winbg1en+ebp] - mov al,[winbg1en+ebp] - call makewindow - cmp byte[winon],0FFh - je near .noback -.nobackwin - mov bl,[curbgnum] - mov byte[curmosaicsz],1 - test byte[mosaicon],bl - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl -.nomos - mov byte[bgcoloradder],0 - cmp byte[bgmode],0 - jne .nomode0 - mov eax,ebp - mov bl,20h - mul bl - mov [bgcoloradder],al -.nomode0 - mov esi,[bg1vbufloc+ebp*4] - mov edi,[bg1tdatloc+ebp*4] - mov edx,[bg1tdabloc+ebp*4] - mov ebx,[bg1cachloc+ebp*4] - mov eax,[bg1xposloc+ebp*4] - mov cl,[curbgnum] - test byte[bgtilesz],cl - jnz .16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw8x816b - cmp byte[drawn],33 - jne .notalldrawn - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawn -.noback - ret -.16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616b - cmp byte[drawn],33 - jne .notalldrawnb - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnb - ret - -NEWSYM drawbackgrndmain16t - cmp byte[bgfixer],1 - je near drawbackgrndmain16tfix - cmp byte[bgfixer2],1 - je near drawbackgrndmain16tfix - mov esi,[colormodeofs] - mov bl,[esi+ebp] - cmp bl,0 - je near .noback - mov al,[curbgnum] - test byte[scrnon],al - jz near .noback - test byte[alreadydrawn],al - jnz near .noback - test byte[scrndis],al - jnz near .noback - mov byte[winon],0 - test byte[winenabm],al - jz near .nobackwin -; procwindow [winbg1en+ebp] - mov al,[winbg1en+ebp] - call makewindow - cmp byte[winon],0FFh - je near .noback -.nobackwin - mov bl,[curbgnum] - mov byte[curmosaicsz],1 - test byte[mosaicon],bl - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl -.nomos - mov byte[bgcoloradder],0 - cmp byte[bgmode],0 - jne .nomode0 - mov eax,ebp - shl eax,5 - mov [bgcoloradder],al -.nomode0 - mov esi,[bg1vbufloc+ebp*4] - mov edi,[bg1tdatloc+ebp*4] - mov edx,[bg1tdabloc+ebp*4] - mov ebx,[bg1cachloc+ebp*4] - mov eax,[bg1xposloc+ebp*4] - mov cl,[curbgnum] - cmp byte[curbgpr],0h - jne .test2 -; test byte[scaddtype],cl -; jnz .transp -.test2 - test byte[scaddset],02h - jz .noscrnadd - test byte[scrnon+1],cl - jnz near .mainandsub -.noscrnadd - test byte[scaddtype],cl - jnz .transp - test byte[bgtilesz],cl - jnz .16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw8x816b - cmp byte[drawn],33 - jne .notalldrawn - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawn -.noback - ret -.16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616b - cmp byte[drawn],33 - jne .notalldrawnb - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnb - ret -.transp - test byte[bgtilesz],cl - jnz .16x16b - mov ecx,[bg1yaddval+ebp*4] - call draw8x816t - cmp byte[drawn],33 - jne .notalldrawnc - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnc - ret -.16x16b - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616t - cmp byte[drawn],33 - jne .notalldrawnd - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnd - ret -.mainandsub - test byte[curbgpr],20h - jnz .firstpr - test byte[scaddtype],cl - jnz .transpb -.firstpr - test byte[bgtilesz],cl - jnz .16x16c - mov ecx,[bg1yaddval+ebp*4] - call draw8x816bt - cmp byte[drawn],33 - jne .notalldrawne - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawne - ret -.16x16c - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616bt - cmp byte[drawn],33 - jne .notalldrawnf - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnf - ret -.transpb - test byte[bgtilesz],cl - jnz .16x16d - mov ecx,[bg1yaddval+ebp*4] - call draw8x816tms - cmp byte[drawn],33 - jne .notalldrawng - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawng - ret -.16x16d - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616tms - cmp byte[drawn],33 - jne .notalldrawnh - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnh - ret - -NEWSYM procspritessub16tfix - test byte[scrndis],10h - jnz .nosprites - test byte[scrnon+1],10h - jz .nosprites - cmp byte[winonsp],0FFh - je .nosprites - xor ebx,ebx - mov bl,[curypos] - add ebx,[cursprloc] - mov cl,[ebx] - cmp byte[sprprifix],0 - jne .sprprio - add dword[cursprloc],256 -.sprprio - cmp cl,0 - je .nosprites - call drawsprites16b -.nosprites - ret - -NEWSYM procspritesmain16tfix - test byte[scrndis],10h - jnz .nosprites - test byte[scrnon],10h - jz .nosprites - cmp byte[winonsp],0FFh - je .nosprites - xor ebx,ebx - mov bl,[curypos] - add ebx,[cursprloc] - mov cl,[ebx] - cmp byte[sprprifix],0 - jne .sprprio - add dword[cursprloc],256 -.sprprio - cmp cl,0 - je .nosprites - test byte[scaddtype],10h - jz .nospriteadd - call drawsprites16t -.nosprites - ret -.nospriteadd - call drawsprites16b - xor eax,eax - ret - -NEWSYM drawbackgrndsub16tfix - mov esi,[colormodeofs] - mov bl,[esi+ebp] - cmp bl,0 - je near .noback - mov al,[curbgnum] - test byte[scrnon+1],al - jz near .noback - test byte[alreadydrawn],al - jnz near .noback - test byte[scrndis],al - jnz near .noback - mov byte[winon],0 - test byte[winenabs],al - jz near .nobackwin -; procwindow [winbg1en+ebp] - mov al,[winbg1en+ebp] - call makewindow - cmp byte[winon],0FFh - je near .noback -.nobackwin - mov bl,[curbgnum] - mov byte[curmosaicsz],1 - test byte[mosaicon],bl - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl -.nomos - mov byte[bgcoloradder],0 - cmp byte[bgmode],0 - jne .nomode0 - mov eax,ebp - mov bl,20h - mul bl - mov [bgcoloradder],al -.nomode0 - mov esi,[bg1vbufloc+ebp*4] - mov edi,[bg1tdatloc+ebp*4] - mov edx,[bg1tdabloc+ebp*4] - mov ebx,[bg1cachloc+ebp*4] - mov eax,[bg1xposloc+ebp*4] - mov cl,[curbgnum] - test byte[bgtilesz],cl - jnz .16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw8x816b - cmp byte[drawn],33 - jne .notalldrawn - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawn -.noback - ret -.16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616b - cmp byte[drawn],33 - jne .notalldrawnb - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnb - ret - -NEWSYM drawbackgrndmain16tfix - mov esi,[colormodeofs] - mov bl,[esi+ebp] - cmp bl,0 - je near .noback - mov al,[curbgnum] - test byte[scrnon],al - jz near .noback - test byte[alreadydrawn],al -; jnz near .noback - test byte[scrndis],al - jnz near .noback - mov byte[winon],0 - test byte[winenabm],al - jz near .nobackwin -; procwindow [winbg1en+ebp] - mov al,[winbg1en+ebp] - call makewindow - cmp byte[winon],0FFh - je near .noback -.nobackwin - mov bl,[curbgnum] - mov byte[curmosaicsz],1 - test byte[mosaicon],bl - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl -.nomos - mov byte[bgcoloradder],0 - cmp byte[bgmode],0 - jne .nomode0 - mov eax,ebp - shl eax,5 - mov [bgcoloradder],al -.nomode0 - mov esi,[bg1vbufloc+ebp*4] - mov edi,[bg1tdatloc+ebp*4] - mov edx,[bg1tdabloc+ebp*4] - mov ebx,[bg1cachloc+ebp*4] - mov eax,[bg1xposloc+ebp*4] - mov cl,[curbgnum] - cmp byte[curbgpr],0h - jne .test2 -; test byte[scaddtype],cl -; jnz .transp -.test2 - test byte[scaddtype],cl - jnz .transp - test byte[bgtilesz],cl - jnz .16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw8x816b - cmp byte[drawn],33 - jne .notalldrawn - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawn -.noback - ret -.16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616b - cmp byte[drawn],33 - jne .notalldrawnb - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnb - ret -.transp - test byte[bgtilesz],cl - jnz .16x16b - mov ecx,[bg1yaddval+ebp*4] - call draw8x816t - cmp byte[drawn],33 - jne .notalldrawnc - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnc - ret -.16x16b - mov ecx,[bg1yaddval+ebp*4] - call draw16x1616t - cmp byte[drawn],33 - jne .notalldrawnd - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnd - ret - -ALIGN32 - -SECTION .bss -NEWSYM transpbuf, resb 576+16+288*2 ; Transparent buffer -SECTION .text - -NEWSYM drawline16t - cmp byte[bgmode],7 - je near processmode716t - mov al,[scrnon] - test [scrnon+1],al - jz .nomainsub - test byte[scrnon],10h - jnz .nomainsub - test byte[scrnon+1],10h - jz .nomainsub - mov al,[scrnon+1] - xor al,0FFh - and [scrnon],al -.nomainsub - push esi - push edi - push ebx - push edx - push ebp - ; current video offset - mov dword[curvidoffset],transpbuf+32 - ; set palette - call setpalette16b - ; clear back area w/ back color - procwindowback - call clearback16bts - ; do sprite windowing - call makewindowsp - ; clear registers - xor eax,eax - xor ecx,ecx - ; get current sprite table - xor ebx,ebx - mov bl,[curypos] - shl ebx,9 - add ebx,[spritetablea] - mov [currentobjptr],ebx - mov dword[cursprloc],sprleftpr - ; setup priorities - cmp byte[sprprifix],0 - je .nosprprio - mov dword[cursprloc],sprlefttot - call preparesprpr -.nosprprio -; process backgrounds -; do background 2 - mov byte[curbgnum],02h - mov ebp,01h - call procbackgrnd -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call procbackgrnd -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call procbackgrnd -; do background 3 - mov byte[curbgnum],04h - mov ebp,02h - call procbackgrnd - - cmp byte[bgmode],1 - ja near priority216t - test byte[scaddset],02h - jz near .noscrnadd -; draw backgrounds - mov byte[curbgpr],0h -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndsub16t -; do background 3 - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndsub16t - mov ebp,0 - call procspritessub16t -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndsub16t -; do background 3 - mov byte[curbgpr],20h - cmp byte[bg3high2],1 - je .bg3nothigh - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndsub16t -.bg3nothigh - mov ebp,1 - call procspritessub16t -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndsub16t -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndsub16t - mov ebp,2 - call procspritessub16t -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndsub16t -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndsub16t - mov ebp,3 - call procspritessub16t -; do background 3 - cmp byte[bg3high2],1 - jne .bg3high - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndsub16t -.bg3high -.noscrnadd - mov al,[winenabm] - mov [cwinenabm],al - -NEWSYM NextDrawLine16bt - ; calculate current video offset - xor ebx,ebx - mov bx,[curypos] - mov esi,ebx - shl esi,9 - shl ebx,6 - add esi,ebx - add esi,32 - add esi,[vidbuffer] - mov [curvidoffset],esi - ; clear back area w/ back color - call clearback16t - mov byte[curbgpr],0h -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndmain16t -; do background 3 - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndmain16t - mov ebp,0 - call procspritesmain16t -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndmain16t -; do background 3 - mov byte[curbgpr],20h - cmp byte[bg3high2],1 - je .bg3nothighb - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndmain16t -.bg3nothighb - mov ebp,1 - call procspritesmain16t -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain16t -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain16t - mov ebp,2 - call procspritesmain16t -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain16t -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain16t - mov ebp,3 - call procspritesmain16t - cmp byte[bg3high2],1 - jne .bg3highb -; do background 3 - mov byte[curbgpr],20h - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndmain16t -.bg3highb - pop ebp - pop edx - pop ebx - pop edi - pop esi - xor eax,eax - xor ecx,ecx - ret - -NEWSYM priority216t - test byte[scaddset],02h - jz near .noscrnadd -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndsub16t - mov ebp,0 - call procspritessub16t -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndsub16t - mov ebp,1 - call procspritessub16t -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndsub16t - mov ebp,2 - call procspritessub16t -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndsub16t - mov ebp,3 - call procspritessub16t -.noscrnadd - mov al,[winenabm] - mov [cwinenabm],al -NEWSYM Priority2NextDrawLine16bt - ; calculate current video offset - xor ebx,ebx - mov bx,[curypos] - mov esi,ebx - shl esi,9 - shl ebx,6 - add esi,ebx - add esi,32 - add esi,[vidbuffer] - mov [curvidoffset],esi - ; clear back area w/ back color - call clearback16t -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain16t - mov ebp,0 - call procspritesmain16t -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain16t - mov ebp,1 - call procspritesmain16t -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain16t - mov ebp,2 - call procspritesmain16t -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain16t - mov ebp,3 - call procspritesmain16t - pop ebp - pop edx - pop ebx - pop edi - pop esi - xor eax,eax - xor ecx,ecx - ret - -NEWSYM processmode716t - push esi - push edi - push ebx - push edx - push ebp - ; current video offset - mov dword[curvidoffset],transpbuf+32 - ; set palette - call setpalette16b - ; clear back area w/ back color - procwindowback - call clearback16bts - ; do sprite windowing - call makewindowsp - ; clear registers - xor eax,eax - xor ecx,ecx - ; get current sprite table - xor ebx,ebx - mov bl,[curypos] - shl ebx,9 - add ebx,[spritetablea] - mov [currentobjptr],ebx - mov dword[cursprloc],sprleftpr - ; setup priorities - cmp byte[sprprifix],0 - je .nosprprio - mov dword[cursprloc],sprlefttot - call preparesprpr -.nosprprio - mov byte[extbgdone],0 - test byte[scaddset],02h - jz .nosubscr - test byte[interlval],40h - jz .noback0s - call procmode716tsubextbg -.noback0s - mov ebp,0 - call procspritessub16t - test byte[interlval],40h - jnz .noback1s - call procmode716tsub -.noback1s - mov ebp,1 - call procspritessub16t - test byte[interlval],40h - jz .noback2s - call procmode716tsubextbgb - call procmode716tsubextbg2 -.noback2s - mov ebp,2 - call procspritessub16t - mov ebp,3 - call procspritessub16t -.nosubscr - mov al,[winenabm] - mov [cwinenabm],al -NEWSYM processmode716t2 - ; calculate current video offset - xor ebx,ebx - mov bx,[curypos] - mov esi,ebx - shl esi,9 - shl ebx,6 - add esi,ebx - add esi,32 - add esi,[vidbuffer] - mov [curvidoffset],esi - ; get current sprite table - xor ebx,ebx - mov bl,[curypos] - shl ebx,9 - add ebx,[spritetablea] - mov [currentobjptr],ebx - mov dword[cursprloc],sprleftpr - ; setup priorities - cmp byte[sprprifix],0 - je .nosprprio - mov dword[cursprloc],sprlefttot - call preparesprpr -.nosprprio - ; clear back area w/ back color - call clearback16t - ; clear registers - xor eax,eax - xor ecx,ecx - mov byte[extbgdone],0 - test byte[interlval],40h - jz .noback0m - call procmode716tmainextbg -.noback0m - mov ebp,0 - call procspritesmain16t - ; do background 1 - test byte[interlval],40h - jnz .noback1m - call procmode716tmain -.noback1m - mov ebp,1 - call procspritesmain16t - test byte[interlval],40h - jz .noback2m - call procmode716tmainextbgb - call procmode716tmainextbg2 -.noback2m - mov ebp,2 - call procspritesmain16t - mov ebp,3 - call procspritesmain16t - pop ebp - pop edx - pop ebx - pop edi - pop esi - xor eax,eax - xor ecx,ecx - ret - -;******************************************************* -; Clear Backarea, with 0s -;******************************************************* - -SECTION .bss -NEWSYM prevrgbcol, resd 1 -NEWSYM prevrgbpal, resd 1 -SECTION .text - -NEWSYM clearback16bts - mov byte[DoTransp],0 - cmp dword[vesa2_rpos],0 - je near clearback16bts0.clear - cmp byte[winon],0 - je near clearback16bts0b - cmp byte[winon],2 - je near clearback16bts0 - cmp byte[winon],4 - je near clearback16bts0.clear -.noclear - mov bl,[scaddset] - and bl,30h - cmp bl,20h - jne .dontclear - cmp byte[winon],5 - je near clearback16bts0.clear -.dontclear - cmp byte[winon],5 - je near clearback16bts0b - cmp byte[winon],3 - je near clearback16bts0b - mov eax,[coladdr] - shl eax,8 - mov bx,[prevrgbpal] - mov al,[vidbright] - cmp eax,[prevrgbcol] - je .useprevpal - mov [prevrgbcol],eax - xor eax,eax - mov al,[coladdr] - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_rpos] - shl ax,cl - mov bx,ax - xor eax,eax - mov al,[coladdg] - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_gpos] - shl ax,cl - add bx,ax - xor eax,eax - mov al,[coladdb] - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_bpos] - shl ax,cl - add bx,ax - mov [prevrgbpal],bx -.useprevpal - mov ax,bx - cmp eax,0 - je .nowin - jmp dowindowback16b -.nowin - mov edi,[curvidoffset] - or eax,eax - jz near clearback16bts0.clearing - cmp byte[MMXSupport],1 - je .dommxclear - mov ecx,128 - rep stosd - xor eax,eax - ret -.dommxclear - mov [mmxtempdat],eax - mov [mmxtempdat+4],eax - mov ecx,32 - movq mm0,[mmxtempdat] -.mmxloop - movq [edi],mm0 - movq [edi+8],mm0 - add edi,16 - dec ecx - jnz .mmxloop - emms - xor eax,eax - ret - -SECTION .bss -mmxtempdat resd 2 -SECTION .text - -NEWSYM clearback16bts0b - mov eax,[coladdr] - shl eax,8 - mov bx,[prevrgbpal] - mov al,[vidbright] - cmp eax,[prevrgbcol] - je .useprevpal2 - mov [prevrgbcol],eax - xor eax,eax - mov al,[coladdr] - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_rpos] - shl ax,cl - mov bx,ax - xor eax,eax - mov al,[coladdg] - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_gpos] - shl ax,cl - add bx,ax - xor eax,eax - mov al,[coladdb] - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[vesa2_bpos] - shl ax,cl - add bx,ax - mov [prevrgbpal],bx -.useprevpal2 - mov ax,bx - shl eax,16 - mov ax,bx - cmp byte[winon],3 - je near clearback16bdual - mov edi,[curvidoffset] - or eax,eax - jz near clearback16bts0.clearing - cmp byte[MMXSupport],1 - je .dommxclear - mov ecx,128 - rep stosd - xor eax,eax - ret -.dommxclear - mov [mmxtempdat],eax - mov [mmxtempdat+4],eax - mov ecx,32 - movq mm0,[mmxtempdat] -.mmxloop - movq [edi],mm0 - movq [edi+8],mm0 - add edi,16 - dec ecx - jnz .mmxloop - emms - xor eax,eax - ret - -NEWSYM clearback16bts0 - mov bl,[scaddset] - and bl,30h - cmp bl,20h - je near clearback16bts0b -.clear - mov edi,[curvidoffset] - xor eax,eax -.clearing - test byte[scrnon+1],10h - jnz .notnotransp - mov byte[DoTransp],1 -.notnotransp - cmp byte[MMXSupport],1 - je .dommxclear - mov ecx,128 - rep stosd - ret -.dommxclear - mov [mmxtempdat],eax - mov [mmxtempdat+4],eax - mov ecx,32 - movq mm0,[mmxtempdat] -.mmxloop - movq [edi],mm0 - movq [edi+8],mm0 - add edi,16 - dec ecx - jnz .mmxloop - emms - ret - -NEWSYM dowindowback16b - test byte[scrnon+1],10h - jnz .notnotransp - mov byte[DoTransp],1 -.notnotransp - mov bl,[scaddset] - and bl,30h - cmp bl,20h - je near dowindowback16brev - mov ebx,windowdata - mov edi,[curvidoffset] - xor edx,edx - xor ch,ch -.getnext - mov cl,[ebx] - cmp dl,cl - je .procnext -.dorest - sub cl,dl - cmp ch,0 - ja .nodraw - mov byte[DoTransp],0 -.loopa - mov [edi+edx*2],ax - inc dl - dec cl - jnz .loopa -.procnext - add ch,[ebx+1] - add ebx,2 - test byte[numwin],0FFh - jz .finishwin - dec byte[numwin] - jnz .getnext - xor cl,cl - jmp .dorest -.nodraw -.loopb - mov word[edi+edx*2],0 - inc dl - dec cl - jnz .loopb - jmp .procnext -.finishwin - xor eax,eax - ret - -NEWSYM dowindowback16brev - mov ebx,windowdata - mov edi,[curvidoffset] - xor edx,edx - xor ch,ch -.getnext - mov cl,[ebx] - cmp dl,cl - je .procnext -.dorest - sub cl,dl - cmp ch,0 - ja .nodraw -.loopa - mov word[edi+edx*2],0 - inc dl - dec cl - jnz .loopa -.procnext - add ch,[ebx+1] - add ebx,2 - test byte[numwin],0FFh - jz .finishwin - dec byte[numwin] - jnz .getnext - xor cl,cl - jmp .dorest -.nodraw - mov byte[DoTransp],0 -.loopb - mov [edi+edx*2],ax - inc dl - dec cl - jnz .loopb - jmp .procnext -.finishwin - xor eax,eax - ret - -NEWSYM clearback16bdual - cmp byte[bgmode],7 - jne .notmode7 - test byte[scrnon+1],10h - jnz .notmode7 - jmp clearback16bdualb2 -.notmode7 - - mov bl,[scaddset] - and bl,30h - cmp bl,10h - je near clearback16bdualrev - - mov edi,[curvidoffset] - mov esi,[cwinptr] - mov ecx,64 - cmp dword[esi],01010101h - je near .drawnone -.nextpart - cmp dword[esi],0 - jne .drawpart -.drawall - mov [edi],eax - mov [edi+4],eax - add edi,8 - add esi,4 - dec ecx - jnz .nextpart - jmp .findraw -.nextpartp - cmp dword[esi],01010101h - je near .drawnone - cmp dword[esi],0h - je .drawall -.drawpart - xor ebx,ebx - cmp byte[esi],1 - je .nodraw - mov ebx,eax -.nodraw - mov [edi],bx - xor ebx,ebx - cmp byte[esi+1],1 - je .nodraw1 - mov ebx,eax -.nodraw1 - mov [edi+2],bx - xor ebx,ebx - cmp byte[esi+2],1 - je .nodraw2 - mov ebx,eax -.nodraw2 - mov [edi+4],bx - xor ebx,ebx - cmp byte[esi+3],1 - je .nodraw3 - mov ebx,eax -.nodraw3 - mov [edi+6],bx - add edi,8 - add esi,4 - dec ecx - jnz near .nextpartp - jmp .findraw -.nextpartn - cmp dword[esi],01010101h - jne .drawpart -.drawnone - mov dword[edi],0 - mov dword[edi+4],0 - add edi,8 - add esi,4 - dec ecx - jnz .nextpartn -.findraw - ret - -NEWSYM clearback16bdualrev - -; xor eax,eax ;aaaaaaaaaaa -; ret - - mov edi,[curvidoffset] - mov esi,[winptrref] - mov esi,[cwinptr] - mov ecx,64 - cmp dword[esi],0 - je near .drawnone -.nextpart - cmp dword[esi],01010101h - jne .drawpart -.drawall - mov [edi],eax - mov [edi+4],eax - add edi,8 - add esi,4 - dec ecx - jnz .nextpart - jmp .findraw -.nextpartp - cmp dword[esi],0 - je near .drawnone - cmp dword[esi],01010101h - je .drawall -.drawpart - xor ebx,ebx - cmp byte[esi],1 - jne .nodraw - mov ebx,eax -.nodraw - mov [edi],bx - xor ebx,ebx - cmp byte[esi+1],1 - jne .nodraw1 - mov ebx,eax -.nodraw1 - mov [edi+2],bx - xor ebx,ebx - cmp byte[esi+2],1 - jne .nodraw2 - mov ebx,eax -.nodraw2 - mov [edi+4],bx - xor ebx,ebx - cmp byte[esi+3],1 - jne .nodraw3 - mov ebx,eax -.nodraw3 - mov [edi+6],bx - add edi,8 - add esi,4 - dec ecx - jnz near .nextpartp - jmp .findraw -.nextpartn - cmp dword[esi],0 - jne .drawpart -.drawnone - mov dword[edi],0 - mov dword[edi+4],0 - add edi,8 - add esi,4 - dec ecx - jnz .nextpartn -.findraw - ret - -NEWSYM clearback16bdualb2 - mov byte[DoTransp],1 - mov bl,[scaddset] - and bl,30h - cmp bl,10h - je near clearback16bdualrev2 - - mov edi,[curvidoffset] - mov esi,[cwinptr] - mov ecx,64 - cmp dword[esi],01010101h - je near .drawnone - mov byte[DoTransp],0 -.nextpart - cmp dword[esi],0 - jne .drawpart -.drawall - mov [edi],eax - mov [edi+4],eax - add edi,8 - add esi,4 - dec ecx - jnz .nextpart - jmp .findraw -.nextpartp - cmp dword[esi],01010101h - je near .drawnone - cmp dword[esi],0h - je .drawall -.drawpart - mov byte[DoTransp],0 - xor ebx,ebx - cmp byte[esi],1 - je .nodraw - mov ebx,eax -.nodraw - mov [edi],bx - xor ebx,ebx - cmp byte[esi+1],1 - je .nodraw1 - mov ebx,eax -.nodraw1 - mov [edi+2],bx - xor ebx,ebx - cmp byte[esi+2],1 - je .nodraw2 - mov ebx,eax -.nodraw2 - mov [edi+4],bx - xor ebx,ebx - cmp byte[esi+3],1 - je .nodraw3 - mov ebx,eax -.nodraw3 - mov [edi+6],bx - add edi,8 - add esi,4 - dec ecx - jnz near .nextpartp - jmp .findraw -.nextpartn - cmp dword[esi],01010101h - jne .drawpart -.drawnone - mov dword[edi],0 - mov dword[edi+4],0 - add edi,8 - add esi,4 - dec ecx - jnz .nextpartn -.findraw - ret - -NEWSYM clearback16bdualrev2 - mov edi,[curvidoffset] - mov esi,[winptrref] - mov esi,[cwinptr] - mov ecx,64 - cmp dword[esi],0 - je near .drawnone - mov byte[DoTransp],0 -.nextpart - cmp dword[esi],01010101h - jne .drawpart -.drawall - mov [edi],eax - mov [edi+4],eax - add edi,8 - add esi,4 - dec ecx - jnz .nextpart - jmp .findraw -.nextpartp - cmp dword[esi],0 - je near .drawnone - cmp dword[esi],01010101h - je .drawall -.drawpart - mov byte[DoTransp],0 - xor ebx,ebx - cmp byte[esi],1 - jne .nodraw - mov ebx,eax -.nodraw - mov [edi],bx - xor ebx,ebx - cmp byte[esi+1],1 - jne .nodraw1 - mov ebx,eax -.nodraw1 - mov [edi+2],bx - xor ebx,ebx - cmp byte[esi+2],1 - jne .nodraw2 - mov ebx,eax -.nodraw2 - mov [edi+4],bx - xor ebx,ebx - cmp byte[esi+3],1 - jne .nodraw3 - mov ebx,eax -.nodraw3 - mov [edi+6],bx - add edi,8 - add esi,4 - dec ecx - jnz near .nextpartp - jmp .findraw -.nextpartn - cmp dword[esi],0 - jne .drawpart -.drawnone - mov dword[edi],0 - mov dword[edi+4],0 - add edi,8 - add esi,4 - dec ecx - jnz .nextpartn -.findraw - ret - -SECTION .bss -NEWSYM DoTransp, resb 1 -SECTION .text - -;******************************************************* -; Clear Backarea, 16-bit mode w/ transparency -;******************************************************* -NEWSYM clearback16t - test byte[scaddtype],20h - jz near .backcopy - test byte[scaddtype],80h - jnz near clearback16ts - mov eax,[pal16b] - mov esi,[curvidoffset] - mov ebp,transpbuf+32 - mov dx,ax - and eax,[vesa2_clbit] - shr eax,1 - test byte[scaddtype],40h - jz .fulladd - cmp byte[scrnon+1],0 - je .fulladd - mov ecx,128 -.loopa - mov ebx,[ebp] - or bx,bx - jz .noadd - and bx,[vesa2_clbit] - shr bx,1 - add bx,ax - mov [esi],bx - jmp .skip -.noadd - mov [esi],dx -.skip - shr ebx,16 - or bx,bx - je .noadd2 - and bx,word[vesa2_clbit] - shr bx,1 - add bx,ax - mov [esi+2],bx - jmp .skip2 -.noadd2 - mov [esi+2],dx -.skip2 - add ebp,4 - add esi,4 - dec ecx - jnz .loopa - xor eax,eax - ret -.fulladd - cmp eax,0 - je .subcopy - mov ecx,256 - xor ebx,ebx -.loopc - mov ebx,[ebp] - and ebx,[vesa2_clbit] - shr ebx,1 - add ebx,eax - add ebp,2 - mov ebx,[fulladdtab+ebx*2] - mov [esi],bx - add esi,2 - dec ecx - jnz .loopc - xor eax,eax - ret -.subcopy - cmp byte[MMXSupport],1 - je .dommxcopy - mov ecx,128 - xor ebx,ebx - mov edi,esi - mov esi,ebp - rep movsd - xor eax,eax - ret -.dommxcopy - mov ecx,32 - xor ebx,ebx - mov edi,esi - mov esi,ebp -.mmxloop2 - movq mm0,[esi] - movq mm1,[esi+8] - movq [edi],mm0 - movq [edi+8],mm1 - add esi,16 - add edi,16 - dec ecx - jnz .mmxloop2 - emms - xor eax,eax - ret -.backcopy - mov edi,[curvidoffset] - mov ecx,128 - mov ax,[pal16b] - shl eax,16 - mov ax,[pal16b] - cmp byte[MMXSupport],1 - je .dommxclear - rep stosd - xor eax,eax - ret -.dommxclear - mov [mmxtempdat],eax - mov [mmxtempdat+4],eax - mov ecx,32 - movq mm0,[mmxtempdat] -.mmxloop - movq [edi],mm0 - movq [edi+8],mm0 - add edi,16 - dec ecx - jnz .mmxloop - emms - xor eax,eax - ret - -NEWSYM clearback16ts - mov eax,[pal16b] - mov esi,[curvidoffset] - mov ebp,transpbuf+32 - xor eax,0FFFFh - and eax,[vesa2_clbit] - shr eax,1 - mov ecx,256 - xor ebx,ebx -.loopc - mov ebx,[ebp] - and ebx,[vesa2_clbit] - shr ebx,1 - add ebx,eax - add ebp,2 - mov ebx,[fulladdtab+ebx*2] - xor ebx,0FFFFh - mov [esi],bx - add esi,2 - dec ecx - jnz .loopc - xor eax,eax - ret - -NEWSYM drawsprites16bt - cmp byte[sprprifix],1 - je near drawsprites16btprio - test byte[cwinenabm],10h - jz .drawnowin - cmp byte[winonsp],0 - jne near drawsprites16btwinon -.drawnowin - mov esi,[currentobjptr] - xor ebx,ebx - xor eax,eax -.loopobj - mov edi,[curvidoffset] - test byte[esi+7],20h - jnz near .drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - shl bx,1 - mov esi,[esi+2] - mov ebp,ebx - add edi,ebx - add ebp,transpbuf+32 - drawspr16bt 0, 16 - drawspr16bt 1, 14 - drawspr16bt 2, 12 - drawspr16bt 3, 10 - drawspr16bt 4, 8 - drawspr16bt 5, 6 - drawspr16bt 6, 4 - drawspr16bt 7, 2 - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - shl bx,1 - mov esi,[esi+2] - mov ebp,ebx - add edi,ebx - add ebp,transpbuf+32 - drawspr16bt 7, 16 - drawspr16bt 6, 14 - drawspr16bt 5, 12 - drawspr16bt 4, 10 - drawspr16bt 3, 8 - drawspr16bt 2, 6 - drawspr16bt 1, 4 - drawspr16bt 0, 2 - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -NEWSYM drawsprites16btwinon - mov esi,[currentobjptr] - xor ebx,ebx - xor eax,eax -.loopobj - mov edi,[curvidoffset] - test byte[esi+7],20h - jnz near .drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - shl bx,1 - mov esi,[esi+2] - mov ebp,ebx - add edi,ebx - shr ebx,1 - add ebp,transpbuf+32 - drawspr16btwo 0, 16, 0 - drawspr16btwo 1, 14, 1 - drawspr16btwo 2, 12, 2 - drawspr16btwo 3, 10, 3 - drawspr16btwo 4, 8, 4 - drawspr16btwo 5, 6, 5 - drawspr16btwo 6, 4, 6 - drawspr16btwo 7, 2, 7 - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - shl bx,1 - mov esi,[esi+2] - mov ebp,ebx - add edi,ebx - shr ebx,1 - add ebp,transpbuf+32 - drawspr16btwo 7, 16, 0 - drawspr16btwo 6, 14, 1 - drawspr16btwo 5, 12, 2 - drawspr16btwo 4, 10, 3 - drawspr16btwo 3, 8, 4 - drawspr16btwo 2, 6, 5 - drawspr16btwo 1, 4, 6 - drawspr16btwo 0, 2, 7 - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -NEWSYM drawsprites16btprio - sprpriorityinit drawsprites16btpriow - sprprioritydrawbt sprdrawpra16bt, sprdrawprb16bt - -NEWSYM drawsprites16btpriow - sprprioritydrawbt sprdrawpra16bt, sprdrawprb16bt - -NEWSYM drawsprites16t - cmp byte[sprprifix],1 - je near drawsprites16tprio - test byte[cwinenabm],10h - jz .drawnowin - cmp byte[winonsp],0 - jne near drawsprites16twinon -.drawnowin - test byte[scaddtype],40h - jz near drawspritesfulladd - cmp byte[scrnon+1],0 - je near drawspritesfulladd - test byte[scaddtype],80h - jnz near drawspritesfulladd - mov esi,[currentobjptr] - mov edi,[curvidoffset] - xor ebx,ebx - xor eax,eax -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - shl bx,1 - mov esi,[esi+2] - cmp ch,12*16 - jae near .transparentobjnf - drawsprgrp drawspr16ta - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - shl bx,1 - mov esi,[esi+2] - cmp ch,12*16 - jae near .transparentobj - drawsprgrpf drawspr16ta - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobjnf - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrp drawspr16tb - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobj - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrpf drawspr16tb - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -drawspritesfulladd: - mov esi,[currentobjptr] - mov edi,[curvidoffset] - xor ebx,ebx - xor eax,eax -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - shl bx,1 - mov esi,[esi+2] - cmp ch,12*16 - jae near .transparentobjnf - drawsprgrp drawspr16ta - pop esi - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - shl bx,1 - mov esi,[esi+2] - cmp ch,12*16 - jae near .transparentobj - drawsprgrpf drawspr16ta - pop esi - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobjnf - test byte[scaddtype],80h - jnz near .transparentobjnfs - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrp drawspr16tc - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobjnfs - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrp drawspr16td - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobj - test byte[scaddtype],80h - jnz near .transparentobjs - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrpf drawspr16tc - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobjs - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrpf drawspr16td - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -NEWSYM drawsprites16twinon - test byte[scaddtype],40h - jz near drawspritesfulladdwinon - cmp byte[scrnon+1],0 - je near drawspritesfulladdwinon - test byte[scaddtype],80h - jnz near drawspritesfulladdwinon - mov esi,[currentobjptr] - mov edi,[curvidoffset] - xor ebx,ebx - xor eax,eax -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - cmp ch,12*16 - jae near .transparentobjnf - drawsprgrpwin drawspr16tawinon - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - cmp ch,12*16 - jae near .transparentobj - drawsprgrpfwin drawspr16tawinon - pop esi - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobjnf - mov ebp,ebx - add edi,ebx - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrpwin drawspr16tbwinon - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobj - mov ebp,ebx - add edi,ebx - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrpfwin drawspr16tbwinon - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -NEWSYM drawspritesfulladdwinon - mov esi,[currentobjptr] - mov edi,[curvidoffset] - xor ebx,ebx - xor eax,eax -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - cmp ch,12*16 - jae near .transparentobjnf - drawsprgrpwin drawspr16tawinon - pop esi - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - push esi - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - cmp ch,12*16 - jae near .transparentobj - drawsprgrpfwin drawspr16tawinon - pop esi - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobjnf - test byte[scaddtype],80h - jnz near .transparentobjnfs - mov ebp,ebx - add edi,ebx - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrpwin drawspr16tcwinon - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobjnfs - mov ebp,ebx - add edi,ebx - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrpwin drawspr16tdwinon - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobj - test byte[scaddtype],80h - jnz near .transparentobjs - mov ebp,ebx - add edi,ebx - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrpfwin drawspr16tcwinon - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.transparentobjs - mov ebp,ebx - add edi,ebx - mov ebp,ebx - add edi,ebx - xor edx,edx - add ebp,transpbuf+32 - drawsprgrpfwin drawspr16tdwinon - pop esi - mov edi,[curvidoffset] - xor edx,edx - xor ebx,ebx - add esi,8 - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -NEWSYM drawsprites16tprio - test byte[scaddtype],40h - jz near drawspritesfulladdprio - cmp byte[scrnon+1],0 - je near drawspritesfulladdprio - test byte[scaddtype],80h - jnz near drawspritesfulladdprio - ; half add - sprpriorityinit drawsprites16tpriow - sprprioritydrawt16b sprdrawpra16bha, sprdrawprb16bha, sprdrawpra16b, sprdrawprb16b - -NEWSYM drawsprites16tpriow - sprprioritydrawt16b sprdrawpraw16bha, sprdrawprbw16bha, sprdrawpraw16b, sprdrawprbw16b - -NEWSYM drawspritesfulladdprio - test byte[scaddtype],80h - jnz near drawspritesfullsubprio - ; full add - sprpriorityinit drawspritesfulladdpriow - sprprioritydrawt16b sprdrawpra16bfa, sprdrawprb16bfa, sprdrawpra16b, sprdrawprb16b - -NEWSYM drawspritesfulladdpriow - sprprioritydrawt16b sprdrawpraw16bfa, sprdrawprbw16bfa, sprdrawpraw16b, sprdrawprbw16b - -NEWSYM drawspritesfullsubprio - ; full sub - sprpriorityinit drawspritesfullsubpriow - sprprioritydrawt16b sprdrawpra16bfs, sprdrawprb16bfs, sprdrawpra16b, sprdrawprb16b - -NEWSYM drawspritesfullsubpriow - sprprioritydrawt16b sprdrawpraw16bfs, sprdrawprbw16bfs, sprdrawpraw16b, sprdrawprbw16b - - -NEWSYM draw8x816bt - cmp byte[bgmode],2 - je near draw8x816boffset - cmp byte[bgmode],5 - je near draw16x816t - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw8x816btwinon -.domosaic - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - ; Start loop - drawtilegrp draw8x816bta -.hprior - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - drawtilegrpf draw8x816bta - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw8x816btwinon - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - mov byte[tileleft16b],33 - mov ecx,[winptrref] - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov eax,ecx - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - mov ecx,eax - xor eax,eax - ; Start loop - drawtilegrp draw8x816btawinon -.hprior - add esi,16 - add ecx,8 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov eax,ecx - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - mov ecx,eax - xor eax,eax - drawtilegrpf draw8x816btawinonb - add esi,16 - add ecx,8 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw8x816t - cmp byte[osm2dis],1 - je .osm2dis - cmp byte[bgmode],2 - je near draw8x816toffset -.osm2dis - cmp byte[bgmode],5 - je near draw16x816t - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw8x816twinon -.domosaic - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - - test byte[scaddtype],80h - jnz near draw8x816ts - test byte[scaddtype],40h - jz near draw8x8fulladd - cmp byte[scrnon+1],0 - jz near draw8x8fulladd - - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816ta -.hprior - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpf draw8x816ta - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw8x8fulladd - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - push edi - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tb -.hprior - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tb - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw8x816ts - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - push edi - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tc -.hprior - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tc - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -ALIGN32 -SECTION .bss -NEWSYM coadder16, resd 1 -SECTION .text - -NEWSYM draw8x816twinon - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - test byte[scaddtype],80h - jnz near draw8x816tswinon - test byte[scaddtype],40h - jz near draw8x8fulladdwinon - cmp byte[scrnon+1],0 - jz near draw8x8fulladdwinon - mov byte[tileleft16b],33 - mov edx,[winptrref] - mov byte[drawn],0 -.loopa - mov ax,[edi] - mov cl,ah - add edi,2 - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test cl,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test cl,40h - jnz near .rloop - - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816tawinon -.hprior - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpf draw8x816tawinonb - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw8x8fulladdwinon - mov byte[tileleft16b],33 - mov edx,[winptrref] - mov byte[drawn],0 -.loopa - mov ax,[edi] - mov cl,ah - add edi,2 - push edi - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tbwinon -.hprior - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tbwinonb - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw8x816tswinon - mov byte[tileleft16b],33 - mov edx,[winptrref] - mov byte[drawn],0 -.loopa - mov ax,[edi] - mov cl,ah - add edi,2 - push edi - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tcwinon -.hprior - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tcwinonb - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -;******************************************************* -; Processes & Draws 16x8 tiles -;******************************************************* - -%macro Process16x816t 2 - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -%%loopa - mov ax,[edi] - mov dh,ah - add edi,2 - push edi - xor dh,[curbgpr] - test dh,20h - jnz near %%hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb %%noclip - sub edi,[bgsubby] -%%noclip - test dh,80h - jz %%normadd - add edi,[yrevadder] - jmp %%skipadd -%%normadd - add edi,[yadder] -%%skipadd - test dh,40h - jnz near %%rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - %2 0+%1, 0 - %2 2+%1, 2 - %2 4+%1, 4 - %2 6+%1, 6 - add edi,64 - ; Start loop - %2 0+%1, 8 - %2 2+%1, 10 - %2 4+%1, 12 - %2 6+%1, 14 -%%hprior - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne %%loopc2 - mov edi,[temptile] -%%loopc2 - dec byte[tileleft16b] - jnz near %%loopa - cmp byte[drawn],0 - je %%nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -%%nodraw - ret - -%%rloop - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - %2 1-%1, 14 - %2 3-%1, 12 - %2 5-%1, 10 - %2 7-%1, 8 - add edi,64 - ; Start loop - %2 1-%1, 6 - %2 3-%1, 4 - %2 5-%1, 2 - %2 7-%1, 0 - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne %%loopc3 - mov edi,[temptile] -%%loopc3 - dec byte[tileleft16b] - jnz near %%loopa - cmp byte[drawn],0 - je %%nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -%%nodraw2 - ret -%endmacro - -%macro Process16x816twin 2 - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -%%loopa - mov ax,[edi] - mov cl,ah - add edi,2 - push edi - xor cl,[curbgpr] - test cl,20h - jnz near %%hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb %%noclip - sub edi,[bgsubby] -%%noclip - test cl,80h - jz %%normadd - add edi,[yrevadder] - jmp %%skipadd -%%normadd - add edi,[yadder] -%%skipadd - test cl,40h - jnz near %%rloop - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - %2 0+%1, 0, 0 - %2 2+%1, 2, 1 - %2 4+%1, 4, 2 - %2 6+%1, 6, 3 - add edi,64 - ; Start loop - %2 0+%1, 8, 4 - %2 2+%1, 10, 5 - %2 4+%1, 12, 6 - %2 6+%1, 14, 7 -%%hprior - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne %%loopc2 - mov edi,[temptile] -%%loopc2 - dec byte[tileleft16b] - jnz near %%loopa - ret - -%%rloop - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - %2 1-%1, 14, 0 - %2 3-%1, 12, 1 - %2 5-%1, 10, 2 - %2 7-%1, 8, 3 - add edi,64 - ; Start loop - %2 1-%1, 6, 4 - %2 3-%1, 4, 5 - %2 5-%1, 2, 6 - %2 7-%1, 0, 7 - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne %%loopc3 - mov edi,[temptile] -%%loopc3 - dec byte[tileleft16b] - jnz near %%loopa - ret -%endmacro - -NEWSYM draw16x816t - push eax - xor eax,eax - mov al,[curypos] - mov byte[hirestiledat+eax],1 - pop eax - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - - test byte[scaddtype],80h - jnz near draw16x816ts - test byte[scaddtype],40h - jz near draw16x816tfa - cmp byte[scrnon+1],0 - jz near draw16x816tfa - - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x816twinon -.domosaic - cmp byte[res512switch],0 - jne near draw16x816tb - Process16x816t 0, draw8x816ta2 - -NEWSYM draw16x816tb - Process16x816t 1, draw8x816ta2 - -NEWSYM draw16x816twinon - mov edx,[winptrref] - cmp byte[res512switch],0 - jne near draw16x816twinonb - Process16x816twin 0, draw8x816tawinon2 - -NEWSYM draw16x816twinonb - Process16x816twin 1, draw8x816tawinon2 - -draw16x816tfa: - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x816twinonfa -.domosaic - cmp byte[res512switch],0 - jne near draw16x816tbfa - Process16x816t 0, draw8x816tb -NEWSYM draw16x816tbfa - Process16x816t 1, draw8x816tb -NEWSYM draw16x816twinonfa - mov edx,[winptrref] - cmp byte[res512switch],0 - jne near draw16x816twinonbfa - Process16x816twin 0, draw8x816tbwinon2 -NEWSYM draw16x816twinonbfa - Process16x816twin 1, draw8x816tbwinon2 - -draw16x816ts: - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x816twinons -.domosaic - cmp byte[res512switch],0 - jne near draw16x816tbs - Process16x816t 0, draw8x816tc -NEWSYM draw16x816tbs - Process16x816t 1, draw8x816tc -NEWSYM draw16x816twinons - mov edx,[winptrref] - cmp byte[res512switch],0 - jne near draw16x816twinonbs - Process16x816twin 0, draw8x816tcwinon2 -NEWSYM draw16x816twinonbs - Process16x816twin 1, draw8x816tcwinon2 - -;******************************************************* -; Processes & Draws 8x8 tiles, offset mode -;******************************************************* - - -NEWSYM draw8x816toffset - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - initoffsetmode - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw8x816twinonoffset -.domosaic - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - test byte[scaddtype],80h - jnz near draw8x816tsoffset - test byte[scaddtype],40h - jz near draw8x8fulladdoffset - cmp byte[scrnon+1],0 - jz near draw8x8fulladdoffset - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816ta -.hprior - procoffsetmode - add esi,16 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpf draw8x816ta - procoffsetmode - add esi,16 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw8x8fulladdoffset - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - push edi - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tb -.hprior - pop edi - procoffsetmode - add esi,16 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tb - pop edi - procoffsetmode - add esi,16 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw8x816tsoffset - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - push edi - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tc -.hprior - pop edi - procoffsetmode - add esi,16 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tc - pop edi - procoffsetmode - add esi,16 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - -NEWSYM draw8x816twinonoffset - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - test byte[scaddtype],80h - jnz near draw8x816tswinonoffset - test byte[scaddtype],40h - jz near draw8x8fulladdwinonoffset - cmp byte[scrnon+1],0 - jz near draw8x8fulladdwinonoffset - mov byte[tileleft16b],33 - mov edx,[winptrref] - mov byte[drawn],0 -.loopa - mov ax,[edi] - mov cl,ah - add edi,2 - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test cl,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test cl,40h - jnz near .rloop - - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816tawinon -.hprior - procoffsetmode - add esi,16 - add edx,8 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpf draw8x816tawinonb - procoffsetmode - add esi,16 - add edx,8 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - -NEWSYM draw8x8fulladdwinonoffset - mov byte[tileleft16b],33 - mov edx,[winptrref] - mov byte[drawn],0 -.loopa - mov ax,[edi] - mov cl,ah - add edi,2 - push edi - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tbwinon -.hprior - pop edi - procoffsetmode - add esi,16 - add edx,8 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tbwinonb - pop edi - procoffsetmode - add esi,16 - add edx,8 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - -NEWSYM draw8x816tswinonoffset - mov byte[tileleft16b],33 - mov edx,[winptrref] - mov byte[drawn],0 -.loopa - mov ax,[edi] - mov cl,ah - add edi,2 - push edi - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tcwinon -.hprior - pop edi - procoffsetmode - add esi,16 - add edx,8 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tcwinonb - pop edi - procoffsetmode - add esi,16 - add edx,8 - add ebp,16 - dec byte[tileleft16b] - jnz near .loopa - xor eax,eax - ret - -;******************************************************* -; Processes & Draws 16x16 tiles in main and sub screen -;******************************************************* -NEWSYM draw16x1616bt - mov byte[drawn],0 - mov [temp],eax - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - xor ebx,ebx - mov bl,[curypos] - mov [temptile],edx - ; set up y adders - test byte[a16x16yinc],01h - jz .noincrc - mov word[yadd],16 - mov word[yflipadd],0 - jmp .yesincrc -.noincrc - mov word[yadd],0 - mov word[yflipadd],16 -.yesincrc - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x1616btwinon -.domosaic - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - mov byte[tileleft16b],33 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - - ; Start loop - drawtilegrp draw8x816bta -.hprior - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - drawtilegrpf draw8x816bta -.skiploop2b - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -NEWSYM draw16x1616btwinon - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - mov byte[tileleft16b],33 - mov ecx,[winptrref] - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov eax,ecx - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - mov ecx,eax - xor eax,eax - - ; Start loop - drawtilegrp draw8x816btawinon -.hprior - add esi,16 - add ecx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov eax,ecx - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - mov ecx,eax - xor eax,eax - drawtilegrpf draw8x816btawinon -.skiploop2b - add esi,16 - add ecx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -;******************************************************* -; Processes & Draws 16x16 tiles in 2, 4, & 8 bit mode -;******************************************************* - -NEWSYM draw16x1616t - mov byte[drawn],0 - mov [temp],eax - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - xor ebx,ebx - mov bl,[curypos] - mov [temptile],edx - ; set up y adders - test byte[a16x16yinc],01h - jz .noincrc - mov word[yadd],16 - mov word[yflipadd],0 - jmp .yesincrc -.noincrc - mov word[yadd],0 - mov word[yflipadd],16 -.yesincrc - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x1616twinon -.domosaic - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - test byte[scaddtype],80h - jnz near draw16x1616ts - test byte[scaddtype],40h - jz near draw16x16fulladd - cmp byte[scrnon+1],0 - je near draw16x16fulladd - mov byte[tileleft16b],33 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - test dh,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816ta -.hprior - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpf draw8x816ta -.skiploop2b - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -SECTION .bss -NEWSYM yadd, resw 1 -NEWSYM yflipadd, resw 1 -SECTION .text - -NEWSYM draw16x16fulladd - mov byte[tileleft16b],33 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - push edi - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov edi,[tempcach] - shl ax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tb -.hprior - pop edi - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tb - pop edi - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -NEWSYM draw16x1616ts - mov byte[tileleft16b],33 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - push edi - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov edi,[tempcach] - shl ax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tc -.hprior - pop edi - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tc - pop edi - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -NEWSYM draw16x1616twinon - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - test byte[scaddtype],80h - jnz near draw16x1616tswinon - test byte[scaddtype],40h - jz near draw16x16fulladdwinon - cmp byte[scrnon+1],0 - je near draw16x16fulladdwinon - mov byte[tileleft16b],33 - mov edx,[winptrref] -.loopa - mov ax,[edi] - mov cl,ah - xor byte[a16x16xinc],1 - test cl,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - test cl,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test cl,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test cl,40h - jnz near .rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816tawinon -.hprior - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc byte[temp] -.noincrb2 - cmp byte[temp],20h - jne .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpf draw8x816tawinonb -.skiploop2b - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc byte[temp] -.noincrb - cmp byte[temp],20h - jne near .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw16x16fulladdwinon - mov byte[tileleft16b],33 - mov edx,[winptrref] -.loopa - mov ax,[edi] - mov cl,ah - xor byte[a16x16xinc],1 - - test cl,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor cl,[curbgpr] - push edi - test cl,20h - jnz near .hprior - inc byte[drawn] - - test cl,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov edi,[tempcach] - shl ax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tbwinon -.hprior - pop edi - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc byte[temp] -.noincrb2 - cmp byte[temp],20h - jne .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tbwinonb - pop edi - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc byte[temp] -.noincrb - cmp byte[temp],20h - jne near .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw16x1616tswinon - mov byte[tileleft16b],33 - mov edx,[winptrref] -.loopa - mov ax,[edi] - mov cl,ah - xor byte[a16x16xinc],1 - - test cl,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor cl,[curbgpr] - push edi - test cl,20h - jnz near .hprior - inc byte[drawn] - - test cl,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov edi,[tempcach] - shl ax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tcwinon -.hprior - pop edi - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc byte[temp] -.noincrb2 - cmp byte[temp],20h - jne .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tcwinonb - pop edi - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc byte[temp] -.noincrb - cmp byte[temp],20h - jne near .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret diff --git a/tools/zsnes/src/video/makevid.asm b/tools/zsnes/src/video/makevid.asm deleted file mode 100644 index 3027051..0000000 --- a/tools/zsnes/src/video/makevid.asm +++ /dev/null @@ -1,4438 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 disableeffects,winl1,winl2,winbgdata,winr1,winr2,winspdata,winlogica -EXTSYM winenabm,winobjen,winlogicb,scrndis,scrnon,bgmode,bgtilesz,winbg1en -EXTSYM winenabs,bg1objptr,bg1ptr,bg1ptrb,bg1ptrc,bg1ptrd,bg1scrolx,bg1scroly -EXTSYM cachebg1,curbgofs1,curcolbg1,vcache2b,vcache4b,vcache8b -EXTSYM vidbuffer,bg3highst,cbitmode,colormodedef,ngptrdat2 -EXTSYM colormodeofs,drawline16b,forceblnk,newengine8b,preparesprpr,scaddset -EXTSYM spritetablea,sprleftpr,vidbright,ForceNewGfxOff,curypos,drawmode7 -EXTSYM mode7set,mosaicon,mosaicsz,sprleftpr1,sprleftpr2,sprleftpr3,sprlefttot -EXTSYM sprprifix,drawmode7extbg,interlval,drawmode7extbg2,sprclprio,sprpriodata -EXTSYM sprsingle,cachetile2b,cachetile4b,cachetile8b,vram,newengen,ofshvaladd -EXTSYM cachetile2b16x16,cachetile4b16x16,cachetile8b16x16,osm2dis,xtravbuf -EXTSYM bg3ptr,bg3scrolx,bg3scroly,vidmemch4,ofsmcptr,ofsmady,ofsmadx,yposngom -EXTSYM flipyposngom,ofsmtptr,ofsmmptr,ofsmcyps,bgtxadd,bg1ptrx,bg1ptry -EXTSYM bg1scrolx_m7,bg1scroly_m7,OMBGTestVal,Testval,cachesingle4bng,m7starty -EXTSYM ofsmtptrs,ofsmcptr2 - -%include "video/vidmacro.mac" - -SECTION .bss -NEWSYM bgcoloradder, resb 1 -NEWSYM res512switch, resb 1 - -SECTION .text - -;******************************************************* -; DrawLine Draws the current line -;******************************************************* -; use curypos+bg1scroly for y location and bg1scrolx for x location -; use bg1ptr(b,c,d) for the pointer to the tile number contents -; use bg1objptr for the pointer to the object tile contents - -%macro decideonmode 0 - cmp bl,2 - je .yes4bit - cmp bl,1 - je .yes2bit - mov byte[bshifter],6 - mov edx,[vcache8b] - jmp .skipbits -.yes4bit - mov byte[bshifter],2 - mov edx,[vcache4b] - shl eax,1 - jmp .skipbits -.yes2bit - mov byte[bshifter],0 - shl eax,2 - mov edx,[vcache2b] -.skipbits -%endmacro - -%macro procmode7 3 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz %%noflip - neg ax - add ax,255 -%%noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],%3 - jz %%nomos - mov bl,[mosaicsz] - cmp bl,0 - je %%nomos - inc bl - mov [curmosaicsz],bl - xor edx,edx - xor bh,bh - div bx - xor edx,edx - mul bx - xor edx,edx - mov dl,[mosaicsz] - add ax,[MosaicYAdder+edx*2] -%%nomos - mov [m7starty],ax - mov ax,%1 - mov dx,%2 - call drawmode7 -%endmacro - -%macro procmode7extbg 3 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz %%noflip - neg ax - add ax,255 -%%noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],%3 - jz %%nomos - mov bl,[mosaicsz] - cmp bl,0 - je %%nomos - inc bl - mov [curmosaicsz],bl - xor edx,edx - xor bh,bh - div bx - xor edx,edx - mul bx - xor edx,edx - mov dl,[mosaicsz] - add ax,[MosaicYAdder+edx*2] -%%nomos - mov [m7starty],ax - mov ax,%1 - mov dx,%2 - call drawmode7extbg -%endmacro - -%macro procmode7extbg2 3 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz %%noflip - neg ax - add ax,255 -%%noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],%3 - jz %%nomos - mov bl,[mosaicsz] - cmp bl,0 - je %%nomos - inc bl - mov [curmosaicsz],bl - xor edx,edx - xor bh,bh - div bx - xor edx,edx - mul bx - xor edx,edx - mov dl,[mosaicsz] - add ax,[MosaicYAdder+edx*2] -%%nomos - mov [m7starty],ax - mov ax,%1 - mov dx,%2 - call drawmode7extbg2 -%endmacro - -SECTION .data -NEWSYM MosaicYAdder, dw 0,0,0,1,0,2,1,0,0,4,2,2,3,1,0,7 - -NEWSYM cwinptr, dd winbgdata - -SECTION .bss -NEWSYM pwinbgenab, resb 1 -NEWSYM pwinbgtype, resd 1 -NEWSYM winonbtype, resb 1 -NEWSYM dualwinbg, resb 1 -NEWSYM pwinspenab, resb 1 -NEWSYM pwinsptype, resd 1 -NEWSYM winonstype, resb 1 -NEWSYM dualwinsp, resb 1 -NEWSYM dwinptrproc, resd 1 -SECTION .text - -; is this macro even used? -%macro ClearWindowData 0 - mov edi,winbgdata+16 - xor eax,eax - mov ecx,64 - rep stosd -%endmacro - -NEWSYM makewindow - ; upon entry, al = win enable bits - cmp byte[disableeffects],1 - je near .finishwin - mov bl,al - and bl,00001010b - cmp bl,00001010b - je near makedualwin - cmp bl,0 - je near .finishwin - mov byte[winon],1 - mov ebx,[winl1] - ; check if data matches previous sprite data - cmp al,[pwinspenab] - jne .skipsprcheck - cmp ebx,[pwinsptype] - jne .skipsprcheck - mov dword[cwinptr],winspdata+16 - mov al,[winonstype] - mov [winon],al - ret -.skipsprcheck - ; check if data matches previous data - cmp al,[pwinbgenab] - jne .skipenab - cmp ebx,[pwinbgtype] - jne .skipenab2 - mov dword[cwinptr],winbgdata+16 - mov al,[winonbtype] - mov [winon],al - ret -.skipenab - mov [pwinbgenab],al - mov ebx,[winl1] -.skipenab2 - mov [pwinbgtype],ebx - mov dl,[winl1] - mov dh,[winr1] - test al,00000010b - jnz .win1 - mov dl,[winl2] - mov dh,[winr2] - shr al,2 -.win1 - test al,01h - jnz near .outside - cmp dl,254 - je .clipped - cmp dl,dh - jb .clip -.clipped - mov byte[winon],0 - mov byte[winonbtype],0 - ret -.clip - mov edi,winbgdata+16 - xor eax,eax - ; start drawing 1's from 0 to left - cmp dl,0 - je .nextdot2 -.nextdot - mov byte[edi+eax],0 - inc al - cmp al,dl - jb .nextdot ; blah -.nextdot2 - mov byte[edi+eax],1 - inc al - cmp al,dh - jb .nextdot2 - mov byte[edi+eax],1 - cmp dh,255 - je .nextdot4 - ; start drawing 1's from right to 255 -.nextdot3 - mov byte[edi+eax],0 - inc al - jnz .nextdot3 -.nextdot4 - mov byte[winon],1 - mov byte[winonbtype],1 - mov dword[cwinptr],winbgdata+16 - ret -.outside - cmp dl,dh - jb .clip2 - mov byte[winon],0FFh - mov byte[winonbtype],0FFh - mov dword[cwinptr],winbgdata+16 - ret -.clip2 - cmp dl,1 - ja .nooutclip - cmp dh,254 - jae near .clipped -.nooutclip - mov edi,winbgdata+16 - xor eax,eax - ; start drawing 1's from 0 to left -.nextdoti - mov byte[edi+eax],1 - inc al - cmp al,dl - jb .nextdoti -.nextdot2i - mov byte[edi+eax],0 - inc al - cmp al,dh - jb .nextdot2i - mov byte[edi+eax],0 - cmp al,255 - je .nextdot4i - inc al - ; start drawing 1's from right to 255 -.nextdot3i - mov byte[edi+eax],1 - inc al - jnz .nextdot3i -.nextdot4i - mov byte[winon],1 - mov byte[winonbtype],1 - mov dword[cwinptr],winbgdata+16 - ret -.finishwin - ret - -NEWSYM makedualwin - mov ecx,ebp - shl cl,1 - mov dl,[winlogica] - shr dl,cl - and dl,03h - mov cl,dl - mov byte[winon],1 - mov ebx,[winl1] - ; check if data matches previous sprite data - cmp cl,[dualwinsp] - jne .skipsprcheck - cmp al,[pwinspenab] - jne .skipsprcheck - cmp ebx,[pwinsptype] - jne .skipsprcheck - mov dword[cwinptr],winspdata+16 - mov al,[winonstype] - mov [winon],al - ret -.skipsprcheck - ; check if data matches previous data - cmp cl,[dualwinbg] - jne .skipenab3 - cmp al,[pwinbgenab] - jne .skipenab - cmp ebx,[pwinbgtype] - jne .skipenab2 - mov dword[cwinptr],winbgdata+16 - mov al,[winonbtype] - mov [winon],al - ret -.skipenab3 - mov [dualwinbg],cl -.skipenab - mov [pwinbgenab],al - mov ebx,[winl1] -.skipenab2 - mov [pwinbgtype],ebx - mov dword[dwinptrproc],winbgdata+16 - mov dword[cwinptr],winbgdata+16 - mov byte[winon],1 - mov byte[winonbtype],1 - -NEWSYM dualstartprocess - - mov dl,[winl1] - mov dh,[winr1] - - push eax - push ecx - test al,01h - jnz near .outside - cmp dl,254 - je .clipped - cmp dl,dh - jb .clip -.clipped - mov edi,[dwinptrproc] - xor eax,eax - mov ecx,64 - rep stosd - jmp .donextwin -.clip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left - cmp dl,0 - je .nextdot2 -.nextdot - mov byte[edi+eax],0 - inc al - cmp al,dl - jbe .nextdot -.nextdot2 - mov byte[edi+eax],1 - inc al - cmp al,dh - jb .nextdot2 - mov byte[edi+eax],1 - cmp dh,255 - je .nextdot4 - ; start drawing 1's from right to 255 -.nextdot3 - mov byte[edi+eax],0 - inc al - jnz .nextdot3 -.nextdot4 - jmp .donextwin -.outside - cmp dl,dh - jb .clip2 - mov edi,[dwinptrproc] - mov eax,01010101h - mov ecx,64 - rep stosd - jmp .donextwin -.clip2 - cmp dl,1 - ja .nooutclip - cmp dh,254 - jae near .clipped -.nooutclip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left -.nextdoti - mov byte[edi+eax],1 - inc al - cmp al,dl - jb .nextdoti -.nextdot2i - mov byte[edi+eax],0 - inc al - cmp al,dh - jb .nextdot2i - mov byte[edi+eax],0 - cmp al,255 - je .nextdot4i - inc al - ; start drawing 1's from right to 255 -.nextdot3i - mov byte[edi+eax],1 - inc al - jnz .nextdot3i -.nextdot4i -.donextwin - pop ecx - pop eax - cmp cl,0 - je near dualwinor - cmp cl,2 - je near dualwinxor - cmp cl,3 - je near dualwinxnor - -NEWSYM dualwinand - mov dl,[winl2] - mov dh,[winr2] - test al,04h - jnz near .outside - cmp dl,254 - je .clipped - cmp dl,dh - jb .clip -.clipped - mov edi,[dwinptrproc] - xor eax,eax - mov ecx,64 - rep stosd - jmp .donextwin -.clip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left - cmp dl,0 - je .nextdot2 -.nextdot - mov byte[edi+eax],0 - inc al - cmp al,dl - jbe .nextdot -.nextdot2 - and byte[edi+eax],1 - inc al - cmp al,dh - jb .nextdot2 - and byte[edi+eax],1 - cmp dh,255 - je .nextdot4 - ; start drawing 1's from right to 255 -.nextdot3 - mov byte[edi+eax],0 - inc al - jnz .nextdot3 -.nextdot4 - jmp .donextwin -.outside - cmp dl,dh - jb .clip2 - jmp .donextwin -.clip2 - cmp dl,1 - ja .nooutclip - cmp dh,254 - jae near .clipped -.nooutclip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left -.nextdoti - and byte[edi+eax],1 - inc al - cmp al,dl - jb .nextdoti -.nextdot2i - mov byte[edi+eax],0 - inc al - cmp al,dh - jb .nextdot2i - mov byte[edi+eax],0 - cmp al,255 - je .nextdot4i - inc al - ; start drawing 1's from right to 255 -.nextdot3i - and byte[edi+eax],1 - inc al - jnz .nextdot3i -.nextdot4i -.donextwin - ret - -NEWSYM dualwinor - mov dl,[winl2] - mov dh,[winr2] - test al,04h - jnz near .outside - cmp dl,254 - je .clipped - cmp dl,dh - jb .clip -.clipped - jmp .donextwin -.clip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left - cmp dl,0 - je .nextdot2 - mov al,dl - inc al -.nextdot2 - mov byte[edi+eax],1 - inc al - cmp al,dh - jb .nextdot2 - mov byte[edi+eax],1 - jmp .donextwin -.outside - cmp dl,dh - jb .clip2 - mov edi,[dwinptrproc] - mov eax,01010101h - mov ecx,64 - rep stosd - jmp .donextwin -.clip2 - cmp dl,1 - ja .nooutclip - cmp dh,254 - jae near .clipped -.nooutclip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left -.nextdoti - mov byte[edi+eax],1 - inc al - cmp al,dl - jb .nextdoti - mov al,dh - cmp al,255 - je .nextdot4i - inc al - ; start drawing 1's from right to 255 -.nextdot3i - mov byte[edi+eax],1 - inc al - jnz .nextdot3i -.nextdot4i -.donextwin - ret - -NEWSYM dualwinxor - mov dl,[winl2] - mov dh,[winr2] - test al,04h - jnz near .outside - cmp dl,254 - je .clipped - cmp dl,dh - jb .clip -.clipped - jmp .donextwin -.clip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left - cmp dl,0 - je .nextdot2 - mov al,dl - inc al -.nextdot2 - xor byte[edi+eax],1 - inc al - cmp al,dh - jb .nextdot2 - xor byte[edi+eax],1 - jmp .donextwin -.outside - cmp dl,dh - jb .clip2 - mov edi,[dwinptrproc] - mov ecx,64 -.loopxor - xor dword[edi],01010101h - add edi,4 - dec ecx - jnz .loopxor - jmp .donextwin -.clip2 - cmp dl,1 - ja .nooutclip - cmp dh,254 - jae near .clipped -.nooutclip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left -.nextdoti - xor byte[edi+eax],1 - inc al - cmp al,dl - jb .nextdoti - mov al,dh - cmp al,255 - je .nextdot4i - inc al - ; start drawing 1's from right to 255 -.nextdot3i - xor byte[edi+eax],1 - inc al - jnz .nextdot3i -.nextdot4i -.donextwin - ret - -NEWSYM dualwinxnor - mov dl,[winl2] - mov dh,[winr2] - test al,04h - jnz near .outside - cmp dl,254 - je .clipped - cmp dl,dh - jb .clip -.clipped - jmp .donextwin -.clip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left - cmp dl,0 - je .nextdot2 - mov al,dl - inc al -.nextdot2 - xor byte[edi+eax],1 - inc al - cmp al,dh - jb .nextdot2 - xor byte[edi+eax],1 - jmp .donextwin -.outside - cmp dl,dh - jb .clip2 - mov edi,[dwinptrproc] - mov ecx,64 -.loopxor - xor dword[edi],01010101h - add edi,4 - dec ecx - jnz .loopxor - jmp .donextwin -.clip2 - cmp dl,1 - ja .nooutclip - cmp dh,254 - jae near .clipped -.nooutclip - mov edi,[dwinptrproc] - xor eax,eax - ; start drawing 1's from 0 to left -.nextdoti - xor byte[edi+eax],1 - inc al - cmp al,dl - jb .nextdoti - mov al,dh - cmp al,255 - je .nextdot4i - inc al - ; start drawing 1's from right to 255 -.nextdot3i - xor byte[edi+eax],1 - inc al - jnz .nextdot3i -.nextdot4i -.donextwin - mov edi,[dwinptrproc] - mov ecx,64 -.loopxor2 - xor dword[edi],01010101h - add edi,4 - dec ecx - jnz .loopxor2 - ret - -SECTION .bss -NEWSYM winonsp, resb 1 -SECTION .text - -NEWSYM makewindowsp - mov al,[winobjen] - mov byte[winonsp],0 - test dword[winenabm],1010h - jz near .finishwin - ; upon entry, al = win enable bits - cmp byte[disableeffects],1 - je near .finishwin - mov bl,al - and bl,00001010b - cmp bl,00001010b - je near makedualwinsp - cmp bl,0 - je near .finishwin - mov byte[winonsp],1 - ; check if data matches previous data - cmp al,[pwinspenab] - jne .skipenab - mov ebx,[winl1] - cmp ebx,[pwinsptype] - jne .skipenab2 - mov dword[cwinptr],winspdata+16 - mov al,[winonstype] - mov [winonsp],al - ret -.skipenab - mov [pwinspenab],al - mov ebx,[winl1] -.skipenab2 - mov [pwinsptype],ebx - mov dl,[winl1] - mov dh,[winr1] - test al,00000010b - jnz .win1 - mov dl,[winl2] - mov dh,[winr2] - shr al,2 -.win1 - test al,01h - jnz near .outside - cmp dl,254 - je .clipped - cmp dl,dh - jb .clip -.clipped - mov byte[winonsp],0 - mov byte[winonstype],0 - ret -.clip - mov edi,winspdata+16 - xor eax,eax - ; start drawing 1's from 0 to left - cmp dl,0 - je .nextdot2 -.nextdot - mov byte[edi+eax],0 - inc al - cmp al,dl - jbe .nextdot -.nextdot2 - mov byte[edi+eax],1 - inc al - cmp al,dh - jb .nextdot2 - mov byte[edi+eax],1 - cmp dh,255 - je .nextdot4 - ; start drawing 1's from right to 255 -.nextdot3 - mov byte[edi+eax],0 - inc al - jnz .nextdot3 -.nextdot4 - mov byte[winonsp],1 - mov byte[winonstype],1 - mov dword[cwinptr],winspdata+16 - ret -.outside - cmp dl,dh - jb .clip2 - mov byte[winonsp],0FFh - mov byte[winonstype],0FFh - mov dword[cwinptr],winspdata+16 - ret -.clip2 - cmp dl,1 - ja .nooutclip - cmp dh,254 - jae near .clipped -.nooutclip - mov edi,winspdata+16 - xor eax,eax - ; start drawing 1's from 0 to left -.nextdoti - mov byte[edi+eax],1 - inc al - cmp al,dl - jb .nextdoti -.nextdot2i - mov byte[edi+eax],0 - inc al - cmp al,dh - jb .nextdot2i - mov byte[edi+eax],0 - cmp al,255 - je .nextdot4i - inc al - ; start drawing 1's from right to 255 -.nextdot3i - mov byte[edi+eax],1 - inc al - jnz .nextdot3i -.nextdot4i - mov byte[winonsp],1 - mov byte[winonstype],1 - mov dword[cwinptr],winspdata+16 - ret -.finishwin - ret - -NEWSYM makedualwinsp - mov ecx,ebp - shl cl,1 - mov dl,[winlogicb] - and dl,03h - mov cl,dl - mov byte[winonsp],1 - ; check if data matches previous data - cmp cl,[dualwinsp] - jne .skipenab3 - cmp al,[pwinspenab] - jne .skipenab - mov ebx,[winl1] - cmp ebx,[pwinsptype] - jne .skipenab2 - mov dword[cwinptr],winspdata+16 - mov al,[winonstype] - mov [winonsp],al - ret -.skipenab3 - mov [dualwinsp],cl -.skipenab - mov [pwinspenab],al - mov ebx,[winl1] -.skipenab2 - mov [pwinsptype],ebx - mov dword[dwinptrproc],winspdata+16 - mov dword[cwinptr],winspdata+16 - mov byte[winonsp],1 - mov byte[winonstype],1 - jmp dualstartprocess - -; window logic data -SECTION .bss -NEWSYM windowdata, resb 16 -NEWSYM numwin, resb 1 -NEWSYM multiwin, resb 1 -NEWSYM multiclip, resb 1 -NEWSYM multitype, resb 1 -SECTION .text - -; jmp .finishwin -%macro procwindow 1 - cmp byte[disableeffects],1 - je near .finishwin - mov al,%1 - test al,00001010b - jz near .finishwin - mov esi,windowdata - mov bl,al - mov byte[winon],1 - and bl,00001010b - and al,00000101b - mov byte[numwin],0 - cmp bl,00001010b - je near .multiwin - mov byte[multiwin],0 - test bl,00000010b - jnz .win1 - mov cl,[winl2] - mov ch,[winr2] - shr al,2 - jmp .okaywin -.win1 - mov cl,[winl1] - mov ch,[winr1] - and al,01h -.okaywin - cmp ch,255 - je .noinc - inc ch -.noinc - test al,01h - jnz .wininside - cmp cl,ch - jae .noinsidemask - mov [esi],cl - mov byte[esi+1],01h - mov [esi+2],ch - mov byte[esi+3],0FFh - mov byte[numwin],2 - jmp .finishwin -.noinsidemask - mov byte[winon],0 - jmp .finishwin -.wininside - cmp cl,ch - ja .nooutsidemask -.nonotoutside - cmp ch,254 - jb .skipnodraw - cmp cl,1 - jbe .noinsidemask -.skipnodraw - mov byte[esi],0 - mov byte[esi+1],01h - mov [esi+2],cl - mov byte[esi+3],0FFh - mov [esi+4],ch - mov byte[esi+5],01h - mov byte[numwin],3 - jmp .finishwin -.nooutsidemask - mov byte[esi],0 - mov byte[esi+1],01h - mov byte[numwin],1 - jmp .finishwin - ; ************** - ; *Multiwindows* - ; ************** -.multiwin - mov byte[winon],0 - mov byte[multiwin],0 - mov [multiclip],al - mov al,[winlogica] - mov ecx,ebp - shl ecx,1 - shr al,cl - and al,3h - mov [multitype],al - mov cl,[winl1] - mov ch,[winr1] - mov esi,windowdata - cmp ch,255 - je .noinc2 - inc ch -.noinc2 - test byte[multiclip],01h - jnz .wininside2 - cmp cl,ch - jae .nowina - mov [esi],cl - mov byte[esi+1],01h - mov [esi+2],ch - mov byte[esi+3],0FFh - add esi,4 - mov byte[numwin],2 - jmp .secondwin -.nowina - mov cl,[winl2] - mov ch,[winr2] - mov al,[multiclip] - shr al,2 - jmp .okaywin -.wininside2 - cmp cl,ch - ja .nooutsidemask2 - cmp ch,254 - jb .skipnodraw2 - cmp cl,1 - jbe .nooutsidemask2 -.skipnodraw2 - mov byte[esi],0 - mov byte[esi+1],01h - mov [esi+2],cl - mov byte[esi+3],0FFh - mov [esi+4],ch - mov byte[esi+5],01h - mov byte[numwin],3 - jmp .secondwin -.nooutsidemask2 - mov byte[esi],0 - mov byte[esi+1],01h - mov byte[numwin],1 -.secondwin - mov byte[multiwin],1 - mov byte[winon],1 -.finishwin -%endmacro - -NEWSYM procspritessub - test byte[scrndis],10h - jnz .nosprites - test byte[scrnon+1],10h - jz .nosprites - test byte[scrnon],10h - jnz .nosprites - cmp byte[winonsp],0FFh - je .nosprites - xor ebx,ebx - mov bl,[curypos] - add ebx,[cursprloc] - mov cl,[ebx] - cmp byte[sprprifix],0 - jne .sprprio - add dword[cursprloc],256 -.sprprio - or cl,cl - jz .nosprites - call drawsprites -.nosprites - ret - -NEWSYM procspritesmain - test byte[scrndis],10h - jnz .nosprites - test byte[scrnon],10h - jz .nosprites - cmp byte[winonsp],0FFh - je .nosprites - xor ebx,ebx - mov bl,[curypos] - add ebx,[cursprloc] - mov cl,[ebx] - cmp byte[sprprifix],0 - jne .sprprio - add dword[cursprloc],256 -.sprprio - or cl,cl - jz .nosprites - call drawsprites -.nosprites - ret - -SECTION .bss -NEWSYM curbgnum, resb 1 -SECTION .text - -NEWSYM drawbackgrndsub - mov esi,[colormodeofs] - mov bl,[esi+ebp] - cmp bl,0 - je near .noback - mov al,[curbgnum] - test byte[scrnon+1],al - jz near .noback - test byte[scrnon],al - jnz near .noback - test byte[alreadydrawn],al - jnz near .noback - test byte[scrndis],al - jnz near .noback - mov byte[winon],0 - test byte[winenabs],al - jz near .nobackwin -; procwindow [winbg1en+ebp] - mov al,[winbg1en+ebp] - call makewindow - cmp byte[winon],0FFh - je near .noback -.nobackwin - mov bl,[curbgnum] - mov byte[curmosaicsz],1 - test byte[mosaicon],bl - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl -.nomos - mov byte[bgcoloradder],0 - cmp byte[bgmode],0 - jne .nomode0 - mov eax,ebp - shl eax,5 - mov [bgcoloradder],al -.nomode0 - mov esi,[bg1vbufloc+ebp*4] - mov edi,[bg1tdatloc+ebp*4] - mov edx,[bg1tdabloc+ebp*4] - mov ebx,[bg1cachloc+ebp*4] - mov eax,[bg1xposloc+ebp*4] - mov cl,[curbgnum] - test byte[bgtilesz],cl - jnz .16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw8x8 - cmp byte[drawn],33 - jne .notalldrawn - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawn - jmp .noback -.16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw16x16 - cmp byte[drawn],33 - jne .notalldrawnb - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnb -.noback - ret - -NEWSYM drawbackgrndmain - mov esi,[colormodeofs] - mov bl,[esi+ebp] - cmp bl,0 - je near .noback - mov al,[curbgnum] - test byte[scrnon],al - jz near .noback - test byte[alreadydrawn],al - jnz near .noback - test byte[scrndis],al - jnz near .noback - mov byte[winon],0 - test byte[winenabm],al - jz near .nobackwin -; procwindow [winbg1en+ebp] - mov al,[winbg1en+ebp] - call makewindow - cmp byte[winon],0FFh - je near .noback -.nobackwin - mov bl,[curbgnum] - mov byte[curmosaicsz],1 - test byte[mosaicon],bl - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl -.nomos - mov byte[bgcoloradder],0 - cmp byte[bgmode],0 - jne .nomode0 - mov eax,ebp - shl eax,5 - mov [bgcoloradder],al -.nomode0 - mov esi,[bg1vbufloc+ebp*4] - mov edi,[bg1tdatloc+ebp*4] - mov edx,[bg1tdabloc+ebp*4] - mov ebx,[bg1cachloc+ebp*4] - mov eax,[bg1xposloc+ebp*4] - mov cl,[curbgnum] - test byte[bgtilesz],cl - jnz .16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw8x8 - cmp byte[drawn],33 - jne .notalldrawn - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawn - jmp .noback -.16x16 - mov ecx,[bg1yaddval+ebp*4] - call draw16x16 - cmp byte[drawn],33 - jne .notalldrawnb - mov al,[curbgnum] - or [alreadydrawn],al -.notalldrawnb -.noback - ret - -NEWSYM procbackgrnd - mov esi,[colormodeofs] - mov bl,[esi+ebp] - cmp bl,0 - je near .noback - mov al,[curbgnum] - mov ah,al - test byte[scrndis],al - jnz near .noback - test [scrnon],ax - jz near .noback - push ebp - shl ebp,6 - mov edi,cachebg1 - add edi,ebp - pop ebp - cmp bl,[curcolbg1+ebp] - je .skipclearcache - mov [curcolbg1+ebp],bl - mov ax,[bg1ptr+ebp*2] - mov [curbgofs1+ebp*2],ax - call fillwithnothing -.skipclearcache - xor eax,eax - mov [curcolor],bl - mov ax,[bg1objptr+ebp*2] - decideonmode - add edx,eax - xor eax,eax - mov [tempcach],edx - xor edx,edx - mov ax,[bg1objptr+ebp*2] - mov [curtileptr],ax - mov ax,[bg1ptr+ebp*2] - mov [bgptr],ax - cmp ax,[curbgofs1+ebp*2] - je .skipclearcacheb - mov [curbgofs1+ebp*2],ax - call fillwithnothing -.skipclearcacheb - mov ax,[bg1ptrb+ebp*2] - mov [bgptrb],ax - mov ax,[bg1ptrc+ebp*2] - mov [bgptrc],ax - mov ax,[bg1ptrd+ebp*2] - mov [bgptrd],ax - mov bl,[curbgnum] - mov ax,[curypos] - - mov byte[curmosaicsz],1 - test byte[mosaicon],bl - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor edx,edx - xor bh,bh - div bx - xor edx,edx - mul bx - xor edx,edx - mov dl,[mosaicsz] - add ax,[MosaicYAdder+edx*2] -.nomos - - add ax,[bg1scroly+ebp*2] - mov dx,[bg1scrolx+ebp*2] - mov cl,[curbgnum] - test byte[bgtilesz],cl - jnz .16x16 - call proc8x8 - mov [bg1vbufloc+ebp*4],esi - mov [bg1tdatloc+ebp*4],edi - mov [bg1tdabloc+ebp*4],edx - mov [bg1cachloc+ebp*4],ebx - mov [bg1yaddval+ebp*4],ecx - mov [bg1xposloc+ebp*4],eax - ret -.16x16 - call proc16x16 - mov [bg1vbufloc+ebp*4],esi - mov [bg1tdatloc+ebp*4],edi - mov [bg1tdabloc+ebp*4],edx - mov [bg1cachloc+ebp*4],ebx - mov [bg1yaddval+ebp*4],ecx - mov [bg1xposloc+ebp*4],eax -.noback - ret - -SECTION .bss -NEWSYM nextprimode, resb 1 -NEWSYM cursprloc, resd 1 -NEWSYM curcolor, resb 1 -NEWSYM curtileptr, resw 1 -; esi = pointer to video buffer -; edi = pointer to tile data -; ebx = cached memory -; al = current x position -NEWSYM bg1vbufloc, resd 1 -NEWSYM bg2vbufloc, resd 1 -NEWSYM bg3vbufloc, resd 1 -NEWSYM bg4vbufloc, resd 1 -NEWSYM bg1tdatloc, resd 1 -NEWSYM bg2tdatloc, resd 1 -NEWSYM bg3tdatloc, resd 1 -NEWSYM bg4tdatloc, resd 1 -NEWSYM bg1tdabloc, resd 1 -NEWSYM bg2tdabloc, resd 1 -NEWSYM bg3tdabloc, resd 1 -NEWSYM bg4tdabloc, resd 1 -NEWSYM bg1cachloc, resd 1 -NEWSYM bg2cachloc, resd 1 -NEWSYM bg3cachloc, resd 1 -NEWSYM bg4cachloc, resd 1 -NEWSYM bg1yaddval, resd 1 -NEWSYM bg2yaddval, resd 1 -NEWSYM bg3yaddval, resd 1 -NEWSYM bg4yaddval, resd 1 -NEWSYM bg1xposloc, resd 1 -NEWSYM bg2xposloc, resd 1 -NEWSYM bg3xposloc, resd 1 -NEWSYM bg4xposloc, resd 1 -NEWSYM alreadydrawn, resb 1 -SECTION .text - -NEWSYM fillwithnothing - push edi - xor eax,eax - mov ecx,16 -.loop - mov [edi],eax - add edi,4 - dec ecx - jnz .loop - pop edi - ret - -SECTION .bss -NEWSYM bg3draw, resb 1 -NEWSYM maxbr, resb 1 -SECTION .text - -NEWSYM blanker - ; calculate current video offset - push ebx - push esi - xor ebx,ebx - mov bx,[curypos] - mov esi,ebx - shl esi,8 - shl ebx,5 - add esi,ebx - add esi,16 - add esi,[vidbuffer] - mov bl,64 -.next - mov dword[esi],0 - add esi,4 - dec bl - jnz .next - pop esi - pop ebx - ret - -ALIGN32 -SECTION .bss -NEWSYM bg3high2, resd 1 -NEWSYM cwinenabm, resd 1 -SECTION .text - -NEWSYM drawline - mov al,[winenabs] - mov [cwinenabm],al - - mov byte[bg3high2],0 - cmp byte[bgmode],1 - jne .nohigh - mov al,[bg3highst] - mov [bg3high2],al -.nohigh - cmp byte[cbitmode],1 - je near drawline16b - mov al,[vidbright] - cmp al,[maxbr] - jbe .nochange - mov [maxbr],al -.nochange - cmp byte[ForceNewGfxOff],0 - jne .nonewgfx - cmp byte[newengen],1 - je near newengine8b -.nonewgfx - cmp byte[forceblnk],0 - jne near blanker - mov byte[alreadydrawn],0 -; cmp byte[curypos],70 -; jne .no -; push ebx -; mov bl,[winlogica] -; mov [bg1sx],bl -; pop ebx -;.no - push ebx - xor ebx,ebx - mov bl,[bgmode] - shl bl,2 - add ebx,colormodedef - mov [colormodeofs],ebx - pop ebx - - cmp byte[bgmode],7 - je near processmode7 - - mov al,[scrnon] - test [scrnon+1],al - jz .nomainsub - test byte[scrnon],10h - jnz .nomainsub - test byte[scrnon+1],10h - jz .nomainsub - mov al,[scrnon+1] - xor al,0FFh - and [scrnon],al -.nomainsub - - push esi - push edi - push ebx - push edx - push ebp - ; calculate current video offset - xor ebx,ebx - mov bx,[curypos] - mov esi,ebx - shl esi,8 - shl ebx,5 - add esi,ebx - add esi,16 - add esi,[vidbuffer] - mov [curvidoffset],esi - ; clear video buffer - mov edi,esi - mov ecx,64 - xor eax,eax - rep stosd - ; do sprite windowing - call makewindowsp - ; get current sprite table - xor ebx,ebx - mov bl,[curypos] - shl ebx,9 - add ebx,[spritetablea] - mov [currentobjptr],ebx - mov dword[cursprloc],sprleftpr - ; setup priorities - cmp byte[sprprifix],0 - je .nosprprio - mov dword[cursprloc],sprlefttot - call preparesprpr -.nosprprio - ; clear registers - xor eax,eax - xor ecx,ecx -; process backgrounds -; do background 2 - mov byte[curbgnum],02h - mov ebp,01h - call procbackgrnd -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call procbackgrnd -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call procbackgrnd -; do background 3 - mov byte[curbgnum],04h - mov ebp,02h - call procbackgrnd - - cmp byte[bgmode],1 - ja near priority2 - test byte[scaddset],02h - jz near .nosubsc -; draw backgrounds - mov byte[curbgpr],0h -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndsub -; do background 3 - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndsub - mov ebp,0 - call procspritessub - mov byte[curbgpr],20h -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndsub -; do background 3 - cmp byte[bg3high2],1 - je .bg3nothigh - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndsub -.bg3nothigh - mov ebp,1 - call procspritessub -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndsub -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndsub - mov ebp,2 - call procspritessub -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndsub -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndsub - mov ebp,3 - call procspritessub - cmp byte[bg3high2],1 - jne .bg3high -; do background 3 - mov byte[curbgpr],20h - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndsub -.bg3high - -.nosubsc - mov al,[winenabm] - mov [cwinenabm],al - mov byte[curbgpr],0h - -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndmain -; do background 3 - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndmain - mov ebp,0 - call procspritesmain - mov byte[curbgpr],20h -; do background 4 - mov byte[curbgnum],08h - mov ebp,03h - call drawbackgrndmain -; do background 3 - cmp byte[bg3high2],1 - je .bg3nothighb - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndmain -.bg3nothighb - mov ebp,1 - call procspritesmain -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain - mov ebp,2 - call procspritesmain -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain - mov ebp,3 - call procspritesmain - cmp byte[bg3high2],1 - jne .bg3highb -; do background 3 - mov byte[curbgpr],20h - mov byte[curbgnum],04h - mov ebp,02h - call drawbackgrndmain -.bg3highb - pop ebp - pop edx - pop ebx - pop edi - pop esi - xor eax,eax - xor ecx,ecx -NEWSYM nodrawline - ret - -NEWSYM priority2 - test byte[scaddset],02h - jz near .nosubsc -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndsub - mov ebp,0 - call procspritessub -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndsub - mov ebp,1 - call procspritessub -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndsub - mov ebp,2 - call procspritessub -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndsub - mov ebp,3 - call procspritessub -.nosubsc - mov al,[winenabm] - mov [cwinenabm],al -; do background 2 - mov byte[curbgpr],0h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain - mov ebp,0 - call procspritesmain -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain - mov ebp,1 - call procspritesmain -; do background 2 - mov byte[curbgpr],20h - mov byte[curbgnum],02h - mov ebp,01h - call drawbackgrndmain - mov ebp,2 - call procspritesmain -; do background 1 - mov byte[curbgnum],01h - mov ebp,00h - call drawbackgrndmain - mov ebp,3 - call procspritesmain - pop ebp - pop edx - pop ebx - pop edi - pop esi - xor eax,eax - xor ecx,ecx - ret - -ALIGN32 -SECTION .bss -NEWSYM tempbuffer, resd 33 -NEWSYM currentobjptr, resd 1 -NEWSYM curmosaicsz, resd 1 -NEWSYM extbgdone, resb 1 -SECTION .text - - -NEWSYM processmode7 - mov al,[winenabm] - mov [cwinenabm],al - push esi - push edi - push ebx - push edx - push ebp - ; get current sprite table - xor ebx,ebx - mov bl,[curypos] - shl ebx,9 - add ebx,[spritetablea] - mov [currentobjptr],ebx - ; setup priorities - cmp byte[sprprifix],0 - je .nosprprio - mov dword[cursprloc],sprlefttot - call preparesprpr -.nosprprio - ; calculate current video offset - xor ebx,ebx - mov bx,[curypos] - mov esi,ebx - shl esi,8 - shl ebx,5 - add esi,ebx - add esi,16 - add esi,[vidbuffer] - mov [curvidoffset],esi - ; clear video buffer - mov edi,esi - mov ecx,64 - xor eax,eax - rep stosd - ; do sprite windowing - call makewindowsp - ; clear registers - xor eax,eax - xor ecx,ecx - - mov byte[extbgdone],0 - - test byte[interlval],40h - jz near .noback0 - test byte[scrndis],02h - jnz near .noback0 - ; do background 1, extbg pr 0 - test word[scrnon],0202h - jz near .noback0 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin0 - test word[winenabm],0100h - jnz near .nobackwin0 - mov ebp,0 - mov al,[winbg1en] - call makewindow - cmp byte[winon],0FFh - je near .noback0 -.nobackwin0 - mov byte[extbgdone],1 - procmode7extbg [bg1scroly_m7],[bg1scrolx_m7],1 -.noback0 - - ; do objects - test byte[scrndis],10h - jnz near .nosprites1 - test word[scrnon],1010h - jz near .nosprites1 - cmp byte[winonsp],0FFh - je .nosprites1 - xor ebx,ebx - mov bl,[curypos] - mov cl,[sprleftpr+ebx] - cmp byte[sprprifix],0 - je .nosprprio2 - mov cl,[sprlefttot+ebx] -.nosprprio2 - cmp cl,0 - je .nosprites1 - mov ebp,0 - call drawsprites -.nosprites1 - - ; display mode7 - test byte[interlval],40h - jnz near .noback1 - test byte[scrndis],01h - jnz near .noback1 - ; do background 1 - test word[scrnon],0101h - jz near .noback1 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin1 - test word[winenabm],0100h - jnz near .nobackwin1 - mov ebp,0 - mov al,[winbg1en] - call makewindow - cmp byte[winon],0FFh - je near .noback1 -.nobackwin1 - procmode7 [bg1scroly_m7],[bg1scrolx_m7],1 -.noback1 - - ; do objects - test byte[scrndis],10h - jnz near .nosprites2 - test word[scrnon],1010h - jz near .nosprites2 - cmp byte[winonsp],0FFh - je .nosprites2 - xor ebx,ebx - mov bl,[curypos] - mov cl,[sprleftpr1+ebx] - cmp byte[sprprifix],0 - je .nosprprio3 - mov cl,[sprlefttot+ebx] -.nosprprio3 - cmp cl,0 - je .nosprites2 - mov ebp,1 - call drawsprites -.nosprites2 - - test byte[interlval],40h - jz near .noback0b - cmp byte[extbgdone],0 - jne near .noback0b - test byte[scrndis],02h - jnz near .noback0b - ; do background 1, extbg pr 0 - test word[scrnon],0101h - jz near .noback0b - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin0b - test word[winenabm],0100h - jnz near .nobackwin0b - mov ebp,0 - mov al,[winbg1en] - call makewindow - cmp byte[winon],0FFh - je near .noback0b -.nobackwin0b - mov byte[extbgdone],1 - procmode7extbg [bg1scroly_m7],[bg1scrolx_m7],1 -.noback0b - - test byte[interlval],40h - jz near .noback2 - cmp byte[extbgdone],1 - jne near .noback2 - mov byte[winon],0 - test word[winenabm],0001h - jz near .nobackwin2 - test word[winenabm],0100h - jnz near .nobackwin2 - mov ebp,0 - mov al,[winbg1en] - call makewindow - cmp byte[winon],0FFh - je near .noback2 -.nobackwin2 - procmode7extbg2 [bg1scroly_m7],[bg1scrolx_m7],1 -.noback2 - - ; do objects - test byte[scrndis],10h - jnz near .nosprites3 - test word[scrnon],1010h - jz near .nosprites3 - cmp byte[winonsp],0FFh - je .nosprites3 - xor ebx,ebx - mov bl,[curypos] - mov cl,[sprleftpr2+ebx] - cmp byte[sprprifix],0 - je .nosprprio4 - mov cl,[sprlefttot+ebx] -.nosprprio4 - cmp cl,0 - je .nosprites3 - mov ebp,2 - call drawsprites -.nosprites3 - ; do objects - test byte[scrndis],10h - jnz near .nosprites4 - test word[scrnon],1010h - jz near .nosprites4 - cmp byte[winonsp],0FFh - je .nosprites4 - xor ebx,ebx - mov bl,[curypos] - mov cl,[sprleftpr3+ebx] - cmp byte[sprprifix],0 - je .nosprprio5 - mov cl,[sprlefttot+ebx] -.nosprprio5 - cmp cl,0 - je .nosprites4 - mov ebp,3 - call drawsprites -.nosprites4 - pop ebp - pop edx - pop ebx - pop edi - pop esi - ret - -;******************************************************* -; Processes & Draws 4-bit sprites -;******************************************************* - -NEWSYM drawsprites - cmp byte[sprprifix],1 - je near drawspritesprio -.returnfrompr - test byte[cwinenabm],10h - jz .drawnowin - cmp byte[winonsp],0 - jne near drawspriteswinon -.drawnowin - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - mov eax,[esi] - test al,0Fh - jz .skipa - add al,ch - mov [edi+ebx-8],al -.skipa - test ah,0Fh - jz .skipb - add ah,ch - mov [edi+ebx-7],ah -.skipb - shr eax,16 - test al,0Fh - jz .skipc - add al,ch - mov [edi+ebx-6],al -.skipc - test ah,0Fh - jz .skipd - add ah,ch - mov [edi+ebx-5],ah -.skipd - mov eax,[esi+4] - test al,0Fh - jz .skipe - add al,ch - mov [edi+ebx-4],al -.skipe - test ah,0Fh - jz .skipf - add ah,ch - mov [edi+ebx-3],ah -.skipf - shr eax,16 - test al,0Fh - jz .skipg - add al,ch - mov [edi+ebx-2],al -.skipg - test ah,0Fh - jz .skiph - add ah,ch - mov [edi+ebx-1],ah -.skiph - add edx,8 - mov esi,edx - dec cl - jnz .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - mov eax,[esi] - test al,0Fh - jz .skipa2 - add al,ch - mov [edi+ebx-1],al -.skipa2 - test ah,0Fh - jz .skipb2 - add ah,ch - mov [edi+ebx-2],ah -.skipb2 - shr eax,16 - test al,0Fh - jz .skipc2 - add al,ch - mov [edi+ebx-3],al -.skipc2 - test ah,0Fh - jz .skipd2 - add ah,ch - mov [edi+ebx-4],ah -.skipd2 - mov eax,[esi+4] - test al,0Fh - jz .skipe2 - add al,ch - mov [edi+ebx-5],al -.skipe2 - test ah,0Fh - jz .skipf2 - add ah,ch - mov [edi+ebx-6],ah -.skipf2 - shr eax,16 - test al,0Fh - jz .skipg2 - add al,ch - mov [edi+ebx-7],al -.skipg2 - test ah,0Fh - jz .skiph2 - add ah,ch - mov [edi+ebx-8],ah -.skiph2 - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -NEWSYM drawspriteswinon - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - mov eax,[esi] - test al,0Fh - jz .skipa - cmp byte[winspdata+ebx-8+16],0 - jne .skipa - add al,ch - mov [edi+ebx-8],al -.skipa - test ah,0Fh - jz .skipb - cmp byte[winspdata+ebx-7+16],0 - jne .skipb - add ah,ch - mov [edi+ebx-7],ah -.skipb - shr eax,16 - test al,0Fh - jz .skipc - cmp byte[winspdata+ebx-6+16],0 - jne .skipc - add al,ch - mov [edi+ebx-6],al -.skipc - test ah,0Fh - jz .skipd - cmp byte[winspdata+ebx-5+16],0 - jne .skipd - add ah,ch - mov [edi+ebx-5],ah -.skipd - mov eax,[esi+4] - test al,0Fh - jz .skipe - cmp byte[winspdata+ebx-4+16],0 - jne .skipe - add al,ch - mov [edi+ebx-4],al -.skipe - test ah,0Fh - jz .skipf - cmp byte[winspdata+ebx-3+16],0 - jne .skipf - add ah,ch - mov [edi+ebx-3],ah -.skipf - shr eax,16 - test al,0Fh - jz .skipg - cmp byte[winspdata+ebx-2+16],0 - jne .skipg - add al,ch - mov [edi+ebx-2],al -.skipg - test ah,0Fh - jz .skiph - cmp byte[winspdata+ebx-1+16],0 - jne .skiph - add ah,ch - mov [edi+ebx-1],ah -.skiph - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -.drawspriteflipx - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - mov eax,[esi] - test al,0Fh - jz .skipa2 - cmp byte[winspdata+ebx-1+16],0 - jne .skipa2 - add al,ch - mov [edi+ebx-1],al -.skipa2 - test ah,0Fh - jz .skipb2 - cmp byte[winspdata+ebx-2+16],0 - jne .skipb2 - add ah,ch - mov [edi+ebx-2],ah -.skipb2 - shr eax,16 - test al,0Fh - jz .skipc2 - cmp byte[winspdata+ebx-3+16],0 - jne .skipc2 - add al,ch - mov [edi+ebx-3],al -.skipc2 - test ah,0Fh - jz .skipd2 - cmp byte[winspdata+ebx-4+16],0 - jne .skipd2 - add ah,ch - mov [edi+ebx-4],ah -.skipd2 - mov eax,[esi+4] - test al,0Fh - jz .skipe2 - cmp byte[winspdata+ebx-5+16],0 - jne .skipe2 - add al,ch - mov [edi+ebx-5],al -.skipe2 - test ah,0Fh - jz .skipf2 - cmp byte[winspdata+ebx-6+16],0 - jne .skipf2 - add ah,ch - mov [edi+ebx-6],ah -.skipf2 - shr eax,16 - test al,0Fh - jz .skipg2 - cmp byte[winspdata+ebx-7+16],0 - jne .skipg2 - add al,ch - mov [edi+ebx-7],al -.skipg2 - test ah,0Fh - jz .skiph2 - cmp byte[winspdata+ebx-8+16],0 - jne .skiph2 - add ah,ch - mov [edi+ebx-8],ah -.skiph2 - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - mov [currentobjptr],esi - ret - -NEWSYM drawspritesprio - cmp byte[sprclprio+ebp],0 - je near .endobj - test byte[cwinenabm],10h - jz .drawnowin - cmp byte[winonsp],0 - jne near drawspritespriowinon -.drawnowin - cmp dword[sprsingle],1 - je near .drawsingle - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,ebp - jne near .notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra - pop edx -.nodrawspr - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,ebp - jne near .notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - ret -.drawsingle - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,ecx - and edx,0FFh - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawa sprdrawprb - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 - ret -.drawspriteflipx2 - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawaf sprdrawprb - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 - ret - -NEWSYM drawspritespriowinon - cmp dword[sprsingle],1 - je near .drawsingle - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,ebp - jne near .notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpraw - pop edx -.nodrawspr - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,ebp - jne near .notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpraw - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - ret -.drawsingle - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,ecx - and edx,0FFh - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawa sprdrawprbw - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 - ret -.drawspriteflipx2 - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawaf sprdrawprbw - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 - ret - -SECTION .data -NEWSYM prfixobjl, db 0 -NEWSYM csprbit, db 1 -NEWSYM csprprlft, db 0 -SECTION .text -;******************************************************* -; Processes & Draws 8x8 tiles in 2, 4, & 8 bit mode -;******************************************************* -NEWSYM proc8x8 - cmp byte[bgmode],5 - je near proc16x8 - ; ax = # of rows down - mov ebx,eax - shr eax,3 - and eax,63 - and ebx,07h - cmp byte[edi+eax],0 - jne .nocachereq -;.docache -; cmp byte[ccud],0 -; jne .nocachereq - mov byte[edi+eax],1 - cmp byte[curcolor],2 - jne .no4b - ; cache 4-bit - call cachetile4b - jmp .nocachereq -.no4b - cmp byte[curcolor],1 - je .2b - ; cache 8-bit - call cachetile8b - jmp .nocachereq -.2b - ; cache 2-bit - call cachetile2b -.nocachereq - test edx,0100h - jz .tilexa - test al,20h - jz .tileya - ; bgptrd/bgptrc - mov ecx,[bgptrd] - mov [bgptrx1],ecx - mov ecx,[bgptrc] - mov [bgptrx2],ecx - jmp .skiptile -.tileya - ; bgptrb/bgptra - mov ecx,[bgptrb] - mov [bgptrx1],ecx - mov ecx,[bgptr] - mov [bgptrx2],ecx - jmp .skiptile -.tilexa - test al,20h - jz .tileya2 - ; bgptrc/bgptrd - mov ecx,[bgptrc] - mov [bgptrx1],ecx - mov ecx,[bgptrd] - mov [bgptrx2],ecx - jmp .skiptile -.tileya2 - ; bgptra/bgptrb - mov ecx,[bgptr] - mov [bgptrx1],ecx - mov ecx,[bgptrb] - mov [bgptrx2],ecx -.skiptile - ; set up edi & yadder to point to tile data - shl ebx,3 - mov [yadder],ebx - and al,1Fh - mov edi,[vram] - mov ebx,eax - shl ebx,6 - mov eax,[bgptrx1] - add edi,ebx - mov [temptile],edi - add edi,eax - ; dx = # of columns right - ; cx = bgxlim - mov eax,edx - shr edx,3 - mov bl,[curypos] - and edx,1Fh - mov [temp],dl - and eax,07h - add dl,dl - add edi,edx - - mov esi,eax - mov ebx,[tempcach] - mov edx,[temptile] - mov eax,[bgptrx2] - and eax,0FFFFh - add edx,eax - mov al,[temp] - mov ecx,[yadder] - mov ah,[bshifter] - ; fill up tempbuffer with pointer #s that point to cached video mem - ; to calculate pointer, get first byte - ; esi = pointer to video buffer - ; edi = pointer to tile data - ; ebx = cached memory - ; ecx = y adder - ; edx = secondary tile pointer - ; al = current x position - ret - -NEWSYM proc16x8 - ; ax = # of rows down - mov ebx,eax - shr eax,3 - and ebx,07h - and eax,63 - cmp byte[edi+eax],0 - jne .nocachereq -; cmp byte[ccud],0 -; jne .nocachereq - mov byte[edi+eax],1 - cmp byte[curcolor],2 - jne .no4b - ; cache 4-bit - call cachetile4b16x16 - jmp .nocachereq -.no4b - cmp byte[curcolor],1 - je .2b - ; cache 8-bit - call cachetile8b16x16 - jmp .nocachereq -.2b - ; cache 2-bit - call cachetile2b16x16 -.nocachereq - test edx,0100h - jz .tilexa - test al,20h - jz .tileya - ; bgptrd/bgptrc - mov ecx,[bgptrd] - mov [bgptrx1],ecx - mov ecx,[bgptrc] - mov [bgptrx2],ecx - jmp .skiptile -.tileya - ; bgptrb/bgptra - mov ecx,[bgptrb] - mov [bgptrx1],ecx - mov ecx,[bgptr] - mov [bgptrx2],ecx - jmp .skiptile -.tilexa - test al,20h - jz .tileya2 - ; bgptrc/bgptrd - mov ecx,[bgptrc] - mov [bgptrx1],ecx - mov ecx,[bgptrd] - mov [bgptrx2],ecx - jmp .skiptile -.tileya2 - ; bgptra/bgptrb - mov ecx,[bgptr] - mov [bgptrx1],ecx - mov ecx,[bgptrb] - mov [bgptrx2],ecx -.skiptile - ; set up edi & yadder to point to tile data - shl ebx,3 - mov [yadder],ebx - and al,1Fh - mov edi,[vram] - mov ebx,eax - shl ebx,6 - mov eax,[bgptrx1] - add edi,ebx - mov [temptile],edi - add edi,eax - ; dx = # of columns right - ; cx = bgxlim - mov eax,edx - shr edx,3 - mov bl,[curypos] - and edx,1Fh - mov [temp],dl - and eax,07h - add dl,dl - add edi,edx - - mov esi,eax - mov ebx,[tempcach] - mov edx,[temptile] - mov eax,[bgptrx2] - and eax,0FFFFh - add edx,eax - mov al,[temp] - mov ecx,[yadder] - mov ah,[bshifter] - ; fill up tempbuffer with pointer #s that point to cached video mem - ; to calculate pointer, get first byte - ; esi = pointer to video buffer - ; edi = pointer to tile data - ; ebx = cached memory - ; ecx = y adder - ; edx = secondary tile pointer - ; al = current x position - ret - -SECTION .bss -NEWSYM drawn, resb 1 -NEWSYM curbgpr, resb 1 ; 00h = low priority, 20h = high priority -SECTION .text - -%macro drawpixel8b8x8 3 - or %1,%1 - jz %2 - add %1,dh - mov [esi+%3],%1 -%2 -%endmacro - -%macro drawpixel8b8x8win 3 - or %1,%1 - jz %2 - test byte[ebp+%3],0FFh - jnz %2 - add %1,dh - mov [esi+%3],%1 -%2 -%endmacro - -SECTION .bss -NEWSYM winptrref, resd 1 -SECTION .text - -NEWSYM draw8x8 - cmp byte[osm2dis],1 - je .osm2dis - cmp byte[bgmode],2 - je near draw8x8offset -.osm2dis - cmp byte[bgmode],5 - jae near draw16x8 - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx -.retfromoffset - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw8x8winon -.domosaic - mov ch,33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - or eax,eax - je .skiploop1 - drawpixel8b8x8 al, .loopd1, 0 - drawpixel8b8x8 ah, .loopd2, 1 - mov eax,[ebx+2] - drawpixel8b8x8 al, .loopd3, 2 - drawpixel8b8x8 ah, .loopd4, 3 -.skiploop1 - mov eax,[ebx+4] - or eax,eax - je .skiploop2 - drawpixel8b8x8 al, .loopd5, 4 - drawpixel8b8x8 ah, .loopd6, 5 - mov eax,[ebx+6] - drawpixel8b8x8 al, .loopd7, 6 - drawpixel8b8x8 ah, .loopd8, 7 -.skiploop2 -.hprior - add esi,8 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec ch - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - or eax,eax - je .skiploop1b - drawpixel8b8x8 al, .loopd1b, 7 - drawpixel8b8x8 ah, .loopd2b, 6 - mov eax,[ebx+2] - drawpixel8b8x8 al, .loopd3b, 5 - drawpixel8b8x8 ah, .loopd4b, 4 -.skiploop1b - mov eax,[ebx+4] - or eax,eax - je .skiploop2b - drawpixel8b8x8 al, .loopd5b, 3 - drawpixel8b8x8 ah, .loopd6b, 2 - mov eax,[ebx+6] - drawpixel8b8x8 al, .loopd7b, 1 - drawpixel8b8x8 ah, .loopd8b, 0 -.skiploop2b - add esi,8 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec ch - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic -.nodraw2 - ret - -NEWSYM draw8x8winon - mov ch,33 - mov byte[drawn],0 - mov ebp,[winptrref] - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - or eax,eax - je .skiploop1 - drawpixel8b8x8win al, .loopd1, 0 - drawpixel8b8x8win ah, .loopd2, 1 - mov eax,[ebx+2] - drawpixel8b8x8win al, .loopd3, 2 - drawpixel8b8x8win ah, .loopd4, 3 -.skiploop1 - mov eax,[ebx+4] - or eax,eax - je .skiploop2 - drawpixel8b8x8win al, .loopd5, 4 - drawpixel8b8x8win ah, .loopd6, 5 - mov eax,[ebx+6] - drawpixel8b8x8win al, .loopd7, 6 - drawpixel8b8x8win ah, .loopd8, 7 -.skiploop2 -.hprior - add esi,8 - add ebp,8 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec ch - jnz near .loopa - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - or eax,eax - je .skiploop1b - drawpixel8b8x8win al, .loopd1b, 7 - drawpixel8b8x8win ah, .loopd2b, 6 - mov eax,[ebx+2] - drawpixel8b8x8win al, .loopd3b, 5 - drawpixel8b8x8win ah, .loopd4b, 4 -.skiploop1b - mov eax,[ebx+4] - or eax,eax - je .skiploop2b - drawpixel8b8x8win al, .loopd5b, 3 - drawpixel8b8x8win ah, .loopd6b, 2 - mov eax,[ebx+6] - drawpixel8b8x8win al, .loopd7b, 1 - drawpixel8b8x8win ah, .loopd8b, 0 -.skiploop2b - add esi,8 - add ebp,8 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec ch - jnz near .loopa - ret - -SECTION .bss -NEWSYM alttile, resb 1 -NEWSYM hirestiledat, resb 256 -SECTION .text - -NEWSYM draw16x8 - push eax - xor eax,eax - mov al,[curypos] - mov byte[hirestiledat+eax],1 - pop eax - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - ;mov dword[bgofwptr],vcache8b+65536 - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x8winon -.domosaic - cmp byte[res512switch],0 - jne near draw16x8b - mov ch,33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start loop - mov eax,[ebx] - or eax,eax - je .skiploop1 - drawpixel8b8x8 al, .loopd1, 0 - mov eax,[ebx+2] - drawpixel8b8x8 al, .loopd3, 1 -.skiploop1 - mov eax,[ebx+4] - or eax,eax - je .skiploop2 - drawpixel8b8x8 al, .loopd5, 2 - mov eax,[ebx+6] - drawpixel8b8x8 al, .loopd7, 3 -.skiploop2 - add ebx,64 - ; Start loop - mov eax,[ebx] - or eax,eax - je .skiploop1c - drawpixel8b8x8 al, .loopd1c, 4 - mov eax,[ebx+2] - drawpixel8b8x8 al, .loopd3c, 5 -.skiploop1c - mov eax,[ebx+4] - or eax,eax - je .skiploop2c - drawpixel8b8x8 al, .loopd5c, 6 - mov eax,[ebx+6] - drawpixel8b8x8 al, .loopd7c, 7 -.skiploop2c -.hprior - add esi,8 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec ch - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - mov eax,[ebx] - or eax,eax - je .skiploop1b - drawpixel8b8x8 ah, .loopd1b, 7 - mov eax,[ebx+2] - drawpixel8b8x8 ah, .loopd3b, 6 -.skiploop1b - mov eax,[ebx+4] - or eax,eax - je .skiploop2b - drawpixel8b8x8 ah, .loopd5b, 5 - mov eax,[ebx+6] - drawpixel8b8x8 ah, .loopd7b, 4 -.skiploop2b - add ebx,64 - mov eax,[ebx] - or eax,eax - je .skiploop1d - drawpixel8b8x8 ah, .loopd1d, 3 - mov eax,[ebx+2] - drawpixel8b8x8 ah, .loopd3d, 2 -.skiploop1d - mov eax,[ebx+4] - or eax,eax - je .skiploop2d - drawpixel8b8x8 ah, .loopd5d, 1 - mov eax,[ebx+6] - drawpixel8b8x8 ah, .loopd7d, 0 -.skiploop2d - add esi,8 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec ch - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic - cmp byte[winon],0 - jne near dowindow -.nodraw2 - ret - -NEWSYM draw16x8b - mov ch,33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start loop - mov eax,[ebx] - or eax,eax - je .skiploop1 - drawpixel8b8x8 ah, .loopd1, 0 - mov eax,[ebx+2] - drawpixel8b8x8 ah, .loopd3, 1 -.skiploop1 - mov eax,[ebx+4] - or eax,eax - je .skiploop2 - drawpixel8b8x8 ah, .loopd5, 2 - mov eax,[ebx+6] - drawpixel8b8x8 ah, .loopd7, 3 -.skiploop2 - add ebx,64 - ; Start loop - mov eax,[ebx] - or eax,eax - je .skiploop1c - drawpixel8b8x8 ah, .loopd1c, 4 - mov eax,[ebx+2] - drawpixel8b8x8 ah, .loopd3c, 5 -.skiploop1c - mov eax,[ebx+4] - or eax,eax - je .skiploop2c - drawpixel8b8x8 ah, .loopd5c, 6 - mov eax,[ebx+6] - drawpixel8b8x8 ah, .loopd7c, 7 -.skiploop2c -.hprior - add esi,8 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec ch - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - mov eax,[ebx] - or eax,eax - je .skiploop1b - drawpixel8b8x8 al, .loopd2b, 7 - mov eax,[ebx+2] - drawpixel8b8x8 al, .loopd4b, 6 -.skiploop1b - mov eax,[ebx+4] - or eax,eax - je .skiploop2b - drawpixel8b8x8 al, .loopd5b, 5 - mov eax,[ebx+6] - drawpixel8b8x8 al, .loopd7b, 4 -.skiploop2b - add ebx,64 - mov eax,[ebx] - or eax,eax - je .skiploop1d - drawpixel8b8x8 al, .loopd1d, 3 - mov eax,[ebx+2] - drawpixel8b8x8 al, .loopd3d, 2 -.skiploop1d - mov eax,[ebx+4] - or eax,eax - je .skiploop2d - drawpixel8b8x8 al, .loopd5d, 1 - mov eax,[ebx+6] - drawpixel8b8x8 al, .loopd7d, 0 -.skiploop2d - add esi,8 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec ch - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic -.nodraw2 - ret - -NEWSYM draw16x8winon - cmp byte[res512switch],0 - jne near draw16x8bwinon - mov ch,33 - mov ebp,[winptrref] - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start loop - mov eax,[ebx] - or eax,eax - je .skiploop1 - drawpixel8b8x8win al, .loopd1, 0 - mov eax,[ebx+2] - drawpixel8b8x8win al, .loopd3, 1 -.skiploop1 - mov eax,[ebx+4] - or eax,eax - je .skiploop2 - drawpixel8b8x8win al, .loopd5, 2 - mov eax,[ebx+6] - drawpixel8b8x8win al, .loopd7, 3 -.skiploop2 - add ebx,64 - ; Start loop - mov eax,[ebx] - or eax,eax - je .skiploop1c - drawpixel8b8x8win al, .loopd1c, 4 - mov eax,[ebx+2] - drawpixel8b8x8win al, .loopd3c, 5 -.skiploop1c - mov eax,[ebx+4] - or eax,eax - je .skiploop2c - drawpixel8b8x8win al, .loopd5c, 6 - mov eax,[ebx+6] - drawpixel8b8x8win al, .loopd7c, 7 -.skiploop2c -.hprior - add ebp,8 - add esi,8 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec ch - jnz near .loopa - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - mov eax,[ebx] - or eax,eax - je .skiploop1b - drawpixel8b8x8win ah, .loopd1b, 7 - mov eax,[ebx+2] - drawpixel8b8x8win ah, .loopd3b, 6 -.skiploop1b - mov eax,[ebx+4] - or eax,eax - je .skiploop2b - drawpixel8b8x8win ah, .loopd5b, 5 - mov eax,[ebx+6] - drawpixel8b8x8win ah, .loopd7b, 4 -.skiploop2b - add ebx,64 - mov eax,[ebx] - or eax,eax - je .skiploop1d - drawpixel8b8x8win ah, .loopd1d, 3 - mov eax,[ebx+2] - drawpixel8b8x8win ah, .loopd3d, 2 -.skiploop1d - mov eax,[ebx+4] - or eax,eax - je .skiploop2d - drawpixel8b8x8win ah, .loopd5d, 1 - mov eax,[ebx+6] - drawpixel8b8x8win ah, .loopd7d, 0 -.skiploop2d - add ebp,8 - add esi,8 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec ch - jnz near .loopa - ret - -NEWSYM draw16x8bwinon - mov ch,33 - mov ebp,[winptrref] - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start loop - mov eax,[ebx] - or eax,eax - je .skiploop1 - drawpixel8b8x8win ah, .loopd1, 0 - mov eax,[ebx+2] - drawpixel8b8x8win ah, .loopd3, 1 -.skiploop1 - mov eax,[ebx+4] - or eax,eax - je .skiploop2 - drawpixel8b8x8win ah, .loopd5, 2 - mov eax,[ebx+6] - drawpixel8b8x8win ah, .loopd7, 3 -.skiploop2 - add ebx,64 - ; Start loop - mov eax,[ebx] - or eax,eax - je .skiploop1c - drawpixel8b8x8win ah, .loopd1c, 4 - mov eax,[ebx+2] - drawpixel8b8x8win ah, .loopd3c, 5 -.skiploop1c - mov eax,[ebx+4] - or eax,eax - je .skiploop2c - drawpixel8b8x8win ah, .loopd5c, 6 - mov eax,[ebx+6] - drawpixel8b8x8win ah, .loopd7c, 7 -.skiploop2c -.hprior - add ebp,8 - add esi,8 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec ch - jnz near .loopa - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - mov eax,[ebx] - or eax,eax - je .skiploop1b - drawpixel8b8x8win al, .loopd2b, 7 - mov eax,[ebx+2] - drawpixel8b8x8win al, .loopd4b, 6 -.skiploop1b - mov eax,[ebx+4] - or eax,eax - je .skiploop2b - drawpixel8b8x8win al, .loopd5b, 5 - mov eax,[ebx+6] - drawpixel8b8x8win al, .loopd7b, 4 -.skiploop2b - add ebx,64 - mov eax,[ebx] - or eax,eax - je .skiploop1d - drawpixel8b8x8win al, .loopd1d, 3 - mov eax,[ebx+2] - drawpixel8b8x8win al, .loopd3d, 2 -.skiploop1d - mov eax,[ebx+4] - or eax,eax - je .skiploop2d - drawpixel8b8x8win al, .loopd5d, 1 - mov eax,[ebx+6] - drawpixel8b8x8win al, .loopd7d, 0 -.skiploop2d - add ebp,8 - add esi,8 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec ch - jnz near .loopa - ret - -SECTION .data -NEWSYM extraleft, db 0,0,0,1,0,1,2,2,0,2,3,1,2,4,2,1 -SECTION .text - -NEWSYM domosaic - mov esi,xtravbuf+16 - mov edi,[curvidoffset] - xor ecx,ecx - mov cl,dh - mov dl,dh - sub dl,[extraleft+ecx] - mov ecx,256 - mov al,[esi] - cmp byte[winon],0 - jne near domosaicwin - test al,0FFh - jz .zeroloop -.loopm - mov [edi],al - inc esi - inc edi - dec ecx - jz .doneloop - dec dl - jnz .loopm - mov al,[esi] - mov dl,dh - test al,0FFh - jnz .loopm -.zeroloop - inc esi - inc edi - dec ecx - jz .doneloop - dec dl - jnz .zeroloop - mov al,[esi] - mov dl,dh - test al,0FFh - jnz .loopm - jmp .zeroloop -.doneloop - ret - -NEWSYM domosaicwin - mov ebp,[winptrref] - test al,0FFh - jz .zeroloop -.loopm - cmp byte[ebp],0 - jne .nozero2 - mov [edi],al -.nozero2 - inc esi - inc edi - inc ebp - dec ecx - jz .doneloop - dec dl - jnz .loopm - mov al,[esi] - mov dl,dh - test al,0FFh - jnz .loopm -.zeroloop - inc esi - inc edi - inc ebp - dec ecx - jz .doneloop - dec dl - jnz .zeroloop - mov al,[esi] - mov dl,dh - test al,0FFh - jnz .loopm - jmp .zeroloop -.doneloop - ret - -NEWSYM dowindow - mov ebx,windowdata - mov esi,xtravbuf+16 - mov edi,[curvidoffset] - xor edx,edx - xor ch,ch -.getnext - mov cl,[ebx] - cmp dl,cl - je .procnext -.dorest - sub cl,dl - cmp ch,0 - ja .nodraw -.loopa - mov eax,[esi+edx] - test al,0FFh - jz .nocopy - mov [edi+edx],al -.nocopy - inc dl - dec cl - jz .procnext - test ah,0FFh - jz .nocopyb - mov [edi+edx],ah -.nocopyb - inc dl - dec cl - jz .procnext - shr eax,16 - test al,0FFh - jz .nocopyc - mov [edi+edx],al -.nocopyc - inc dl - dec cl - jz .procnext - test ah,0FFh - jz .nocopyd - mov [edi+edx],ah -.nocopyd - inc dl - dec cl - jnz .loopa -.procnext - add ch,[ebx+1] - add ebx,2 - test byte[numwin],0FFh - jz .finishwin - dec byte[numwin] - jnz .getnext - xor cl,cl - jmp .dorest -.nodraw - add dl,cl - jmp .procnext -.finishwin - xor eax,eax - ret - -ALIGN32 - -SECTION .bss -NEWSYM yadder, resd 1 -NEWSYM yrevadder, resd 1 -NEWSYM tempcach, resd 1 ; points to cached memory -NEWSYM temptile, resd 1 ; points to the secondary video pointer -NEWSYM bgptr, resd 1 -NEWSYM bgptrb, resd 1 -NEWSYM bgptrc, resd 1 -NEWSYM bgptrd, resd 1 -NEWSYM bgptrx1, resd 1 -NEWSYM bgptrx2, resd 1 -NEWSYM curvidoffset, resd 1 -NEWSYM winon, resd 1 -NEWSYM bgofwptr, resd 1 -NEWSYM bgsubby, resd 1 -SECTION .text - - -NEWSYM draw8x8offset - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - initoffsetmode - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw8x8winon -.domosaic - mov byte[offsettilel],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 -; add dword[offsetptrb],2 -; add dword[offsetcedi],2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - or eax,eax - je .skiploop1 - drawpixel8b8x8 al, .loopd1, 0 - drawpixel8b8x8 ah, .loopd2, 1 - mov eax,[ebx+2] - drawpixel8b8x8 al, .loopd3, 2 - drawpixel8b8x8 ah, .loopd4, 3 -.skiploop1 - mov eax,[ebx+4] - or eax,eax - je .skiploop2 - drawpixel8b8x8 al, .loopd5, 4 - drawpixel8b8x8 ah, .loopd6, 5 - mov eax,[ebx+6] - drawpixel8b8x8 al, .loopd7, 6 - drawpixel8b8x8 ah, .loopd8, 7 -.skiploop2 -.hprior - procoffsetmode - add esi,8 - dec byte[offsettilel] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - or eax,eax - je .skiploop1b - drawpixel8b8x8 al, .loopd1b, 7 - drawpixel8b8x8 ah, .loopd2b, 6 - mov eax,[ebx+2] - drawpixel8b8x8 al, .loopd3b, 5 - drawpixel8b8x8 ah, .loopd4b, 4 -.skiploop1b - mov eax,[ebx+4] - or eax,eax - je .skiploop2b - drawpixel8b8x8 al, .loopd5b, 3 - drawpixel8b8x8 ah, .loopd6b, 2 - mov eax,[ebx+6] - drawpixel8b8x8 al, .loopd7b, 1 - drawpixel8b8x8 ah, .loopd8b, 0 -.skiploop2b - procoffsetmode - add esi,8 - dec byte[offsettilel] - jnz near .loopa - xor eax,eax - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic -.nodraw2 - ret - -NEWSYM draw8x8winonoffset - mov ch,33 - mov byte[drawn],0 - mov ebp,[winptrref] - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - offsetmcachechk - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - or eax,eax - je .skiploop1 - drawpixel8b8x8win al, .loopd1, 0 - drawpixel8b8x8win ah, .loopd2, 1 - mov eax,[ebx+2] - drawpixel8b8x8win al, .loopd3, 2 - drawpixel8b8x8win ah, .loopd4, 3 -.skiploop1 - mov eax,[ebx+4] - or eax,eax - je .skiploop2 - drawpixel8b8x8win al, .loopd5, 4 - drawpixel8b8x8win ah, .loopd6, 5 - mov eax,[ebx+6] - drawpixel8b8x8win al, .loopd7, 6 - drawpixel8b8x8win ah, .loopd8, 7 -.skiploop2 -.hprior - procoffsetmode - add esi,8 - add ebp,8 - dec ch - jnz near .loopa - xor eax,eax - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - or eax,eax - je .skiploop1b - drawpixel8b8x8win al, .loopd1b, 7 - drawpixel8b8x8win ah, .loopd2b, 6 - mov eax,[ebx+2] - drawpixel8b8x8win al, .loopd3b, 5 - drawpixel8b8x8win ah, .loopd4b, 4 -.skiploop1b - mov eax,[ebx+4] - or eax,eax - je .skiploop2b - drawpixel8b8x8win al, .loopd5b, 3 - drawpixel8b8x8win ah, .loopd6b, 2 - mov eax,[ebx+6] - drawpixel8b8x8win al, .loopd7b, 1 - drawpixel8b8x8win ah, .loopd8b, 0 -.skiploop2b - procoffsetmode - add esi,8 - add ebp,8 - dec ch - jnz near .loopa - xor eax,eax - ret - -ALIGN32 - -SECTION .bss -NEWSYM offsetmodeptr, resd 1 -NEWSYM offsetptra, resd 1 -NEWSYM offsetptrb, resd 1 -NEWSYM prevtempcache, resd 1 -NEWSYM prevoffsetdat, resd 1 -NEWSYM offsetenab, resd 1 -NEWSYM offsettilel, resd 1 -NEWSYM offsetrevval, resd 1 -NEWSYM posyscroll, resd 1 -NEWSYM offsetmcol, resd 1 -NEWSYM offsetmshl, resd 1 -NEWSYM offsetmptr, resd 1 -NEWSYM offsetmtst, resd 1 -NEWSYM offsetmclr, resd 1 -NEWSYM offsetcedi, resd 1 -SECTION .text - -;******************************************************* -; Processes & Draws 16x16 tiles in 2, 4, & 8 bit mode -;******************************************************* - -NEWSYM proc16x16 - ; ax = # of rows down - xor ebx,ebx - mov ebx,eax - and ebx,07h - mov byte[a16x16yinc],0 - test eax,08h - jz .noincb - mov byte[a16x16yinc],1 -.noincb - shr eax,4 - and eax,63 - cmp byte[edi+eax],0 - jne .nocachereq - mov byte[edi+eax],1 - cmp byte[curcolor],2 - jne .no4b - ; cache 4-bit - call cachetile4b16x16 - jmp .nocachereq -.no4b - cmp byte[curcolor],1 - je .2b - ; cache 8-bit - call cachetile8b16x16 - jmp .nocachereq -.2b - ; cache 2-bit - call cachetile2b16x16 -.nocachereq - test edx,0200h - jz .tilexa - test eax,20h - jz .tileya - ; bgptrd/bgptrc - mov ecx,[bgptrd] - mov [bgptrx1],ecx - mov ecx,[bgptrc] - mov [bgptrx2],ecx - jmp .skiptile -.tileya - ; bgptrb/bgptra - mov ecx,[bgptrb] - mov [bgptrx1],ecx - mov ecx,[bgptr] - mov [bgptrx2],ecx - jmp .skiptile -.tilexa - test ax,20h - jz .tileya2 - ; bgptrc/bgptrd - mov ecx,[bgptrc] - mov [bgptrx1],ecx - mov ecx,[bgptrd] - mov [bgptrx2],ecx - jmp .skiptile -.tileya2 - ; bgptra/bgptrb - mov ecx,[bgptr] - mov [bgptrx1],ecx - mov ecx,[bgptrb] - mov [bgptrx2],ecx -.skiptile - and eax,1Fh - shl ebx,3 - mov [yadder],ebx - ; set up edi to point to tile data - mov edi,[vram] - mov ebx,eax - shl ebx,6 - mov ax,[bgptrx1] - add edi,ebx - mov [temptile],edi - add edi,eax - ; dx = # of columns right - ; cx = bgxlim - mov eax,edx - mov byte[a16x16xinc],0 - test edx,08h - jz .noincd - mov byte[a16x16xinc],1 -.noincd - shr edx,4 - and edx,1Fh - mov [temp],dl - and eax,07h - shl dl,1 - xor ebx,ebx - add edi,edx - - mov esi,eax - mov ebx,[tempcach] - xor eax,eax - mov edx,[temptile] - mov ax,[bgptrx2] - add edx,eax - mov ecx,[yadder] - mov eax,[temp] - ; fill up tempbuffer with pointer #s that point to cached video mem - ; to calculate pointer, get first byte - ; esi = pointer to video buffer - ; edi = pointer to tile data - ; ebx = cached memory - ; ecx = y adder - ; edx = secondary tile pointer - ; al = current x position - ret - -NEWSYM draw16x16 - mov byte[drawn],0 - mov [temp],eax - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - xor ebx,ebx - mov bl,[curypos] - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx - ; set up y adders - test byte[a16x16yinc],01h - jz .noincrc - mov word[.yadd],16 - mov word[.yflipadd],0 - jmp .yesincrc -.noincrc - mov word[.yadd],0 - mov word[.yflipadd],16 -.yesincrc - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 - sub esi,eax -.nomosaic - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x16winon -.domosaic - mov ch,33 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[.yadd] - jmp .yesyflip -.noyflip - add ax,word[.yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - cmp eax,0 - je .skiploop1 - drawpixel8b8x8 al, .loopd1, 0 - drawpixel8b8x8 ah, .loopd2, 1 - shr eax,16 - drawpixel8b8x8 al, .loopd3, 2 - drawpixel8b8x8 ah, .loopd4, 3 -.skiploop1 - mov eax,[ebx+4] - cmp eax,0 - je .skiploop2 - drawpixel8b8x8 al, .loopd5, 4 - drawpixel8b8x8 ah, .loopd6, 5 - shr eax,16 - drawpixel8b8x8 al, .loopd7, 6 - drawpixel8b8x8 ah, .loopd8, 7 -.skiploop2 -.hprior - add esi,8 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec ch - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - cmp eax,0 - je .skiploop1b - drawpixel8b8x8 al, .loopd1b, 7 - drawpixel8b8x8 ah, .loopd2b, 6 - shr eax,16 - drawpixel8b8x8 al, .loopd3b, 5 - drawpixel8b8x8 ah, .loopd4b, 4 -.skiploop1b - mov eax,[ebx+4] - cmp eax,0 - je .skiploop2b - drawpixel8b8x8 al, .loopd5b, 3 - drawpixel8b8x8 ah, .loopd6b, 2 - shr eax,16 - drawpixel8b8x8 al, .loopd7b, 1 - drawpixel8b8x8 ah, .loopd8b, 0 -.skiploop2b - add esi,8 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec ch - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic - ret - -SECTION .bss -.yadd resw 1 -.yflipadd resw 1 -SECTION .text - -NEWSYM draw16x16winon -.domosaic - mov ch,33 - mov ebp,[winptrref] - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[draw16x16.yadd] - jmp .yesyflip -.noyflip - add ax,word[draw16x16.yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - cmp eax,0 - je .skiploop1 - drawpixel8b8x8win al, .loopd1, 0 - drawpixel8b8x8win ah, .loopd2, 1 - shr eax,16 - drawpixel8b8x8win al, .loopd3, 2 - drawpixel8b8x8win ah, .loopd4, 3 -.skiploop1 - mov eax,[ebx+4] - cmp eax,0 - je .skiploop2 - drawpixel8b8x8win al, .loopd5, 4 - drawpixel8b8x8win ah, .loopd6, 5 - shr eax,16 - drawpixel8b8x8win al, .loopd7, 6 - drawpixel8b8x8win ah, .loopd8, 7 -.skiploop2 -.hprior - add ebp,8 - add esi,8 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec ch - jnz near .loopa - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - mov eax,[ebx] - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - ; Start fast loop - cmp eax,0 - je .skiploop1b - drawpixel8b8x8win al, .loopd1b, 7 - drawpixel8b8x8win ah, .loopd2b, 6 - shr eax,16 - drawpixel8b8x8win al, .loopd3b, 5 - drawpixel8b8x8win ah, .loopd4b, 4 -.skiploop1b - mov eax,[ebx+4] - cmp eax,0 - je .skiploop2b - drawpixel8b8x8win al, .loopd5b, 3 - drawpixel8b8x8win ah, .loopd6b, 2 - shr eax,16 - drawpixel8b8x8win al, .loopd7b, 1 - drawpixel8b8x8win ah, .loopd8b, 0 -.skiploop2b - add ebp,8 - add esi,8 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec ch - jnz near .loopa - ret - -SECTION .bss -NEWSYM temp, resb 1 -NEWSYM bshifter, resb 1 -NEWSYM a16x16xinc, resb 1 -NEWSYM a16x16yinc, resb 1 -SECTION .text diff --git a/tools/zsnes/src/video/mode7.asm b/tools/zsnes/src/video/mode7.asm deleted file mode 100644 index 465d5ff..0000000 --- a/tools/zsnes/src/video/mode7.asm +++ /dev/null @@ -1,824 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%include "macros.mac" - -EXTSYM mode7tab,winptrref,nglogicval,winlogicaval,curmosaicsz,curvidoffset -EXTSYM cwinptr,domosaic,mode7A,mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set -EXTSYM vram,vrama,winon,xtravbuf,ngwinen,winbg1enval,BuildWindow,ngwintable -EXTSYM ngcwinptr,domosaicng,pesimpng,mode7hr,BGMA,mode7ab,mode7cd,BG1SYl,BG1SXl - -%include "video/mode7.mac" - -;******************************************************* -; Processes & Draws Mode 7 -;******************************************************* - -%macro Mode7Normal 0 - or dl,dl - jz %%nodrawb - mov [esi],dl -%%nodrawb - inc esi -%endmacro - -%macro Mode7Window 0 - or dl,dl - jz %%nodrawbw - test byte[ebp],0FFh - jnz %%nodrawbw - mov [esi],dl -%%nodrawbw - inc esi - inc ebp -%endmacro - -SECTION .text - -NEWSYM Makemode7Table - xor eax,eax -.nextentry - mov cl,al - mov dl,ah - and cl,07h - and dl,07h - shl cl,4 - shl dl,1 - inc dl - add dl,cl - mov [mode7tab+eax],dl - dec ax - jnz .nextentry - ret - -; backup mode7X0, mode7Y0, Mode7A, and Mode7B -NEWSYM drawmode7 - mov esi,[cwinptr] - mov [winptrref],esi - Mode7Calculate - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawmode7win -.domosaic - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - Mode7Process Mode7Normal, domosaic, 1 -.nextval3 - Mode7ProcessB Mode7Normal, domosaic, 1 - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resw 1 ; cx location -.cyloc resw 1 ; cy location -.m7xaddofa resd 1 -.m7xaddof2a resd 1 -.m7yaddofa resd 1 -.m7yaddof2a resd 1 -SECTION .text - -.drawmode7win -.domosaicw - - mov ebp,[cwinptr] - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3w - cmp dword[.mode7xadder],-7F0h - jl near .nextval3w - cmp dword[.mode7yadder],7F0h - jg near .nextval3w - cmp dword[.mode7yadder],-7F0h - jl near .nextval3w - - Mode7Process Mode7Window, domosaic, 1 -.nextval3w - Mode7ProcessB Mode7Window, domosaic, 1 - - -NEWSYM drawmode7win - cmp byte[mode7hr+ebx],1 - je near drawmode7winhr - ProcessBuildWindow 0 -.nohr - - mov esi,[cwinptr] - mov [winptrref],esi - Mode7Calculate - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov [pesimpng],esi - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - cmp byte[ngwinen],1 - je near .drawmode7win - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - Mode7Process Mode7Normal, domosaicng, 1 -.nextval3 - Mode7ProcessB Mode7Normal, domosaicng, 1 - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resw 1 ; cx location -.cyloc resw 1 ; cy location -.m7xaddofa resd 1 -.m7xaddof2a resd 1 -.m7yaddofa resd 1 -.m7yaddof2a resd 1 -SECTION .text - -.drawmode7win -.domosaicw - mov ebx,[.mode7xrpos] - mov [mode7xrpos],ebx - mov ebx,[.mode7yrpos] - mov [mode7yrpos],ebx - mov ebx,[.mode7xadder] - mov [mode7xadder],ebx - mov ebx,[.mode7yadder] - mov [mode7yadder],ebx - mov ebx,[.mode7xpos] - mov [mode7xpos],ebx - mov ebx,[.mode7ypos] - mov [mode7ypos],ebx - - mov edi,[vram] - Mode7Processngw Mode7Normal, domosaicng, 1 - -NEWSYM drawmode7winB - cmp byte[mode7hr+ebx],1 - je near drawmode7winBhr - ProcessBuildWindow 0 -.nohr - - mov esi,[cwinptr] - mov [winptrref],esi - Mode7CalculateB - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - cmp byte[ngwinen],1 - je near .drawmode7win - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - Mode7Process Mode7Normal, domosaic, 1 -.nextval3 - Mode7ProcessB Mode7Normal, domosaic, 1 - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resw 1 ; cx location -.cyloc resw 1 ; cy location -.m7xaddofa resd 1 -.m7xaddof2a resd 1 -.m7yaddofa resd 1 -.m7yaddof2a resd 1 -SECTION .text - -.drawmode7win -.domosaicw - mov ebx,[.mode7xrpos] - mov [mode7xrpos],ebx - mov ebx,[.mode7yrpos] - mov [mode7yrpos],ebx - mov ebx,[.mode7xpos] - mov [mode7xpos],ebx - mov ebx,[.mode7ypos] - mov [mode7ypos],ebx - mov ebx,[.mode7xadder] - mov [mode7xadder],ebx - mov ebx,[.mode7yadder] - mov [mode7yadder],ebx - - mov edi,[vram] - Mode7Processngw Mode7Normal, domosaic, 1 - -NEWSYM drawmode7winhr - ProcessBuildWindow 0 - - cmp byte[ngwinen],1 - jne .notwinen - mov byte[mode7hr+ebx],0 - jmp drawmode7win.nohr -.notwinen - - mov esi,[cwinptr] - mov [winptrref],esi - Mode7Calculate - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov [pesimpng],esi - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - sar dword[.mode7xadder],1 - sar dword[.mode7yadder],1 - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - Mode7Processhr Mode7Normal, domosaicng, 1 -.nextval3 - Mode7ProcessBhr Mode7Normal, domosaicng, 1 - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.temp2 resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resw 1 ; cx location -.cyloc resw 1 ; cy location -.m7xaddofa resd 1 -.m7xaddof2a resd 1 -.m7yaddofa resd 1 -.m7yaddof2a resd 1 -SECTION .text - -NEWSYM drawmode7winBhr - ProcessBuildWindow 0 - - cmp byte[ngwinen],1 - jne .notwinen - mov byte[mode7hr+ebx],0 - jmp drawmode7winB.nohr -.notwinen - - mov esi,[cwinptr] - mov [winptrref],esi - Mode7CalculateB - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - sar dword[.mode7xadder],1 - sar dword[.mode7yadder],1 - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - Mode7Processhr Mode7Normal, domosaic, 1 -.nextval3 - Mode7ProcessBhr Mode7Normal, domosaic, 1 - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.temp2 resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resw 1 ; cx location -.cyloc resw 1 ; cy location -.m7xaddofa resd 1 -.m7xaddof2a resd 1 -.m7yaddofa resd 1 -.m7yaddof2a resd 1 - -;ALIGN32 -NEWSYM ngwleft, resd 1 ; for byte move left -NEWSYM ngwleftb, resd 1 ; for byte move left -NEWSYM mode7xpos, resd 2 ; x position -NEWSYM mode7ypos, resd 2 ; x position -NEWSYM mode7xrpos, resd 2 ; x position, relative -NEWSYM mode7yrpos, resd 2 ; y position, relative -NEWSYM mode7xadder, resd 2 ; number to add for x -NEWSYM mode7yadder, resd 2 ; number to add for y -SECTION .text - -NEWSYM ProcessMode7ngwin - mov ecx,[ngcwinptr] - mov ecx,[ecx] - or ecx,ecx - jz near .winb - cmp ecx,[ngwleft] - jae .alldisplay - sub [ngwleft],ecx - mov [ngwleftb],ecx - xor ecx,ecx - mov eax,[mode7xrpos] - ret -.alldisplay - mov ecx,[ngwleft] - mov [ngwleftb],ecx - mov dword[ngwleft],0 - xor ecx,ecx - mov eax,[mode7xrpos] - ret -.winb -NEWSYM ProcessMode7ngwinB - add dword[ngcwinptr],4 - mov ecx,[ngcwinptr] - mov ecx,[ecx] - cmp ecx,[ngwleft] - jae near .finishmode7 - sub [ngwleft],ecx - or ecx,ecx - jz .noclip -.nextvalngw - mov eax,[mode7xadder] - add [mode7xrpos],eax - mov eax,[mode7yadder] - sub [mode7yrpos],eax - inc esi - dec ecx - jnz near .nextvalngw -.noclip - add dword[ngcwinptr],4 - jmp ProcessMode7ngwin -.finishmode7 - mov dword[ngwleft],0 - mov dword[ngwleftb],0 - ret - -NEWSYM ProcessMode7ngwinC - mov ecx,[ngcwinptr] - mov ecx,[ecx] - or ecx,ecx - jz near .winb - cmp ecx,[ngwleft] - jae .alldisplay - sub [ngwleft],ecx - mov [ngwleftb],ecx - xor ecx,ecx - mov eax,[mode7xpos] - ret -.alldisplay - mov ecx,[ngwleft] - mov [ngwleftb],ecx - mov dword[ngwleft],0 - xor ecx,ecx - mov eax,[mode7xpos] - ret -.winb -NEWSYM ProcessMode7ngwinD - add dword[ngcwinptr],4 - mov ecx,[ngcwinptr] - mov ecx,[ecx] - cmp ecx,[ngwleft] - jae near .finishmode7 - sub [ngwleft],ecx - or ecx,ecx - jz .noclip -.nextvalngw - mov eax,[mode7xadder] - add [mode7xpos],eax - mov eax,[mode7yadder] - sub [mode7ypos],eax - inc esi - dec ecx - jnz near .nextvalngw -.noclip - add dword[ngcwinptr],4 - jmp ProcessMode7ngwin -.finishmode7 - mov dword[ngwleft],0 - mov dword[ngwleftb],0 - ret - -%macro newvaluepred 2 - mov dx,[%1+ebx*4+8] - cmp dx,word[%1+ebx*4] - je %%nodivide - cmp byte[BGMA+ebx+2],7 - je %%mode7scaleb -%%nodivide - movsx edx,word[%1+ebx*4+4] - movsx ecx,word[%1+ebx*4] - add ecx,edx - sar ecx,1 - mov [%2],cx - jmp %%mode7scalend -%%mode7scaleb - mov esi,ebx - movsx ebx,word[%1+esi*4+8] - movsx edx,word[%1+esi*4] - sub ebx,edx - movsx ecx,word[%1+esi*4+4] - sub ecx,edx - mov eax,ecx - imul ecx - idiv ebx - add ax,word[%1+esi*4] - mov ebx,esi - mov [%2],ax -%%mode7scalend -%endmacro - -NEWSYM processmode7hires - cmp byte[BGMA+ebx+1],7 - jne near .nogo - - push esi - push ebx - ; predict new values - push eax - push edx - push ebx - push esi - newvaluepred mode7ab,mode7A - newvaluepred mode7ab+2,mode7B - newvaluepred mode7cd,mode7C - newvaluepred mode7cd+2,mode7D - pop esi - pop ebx - pop edx - pop eax - - mov ecx,edx - xor edx,edx - mov dx,[BG1SXl+ebx*2+2] - add edx,ecx - shr edx,1 - - mov ecx,eax - mov eax,ebx - inc eax - test byte[mode7set],02h - jz .noflip - mov eax,255 - sub eax,ebx -.noflip - mov [m7starty],ax - mov ax,[BG1SYl+ebx*2+2] - add eax,ecx - - add esi,75036 - mov [curvidoffset],esi - call drawmode7winB - pop ebx - pop esi -.nogo - ret diff --git a/tools/zsnes/src/video/mode7.mac b/tools/zsnes/src/video/mode7.mac deleted file mode 100644 index 5addfb2..0000000 --- a/tools/zsnes/src/video/mode7.mac +++ /dev/null @@ -1,1599 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 m7starty - -%macro CLIP 1 - test word[%1],2000h - jz %%zero - or word[%1],~3ffh - jmp %%notzero -%%zero - and word[%1],3ffh -%%notzero -%endmacro - -%macro Convert13Bit 0 - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz %%noneg - or bx,1110000000000000b -%%noneg -%endmacro - -%macro Mode7Calculate 0 - ; mode 7, ax = curyposition, dx = curxposition (left side) - ; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen - ; center map coordinates = (X0,Y0) - ; 1.) cx=X0-bg1scrolx, cy =Y0-ax - - mov bx,dx - Convert13Bit - mov [.cxloc],bx - mov bx,[mode7X0] - Convert13Bit - sub [.cxloc],bx - CLIP .cxloc - mov bx,ax - Convert13Bit - mov [.cyloc],bx - mov bx,[mode7Y0] - Convert13Bit - sub word[.cyloc],bx - CLIP .cyloc - - ; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D) - - movsx eax,word[mode7B] - movsx ebx,word[.cyloc] - imul eax,ebx - and eax,~63 - mov [.mode7xpos],eax - mov bx,[mode7X0] - Convert13Bit - add [.mode7xpos+1],bx - - movsx eax,word[mode7B] - movzx ebx,word[m7starty] - imul eax,ebx - and eax,~63 - add [.mode7xpos],eax - - movsx ebx,word[.cyloc] - movsx eax,word[mode7D] - imul eax,ebx - and eax,~63 - mov [.mode7ypos],eax - mov bx,[mode7Y0] - Convert13Bit - add [.mode7ypos+1],bx - - movsx eax,word[mode7D] - movzx ebx,word[m7starty] - imul eax,ebx - and eax,~63 - add [.mode7ypos],eax - - ; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B) - - movsx ebx,word[.cxloc] - movsx eax,word[mode7A] - mov [.mode7xadder],eax - imul eax,ebx - and eax,~63 - ;neg eax - add [.mode7xpos],eax - - movsx eax,word[mode7C] - movsx ebx,word[.cxloc] - neg eax - mov [.mode7yadder],eax - neg eax - imul eax,ebx - and eax,~63 - add [.mode7ypos],eax - - test byte[mode7set],1 - jz .nohflip - mov eax,[.mode7xadder] - shl eax,8 - add [.mode7xpos],eax - neg dword[.mode7xadder] - mov eax,[.mode7yadder] - shl eax,8 - sub [.mode7ypos],eax - neg dword[.mode7yadder] -.nohflip -%endmacro - -%macro Mode7CalculateB 0 - ; mode 7, ax = curyposition, dx = curxposition (left side) - ; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen - ; center map coordinates = (X0,Y0) - ; 1.) cx=X0-bg1scrolx, cy =Y0-ax - - mov bx,dx - Convert13Bit - mov [.cxloc],bx - mov bx,[mode7X0] - Convert13Bit - sub [.cxloc],bx - CLIP .cxloc - mov bx,ax - and bx,0011111111111111b ; 13 -> 16 bit signed value - test bx,0010000000000000b - jz .nonegc - or bx,1100000000000000b -.nonegc - mov [.cyloc],bx - mov bx,[mode7Y0] - Convert13Bit - add bx,bx - sub word[.cyloc],bx - test word[.cyloc],4000h - jz %%zero - or word[.cyloc],~7ffh - jmp %%notzero -%%zero - and word[.cyloc],7ffh -%%notzero - - ; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D) - - movsx eax,word[mode7B] - movsx ebx,word[.cyloc] - imul eax,ebx - sar eax,1 - and eax,~63 - mov [.mode7xpos],eax - mov bx,[mode7X0] - Convert13Bit - add [.mode7xpos+1],bx - - movsx eax,word[mode7B] - movzx ebx,word[m7starty] - imul eax,ebx - and eax,~63 - add [.mode7xpos],eax - - movsx ebx,word[.cyloc] - movsx eax,word[mode7D] - imul eax,ebx - sar eax,1 - and eax,~63 - mov [.mode7ypos],eax - mov bx,[mode7Y0] - Convert13Bit - add [.mode7ypos+1],bx - - movsx eax,word[mode7D] - movzx ebx,word[m7starty] - imul eax,ebx - and eax,~63 - add [.mode7ypos],eax - - ; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B) - - movsx ebx,word[.cxloc] - movsx eax,word[mode7A] - mov [.mode7xadder],eax - imul eax,ebx - and eax,~63 - ;neg eax - add [.mode7xpos],eax - - movsx eax,word[mode7C] - movsx ebx,word[.cxloc] - neg eax - mov [.mode7yadder],eax - neg eax - imul eax,ebx - and eax,~63 - add [.mode7ypos],eax - - test byte[mode7set],1 - jz .nohflip - mov eax,[.mode7xadder] - shl eax,8 - add [.mode7xpos],eax - neg dword[.mode7xadder] - mov eax,[.mode7yadder] - shl eax,8 - sub [.mode7ypos],eax - neg dword[.mode7yadder] -.nohflip -%endmacro - -%macro Mode7Process 3 - mov dword[.temp],256 - test byte[mode7set],80h - jnz near %%norep2 - - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ecx,ecx - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - mov eax,[.mode7xrpos] - mov ebx,[.mode7ptr] - jmp %%nextval - ALIGN16 -%%nextval - test ah,08h - jnz near %%rposoffx -%%nextposx - test byte[.mode7yrpos+1],08h - jnz near %%rposoffy -%%nextposy - mov ch,ah - mov edx,[.mode7yadder] - mov cl,[.mode7yrpos+1] - sub dword[.mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[.mode7xadder] - mov dl,[edi+edx] - %1 - dec dword[.temp] - jnz near %%nextval - jmp %%finishmode7 - -%%rposoffx - add bl,[.mode7xinc] - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - sub eax,[.mode7xadd2] - lea edi,[ecx+vrama] - jmp %%nextposx - -%%rposoffy - sub bh,[.mode7yinc] - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - mov edx,[.mode7yadd2] - shl ecx,7 - add dword[.mode7yrpos],edx - lea edi,[ecx+vrama] - jmp %%nextposy - -%%finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near %2 - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -%%norep2 - test byte[mode7set],40h - jnz %%tilerep2 - jmp %%nextvalb2 - ALIGN16 -%%nextvalb2 - cmp byte[.mode7ypos+2],3 - ja %%offscr2 - cmp byte[.mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2 - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,%3 - dec dword[.temp] - jnz near %%nextvalb2 - jmp %%finishmode7 -%%tilerep2 -%%nextvalb3 - cmp byte[.mode7ypos+2],3 - ja %%offscr2b - cmp byte[.mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2b - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - %1 - dec dword[.temp] - jnz near %%nextvalb3 - jmp %%finishmode7 -%%offscr3 - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - jmp %%nextvalr - ALIGN16 -%%nodr2 - add esi,%3 - dec dword[.temp] - jz near %%fin2 -%%nextvalr - test byte[.mode7xrpos+1],08h - jnz near %%rposoffxr -%%nextposxr - test byte[.mode7yrpos+1],08h - jnz near %%rposoffyr -%%nextposyr - mov cl,[.mode7yrpos+1] - mov ch,[.mode7xrpos+1] - mov edx,[.mode7xadder] - add dword[.mode7xrpos],edx - mov edx,[.mode7yadder] - sub dword[.mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - mov dl,[edi+edx] - %1 - dec dword[.temp] - jnz near %%nextvalr -%%fin2 - jmp %%finishmode7 -%%rposoffxr - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov cl,[.mode7xincc] - cmp byte[.mode7ptr],cl - je %%roff -%%roffxretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp %%nextposxr -%%rposoffyr - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js %%roff -%%roffyretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp %%nextposyr -%%roff - test byte[mode7set],40h - jnz %%tilerep3 - jmp %%finishmode7 -%%tilerep3 - and byte[.mode7yrpos+1],07h - and byte[.mode7xrpos+1],07h - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[vrama+edx] - sub [.mode7yrpos],eax - %1 - dec dword[.temp] - jnz near %%tilerep3 - jmp %%finishmode7 -%endmacro - -; ************************************************************************ - -%macro Mode7ProcessB 3 - mov dword[.temp],256 - test byte[mode7set],80h - jnz near %%norep2 - - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - xor dl,dl - xor ecx,ecx - mov ebx,[.mode7xadder] - test ebx,80000000h - jz %%nexta - neg ebx -%%nexta - cmp ebx,0800h - jl %%skipx - sub ebx,800h - add ecx,[.mode7xadd2] - add dl,[.mode7xinc] - jmp %%nexta -%%skipx - mov [.m7xaddofa],ecx - mov [.m7xaddof2a],dl - - xor dl,dl - xor ecx,ecx - mov ebx,[.mode7yadder] - test ebx,80000000h - jz %%nextay - neg ebx -%%nextay - cmp ebx,0800h - jl %%skipy - sub ebx,800h - add ecx,[.mode7yadd2] - add dl,[.mode7yinc] - jmp %%nextay -%%skipy - mov [.m7yaddofa],ecx - mov [.m7yaddof2a],dl - - xor ecx,ecx - - mov eax,[.mode7xrpos] - mov ebx,[.mode7ptr] - jmp %%nextval - ALIGN16 -%%nextval - test ah,0F8h - jnz near %%rposoffx -%%nextposx - test byte[.mode7yrpos+1],0F8h - jnz near %%rposoffy -%%nextposy - mov ch,ah - mov edx,[.mode7yadder] - mov cl,[.mode7yrpos+1] - sub dword[.mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[.mode7xadder] - mov dl,[edi+edx] - %1 - dec dword[.temp] - jnz near %%nextval - jmp %%finishmode7 - -%%rposoffx - sub eax,[.m7xaddofa] - add bl,[.m7xaddof2a] - test ah,0F8h - jz %%noaddstuff - add bl,[.mode7xinc] - sub eax,[.mode7xadd2] -%%noaddstuff - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposx - -%%rposoffy - mov edx,[.m7yaddofa] - sub bh,[.m7yaddof2a] - add dword[.mode7yrpos],edx - test byte[.mode7yrpos+1],0F8h - jz %%noaddstuff2 - mov edx,[.mode7yadd2] - sub bh,[.mode7yinc] - add dword[.mode7yrpos],edx -%%noaddstuff2 - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposy - -%%finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near %2 - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -%%norep2 - test byte[mode7set],40h - jnz %%tilerep2 - jmp %%nextvalb2 - ALIGN16 -%%nextvalb2 - cmp byte[.mode7ypos+2],3 - ja %%offscr2 - cmp byte[.mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2 - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,%3 - dec dword[.temp] - jnz near %%nextvalb2 - jmp %%finishmode7 -%%tilerep2 -%%nextvalb3 - cmp byte[.mode7ypos+2],3 - ja %%offscr2b - cmp byte[.mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2b - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - %1 - dec dword[.temp] - jnz near %%nextvalb3 - jmp %%finishmode7 -%%offscr3 - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - jmp %%nextvalr - ALIGN16 -%%nodr2 - add esi,%3 - dec dword[.temp] - jz near %%fin2 -%%nextvalr - test byte[.mode7xrpos+1],0F8h - jnz near %%rposoffxr -%%nextposxr - test byte[.mode7yrpos+1],0F8h - jnz near %%rposoffyr -%%nextposyr - mov cl,[.mode7yrpos+1] - mov ch,[.mode7xrpos+1] - mov edx,[.mode7xadder] - add dword[.mode7xrpos],edx - mov edx,[.mode7yadder] - sub dword[.mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - mov dl,[edi+edx] - %1 - dec dword[.temp] - jnz near %%nextvalr -%%fin2 - jmp %%finishmode7 -%%rposoffxr - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov cl,[.mode7xincc] - cmp byte[.mode7ptr],cl - je %%roff -%%roffxretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp %%nextvalr -%%rposoffyr - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js %%roff -%%roffyretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp %%nextposxr -%%roff - test byte[mode7set],40h - jnz %%tilerep3 - jmp %%finishmode7 -%%tilerep3 - and byte[.mode7yrpos+1],07h - and byte[.mode7xrpos+1],07h - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[vrama+edx] - sub [.mode7yrpos],eax - %1 - dec dword[.temp] - jnz near %%tilerep3 - jmp %%finishmode7 -%endmacro - -%macro Mode7Processhr 3 - mov dword[.temp],256 - mov dword[.temp2],2 - test byte[mode7set],80h - jnz near %%norep2 - - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - mov eax,[.mode7xrpos] - mov ebx,[.mode7ptr] - jmp %%nextval - ALIGN16 -%%nextval - test ah,08h - jnz near %%rposoffx -%%nextposx - test byte[.mode7yrpos+1],08h - jnz near %%rposoffy -%%nextposy - mov ch,ah - mov edx,[.mode7yadder] - mov cl,[.mode7yrpos+1] - sub dword[.mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[.mode7xadder] - mov dl,[edi+edx] - %1 - dec dword[.temp] - jnz near %%nextval - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%nextval - jmp %%finishmode7 - -%%rposoffx - add bl,[.mode7xinc] - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - sub eax,[.mode7xadd2] - lea edi,[ecx+vrama] - jmp %%nextposx - -%%rposoffy - sub bh,[.mode7yinc] - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - mov edx,[.mode7yadd2] - shl ecx,7 - add dword[.mode7yrpos],edx - lea edi,[ecx+vrama] - jmp %%nextposy - -%%finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near %2 - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -%%norep2 - test byte[mode7set],40h - jnz %%tilerep2 - jmp %%nextvalb2 - ALIGN16 -%%nextvalb2 - cmp byte[.mode7ypos+2],3 - ja %%offscr2 - cmp byte[.mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2 - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,%3 - dec dword[.temp] - jnz near %%nextvalb2 - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%nextvalb2 - jmp %%finishmode7 -%%tilerep2 -%%nextvalb3 - cmp byte[.mode7ypos+2],3 - ja %%offscr2b - cmp byte[.mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2b - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - %1 - dec dword[.temp] - jnz near %%nextvalb3 - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%nextvalb3 - jmp %%finishmode7 -%%offscr3 - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - jmp %%nextvalr - ALIGN16 -%%nodr2 - add esi,%3 - dec dword[.temp] - jz near %%fin2 -%%nextvalr - test byte[.mode7xrpos+1],08h - jnz near %%rposoffxr -%%nextposxr - test byte[.mode7yrpos+1],08h - jnz near %%rposoffyr -%%nextposyr - mov cl,[.mode7yrpos+1] - mov ch,[.mode7xrpos+1] - mov edx,[.mode7xadder] - add dword[.mode7xrpos],edx - mov edx,[.mode7yadder] - sub dword[.mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - mov dl,[edi+edx] - %1 - dec dword[.temp] - jnz near %%nextvalr -%%fin2 - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%nextvalr - jmp %%finishmode7 -%%rposoffxr - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov cl,[.mode7xincc] - cmp byte[.mode7ptr],cl - je %%roff -%%roffxretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp %%nextposxr -%%rposoffyr - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js %%roff -%%roffyretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp %%nextposyr -%%roff - test byte[mode7set],40h - jnz %%tilerep3 - jmp %%finishmode7 -%%tilerep3 - and byte[.mode7yrpos+1],07h - and byte[.mode7xrpos+1],07h - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[vrama+edx] - sub [.mode7yrpos],eax - %1 - dec dword[.temp] - jnz near %%tilerep3 - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%tilerep3 - jmp %%finishmode7 -%endmacro - -; ************************************************************************ - -%macro Mode7ProcessBhr 3 - mov dword[.temp],256 - mov dword[.temp2],2 - test byte[mode7set],80h - jnz near %%norep2 - - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - xor dl,dl - xor ecx,ecx - mov ebx,[.mode7xadder] - test ebx,80000000h - jz %%nexta - neg ebx -%%nexta - cmp ebx,0800h - jl %%skipx - sub ebx,800h - add ecx,[.mode7xadd2] - add dl,[.mode7xinc] - jmp %%nexta -%%skipx - mov [.m7xaddofa],ecx - mov [.m7xaddof2a],dl - - xor dl,dl - xor ecx,ecx - mov ebx,[.mode7yadder] - test ebx,80000000h - jz %%nextay - neg ebx -%%nextay - cmp ebx,0800h - jl %%skipy - sub ebx,800h - add ecx,[.mode7yadd2] - add dl,[.mode7yinc] - jmp %%nextay -%%skipy - mov [.m7yaddofa],ecx - mov [.m7yaddof2a],dl - - xor ecx,ecx - - mov eax,[.mode7xrpos] - mov ebx,[.mode7ptr] - jmp %%nextval - ALIGN16 -%%nextval - test ah,0F8h - jnz near %%rposoffx -%%nextposx - test byte[.mode7yrpos+1],0F8h - jnz near %%rposoffy -%%nextposy - mov ch,ah - mov edx,[.mode7yadder] - mov cl,[.mode7yrpos+1] - sub dword[.mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[.mode7xadder] - mov dl,[edi+edx] - %1 - dec dword[.temp] - jnz near %%nextval - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%nextval - jmp %%finishmode7 - -%%rposoffx - sub eax,[.m7xaddofa] - add bl,[.m7xaddof2a] - test ah,0F8h - jz %%noaddstuff - add bl,[.mode7xinc] - sub eax,[.mode7xadd2] -%%noaddstuff - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposx - -%%rposoffy - mov edx,[.m7yaddofa] - sub bh,[.m7yaddof2a] - add dword[.mode7yrpos],edx - test byte[.mode7yrpos+1],0F8h - jz %%noaddstuff2 - mov edx,[.mode7yadd2] - sub bh,[.mode7yinc] - add dword[.mode7yrpos],edx -%%noaddstuff2 - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposy - -%%finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near %2 - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -%%norep2 - test byte[mode7set],40h - jnz %%tilerep2 - jmp %%nextvalb2 - ALIGN16 -%%nextvalb2 - cmp byte[.mode7ypos+2],3 - ja %%offscr2 - cmp byte[.mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2 - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,%3 - dec dword[.temp] - jnz near %%nextvalb2 - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%nextvalb2 - jmp %%finishmode7 -%%tilerep2 -%%nextvalb3 - cmp byte[.mode7ypos+2],3 - ja %%offscr2b - cmp byte[.mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2b - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - %1 - dec dword[.temp] - jnz near %%nextvalb3 - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%nextvalb3 - jmp %%finishmode7 -%%offscr3 - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - jmp %%nextvalr - ALIGN16 -%%nodr2 - add esi,%3 - dec dword[.temp] - jz near %%fin2 -%%nextvalr - test byte[.mode7xrpos+1],0F8h - jnz near %%rposoffxr -%%nextposxr - test byte[.mode7yrpos+1],0F8h - jnz near %%rposoffyr -%%nextposyr - mov cl,[.mode7yrpos+1] - mov edx,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add dword[.mode7xrpos],edx - mov edx,[.mode7yadder] - sub dword[.mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - mov dl,[edi+edx] - %1 - dec dword[.temp] - jnz near %%nextvalr -%%fin2 - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%nextvalr - jmp %%finishmode7 -%%rposoffxr - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov cl,[.mode7xincc] - cmp byte[.mode7ptr],cl - je %%roff -%%roffxretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp %%nextvalr -%%rposoffyr - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js %%roff -%%roffyretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp %%nextposxr -%%roff - test byte[mode7set],40h - jnz %%tilerep3 - jmp %%finishmode7 -%%tilerep3 - and byte[.mode7yrpos+1],07h - and byte[.mode7xrpos+1],07h - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[vrama+edx] - sub [.mode7yrpos],eax - %1 - dec dword[.temp] - jnz near %%tilerep3 - mov dword[.temp],256 - add esi,75036*2-256 - dec dword[.temp2] - jnz near %%tilerep3 - jmp %%finishmode7 -%endmacro - -%macro ProcessBuildWindow 1 - mov dword[ngwinen],0 - test byte[winbg1enval+ebx+%1*256],0Ah - jz %%nowindowing - push eax - push ebx - mov al,[winlogicaval+ebx*2] - shr al,%1*2 - and al,03h - mov [nglogicval],al - mov eax,ebx - add ebx,%1*256 - call BuildWindow - cmp dword[ngwintable],0 - je %%zero - dec dword[ngwintable] - jmp %%notzero -%%zero - dec dword[ngwintable+4] -%%notzero - pop ebx - pop eax - mov dword[ngcwinptr],ngwintable -%%nowindowing -%endmacro - -;************************************ - -%macro Mode7Processngw 3 - mov dword[ngwleftb],256 - mov dword[ngwleft],256 - test byte[mode7set],80h - jnz near %%norep2 - - mov eax,[.mode7xpos] - and eax,7FFh - mov [mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - xor dl,dl - xor ecx,ecx - mov ebx,[.mode7xadder] - test ebx,80000000h - jz %%nexta - neg ebx -%%nexta - cmp ebx,0800h - jl %%skipx - sub ebx,800h - add ecx,[.mode7xadd2] - add dl,[.mode7xinc] - jmp %%nexta -%%skipx - mov [.m7xaddofa],ecx - mov [.m7xaddof2a],dl - - xor dl,dl - xor ecx,ecx - mov ebx,[.mode7yadder] - test ebx,80000000h - jz %%nextay - neg ebx -%%nextay - cmp ebx,0800h - jl %%skipy - sub ebx,800h - add ecx,[.mode7yadd2] - add dl,[.mode7yinc] - jmp %%nextay -%%skipy - mov [.m7yaddofa],ecx - mov [.m7yaddof2a],dl - - xor ecx,ecx - - mov eax,[mode7xrpos] - mov ebx,[.mode7ptr] - - call ProcessMode7ngwin - cmp dword[ngwleftb],0 - jne near %%nextval - jmp %%finishmode7 - ALIGN16 -%%nextval - test ah,0F8h - jnz near %%rposoffx -%%nextposx - test byte[mode7yrpos+1],0F8h - jnz near %%rposoffy -%%nextposy - mov ch,ah - mov cl,[mode7yrpos+1] - mov edx,[mode7yadder] - sub dword[mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[mode7xadder] - mov dl,[edi+edx] - %1 - dec dword[ngwleftb] - jnz near %%nextval - mov [mode7xrpos],eax - cmp dword[ngwleft],0 - je %%notskipvalues - call ProcessMode7ngwinB - cmp dword[ngwleftb],0 - jne near %%nextval -%%notskipvalues - jmp %%finishmode7 - -%%rposoffx - sub eax,[.m7xaddofa] - add bl,[.m7xaddof2a] - test ah,0F8h - jz %%noaddstuff - add bl,[.mode7xinc] - sub eax,[.mode7xadd2] -%%noaddstuff - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposx - -%%rposoffy - mov edx,[.m7yaddofa] - sub bh,[.m7yaddof2a] - add dword[mode7yrpos],edx - test byte[mode7yrpos+1],0F8h - jz %%noaddstuff2 - mov edx,[.mode7yadd2] - sub bh,[.mode7yinc] - add dword[mode7yrpos],edx -%%noaddstuff2 - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposy - -%%finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near %2 - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -%%norep2 - call ProcessMode7ngwinC - cmp dword[ngwleftb],0 - jne near %%nextvald - jmp %%finishmode7 -%%nextvald - mov dword[ngwleft],0 - - test byte[mode7set],40h - jnz near %%tilerep2 - jmp %%nextvalb2 - ALIGN16 -%%nextvalb2 - cmp byte[mode7ypos+2],3 - ja %%offscr2 - cmp byte[mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2 - mov eax,[mode7xadder] - mov ebx,[mode7yadder] - add [mode7xpos],eax - sub [mode7ypos],ebx - add esi,%3 - dec dword[ngwleftb] - jnz near %%nextvalb2 - - cmp dword[ngwleft],0 - je %%notskipvalues3b - call ProcessMode7ngwinD - cmp dword[ngwleftb],0 - jne near %%nextvalb2 -%%notskipvalues3b - - jmp %%finishmode7 -%%tilerep2 -%%nextvalb3 - cmp byte[mode7ypos+2],3 - ja %%offscr2b - cmp byte[mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2b - mov ch,[mode7xpos+1] - mov eax,[mode7xadder] - mov cl,[mode7ypos+1] - mov ebx,[mode7yadder] - mov dl,[mode7tab+ecx] - add [mode7xpos],eax - mov dl,[vrama+edx] - sub [mode7ypos],ebx - %1 - dec dword[ngwleftb] - jnz near %%nextvalb3 - - cmp dword[ngwleft],0 - je %%notskipvalues3 - call ProcessMode7ngwinD - cmp dword[ngwleftb],0 - jne near %%nextvalb3 -%%notskipvalues3 - - jmp %%finishmode7 -%%offscr3 - mov eax,[mode7xpos] - and eax,7FFh - mov [mode7xrpos],eax - mov eax,[mode7ypos] - and eax,7FFh - mov [mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[mode7ypos+1] - mov eax,[mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - - jmp %%nextvalr - ALIGN16 -%%nodr2 - add esi,%3 - dec dword[ngwleftb] - jz near %%fin2 -%%nextvalr - test byte[mode7xrpos+1],0F8h - jnz near %%rposoffxr -%%nextposxr - test byte[mode7yrpos+1],0F8h - jnz near %%rposoffyr -%%nextposyr - mov cl,[mode7yrpos+1] - mov ch,[mode7xrpos+1] - mov edx,[mode7xadder] - add dword[mode7xrpos],edx - mov edx,[mode7yadder] - sub dword[mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - mov dl,[edi+edx] - %1 - dec dword[ngwleftb] - jnz near %%nextvalr -%%fin2 - - cmp dword[ngwleft],0 - je %%notskipvalues4 - call ProcessMode7ngwinB - cmp dword[ngwleftb],0 - jne near %%nextvalr -%%notskipvalues4 - - jmp %%finishmode7 -%%rposoffxr - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov cl,[.mode7xincc] - cmp byte[.mode7ptr],cl - je %%roff -%%roffxretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [mode7xrpos],eax - add edi,ecx - jmp %%nextvalr -%%rposoffyr - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js %%roff -%%roffyretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [mode7yrpos],eax - add edi,ecx - jmp %%nextposxr -%%roff - test byte[mode7set],40h - jnz %%tilerep3 - jmp %%finishmode7 -%%tilerep3 - and byte[mode7yrpos+1],07h - and byte[mode7xrpos+1],07h - mov cl,[mode7yrpos+1] - mov eax,[mode7xadder] - mov ch,[mode7xrpos+1] - add [mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[mode7yadder] - mov dl,[vrama+edx] - sub [mode7yrpos],eax - %1 - dec dword[ngwleftb] - jnz near %%tilerep3 - - mov [mode7xrpos],eax - cmp dword[ngwleft],0 - je %%notskipvalues5 - call ProcessMode7ngwinB - cmp dword[ngwleftb],0 - jne near %%tilerep3 -%%notskipvalues5 - - jmp %%finishmode7 -%endmacro - -;************************************ - - - - diff --git a/tools/zsnes/src/video/mode716.asm b/tools/zsnes/src/video/mode716.asm deleted file mode 100644 index 649f09f..0000000 --- a/tools/zsnes/src/video/mode716.asm +++ /dev/null @@ -1,685 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%include "macros.mac" - -EXTSYM mode7tab,winptrref,nglogicval,winlogicaval,curmosaicsz,curvidoffset -EXTSYM cwinptr,mode7A,mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,vram,vrama -EXTSYM xtravbuf,ngwleft,ngwleftb,mode7xpos,mode7ypos,mode7xrpos,mode7yrpos -EXTSYM mode7xadder,mode7yadder,mode7hr,dcolortab,UnusedBitXor,UnusedBit,scrndis -EXTSYM vidbright,prevbrightdc,Gendcolortable,mode7ab,mode7cd,BGMA,BG1SXl,BG1SYl - -%include "video/mode716.mac" - -;******************************************************* -; Processes & Draws Mode 7 -;******************************************************* - -%macro Mode7Normal 0 - or dl,dl - jz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Normalnt 0 - or dl,dl - jz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Normalt 0 - or dl,dl - jz %%nodrawb - mov dx,[ebp+edx*2+512] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Normalmsnt 0 - or dl,dl - jz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi],dx - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Normalmst 0 - or dl,dl - jz %%nodrawb - mov dx,[ebp+edx*2+512] - mov [esi],dx - and dx,[UnusedBitXor] - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Normalsnt 0 - or dl,dl - jz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Normalst 0 - or dl,dl - jz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Direct 0 - or dl,dl - jz %%nodrawb - mov dx,[dcolortab+edx*4] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Directnt 0 - or dl,dl - jz %%nodrawb - mov dx,[dcolortab+edx*4] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Directt 0 - or dl,dl - jz %%nodrawb - mov dx,[dcolortab+edx*4] - or dx,[UnusedBit] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Directmsnt 0 - or dl,dl - jz %%nodrawb - mov dx,[dcolortab+edx*4] - mov [esi],dx - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Directmst 0 - or dl,dl - jz %%nodrawb - mov dx,[dcolortab+edx*4] - mov [esi+75036*2],dx - or dx,[UnusedBit] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Directsnt 0 - or dl,dl - jz %%nodrawb - mov dx,[dcolortab+edx*4] - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Directst 0 - or dl,dl - jz %%nodrawb - mov dx,[dcolortab+edx*4] - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7ExtBG 0 - mov [esi+75036*8],dl - or dl,dl - jz %%nodrawb - test dl,80h - jnz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7ExtBGnt 0 - mov [esi+75036*8],dl - or dl,dl - jz %%nodrawb - test dl,80h - jnz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7ExtBGt 0 - mov [esi+75036*8],dl - or dl,dl - jz %%nodrawb - test dl,80h - jnz %%nodrawb - mov dx,[ebp+edx*2+512] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7ExtBGmsnt 0 - mov [esi+75036*8],dl - or dl,dl - jz %%nodrawb - test dl,80h - jnz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi],dx - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7ExtBGmst 0 - mov [esi+75036*8],dl - or dl,dl - jz %%nodrawb - test dl,80h - jnz %%nodrawb - mov dx,[ebp+edx*2+512] - mov [esi+75036*2],dx - or dx,[UnusedBit] - mov [esi],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7ExtBGsnt 0 - mov [esi+75036*8],dl - or dl,dl - jz %%nodrawb - test dl,80h - jnz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7ExtBGst 0 - mov [esi+75036*8],dl - or dl,dl - jz %%nodrawb - test dl,80h - jnz %%nodrawb - mov dx,[ebp+edx*2] - mov [esi+75036*2],dx - xor edx,edx -%%nodrawb - add esi,2 -%endmacro - -SECTION .text - -NEWSYM drawmode7win16b - test byte[scrndis],1 - jz .notdisabled - ret -.notdisabled - CheckTransparency 01h,drawmode7win16bt -normal - Mode7NonMainSub Mode7Normal -drawmode7win16bt - test byte[scadtng+ebx],1h - jz near drawmode7win16bnt - test byte[BGMS1+ebx*2+1],1h - jnz near drawmode716bmst - Mode7NonMainSub Mode7Normalt -drawmode716bmst: - mov edi,[CMainWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmt - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bst -drawmode7w16bmst - Mode7NonMainSub Mode7Normalmst -drawmode7w16bmt - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmst - Mode7MainSub Mode7Normalmst,Mode7Normalst -drawmode7w16bst - Mode7MainSub Mode7Normalmst,Mode7Normalt -drawmode7win16bnt: - test byte[BGMS1+ebx*2+1],1h - jnz near drawsprngm716bmsnt - Mode7NonMainSub Mode7Normalnt -drawsprngm716bmsnt: - cmp dword[ngwinen],0 - je drawmode7w16bmsnt - mov edi,[CMainWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmnt - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bsnt -drawmode7w16bmsnt - Mode7NonMainSub Mode7Normalmsnt -drawmode7w16bmnt - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmsnt - Mode7MainSub Mode7Normalmsnt,Mode7Normalsnt -drawmode7w16bsnt - Mode7MainSub Mode7Normalmsnt,Mode7Normalnt - -NEWSYM drawmode7win16bd - test byte[scrndis],1 - jz .notdisabled - ret -.notdisabled - mov bl,[vidbright] - cmp bl,[prevbrightdc] - je .nodcchange - mov [prevbrightdc],bl - call Gendcolortable -.nodcchange - CheckTransparency 01h,drawmode7win16btd - Mode7NonMainSub Mode7Direct -drawmode7win16btd - test byte[scadtng+ebx],1h - jz near drawmode7win16bntd - test byte[BGMS1+ebx*2+1],1h - jnz near drawmode716bmstd - Mode7NonMainSub Mode7Directt -drawmode716bmstd: - mov edi,[CMainWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmtd - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bstd -drawmode7w16bmstd - Mode7NonMainSub Mode7Directmst -drawmode7w16bmtd - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmstd - Mode7MainSub Mode7Directmst,Mode7Directst -drawmode7w16bstd - Mode7MainSub Mode7Directmst,Mode7Directt -drawmode7win16bntd: - test byte[BGMS1+ebx*2+1],1h - jnz near drawsprngm716bmsntd - Mode7NonMainSub Mode7Directnt -drawsprngm716bmsntd: - cmp dword[ngwinen],0 - je drawmode7w16bmsntd - mov edi,[CMainWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmntd - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bsntd -drawmode7w16bmsntd - Mode7NonMainSub Mode7Directmsnt -drawmode7w16bmntd - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmsntd - Mode7MainSub Mode7Directmsnt,Mode7Directsnt -drawmode7w16bsntd - Mode7MainSub Mode7Directmsnt,Mode7Directnt - - -NEWSYM drawmode7ngextbg16b - test byte[scrndis],1 - jz .notdisabled - ret -.notdisabled - mov byte[curmosaicsz],1 - push ecx - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov ecx,256 -.loop - mov byte[esi+75036*8],0 - add esi,2 - dec ecx - jnz .loop - pop ecx - - cmp byte[mode7hr+ebx],1 -; je near drawmode7winextbghr16e - CheckTransparency 02h,drawmode7win16bte - mov esi,[cwinptr] - mov [winptrref],esi - mov esi,[curvidoffset] - Mode7NonMainSube Mode7ExtBG -drawmode7win16bte - test byte[scadtng+ebx],1h - jz near drawmode7win16bnte - test byte[BGMS1+ebx*2+1],1h - jnz near drawmode716bmste - Mode7NonMainSube Mode7ExtBGt -drawmode716bmste: - mov edi,[CMainWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmte - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bste -drawmode7w16bmste - Mode7NonMainSube Mode7ExtBGmst -drawmode7w16bmte - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmste - Mode7MainSube Mode7ExtBGmst,Mode7ExtBGst -drawmode7w16bste - Mode7MainSube Mode7ExtBGmst,Mode7ExtBGt -drawmode7win16bnte: - test byte[BGMS1+ebx*2+1],1h - jnz near drawsprngm716bmsnte - Mode7NonMainSube Mode7ExtBGnt -drawsprngm716bmsnte: - cmp dword[ngwinen],0 - je drawmode7w16bmsnte - mov edi,[CMainWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmnte - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bsnte -drawmode7w16bmsnte - Mode7NonMainSube Mode7ExtBGmsnt -drawmode7w16bmnte - mov edi,[CSubWinScr] - cmp byte[edi+ebx],0 - jne near drawmode7w16bmsnte - Mode7MainSube Mode7ExtBGmsnt,Mode7ExtBGsnt -drawmode7w16bsnte - Mode7MainSube Mode7ExtBGmsnt,Mode7ExtBGnt - -%macro ExtBG2 1 - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov ecx,256 - xor eax,eax -.loop - mov al,[esi+75036*8] - test al,80h - jz .nopr2 - and al,7Fh - %1 -.nopr2 - add esi,2 - dec ecx - jnz .loop - xor eax,eax - ret -%endmacro - -%macro ExtBGNormal 0 - mov dx,[ebp+eax*2] - mov [esi],dx -%endmacro -%macro ExtBGNormalt 0 - mov dx,[ebp+eax*2+512] - mov [esi],dx -%endmacro -%macro ExtBGNormalnt 0 - mov dx,[ebp+eax*2] - mov [esi],dx -%endmacro -%macro ExtBGNormalst 0 - mov dx,[ebp+eax*2] - mov [esi+75036*2],dx -%endmacro -%macro ExtBGNormalsnt 0 - mov dx,[ebp+eax*2] - mov [esi+75036*2],dx -%endmacro -%macro ExtBGNormalmst 0 - mov dx,[ebp+eax*2+512] - mov [esi],dx - and dx,[UnusedBitXor] - mov [esi+75036*2],dx -%endmacro -%macro ExtBGNormalmsnt 0 - mov dx,[ebp+eax*2] - mov [esi],dx - mov [esi+75036*2],dx -%endmacro - -NEWSYM drawmode7ngextbg216b - test byte[scrndis],1 - jz .notdisabled - ret -.notdisabled - cmp byte[mode7hr+ebx],1 -; je near drawmode7winextbg2hr16b - ; esi = pointer to video buffer - CheckTransparency 01h,drawmode7ngextbg216bt - test byte[FillSubScr+ebx],1 - jz .main - test byte[BGMS1+ebx*2],01h - jnz .main - add esi,75036*2 -.main - ExtBG2 ExtBGNormal -drawmode7ngextbg216bt: - test byte[scadtng+ebx],1h - jz near drawmode7ngextbg216bnt - test byte[BGMS1+ebx*2+1],1h - jnz near drawmode7ngextbg216bmst - ExtBG2 ExtBGNormalt -drawmode7ngextbg216bmst - test byte[BGMS1+ebx*2],1h - jz near drawmode7ngextbg216bst - ExtBG2 ExtBGNormalmst -drawmode7ngextbg216bst: - ExtBG2 ExtBGNormalst -drawmode7ngextbg216bnt: - test byte[BGMS1+ebx*2+1],1h - jnz near drawmode7ngextbg216bmsnt - ExtBG2 ExtBGNormalnt -drawmode7ngextbg216bmsnt - test byte[BGMS1+ebx*2],1h - jz near drawmode7ngextbg216bsnt - ExtBG2 ExtBGNormalmsnt -drawmode7ngextbg216bsnt: - ExtBG2 ExtBGNormalsnt - -ALIGN32 -SECTION .bss -mtemp resd 1 ; for byte move left -mmode7xpos resd 1 ; x position -mtempa2 resd 1 ; keep this blank! -mmode7xrpos resd 1 ; x position -mtempa resd 1 ; keep this blank! -mmode7ypos resd 1 ; y position -mtempb2 resd 1 ; keep this blank! -mmode7yrpos resd 1 ; y position -mtempb resd 1 ; keep this blank! -mmode7xadder resd 1 ; number to add for x -mtempc2 resd 1 ; keep this blank! -mmode7xadd2 resd 1 ; number to add for x -mtempc resd 1 ; keep this blank! -mmode7yadder resd 1 ; number to add for y -mtempd2 resd 1 ; keep this blank! -mmode7yadd2 resd 1 ; number to add for y -mtempd resd 1 ; keep this blank! -mmode7ptr resd 1 ; pointer value -mmode7xinc resd 1 ; number to add for x -mmode7xincc resd 1 ; range check for x -mmode7yinc resd 1 ; number to add for y -mmode7xsloc resd 1 ; which screen x -mmode7ysloc resd 1 ; which screen y -mmode7xsrl resd 1 ; which relative screen x -mmode7ysrl resd 1 ; which relative screen y -mcxloc resw 1 ; cx location -mcyloc resw 1 ; cy location -M7HROn resd 1 ; High Resolution On -switchtorep3 resd 1 - -m7xaddof resd 1 -m7xaddof2 resd 1 -m7yaddof resd 1 -m7yaddof2 resd 1 -pixelsleft resd 1 -mm7xaddof resd 1 -mm7xaddof2 resd 1 -mm7yaddof resd 1 -mm7yaddof2 resd 1 -SECTION .text - -%macro newvaluepred 2 - mov dx,[%1+ebx*4+8] - cmp dx,word[%1+ebx*4] - je %%nodivide - cmp byte[BGMA+ebx+2],7 - je %%mode7scaleb -%%nodivide - movsx edx,word[%1+ebx*4+4] - movsx ecx,word[%1+ebx*4] - add ecx,edx - sar ecx,1 - mov [%2],cx - jmp %%mode7scalend -%%mode7scaleb - mov esi,ebx - movsx ebx,word[%1+esi*4+8] - movsx edx,word[%1+esi*4] - sub ebx,edx - movsx ecx,word[%1+esi*4+4] - sub ecx,edx - mov eax,ecx - imul ecx - idiv ebx - add ax,word[%1+esi*4] - mov ebx,esi - mov [%2],ax -%%mode7scalend -%endmacro - -CalculateNewValues: - ; predict new values - push eax - push edx - push ebx - push esi - newvaluepred mode7ab,mode7A - newvaluepred mode7ab+2,mode7B - newvaluepred mode7cd,mode7C - newvaluepred mode7cd+2,mode7D - pop esi - pop ebx - pop edx - pop eax - - mov ecx,edx - xor edx,edx - mov dx,[BG1SXl+ebx*2+2] - add edx,ecx - shr edx,1 - - mov ecx,eax - mov eax,ebx - inc eax - test byte[mode7set],02h - jz .noflip - mov eax,255 - sub eax,ebx -.noflip - mov [m7starty],ax - mov ax,[BG1SYl+ebx*2+2] - add eax,ecx - ret - - -NEWSYM processmode7hires16b - cmp byte[BGMA+ebx+1],7 - jne near .nogo - push esi - push ebx - call CalculateNewValues - add esi,75036*4 - mov [curvidoffset],esi - mov dword[M7HROn],1 - call drawmode7win16b - mov dword[M7HROn],0 - pop ebx - pop esi -.nogo - ret - -NEWSYM processmode7hires16bd - cmp byte[BGMA+ebx+1],7 - jne near .nogo - push esi - push ebx - call CalculateNewValues - add esi,75036*4 - mov [curvidoffset],esi - mov dword[M7HROn],1 - call drawmode7win16bd - mov dword[M7HROn],0 - pop ebx - pop esi -.nogo - ret diff --git a/tools/zsnes/src/video/mode716.mac b/tools/zsnes/src/video/mode716.mac deleted file mode 100644 index 22469f1..0000000 --- a/tools/zsnes/src/video/mode716.mac +++ /dev/null @@ -1,1920 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 BGMS1,FillSubScr,CMainWinScr,CSubWinScr,scadtng -EXTSYM ngwinen,winbg1enval,BuildWindow,ngwintable,ngcwinptr,domosaicng16b -EXTSYM pesimpng - -;Skip transparency if the bg is just a sub-screen or there are no sub-screens -;for that line: -%macro CheckTransparency 2 - cmp byte[curmosaicsz],1 - jne %%nosubmain - test byte[BGMS1+ebx*2],%1 - jz %%nosubmain - test byte[FillSubScr+ebx],1 - jnz near %2 -%%nosubmain -%endmacro - -%macro Mode7NoTranspPreStartUp 0 - mov esi,[cwinptr] - mov [winptrref],esi - mov esi,[curvidoffset] - test byte[FillSubScr+ebx],1 - jz %%main - test byte[BGMS1+ebx*2],01h - jnz %%main - add esi,75036*2 -%%main -%endmacro - -%macro Mode7NoTranspPreStartUp2 0 - mov esi,[cwinptr] - mov [winptrref],esi - mov esi,[curvidoffset] -%endmacro - -%macro WinEnCheck 0 - mov esi,[CMainWinScr] - test byte[FillSubScr+ebx],1 - jz %%main2 - test byte[BGMS1+ebx*2],01h - jnz %%main2 - mov esi,[CSubWinScr] -%%main2 -%endmacro - -%macro WinEnCheckMS 0 - mov esi,winbg1enval -%endmacro - -SECTION .data -NEWSYM m7starty, dw 0 - -SECTION .text - -%macro CLIP 1 - test word[%1],2000h - jz %%zero - or word[%1],~3ffh - jmp %%notzero -%%zero - and word[%1],3ffh -%%notzero -%endmacro - -%macro Convert13Bit 0 - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz %%noneg - or bx,1110000000000000b -%%noneg -%endmacro - -%macro Mode7Calculate16b 0 - ; mode 7, ax = curyposition, dx = curxposition (left side) - ; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen - ; center map coordinates = (X0,Y0) - ; 1.) cx=X0-bg1scrolx, cy =Y0-ax - - cmp byte[M7HROn],1 - je near .calculateb - - mov bx,dx - Convert13Bit - mov [mcxloc],bx - mov bx,[mode7X0] - Convert13Bit - sub [mcxloc],bx - CLIP mcxloc - mov bx,ax - Convert13Bit - mov [mcyloc],bx - mov bx,[mode7Y0] - Convert13Bit - sub word[mcyloc],bx - CLIP mcyloc - - ; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D) - - movsx eax,word[mode7B] - movsx ebx,word[mcyloc] - imul eax,ebx - and eax,~63 - mov [mmode7xpos],eax - mov bx,[mode7X0] - Convert13Bit - add [mmode7xpos+1],bx - - movsx eax,word[mode7B] - movzx ebx,word[m7starty] - imul eax,ebx - and eax,~63 - add [mmode7xpos],eax - - movsx ebx,word[mcyloc] - movsx eax,word[mode7D] - imul eax,ebx - and eax,~63 - mov [mmode7ypos],eax - mov bx,[mode7Y0] - Convert13Bit - add [mmode7ypos+1],bx - - movsx eax,word[mode7D] - movzx ebx,word[m7starty] - imul eax,ebx - and eax,~63 - add [mmode7ypos],eax - - ; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B) - - movsx ebx,word[mcxloc] - movsx eax,word[mode7A] - mov [mmode7xadder],eax - imul eax,ebx - and eax,~63 - add [mmode7xpos],eax - - movsx eax,word[mode7C] - movsx ebx,word[mcxloc] - neg eax - mov [mmode7yadder],eax - neg eax - imul eax,ebx - and eax,~63 - add [mmode7ypos],eax - - test byte[mode7set],1 - jz .nohflip - mov eax,[mmode7xadder] - shl eax,8 - add [mmode7xpos],eax - neg dword[mmode7xadder] - mov eax,[mmode7yadder] - shl eax,8 - sub [mmode7ypos],eax - neg dword[mmode7yadder] -.nohflip - jmp .calculatea -.calculateb - - ; mode 7, ax = curyposition, dx = curxposition (left side) - ; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen - ; center map coordinates = (X0,Y0) - ; 1.) cx=X0-bg1scrolx, cy =Y0-ax - - mov bx,dx - Convert13Bit - mov [mcxloc],bx - mov bx,[mode7X0] - Convert13Bit - sub [mcxloc],bx - CLIP mcxloc - mov bx,ax - and bx,0011111111111111b ; 13 -> 16 bit signed value - test bx,0010000000000000b - jz .nonegccb - or bx,1100000000000000b -.nonegccb - mov [mcyloc],bx - mov bx,[mode7Y0] - Convert13Bit - add bx,bx - sub word[mcyloc],bx - test word[mcyloc],4000h - jz %%zero - or word[mcyloc],~7ffh - jmp %%notzero -%%zero - and word[mcyloc],7ffh -%%notzero - - ; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D) - - movsx eax,word[mode7B] - movsx ebx,word[mcyloc] - imul eax,ebx - sar eax,1 - and eax,~63 - mov [mmode7xpos],eax - mov bx,[mode7X0] - Convert13Bit - add [mmode7xpos+1],bx - - movsx eax,word[mode7B] - movzx ebx,word[m7starty] - imul eax,ebx - and eax,~63 - add [mmode7xpos],eax - - movsx ebx,word[mcyloc] - movsx eax,word[mode7D] - imul eax,ebx - sar eax,1 - and eax,~63 - mov [mmode7ypos],eax - mov bx,[mode7Y0] - Convert13Bit - add [mmode7ypos+1],bx - - movsx eax,word[mode7D] - movzx ebx,word[m7starty] - imul eax,ebx - and eax,~63 - add [mmode7ypos],eax - - ; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B) - - movsx ebx,word[mcxloc] - movsx eax,word[mode7A] - mov [mmode7xadder],eax - imul eax,ebx - and eax,~63 - ;neg eax - add [mmode7xpos],eax - - movsx eax,word[mode7C] - movsx ebx,word[mcxloc] - neg eax - mov [mmode7yadder],eax - neg eax - imul eax,ebx - and eax,~63 - add [mmode7ypos],eax - - test byte[mode7set],1 - jz .nohflipcb - mov eax,[mmode7xadder] - shl eax,8 - add [mmode7xpos],eax - neg dword[mmode7xadder] - mov eax,[mmode7yadder] - shl eax,8 - sub [mmode7ypos],eax - neg dword[mmode7yadder] -.nohflipcb -.calculatea -%endmacro - -SECTION .text - -Mode7Startup16b: - Mode7Calculate16b - ; esi = pointer to video buffer - mov [pesimpng],esi - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[mmode7xadd2],800h - mov byte[mmode7xinc],2 - mov byte[mmode7xincc],0 - test dword[mmode7xadder],80000000h - jz .noneg - mov dword[mmode7xadd2],-800h - mov byte[mmode7xinc],-2 - mov byte[mmode7xincc],0FEh -.noneg - mov dword[mmode7yadd2],800h - mov byte[mmode7yinc],1 - test dword[mmode7yadder],80000000h - jz .noneg2 - mov dword[mmode7yadd2],-800h - mov byte[mmode7yinc],-1 -.noneg2 - ret - -%macro Mode7Startup 0 - call Mode7Startup16b - - cmp byte[ngwinen],1 - je near .drawmode7win - - mov edi,[vram] - cmp dword[mmode7xadder],7F0h - jg near .nextval3 - cmp dword[mmode7xadder],-7F0h - jl near .nextval3 - cmp dword[mmode7yadder],7F0h - jg near .nextval3 - cmp dword[mmode7yadder],-7F0h - jl near .nextval3 -%endmacro - -%macro Mode7MidRoutines 0 - -.drawmode7win -.domosaicw - mov ebx,[mmode7xrpos] - mov [mode7xrpos],ebx - mov ebx,[mmode7yrpos] - mov [mode7yrpos],ebx - mov ebx,[mmode7xadder] - mov [mode7xadder],ebx - mov ebx,[mmode7yadder] - mov [mode7yadder],ebx - mov ebx,[mmode7xpos] - mov [mode7xpos],ebx - mov ebx,[mmode7ypos] - mov [mode7ypos],ebx -%endmacro - - -NEWSYM ProcessMode7ngwin16b - mov ecx,[ngcwinptr] - mov ecx,[ecx] - or ecx,ecx - jz near .winb - cmp ecx,[ngwleft] - jae .alldisplay - sub [ngwleft],ecx - mov [ngwleftb],ecx - xor ecx,ecx - mov eax,[mode7xrpos] - ret -.alldisplay - mov ecx,[ngwleft] - mov [ngwleftb],ecx - mov dword[ngwleft],0 - xor ecx,ecx - mov eax,[mode7xrpos] - ret -.winb -NEWSYM ProcessMode7ngwinB16b - add dword[ngcwinptr],4 - mov ecx,[ngcwinptr] - mov ecx,[ecx] - cmp ecx,[ngwleft] - jae near .finishmode7 - -; mov ecx,[ngwleft] -; mov dword[ngwleftb],ecx -; mov dword[ngwleft],0 -; xor ecx,ecx -; mov eax,[mode7xrpos] -; ret - - sub [ngwleft],ecx - or ecx,ecx - jz .noclip - mov [pixelsleft],ecx -.nextvalngw - test byte[mode7xrpos+1],0F8h - jnz near .rposoffx -.nextposx - test byte[mode7yrpos+1],0F8h - jnz near .rposoffy -.nextposy - - mov eax,[mode7xadder] - add [mode7xrpos],eax - mov eax,[mode7yadder] - sub [mode7yrpos],eax - add esi,2 - dec dword[pixelsleft] - jnz near .nextvalngw -.noclip - add dword[ngcwinptr],4 - jmp ProcessMode7ngwin16b -.finishmode7 - mov dword[ngwleft],0 - mov dword[ngwleftb],0 - ret - -.rposoffx - mov eax,[m7xaddof] - sub [mode7xrpos],eax - add bl,[m7xaddof2] - test byte[mode7xrpos+1],0F8h - jz .noaddstuff - add bl,[mmode7xinc] - mov eax,[mmode7xadd2] - sub [mode7xrpos],eax -.noaddstuff - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp .nextposx -.rposoffy - mov eax,[m7yaddof] - add dword[mode7yrpos],eax - sub bh,[m7yaddof2] - test byte[mode7yrpos+1],0F8h - jz .noaddstuff2 - sub bh,[mmode7yinc] - mov eax,[mmode7yadd2] - add dword[mode7yrpos],eax -.noaddstuff2 - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp .nextposy - -NEWSYM ProcessMode7ngwinC16b - mov ecx,[ngcwinptr] - mov ecx,[ecx] - or ecx,ecx - jz near .winb - cmp ecx,[ngwleft] - jae .alldisplay - sub [ngwleft],ecx - mov [ngwleftb],ecx - xor ecx,ecx - mov eax,[mode7xpos] - ret -.alldisplay - mov ecx,[ngwleft] - mov [ngwleftb],ecx - mov dword[ngwleft],0 - xor ecx,ecx - mov eax,[mode7xpos] - ret -.winb -NEWSYM ProcessMode7ngwinD16b - add dword[ngcwinptr],4 - mov ecx,[ngcwinptr] - mov ecx,[ecx] - cmp ecx,[ngwleft] - jae near .finishmode7 - sub [ngwleft],ecx - or ecx,ecx - jz .noclip -.nextvalngw -.nextvalr -; cmp byte[switchtorep3],1 -; je .nextposy -; test byte[mode7xpos+1],0F8h -; jnz near .rposoffx -.nextposx -; test byte[mode7ypos+1],0F8h -; jnz near .rposoffy -.nextposy - mov eax,[mode7xadder] - add [mode7xpos],eax - mov eax,[mode7yadder] - sub [mode7ypos],eax - add esi,2 - dec ecx - jnz near .nextvalngw -.noclip - add dword[ngcwinptr],4 - jmp ProcessMode7ngwin16b -.finishmode7 - mov dword[ngwleft],0 - mov dword[ngwleftb],0 - ret -.rposoffx - mov al,[mmode7xinc] - mov edi,[vram] - add [mmode7ptr],al - mov cl,[mmode7xincc] - cmp byte[mmode7ptr],cl - je .roffx -.roffxretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7xadd2] - shl ecx,7 - sub [mode7xrpos],eax - add edi,ecx - jmp .nextvalr -.roffx - mov byte[switchtorep3],1 - jmp .roffxretb -.rposoffy - mov al,[mmode7yinc] - mov edi,[vram] - sub [mmode7ptr+1],al - js .roffy -.roffyretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7yadd2] - shl ecx,7 - add [mode7yrpos],eax - add edi,ecx - jmp .nextposx -.roffy - mov byte[switchtorep3],1 - jmp .roffyretb - -%macro ProcessBuildWindow16b 1 - mov dword[ngwinen],0 - test byte[esi+ebx+%1*256],0Ah - jz %%nowindowing - push eax - push ebx - mov al,[winlogicaval+ebx*2] - shr al,%1*2 - and al,03h - mov [nglogicval],al - mov eax,ebx - add ebx,%1*256 - call BuildWindow - cmp dword[ngwintable],0 - je %%zero - dec dword[ngwintable] - jmp %%notzero -%%zero - dec dword[ngwintable+4] -%%notzero - pop ebx - pop eax - mov dword[ngcwinptr],ngwintable -%%nowindowing -%endmacro - -%macro Mode7Process 3 - mov dword[mtemp],256 - test byte[mode7set],80h - jnz near %%norep2 - - mov eax,[mmode7xpos] - and eax,7FFh - mov [mmode7xrpos],eax - mov eax,[mmode7ypos] - and eax,7FFh - mov [mmode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[mmode7ypos+1] - mov eax,[mmode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [mmode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - mov eax,[mmode7xrpos] - mov ebx,[mmode7ptr] - jmp %%nextval - ALIGN16 -%%nextval - test ah,08h - jnz near %%rposoffx -%%nextposx - test byte[mmode7yrpos+1],08h - jnz near %%rposoffy -%%nextposy - mov ch,ah - mov edx,[mmode7yadder] - mov cl,[mmode7yrpos+1] - sub dword[mmode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[mmode7xadder] - mov dl,[edi+edx] - %1 - dec dword[mtemp] - jnz near %%nextval - jmp %%finishmode7 - -%%rposoffx - add bl,[mmode7xinc] - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - sub eax,[mmode7xadd2] - lea edi,[ecx+vrama] - jmp %%nextposx - -%%rposoffy - sub bh,[mmode7yinc] - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - mov edx,[mmode7yadd2] - shl ecx,7 - add dword[mmode7yrpos],edx - lea edi,[ecx+vrama] - jmp %%nextposy - -%%finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near %2 - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -%%norep2 - test byte[mode7set],40h - jnz %%tilerep2 - jmp %%nextvalb2 - ALIGN16 -%%nextvalb2 - cmp byte[mmode7ypos+2],3 - ja %%offscr2 - cmp byte[mmode7xpos+2],3 - jbe near %%offscr3 -%%offscr2 - mov eax,[mmode7xadder] - mov ebx,[mmode7yadder] - add [mmode7xpos],eax - sub [mmode7ypos],ebx - add esi,%3 - dec dword[mtemp] - jnz near %%nextvalb2 - jmp %%finishmode7 -%%tilerep2 -%%nextvalb3 - cmp byte[mmode7ypos+2],3 - ja %%offscr2b - cmp byte[mmode7xpos+2],3 - jbe near %%offscr3 -%%offscr2b - mov ch,[mmode7xpos+1] - mov eax,[mmode7xadder] - mov cl,[mmode7ypos+1] - mov ebx,[mmode7yadder] - mov dl,[mode7tab+ecx] - add [mmode7xpos],eax - mov dl,[vrama+edx] - sub [mmode7ypos],ebx - %1 - dec dword[mtemp] - jnz near %%nextvalb3 - jmp %%finishmode7 -%%offscr3 - mov eax,[mmode7xpos] - and eax,7FFh - mov [mmode7xrpos],eax - mov eax,[mmode7ypos] - and eax,7FFh - mov [mmode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[mmode7ypos+1] - mov eax,[mmode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [mmode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - jmp %%nextvalr - ALIGN16 -%%nodr2 - add esi,%3 - dec dword[mtemp] - jz near %%fin2 -%%nextvalr - test byte[mmode7xrpos+1],08h - jnz near %%rposoffxr -%%nextposxr - test byte[mmode7yrpos+1],08h - jnz near %%rposoffyr -%%nextposyr - mov cl,[mmode7yrpos+1] - mov ch,[mmode7xrpos+1] - mov edx,[mmode7xadder] - add dword[mmode7xrpos],edx - mov edx,[mmode7yadder] - sub dword[mmode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] -%%m7yrpa2 - mov dl,[edi+edx] - %1 - dec dword[mtemp] - jnz near %%nextvalr -%%fin2 - jmp %%finishmode7 -%%rposoffxr - mov al,[mmode7xinc] - mov edi,[vram] - add [mmode7ptr],al - mov cl,[mmode7xincc] - cmp byte[mmode7ptr],cl - je %%roff -%%roffxretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7xadd2] - shl ecx,7 - sub [mmode7xrpos],eax - add edi,ecx - jmp %%nextposxr -%%rposoffyr - mov al,[mmode7yinc] - mov edi,[vram] - sub [mmode7ptr+1],al - js %%roff -%%roffyretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7yadd2] - shl ecx,7 - add [mmode7yrpos],eax - add edi,ecx - jmp %%nextposyr -%%roff - test byte[mode7set],40h - jnz %%tilerep3 - jmp %%finishmode7 -%%tilerep3 - and byte[mmode7yrpos+1],07h - and byte[mmode7xrpos+1],07h - mov cl,[mmode7yrpos+1] - mov eax,[mmode7xadder] - mov ch,[mmode7xrpos+1] - add [mmode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[mmode7yadder] - mov dl,[vrama+edx] - sub [mmode7yrpos],eax - %1 - dec dword[mtemp] - jnz near %%tilerep3 - jmp %%finishmode7 -%endmacro - -%macro Mode7ProcessB 3 - mov dword[mtemp],256 - test byte[mode7set],80h - jnz near %%norep2 - - mov eax,[mmode7xpos] - and eax,7FFh - mov [mmode7xrpos],eax - mov eax,[mmode7ypos] - and eax,7FFh - mov [mmode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[mmode7ypos+1] - mov eax,[mmode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [mmode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - xor dl,dl - xor ecx,ecx - mov ebx,[mmode7xadder] - test ebx,80000000h - jz %%nexta - neg ebx -%%nexta - cmp ebx,0800h - jl %%skipx - sub ebx,800h - add ecx,[mmode7xadd2] - add dl,[mmode7xinc] - jmp %%nexta -%%skipx - mov [mm7xaddof],ecx - mov [mm7xaddof2],dl - - xor dl,dl - xor ecx,ecx - mov ebx,[mmode7yadder] - test ebx,80000000h - jz %%nextay - neg ebx -%%nextay - cmp ebx,0800h - jl %%skipy - sub ebx,800h - add ecx,[mmode7yadd2] - add dl,[mmode7yinc] - jmp %%nextay -%%skipy - mov [mm7yaddof],ecx - mov [mm7yaddof2],dl - - xor ecx,ecx - - mov eax,[mmode7xrpos] - mov ebx,[mmode7ptr] - jmp %%nextval - ALIGN16 -%%nextval - test ah,0F8h - jnz near %%rposoffx -%%nextposx - test byte[mmode7yrpos+1],0F8h - jnz near %%rposoffy -%%nextposy - mov ch,ah - mov cl,[mmode7yrpos+1] - mov edx,[mmode7yadder] - sub dword[mmode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[mmode7xadder] - mov dl,[edi+edx] - %1 - dec dword[mtemp] - jnz near %%nextval - jmp %%finishmode7 - -%%rposoffx - sub eax,[mm7xaddof] - add bl,[mm7xaddof2] - test ah,0F8h - jz %%noaddstuff - add bl,[mmode7xinc] - sub eax,[mmode7xadd2] -%%noaddstuff - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposx - -%%rposoffy - mov edx,[m7yaddof] - add dword[mmode7yrpos],edx - sub bh,[mm7yaddof2] - test byte[mmode7yrpos+1],0F8h - jz %%noaddstuff2 - mov edx,[mmode7yadd2] - sub bh,[mmode7yinc] - add dword[mmode7yrpos],edx -%%noaddstuff2 - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposy - -%%finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near %2 - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -%%norep2 - test byte[mode7set],40h - jnz %%tilerep2 - jmp %%nextvalb2 - ALIGN16 -%%nextvalb2 - cmp byte[mmode7ypos+2],3 - ja %%offscr2 - cmp byte[mmode7xpos+2],3 - jbe near %%offscr3 -%%offscr2 - mov eax,[mmode7xadder] - mov ebx,[mmode7yadder] - add [mmode7xpos],eax - sub [mmode7ypos],ebx - add esi,%3 - dec dword[mtemp] - jnz near %%nextvalb2 - jmp %%finishmode7 -%%tilerep2 -%%nextvalb3 - cmp byte[mmode7ypos+2],3 - ja %%offscr2b - cmp byte[mmode7xpos+2],3 - jbe near %%offscr3 -%%offscr2b - mov ch,[mmode7xpos+1] - mov eax,[mmode7xadder] - mov cl,[mmode7ypos+1] - mov ebx,[mmode7yadder] - mov dl,[mode7tab+ecx] - add [mmode7xpos],eax - mov dl,[vrama+edx] - sub [mmode7ypos],ebx - %1 - dec dword[mtemp] - jnz near %%nextvalb3 - jmp %%finishmode7 -%%offscr3 - mov eax,[mmode7xpos] - and eax,7FFh - mov [mmode7xrpos],eax - mov eax,[mmode7ypos] - and eax,7FFh - mov [mmode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[mmode7ypos+1] - mov eax,[mmode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [mmode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - jmp %%nextvalr - ALIGN16 -%%nodr2 - add esi,%3 - dec dword[mtemp] - jz near %%fin2 -%%nextvalr - test byte[mmode7xrpos+1],0F8h - jnz near %%rposoffxr -%%nextposxr - test byte[mmode7yrpos+1],0F8h - jnz near %%rposoffyr -%%nextposyr - mov cl,[mmode7yrpos+1] - mov ch,[mmode7xrpos+1] - mov edx,[mmode7xadder] - add dword[mmode7xrpos],edx - mov edx,[mmode7yadder] - sub dword[mmode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - mov dl,[edi+edx] - %1 - dec dword[mtemp] - jnz near %%nextvalr -%%fin2 - jmp %%finishmode7 -%%rposoffxr - mov al,[mmode7xinc] - mov edi,[vram] - add [mmode7ptr],al - mov cl,[mmode7xincc] - cmp byte[mmode7ptr],cl - je %%roff -%%roffxretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7xadd2] - shl ecx,7 - sub [mmode7xrpos],eax - add edi,ecx - jmp %%nextvalr -%%rposoffyr - mov al,[mmode7yinc] - mov edi,[vram] - sub [mmode7ptr+1],al - js %%roff -%%roffyretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7yadd2] - shl ecx,7 - add [mmode7yrpos],eax - add edi,ecx - jmp %%nextposxr -%%roff - test byte[mode7set],40h - jnz %%tilerep3 - jmp %%finishmode7 -%%tilerep3 - and byte[mmode7yrpos+1],07h - and byte[mmode7xrpos+1],07h - mov cl,[mmode7yrpos+1] - mov eax,[mmode7xadder] - mov ch,[mmode7xrpos+1] - add [mmode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[mmode7yadder] - mov dl,[vrama+edx] - sub [mmode7yrpos],eax - %1 - dec dword[mtemp] - jnz near %%tilerep3 - jmp %%finishmode7 -%endmacro - -%macro Mode7Processngw16b 3 - mov dword[ngwleftb],256 - mov dword[ngwleft],256 - test byte[mode7set],80h - jnz near %%norep2 - - mov eax,[mmode7xpos] - and eax,7FFh - mov [mode7xrpos],eax - mov eax,[mmode7ypos] - and eax,7FFh - mov [mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[mmode7ypos+1] - mov eax,[mmode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [mmode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - xor dl,dl - xor ecx,ecx - mov ebx,[mmode7xadder] - test ebx,80000000h - jz %%nexta - neg ebx -%%nexta - cmp ebx,0800h - jl %%skipx - sub ebx,800h - add ecx,[mmode7xadd2] - add dl,[mmode7xinc] - jmp %%nexta -%%skipx - mov [mm7xaddof],ecx - mov [mm7xaddof2],dl - mov [m7xaddof],ecx - mov [m7xaddof2],dl - - xor dl,dl - xor ecx,ecx - mov ebx,[mmode7yadder] - test ebx,80000000h - jz %%nextay - neg ebx -%%nextay - cmp ebx,0800h - jl %%skipy - sub ebx,800h - add ecx,[mmode7yadd2] - add dl,[mmode7yinc] - jmp %%nextay -%%skipy - mov [mm7yaddof],ecx - mov [mm7yaddof2],dl - mov [m7yaddof],ecx - mov [m7yaddof2],dl - - xor ecx,ecx - - mov eax,[mode7xrpos] - mov ebx,[mmode7ptr] - - call ProcessMode7ngwin16b - - cmp dword[ngwleftb],0 - jne near %%nextval - jmp %%finishmode7 - ALIGN16 -%%nextval - test ah,0F8h - jnz near %%rposoffx -%%nextposx - test byte[mode7yrpos+1],0F8h - jnz near %%rposoffy -%%nextposy - mov ch,ah - mov cl,[mode7yrpos+1] - mov edx,[mode7yadder] - sub dword[mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[mode7xadder] - mov dl,[edi+edx] - %1 - dec dword[ngwleftb] - jnz near %%nextval - mov [mode7xrpos],eax - cmp dword[ngwleft],0 - je %%notskipvalues - call ProcessMode7ngwinB16b - cmp dword[ngwleftb],0 - jne near %%nextval -%%notskipvalues - jmp %%finishmode7 - -%%rposoffx - sub eax,[mm7xaddof] - add bl,[mm7xaddof2] - test ah,0F8h - jz %%noaddstuff - add bl,[mmode7xinc] - sub eax,[mmode7xadd2] -%%noaddstuff - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposx - -%%rposoffy - mov edx,[mm7yaddof] - add dword[mode7yrpos],edx - sub bh,[mm7yaddof2] - test byte[mode7yrpos+1],0F8h - jz %%noaddstuff2 - mov edx,[mmode7yadd2] - sub bh,[mmode7yinc] - add dword[mode7yrpos],edx -%%noaddstuff2 - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - lea edi,[ecx+vrama] - jmp %%nextposy - -%%finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near %2 - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -%%norep2 - mov byte[switchtorep3],0 - -; mov dword[ngcwinptr],ngwintable blahblah -; mov ebx,dword[ngcwinptr] -; mov dword[ebx],900 - ;ngwintable -; jmp %%finishmode7 - - call ProcessMode7ngwinC16b - cmp dword[ngwleftb],0 - jne near %%nextvald - jmp %%finishmode7 -%%nextvald - mov dword[ngwleft],0 - - test byte[mode7set],40h - jnz near %%tilerep2 - jmp %%nextvalb2 - ALIGN16 -%%nextvalb2 - cmp byte[mode7ypos+2],3 - ja %%offscr2 - cmp byte[mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2 - mov eax,[mode7xadder] - mov ebx,[mode7yadder] - add [mode7xpos],eax - sub [mode7ypos],ebx - add esi,%3 - dec dword[ngwleftb] - jnz near %%nextvalb2 - - cmp dword[ngwleft],0 - je %%notskipvalues3b - call ProcessMode7ngwinD16b - cmp dword[ngwleftb],0 - jne near %%nextvalb2 -%%notskipvalues3b - - jmp %%finishmode7 -%%tilerep2 -%%nextvalb3 - cmp byte[mode7ypos+2],3 - ja %%offscr2b - cmp byte[mode7xpos+2],3 - jbe near %%offscr3 -%%offscr2b - mov ch,[mode7xpos+1] - mov eax,[mode7xadder] - mov cl,[mode7ypos+1] - mov ebx,[mode7yadder] - mov dl,[mode7tab+ecx] - add [mode7xpos],eax - mov dl,[vrama+edx] - sub [mode7ypos],ebx - %1 - dec dword[ngwleftb] - jnz near %%nextvalb3 - - cmp dword[ngwleft],0 - je %%notskipvalues3 - call ProcessMode7ngwinD16b - cmp dword[ngwleftb],0 - jne near %%nextvalb3 -%%notskipvalues3 - - jmp %%finishmode7 -%%offscr3 - mov eax,[mode7xpos] - and eax,7FFh - mov [mode7xrpos],eax - mov eax,[mode7ypos] - and eax,7FFh - mov [mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[mode7ypos+1] - mov eax,[mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [mmode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - jmp %%nextvalr - ALIGN16 -%%nodr2 - add esi,%3 - dec dword[ngwleftb] - jz near %%fin2 -%%nextvalr - test byte[mode7xrpos+1],0F8h - jnz near %%rposoffxr -%%nextposxr - test byte[mode7yrpos+1],0F8h - jnz near %%rposoffyr -%%nextposyr - mov cl,[mode7yrpos+1] - mov ch,[mode7xrpos+1] - mov edx,[mode7xadder] - add dword[mode7xrpos],edx - mov edx,[mode7yadder] - sub dword[mode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - mov dl,[edi+edx] - %1 - dec dword[ngwleftb] - jnz near %%nextvalr -%%fin2 - - cmp dword[ngwleft],0 - je %%notskipvalues4 - call ProcessMode7ngwinB16b - cmp byte[switchtorep3],0 - jne near %%tilerep3 - cmp dword[ngwleftb],0 - jne near %%nextvalr -%%notskipvalues4 - - jmp %%finishmode7 -%%rposoffxr - mov al,[mmode7xinc] - mov edi,[vram] - add [mmode7ptr],al - mov cl,[mmode7xincc] - cmp byte[mmode7ptr],cl - je %%roff -%%roffxretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7xadd2] - shl ecx,7 - sub [mode7xrpos],eax - add edi,ecx - jmp %%nextvalr -%%rposoffyr - mov al,[mmode7yinc] - mov edi,[vram] - sub [mmode7ptr+1],al - js %%roff -%%roffyretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7yadd2] - shl ecx,7 - add [mode7yrpos],eax - add edi,ecx - jmp %%nextposxr -%%roff - test byte[mode7set],40h - jnz %%tilerep3 - jmp %%finishmode7 -%%tilerep3 - and byte[mode7yrpos+1],07h - and byte[mode7xrpos+1],07h - mov cl,[mode7yrpos+1] - mov eax,[mode7xadder] - mov ch,[mode7xrpos+1] - add [mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[mode7yadder] - mov dl,[vrama+edx] - sub [mode7yrpos],eax - %1 - dec dword[ngwleftb] - jnz near %%tilerep3 - - mov [mode7xrpos],eax - cmp dword[ngwleft],0 - je %%notskipvalues5 - call ProcessMode7ngwinB16b - cmp dword[ngwleftb],0 - jne near %%tilerep3 -%%notskipvalues5 - - jmp %%finishmode7 -%endmacro - -%macro Mode7Processngw216b 4 - mov eax,[ngcwinptr] - mov eax,[eax] - mov [ngwleft],eax - - mov dword[mtemp],256 - test byte[mode7set],80h - jnz near %%norep2start - - mov eax,[mmode7xpos] - and eax,7FFh - mov [mmode7xrpos],eax - mov eax,[mmode7ypos] - and eax,7FFh - mov [mmode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[mmode7ypos+1] - mov eax,[mmode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [mmode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - mov eax,[mmode7xrpos] - mov ebx,[mmode7ptr] - - cmp dword[ngwleft],0 - jne %%nextvalwb - jmp %%nextvalwc -%%nextvalw - add dword[ngcwinptr],4 - mov edx,[ngcwinptr] - mov edx,[edx] - mov [ngwleft],edx - xor edx,edx -%%nextvalwb - - test ah,08h - jnz near %%rposoffxw -%%nextposxw - test byte[mmode7yrpos+1],08h - jnz near %%rposoffyw -%%nextposyw - mov ch,ah - mov cl,[mmode7yrpos+1] - mov edx,[mmode7yadder] - sub dword[mmode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[mmode7xadder] - mov dl,[edi+edx] - %1 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%nextvalwb - jmp %%nextvalwc - -%%rposoffxw - add bl,[mmode7xinc] - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - sub eax,[mmode7xadd2] - lea edi,[ecx+vrama] - jmp %%nextposxw -%%rposoffyw - sub bh,[mmode7yinc] - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - mov edx,[mmode7yadd2] - shl ecx,7 - add dword[mmode7yrpos],edx - lea edi,[ecx+vrama] - jmp %%nextposyw - -%%nextvalwc - add dword[ngcwinptr],4 - mov edx,[ngcwinptr] - mov edx,[edx] - mov [ngwleft],edx - xor edx,edx -%%nextval - test ah,08h - jnz near %%rposoffx -%%nextposx - test byte[mmode7yrpos+1],08h - jnz near %%rposoffy -%%nextposy - mov ch,ah - mov cl,[mmode7yrpos+1] - mov edx,[mmode7yadder] - sub dword[mmode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - add eax,[mmode7xadder] - mov dl,[edi+edx] - %4 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%nextval - jmp %%nextvalw -%%rposoffx - add bl,[mmode7xinc] - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - sub eax,[mmode7xadd2] - lea edi,[ecx+vrama] - jmp %%nextposx -%%rposoffy - sub bh,[mmode7yinc] - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - mov edx,[mmode7yadd2] - shl ecx,7 - add dword[mmode7yrpos],edx - lea edi,[ecx+vrama] - jmp %%nextposy -%%finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near %2 - ret - -; ******************************************* - -%%norep2start - cmp dword[ngwleft],0 - jne %%firstsetwb - jmp %%firstsetww -%%firstsetw - add dword[ngcwinptr],4 - mov edx,[ngcwinptr] - mov edx,[edx] - mov [ngwleft],edx - xor edx,edx -%%firstsetwb -%%norep2 - test byte[mode7set],40h - jnz %%tilerep2 -%%nextvalb2 - cmp byte[mmode7ypos+2],3 - ja %%offscr2 - cmp byte[mmode7xpos+2],3 - jbe near %%offscr3 -%%offscr2 - mov eax,[mmode7xadder] - mov ebx,[mmode7yadder] - add [mmode7xpos],eax - sub [mmode7ypos],ebx - add esi,%3 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%nextvalb2 - jmp %%firstsetww -%%tilerep2 -%%nextvalb3 - cmp byte[mmode7ypos+2],3 - ja %%offscr2b - cmp byte[mmode7xpos+2],3 - jbe near %%offscr3 -%%offscr2b - mov ch,[mmode7xpos+1] - mov eax,[mmode7xadder] - mov cl,[mmode7ypos+1] - mov ebx,[mmode7yadder] - mov dl,[mode7tab+ecx] - add [mmode7xpos],eax - mov dl,[vrama+edx] - sub [mmode7ypos],ebx - %1 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%nextvalb3 - jmp %%firstsetw - -%%offscr3 - mov eax,[mmode7xpos] - and eax,7FFh - mov [mmode7xrpos],eax - mov eax,[mmode7ypos] - and eax,7FFh - mov [mmode7yrpos],eax - ; get tile data offset into edi - mov ebx,[mmode7ypos+1] - mov eax,[mmode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [mmode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - jmp %%nextvalr -%%nodr2 - add esi,%3 - - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz %%nextvalr -%%secondsetw - add dword[ngcwinptr],4 - mov edx,[ngcwinptr] - mov edx,[edx] - mov [ngwleft],edx - xor edx,edx -%%nextvalr - test byte[mmode7xrpos+1],08h - jnz near %%rposoffxr -%%nextposxr - test byte[mmode7yrpos+1],08h - jnz near %%rposoffyr -%%nextposyr - mov cl,[mmode7yrpos+1] - mov ch,[mmode7xrpos+1] - mov edx,[mmode7xadder] - add dword[mmode7xrpos],edx - mov edx,[mmode7yadder] - sub dword[mmode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - mov dl,[edi+edx] - %1 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%nextvalr - jmp %%secondsetww -%%rposoffxr - mov al,[mmode7xinc] - mov edi,[vram] - add [mmode7ptr],al - mov cl,[mmode7xincc] - cmp byte[mmode7ptr],cl - je %%roff -%%roffxretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7xadd2] - shl ecx,7 - sub [mmode7xrpos],eax - add edi,ecx - jmp %%nextposxr -%%rposoffyr - mov al,[mmode7yinc] - mov edi,[vram] - sub [mmode7ptr+1],al - js %%roff -%%roffyretb - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7yadd2] - shl ecx,7 - add [mmode7yrpos],eax - add edi,ecx - jmp %%nextposyr - -%%roff - test byte[mode7set],40h - jnz %%tilerep3 - jmp %%finishmode7 -%%thirdsetw - add dword[ngcwinptr],4 - mov edx,[ngcwinptr] - mov edx,[edx] - mov [ngwleft],edx - xor edx,edx -%%tilerep3 - and byte[mmode7yrpos+1],07h - and byte[mmode7xrpos+1],07h - mov cl,[mmode7yrpos+1] - mov eax,[mmode7xadder] - mov ch,[mmode7xrpos+1] - add [mmode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[mmode7yadder] - mov dl,[vrama+edx] - sub [mmode7yrpos],eax - %1 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%tilerep3 - jmp %%thirdsetww - -; ************************************* -%%firstsetww - add dword[ngcwinptr],4 - mov edx,[ngcwinptr] - mov edx,[edx] - mov [ngwleft],edx - xor edx,edx -%%norep2w - test byte[mode7set],40h - jnz %%tilerep2w -%%nextvalb2w - cmp byte[mmode7ypos+2],3 - ja %%offscr2w - cmp byte[mmode7xpos+2],3 - jbe near %%offscr3w -%%offscr2w - mov eax,[mmode7xadder] - mov ebx,[mmode7yadder] - add [mmode7xpos],eax - sub [mmode7ypos],ebx - add esi,%3 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%nextvalb2w - jmp %%firstsetw -%%tilerep2w -%%nextvalb3w - cmp byte[mmode7ypos+2],3 - ja %%offscr2bw - cmp byte[mmode7xpos+2],3 - jbe near %%offscr3w -%%offscr2bw - mov ch,[mmode7xpos+1] - mov eax,[mmode7xadder] - mov cl,[mmode7ypos+1] - mov ebx,[mmode7yadder] - mov dl,[mode7tab+ecx] - add [mmode7xpos],eax - mov dl,[vrama+edx] - sub [mmode7ypos],ebx - %4 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%nextvalb3w - jmp %%firstsetw - -%%offscr3w - mov eax,[mmode7xpos] - and eax,7FFh - mov [mmode7xrpos],eax - mov eax,[mmode7ypos] - and eax,7FFh - mov [mmode7yrpos],eax - ; get tile data offset into edi - mov ebx,[mmode7ypos+1] - mov eax,[mmode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [mmode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - jmp %%nextvalrw -%%nodr2w - add esi,%3 - - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz %%nextvalrw -%%secondsetww - add dword[ngcwinptr],4 - mov edx,[ngcwinptr] - mov edx,[edx] - mov [ngwleft],edx - xor edx,edx -%%nextvalrw - test byte[mmode7xrpos+1],08h - jnz near %%rposoffxrw -%%nextposxrw - test byte[mmode7yrpos+1],08h - jnz near %%rposoffyrw -%%nextposyrw - mov cl,[mmode7yrpos+1] - mov ch,[mmode7xrpos+1] - mov edx,[mmode7xadder] - add dword[mmode7xrpos],edx - mov edx,[mmode7yadder] - sub dword[mmode7yrpos],edx - xor edx,edx - mov dl,[mode7tab+ecx] - mov dl,[edi+edx] - %4 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%nextvalrw - jmp %%secondsetw -%%rposoffxrw - mov al,[mmode7xinc] - mov edi,[vram] - add [mmode7ptr],al - mov cl,[mmode7xincc] - cmp byte[mmode7ptr],cl - je %%roffw -%%roffxretbw - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7xadd2] - shl ecx,7 - sub [mmode7xrpos],eax - add edi,ecx - jmp %%nextposxrw -%%rposoffyrw - mov al,[mmode7yinc] - mov edi,[vram] - sub [mmode7ptr+1],al - js %%roffw -%%roffyretbw - mov ebx,[mmode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[mmode7yadd2] - shl ecx,7 - add [mmode7yrpos],eax - add edi,ecx - jmp %%nextposyrw - -%%roffw - test byte[mode7set],40h - jnz %%tilerep3w - jmp %%finishmode7 -%%thirdsetww - add dword[ngcwinptr],4 - mov edx,[ngcwinptr] - mov edx,[edx] - mov [ngwleft],edx - xor edx,edx -%%tilerep3w - and byte[mmode7yrpos+1],07h - and byte[mmode7xrpos+1],07h - mov cl,[mmode7yrpos+1] - mov eax,[mmode7xadder] - mov ch,[mmode7xrpos+1] - add [mmode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[mmode7yadder] - mov dl,[vrama+edx] - sub [mmode7yrpos],eax - %4 - dec dword[mtemp] - jz near %%finishmode7 - dec dword[ngwleft] - jnz near %%tilerep3w - jmp %%thirdsetw -%endmacro - -; ********************************************************************* - -%macro Mode7NonMainSub 1 - WinEnCheck - ProcessBuildWindow16b 0 -.nohr - Mode7NoTranspPreStartUp - Mode7Startup - Mode7Process %1, domosaicng16b, 2 -.nextval3 - Mode7ProcessB %1, domosaicng16b, 2 - Mode7MidRoutines - mov edi,[vram] - Mode7Processngw16b %1, domosaicng16b, 2 -%endmacro - -%macro Mode7NonMainSube 1 - WinEnCheck - ProcessBuildWindow16b 0 -.nohr - Mode7NoTranspPreStartUp2 - Mode7Startup - Mode7Process %1, domosaicng16b, 2 -.nextval3 - Mode7ProcessB %1, domosaicng16b, 2 - Mode7MidRoutines - mov edi,[vram] - Mode7Processngw16b %1, domosaicng16b, 2 -%endmacro - -%macro Mode7MainSub 2 - WinEnCheckMS - ProcessBuildWindow16b 0 -.nohr - Mode7NoTranspPreStartUp - call Mode7Startup16b - Mode7MidRoutines - mov edi,[vram] - Mode7Processngw216b %1, domosaicng16b, 2, %2 -%endmacro - -%macro Mode7MainSube 2 - WinEnCheckMS - ProcessBuildWindow16b 0 -.nohr - Mode7NoTranspPreStartUp2 - call Mode7Startup16b - Mode7MidRoutines - mov edi,[vram] - Mode7Processngw216b %1, domosaicng16b, 2, %2 -%endmacro - - - diff --git a/tools/zsnes/src/video/mode716b.asm b/tools/zsnes/src/video/mode716b.asm deleted file mode 100644 index 363bd7d..0000000 --- a/tools/zsnes/src/video/mode716b.asm +++ /dev/null @@ -1,191 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -%include "macros.mac" - -EXTSYM curmosaicsz,curvidoffset,domosaic16b,winptrref,scaddset -EXTSYM mode7A,mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set -EXTSYM pal16b,vram,vrama,winon,mode7tab,xtravbuf,drawmode7dcolor -EXTSYM cwinptr - -%include "video/mode7.mac" - -;******************************************************* -; Processes & Draws Mode 7 -;******************************************************* - -ALIGN16 - -%macro Mode7Normal 0 - or dl,dl - jz %%nodrawb - mov ecx,[pal16b+edx*4] - mov [esi],cx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Window 0 - or dl,dl - jz %%nodrawbw - test byte[ebp],0FFh - jnz %%nodrawbw - mov ecx,[pal16b+edx*4] - mov [esi],cx -%%nodrawbw - add esi,2 - inc ebp -%endmacro - -SECTION .text - -NEWSYM drawmode716b - test byte[scaddset],1 - jnz near drawmode7dcolor - mov esi,[cwinptr] - mov [winptrref],esi - - Mode7Calculate - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov edi,[vram] - - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawmode7win -.domosaic - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - Mode7Process Mode7Normal, domosaic16b, 2 -.nextval3 - Mode7ProcessB Mode7Normal, domosaic16b, 2 - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resw 1 ; cx location -.cyloc resw 1 ; cy location -.m7xaddofa resd 1 -.m7xaddof2a resd 1 -.m7yaddofa resd 1 -.m7yaddof2a resd 1 -SECTION .text - -.drawmode7win -.domosaicw - mov ebp,[cwinptr] - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3w - cmp dword[.mode7xadder],-7F0h - jl near .nextval3w - cmp dword[.mode7yadder],7F0h - jg near .nextval3w - cmp dword[.mode7yadder],-7F0h - jl near .nextval3w - - Mode7Process Mode7Window, domosaic16b, 2 -.nextval3w - Mode7ProcessB Mode7Window, domosaic16b, 2 - - diff --git a/tools/zsnes/src/video/mode716d.asm b/tools/zsnes/src/video/mode716d.asm deleted file mode 100644 index 627d9e6..0000000 --- a/tools/zsnes/src/video/mode716d.asm +++ /dev/null @@ -1,235 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -%include "macros.mac" - -EXTSYM curmosaicsz,curvidoffset,domosaic16b,winptrref,mode7A,mode7B,mode7C -EXTSYM mode7D,mode7X0,mode7Y0,mode7set,cwinptr,vram,vrama,winon,mode7tab -EXTSYM xtravbuf,dcolortab,vidbright - -%include "video/mode7.mac" - -SECTION .text - -NEWSYM Gendcolortable - ; generate Direct Color Table - push eax - push edx - xor ecx,ecx -.loopdct - mov al,cl - and eax,00000111b - mov bl,[vidbright] - mul bl - mov bl,15 - div bl - xor ah,ah - shl eax,13 - mov edx,eax - mov al,cl - and eax,00111000b - shr eax,3 - mov bl,[vidbright] - mul bl - mov bl,15 - div bl - xor ah,ah - shl eax,8 - or edx,eax - mov al,cl - and eax,11000000b - shr eax,6 - mov bl,[vidbright] - mul bl - mov bl,15 - div bl - xor ah,ah - shl eax,3 - or edx,eax - and edx,0FFFFh - mov [dcolortab+ecx*4],edx - inc cl - jnz .loopdct - pop edx - pop eax - ret - -%macro Mode7Normal 0 - or dl,dl - jz %%nodrawb - mov ecx,[dcolortab+edx*4] - mov [esi],cx -%%nodrawb - add esi,2 -%endmacro - -%macro Mode7Window 0 - or dl,dl - jz %%nodrawbw - test byte[ebp],0FFh - jnz %%nodrawbw - mov ecx,[dcolortab+edx*4] - mov [esi],cx -%%nodrawbw - add esi,2 - inc ebp -%endmacro - -;******************************************************* -; Processes & Draws Mode 7 -;******************************************************* -SECTION .bss -NEWSYM prevbrightdc, resb 1 -SECTION .text -NEWSYM drawmode7dcolor - mov bl,[vidbright] - cmp bl,[prevbrightdc] - je .nodcchange - mov [prevbrightdc],bl - call Gendcolortable -.nodcchange - mov esi,[cwinptr] - mov [winptrref],esi - - Mode7Calculate - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov edi,[vram] - - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawmode7win -.domosaic - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - Mode7Process Mode7Normal, domosaic16b, 2 -.nextval3 - Mode7ProcessB Mode7Normal, domosaic16b, 2 - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resw 1 ; cx location -.cyloc resw 1 ; cy location -.m7xaddofa resd 1 -.m7xaddof2a resd 1 -.m7yaddofa resd 1 -.m7yaddof2a resd 1 -SECTION .text - -.drawmode7win -.domosaicw - mov ebp,[cwinptr] - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3w - cmp dword[.mode7xadder],-7F0h - jl near .nextval3w - cmp dword[.mode7yadder],7F0h - jg near .nextval3w - cmp dword[.mode7yadder],-7F0h - jl near .nextval3w - - Mode7Process Mode7Window, domosaic16b, 2 -.nextval3w - Mode7ProcessB Mode7Window, domosaic16b, 2 diff --git a/tools/zsnes/src/video/mode716e.asm b/tools/zsnes/src/video/mode716e.asm deleted file mode 100644 index e45b23f..0000000 --- a/tools/zsnes/src/video/mode716e.asm +++ /dev/null @@ -1,1266 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -%include "macros.mac" - -EXTSYM curmosaicsz,curvidoffset,domosaic16b,winptrref,mode7A,mode7B,mode7C -EXTSYM mode7D,mode7X0,mode7Y0,mode7set,pal16b,vram,vrama,winon,mode7tab,xtravbuf -EXTSYM cwinptr - -;******************************************************* -; Processes & Draws Mode 7 -;******************************************************* - -SECTION .text - -ALIGN16 - -NEWSYM drawmode716extbg -; test byte[scaddset],1 -; jnz near drawmode7dcolor - mov esi,[cwinptr] - mov [winptrref],esi - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near drawmode716bwinonextbg -.domosaic - ; mode 7, ax = curyposition, dx = curxposition (left side) - ; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen - ; center map coordinates = (X0,Y0) - ; 1.) cx=X0-bg1scrolx, cy =Y0-ax - - mov bx,[mode7X0] - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonega - or bx,1110000000000000b -.nonega - mov [.cxloc],bx - mov bx,dx - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegb - or bx,1110000000000000b -.nonegb - sub [.cxloc],bx - mov bx,ax - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegc - or bx,1110000000000000b -.nonegc - mov [.cyloc],bx - mov bx,[mode7Y0] - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegd - or bx,1110000000000000b -.nonegd - sub word[.cyloc],bx - - ; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D) - - movsx eax,word[mode7B] - movsx ebx,word[.cyloc] - imul eax,ebx - mov [.mode7xpos],eax - mov bx,[mode7X0] - add [.mode7xpos+1],bx - - movsx ebx,word[.cyloc] - movsx eax,word[mode7D] - imul eax,ebx - mov [.mode7ypos],eax - mov bx,[mode7Y0] - add [.mode7ypos+1],bx - - ; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B) - - movsx ebx,word[.cxloc] - movsx eax,word[mode7A] - mov [.mode7xadder],eax - imul eax,ebx - neg eax - add [.mode7xpos],eax - - movsx eax,word[mode7C] - movsx ebx,word[.cxloc] - neg eax - mov [.mode7yadder],eax - imul eax,ebx - add [.mode7ypos],eax - - test byte[mode7set],1 - jz .nohflip - mov eax,[.mode7xadder] - shl eax,8 - add [.mode7xpos],eax - neg dword[.mode7xadder] - mov eax,[.mode7yadder] - shl eax,8 - sub [.mode7ypos],eax - neg dword[.mode7yadder] -.nohflip - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov edi,[vram] - - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - mov byte[.temp],0 - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - - test byte[mode7set],80h - jnz near .norep2 - - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - -.nextval - test byte[.mode7xrpos+1],08h - jnz .rposoffx -.nextposx - test byte[.mode7yrpos+1],08h - jnz near .rposoffy -.nextposy - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[edi+edx] - sub [.mode7yrpos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodrawb - test dl,0FFh - jz .nodrawb - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodrawb - add esi,2 - dec byte[.temp] - jnz .nextval - jmp .finishmode7 -.rposoffx - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp .nextposx -.rposoffy - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - and byte[.mode7ptr+1],7Fh - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp .nextposy -.finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -.norep2 - test byte[mode7set],40h - jnz .tilerep2 -.nextvalb2 - cmp byte[.mode7ypos+2],3 - ja .offscr2 - cmp byte[.mode7xpos+2],3 - jbe near .offscr3 -.offscr2 - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,2 - dec byte[.temp] - jnz near .nextvalb2 - jmp .finishmode7 -.tilerep2 -.nextvalb3 - cmp byte[.mode7ypos+2],3 - ja .offscr2b - cmp byte[.mode7xpos+2],3 - jbe .offscr3 -.offscr2b - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - mov [esi+288*2],dl - test dl,80h - jnz .nodraw2trb2 - test dl,0FFh - jz .nodraw2trb2 - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw2trb2 - add esi,2 - dec byte[.temp] - jnz .nextvalb3 - jmp .finishmode7 -.offscr3 - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - -.nextvalr - test byte[.mode7xrpos+1],08h - jnz .rposoffxr -.nextposxr - test byte[.mode7yrpos+1],08h - jnz near .rposoffyr -.nextposyr - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[edi+edx] - sub [.mode7yrpos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodrawbr - test dl,0FFh - jz .nodrawbr - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodrawbr - add esi,2 - dec byte[.temp] - jnz .nextvalr - jmp .finishmode7 -.rposoffxr - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov cl,[.mode7xincc] - cmp byte[.mode7ptr],cl - je .roff -.roffxretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp .nextposxr -.rposoffyr - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js .roff -.roffyretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp .nextposyr -.roff - test byte[mode7set],40h - jnz .tilerep3 - jmp .finishmode7 -.tilerep3 - and byte[.mode7yrpos+1],07h - and byte[.mode7xrpos+1],07h - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[vrama+edx] - sub [.mode7yrpos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodrawbr2 - test dl,0FFh - jz .nodrawbr2 - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodrawbr2 - add esi,2 - dec byte[.temp] - jnz .tilerep3 - jmp .finishmode7 - -;********************************************************** -; Mode 7, old routines -;********************************************************** - -.nextval3 - test byte[mode7set],80h - jnz near .norep -.nextval2 - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov dl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodraw - test dl,0FFh - jz .nodraw - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw - add esi,2 - dec byte[.temp] - jnz .nextval2 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - ; Color repetition -.norep - test byte[mode7set],40h - jnz near .tilerep -.nextvalb - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscr - cmp byte[.mode7xpos+2],3 - ja near .offscr -.offscrb - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov dl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodraw2 - test dl,0FFh - jz .nodraw2 - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw2 - add esi,2 - dec byte[.temp] - jnz near .nextvalb - jmp .goon -.offscrc - cmp byte[.mode7ypos+2],3 - ja .offscr - cmp byte[.mode7xpos+2],3 - jbe near .offscrb -.offscr - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,2 - dec byte[.temp] - jnz .offscrc -.goon - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -.tilerep -.nextvalbtr - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscrtr - cmp byte[.mode7xpos+2],3 - ja near .offscrtr -.offscrtrb - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov dl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodraw2tr - test dl,0FFh - jz .nodraw2tr - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw2tr - add esi,2 - dec byte[.temp] - jnz near .nextvalbtr - jmp .goon -.offscrtrc - cmp byte[.mode7ypos+2],3 - ja .offscrtr - cmp byte[.mode7xpos+2],3 - jbe near .offscrtrb -.offscrtr - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - mov [esi+288*2],dl - test dl,80h - jnz .nodraw2trb - test dl,0FFh - jz .nodraw2trb - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw2trb - add esi,2 - dec byte[.temp] - jnz near .offscrtrc - jmp .goon - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resd 1 ; cx location -.cyloc resd 1 ; cy location -SECTION .text - -NEWSYM drawmode716bwinonextbg - - ; mode 7, ax = curyposition, dx = curxposition (left side) - ; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen - ; center map coordinates = (X0,Y0) - ; 1.) cx=X0-bg1scrolx, cy =Y0-ax - - mov bx,[mode7X0] - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonega - or bx,1110000000000000b -.nonega - mov [.cxloc],bx - mov bx,dx - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegb - or bx,1110000000000000b -.nonegb - sub [.cxloc],bx - mov bx,ax - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegc - or bx,1110000000000000b -.nonegc - mov [.cyloc],bx - mov bx,[mode7Y0] - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegd - or bx,1110000000000000b -.nonegd - sub word[.cyloc],bx - - ; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D) - - movsx ebx,word[.cyloc] - movsx eax,word[mode7C] - imul eax,ebx - neg eax - mov [.mode7xpos],eax - mov bx,[mode7X0] - add [.mode7xpos+1],bx - - movsx ebx,word[.cyloc] - movsx eax,word[mode7D] - imul eax,ebx -; neg ax - mov [.mode7ypos],eax - mov bx,[mode7Y0] - add [.mode7ypos+1],bx - - ; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B) - - movsx ebx,word[.cxloc] - movsx eax,word[mode7A] - mov [.mode7xadder],eax - imul eax,ebx - neg eax - add [.mode7xpos],eax - - movsx ebx,word[.cxloc] - movsx eax,word[mode7B] - mov [.mode7yadder],eax - imul eax,ebx - add [.mode7ypos],eax - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov edi,[vram] - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - mov byte[.temp],0 - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - mov edi,[vram] - mov ebp,[cwinptr] - - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - - test byte[mode7set],80h - jnz near .norep2 - - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - -.nextval - test byte[.mode7xrpos+1],08h - jnz .rposoffx -.nextposx - test byte[.mode7yrpos+1],08h - jnz near .rposoffy -.nextposy - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[edi+edx] - sub [.mode7yrpos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodrawb - test dl,0FFh - jz .nodrawb - test byte[ebp],0FFh - jnz .nodrawb - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodrawb - add esi,2 - inc ebp - dec byte[.temp] - jnz .nextval - jmp .finishmode7 -.rposoffx - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp .nextposx -.rposoffy - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - and byte[.mode7ptr+1],7Fh - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp .nextposy -.finishmode7 - xor eax,eax - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -.norep2 - test byte[mode7set],40h - jnz .tilerep2 -.nextvalb2 - cmp byte[.mode7ypos+2],3 - ja .offscr2 - cmp byte[.mode7xpos+2],3 - jbe near .offscr3 -.offscr2 - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,2 - dec byte[.temp] - jnz near .nextvalb2 - jmp .finishmode7 -.tilerep2 -.nextvalb3 - cmp byte[.mode7ypos+2],3 - ja .offscr2b - cmp byte[.mode7xpos+2],3 - jbe .offscr3 -.offscr2b - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - mov [esi+288*2],dl - test dl,80h - jnz .nodraw2trb2 - test dl,0FFh - jz .nodraw2trb2 - test byte[ebp],0FFh - jnz .nodraw2trb2 - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw2trb2 - add esi,2 - inc ebp - dec byte[.temp] - jnz .nextvalb3 - jmp .finishmode7 -.offscr3 - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - -.nextvalr - test byte[.mode7xrpos+1],08h - jnz .rposoffxr -.nextposxr - test byte[.mode7yrpos+1],08h - jnz near .rposoffyr -.nextposyr - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[edi+edx] - sub [.mode7yrpos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodrawbr - test dl,0FFh - jz .nodrawbr - test byte[ebp],0FFh - jnz .nodrawbr - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodrawbr - add esi,2 - inc ebp - dec byte[.temp] - jnz .nextvalr - jmp .finishmode7 -.rposoffxr - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov cl,[.mode7xincc] - cmp byte[.mode7ptr],cl - je .roff -.roffxretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp .nextposxr -.rposoffyr - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js .roff -.roffyretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp .nextposyr -.roff - test byte[mode7set],40h - jnz .tilerep3 - jmp .finishmode7 -.tilerep3 - and byte[.mode7yrpos+1],07h - and byte[.mode7xrpos+1],07h - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov dl,[vrama+edx] - sub [.mode7yrpos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodrawbr2 - test dl,0FFh - jz .nodrawbr2 - test byte[ebp],0FFh - jnz .nodrawbr2 - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodrawbr2 - add esi,2 - inc ebp - dec byte[.temp] - jnz .tilerep3 - jmp .finishmode7 - -;********************************************************** -; Mode 7, old routines -;********************************************************** - -.nextval3 - test byte[mode7set],80h - jnz near .norep -.nextval2 - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov dl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodraw - test dl,0FFh - jz .nodraw - test byte[ebp],0FFh - jnz .nodraw - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw - add esi,2 - inc ebp - dec byte[.temp] - jnz .nextval2 - xor eax,eax - ret - ; Color repetition -.norep - test byte[mode7set],40h - jnz near .tilerep -.nextvalb - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscr - cmp byte[.mode7xpos+2],3 - ja near .offscr -.offscrb - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov dl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodraw2 - test dl,0FFh - jz .nodraw2 - test byte[ebp],0FFh - jnz .nodraw2 - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw2 - add esi,2 - inc ebp - dec byte[.temp] - jnz near .nextvalb - jmp .goon -.offscrc - cmp byte[.mode7ypos+2],3 - ja .offscr - cmp byte[.mode7xpos+2],3 - jbe near .offscrb -.offscr - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - add esi,2 - dec byte[.temp] - jnz .offscrc -.goon - xor eax,eax - ret - -.tilerep -.nextvalbtr - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscrtr - cmp byte[.mode7xpos+2],3 - ja near .offscrtr -.offscrtrb - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov dl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288*2],dl - test dl,80h - jnz .nodraw2tr - test dl,0FFh - jz .nodraw2tr - test byte[ebp],0FFh - jnz .nodraw2tr - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw2tr - add esi,2 - inc ebp - dec byte[.temp] - jnz near .nextvalbtr - jmp .goon -.offscrtrc - cmp byte[.mode7ypos+2],3 - ja near .offscrtr - cmp byte[.mode7xpos+2],3 - jbe near .offscrtrb -.offscrtr - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov dl,[vrama+edx] - sub [.mode7ypos],ebx - mov [esi+288*2],dl - test dl,80h - jnz .nodraw2trb - test dl,0FFh - jz .nodraw2trb - test byte[ebp],0FFh - jnz .nodraw2trb - mov ecx,[pal16b+edx*4] - mov [esi],cx -.nodraw2trb - add esi,2 - inc ebp - dec byte[.temp] - jnz near .offscrtrc - jmp .goon - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resd 1 ; cx location -.cyloc resd 1 ; cy location -SECTION .text - -NEWSYM drawmode716extbg2 - mov esi,[cwinptr] - mov [winptrref],esi - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov edi,[vram] - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 -.nomosaic - - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawwin -.domosaic - mov ecx,256 - xor eax,eax -.loop - mov al,[esi+288*2] - test al,80h - jz .nopr2 - and al,7Fh - mov ebx,[pal16b+eax*4] - mov [esi],bx -.nopr2 - add esi,2 - dec ecx - jnz .loop - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret -.drawwin - mov ebp,[cwinptr] - mov [esi],cl -.nodrawbw - mov ecx,256 - xor eax,eax -.loop2 - mov al,[esi+288*2] - test byte[ebp],0FFh - jnz .nopr2b - test al,80h - jz .nopr2b - and al,7Fh - mov ebx,[pal16b+eax*4] - mov [esi],bx -.nopr2b - add esi,2 - inc ebp - dec ecx - jnz .loop2 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret diff --git a/tools/zsnes/src/video/mode716t.asm b/tools/zsnes/src/video/mode716t.asm deleted file mode 100644 index cfccfa9..0000000 --- a/tools/zsnes/src/video/mode716t.asm +++ /dev/null @@ -1,373 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -%include "macros.mac" - -EXTSYM cwinptr -EXTSYM coladdr,curmosaicsz,curvidoffset,domosaic16b,mode7A,drawmode7dcolor -EXTSYM mode7B,mode7C,mode7D,mode7X0,mode7Y0,mode7set,mode7tab,DoTransp -EXTSYM pal16b,pal16bcl,pal16bxcl,scaddtype,scrnon,transpbuf,drawmode716b -EXTSYM vesa2_clbit,vram,vrama,winon,xtravbuf,winptrref,scaddset -EXTSYM fulladdtab - -%include "video/mode7.mac" - - - - - -;******************************************************* -; Processes & Draws Mode 7 -;******************************************************* - - -%macro mode7halfadd 0 - or dl,dl - jz %%nodraw - mov ecx,[ebp] - mov edx,[pal16bcl+edx*4] - or cx,cx - jz %%noadd - and edx,[vesa2_clbit] - and ecx,[vesa2_clbit] - add edx,ecx - shr edx,1 -%%noadd - mov [esi],dx - xor ecx,ecx - xor edx,edx -%%nodraw - add esi,2 - add ebp,2 -%endmacro - -%macro mode7fulladd 0 - or dl,dl - jz %%nodraw - mov ecx,[ebp] - mov edx,[pal16bcl+edx*4] - and ecx,[vesa2_clbit] - add edx,ecx - shr edx,1 - mov edx,[fulladdtab+edx*2] - mov [esi],dx - xor edx,edx -%%nodraw - add esi,2 - add ebp,2 -%endmacro - -%macro mode7fullsub 0 - or dl,dl - jz %%nodraw - mov ecx,[ebp] - mov edx,[pal16bxcl+edx*4] - and ecx,[vesa2_clbit] - add edx,ecx - shr edx,1 - mov edx,[fulladdtab+edx*2] - xor edx,0FFFFh - mov [esi],dx - xor edx,edx -%%nodraw - add esi,2 - add ebp,2 -%endmacro - -%macro mode7mainsub 0 - or dl,dl - jz %%nodraw - mov ecx,[pal16b+edx*4] - mov [esi],cx - mov [ebp],cx -%%nodraw - add esi,2 - add ebp,2 -%endmacro - -%macro mode7halfaddwinon 0 - mov ecx,[cwinptr2] - or dl,dl - jz %%nodraw - test byte[ecx],0FFh - jnz %%nodraw - mov ecx,[ebp] - mov edx,[pal16bcl+edx*4] - or cx,cx - je %%noadd - and edx,[vesa2_clbit] - and ecx,[vesa2_clbit] - add edx,ecx - shr edx,1 -%%noadd - mov [esi],dx - xor edx,edx -%%nodraw - xor ecx,ecx - inc dword[cwinptr2] - add esi,2 - add ebp,2 -%endmacro - -%macro mode7fulladdwinon 0 - mov ecx,[cwinptr2] - or dl,dl - jz %%nodraw - test byte[ecx],0FFh - jnz %%nodraw - mov ecx,[ebp] - mov edx,[pal16bcl+edx*4] - and ecx,[vesa2_clbit] - add edx,ecx - shr edx,1 - mov edx,[fulladdtab+edx*2] - mov [esi],dx - xor edx,edx -%%nodraw - inc dword[cwinptr2] - xor ecx,ecx - add esi,2 - add ebp,2 -%endmacro - -%macro mode7fullsubwinon 0 - mov ecx,[cwinptr2] - or dl,dl - jz %%nodraw - test byte[ecx],0FFh - jnz %%nodraw - mov ecx,[ebp] - mov edx,[pal16bxcl+edx*4] - and ecx,[vesa2_clbit] - add edx,ecx - shr edx,1 - mov edx,[fulladdtab+edx*2] - xor edx,0FFFFh - mov [esi],dx - xor edx,edx -%%nodraw - xor ecx,ecx - inc dword[cwinptr2] - add esi,2 - add ebp,2 -%endmacro - -%macro mode7mainsubwinon 0 - mov ecx,[cwinptr2] - or dl,dl - jz %%nodraw - test byte[ecx],0FFh - jnz %%nodraw - mov ecx,[pal16b+edx*4] - mov [esi],cx - mov [ebp],cx -%%nodraw - inc dword[cwinptr2] - xor ecx,ecx - add esi,2 - add ebp,2 -%endmacro - -%macro mode716tmacro 2 - Mode7Calculate - mov ebp,transpbuf+32 - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - mov edi,[vram] - - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawmode7win -.domosaic - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - Mode7Process %1, domosaic16b, 2 -.nextval3 - Mode7ProcessB %1, domosaic16b, 2 - -ALIGN32 -SECTION .data - -.temp dd 0 ; for byte move left -.mode7xpos dd 0 ; x position -.tempa2 dd 0 ; keep this blank! -.mode7xrpos dd 0 ; x position -.tempa dd 0 ; keep this blank! -.mode7ypos dd 0 ; y position -.tempb2 dd 0 ; keep this blank! -.mode7yrpos dd 0 ; y position -.tempb dd 0 ; keep this blank! -.mode7xadder dd 0 ; number to add for x -.tempc2 dd 0 ; keep this blank! -.mode7xadd2 dd 0 ; number to add for x -.tempc dd 0 ; keep this blank! -.mode7yadder dd 0 ; number to add for y -.tempd2 dd 0 ; keep this blank! -.mode7yadd2 dd 0 ; number to add for y -.tempd dd 0 ; keep this blank! -.mode7ptr dd 0 ; pointer value -.mode7xinc dd 0 ; number to add for x -.mode7xincc dd 0 ; range check for x -.mode7yinc dd 0 ; number to add for y -.mode7xsloc dd 0 ; which screen x -.mode7ysloc dd 0 ; which screen y -.mode7xsrl dd 0 ; which relative screen x -.mode7ysrl dd 0 ; which relative screen y -.cxloc dw 0 ; cx location -.cyloc dw 0 ; cy location -.m7xaddofa dd 0 -.m7xaddof2a dd 0 -.m7yaddofa dd 0 -.m7yaddof2a dd 0 - -SECTION .text - -.drawmode7win -.domosaicw - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3w - cmp dword[.mode7xadder],-7F0h - jl near .nextval3w - cmp dword[.mode7yadder],7F0h - jg near .nextval3w - cmp dword[.mode7yadder],-7F0h - jl near .nextval3w - - Mode7Process %2, domosaic16b, 2 -.nextval3w - Mode7ProcessB %2, domosaic16b, 2 -%endmacro - -;******************************************************* -; Processes & Draws Mode 7 half Addition -;******************************************************* -SECTION .text - -NEWSYM drawmode716t - test byte[scaddset],1 - jnz near drawmode7dcolor - cmp byte[DoTransp],1 - jne .transpfull - jmp drawmode716b -.transpfull - mov esi,[cwinptr] - mov [winptrref],esi - mov [cwinptr2],esi - test byte[scaddtype],80h - jnz near drawmode716tsub - test byte[scaddtype],40h - jz near drawmode716tfulladd - cmp byte[scrnon+1],0 - je near drawmode716tfulladd - cmp dword[coladdr],0 - jnz near drawmode716tfulladd -; cmp byte[scrnon+1],10h -; je near drawmode716tfulladd -;.n - mode716tmacro mode7halfadd,mode7halfaddwinon - - -;******************************************************* -; Processes & Draws Mode 7 Full Addition -;******************************************************* -NEWSYM drawmode716tfulladd - mode716tmacro mode7fulladd,mode7fulladdwinon - -;********************************************************** -; Processes and draws Mode 7 subtract -;********************************************************** - -drawmode716tsub: - mode716tmacro mode7fullsub,mode7fullsubwinon - -;********************************************************** -; Mode 7, main & sub mode -;********************************************************** - -NEWSYM drawmode716tb - mov esi,[cwinptr] - mov [winptrref],esi - mov [cwinptr2],esi - mode716tmacro mode7mainsub,mode7mainsubwinon - -SECTION .bss -cwinptr2 resd 1 - - diff --git a/tools/zsnes/src/video/mode7ext.asm b/tools/zsnes/src/video/mode7ext.asm deleted file mode 100644 index 59ca9aa..0000000 --- a/tools/zsnes/src/video/mode7ext.asm +++ /dev/null @@ -1,1314 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;This program is distributed in the hope that it will be useful, -;but WITHOUT ANY WARRANTY; without even the implied warranty of -;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;GNU General Public License for more details. -; -;You should have received a copy of the GNU General Public License -;along with this program; if not, write to the Free Software -;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -%include "macros.mac" - -EXTSYM mode7tab,winptrref -EXTSYM curmosaicsz,curvidoffset,cwinptr,domosaic,mode7A,mode7B -EXTSYM mode7C,mode7D,mode7X0,mode7Y0,mode7set,vram,vrama,winon,xtravbuf -EXTSYM ngwleft,ngwleftb,mode7xpos,mode7ypos,mode7xrpos,mode7yrpos,mode7xadder -EXTSYM mode7yadder -EXTSYM nglogicval,winlogicaval,ProcessMode7ngwinD,ProcessMode7ngwinC -EXTSYM ngwinen, winbg1enval, BuildWindow, ngwintable, ngcwinptr -EXTSYM ProcessMode7ngwin,ProcessMode7ngwinB - -%include "video/mode7.mac" - - - - - -;******************************************************* -; Processes & Draws Mode 7 -;******************************************************* - -SECTION .text - -NEWSYM drawmode7extbg - mov esi,[cwinptr] - mov [winptrref],esi - ; mode 7, ax = curyposition, dx = curxposition (left side) - ; draw center map coordinates at (X0-bg1scrolx,Y0-bg1scroly) on screen - ; center map coordinates = (X0,Y0) - ; 1.) cx=X0-bg1scrolx, cy =Y0-ax - - mov bx,[mode7X0] - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonega - or bx,1110000000000000b -.nonega - mov [.cxloc],bx - mov bx,dx - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegb - or bx,1110000000000000b -.nonegb - sub [.cxloc],bx - mov bx,ax - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegc - or bx,1110000000000000b -.nonegc - mov [.cyloc],bx - mov bx,[mode7Y0] - and bx,0001111111111111b ; 13 -> 16 bit signed value - test bx,0001000000000000b - jz .nonegd - or bx,1110000000000000b -.nonegd - sub word[.cyloc],bx - - ; 2.) Find position at scaled y, centered x at SCX=X0-(cy*C),SCY=Y0-(cy*D) - - movsx eax,word[mode7B] - movsx ebx,word[.cyloc] - imul eax,ebx - mov [.mode7xpos],eax - mov bx,[mode7X0] - add [.mode7xpos+1],bx - - movsx ebx,word[.cyloc] - movsx eax,word[mode7D] - imul eax,ebx - mov [.mode7ypos],eax - mov bx,[mode7Y0] - add [.mode7ypos+1],bx - - ; 3.) Find left scaled location : SCX=SCX-(cx*A),SCY=SCY-(cx*B) - - movsx ebx,word[.cxloc] - movsx eax,word[mode7A] - mov [.mode7xadder],eax - imul eax,ebx - neg eax - add [.mode7xpos],eax - - movsx eax,word[mode7C] - movsx ebx,word[.cxloc] - neg eax - mov [.mode7yadder],eax - imul eax,ebx - add [.mode7ypos],eax - - test byte[mode7set],1 - jz .nohflip - mov eax,[.mode7xadder] - shl eax,8 - add [.mode7xpos],eax - neg dword[.mode7xadder] - mov eax,[.mode7yadder] - shl eax,8 - sub [.mode7ypos],eax - neg dword[.mode7yadder] -.nohflip - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - mov dword[.temp],256 - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawmode7win -.domosaic - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - - test byte[mode7set],80h - jnz near .norep2 - - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - mov eax,[.mode7xadder] - mov [.m7xrpa-4],eax - mov eax,[.mode7yadder] - mov [.m7yrpa-4],eax - mov al,[.mode7xinc] - mov [.m7xin-1],al - mov eax,[.mode7xadd2] - mov [.m7xad2-4],eax - mov al,[.mode7yinc] - mov [.m7yin-1],al - mov eax,[.mode7yadd2] - mov [.m7yad2-4],eax - mov eax,[.mode7xrpos] - mov ebx,[.mode7ptr] - jmp .nextval - ALIGN16 -.nextval - test ah,08h - jnz .rposoffx -.nextposx - test byte[.mode7yrpos+1],08h - jnz .rposoffy -.nextposy - mov ch,ah - mov cl,[.mode7yrpos+1] - add eax,0 -.m7xrpa - mov dl,[mode7tab+ecx] - sub dword[.mode7yrpos],0 -.m7yrpa - mov cl,[edi+edx] - mov [esi+288],cl - test cl,80h - jnz .nodrawb - or cl,cl - jz .nodrawb - mov [esi],cl -.nodrawb - inc esi - dec dword[.temp] - jnz .nextval - jmp .finishmode7 - -.rposoffx - add bl,0 -.m7xin - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - sub eax,0 -.m7xad2 - lea edi,[ecx+vrama] - jmp .nextposx - -.rposoffy - sub bh,0 -.m7yin - and ebx,07FFFh - xor ecx,ecx - mov cl,[vrama+ebx] - shl ecx,7 - add dword[.mode7yrpos],0 -.m7yad2 - lea edi,[ecx+vrama] - jmp .nextposy - -.finishmode7 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -.norep2 - test byte[mode7set],40h - jnz .tilerep2 - jmp .nextvalb2 - ALIGN16 -.nextvalb2 - cmp byte[.mode7ypos+2],3 - ja .offscr2 - cmp byte[.mode7xpos+2],3 - jbe near .offscr3 -.offscr2 - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - inc esi - dec dword[.temp] - jnz near .nextvalb2 - jmp .finishmode7 -.tilerep2 -.nextvalb3 - cmp byte[.mode7ypos+2],3 - ja .offscr2b - cmp byte[.mode7xpos+2],3 - jbe .offscr3 -.offscr2b - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov cl,[vrama+edx] - sub [.mode7ypos],ebx - mov [esi+288],cl - test cl,80h - jnz .nodraw2trb2 - or cl,cl - jz .nodraw2trb2 - mov [esi],cl -.nodraw2trb2 - inc esi - dec dword[.temp] - jnz .nextvalb3 - jmp .finishmode7 -.offscr3 - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - - mov eax,[.mode7xadder] - mov [.m7xrpa2-4],eax - mov eax,[.mode7yadder] - mov [.m7yrpa2-4],eax - - jmp .nextvalr - ALIGN16 -.nodr2 - inc esi - dec dword[.temp] - jz .fin2 -.nextvalr - test byte[.mode7xrpos+1],08h - jnz .rposoffxr -.nextposxr - test byte[.mode7yrpos+1],08h - jnz near .rposoffyr -.nextposyr - mov cl,[.mode7yrpos+1] - mov ch,[.mode7xrpos+1] - add dword[.mode7xrpos],0 -.m7xrpa2 - mov dl,[mode7tab+ecx] - sub dword[.mode7yrpos],0 -.m7yrpa2 - mov cl,[edi+edx] - mov [esi+288],cl - test cl,80h - jnz .nodr2 - or cl,cl - jz .nodr2 - mov [esi],cl -.nodrawbr - inc esi - dec dword[.temp] - jnz .nextvalr -.fin2 - jmp .finishmode7 -.rposoffxr - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov cl,[.mode7xincc] - cmp byte[.mode7ptr],cl - je .roff -.roffxretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp .nextposxr -.rposoffyr - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js .roff -.roffyretb - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp .nextposyr -.roff - test byte[mode7set],40h - jnz .tilerep3 - jmp .finishmode7 -.tilerep3 - and byte[.mode7yrpos+1],07h - and byte[.mode7xrpos+1],07h - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov cl,[vrama+edx] - sub [.mode7yrpos],eax - mov [esi+288],cl - test cl,80h - jnz .nodrawbr2 - or cl,cl - jz .nodrawbr2 - mov [esi],cl -.nodrawbr2 - inc esi - dec dword[.temp] - jnz .tilerep3 - jmp .finishmode7 - -;********************************************************** -; Mode 7, old routines -;********************************************************** - -.nextval3 - test byte[mode7set],80h - jnz near .norep - jmp .nextval2 - ALIGN16 -.nextval2 - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov cl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288],cl - test cl,80h - jnz .nodraw - or cl,cl - jz .nodraw - mov [esi],cl -.nodraw - inc esi - dec dword[.temp] - jnz .nextval2 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic - ret - ; Color repetition -.norep - test byte[mode7set],40h - jnz near .tilerep - jmp .nextvalb - ALIGN16 -.nextvalb - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscr - cmp byte[.mode7xpos+2],3 - ja near .offscr -.offscrc - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov cl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288],cl - test cl,80h - jnz .nodraw2 - or cl,cl - jz .nodraw2 - mov [esi],cl -.nodraw2 - inc esi - dec dword[.temp] - jnz near .nextvalb - jmp .goon -.offscrb - cmp byte[.mode7ypos+2],3 - ja .offscr - cmp byte[.mode7xpos+2],3 - jbe near .offscrc -.offscr - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - inc esi - dec dword[.temp] - jnz .offscrb -.goon - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic - ret - -.tilerep - jmp .nextvalbtr - ALIGN16 -.nextvalbtr - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscrtr - cmp byte[.mode7xpos+2],3 - ja near .offscrtr -.notoffscrtr - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov cl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288],cl - test cl,80h - jnz .nodraw2tr - or cl,cl - jz .nodraw2tr - mov [esi],cl -.nodraw2tr - inc esi - dec dword[.temp] - jnz near .nextvalbtr - jmp .goon -.offscrtrb - cmp byte[.mode7ypos+2],3 - ja .offscrtr - cmp byte[.mode7xpos+2],3 - jbe .notoffscrtr -.offscrtr - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov cl,[vrama+edx] - sub [.mode7ypos],ebx - mov [esi+288],cl - test cl,80h - jnz .nodraw2trb - or cl,cl - jz .nodraw2trb - mov [esi],cl -.nodraw2trb - inc esi - dec dword[.temp] - jnz near .offscrtrb - jmp .goon - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resw 1 ; cx location -.cyloc resw 1 ; cy location -SECTION .text - -.drawmode7win -.domosaicw - - mov ebp,[cwinptr] - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3w - cmp dword[.mode7xadder],-7F0h - jl near .nextval3w - cmp dword[.mode7yadder],7F0h - jg near .nextval3w - cmp dword[.mode7yadder],-7F0h - jl near .nextval3w - - test byte[mode7set],80h - jnz near .norep2w - - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - jmp .nextvalw - ALIGN16 -.nextvalw - test byte[.mode7xrpos+1],08h - jnz .rposoffxw -.nextposxw - test byte[.mode7yrpos+1],08h - jnz near .rposoffyw -.nextposyw - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov cl,[edi+edx] - sub [.mode7yrpos],eax - mov [esi+288],cl - test cl,80h - jnz .nodrawbw - or cl,cl - jz .nodrawbw - test byte[ebp],0FFh - jnz .nodrawbw - mov [esi],cl -.nodrawbw - inc esi - inc ebp - dec byte[.temp] - jnz .nextvalw - jmp .finishmode7w -.rposoffxw - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp .nextposxw -.rposoffyw - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - and byte[.mode7ptr+1],7Fh - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp .nextposyw -.finishmode7w - xor eax,eax - ret - -;********************************************************** -; Mode 7, no repetition mode -;********************************************************** - -.norep2w - test byte[mode7set],40h - jnz .tilerep2w -.nextvalb2w - cmp byte[.mode7ypos+2],3 - ja .offscr2w - cmp byte[.mode7xpos+2],3 - jbe near .offscr3w -.offscr2w - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - inc esi - inc ebp - dec byte[.temp] - jnz near .nextvalb2w - jmp .finishmode7w -.tilerep2w -.nextvalb3w - cmp byte[.mode7ypos+2],3 - ja .offscr2bw - cmp byte[.mode7xpos+2],3 - jbe .offscr3w -.offscr2bw - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov cl,[vrama+edx] - sub [.mode7ypos],ebx - mov [esi+288],cl - test cl,80h - jnz .nodraw2trb2w - or cl,cl - jz .nodraw2trb2w - test byte[ebp],0FFh - jnz .nodraw2trb2w - mov [esi],cl -.nodraw2trb2w - inc esi - inc ebp - dec byte[.temp] - jnz .nextvalb3w - jmp .finishmode7w -.offscr3w - mov eax,[.mode7xpos] - and eax,7FFh - mov [.mode7xrpos],eax - mov eax,[.mode7ypos] - and eax,7FFh - mov [.mode7yrpos],eax - - ; get tile data offset into edi - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - shl ebx,5 - shr eax,3 - and ebx,07FF8h - shl al,1 - mov bl,al - mov edi,[vram] - xor ch,ch - mov [.mode7ptr],ebx - mov cl,[edi+ebx] - shl ecx,7 - add edi,ecx - -.nextvalrw - test byte[.mode7xrpos+1],08h - jnz .rposoffxrw -.nextposxrw - test byte[.mode7yrpos+1],08h - jnz near .rposoffyrw -.nextposyrw - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov cl,[edi+edx] - sub [.mode7yrpos],eax - mov [esi+288],cl - test cl,80h - jnz .nodrawbrw - or cl,cl - jz .nodrawbrw - test byte[ebp],0FFh - jnz .nodrawbrw - mov [esi],cl -.nodrawbrw - inc esi - inc ebp - dec byte[.temp] - jnz .nextvalrw - jmp .finishmode7w -.rposoffxrw - mov al,[.mode7xinc] - mov edi,[vram] - add [.mode7ptr],al - mov cl,[.mode7xincc] - cmp byte[.mode7ptr],cl - je .roffw -.roffxretbw - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7xadd2] - shl ecx,7 - sub [.mode7xrpos],eax - add edi,ecx - jmp .nextposxrw -.rposoffyrw - mov al,[.mode7yinc] - mov edi,[vram] - sub [.mode7ptr+1],al - js .roffw -.roffyretbw - mov ebx,[.mode7ptr] - xor ecx,ecx - mov cl,[edi+ebx] - mov eax,[.mode7yadd2] - shl ecx,7 - add [.mode7yrpos],eax - add edi,ecx - jmp .nextposyrw -.roffw - test byte[mode7set],40h - jnz .tilerep3w - jmp .finishmode7w -.tilerep3w - and byte[.mode7yrpos+1],07h - and byte[.mode7xrpos+1],07h - mov cl,[.mode7yrpos+1] - mov eax,[.mode7xadder] - mov ch,[.mode7xrpos+1] - add [.mode7xrpos],eax - mov dl,[mode7tab+ecx] - mov eax,[.mode7yadder] - mov cl,[vrama+edx] - sub [.mode7yrpos],eax - mov [esi+288],cl - test cl,80h - jnz .nodrawbr2w - or cl,cl - jz .nodrawbr2w - test byte[ebp],0FFh - jnz .nodrawbr2w - mov [esi],cl -.nodrawbr2w - inc esi - inc ebp - dec byte[.temp] - jnz .tilerep3w - jmp .finishmode7w - -;********************************************************** -; Mode 7, old routines -;********************************************************** - -.nextval3w - test byte[mode7set],80h - jnz near .norepw -.nextval2w - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov cl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288],cl - test cl,80h - jnz .nodraww - or cl,cl - jz .nodraww - test byte[ebp],0FFh - jnz .nodraww - mov [esi],cl -.nodraww - inc esi - inc ebp - dec byte[.temp] - jnz .nextval2w - xor eax,eax - ret - ; Color repetition -.norepw - test byte[mode7set],40h - jnz near .tilerepw -.nextvalbw - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscrw - cmp byte[.mode7xpos+2],3 - ja near .offscrw -.offscrwb - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov cl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288],cl - test cl,80h - jnz .nodraw2w - or cl,cl - jz .nodraw2w - test byte[ebp],0FFh - jnz .nodraw2w - mov [esi],cl -.nodraw2w - inc esi - inc ebp - dec byte[.temp] - jnz near .nextvalbw - jmp .goonw -.offscrwc - cmp byte[.mode7ypos+2],3 - ja .offscrw - cmp byte[.mode7xpos+2],3 - jbe near .offscrwb -.offscrw - mov eax,[.mode7xadder] - mov ebx,[.mode7yadder] - add [.mode7xpos],eax - sub [.mode7ypos],ebx - inc esi - inc ebp - dec byte[.temp] - jnz .offscrwc -.goonw - xor eax,eax - ret - -.tilerepw -.nextvalbtrw - ; get tile # @ ([.mode7xpos],[.mode7ypos]) - ; get tile location in vram (tileloc=x*2+y*256) - cmp byte[.mode7ypos+2],3 - ja near .offscrtrw - cmp byte[.mode7xpos+2],3 - ja near .offscrtrw -.notoffscrtrw - mov ebx,[.mode7ypos+1] - mov eax,[.mode7xpos+1] - mov cl,bl - mov ch,al - shl ebx,5 - shr eax,3 - mov dl,[mode7tab+ecx] - and ebx,07FF8h - shl al,1 - mov bl,al - xor ch,ch - mov cl,[edi+ebx] - mov eax,[.mode7xadder] - shl ecx,7 - add [.mode7xpos],eax - add ecx,edx - mov eax,[.mode7yadder] - mov cl,[edi+ecx] - sub [.mode7ypos],eax - mov [esi+288],cl - test cl,80h - jnz .nodraw2trw - or cl,cl - jz .nodraw2trw - test byte[ebp],0FFh - jnz .nodraw2trw - mov [esi],cl -.nodraw2trw - inc esi - inc ebp - dec byte[.temp] - jnz near .nextvalbtrw - jmp .goonw -.offscrtrwb - cmp byte[.mode7ypos+2],3 - ja .offscrtrw - cmp byte[.mode7xpos+2],3 - jbe near .notoffscrtrw -.offscrtrw - mov ch,[.mode7xpos+1] - mov eax,[.mode7xadder] - mov cl,[.mode7ypos+1] - mov ebx,[.mode7yadder] - mov dl,[mode7tab+ecx] - add [.mode7xpos],eax - mov cl,[vrama+edx] - sub [.mode7ypos],ebx - mov [esi+288],cl - test cl,80h - jnz .nodraw2trbw - or cl,cl - jz .nodraw2trbw - test byte[ebp],0FFh - jnz .nodraw2trbw - mov [esi],cl -.nodraw2trbw - inc esi - inc ebp - dec byte[.temp] - jnz near .offscrtrwb - jmp .goonw - -NEWSYM drawmode7extbg2 - mov esi,[cwinptr] - mov [winptrref],esi - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 -.nomosaic - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near .drawwin -.domosaic - mov ecx,256 -.loop - mov al,[esi+288] - test al,80h - jz .nopr2 - and al,7Fh - mov [esi],al -.nopr2 - inc esi - dec ecx - jnz .loop - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic - ret -.drawwin - mov ebp,[cwinptr] - mov [esi],cl -.nodrawbw - mov ecx,256 -.loop2 - mov al,[esi+288] - test byte[ebp],0FFh - jnz .nopr2b - test al,80h - jz .nopr2b - and al,7Fh - mov [esi],al -.nopr2b - inc esi - inc ebp - dec ecx - jnz .loop2 - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic - ret - -%macro Mode7Normalng 0 - mov [esi+75036],dl - test dl,80h - jnz %%nodrawb - or dl,dl - jz %%nodrawb - mov [esi],dl -%%nodrawb - inc esi -%endmacro - -NEWSYM drawmode7ngextbg - ProcessBuildWindow 0 - - mov esi,[cwinptr] - mov [winptrref],esi - Mode7Calculate - - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 -.nomosaic - - ; esi = pointer to video buffer - ; edi = pointer to vram - ; [.mode7xadder] = dword value to add to x value (decimal between 7 & 8bit) - ; [.mode7yadder] = dword value to add to y value (decimal between 7 & 8bit) - ; [.mode7xpos] = dword value of x position, decimal between 7 & 8bit - ; [.mode7xpos+1] = word value of x position - ; [.mode7ypos] = dword value of y position, decimal between 7 & 8bit - ; [.mode7ypos+1] = word value of y position - xor ebx,ebx - xor edx,edx - xor ecx,ecx - mov dword[.mode7xadd2],800h - mov byte[.mode7xinc],2 - mov byte[.mode7xincc],0 - test dword[.mode7xadder],80000000h - jz .noneg - mov dword[.mode7xadd2],-800h - mov byte[.mode7xinc],-2 - mov byte[.mode7xincc],0FEh -.noneg - mov dword[.mode7yadd2],800h - mov byte[.mode7yinc],1 - test dword[.mode7yadder],80000000h - jz .noneg2 - mov dword[.mode7yadd2],-800h - mov byte[.mode7yinc],-1 -.noneg2 - - cmp byte[ngwinen],1 - je near .drawmode7win - - mov edi,[vram] - cmp dword[.mode7xadder],7F0h - jg near .nextval3 - cmp dword[.mode7xadder],-7F0h - jl near .nextval3 - cmp dword[.mode7yadder],7F0h - jg near .nextval3 - cmp dword[.mode7yadder],-7F0h - jl near .nextval3 - Mode7Process Mode7Normalng, domosaic, 1 -.nextval3 - Mode7ProcessB Mode7Normalng, domosaic, 1 - ret - -ALIGN32 -SECTION .bss -.temp resd 1 ; for byte move left -.mode7xpos resd 1 ; x position -.tempa2 resd 1 ; keep this blank! -.mode7xrpos resd 1 ; x position -.tempa resd 1 ; keep this blank! -.mode7ypos resd 1 ; y position -.tempb2 resd 1 ; keep this blank! -.mode7yrpos resd 1 ; y position -.tempb resd 1 ; keep this blank! -.mode7xadder resd 1 ; number to add for x -.tempc2 resd 1 ; keep this blank! -.mode7xadd2 resd 1 ; number to add for x -.tempc resd 1 ; keep this blank! -.mode7yadder resd 1 ; number to add for y -.tempd2 resd 1 ; keep this blank! -.mode7yadd2 resd 1 ; number to add for y -.tempd resd 1 ; keep this blank! -.mode7ptr resd 1 ; pointer value -.mode7xinc resd 1 ; number to add for x -.mode7xincc resd 1 ; range check for x -.mode7yinc resd 1 ; number to add for y -.mode7xsloc resd 1 ; which screen x -.mode7ysloc resd 1 ; which screen y -.mode7xsrl resd 1 ; which relative screen x -.mode7ysrl resd 1 ; which relative screen y -.cxloc resw 1 ; cx location -.cyloc resw 1 ; cy location -.m7xaddofa resd 1 -.m7xaddof2a resd 1 -.m7yaddofa resd 1 -.m7yaddof2a resd 1 -SECTION .text - - -.drawmode7win -.domosaicw - mov ebx,[.mode7xrpos] - mov [mode7xrpos],ebx - mov ebx,[.mode7yrpos] - mov [mode7yrpos],ebx - mov ebx,[.mode7xadder] - mov [mode7xadder],ebx - mov ebx,[.mode7yadder] - mov [mode7yadder],ebx - - mov edi,[vram] - Mode7Processngw Mode7Normalng, domosaic, 1 - -NEWSYM drawmode7ngextbg2 - ; esi = pointer to video buffer - mov esi,[curvidoffset] ; esi = [vidbuffer] + curypos * 288 + 16 - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+16 - mov ecx,64 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+16 -.nomosaic - mov ecx,256 -.loop - mov al,[esi+75036] - test al,80h - jz .nopr2 - and al,7Fh - mov [esi],al -.nopr2 - inc esi - dec ecx - jnz .loop - xor eax,eax - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic - ret - - diff --git a/tools/zsnes/src/video/mv16tms.asm b/tools/zsnes/src/video/mv16tms.asm deleted file mode 100644 index e6fe158..0000000 --- a/tools/zsnes/src/video/mv16tms.asm +++ /dev/null @@ -1,1514 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 bgcoloradder,bgofwptr,bgsubby,bshifter,curbgpr,curmosaicsz,curvidoffset -EXTSYM cwinptr,domosaic16b,drawn,pal16b,scaddtype,scrnon,temp,tempcach,temptile -EXTSYM tileleft16b,transpbuf,winon,winptrref,xtravbuf,yadd,yadder,yrevadder -EXTSYM draw16x816t,bgmode,vcache2b,vcache4b,vcache8b,fulladdtab,pal16bcl -EXTSYM pal16bxcl,coadder16,a16x16xinc,a16x16yinc,curypos,yflipadd - -%include "video/vidmacro.mac" - -;******************************************************* -; Processes & Draws 8x8 tiles in 2, 4, & 8 bit mode -;******************************************************* - -%macro draw8x816tams 2 - mov al,[ebx+%1] - or al,al - jz %%loop - add al,dh - mov ecx,[ebp+%2] - mov eax,[pal16b+eax*4] - mov [ebp+%2],ax - test ecx,0FFFFh - je %%noadd - and eax,1111011111011110b ; [vesa2_clbit] - and ecx,1111011111011110b ; [vesa2_clbit] - add eax,ecx - shr eax,1 -%%noadd - mov [esi+%2],ax - xor eax,eax -%%loop -%endmacro - -%macro draw8x816tbms 2 - mov al,[edi+%1] - or al,al - jz %%loop - add al,dh - mov ebx,[ebp+%2] - mov ecx,[pal16bcl+eax*4] - mov [ebp+%2],cx - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tcms 2 - mov al,[edi+%1] - or al,al - jz %%loop - add al,dh - mov ebx,[ebp+%2] - mov ecx,[pal16bxcl+eax*4] - mov [ebp+%2],cx - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - xor ecx,0FFFFh - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tawinonms 2 - mov al,[ebx+%1] - or al,al - jz %%loop - test byte[edx+%1],0FFh - jnz %%loop - add al,[coadder16] - mov ecx,[ebp+%2] - mov eax,[pal16b+eax*4] - mov [ebp+%2],ax - test ecx,0FFFFh - je %%noadd - and eax,1111011111011110b ; [vesa2_clbit] - and ecx,1111011111011110b ; [vesa2_clbit] - add eax,ecx - shr eax,1 -%%noadd - mov [esi+%2],ax - xor eax,eax -%%loop -%endmacro - -%macro draw8x816tbwinonms 2 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+%1],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bcl+eax*4] - mov [ebp+%2],cx - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tcwinonms 2 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+%1],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bxcl+eax*4] - mov [ebp+%2],cx - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - xor ecx,0FFFFh - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tawinonbms 2 - mov al,[ebx+%1] - or al,al - jz %%loop - test byte[edx+7-%1],0FFh - jnz %%loop - add al,[coadder16] - mov ecx,[ebp+%2] - mov eax,[pal16b+eax*4] - mov [ebp+%2],ax - test ecx,0FFFFh - je %%noadd - and eax,1111011111011110b ; [vesa2_clbit] - and ecx,1111011111011110b ; [vesa2_clbit] - add eax,ecx - shr eax,1 -%%noadd - mov [esi+%2],ax - xor eax,eax -%%loop -%endmacro - -%macro draw8x816tbwinonbms 2 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+7-%1],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bcl+eax*4] - mov [ebp+%2],cx - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tcwinonbms 2 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+7-%1],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bxcl+eax*4] - mov [ebp+%2],cx - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - xor ecx,0FFFFh - mov [esi+%2],cx -%%loop -%endmacro - -SECTION .text - -NEWSYM draw8x816tms - cmp byte[bgmode],5 - je near draw16x816t - - mov [temp],al - mov [bshifter],ah - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx -; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value -; bit 10-12 = palette, 0-9=tile# - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw8x816twinonms -.domosaic - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - test byte[scaddtype],80h - jnz near draw8x816tsms - test byte[scaddtype],40h - jz near draw8x8fulladdms - cmp byte[scrnon+1],0 - jz near draw8x8fulladdms - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816tams -.hprior - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpf draw8x816tams - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw8x8fulladdms - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - push edi - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tbms -.hprior - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tbms - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - cmp byte[drawn],0 - je .nodraw2 - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b -.nodraw2 - ret - -NEWSYM draw8x816tsms - mov byte[tileleft16b],33 - mov byte[drawn],0 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - add edi,2 - push edi - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - - ; Begin Normal Loop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tcms -.hprior - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tcms - pop edi - add esi,16 - add ebp,16 - inc dl - cmp dl,20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw8x816twinonms - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - test byte[scaddtype],80h - jnz near draw8x816tswinonms - test byte[scaddtype],40h - jz near draw8x8fulladdwinonms - cmp byte[scrnon+1],0 - jz near draw8x8fulladdwinonms - mov byte[tileleft16b],33 - mov edx,[winptrref] - mov byte[drawn],0 -.loopa - mov ax,[edi] - mov cl,ah - add edi,2 - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl eax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test cl,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test cl,40h - jnz near .rloop - - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816tawinonms -.hprior - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpf draw8x816tawinonbms - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw8x8fulladdwinonms - mov byte[tileleft16b],33 - mov edx,[winptrref] - mov byte[drawn],0 -.loopa - mov ax,[edi] - mov cl,ah - add edi,2 - push edi - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tbwinonms -.hprior - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tbwinonbms - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw8x816tswinonms - mov byte[tileleft16b],33 - mov edx,[winptrref] - mov byte[drawn],0 -.loopa - mov ax,[edi] - mov cl,ah - add edi,2 - push edi - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - and eax,03FFh ; filter out tile # - mov edi,[tempcach] - shl eax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - - ; Begin Normal Loop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tcwinonms -.hprior - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc2 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tcwinonbms - pop edi - add esi,16 - add edx,8 - add ebp,16 - inc byte[temp] - cmp byte[temp],20h - jne .loopc - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -;******************************************************* -; Processes & Draws 16x16 tiles in 2, 4, & 8 bit mode -;******************************************************* -NEWSYM draw16x1616tms - mov byte[drawn],0 - mov [temp],eax - mov eax,esi - mov [yadder],ecx - mov [tempcach],ebx - mov ebx,56 - sub ebx,ecx - mov [yrevadder],ebx - xor ebx,ebx - mov bl,[curypos] - mov [temptile],edx - ; set up y adders - test byte[a16x16yinc],01h - jz .noincrc - mov word[yadd],16 - mov word[yflipadd],0 - jmp .yesincrc -.noincrc - mov word[yadd],0 - mov word[yflipadd],16 -.yesincrc - ; esi = pointer to video buffer - mov esi,[cwinptr] - sub esi,eax - mov [winptrref],esi - mov esi,[curvidoffset] - sub esi,eax ; esi = [vidbuffer] + curypos * 288 + 16 - HOfs - sub esi,eax - cmp byte[curmosaicsz],1 - je .nomosaic - mov esi,xtravbuf+32 - mov ecx,128 -.clearnext - mov dword[esi],0 - add esi,4 - dec ecx - jnz .clearnext - mov esi,xtravbuf+32 - sub esi,eax - sub esi,eax -.nomosaic - mov [temptile],edx - push ecx - mov dword[bgsubby],262144 - mov ecx,[vcache2b] - add ecx,262144 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov dword[bgsubby],131072 - mov ecx,[vcache4b] - add ecx,131072 - mov [bgofwptr],ecx - cmp dword[tempcach],ecx - jb .nobit - mov ecx,[vcache8b] - add ecx,65536 - mov [bgofwptr],ecx - mov dword[bgsubby],65536 -.nobit - pop ecx - cmp byte[curmosaicsz],1 - jne .domosaic - cmp byte[winon],0 - jne near draw16x1616twinonms -.domosaic - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - test byte[scaddtype],80h - jnz near draw16x1616tsms - test byte[scaddtype],40h - jz near draw16x16fulladdms - cmp byte[scrnon+1],0 - je near draw16x16fulladdms - mov byte[tileleft16b],33 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - test dh,20h - jnz near .hprior - inc byte[drawn] - test dh,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test dh,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816tams -.hprior - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpf draw8x816tams -.skiploop2b - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -draw16x16fulladdms: - mov byte[tileleft16b],33 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - push edi - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov edi,[tempcach] - shl ax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tbms -.hprior - pop edi - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tbms - pop edi - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -NEWSYM draw16x1616tsms - mov byte[tileleft16b],33 - mov dl,[temp] -.loopa - mov ax,[edi] - mov dh,ah - xor byte[a16x16xinc],1 - - test dh,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor dh,[curbgpr] - push edi - test dh,20h - jnz near .hprior - inc byte[drawn] - - test dh,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov edi,[tempcach] - shl ax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test dh,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test dh,40h - jnz near .rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tcms -.hprior - pop edi - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc dl -.noincrb2 - cmp dl,20h - jne .loopc2 - xor dl,dl - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - - ; reversed loop -.rloop - mov cl,[bshifter] - and dh,1Ch - shl dh,cl ; process palette # (bits 10-12) - add dh,[bgcoloradder] - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tcms - pop edi - add esi,16 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc dl -.noincrb - cmp dl,20h - jne .loopc - xor dl,dl - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - mov dh,[curmosaicsz] - cmp dh,1 - jne near domosaic16b - ret - -NEWSYM draw16x1616twinonms - mov ebp,transpbuf+32 - sub ebp,eax - sub ebp,eax - test byte[scaddtype],80h - jnz near draw16x1616tswinonms - test byte[scaddtype],40h - jz near draw16x16fulladdwinonms - cmp byte[scrnon+1],0 - je near draw16x16fulladdwinonms - mov byte[tileleft16b],33 - mov edx,[winptrref] -.loopa - mov ax,[edi] - mov cl,ah - xor byte[a16x16xinc],1 - test cl,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor cl,[curbgpr] - test cl,20h - jnz near .hprior - inc byte[drawn] - test cl,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - and ax,03FFh ; filter out tile # - mov ebx,[tempcach] - shl ax,6 - add ebx,eax - cmp ebx,[bgofwptr] - jb .noclip - sub ebx,[bgsubby] -.noclip - test cl,80h - jz .normadd - add ebx,[yrevadder] - jmp .skipadd -.normadd - add ebx,[yadder] -.skipadd - test cl,40h - jnz near .rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrp draw8x816tawinonms -.hprior - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc byte[temp] -.noincrb2 - cmp byte[temp],20h - jne .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpf draw8x816tawinonbms -.skiploop2b - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc byte[temp] -.noincrb - cmp byte[temp],20h - jne near .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw16x16fulladdwinonms - mov byte[tileleft16b],33 - mov edx,[winptrref] -.loopa - mov ax,[edi] - mov cl,ah - xor byte[a16x16xinc],1 - - test cl,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor cl,[curbgpr] - push edi - test cl,20h - jnz near .hprior - inc byte[drawn] - - test cl,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov edi,[tempcach] - shl ax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tbwinonms -.hprior - pop edi - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc byte[temp] -.noincrb2 - cmp byte[temp],20h - jne .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tbwinonbms - pop edi - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc byte[temp] -.noincrb - cmp byte[temp],20h - jne near .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret - -NEWSYM draw16x1616tswinonms - mov byte[tileleft16b],33 - mov edx,[winptrref] -.loopa - mov ax,[edi] - mov cl,ah - xor byte[a16x16xinc],1 - - test cl,40h - jnz .noxflip - test byte[a16x16xinc],01h - jnz .noincr2 - inc ax - add edi,2 -.noincr2 - jmp .yesxflip -.noxflip - test byte[a16x16xinc],01h - jnz .noincr - add edi,2 - jmp .yesincr -.noincr - inc ax -.yesincr -.yesxflip - xor cl,[curbgpr] - push edi - test cl,20h - jnz near .hprior - inc byte[drawn] - - test cl,80h - jnz .noyflip - add ax,word[yadd] - jmp .yesyflip -.noyflip - add ax,word[yflipadd] -.yesyflip - - and ax,03FFh ; filter out tile # - mov edi,[tempcach] - shl ax,6 - add edi,eax - cmp edi,[bgofwptr] - jb .noclip - sub edi,[bgsubby] -.noclip - test cl,80h - jz .normadd - add edi,[yrevadder] - jmp .skipadd -.normadd - add edi,[yadder] -.skipadd - test cl,40h - jnz near .rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - ; Start loop - drawtilegrpfull draw8x816tcwinonms -.hprior - pop edi - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb2 - inc byte[temp] -.noincrb2 - cmp byte[temp],20h - jne .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc2 - dec byte[tileleft16b] - jnz near .loopa - ret - - ; reversed loop -.rloop - mov al,cl - mov cl,[bshifter] - and al,1Ch - shl al,cl ; process palette # (bits 10-12) - add al,[bgcoloradder] - mov [coadder16],al - xor eax,eax - xor ecx,ecx - drawtilegrpfullf draw8x816tcwinonbms - pop edi - add esi,16 - add edx,8 - add ebp,16 - test byte[a16x16xinc],01h - jnz .noincrb - inc byte[temp] -.noincrb - cmp byte[temp],20h - jne near .loopc2 - mov byte[temp],0 - mov edi,[temptile] -.loopc - dec byte[tileleft16b] - jnz near .loopa - ret diff --git a/tools/zsnes/src/video/newg162.asm b/tools/zsnes/src/video/newg162.asm deleted file mode 100644 index 0de4033..0000000 --- a/tools/zsnes/src/video/newg162.asm +++ /dev/null @@ -1,1398 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 ngwintable,ngwinen,ngcwinptr,ngcpixleft,ngcwinmode,tleftn,ng16bprval -EXTSYM vrama,bg1drwng,ng16bbgval,bg1totng,bgtxadd,taddnfy16x16,taddfy16x16 -EXTSYM switch16x16,curmosaicsz,domosaicng16b,vidmemch2,vidmemch4,vidmemch8 -EXTSYM mode0add,vcache4b,vcache2b,vcache8b,cachesingle2bng,cachesingle8bng -EXTSYM ngpalcon4b,ngpalcon8b,ngpalcon2b,tleftnb,tltype2b,tltype4b,tltype8b -EXTSYM yposng,flipyposng,ofsmcptr,ofsmtptr,ofsmmptr,ofsmcyps,ofsmady,ofsmadx -EXTSYM FillSubScr,UnusedBitXor,yposngom,flipyposngom,cbgval,ofsmval,ofsmvalh -EXTSYM CPalPtrng,BGMS1,scadtng,CMainWinScr,CSubWinScr,UnusedBit,res640 -EXTSYM mosclineval,mostranspval,vcache2bs,vcache4bs,vcache8bs,vidmemch2s -EXTSYM vidmemch4s,vidmemch8s,cpalval,bgtxadd2,SpecialLine,cachesingle4bng -EXTSYM ofshvaladd,ofsmtptrs,ofsmcptr2,ngptrdat2 - -%include "video/vidmacro.mac" -%include "video/newg162.mac" -%include "video/newgfx16.mac" -%include "video/newg16wn.mac" - -;****************************************** -; 16bitng caching functions -;****************************************** - -%macro cacheloopstuff 1 - mov bl,[esi+%1] - or bl,bl - jnz %%okay - mov ax,0FFFFh - jmp %%transp -%%okay - or bl,dl - mov ax,[ebp+ebx*2] -%%transp - mov [edi+%1*2],ax - mov [edi+14-%1*2+128],ax -%endmacro - -%macro DoCache 2 - push ecx - push eax - push esi - push edi - mov esi,ecx - xor ebx,ebx - shl esi,6 - shl ecx,8 - add esi,[%1] - add ecx,[%2] - mov edi,ecx - mov ecx,8 - -.loop - cacheloopstuff 0 - cacheloopstuff 1 - cacheloopstuff 2 - cacheloopstuff 3 - cacheloopstuff 4 - cacheloopstuff 5 - cacheloopstuff 6 - cacheloopstuff 7 - add edi,16 - add esi,8 - dec ecx - jnz near .loop - pop edi - pop esi - pop eax - pop ecx - ret -%endmacro - -SECTION .text - -cache2b16b: - DoCache vcache2b,vcache2bs -cache4b16b: - DoCache vcache4b,vcache4bs -cache8b16b: - DoCache vcache8b,vcache8bs - -;****************************************** -; 8x8 tiles - tile engine -;****************************************** - -%macro WinClipMacro 1 - mov byte[tleftn],33 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %1 - sub dword[ebx],8 - add ax,2 - mov ebx,[ng16bbgval] - add edi,16 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jnz .notileadd - add ax,[bgtxadd] -.notileadd - dec byte[tleftn] - jnz .winclipped - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %1 - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline -%endmacro - -%macro determinetransp 1 - mov [mostranspval],dl - mov [mosclineval],ebx - add ecx,[CMainWinScr] - cmp byte[curmosaicsz],1 - jne .mosaic - test byte[BGMS1+ebx*2],dl - jz .nosubmain - test byte[FillSubScr+ebx],1 - jnz near %1 - jmp .main -.nosubmain - test byte[FillSubScr+ebx],1 - jz .main - sub ecx,[CMainWinScr] - add ecx,[CSubWinScr] - add edi,75036*2 - jmp .main -.mosaic - test byte[FillSubScr+ebx],1 - jz .main - sub ecx,[CMainWinScr] - add ecx,[CSubWinScr] -.main -%endmacro - -%macro CheckWindowing 1 - cmp byte[ngwinen],0 - je %%nowindowing - cmp byte[ecx],0 - jne near %1 -%%nowindowing -%endmacro - -%macro DetermineWindow 3 ; both,main,sub - cmp byte[ngwinen],0 - je %%nowindow - cmp byte[ecx],0 - jz near %3 - sub ecx,[CMainWinScr] - add ecx,[CSubWinScr] - cmp byte[ecx],0 - jnz near %1 - jmp %2 -%%nowindow -%endmacro - -%macro drawtile16b 10 - mov byte[tleftn],33 - -%%loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near %%finline - drawtileng16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8,%9,%10 - ret -%endmacro - -%macro drawtile16bw 12 - WinClipMacro %%processwinclip2b - drawtileng16b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8,%9,%10 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawtilengwin16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8,%11,%12 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -%macro drawtile16bw2 14 - mov byte[tleftn],33 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne near .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %%processwinclip2b - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finlineb - drawtileng16b %1,%2,%3,.winclipped,.finlineb,%4,%5,%6,%7,%8,%13,%14 -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %%processwinclip2b - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawtileng16b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8,%9,%10 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawtilengwin16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8,%11,%12 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -NEWSYM drawtileng2b16b - mov ebp,[cpalval+ebx*4] - determinetransp drawtileng2b16bt -drawtileng2b16bnt - CheckWindowing drawtileng2bwin - drawtile16b tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormal,tilenormalb -drawtileng2bwin: - drawtile16bw tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormal,tilenormalb,tilenormalw,tilenormalwb -drawtileng2b16bt - test byte[BGMS1+ebx*2+1],dl - jnz near drawtileng2b16bms - test byte[scadtng+ebx],dl - jz near drawtileng2b16bnt - CheckWindowing drawtileng2bwint - drawtile16b tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalt,tilenormalbt -drawtileng2bwint: - drawtile16bw tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalt,tilenormalbt,tilenormalwt,tilenormalwbt -drawtileng2b16bms: - test byte[scadtng+ebx],dl - jz near drawtileng2b16bmsnt - DetermineWindow drawtileng2b16bmstmsw, drawtileng2b16bmstmw, drawtileng2b16bmstsw - drawtile16b tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst -drawtileng2b16bmstmsw: - drawtile16bw tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst,tilenormalwmst,tilenormalwbmst -drawtileng2b16bmstmw: - drawtile16bw2 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst,tilenormalwsmt,tilenormalwbsmt,tilenormals,tilenormalbs -drawtileng2b16bmstsw: - drawtile16bw2 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst,tilenormalwmsbt,tilenormalwbmsbt,tilenormalt,tilenormalbt -drawtileng2b16bmsnt - DetermineWindow drawtileng2b16bmsntmsw, drawtileng2b16bmsntmw, drawtileng2b16bmsntsw - drawtile16b tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt -drawtileng2b16bmsntmsw: - drawtile16bw tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsnt,tilenormalwbmsnt -drawtileng2b16bmsntmw: - drawtile16bw2 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwsmnt,tilenormalwbsmnt,tilenormals,tilenormalbs -drawtileng2b16bmsntsw: - drawtile16bw2 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsbnt,tilenormalwbmsbnt,tilenormal,tilenormalb - -NEWSYM drawtileng4b16b - mov ebp,[cpalval+ebx*4] - determinetransp drawtileng4b16bt -drawtileng4b16bnt - CheckWindowing drawtileng4bwin - drawtile16b tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormal,tilenormalb -drawtileng4bwin: - drawtile16bw tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormal,tilenormalb,tilenormalw,tilenormalwb -drawtileng4b16bt - test byte[BGMS1+ebx*2+1],dl - jnz near drawtileng4b16bms - test byte[scadtng+ebx],dl - jz near drawtileng4b16bnt - CheckWindowing drawtileng4bwint - drawtile16b tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalt,tilenormalbt -drawtileng4bwint: - drawtile16bw tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalt,tilenormalbt,tilenormalwt,tilenormalwbt -drawtileng4b16bms: - test byte[scadtng+ebx],dl - jz near drawtileng4b16bmsnt - DetermineWindow drawtileng4b16bmstmsw, drawtileng4b16bmstmw, drawtileng4b16bmstsw - drawtile16b tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst -drawtileng4b16bmstmsw: - drawtile16bw tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst,tilenormalwmst,tilenormalwbmst -drawtileng4b16bmstmw: - drawtile16bw2 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst,tilenormalwsmt,tilenormalwbsmt,tilenormals,tilenormalbs -drawtileng4b16bmstsw: - drawtile16bw2 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst,tilenormalwmsbt,tilenormalwbmsbt,tilenormalt,tilenormalbt -drawtileng4b16bmsnt - DetermineWindow drawtileng4b16bmsntmsw, drawtileng4b16bmsntmw, drawtileng4b16bmsntsw - drawtile16b tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt -drawtileng4b16bmsntmsw: - drawtile16bw tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsnt,tilenormalwbmsnt -drawtileng4b16bmsntmw: - drawtile16bw2 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwsmnt,tilenormalwbsmnt,tilenormals,tilenormalbs -drawtileng4b16bmsntsw: - drawtile16bw2 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsbnt,tilenormalwbmsbnt,tilenormal,tilenormalb - -NEWSYM drawtileng8b16b - mov ebp,[cpalval+ebx*4] - determinetransp drawtileng8b16bt -drawtileng8b16bnt - CheckWindowing drawtileng8bwin - drawtile16b tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0Fh,vidmemch8s,cache8b16b,tilenormal,tilenormalb -drawtileng8bwin: - drawtile16bw tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0Fh,vidmemch8s,cache8b16b,tilenormal,tilenormalb,tilenormalw,tilenormalwb -drawtileng8b16bt - test byte[BGMS1+ebx*2+1],dl - jnz near drawtileng8b16bms - test byte[scadtng+ebx],dl - jz near drawtileng8b16bnt - CheckWindowing drawtileng8bwint - drawtile16b tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0Fh,vidmemch8s,cache8b16b,tilenormalt,tilenormalbt -drawtileng8bwint: - drawtile16bw tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0Fh,vidmemch8s,cache8b16b,tilenormalt,tilenormalbt,tilenormalwt,tilenormalwbt -drawtileng8b16bms: - test byte[scadtng+ebx],dl - jz near drawtileng8b16bmsnt - DetermineWindow drawtileng8b16bmstmsw, drawtileng8b16bmstmw, drawtileng8b16bmstsw - drawtile16b tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmst,tilenormalbmst -drawtileng8b16bmstmsw: - drawtile16bw tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmst,tilenormalbmst,tilenormalwmst,tilenormalwbmst -drawtileng8b16bmstmw: - drawtile16bw2 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmst,tilenormalbmst,tilenormalwsmt,tilenormalwbsmt,tilenormals,tilenormalbs -drawtileng8b16bmstsw: - drawtile16bw2 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmst,tilenormalbmst,tilenormalwmsbt,tilenormalwbmsbt,tilenormalt,tilenormalbt -drawtileng8b16bmsnt - DetermineWindow drawtileng8b16bmsntmsw, drawtileng8b16bmsntmw, drawtileng8b16bmsntsw - drawtile16b tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmsnt,tilenormalbmsnt -drawtileng8b16bmsntmsw: - drawtile16bw tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsnt,tilenormalwbmsnt -drawtileng8b16bmsntmw: - drawtile16bw2 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwsmnt,tilenormalwbsmnt,tilenormals,tilenormalbs -drawtileng8b16bmsntsw: - drawtile16bw2 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsbnt,tilenormalwbmsbnt,tilenormal,tilenormalb - -;****************************************** -; 16x16 tiles - tile engine -;****************************************** - -%macro WinClipMacro16x16 1 - mov byte[tleftn],17 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %1 - sub dword[ebx],16 - add ax,2 - mov ebx,[ng16bbgval] - add edi,32 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jnz .notileadd - add ax,[bgtxadd] -.notileadd - dec byte[tleftn] - jnz .winclipped - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %1 - sub dword[ebx],16 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline -%endmacro - -%macro drawtile16b16x16 10 - mov byte[tleftn],17 -%%loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near %%finline - drawtileng16x1616b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8,%9,%10 - ret -%endmacro - -%macro drawtile16bw16x16 12 - WinClipMacro16x16 %%processwinclip2b - drawtileng16x1616b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8,%9,%10 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawtileng16x16win16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8,%11,%12 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -%macro drawtile16bw216x16 14 - mov byte[tleftn],17 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne near .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %%processwinclip2b - sub dword[ebx],16 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finlineb - drawtileng16x1616b %1,%2,%3,.winclipped,.finlineb,%4,%5,%6,%7,%8,%13,%14 -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %%processwinclip2b - sub dword[ebx],16 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawtileng16x1616b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8,%9,%10 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawtileng16x16win16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8,%11,%12 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -NEWSYM drawtileng16x162b16b - mov ebp,[cpalval+ebx*4] - determinetransp drawtileng2b16bt16x16 -drawtileng2b16bnt16x16 - CheckWindowing drawtileng2bwin16x16 - drawtile16b16x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormal,tilenormalb -drawtileng2bwin16x16: - drawtile16bw16x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormal,tilenormalb,tilenormalw,tilenormalwb -drawtileng2b16bt16x16 - test byte[BGMS1+ebx*2+1],dl - jnz near drawtileng2b16bms16x16 - test byte[scadtng+ebx],dl - jz near drawtileng2b16bnt16x16 - CheckWindowing drawtileng2bwint16x16 - drawtile16b16x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalt,tilenormalbt -drawtileng2bwint16x16: - drawtile16bw16x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalt,tilenormalbt,tilenormalwt,tilenormalwbt -drawtileng2b16bms16x16: - test byte[scadtng+ebx],dl - jz near drawtileng2b16bmsnt16x16 - DetermineWindow drawtileng2b16bmstmsw16x16, drawtileng2b16bmstmw16x16, drawtileng2b16bmstsw16x16 - drawtile16b16x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst -drawtileng2b16bmstmsw16x16: - drawtile16bw16x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst,tilenormalwmst,tilenormalwbmst -drawtileng2b16bmstmw16x16: - drawtile16bw216x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst,tilenormalwsmt,tilenormalwbsmt,tilenormals,tilenormalbs -drawtileng2b16bmstsw16x16: - drawtile16bw216x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst,tilenormalwmsbt,tilenormalwbmsbt,tilenormalt,tilenormalbt -drawtileng2b16bmsnt16x16 - DetermineWindow drawtileng2b16bmsntmsw16x16, drawtileng2b16bmsntmw16x16, drawtileng2b16bmsntsw16x16 - drawtile16b16x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt -drawtileng2b16bmsntmsw16x16: - drawtile16bw16x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsnt,tilenormalwbmsnt -drawtileng2b16bmsntmw16x16: - drawtile16bw216x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwsmnt,tilenormalwbsmnt,tilenormals,tilenormalbs -drawtileng2b16bmsntsw16x16: - drawtile16bw216x16 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsbnt,tilenormalwbmsbnt,tilenormal,tilenormalb - -NEWSYM drawtileng16x164b16b - mov ebp,[cpalval+ebx*4] - determinetransp drawtileng4b16bt16x16 -drawtileng4b16bnt16x16 - CheckWindowing drawtileng4bwin16x16 - drawtile16b16x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormal,tilenormalb -drawtileng4bwin16x16: - drawtile16bw16x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormal,tilenormalb,tilenormalw,tilenormalwb -drawtileng4b16bt16x16 - test byte[BGMS1+ebx*2+1],dl - jnz near drawtileng4b16bms16x16 - test byte[scadtng+ebx],dl - jz near drawtileng4b16bnt16x16 - CheckWindowing drawtileng4bwint16x16 - drawtile16b16x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalt,tilenormalbt -drawtileng4bwint16x16: - drawtile16bw16x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalt,tilenormalbt,tilenormalwt,tilenormalwbt -drawtileng4b16bms16x16: - test byte[scadtng+ebx],dl - jz near drawtileng4b16bmsnt16x16 - DetermineWindow drawtileng4b16bmstmsw16x16, drawtileng4b16bmstmw16x16, drawtileng4b16bmstsw16x16 - drawtile16b16x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst -drawtileng4b16bmstmsw16x16: - drawtile16bw16x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst,tilenormalwmst,tilenormalwbmst -drawtileng4b16bmstmw16x16: - drawtile16bw216x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst,tilenormalwsmt,tilenormalwbsmt,tilenormals,tilenormalbs -drawtileng4b16bmstsw16x16: - drawtile16bw216x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst,tilenormalwmsbt,tilenormalwbmsbt,tilenormalt,tilenormalbt -drawtileng4b16bmsnt16x16 - DetermineWindow drawtileng4b16bmsntmsw16x16, drawtileng4b16bmsntmw16x16, drawtileng4b16bmsntsw16x16 - drawtile16b16x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt -drawtileng4b16bmsntmsw16x16: - drawtile16bw16x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsnt,tilenormalwbmsnt -drawtileng4b16bmsntmw16x16: - drawtile16bw216x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwsmnt,tilenormalwbsmnt,tilenormals,tilenormalbs -drawtileng4b16bmsntsw16x16: - drawtile16bw216x16 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsbnt,tilenormalwbmsbnt,tilenormal,tilenormalb - -NEWSYM drawtileng16x168b16b - mov ebp,[cpalval+ebx*4] - determinetransp drawtileng8b16bt16x16 -drawtileng8b16bnt16x16 - CheckWindowing drawtileng8bwin16x16 - drawtile16b16x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormal,tilenormalb -drawtileng8bwin16x16: - drawtile16bw16x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormal,tilenormalb,tilenormalw,tilenormalwb -drawtileng8b16bt16x16 - test byte[BGMS1+ebx*2+1],dl - jnz near drawtileng8b16bms16x16 - test byte[scadtng+ebx],dl - jz near drawtileng8b16bnt16x16 - CheckWindowing drawtileng8bwint16x16 - drawtile16b16x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalt,tilenormalbt -drawtileng8bwint16x16: - drawtile16bw16x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalt,tilenormalbt,tilenormalwt,tilenormalwbt -drawtileng8b16bms16x16: - test byte[scadtng+ebx],dl - jz near drawtileng8b16bmsnt16x16 - DetermineWindow drawtileng8b16bmstmsw16x16, drawtileng8b16bmstmw16x16, drawtileng8b16bmstsw16x16 - drawtile16b16x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmst,tilenormalbmst -drawtileng8b16bmstmsw16x16: - drawtile16bw16x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmst,tilenormalbmst,tilenormalwmst,tilenormalwbmst -drawtileng8b16bmstmw16x16: - drawtile16bw216x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmst,tilenormalbmst,tilenormalwsmt,tilenormalwbsmt,tilenormals,tilenormalbs -drawtileng8b16bmstsw16x16: - drawtile16bw216x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmst,tilenormalbmst,tilenormalwmsbt,tilenormalwbmsbt,tilenormalt,tilenormalbt -drawtileng8b16bmsnt16x16 - DetermineWindow drawtileng8b16bmsntmsw16x16, drawtileng8b16bmsntmw16x16, drawtileng8b16bmsntsw16x16 - drawtile16b16x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmsnt,tilenormalbmsnt -drawtileng8b16bmsntmsw16x16: - drawtile16bw16x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsnt,tilenormalwbmsnt -drawtileng8b16bmsntmw16x16: - drawtile16bw216x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwsmnt,tilenormalwbsmnt,tilenormals,tilenormalbs -drawtileng8b16bmsntsw16x16: - drawtile16bw216x16 tltype8b, preparet8batile, cachesingle8bng,ngpalcon8b,test8ba,0FFh,vidmemch8s,cache8b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsbnt,tilenormalwbmsbnt,tilenormal,tilenormalb - -;****************************************** -; 8x8 tiles - line by line engine -;****************************************** - -%macro drawline16bmacro 8 - mov byte[tleftn],33 -%%loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near %%finline - drawlineng16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8 - ret -%endmacro - -%macro drawline16bwmacro 9 - WinClipMacro %%processwinclip2b - drawlineng16b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawlinengwin16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%9 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -%macro drawline16bw2macro 11 - mov byte[tleftn],33 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne near .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %%processwinclip2b - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finlineb - drawlineng16b %1,%2,%3,.winclipped,.finlineb,%4,%5,%6,%10,%11 -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %%processwinclip2b - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlineng16b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawlinengwin16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%9 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -NEWSYM drawlineng2b16b - determinetransp drawlineng2b16bt -drawlineng2b16bnt - CheckWindowing drawlineng2bwin - drawline16bmacro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixels,procpixelst -drawlineng2bwin: - drawline16bwmacro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixels,procpixelst,procpixelstw -drawlineng2b16bt - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng2b16bms - test byte[scadtng+ebx],dl - jz near drawlineng2b16bnt - CheckWindowing drawlineng2bwint - drawline16bmacro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelstr,procpixelstt -drawlineng2bwint: - drawline16bwmacro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelstr,procpixelstt,procpixelstwt -drawlineng2b16bms: - test byte[scadtng+ebx],dl - jz near drawlineng2b16bmsnt - DetermineWindow drawlineng2b16bmstmsw, drawlineng2b16bmstmw, drawlineng2b16bmstsw - drawline16bmacro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmst,procpixelstmst -drawlineng2b16bmstmsw: - drawline16bwmacro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmst,procpixelstmst,procpixelstwmst -drawlineng2b16bmstmw: - drawline16bw2macro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmst,procpixelstmst,procpixelstwsmt,procpixelss,procpixelsts -drawlineng2b16bmstsw: - drawline16bw2macro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmst,procpixelstmst,procpixelstwmsbt,procpixelstr,procpixelstt -drawlineng2b16bmsnt - DetermineWindow drawlineng2b16bmsntmsw, drawlineng2b16bmsntmw, drawlineng2b16bmsntsw - drawline16bmacro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmsnt,procpixelstmsnt -drawlineng2b16bmsntmsw: - drawline16bwmacro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmsnt,procpixelstmsnt,procpixelstwmsnt -drawlineng2b16bmsntmw: - drawline16bw2macro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmsnt,procpixelstmsnt,procpixelstwsmnt,procpixelss,procpixelsts -drawlineng2b16bmsntsw: - drawline16bw2macro tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmsnt,procpixelstmsnt,procpixelstwmsbnt,procpixelsnt,procpixelstnt - -NEWSYM drawlineng4b16b - determinetransp drawlineng4b16bt -drawlineng4b16bnt - CheckWindowing drawlineng4bwin - drawline16bmacro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixels,procpixelst -drawlineng4bwin: - drawline16bwmacro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixels,procpixelst,procpixelstw -drawlineng4b16bt - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng4b16bms - test byte[scadtng+ebx],dl - jz near drawlineng4b16bnt - CheckWindowing drawlineng4bwint - drawline16bmacro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelstr,procpixelstt -drawlineng4bwint: - drawline16bwmacro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelstr,procpixelstt,procpixelstwt -drawlineng4b16bms: - test byte[scadtng+ebx],dl - jz near drawlineng4b16bmsnt - DetermineWindow drawlineng4b16bmstmsw, drawlineng4b16bmstmw, drawlineng4b16bmstsw - drawline16bmacro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst -drawlineng4b16bmstmsw: - drawline16bwmacro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst,procpixelstwmst -drawlineng4b16bmstmw: - drawline16bw2macro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst,procpixelstwsmt,procpixelss,procpixelsts -drawlineng4b16bmstsw: - drawline16bw2macro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst,procpixelstwmsbt,procpixelstr,procpixelstt -drawlineng4b16bmsnt - DetermineWindow drawlineng4b16bmsntmsw, drawlineng4b16bmsntmw, drawlineng4b16bmsntsw - drawline16bmacro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt -drawlineng4b16bmsntmsw: - drawline16bwmacro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsnt -drawlineng4b16bmsntmw: - drawline16bw2macro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt,procpixelstwsmnt,procpixelss,procpixelsts -drawlineng4b16bmsntsw: - drawline16bw2macro tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsbnt,procpixelsnt,procpixelstnt - -NEWSYM drawlineng8b16b - determinetransp drawlineng8b16bt -drawlineng8b16bnt - CheckWindowing drawlineng8bwin - drawline16bmacro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixels,procpixelst -drawlineng8bwin: - drawline16bwmacro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixels,procpixelst,procpixelstw -drawlineng8b16bt - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng8b16bms - test byte[scadtng+ebx],dl - jz near drawlineng8b16bnt - CheckWindowing drawlineng8bwint - drawline16bmacro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelstr,procpixelstt -drawlineng8bwint: - drawline16bwmacro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelstr,procpixelstt,procpixelstwt -drawlineng8b16bms: - test byte[scadtng+ebx],dl - jz near drawlineng8b16bmsnt - DetermineWindow drawlineng8b16bmstmsw, drawlineng8b16bmstmw, drawlineng8b16bmstsw - drawline16bmacro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmst,procpixelstmst -drawlineng8b16bmstmsw: - drawline16bwmacro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmst,procpixelstmst,procpixelstwmst -drawlineng8b16bmstmw: - drawline16bw2macro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmst,procpixelstmst,procpixelstwsmt,procpixelss,procpixelsts -drawlineng8b16bmstsw: - drawline16bw2macro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmst,procpixelstmst,procpixelstwmsbt,procpixelstr,procpixelstt -drawlineng8b16bmsnt - DetermineWindow drawlineng8b16bmsntmsw, drawlineng8b16bmsntmw, drawlineng8b16bmsntsw - drawline16bmacro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmsnt,procpixelstmsnt -drawlineng8b16bmsntmsw: - drawline16bwmacro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsnt -drawlineng8b16bmsntmw: - drawline16bw2macro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmsnt,procpixelstmsnt,procpixelstwsmnt,procpixelss,procpixelsts -drawlineng8b16bmsntsw: - drawline16bw2macro tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsbnt,procpixelsnt,procpixelstnt - -;****************************************** -; 16x16 tiles - line by line engine -;****************************************** - -%macro drawline16bmacro16x16 8 - mov byte[tleftn],17 -%%loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near %%finline - drawlineng16x1616b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8 - ret -%endmacro - -%macro drawline16bwmacro16x16 9 - WinClipMacro16x16 %%processwinclip2b - drawlineng16x1616b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawlineng16x16win16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%9 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -%macro drawline16bw2macro16x16 11 - mov byte[tleftn],17 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne near .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %%processwinclip2b - sub dword[ebx],16 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finlineb - drawlineng16x1616b %1,%2,%3,.winclipped,.finlineb,%4,%5,%6,%10,%11 -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %%processwinclip2b - sub dword[ebx],16 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlineng16x1616b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawlineng16x16win16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%9 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - - -NEWSYM drawlineng16x162b16b - determinetransp drawlineng2b16bt16x16 -drawlineng2b16bnt16x16 - CheckWindowing drawlineng2bwin16x16 - drawline16bmacro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixels,procpixelst -drawlineng2bwin16x16: - drawline16bwmacro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixels,procpixelst,procpixelstw -drawlineng2b16bt16x16 - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng2b16bms16x16 - test byte[scadtng+ebx],dl - jz near drawlineng2b16bnt16x16 - CheckWindowing drawlineng2bwint16x16 - drawline16bmacro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelstr,procpixelstt -drawlineng2bwint16x16: - drawline16bwmacro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelstr,procpixelstt,procpixelstwt -drawlineng2b16bms16x16: - test byte[scadtng+ebx],dl - jz near drawlineng2b16bmsnt16x16 - DetermineWindow drawlineng2b16bmstmsw16x16, drawlineng2b16bmstmw16x16, drawlineng2b16bmstsw16x16 - drawline16bmacro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmst,procpixelstmst -drawlineng2b16bmstmsw16x16: - drawline16bwmacro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmst,procpixelstmst,procpixelstwmst -drawlineng2b16bmstmw16x16: - drawline16bw2macro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmst,procpixelstmst,procpixelstwsmt,procpixelss,procpixelsts -drawlineng2b16bmstsw16x16: - drawline16bw2macro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmst,procpixelstmst,procpixelstwmsbt,procpixelstr,procpixelstt -drawlineng2b16bmsnt16x16 - DetermineWindow drawlineng2b16bmsntmsw16x16, drawlineng2b16bmsntmw16x16, drawlineng2b16bmsntsw16x16 - drawline16bmacro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmsnt,procpixelstmsnt -drawlineng2b16bmsntmsw16x16: - drawline16bwmacro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmsnt,procpixelstmsnt,procpixelstwmsnt -drawlineng2b16bmsntmw16x16: - drawline16bw2macro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmsnt,procpixelstmsnt,procpixelstwsmnt,procpixelss,procpixelsts -drawlineng2b16bmsntsw16x16: - drawline16bw2macro16x16 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmsnt,procpixelstmsnt,procpixelstwmsbnt,procpixelsnt,procpixelstnt - -NEWSYM drawlineng16x164b16b - determinetransp drawlineng4b16bt16x16 -drawlineng4b16bnt16x16 - CheckWindowing drawlineng4bwin16x16 - drawline16bmacro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixels,procpixelst -drawlineng4bwin16x16: - drawline16bwmacro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixels,procpixelst,procpixelstw -drawlineng4b16bt16x16 - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng4b16bms16x16 - test byte[scadtng+ebx],dl - jz near drawlineng4b16bnt16x16 - CheckWindowing drawlineng4bwint16x16 - drawline16bmacro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelstr,procpixelstt -drawlineng4bwint16x16: - drawline16bwmacro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelstr,procpixelstt,procpixelstwt -drawlineng4b16bms16x16: - test byte[scadtng+ebx],dl - jz near drawlineng4b16bmsnt16x16 - DetermineWindow drawlineng4b16bmstmsw16x16, drawlineng4b16bmstmw16x16, drawlineng4b16bmstsw16x16 - drawline16bmacro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst -drawlineng4b16bmstmsw16x16: - drawline16bwmacro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst,procpixelstwmst -drawlineng4b16bmstmw16x16: - drawline16bw2macro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst,procpixelstwsmt,procpixelss,procpixelsts -drawlineng4b16bmstsw16x16: - drawline16bw2macro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst,procpixelstwmsbt,procpixelstr,procpixelstt -drawlineng4b16bmsnt16x16 - DetermineWindow drawlineng4b16bmsntmsw16x16, drawlineng4b16bmsntmw16x16, drawlineng4b16bmsntsw16x16 - drawline16bmacro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt -drawlineng4b16bmsntmsw16x16: - drawline16bwmacro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsnt -drawlineng4b16bmsntmw16x16: - drawline16bw2macro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt,procpixelstwsmnt,procpixelss,procpixelsts -drawlineng4b16bmsntsw16x16: - drawline16bw2macro16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsbnt,procpixelsnt,procpixelstnt - -NEWSYM drawlineng16x168b16b - determinetransp drawlineng8b16bt16x16 -drawlineng8b16bnt16x16 - CheckWindowing drawlineng8bwin16x16 - drawline16bmacro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixels,procpixelst -drawlineng8bwin16x16: - drawline16bwmacro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixels,procpixelst,procpixelstw -drawlineng8b16bt16x16 - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng8b16bms16x16 - test byte[scadtng+ebx],dl - jz near drawlineng8b16bnt16x16 - CheckWindowing drawlineng8bwint16x16 - drawline16bmacro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelstr,procpixelstt -drawlineng8bwint16x16: - drawline16bwmacro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelstr,procpixelstt,procpixelstwt -drawlineng8b16bms16x16: - test byte[scadtng+ebx],dl - jz near drawlineng8b16bmsnt16x16 - DetermineWindow drawlineng8b16bmstmsw16x16, drawlineng8b16bmstmw16x16, drawlineng8b16bmstsw16x16 - drawline16bmacro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmst,procpixelstmst -drawlineng8b16bmstmsw16x16: - drawline16bwmacro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmst,procpixelstmst,procpixelstwmst -drawlineng8b16bmstmw16x16: - drawline16bw2macro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmst,procpixelstmst,procpixelstwsmt,procpixelss,procpixelsts -drawlineng8b16bmstsw16x16: - drawline16bw2macro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmst,procpixelstmst,procpixelstwmsbt,procpixelstr,procpixelstt -drawlineng8b16bmsnt16x16 - DetermineWindow drawlineng8b16bmsntmsw16x16, drawlineng8b16bmsntmw16x16, drawlineng8b16bmsntsw16x16 - drawline16bmacro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmsnt,procpixelstmsnt -drawlineng8b16bmsntmsw16x16: - drawline16bwmacro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsnt -drawlineng8b16bmsntmw16x16: - drawline16bw2macro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmsnt,procpixelstmsnt,procpixelstwsmnt,procpixelss,procpixelsts -drawlineng8b16bmsntsw16x16: - drawline16bw2macro16x16 tltype8b,preparet8ba,cachesingle8bng,ngpalcon8b,test8ba,0FFh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsbnt,procpixelsnt,procpixelstnt - -%macro drawline16bmacro16x8 10 - cmp byte[curmosaicsz],1 - ja near %%res640 - cmp byte[res640],0 - je near %%res640 - mov byte[tleftn],33 -%%loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near %%finline - drawlineng16x816b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8 - ret -%%res640 - push ebx - mov cl,[curmosaicsz] -%%mosloop - mov byte[SpecialLine+ebx],0 - inc ebx - dec cl - jnz %%mosloop - pop ebx - mov byte[tleftn],33 -%%loopb - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near %%finlineb - drawlineng16x816b %1,%2,%3,%%loopb,%%finlineb,%4,%5,%6,%9,%10 - ret -%endmacro - -NEWSYM drawlineng16x84b16b - determinetransp drawlineng4b16bt16x8 -drawlineng4b16bnt16x8 - drawline16bmacro16x8 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixels16x8,procpixelst16x8,procpixels16x8b,procpixelst16x8b -drawlineng4b16bt16x8 - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng4b16bms16x8 - test byte[scadtng+ebx],dl - jz near drawlineng4b16bnt16x8 - drawline16bmacro16x8 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelstr16x8,procpixelstt16x8,procpixelstr16x8b,procpixelstt16x8b -drawlineng4b16bms16x8: - test byte[scadtng+ebx],dl - jz near drawlineng4b16bmsnt16x8 - drawline16bmacro16x8 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst16x8,procpixelstmst16x8,procpixelsmst16x8b,procpixelstmst16x8b -drawlineng4b16bmsnt16x8 - drawline16bmacro16x8 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt16x8,procpixelstmsnt16x8,procpixelsmsnt16x8b,procpixelstmsnt16x8b - -NEWSYM drawlineng16x82b16b - determinetransp drawlineng2b16bt16x8 -drawlineng2b16bnt16x8 - drawline16bmacro16x8 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixels16x8,procpixelst16x8,procpixels16x8b,procpixelst16x8b -drawlineng2b16bt16x8 - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng2b16bms16x8 - test byte[scadtng+ebx],dl - jz near drawlineng2b16bnt16x8 - drawline16bmacro16x8 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelstr16x8,procpixelstt16x8,procpixelstr16x8b,procpixelstt16x8b -drawlineng2b16bms16x8: - test byte[scadtng+ebx],dl - jz near drawlineng2b16bmsnt16x8 - drawline16bmacro16x8 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmst16x8,procpixelstmst16x8,procpixelsmst16x8b,procpixelstmst16x8b -drawlineng2b16bmsnt16x8 - drawline16bmacro16x8 tltype2b,preparet2ba,cachesingle2bng,ngpalcon2b,test2ba,03h,procpixelsmsnt16x8,procpixelstmsnt16x8,procpixelsmsnt16x8b,procpixelstmsnt16x8b - -%macro WinClipMacroom 1 - mov byte[tleftn],33 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne near .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - cmp dword[ebx],8 - jbe near %1 - sub dword[ebx],8 - - mov ebx,[cbgval] - add word[ofsmmptr],2 - inc dword[bg1totng+ebx*4] - add word[ofsmtptr],2 - mov ax,[ofsmmptr] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - add edi,16 - test eax,03Fh - jnz .next - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx -.next - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - mov ecx,[ofsmval] - add dword[ofshvaladd],8 - test dword[ebx],ecx - jz .noofsm2 - mov ebx,[ebx] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz .noupper2 - add ax,[ofsmady] -.noupper2 - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -.noofsm2 - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofsmcptr2],2 - mov ecx,[ofsmvalh] - and dword[ofsmcptr2],3Fh - test dword[ebx-40h],ecx - jz .noofsmh - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz .noleft - add ax,[ofsmadx] -.noleft - and ebx,0F8h - shr ebx,2 - add ax,bx -.noofsmh - - dec byte[tleftn] - jnz near .winclipped - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %1 - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline -%endmacro - -%macro drawline16bmacroom 8 - mov byte[tleftn],33 -%%loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near %%finline - drawlinengom16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8 - ret -%endmacro - -%macro drawline16bwmacroom 9 - WinClipMacroom %%processwinclip2b - drawlinengom16b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawlinengomwin16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%9 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -%macro drawline16bw2macroom 11 - mov byte[tleftn],33 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne near .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %%processwinclip2b - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finlineb - drawlinengom16b %1,%2,%3,.winclipped,.finlineb,%4,%5,%6,%10,%11 -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %%processwinclip2b - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlinengom16b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawlinengomwin16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%9 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -NEWSYM drawlinengom4b16b - determinetransp drawlineng4b16btom -drawlineng4b16bntom - CheckWindowing drawlineng4bwinom - drawline16bmacroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixels,procpixelst -drawlineng4bwinom: - drawline16bwmacroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixels,procpixelst,procpixelstw -drawlineng4b16btom - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng4b16bmsom - test byte[scadtng+ebx],dl - jz near drawlineng4b16bntom - CheckWindowing drawlineng4bwintom - drawline16bmacroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelstr,procpixelstt -drawlineng4bwintom: - drawline16bwmacroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelstr,procpixelstt,procpixelstwt -drawlineng4b16bmsom: - test byte[scadtng+ebx],dl - jz near drawlineng4b16bmsntom - DetermineWindow drawlineng4b16bmstmswom, drawlineng4b16bmstmwom, drawlineng4b16bmstswom - drawline16bmacroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst -drawlineng4b16bmstmswom: - drawline16bwmacroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst,procpixelstwmst -drawlineng4b16bmstmwom: - drawline16bw2macroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst,procpixelstwsmt,procpixelss,procpixelsts -drawlineng4b16bmstswom: - drawline16bw2macroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst,procpixelstwmsbt,procpixelstr,procpixelstt -drawlineng4b16bmsntom - DetermineWindow drawlineng4b16bmsntmswom, drawlineng4b16bmsntmwom, drawlineng4b16bmsntswom - drawline16bmacroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt -drawlineng4b16bmsntmswom: - drawline16bwmacroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsnt -drawlineng4b16bmsntmwom: - drawline16bw2macroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt,procpixelstwsmnt,procpixelss,procpixelsts -drawlineng4b16bmsntswom: - drawline16bw2macroom tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt,procpixelstwmsbnt,procpixelsnt,procpixelstnt - -%macro drawline16bmacroom16x16 8 - mov byte[tleftn],17 -%%loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near %%finline - drawlinengom16b16x16 %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8 - ret -%endmacro - -%macro drawline16bwmacroom16x16 9 - WinClipMacro16x16 %%processwinclip2b - drawlinengom16b16x16 %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawlinengomwin16b16x16 %1,%2,%3,%%loop,%%finline,%4,%5,%6,%9 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -%macro drawline16bw2macroom16x16 11 - mov byte[tleftn],17 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne near .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %%processwinclip2b - sub dword[ebx],16 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finlineb - drawlinengom16b16x16 %1,%2,%3,.winclipped,.finlineb,%4,%5,%6,%10,%11 -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %%processwinclip2b - sub dword[ebx],16 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlinengom16b16x16 %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8 -%%processwinclip2b - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near %%finline - drawlinengomwin16b16x16 %1,%2,%3,%%loop,%%finline,%4,%5,%6,%9 -%%loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near .winclipped - jmp .loop -%endmacro - -NEWSYM drawlinengom16x164b16b - determinetransp drawlineng4b16btom16x16 -drawlineng4b16bntom16x16 - drawline16bmacroom16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixels,procpixelst -drawlineng4b16btom16x16 - test byte[BGMS1+ebx*2+1],dl - jnz near drawlineng4b16bmsom16x16 - test byte[scadtng+ebx],dl - jz near drawlineng4b16bntom16x16 - drawline16bmacroom16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelstr,procpixelstt -drawlineng4b16bmsom16x16: - test byte[scadtng+ebx],dl - jz near drawlineng4b16bmsntom16x16 - drawline16bmacroom16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmst,procpixelstmst -drawlineng4b16bmsntom16x16 - drawline16bmacroom16x16 tltype4b,preparet4ba,cachesingle4bng,ngpalcon4b,test4ba,0Fh,procpixelsmsnt,procpixelstmsnt diff --git a/tools/zsnes/src/video/newg162.mac b/tools/zsnes/src/video/newg162.mac deleted file mode 100644 index a0030dd..0000000 --- a/tools/zsnes/src/video/newg162.mac +++ /dev/null @@ -1,889 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -; Finish up parttile - -%macro procpixels16x8 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2] - mov [edi+%3+75036*4],bx - mov bx,[eax+ecx*2] - mov [edi+%3],bx - xor ebx,ebx -%endmacro - -%macro procpixelst16x8 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx -%%nodraw -%endmacro - -%macro procpixelstr16x8 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2+512] - mov [edi+%3+75036*4],bx - mov bx,[eax+ecx*2+512] - mov [edi+%3],bx - xor ebx,ebx -%endmacro - -%macro procpixelstt16x8 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2+512] - mov [edi+%2],cx -%%nodraw -%endmacro - -%macro procpixelsmst16x8 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2+512] - mov [edi+%3+75036*4],bx - and ebx,[UnusedBitXor] - mov [edi+%3+75036*6],bx - mov bx,[eax+ecx*2+512] - mov [edi+%3],bx - and ebx,[UnusedBitXor] - mov [edi+%3+75036*2],bx - xor ebx,ebx -%endmacro - -%macro procpixelstmst16x8 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2+512] - mov [edi+%2],cx - and cx,[UnusedBitXor] - mov [edi+%2+75036*2],cx -%%nodraw -%endmacro - -%macro procpixelsmsnt16x8 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2] - mov [edi+%3+75036*4],bx - mov [edi+%3+75036*6],bx - mov bx,[eax+ecx*2] - mov [edi+%3],bx - mov [edi+%3+75036*2],bx - xor ebx,ebx -%endmacro - -%macro procpixelstmsnt16x8 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx - mov [edi+%2+75036*2],cx -%%nodraw -%endmacro - -%macro procpixels16x8b 3 - mov bl,[esi+%2] - add bl,dl - mov cx,[eax+ebx*2] - mov [edi+%3],cx -%endmacro - -%macro procpixelst16x8b 3 - %if %2<8 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx -%%nodraw - %endif -%endmacro - -%macro procpixelstr16x8b 3 - mov bl,[esi+%2] - add bl,dl - mov cx,[eax+ebx*2+512] - mov [edi+%3],cx -%endmacro - -%macro procpixelstt16x8b 3 - %if %2<8 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2+512] - mov [edi+%2],cx -%%nodraw - %endif -%endmacro - -%macro procpixelsmst16x8b 3 - mov bl,[esi+%2] - add bl,dl - mov cx,[eax+ebx*2+512] - mov [edi+%3],cx - and ecx,[UnusedBitXor] - mov [edi+%3+75036*2],cx -%endmacro - -%macro procpixelstmst16x8b 3 - %if %2<8 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2+512] - mov [edi+%2],cx - and cx,[UnusedBitXor] - mov [edi+%2+75036*2],cx -%%nodraw - %endif -%endmacro - -%macro procpixelsmsnt16x8b 3 - mov bl,[esi+%2] - add bl,dl - mov cx,[eax+ebx*2] - mov [edi+%3],cx - mov [edi+%3+75036*2],cx -%endmacro - -%macro procpixelstmsnt16x8b 3 - %if %2<8 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx - mov [edi+%2+75036*2],cx -%%nodraw - %endif -%endmacro - -%macro drawlineng16x816b 10 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[cbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %%done - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jz %%notflipyfull - add ecx,[flipyposng] - jmp %%yesflipyfull -%%notflipyfull - add ecx,[yposng] -%%yesflipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 0,1,0 - %9 2,3,2 - %9 4,5,4 - %9 6,7,6 - pop eax - jmp %%done -%%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 7,6,0 - %9 5,4,2 - %9 3,2,4 - %9 1,0,6 - pop eax - jmp %%done -%%parttile - %2 - ; start drawing from ecx to edi - test dword[vrama+eax],8000h - jz %%notflipypart - add ecx,[flipyposng] - jmp %%yesflipypart -%%notflipypart - add ecx,[yposng] -%%yesflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 0,0,%8 - %10 1,0+75036*4,%8 - %10 2,2,%8 - %10 3,2+75036*4,%8 - %10 4,4,%8 - %10 5,4+75036*4,%8 - %10 6,6,%8 - %10 7,6+75036*4,%8 - pop eax - jmp %%done -%%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 7,0,%8 - %10 6,0+75036*4,%8 - %10 5,2,%8 - %10 4,2+75036*4,%8 - %10 3,4,%8 - %10 2,4+75036*4,%8 - %10 1,6,%8 - %10 0,6+75036*4,%8 - pop eax -%%done - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,8 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[cbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%5 - add edi,16 - jmp %%ntile -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawlinengom216b 9 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov dl,ch - inc dword[bg1drwng+%9*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jz %%notflipyfull - add ecx,[flipyposng] - jmp %%yesflipyfull -%%notflipyfull - add ecx,[yposng] -%%yesflipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - procpixels 0,1,0 - procpixels 2,3,4 - procpixels 4,5,8 - procpixels 6,7,12 - pop eax - jmp %5 -%%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - procpixels 7,6,0 - procpixels 5,4,4 - procpixels 3,2,8 - procpixels 1,0,12 - pop eax - jmp %5 -%%parttile - %2 - ; start drawing from ecx to edi - test dword[vrama+eax],8000h - jz %%notflipypart - add ecx,[flipyposng] - jmp %%yesflipypart -%%notflipypart - add ecx,[yposng] -%%yesflipypart - - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - procpixelst 0,0,%8 - procpixelst 1,2,%8 - procpixelst 2,4,%8 - procpixelst 3,6,%8 - procpixelst 4,8,%8 - procpixelst 5,10,%8 - procpixelst 6,12,%8 - procpixelst 7,14,%8 - pop eax - jmp %5 - -%%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - procpixelst 7,0,%8 - procpixelst 6,2,%8 - procpixelst 5,4,%8 - procpixelst 4,6,%8 - procpixelst 3,8,%8 - procpixelst 2,10,%8 - procpixelst 1,12,%8 - procpixelst 0,14,%8 - pop eax -%5 - inc dword[bg1totng+%9*4] - add word[ofsmmptr],2 - add word[ofsmtptr],2 - - mov ax,[ofsmmptr] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - add edi,16 - test eax,03Fh - jz near %%tileadd -%%next - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofshvaladd],8 - test dword[ebx-40h],8000h - jz near %%noofsm - test dword[ebx-40h],2000h << %9 - jz %%noofsm - mov ebx,[ebx-40h] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz %%noupper - add ax,[ofsmady] -%%noupper - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -%%noofsm - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofsmcptr2],2 - and dword[ofsmcptr2],3Fh - test dword[ofsmcptr2],3Fh - jnz %%notzeroed - mov bx,[bgtxadd2] - add word[ofsmcptr],bx -%%notzeroed - test dword[ebx-40h],8000h - jnz near %%noofsmh - test dword[ebx-40h],2000h << %9 - jz %%noofsmh - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz %%noleft - add ax,[ofsmadx] -%%noleft - and ebx,0F8h - shr ebx,2 - add ax,bx -%%noofsmh - dec byte[tleftn] - jnz near %4 -%%fin - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx - jmp %%next -%endmacro - -%macro drawlinengom16b 10 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[cbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jz %%notflipyfull - add ecx,[flipyposng] - jmp %%yesflipyfull -%%notflipyfull - add ecx,[yposng] -%%yesflipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 0,1,0 - %9 2,3,4 - %9 4,5,8 - %9 6,7,12 - pop eax - jmp %5 -%%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 7,6,0 - %9 5,4,4 - %9 3,2,8 - %9 1,0,12 - pop eax - jmp %5 -%%parttile - %2 - ; start drawing from ecx to edi - test dword[vrama+eax],8000h - jz %%notflipypart - add ecx,[flipyposng] - jmp %%yesflipypart -%%notflipypart - add ecx,[yposng] -%%yesflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 0,0,%8 - %10 1,2,%8 - %10 2,4,%8 - %10 3,6,%8 - %10 4,8,%8 - %10 5,10,%8 - %10 6,12,%8 - %10 7,14,%8 - pop eax - jmp %5 -%%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 7,0,%8 - %10 6,2,%8 - %10 5,4,%8 - %10 4,6,%8 - %10 3,8,%8 - %10 2,10,%8 - %10 1,12,%8 - %10 0,14,%8 - pop eax -%5 - mov ebx,[cbgval] - add word[ofsmmptr],2 - inc dword[bg1totng+ebx*4] - add word[ofsmtptr],2 - mov ax,[ofsmmptr] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - add edi,16 - test eax,03Fh - jz near %%tileadd -%%next - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - mov ecx,[ofsmval] - add dword[ofshvaladd],8 - test dword[ebx],ecx - jz %%noofsm - mov ebx,[ebx] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz %%noupper - add ax,[ofsmady] -%%noupper - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -%%noofsm - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofsmcptr2],2 - mov ecx,[ofsmvalh] - and dword[ofsmcptr2],3Fh - test dword[ofsmcptr2],3Fh - jnz %%notzeroed - mov bx,[bgtxadd2] - add word[ofsmcptr],bx -%%notzeroed - test dword[ebx-40h],ecx - jz %%noofsmh - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz %%noleft - add ax,[ofsmadx] -%%noleft - and ebx,0F8h - shr ebx,2 - add ax,bx -%%noofsmh - dec byte[tleftn] - jnz near %4 -%%fin - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx - jmp %%next -%endmacro - -%macro drawlinengom16b16x16 10 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx - test byte[switch16x16],1 - jz %%noflipxb - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %%done - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test word[vrama+eax],8000h - jz %%noflipyfull - add ecx,[flipyposng] - jmp %%yesflipyfull -%%noflipyfull - add ecx,[yposng] -%%yesflipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 0,1,0 - %9 2,3,4 - %9 4,5,8 - %9 6,7,12 - pop eax - jmp %%done -%%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 7,6,0 - %9 5,4,4 - %9 3,2,8 - %9 1,0,12 - pop eax - jmp %%done -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jz %%noflipypart - add ecx,[flipyposng] - jmp %%yesflipypart -%%noflipypart - add ecx,[yposng] -%%yesflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 0,0,%8 - %10 1,2,%8 - %10 2,4,%8 - %10 3,6,%8 - %10 4,8,%8 - %10 5,10,%8 - %10 6,12,%8 - %10 7,14,%8 - pop eax - jmp %%done -%%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 7,0,%8 - %10 6,2,%8 - %10 5,4,%8 - %10 4,6,%8 - %10 3,8,%8 - %10 2,10,%8 - %10 1,12,%8 - %10 0,14,%8 - pop eax -%%done - pop edx - pop ecx - - test byte[switch16x16],1 - jz %%nextb - add word[ofsmmptr],2 - add word[ofsmtptr],2 - mov ax,[ofsmmptr] - test eax,03Fh - jz near %%tileaddb -%%nextb - - mov ebx,[cbgval] - inc dword[bg1totng+ebx*4] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - mov ecx,[ofsmval] - add dword[ofshvaladd],8 - test dword[ebx],ecx - jz %%noofsm - - mov ebx,[ebx] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,200h - jz %%noupper - add ax,[ofsmady] -%%noupper - and ebx,01FFh - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ebx,8 - jz %%noflipy16x16 - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -%%noflipy16x16 - mov edx,ebx - shr ebx,4 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -%%noofsm - add dword[ofsmcptr2],2 - and dword[ofsmcptr2],3Fh - test dword[ofsmcptr2],3Fh - jnz %%notzeroed - mov bx,[bgtxadd2] - add word[ofsmcptr],bx -%%notzeroed - - add edi,16 - xor dword[switch16x16],1 - jnz near %4 -%%ntile - mov ebx,[ng16bbgval] -; add ax,2 - inc dword[bg1totng+ebx*4] -; test eax,03Fh -; jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%5 - add edi,32 - jmp %%ntile -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%%tileaddb - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx - jmp %%nextb -%endmacro diff --git a/tools/zsnes/src/video/newg16wn.mac b/tools/zsnes/src/video/newg16wn.mac deleted file mode 100644 index 523d7a2..0000000 --- a/tools/zsnes/src/video/newg16wn.mac +++ /dev/null @@ -1,1188 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 procpixelstw 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - cmp dword[ngcwinmode],1 - je %%nodraw - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx -%%nodraw -%endmacro - -%macro procpixelstwt 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - cmp dword[ngcwinmode],1 - je %%nodraw - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2+512] - mov [edi+%2],cx -%%nodraw -%endmacro - -%macro procpixelstwnt 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - cmp dword[ngcwinmode],1 - je %%nodraw - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx -%%nodraw -%endmacro - -%macro procpixelstwmst 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - cmp dword[ngcwinmode],1 - je %%nodraw - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2+512] - mov [edi+%2],cx - and cx,[UnusedBitXor] - mov [edi+75036*2+%2],cx -%%nodraw -%endmacro - -%macro procpixelstwmsnt 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - cmp dword[ngcwinmode],1 - je %%nodraw - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx - mov [edi+75036*2+%2],cx -%%nodraw -%endmacro - -%macro procpixelstwmsbt 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2+512] - mov [edi+%2],cx - cmp dword[ngcwinmode],1 - je %%nodraw - and cx,[UnusedBitXor] - mov [edi+75036*2+%2],cx -%%nodraw -%endmacro - -%macro procpixelstwmsbnt 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx - cmp dword[ngcwinmode],1 - je %%nodraw - mov [edi+75036*2+%2],cx -%%nodraw -%endmacro - -%macro procpixelstwsmt 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+75036*2+%2],cx - cmp dword[ngcwinmode],1 - je %%nodraw - or cx,[UnusedBit] - mov [edi+%2],cx -%%nodraw -%endmacro - -%macro procpixelstwsmnt 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+75036*2+%2],cx - cmp dword[ngcwinmode],1 - je %%nodraw - mov [edi+%2],cx -%%nodraw -%endmacro - -SECTION .text - -Nextwinmode: - push ebx - mov ebx,[ngcwinptr] - xor dword[ngcwinmode],1 - mov ebx,[ebx+4] - add dword[ngcwinptr],4 - mov [ngcpixleft],ebx - pop ebx - ret - -%macro processnextdrawwin 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - cmp dword[ngcwinmode],1 - je %%nodraw - test %1,%3 - jz %%nodraw - mov [edi+%2],%1 -%%nodraw -%endmacro - -%macro processwinpixel 0 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - dec dword[ngcpixleft] - jnz %%notzero2 - call Nextwinmode -%%notzero2 -%endmacro - -%macro drawlinengwin16b 9 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jz %%noflipypart - add ecx,[flipyposng] - jmp %%flipypart -%%noflipypart - add ecx,[yposng] -%%flipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - xor ebx,ebx - mov esi,ecx - mov eax,[CPalPtrng] - %9 0,0,%8 - %9 1,2,%8 - %9 2,4,%8 - %9 3,6,%8 - %9 4,8,%8 - %9 5,10,%8 - %9 6,12,%8 - %9 7,14,%8 - pop eax - jmp .fin -%%flipxpart - push eax - xor ebx,ebx - mov esi,ecx - mov eax,[CPalPtrng] - %9 7,0,%8 - %9 6,2,%8 - %9 5,4,%8 - %9 4,6,%8 - %9 3,8,%8 - %9 2,10,%8 - %9 1,12,%8 - %9 0,14,%8 - pop eax - jmp .fin -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel -.fin - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - add edi,16 - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawlineng16x16win16b 9 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz %%flipypart - add ecx,[yposng] - jmp %%noflipypart -%%flipypart - add ecx,[flipyposng] -%%noflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - xor ebx,ebx - mov esi,ecx - mov eax,[CPalPtrng] - %9 0,0,%8 - %9 1,2,%8 - %9 2,4,%8 - %9 3,6,%8 - %9 4,8,%8 - %9 5,10,%8 - %9 6,12,%8 - %9 7,14,%8 - pop eax - jmp %%done -%%flipxpart - push eax - xor ebx,ebx - mov esi,ecx - mov eax,[CPalPtrng] - %9 7,0,%8 - %9 6,2,%8 - %9 5,4,%8 - %9 4,6,%8 - %9 3,8,%8 - %9 2,10,%8 - %9 1,12,%8 - %9 0,14,%8 - pop eax -%%done - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,16 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz near %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - add edi,32 - jmp %%ntile -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawlinengomwin16b 9 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[cbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - add ecx,[yposng] - jmp %%notflipypart -%%flipypart - add ecx,[flipyposng] -%%notflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - xor ebx,ebx - mov esi,ecx - mov eax,[CPalPtrng] - %9 0,0,%8 - %9 1,2,%8 - %9 2,4,%8 - %9 3,6,%8 - %9 4,8,%8 - %9 5,10,%8 - %9 6,12,%8 - %9 7,14,%8 - pop eax - jmp %%endokay -%%flipxpart - push eax - xor ebx,ebx - mov esi,ecx - mov eax,[CPalPtrng] - %9 7,0,%8 - %9 6,2,%8 - %9 5,4,%8 - %9 4,6,%8 - %9 3,8,%8 - %9 2,10,%8 - %9 1,12,%8 - %9 0,14,%8 - pop eax - jmp %%endokay -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel -%%endokay - mov ebx,[cbgval] - add word[ofsmmptr],2 - inc dword[bg1totng+ebx*4] - add word[ofsmtptr],2 - mov ax,[ofsmmptr] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - add edi,16 - test eax,03Fh - jz near %%tileadd -%%next - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - mov ecx,[ofsmval] - add dword[ofshvaladd],8 - test dword[ebx],ecx - jz %%noofsm - mov ebx,[ebx] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz %%noupper - add ax,[ofsmady] -%%noupper - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -%%noofsm - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofsmcptr2],2 - mov ecx,[ofsmval] - and dword[ofsmcptr2],3Fh - test dword[ebx-40h],ecx - jz %%noofsmh - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz %%noleft - add ax,[ofsmadx] -%%noleft - and ebx,0F8h - shr ebx,2 - add ax,bx -%%noofsmh - dec byte[tleftn] - jnz near %4 -%%fin - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx - jmp %%next -%endmacro - -%macro parttilewin 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bl,[ecx+%1*8] - or bl,bl - jz %%nodraw - add bl,dl - mov [edi+%2*288*2],bl -%%nodraw -%endmacro - -%macro tilenormalw 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwb 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - cmp bx,0FFFFh - je %%nodraw - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwt 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - or bx,[UnusedBit] - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwbt 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - cmp bx,0FFFFh - je %%nodraw - or bx,[UnusedBit] - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwnt 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwbnt 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - cmp bx,0FFFFh - je %%nodraw - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwmst 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - mov [edi+%1+75036*2],bx - or bx,[UnusedBit] - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwbmst 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - cmp bx,0FFFFh - je %%nodraw - mov [edi+%1+75036*2],bx - or bx,[UnusedBit] - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwmsnt 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - mov [edi+%1+75036*2],bx - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwbmsnt 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bx,[ecx+%2] - cmp bx,0FFFFh - je %%nodraw - mov [edi+%1+75036*2],bx - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwmsbt 2 - mov bx,[ecx+%2] - or bx,[UnusedBit] - mov [edi+%1],bx - cmp dword[ngcwinmode],1 - je %%nodraw - and bx,[UnusedBitXor] - mov [edi+%1+75036*2],bx -%%nodraw -%endmacro - -%macro tilenormalwbmsbt 2 - mov bx,[ecx+%2] - cmp bx,0FFFFh - je %%nodraw - or bx,[UnusedBit] - mov [edi+%1],bx - cmp dword[ngcwinmode],1 - je %%nodraw - and bx,[UnusedBitXor] - mov [edi+%1+75036*2],bx -%%nodraw -%endmacro - -%macro tilenormalwmsbnt 2 - mov bx,[ecx+%2] - mov [edi+%1],bx - cmp dword[ngcwinmode],1 - je %%nodraw - mov [edi+%1+75036*2],bx -%%nodraw -%endmacro - -%macro tilenormalwbmsbnt 2 - cmp bx,0FFFFh - je %%nodraw - mov bx,[ecx+%2] - mov [edi+%1],bx - cmp dword[ngcwinmode],1 - je %%nodraw - mov [edi+%1+75036*2],bx -%%nodraw -%endmacro - -%macro tilenormalwsmt 2 - mov bx,[ecx+%2] - mov [edi+%1+75036*2],bx - cmp dword[ngcwinmode],1 - je %%nodraw - or bx,[UnusedBit] - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwbsmt 2 - mov bx,[ecx+%2] - cmp bx,0FFFFh - je %%nodraw - mov [edi+%1+75036*2],bx - cmp dword[ngcwinmode],1 - je %%nodraw - or bx,[UnusedBit] - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwsmnt 2 - mov bx,[ecx+%2] - mov [edi+%1+75036*2],bx - cmp dword[ngcwinmode],1 - je %%nodraw - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro tilenormalwbsmnt 2 - mov bx,[ecx+%2] - cmp bx,0FFFFh - je %%nodraw - mov [edi+%1+75036*2],bx - cmp dword[ngcwinmode],1 - je %%nodraw - mov [edi+%1],bx -%%nodraw -%endmacro - -%macro drawtilengwin16b 12 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache - cmp byte[%9+ecx],dl - je %%returnfromcache - mov [%9+ecx],dl - call %10 -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],4000h - jz %%notflipxfull - add ecx,128 -%%notflipxfull - test dword[vrama+eax],8000h - jnz near %%flipyfull - mov dword[tleftnb],8 -%%loopfa - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - %11 0,0 - %11 288*2,16 - %11 288*4,16*2 - %11 288*6,16*3 - %11 288*8,16*4 - %11 288*10,16*5 - %11 288*12,16*6 - %11 288*14,16*7 - add ecx,2 - add edi,2 - dec dword[tleftnb] - jnz near %%loopfa - sub edi,16 - jmp %%end -%%flipyfull - mov dword[tleftnb],8 -%%loopfc - dec dword[ngcpixleft] - jnz %%notzeroc - call Nextwinmode -%%notzeroc - %11 0,16*7 - %11 288*2,16*6 - %11 288*4,16*5 - %11 288*6,16*4 - %11 288*8,16*3 - %11 288*10,16*2 - %11 288*12,16*1 - %11 288*14,0 - add ecx,2 - add edi,2 - dec dword[tleftnb] - jnz near %%loopfc - sub edi,16 - jmp %%end -%%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],4000h - jz %%notflipxpart - add ecx,128 -%%notflipxpart - test dword[vrama+eax],8000h - jnz near %%flipyfullp - mov dword[tleftnb],8 -%%loopfap - dec dword[ngcpixleft] - jnz %%notzerop - call Nextwinmode -%%notzerop - %12 0,0 - %12 288*2,16 - %12 288*4,16*2 - %12 288*6,16*3 - %12 288*8,16*4 - %12 288*10,16*5 - %12 288*12,16*6 - %12 288*14,16*7 - add ecx,2 - add edi,2 - dec dword[tleftnb] - jnz near %%loopfap - sub edi,16 - jmp %%end -%%flipyfullp - mov dword[tleftnb],8 -%%loopfcp - dec dword[ngcpixleft] - jnz %%notzerocp - call Nextwinmode -%%notzerocp - %12 0,16*7 - %12 288*2,16*6 - %12 288*4,16*5 - %12 288*6,16*4 - %12 288*8,16*3 - %12 288*10,16*2 - %12 288*12,16*1 - %12 288*14,0 - add ecx,2 - add edi,2 - dec dword[tleftnb] - jnz near %%loopfcp - sub edi,16 - jmp %%end -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel -%%end - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - add edi,16 - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - ret -%%docache - call %3 - mov [%9+ecx],dl - call %10 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawtileng16x16win16b 12 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache - cmp byte[%9+ecx],dl - je %%returnfromcache - mov [%9+ecx],dl - call %10 -%%returnfromcache - cmp byte[%1+ecx],2 - je near %%skip - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],4000h - jz %%notflipxfull - add ecx,128 -%%notflipxfull - test dword[vrama+eax],8000h - jnz near %%flipyfull - mov dword[tleftnb],8 -%%loopfa - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - %11 0,0 - %11 288*2,16 - %11 288*4,16*2 - %11 288*6,16*3 - %11 288*8,16*4 - %11 288*10,16*5 - %11 288*12,16*6 - %11 288*14,16*7 - add ecx,2 - add edi,2 - dec dword[tleftnb] - jnz near %%loopfa - sub edi,16 - jmp %%end -%%flipyfull - mov dword[tleftnb],8 -%%loopfc - dec dword[ngcpixleft] - jnz %%notzeroc - call Nextwinmode -%%notzeroc - %11 0,16*7 - %11 288*2,16*6 - %11 288*4,16*5 - %11 288*6,16*4 - %11 288*8,16*3 - %11 288*10,16*2 - %11 288*12,16*1 - %11 288*14,0 - add ecx,2 - add edi,2 - dec dword[tleftnb] - jnz near %%loopfc - sub edi,16 - jmp %%end -%%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],4000h - jz %%notflipxpart - add ecx,128 -%%notflipxpart - test dword[vrama+eax],8000h - jnz near %%flipyfullp - mov dword[tleftnb],8 -%%loopfap - dec dword[ngcpixleft] - jnz %%notzerop - call Nextwinmode -%%notzerop - %12 0,0 - %12 288*2,16 - %12 288*4,16*2 - %12 288*6,16*3 - %12 288*8,16*4 - %12 288*10,16*5 - %12 288*12,16*6 - %12 288*14,16*7 - add ecx,2 - add edi,2 - dec dword[tleftnb] - jnz near %%loopfap - sub edi,16 - jmp %%end -%%flipyfullp - mov dword[tleftnb],8 -%%loopfcp - dec dword[ngcpixleft] - jnz %%notzerocp - call Nextwinmode -%%notzerocp - %12 0,16*7 - %12 288*2,16*6 - %12 288*4,16*5 - %12 288*6,16*4 - %12 288*8,16*3 - %12 288*10,16*2 - %12 288*12,16*1 - %12 288*14,0 - add ecx,2 - add edi,2 - dec dword[tleftnb] - jnz near %%loopfcp - sub edi,16 - jmp %%end -%%skip - processwinpixel - processwinpixel - processwinpixel - processwinpixel -%%end - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,16 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz near %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - ret -%%done -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - add edi,32 - jmp %%ntile -%%docache - call %3 - mov [%9+ecx],dl - call %10 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawlinengomwin16b16x16 9 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[cbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - jmp %%endokay - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - add ecx,[yposng] - jmp %%notflipypart -%%flipypart - add ecx,[flipyposng] -%%notflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - xor ebx,ebx - mov esi,ecx - mov eax,[CPalPtrng] - %9 0,0,%8 - %9 1,2,%8 - %9 2,4,%8 - %9 3,6,%8 - %9 4,8,%8 - %9 5,10,%8 - %9 6,12,%8 - %9 7,14,%8 - pop eax - jmp %%endokay -%%flipxpart - push eax - xor ebx,ebx - mov esi,ecx - mov eax,[CPalPtrng] - %9 7,0,%8 - %9 6,2,%8 - %9 5,4,%8 - %9 4,6,%8 - %9 3,8,%8 - %9 2,10,%8 - %9 1,12,%8 - %9 0,14,%8 - pop eax - jmp %%endokay -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel -%%endokay - mov ebx,[cbgval] - add word[ofsmmptr],2 - inc dword[bg1totng+ebx*4] - add word[ofsmtptr],2 - mov ax,[ofsmmptr] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - add edi,16 - test eax,03Fh - jz near %%tileadd -%%next - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - mov ecx,[ofsmval] - add dword[ofshvaladd],8 - test dword[ebx],ecx - jz %%noofsm - mov ebx,[ebx] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz %%noupper - add ax,[ofsmady] -%%noupper - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -%%noofsm - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofsmcptr2],2 - mov ecx,[ofsmval] - and dword[ofsmcptr2],3Fh - test dword[ebx-40h],ecx - jz %%noofsmh - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz %%noleft - add ax,[ofsmadx] -%%noleft - and ebx,0F8h - shr ebx,2 - add ax,bx -%%noofsmh - dec byte[tleftn] - jnz near %4 -%%fin - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx - jmp %%next -%endmacro diff --git a/tools/zsnes/src/video/newgfx.asm b/tools/zsnes/src/video/newgfx.asm deleted file mode 100644 index d7205a9..0000000 --- a/tools/zsnes/src/video/newgfx.asm +++ /dev/null @@ -1,2348 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 BG116x16t,BG1SXl,BG1SYl,BG216x16t,BG2SXl,BG2SYl,BG316x16t,BG3PRI,BG3SXl -EXTSYM BG3SYl,BG416x16t,BG4SXl,BG4SYl,BGFB,BGMA,BGMS1,BGOPT1,BGOPT2,BGOPT3 -EXTSYM BGOPT4,BGPT1,BGPT1X,BGPT1Y,BGPT2,BGPT2X,BGPT2Y,BGPT3,BGPT3X,BGPT3Y,BGPT4 -EXTSYM BGPT4X,BGPT4Y,StartDrawNewGfx16b,bg1objptr,bg1ptr,bg1ptrx,bg1ptry -EXTSYM bg1scrolx,bg1scroly,bg2objptr,bg2ptr,bg2ptrx,bg2ptry,bg2scrolx,bg2scroly -EXTSYM bg3highst,bg3objptr,bg3ptr,bg3ptrx,bg3ptry,bg3scrolx,bg3scroly,bg4objptr -EXTSYM bg4ptr,bg4ptrx,bg4ptry,bg4scrolx,bg4scroly,bgmode,bgtxad,cachesingle2bng -EXTSYM cachesingle8bng,cbitmode,cfield,colormodedef,csprbit,curmosaicsz -EXTSYM curvidoffset,curypos,forceblnk,interlval,intrlng,mode7A,m7starty -EXTSYM mode7C,mode7X0,mode7ab,mode7cd,mode7set,mode7st,mode7xy,mosaicon,mosaicsz -EXTSYM mosenng,mosszng,ngceax,ngcedi,ngpalcon2b,ngpalcon8b,ngptrdat,prdata -EXTSYM prdatb,prdatc,res640,resolutn,scrndis,scrnon,spritetablea,sprleftpr -EXTSYM sprlefttot,sprpriodata,sprtbng,sprtlng,t16x161,t16x162,t16x163,t16x164 -EXTSYM tltype2b,tltype8b,vcache2b,vcache8b,vidbuffer,vidmemch2,ngptrdat2 -EXTSYM vidmemch8,vram,vrama,winon,xtravbuf,ng16bbgval,ng16bprval,ofshvaladd -EXTSYM bgwinchange,res480,drawtileng2b,drawtileng4b,drawtileng8b,drawmode7win -EXTSYM drawtileng16x162b,drawtileng16x164b,drawtileng16x168b -EXTSYM osm2dis,drawlineng2b,drawlineng4b,drawlineng8b,processmode7hires -EXTSYM drawlineng16x162b,drawlineng16x164b,drawlineng16x168b,winboundary -EXTSYM winbg1enval,winbg2enval,winbg3enval,winbg4enval,winbgobjenval -EXTSYM winlogicaval,disableeffects,winenabs,scanlines,winl1,winbg1en,winobjen -EXTSYM winlogica,winenabm,bgallchange,bg1change,bg2change,bg3change,bg4change -EXTSYM hiresstuff,drawlineng16x84b,drawlineng16x82b,drawlinengom4b,WindowRedraw -EXTSYM winlogicb,ngwinptr,objwlrpos,objwen,objclineptr,CSprWinPtr -EXTSYM ofsmtptrs,ofsmcptr2,drawmode7ngextbg,drawmode7ngextbg2 - -%include "video/vidmacro.mac" -%include "video/newgfx2.mac" -%include "video/newgfx.mac" - -; vidbufferofsmos pointer to mosaic buffer - -%macro WinBGCheck 1 - mov bl,[winbg1en+%1] - test bl,0Ah - jz %%disable - test byte[scrnon],1 << %1 - jnz %%nbgen - test byte[winenabs],1 << %1 - jnz %%bg - jmp %%disable -%%nbgen - test byte[winenabm],1 << %1 - jnz %%bg -%%disable - xor bl,bl - jmp %%skip -%%bg - mov cl,bl - and cl,0Ah - cmp cl,0Ah - je %%skip -; jne %%notskip -; and bl,03h -; and cl,03h -;%%notskip - mov ch,bl - mov edx,[winl1] - cmp cl,02h - je %%bg1 - shr ch,2 - shr edx,16 -%%bg1 - test ch,01h - jnz %%outside - cmp dl,dh - jbe %%skip - xor bl,bl - jmp %%skip -%%outside - cmp dl,0 - ja %%skip - cmp dh,255 - jb %%skip - xor bl,bl -%%skip - mov [winbg1enval+eax+%1*256],bl -%endmacro - -SECTION .text - -NEWSYM newengine8b - ; store line by line data - ; BGMode, BGxScrollX, BGxScrollY, both BGPtrs - mov eax,[curypos] - and eax,0FFh - - mov byte[bgallchange+eax],0 - mov byte[bg1change+eax],0 - mov byte[bg2change+eax],0 - mov byte[bg3change+eax],0 - mov byte[bg4change+eax],0 - - ; BG3 Priority - mov ebx,[bg3highst] - mov [BG3PRI+eax],ebx - ; Main/Sub Screen - mov ebx,[scrnon] - or [bgcmsung],ebx - mov [BGMS1+eax*2],ebx - cmp [BGMS1+eax*2-2],bx - je .nosbgms1 - mov byte[bgallchange+eax],1 -.nosbgms1 - - ; Scroll Values - mov ebx,[bg1scrolx] - mov [BG1SXl+eax*2],ebx - cmp [BG1SXl+eax*2-2],bx - je .nosbgx1 - mov byte[bg1change+eax],1 -.nosbgx1 - mov ebx,[bg2scrolx] - mov [BG2SXl+eax*2],ebx - cmp [BG2SXl+eax*2-2],bx - je .nosbgx2 - mov byte[bg2change+eax],1 -.nosbgx2 - mov ebx,[bg3scrolx] - mov [BG3SXl+eax*2],ebx - cmp [BG3SXl+eax*2-2],bx - je .nosbgx3 - mov byte[bg3change+eax],1 -.nosbgx3 - mov ebx,[bg4scrolx] - mov [BG4SXl+eax*2],ebx - cmp [BG4SXl+eax*2-2],bx - je .nosbgx4 - mov byte[bg4change+eax],1 -.nosbgx4 - - mov ebx,[bg1scroly] - mov [BG1SYl+eax*2],ebx - cmp [BG1SYl+eax*2-2],bx - je .nosbgy1 - mov byte[bg1change+eax],1 -.nosbgy1 - mov ebx,[bg2scroly] - mov [BG2SYl+eax*2],ebx - cmp [BG2SYl+eax*2-2],bx - je .nosbgy2 - mov byte[bg2change+eax],1 -.nosbgy2 - mov ebx,[bg3scroly] - mov [BG3SYl+eax*2],ebx - cmp [BG3SYl+eax*2-2],bx - je .nosbgy3 - mov byte[bg3change+eax],1 -.nosbgy3 - mov ebx,[bg4scroly] - mov [BG4SYl+eax*2],ebx - cmp [BG4SYl+eax*2-2],bx - je .nosbgy4 - mov byte[bg1change+eax],1 -.nosbgy4 - - ; Background Mode - mov bl,[bgmode] - and ebx,07h - mov [BGMA+eax],bl - cmp bl,4 - je .changedmode4 - cmp [BGMA+eax-1],bl - je .nobgma -.changedmode4 - mov byte[bgallchange+eax],1 -.nobgma - - ; new graphics fix, thanks to TRAC - and ebx,07h - mov byte[modeused+ebx],1 - - ; Pointer to OBJ tile data - mov ebx,[bg1objptr] - mov [BGOPT1+eax*2],ebx - cmp [BGOPT1+eax*2-2],bx - je .nosbgo1 - mov byte[bg1change+eax],1 -.nosbgo1 - mov ebx,[bg2objptr] - mov [BGOPT2+eax*2],ebx - cmp [BGOPT2+eax*2-2],bx - je .nosbgo2 - mov byte[bg2change+eax],1 -.nosbgo2 - mov ebx,[bg3objptr] - mov [BGOPT3+eax*2],ebx - cmp [BGOPT3+eax*2-2],bx - je .nosbgo3 - mov byte[bg3change+eax],1 -.nosbgo3 - mov ebx,[bg4objptr] - mov [BGOPT4+eax*2],ebx - cmp [BGOPT4+eax*2-2],bx - je .nosbgo4 - mov byte[bg4change+eax],1 -.nosbgo4 - - ; Pointer to tile status data - mov ebx,[bg1ptr] - mov [BGPT1+eax*2],ebx - cmp [BGPT1+eax*2-2],bx - je .nosbgp1 - mov byte[bg1change+eax],1 -.nosbgp1 - mov ebx,[bg2ptr] - mov [BGPT2+eax*2],ebx - cmp [BGPT2+eax*2-2],bx - je .nosbgp2 - mov byte[bg2change+eax],1 -.nosbgp2 - mov ebx,[bg3ptr] - mov [BGPT3+eax*2],ebx - cmp [BGPT3+eax*2-2],bx - je .nosbgp3 - mov byte[bg3change+eax],1 -.nosbgp3 - mov ebx,[bg4ptr] - mov [BGPT4+eax*2],ebx - cmp [BGPT4+eax*2-2],bx - je .nosbgp4 - mov byte[bg4change+eax],1 -.nosbgp4 - - mov ebx,[bg1ptrx] - mov [BGPT1X+eax*2],ebx - cmp [BGPT1X+eax*2-2],bx - je .nosbgpx1 - mov byte[bg1change+eax],1 -.nosbgpx1 - mov ebx,[bg2ptrx] - mov [BGPT2X+eax*2],ebx - cmp [BGPT2X+eax*2-2],bx - je .nosbgpx2 - mov byte[bg2change+eax],1 -.nosbgpx2 - mov ebx,[bg3ptrx] - mov [BGPT3X+eax*2],ebx - cmp [BGPT3X+eax*2-2],bx - je .nosbgpx3 - mov byte[bg3change+eax],1 -.nosbgpx3 - mov ebx,[bg4ptrx] - mov [BGPT4X+eax*2],ebx - cmp [BGPT4X+eax*2-2],bx - je .nosbgpx4 - mov byte[bg4change+eax],1 -.nosbgpx4 - - mov ebx,[bg1ptry] - mov [BGPT1Y+eax*2],ebx - cmp [BGPT1Y+eax*2-2],bx - je .nosbgpy1 - mov byte[bg1change+eax],1 -.nosbgpy1 - mov ebx,[bg2ptry] - mov [BGPT2Y+eax*2],ebx - cmp [BGPT2Y+eax*2-2],bx - je .nosbgpy2 - mov byte[bg2change+eax],1 -.nosbgpy2 - mov ebx,[bg3ptry] - mov [BGPT3Y+eax*2],ebx - cmp [BGPT3Y+eax*2-2],bx - je .nosbgpy3 - mov byte[bg3change+eax],1 -.nosbgpy3 - mov ebx,[bg4ptry] - mov [BGPT4Y+eax*2],ebx - cmp [BGPT4Y+eax*2-2],bx - je .nosbgpy4 - mov byte[bg4change+eax],1 -.nosbgpy4 - mov ebx,[forceblnk] - or bl,bl - jne .dontdraw - mov dword[scfbl],0 -.dontdraw - ; Variable size write error fix [TRAC] - mov [BGFB+eax],bl - cmp [BGFB+eax-1],bl - je .nosbgfb - mov byte[bgallchange+eax],1 -.nosbgfb - - mov ebx,[mode7A] - mov [mode7ab+eax*4],ebx - mov ebx,[mode7C] - mov [mode7cd+eax*4],ebx - mov ebx,[mode7X0] - mov [mode7xy+eax*4],ebx - mov ebx,[mode7set] - mov [mode7st+eax],ebx - - ; 16x16 tiles - mov ebx,[BG116x16t] - mov [t16x161+eax],ebx - cmp [t16x161+eax-1],bl - je .not16x161 - mov byte[bg1change+eax],1 -.not16x161 - mov ebx,[BG216x16t] - mov [t16x162+eax],ebx - cmp [t16x162+eax-1],bl - je .not16x162 - mov byte[bg2change+eax],1 -.not16x162 - mov ebx,[BG316x16t] - mov [t16x163+eax],ebx - cmp [t16x163+eax-1],bl - je .not16x163 - mov byte[bg3change+eax],1 -.not16x163 - mov ebx,[BG416x16t] - mov [t16x164+eax],ebx - cmp [t16x164+eax-1],bl - je .not16x164 - mov byte[bg4change+eax],1 -.not16x164 - -; mov byte[mode7hr+eax],0 - cmp byte[bgmode],7 - jne .noextbg -; cmp byte[res640],0 -; je .nomode7512 -; mov byte[mode7hr+eax],1 -;.nomode7512 - test byte[interlval],40h - jz .noextbg - mov byte[ngextbg],1 -.noextbg - - ; mosaic - mov ebx,[mosaicon] - mov [mosenng+eax],ebx - mov ebx,[mosaicsz] - mov [mosszng+eax],ebx - - ; Interlaced - mov ebx,[interlval] - mov [intrlng+eax],ebx - -; Windowing Stuff -;NEWSYM winl1, 0 ; window 1 left position -;NEWSYM winr1, 0 ; window 1 right position -;NEWSYM winl2, 0 ; window 2 left position -;NEWSYM winr2, 0 ; window 2 right position -;NEWSYM winbg1en, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG1 -;NEWSYM winbg2en, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG2 -;NEWSYM winbg3en, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG3 -;NEWSYM winbg4en, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG4 -;NEWSYM winobjen, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on sprites -;NEWSYM wincolen, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on backarea -;NEWSYM winlogica, 0 ; Window logic type for BG1 to 4 -;NEWSYM winlogicb, 0 ; Window logic type for Sprites and Backarea -;NEWSYM winenabm, 0 ; Window logic enable for main screen -;NEWSYM winenabs, 0 ; Window logic enable for sub screen - - mov byte[bgwinchange+eax],0 - cmp byte[disableeffects],1 - je near .finishwin - push ecx - push edx - WinBGCheck 0 - WinBGCheck 1 - WinBGCheck 2 - WinBGCheck 3 - WinBGCheck 4 - - mov ebx,[winlogica] - mov [winlogicaval+eax*2],ebx - cmp [winlogicaval+eax*2-2],bx - je .winnchangedb - mov byte[bgwinchange+eax],1 -.winnchangedb - mov ebx,[winl1] - mov [winboundary+eax*4],ebx - cmp [winboundary+eax*4-4],ebx - je .winnchanged - mov byte[bgwinchange+eax],1 -.winnchanged - - ; generate sprite window - cmp byte[winbg1enval+eax+4*256],0 - je near .skipobjw - - mov ebx,[winl1] - mov dl,[winobjen] - mov dh,[winlogicb] - and dh,03h - ; Same as previous line? - cmp dword[objwlrpos+eax*4-4],0FFFFFFFFh - je .changed - cmp [objwlrpos+eax*4-4],ebx - jne .changedb - cmp [objwen+eax*2-2],dx - je near .notchanged -.changedb - cmp [objwlrpos+eax*4],ebx - jne .changed - cmp [objwen+eax*2],dx - jne .changed - mov ecx,[CSprWinPtr] - cmp [objclineptr+eax*4],ecx - ja near .usecurrent -.changed - mov [objwlrpos+eax*4],ebx - mov [objwen+eax*2],dx - - mov bl,[winlogicb] - and bl,03h - mov [nglogicval],bl - mov ebx,4*256 - add ebx,eax - call BuildWindow - mov ecx,[CSprWinPtr] - add ecx,260 - mov [CSprWinPtr],ecx - mov [objclineptr+eax*4],ecx - add ecx,[ngwinptr] - ; Construct Window in ecx - push eax - mov ebx,ngwintable - dec ecx - mov eax,256 -.procnotempty - mov edx,[ebx] - add ebx,4 - or edx,edx - jz .procempty - dec edx -.swloop - mov dword[ecx],0 - add ecx,4 - sub eax,4 - jc .done - sub edx,4 - jnc .swloop - sub eax,edx - add ecx,edx - dec eax - inc ecx -.procempty - mov edx,[ebx] - dec edx - add ebx,4 -.swloop2 - mov dword[ecx],01010101h - add ecx,4 - sub eax,4 - jc .done - sub edx,4 - jnc .swloop2 - sub eax,edx - add ecx,edx - dec eax - inc ecx - jmp .procnotempty -.done - pop eax - jmp .skipobjw -.usecurrent - mov ecx,[objclineptr+eax*4] - mov [CSprWinPtr],ecx - jmp .skipobjw - ; copy over if it's the same -.notchanged - mov [objwlrpos+eax*4],ebx - mov [objwen+eax*2],dx - mov ebx,[objclineptr+eax*4-4] - mov [objclineptr+eax*4],ebx -.skipobjw - pop edx - pop ecx - jmp .okaywin -.finishwin - mov byte[winbg1enval+eax],0 - mov byte[winbg2enval+eax],0 - mov byte[winbg3enval+eax],0 - mov byte[winbg4enval+eax],0 - mov byte[winbgobjenval+eax],0 -.okaywin - -; cmp byte[Mode7HiRes],1 -; jne .nomode7hires -; cmp byte[bgmode],7 -; je .hires -.nomode7hires - cmp byte[res640],0 - je near .no512 - cmp byte[bgmode],5 - jb .no512 - cmp byte[Mode7HiRes],1 - je .hires - cmp byte[bgmode],7 - je .no512 -.hires - mov byte[hiresstuff],1 - push edi - push eax - push ecx - mov ebx,eax - mov edi,[vidbuffer] - mov eax,ebx - add edi,16+75036 - shl eax,8 - add edi,eax - mov eax,ebx - shl eax,5 - add edi,eax - xor eax,eax - mov ecx,64 - rep stosd - pop ecx - pop eax - pop edi -.no512 - mov ebx,[sprleftpr+eax*4] - cmp ebx,00000001h - je .single - cmp ebx,00000100h - je .single - cmp ebx,00010000h - je .single - cmp ebx,01000000h - je .single - or [sprprdrn],ebx - xor ebx,ebx - ret -.single - or [sprprdrn],ebx - or dword[sprleftpr+eax*4],80000000h - xor ebx,ebx - ret - -%macro Process1DualWindow 0 - test ch,1 - jnz %%outside - inc ebx - cmp edx,ebx - jb %%noclip - ; Process Inside window - mov [esi],ebx - sub edx,ebx - add edx,2 - mov [esi+4],edx - mov dword[esi+8],0EE00h - add esi,12 - jmp %%finwin -%%noclip - mov dword[esi],0EE00h - add esi,4 - jmp %%finwin -%%outside - ; Process Outside window - cmp edx,ebx - jb %%completeclip - or ebx,ebx - jz %%skipclip - inc ebx - mov dword[esi],0 - mov [esi+4],ebx - add esi,8 -%%skipclip - sub edx,ebx - add edx,2 - mov [esi],edx - mov dword[esi+4],0EE00h - add esi,8 - jmp %%finwin -%%completeclip - mov dword[esi],0 - mov dword[esi+4],0EE00h - add esi,8 -%%finwin -%endmacro - -NEWSYM BuildWindow2 - jmp BuildWindow.ns2 -NEWSYM BuildWindow - cmp byte[WindowRedraw],1 - je .ns2 - mov dword[valtemp],0EE00h - push edx - push ecx - mov edx,[winlogicaval+eax*2] - shl edx,16 - mov dl,[winbg1enval+ebx] - cmp edx,[pwinen] - jne .notsimilar - mov edx,[winboundary+eax*4] - cmp edx,[pwinbound] - jne .notsimilarb - mov ecx,ngwintable -.loopc - mov edx,[ecx+64] - mov [ecx],edx - add ecx,4 - cmp edx,0D000h - ja .finloopc - cmp ecx,ngwintable+64 - jne .loopc -.finloopc - mov edx,[pngwinen] - mov [ngwinen],edx - pop ecx - pop edx - ret -.ns2 - mov byte[WindowRedraw],0 - push edx - push ecx - jmp .ns -.notsimilar - mov [pwinen],edx - mov edx,[winboundary+eax*4] -.notsimilarb - mov [pwinbound],edx -.ns - push esi - mov cl,[winbg1enval+ebx] - xor edx,edx - mov ch,cl - and cl,0Ah - mov esi,ngwintable - cmp cl,0Ah - je near .dualwin - xor ebx,ebx - cmp cl,2 - jne .winb - mov bl,[winboundary+eax*4] - mov dl,[winboundary+eax*4+1] - jmp .wina -.winb - mov bl,[winboundary+eax*4+2] - mov dl,[winboundary+eax*4+3] - shr ch,2 -.wina - test ch,1 - jnz .outside - inc ebx - cmp edx,ebx - jb .noclip - ; Process Inside window - mov [esi],ebx - mov [esi+64],ebx - sub edx,ebx - add edx,2 - mov [esi+4],edx - mov dword[esi+8],0EE00h - mov [esi+4+64],edx - mov dword[esi+8+64],0EE00h - mov dword[ngwinen],1 -.noclip - pop esi - mov edx,[ngwinen] - mov [pngwinen],edx - pop ecx - pop edx - ret -.outside - ; Process Outside window - cmp edx,ebx - jb .completeclip - or ebx,ebx - jz .skipclip - inc ebx - mov dword[esi],0 - mov [esi+4],ebx - mov dword[esi+64],0 - mov [esi+4+64],ebx - add esi,8 -.skipclip - sub edx,ebx - add edx,2 - mov [esi],edx - mov [esi+64],edx - mov dword[esi+4],0EE00h - mov dword[esi+4+64],0EE00h - mov dword[ngwinen],1 - pop esi - mov edx,[ngwinen] - mov [pngwinen],edx - pop ecx - pop edx - ret -.completeclip - mov dword[esi],0 - mov dword[esi+4],0EE00h - mov dword[esi+64],0 - mov dword[esi+4+64],0EE00h - mov dword[ngwinen],1 - pop esi - mov edx,[ngwinen] - mov [pngwinen],edx - pop ecx - pop edx - ret -.dualwin - push ebx - xor ebx,ebx - mov dl,[winboundary+eax*4+1] - mov bl,[winboundary+eax*4] - Process1DualWindow - pop ebx - mov [WinPtrAPos],esi - - mov ch,[winbg1enval+ebx] - xor ebx,ebx - xor edx,edx - mov bl,[winboundary+eax*4+2] - mov dl,[winboundary+eax*4+3] - shr ch,2 - Process1DualWindow - mov [WinPtrBPos],esi - - ; Convert displacement table to cumulative table - mov esi,ngwintable - xor ebx,ebx -.loopapos - add ebx,[esi] - mov [esi],ebx - add esi,4 - cmp esi,[WinPtrAPos] - jne .loopapos - xor ebx,ebx -.loopbpos - add ebx,[esi] - mov [esi],ebx - add esi,4 - cmp esi,[WinPtrBPos] - jne .loopbpos - - ; Combine both lists - push edi - mov ecx,0101h - mov edx,ngwintablec - mov esi,ngwintable - mov edi,[WinPtrAPos] - mov dword[edx],0 - mov dword[edx+64],0 - cmp dword[esi],0 - jne .notzeroa - add esi,4 - inc dword[edx+64] - neg cl -.notzeroa - cmp dword[edi],0 - jne .notzerob - add edi,4 - inc dword[edx+64] - neg ch -.notzerob - add edx,4 -.loop - mov ebx,[esi] - cmp ebx,0EE00h - jae .edi -.noedi - cmp ebx,[edi] - je .equal - jb .esi -.edi - mov ebx,[edi] - cmp ebx,0EE00h - jae .esib - mov [edx],ebx - mov [edx+64],ch - add edx,4 - add edi,4 - neg ch - jmp .loop -.esib - mov ebx,[esi] - cmp ebx,0EE00h - jae .fin -.esi - mov [edx],ebx - mov [edx+64],cl - add edx,4 - add esi,4 - neg cl - jmp .loop -.equal - mov [edx],ebx - mov [edx+64],cl - add [edx+64],ch - neg cl - neg ch - add edx,4 - add esi,4 - add edi,4 - cmp ebx,0EE00h - jb .loop - jmp .finb -.fin - mov dword[edx],0EE00h - add edx,4 -.finb - - mov [WinPtrAPos],edx - -; jmp .c - - ; Convert list to proper on/off format - mov edi,[nglogicval] - and edi,3 - shl edi,2 - add edi,OrLogicTable - mov edx,ngwintablec - xor ecx,ecx -.loopp - add cl,[edx+64] - mov bl,[edi+ecx] - mov [edx+64],bl - add edx,4 - cmp edx,[WinPtrAPos] - jne .loopp - - ; Shorten & Convert back to displacement format - mov edx,ngwintablec - mov esi,ngwintable - mov cl,1 - xor ebx,ebx -.loops - cmp byte[edx+64],cl - jne .noadd - mov edi,[edx] - sub edi,ebx - add ebx,edi - mov [esi],edi - mov [esi+64],edi - add esi,4 - xor cl,1 -.noadd - add edx,4 - cmp edx,[WinPtrAPos] - jne .loops - mov dword[esi],0EE00h - mov dword[esi+64],0EE00h - -.c - - pop edi - pop esi - mov dword[ngwinen],1 - mov dword[pngwinen],1 - pop ecx - pop edx - ret - -SECTION .data -NEWSYM firstdrawn, db 0 - -NEWSYM bgusedng - dd 01010101h,00010101h,00000101h,00000101h,00000101h,00000101h - dd 00000001h,00000001h - -SECTION .bss -NEWSYM bgcmsung, resd 1 -NEWSYM modeused, resd 2 -NEWSYM reslbyl, resd 1 -NEWSYM sprprdrn, resd 1 -NEWSYM csprival, resd 1 -NEWSYM pesimpng2, resd 1 -NEWSYM cfieldad, resd 1 -NEWSYM ignor512, resd 1 -NEWSYM ofsmcptr, resd 1 -NEWSYM ofsmtptr, resd 1 -NEWSYM ofsmmptr, resd 1 -NEWSYM ofsmcyps, resd 1 -NEWSYM ofsmady, resd 1 -NEWSYM ofsmadx, resd 1 -NEWSYM mosoldtab, resd 15 - -SECTION .data -ALIGN32 - -NEWSYM ngwintable, times 16 dd 0EE00h -NEWSYM ngwintableb, times 16 dd 0EE00h -NEWSYM ngwintablec, times 16 dd 0EE00h -NEWSYM ngwintabled, times 16 dd 0EE00h -NEWSYM valtemp, dd 0EE00h, 0EE00h -NEWSYM ngcwinptr, dd ngwintable - -SECTION .bss -NEWSYM ngwinen, resd 1 -NEWSYM ngcwinmode, resd 1 -NEWSYM ngcpixleft, resd 1 -NEWSYM Mode7BackA, resd 1 -NEWSYM Mode7BackC, resd 1 -NEWSYM Mode7BackX0, resd 1 -NEWSYM Mode7BackSet, resd 1 -NEWSYM ngextbg, resd 1 -NEWSYM cbgval, resd 1 -NEWSYM ofsmval, resd 1 -NEWSYM ofsmvalh, resd 1 - -SECTION .data -NEWSYM pwinen, dd 0FFFFh -NEWSYM pngwinen, dd 0FFFFh - -SECTION .bss -NEWSYM pwinbound, resd 1 -NEWSYM WinPtrAPos, resd 1 -NEWSYM WinPtrBPos, resd 1 - -SECTION .data -NEWSYM OrLogicTable, db 0,1,1,0 -NEWSYM AndLogicTable, db 0,0,1,0 -NEWSYM XorLogicTable, db 0,1,0,0 -NEWSYM XNorLogicTable, db 1,0,1,0 - -SECTION .bss -NEWSYM nglogicval, resd 1 -NEWSYM pnglogicval, resd 1 -NEWSYM mosjmptab, resd 15 -NEWSYM Mode7HiRes, resd 1 -NEWSYM pesimpng, resd 1 -NEWSYM bgtxadd2, resd 1 -SECTION .text - -NEWSYM StartDrawNewGfx - mov byte[WindowRedraw],1 - mov dword[ignor512],1 - mov dword[cfieldad],0 - cmp byte[res480],1 - jne .scan2 - cmp byte[scanlines],0 - jne .scan2 - mov al,[cfield] - mov [cfieldad],al -.scan2 - mov ax,[resolutn] - sub ax,8 - mov [reslbyl],ax - cmp byte[cbitmode],1 - je near StartDrawNewGfx16b - push edx - push esi - push edi - push ebp - - ; Clear video memory - mov edi,[vidbuffer] - xor eax,eax - add edi,16 - mov dl,[resolutn] -.loopa - mov ecx,64 - rep stosd - add edi,32 - dec dl - jnz .loopa - - cmp dword[scfbl],0 - jne near .dontdraw - - ; Sprite Layering : - ; Mode 0/1 - BG4/BG3pr0 * BG4/BG3pr1 * BG2/BG1pr0 * BG2/BG1pr0 * BG3pr1 - ; Mode 2-6 - BG2pr0 * BG1pr0 * BG2pr1 * BG1pr1 * - ; Mode 7 - * BG1pr0 * BG1pr1 * * - - ; Copy data to sprite table - mov ecx,256 - mov eax,[spritetablea] - mov ebx,sprlefttot - mov edi,sprtbng -.loop - mov [edi],eax - add eax,512 - inc ebx - add edi,4 - dec ecx - jnz .loop - - xor eax,eax - mov edi,sprtlng - mov ecx,64 - rep stosd - - mov byte[firstdrawn],1 - mov dword[bg1totng],0 - mov dword[bg2totng],0 - mov dword[bg3totng],0 - mov dword[bg4totng],0 - mov dword[bg1drwng],0 - mov dword[bg2drwng],0 - mov dword[bg3drwng],0 - mov dword[bg4drwng],0 - - ; Draw SubScreens - test byte[scrndis],8h - jnz near .nodobg4s - test dword[bgcmsung],800h - jz near .nodobg4s - mov dword[mode0ads],60606060h - Procbgpr0 3, drawbg4line, drawbg4tile, 800h, 8h -.nodobg4s - test byte[scrndis],4h - jnz near .nodobg3s - test dword[bgcmsung],400h - jz near .nodobg3s - mov dword[mode0ads],40404040h - Procbg3pr0 2, drawbg3line, drawbg3tile, 400h, 4h -.nodobg3s - - ; draw sprites mode 0-1 - test byte[scrndis],10h - jnz near .nosprpra - test dword[modeused],00000101h - jz near .nosprpra - test dword[bgcmsung],1000h - jz near .nosprpra - Procsprng01 1000h, 10h -.nosprpra - - test byte[scrndis],8h - jnz near .nodobg4sb - test dword[bgcmsung],800h - jz near .nodobg4sb - mov eax,[bg4totng] - cmp eax,[bg4drwng] - je near .nodobg4sb - mov dword[mode0ads],60606060h - Procbgpr1 3, drawbg4linepr1, drawbg4tilepr1, prdata, 800h, 8h -.nodobg4sb - test byte[scrndis],4h - jnz near .nodobg3sb - test dword[bgcmsung],400h - jz near .nodobg3sb - mov eax,[bg3totng] - cmp eax,[bg3drwng] - je near .nodobg3sb - mov dword[mode0ads],40404040h - Procbg3pr1 2, drawbg3linepr1, drawbg3tilepr1, prdatc, 400h, 4h -.nodobg3sb - - ; draw sprites mode 0-1 - test byte[scrndis],10h - jnz near .nosprprb - test dword[modeused],00000101h - jz near .nosprprb - test dword[bgcmsung],1000h - jz near .nosprprb - Procsprng01 1000h, 10h -.nosprprb - - test byte[scrndis],2h - jnz near .nodobg2s - test dword[bgcmsung],200h - jz near .nodobg2s - mov dword[mode0ads],20202020h - Procbgpr0 1, drawbg2line, drawbg2tile, 200h, 2h -.nodobg2s - - ; draw mode 7 extbg pr 0 - cmp byte[ngextbg],0 - je near .noextbgsc - test dword[bgcmsung],300h - jz near .noextbgsc - ProcMode7ngextbg 300h, 3h -.noextbgsc - - ; draw sprites mode 2-7 - test byte[scrndis],10h - jnz near .nosprprc - test dword[modeused],01010000h - jnz near .yessprprc - test dword[modeused+4],01010101h - jz near .nosprprc -.yessprprc - test dword[bgcmsung],1000h - jz near .nosprprc - Procsprng234567 1000h, 10h -.nosprprc - - test byte[scrndis],1h - jnz near .nodobg1s - test dword[bgcmsung],100h - jz near .nodobg1s - mov dword[mode0ads],00000000h - Procbgpr0 0, drawbg1line, drawbg1tile, 100h, 1h -.nodobg1s - - ; draw mode 7, priority 0 - cmp byte[modeused+7],0 - je near .nomode7 - test dword[bgcmsung],300h - jz near .nomode7 - ProcMode7ng 100h, 1h -.nomode7 - - ; draw sprites mode 0-7 - test byte[scrndis],10h - jnz near .nosprprd - test dword[bgcmsung],1000h - jz near .nosprprd - Procsprng 1000h, 10h -.nosprprd - - test byte[scrndis],2h - jnz near .nodobg2sb - test dword[bgcmsung],200h - jz near .nodobg2sb - mov eax,[bg2totng] - cmp eax,[bg2drwng] - je near .nodobg2sb - mov dword[mode0ads],20202020h - Procbgpr1 1, drawbg2linepr1, drawbg2tilepr1, prdata, 200h, 2h -.nodobg2sb - - ; draw mode 7 extbg pr 1 - cmp byte[ngextbg],0 - je near .noextbgscb - test dword[bgcmsung],300h - jz near .noextbgscb - ProcMode7ngextbg2 200h, 2h -.noextbgscb - - ; draw sprites mode 2-7 - test byte[scrndis],10h - jnz near .nosprpre - test dword[modeused],01010000h - jnz near .yessprpre - test dword[modeused+4],01010101h - jz near .nosprpre -.yessprpre - test dword[bgcmsung],1000h - jz near .nosprpre - Procsprng234567 1000h, 10h -.nosprpre - - test byte[scrndis],1h - jnz near .nodobg1sb - test dword[bgcmsung],100h - jz near .nodobg1sb - mov eax,[bg1totng] - cmp eax,[bg1drwng] - je near .nodobg1sb - mov dword[mode0ads],00000000h - Procbgpr1 0, drawbg1linepr1, drawbg1tilepr1, prdatb, 100h, 1h -.nodobg1sb - - ; draw sprites mode 0-7 - test byte[scrndis],10h - jnz near .nosprprf - test dword[bgcmsung],1000h - jz near .nosprprf - Procsprng 1000h, 10h -.nosprprf - - test byte[scrndis],4h - jnz near .nodobg3sb2 - cmp byte[modeused+1],0 - je near .nodobg3sb2 - test dword[bgcmsung],400h - jz near .nodobg3sb2 - mov eax,[bg3totng] - cmp eax,[bg3drwng] - je near .nodobg3sb2 - mov dword[mode0ads],40404040h - Procbg3pr1b 2, drawbg3linepr1, drawbg3tilepr1, prdatc, 400h, 4h -.nodobg3sb2 - - mov dword[bg1totng],0 - mov dword[bg2totng],0 - mov dword[bg3totng],0 - mov dword[bg4totng],0 - mov dword[bg1drwng],0 - mov dword[bg2drwng],0 - mov dword[bg3drwng],0 - mov dword[bg4drwng],0 - - ; Draw MainScreens - test byte[scrndis],8h - jnz near .nodobg4m - test dword[bgcmsung],8h - jz near .nodobg4m - mov dword[mode0ads],60606060h - Procbgpr0 3, drawbg4line, drawbg4tile, 8h, 0 -.nodobg4m - test byte[scrndis],4h - jnz near .nodobg3m - test dword[bgcmsung],4h - jz near .nodobg3m - mov dword[mode0ads],40404040h - Procbg3pr0 2, drawbg3line, drawbg3tile, 4h, 0 -.nodobg3m - - ; draw sprites mode 0-1 - test byte[scrndis],10h - jnz near .nosprprma - test dword[modeused],00000101h - jz near .nosprprma - test dword[bgcmsung],10h - jz near .nosprprma - Procsprng01 10h, 0 -.nosprprma - - test byte[scrndis],8h - jnz near .nodobg4mb - test dword[bgcmsung],8h - jz near .nodobg4mb - mov eax,[bg4totng] - cmp eax,[bg4drwng] - je near .nodobg4mb - mov dword[mode0ads],60606060h - Procbgpr1 3, drawbg4linepr1, drawbg4tilepr1, prdata, 8h, 0 -.nodobg4mb - test byte[scrndis],4h - jnz near .nodobg3mb - test dword[bgcmsung],4h - jz near .nodobg3mb - mov eax,[bg3totng] - cmp eax,[bg3drwng] - je near .nodobg3mb - mov dword[mode0ads],40404040h - Procbg3pr1 2, drawbg3linepr1, drawbg3tilepr1, prdatc, 4h, 0 -.nodobg3mb - - ; draw sprites mode 0-1 - test byte[scrndis],10h - jnz near .nosprprmb - test dword[modeused],00000101h - jz near .nosprprmb - test dword[bgcmsung],10h - jz near .nosprprmb - Procsprng01 10h, 0 -.nosprprmb - - test byte[scrndis],2h - jnz near .nodobg2m - test dword[bgcmsung],2h - jz near .nodobg2m - mov dword[mode0ads],20202020h - Procbgpr0 1, drawbg2line, drawbg2tile, 2h, 0 -.nodobg2m - - ; draw mode 7 extbg pr 0 - cmp byte[ngextbg],0 - je near .noextbgmn - test dword[bgcmsung],3h - jz near .noextbgmn - ProcMode7ngextbg 3h, 0 -.noextbgmn - - ; draw sprites mode 2-7 - test byte[scrndis],10h - jnz near .nosprprmc - test dword[modeused],01010000h - jnz near .yessprprmc - test dword[modeused+4],01010101h - jz near .nosprprmc -.yessprprmc - test dword[bgcmsung],10h - jz near .nosprprmc - Procsprng234567 10h, 0h -.nosprprmc - - test byte[scrndis],1h - jnz near .nodobg1m - test dword[bgcmsung],1h - jz near .nodobg1m - mov dword[mode0ads],00000000h - Procbgpr0 0, drawbg1line, drawbg1tile, 1h, 0 -.nodobg1m - - ; draw mode 7, priority 0 - cmp byte[modeused+7],0 - je near .nomode7m - test dword[bgcmsung],1h - jz near .nomode7m - ProcMode7ng 1h, 0 -.nomode7m - - ; draw sprites mode 0-7 - test byte[scrndis],10h - jnz near .nosprprmd - test dword[bgcmsung],10h - jz near .nosprprmd - Procsprng 10h, 0 -.nosprprmd - - ; draw mode 7 extbg pr 1 - cmp byte[ngextbg],0 - je near .noextbgmn2 - test dword[bgcmsung],3h - jz near .noextbgmn2 - ProcMode7ngextbg2 2h, 0 -.noextbgmn2 - - test byte[scrndis],2h - jnz near .nodobg2mb - test dword[bgcmsung],2h - jz near .nodobg2mb - mov eax,[bg2totng] - cmp eax,[bg2drwng] - je near .nodobg2mb - mov dword[mode0ads],20202020h - Procbgpr1 1, drawbg2linepr1, drawbg2tilepr1, prdata, 2h, 0 -.nodobg2mb - - ; draw sprites mode 2-7 - test byte[scrndis],10h - jnz near .nosprprme - test dword[modeused],01010000h - jnz near .yessprprme - test dword[modeused+4],01010101h - jz near .nosprprme -.yessprprme - test dword[bgcmsung],10h - jz near .nosprprme - Procsprng234567 10h, 0 -.nosprprme - - test byte[scrndis],1h - jnz near .nodobg1mb - test dword[bgcmsung],1h - jz near .nodobg1mb - mov eax,[bg1totng] - cmp eax,[bg1drwng] - je near .nodobg1mb - mov dword[mode0ads],00000000h - Procbgpr1 0, drawbg1linepr1, drawbg1tilepr1, prdatb, 1h, 0 -.nodobg1mb - - ; draw sprites mode 0-7 - test byte[scrndis],10h - jnz near .nosprprmf - test dword[bgcmsung],10h - jz near .nosprprmf - Procsprng 10h, 0 -.nosprprmf - - test byte[scrndis],4h - jnz near .nodobg3mb2 - cmp byte[modeused+1],0 - je near .nodobg3mb2 - test dword[bgcmsung],4h - jz near .nodobg3mb2 - mov eax,[bg3totng] - cmp eax,[bg3drwng] - je near .nodobg3mb2 - mov dword[mode0ads],40404040h - Procbg3pr1b 2, drawbg3linepr1, drawbg3tilepr1, prdatc, 4h, 0 -.nodobg3mb2 - -.dontdraw - xor ebx,ebx - xor ecx,ecx - pop ebp - pop edi - pop esi - pop edx - ret - -NEWSYM drawbg1tile - mov byte[prdatb+ebx],1 - drawbgtileng 0,0 - ret - -NEWSYM drawbg2tile - mov byte[prdata+ebx],1 - drawbgtileng 1,1 - ret - -NEWSYM drawbg3tile - mov byte[prdatc+ebx],1 - drawbgtileng 2,2 - ret - -NEWSYM drawbg4tile - mov byte[prdata+ebx],1 - drawbgtileng 3,1 - ret - -NEWSYM drawbg1tilepr1 - drawbgtilengpr1 0,0 - ret - -NEWSYM drawbg2tilepr1 - drawbgtilengpr1 1,1 - ret - -NEWSYM drawbg3tilepr1 - drawbgtilengpr1 2,2 - ret - -NEWSYM drawbg4tilepr1 - drawbgtilengpr1 3,1 - ret - -NEWSYM drawbg1line - mov byte[prdatb+ebx],0 - drawbglineng 0,0 - -NEWSYM drawbg2line - mov byte[prdata+ebx],0 - drawbglineng 1,1 - -NEWSYM drawbg3line - mov byte[prdatc+ebx],0 - drawbglineng 2,2 - -NEWSYM drawbg4line - mov byte[prdata+ebx],0 - drawbglineng 3,1 - -NEWSYM domosaicng - mov esi,[pesimpng] - xor eax,eax - mov edi,xtravbuf+16 - mov al,[curmosaicsz] - cmp al,16 - ja .notokay - cmp al,1 - jbe .notokay - push esi - jmp [mosjmptab+eax*4-8] -.notokay - ret - -NEWSYM mosdraw2 - mov ecx,128 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mosender 2 - -NEWSYM mosdraw3 - mov ecx,86 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mosender 3 - -NEWSYM mosdraw4 - mov ecx,64 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mosender 4 - -NEWSYM mosdraw5 - mov ecx,52 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mosender 5 - -NEWSYM mosdraw6 - mov ecx,43 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mosender 6 - -NEWSYM mosdraw7 - mov ecx,37 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mosender 7 - -NEWSYM mosdraw8 - mov ecx,32 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mov [esi+7],al - mosender 8 - -NEWSYM mosdraw9 - mov ecx,29 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mov [esi+7],al - mov [esi+8],al - mosender 9 - -NEWSYM mosdraw10 - mov ecx,26 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mov [esi+7],al - mov [esi+8],al - mov [esi+9],al - mosender 10 - -NEWSYM mosdraw11 - mov ecx,24 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mov [esi+7],al - mov [esi+8],al - mov [esi+9],al - mov [esi+10],al - mosender 11 - -NEWSYM mosdraw12 - mov ecx,22 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mov [esi+7],al - mov [esi+8],al - mov [esi+9],al - mov [esi+10],al - mov [esi+11],al - mosender 12 - -NEWSYM mosdraw13 - mov ecx,20 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mov [esi+7],al - mov [esi+8],al - mov [esi+9],al - mov [esi+10],al - mov [esi+11],al - mov [esi+12],al - mosender 13 - -NEWSYM mosdraw14 - mov ecx,19 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mov [esi+7],al - mov [esi+8],al - mov [esi+9],al - mov [esi+10],al - mov [esi+11],al - mov [esi+12],al - mov [esi+13],al - mosender 14 - -NEWSYM mosdraw15 - mov ecx,18 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mov [esi+7],al - mov [esi+8],al - mov [esi+9],al - mov [esi+10],al - mov [esi+11],al - mov [esi+12],al - mov [esi+13],al - mov [esi+14],al - mosender 15 - -NEWSYM mosdraw16 - mov ecx,16 -.next - mov al,[edi] - or al,al - jz .nodraw - mov [esi],al - mov [esi+1],al - mov [esi+2],al - mov [esi+3],al - mov [esi+4],al - mov [esi+5],al - mov [esi+6],al - mov [esi+7],al - mov [esi+8],al - mov [esi+9],al - mov [esi+10],al - mov [esi+11],al - mov [esi+12],al - mov [esi+13],al - mov [esi+14],al - mov [esi+15],al - mosender 16 - -NEWSYM drawbg1linepr1 - drawbglinengpr1 0,0 - -NEWSYM drawbg2linepr1 - drawbglinengpr1 1,1 - -NEWSYM drawbg3linepr1 - drawbglinengpr1 2,2 - -NEWSYM drawbg4linepr1 - drawbglinengpr1 3,1 - - -SECTION .bss -NEWSYM bgtxadd, resd 1 -NEWSYM bgcyval, resd 1 -NEWSYM bgcxval, resd 1 -NEWSYM tleftn, resd 1 -NEWSYM tleftnb, resd 1 -NEWSYM bg1totng, resd 1 -NEWSYM bg2totng, resd 1 -NEWSYM bg3totng, resd 1 -NEWSYM bg4totng, resd 1 -NEWSYM bg1drwng, resd 1 -NEWSYM bg2drwng, resd 1 -NEWSYM bg3drwng, resd 1 -NEWSYM bg4drwng, resd 1 -NEWSYM sprcurng, resd 1 -NEWSYM scfbl, resd 1 -NEWSYM mode0ads, resd 1 -NEWSYM mode0add, resd 1 -NEWSYM taddnfy16x16, resd 1 -NEWSYM taddfy16x16, resd 1 -NEWSYM switch16x16, resd 1 -NEWSYM yposng, resd 1 -NEWSYM flipyposng, resd 1 -NEWSYM yposngom, resd 1 -NEWSYM flipyposngom, resd 1 -SECTION .text - -NEWSYM drawsprng - cmp byte[winbg1enval+ebx+4*256],0 - jne near drawsprngw - test dword[sprleftpr+ebx*4],80000000h - jnz near .drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra - pop edx -.nodrawspr - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - ret -.drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - pop ebx - pop esi - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - pop ebx - pop esi - ret - -.drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - mov edx,ecx - and edx,0FFh - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawa sprdrawprb - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 - pop ebx - pop esi - ret -.drawspriteflipx2 - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawaf sprdrawprb - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 - pop ebx - pop esi - ret - -NEWSYM drawsprngm7h - cmp byte[winbg1enval+ebx+4*256],0 - jne near drawsprngm7w - test dword[sprleftpr+ebx*4],80000000h - jnz near .drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra - pop edx -.nodrawspr - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - ret -.drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - pop ebx - pop esi - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - pop ebx - pop esi - ret - -.drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - mov edx,ecx - and edx,0FFh - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawa sprdrawprb - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 - pop ebx - pop esi - ret -.drawspriteflipx2 - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawaf sprdrawprb - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 - pop ebx - pop esi - ret - -SECTION .bss -NEWSYM NGNumSpr, resb 1 -SECTION .text - -NEWSYM drawsprngw - mov [NGNumSpr],cl - mov ecx,[objclineptr+ebx*4] - add ecx,[ngwinptr] - test dword[sprleftpr+ebx*4],80000000h - jnz near .drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push edx - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notprio - mov dh,[esi+6] - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawprawb - pop edx -.nodrawspr - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - xor ecx,ecx - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - xor ecx,ecx - ret -.drawspriteflipx - mov bx,[esi] - push edx - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notpriof - mov dh,[esi+6] - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawprawb - pop edx - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - pop ebx - pop esi - xor ecx,ecx - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - xor ecx,ecx - xor ecx,ecx - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - pop ebx - pop esi - ret - -.drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - xor edx,edx - mov dl,[NGNumSpr] - and edx,0FFh - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - push edx - mov bx,[esi] - mov dh,[esi+6] - mov esi,[esi+2] - sprdrawa sprdrawprbwb - pop edx - sub edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj2 - pop ebx - pop esi - xor ecx,ecx - ret -.drawspriteflipx2 - push edx - mov bx,[esi] - mov dh,[esi+6] - mov esi,[esi+2] - sprdrawaf sprdrawprbwb - pop edx - sub edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj2 - pop ebx - pop esi - xor ecx,ecx - ret - -NEWSYM drawsprngm7w - mov [NGNumSpr],cl - mov ecx,[objclineptr+ebx*4] - add ecx,[ngwinptr] - test dword[sprleftpr+ebx*4],80000000h - jnz near .drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push edx - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notprio - mov dh,[esi+6] - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawprawb - pop edx -.nodrawspr - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - xor ecx,ecx - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - xor ecx,ecx - ret -.drawspriteflipx - mov bx,[esi] - push edx - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notpriof - mov dh,[esi+6] - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawprawb - pop edx - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - pop ebx - pop esi - xor ecx,ecx - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - xor ecx,ecx - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - pop ebx - pop esi - ret - -.drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - xor edx,edx - mov dl,[NGNumSpr] - and edx,0FFh - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - push edx - mov bx,[esi] - mov dh,[esi+6] - mov esi,[esi+2] - sprdrawa sprdrawprbwb - pop edx - sub edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj2 - pop ebx - pop esi - xor ecx,ecx - ret -.drawspriteflipx2 - push edx - mov bx,[esi] - mov dh,[esi+6] - mov esi,[esi+2] - sprdrawaf sprdrawprbwb - pop edx - sub edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj2 - pop ebx - pop esi - xor ecx,ecx - ret - -;******************************************************* -; Prepare Sprite Priorities -;******************************************************* - -NEWSYM makesprprtable - ret - -NEWSYM preparesprpr - xor ebx,ebx - mov bl,[curypos] - mov eax,[sprleftpr+ebx*4] - mov [sprclprio],eax - cmp eax,00000001h - je .single - cmp eax,00000100h - je .single - cmp eax,00010000h - je .single - cmp eax,01000000h - je .single - mov dword[sprsingle],0 - ret -.single - mov dword[sprsingle],1 - ret - -SECTION .bss -NEWSYM sprclprio, resd 1 -NEWSYM sprsingle, resd 1 -SECTION .text diff --git a/tools/zsnes/src/video/newgfx.mac b/tools/zsnes/src/video/newgfx.mac deleted file mode 100644 index 97eeeec..0000000 --- a/tools/zsnes/src/video/newgfx.mac +++ /dev/null @@ -1,3361 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 Procbgpr0 5 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16 -; add esi,16+288 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - test dword[BGMS1+ebx*2],%4 - jz %%nogo - test dword[BGMS1+ebx*2],%5 - jnz %%nogo - ; Check if at a tile alignment - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - add ecx,ebx - test ecx,07h - jz %%tilecheck -%%proclinebyline - ; process line by line - call %2 -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja %%nextline - jmp %%donextbg -%%tilecheck - test dword[bgwinchange+ebx],0FFFFFF00h - jnz %%linebyline - test dword[bgwinchange+ebx+4],0FFFFFFFFh - jz %%tilebytile -%%linebyline - test dword[winbg1enval+ebx+%1*256],0A0A0A0Ah - jnz %%proclinebyline - test dword[winbg1enval+ebx+%1*256+4],0A0A0A0Ah - jnz %%proclinebyline -%%tilebytile - test dword[BGMS1+ebx*2+14],%4 - jz %%proclinebyline - test dword[BGMS1+ebx*2+14],%5 - jnz %%proclinebyline - cmp ebx,[reslbyl] - jae %%proclinebyline - test dword[bgallchange+ebx],0FFFFFF00h - jnz %%proclinebyline - test dword[bgallchange+ebx+4],0FFFFFFFFh - jnz near %%proclinebyline - test dword[bg1change+ebx+%1*256],0FFFFFF00h - jnz near %%proclinebyline - test dword[bg1change+ebx+%1*256+4],0FFFFFFFFh - jnz near %%proclinebyline - cmp byte[BGMA+ebx],5 - jae near %%proclinebyline - cmp byte[BGMA+ebx],2 - je near %%proclinebyline - test dword[intrlng+ebx],01010101h - jnz near %%proclinebyline - test dword[intrlng+ebx+4],01010101h - jnz near %%proclinebyline - test byte[mosenng+ebx],1 << %1 - jnz %%mosaic -%%nomosaic - call %3 - add ebx,8 - add esi,288*8 - cmp [resolutn],bx - ja near %%nextline - jmp %%donextbg -%%mosaic - cmp byte[mosszng+ebx],0 - je %%nomosaic - jmp %%proclinebyline -%%donextbg -%endmacro - -%macro Procbg3pr0 5 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16 -; add esi,16+288 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - test dword[BGMS1+ebx*2],%4 - jz %%nogo - test dword[BGMS1+ebx*2],%5 - jnz %%nogo - ; Check if at a tile alignment - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - add ecx,ebx - test ecx,07h - jz %%tilecheck -%%proclinebyline - ; process line by line - call %2 -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja %%nextline - jmp %%donextbg -%%tilecheck - test dword[bgwinchange+ebx],0FFFFFF00h - jnz %%linebyline - test dword[bgwinchange+ebx+4],0FFFFFFFFh - jz %%tilebytile -%%linebyline - test dword[winbg1enval+ebx+%1*256],0A0A0A0Ah - jnz %%proclinebyline - test dword[winbg1enval+ebx+%1*256+4],0A0A0A0Ah - jnz %%proclinebyline -%%tilebytile - test dword[BGMS1+ebx*2+14],%4 - jz %%proclinebyline - test dword[BGMS1+ebx*2+14],%5 - jnz %%proclinebyline - cmp ebx,[reslbyl] - jae %%proclinebyline - test dword[bgallchange+ebx],0FFFFFF00h - jnz %%proclinebyline - test dword[bgallchange+ebx+4],0FFFFFFFFh - jnz near %%proclinebyline - test dword[bg1change+ebx+%1*256],0FFFFFF00h - jnz near %%proclinebyline - test dword[bg1change+ebx+%1*256+4],0FFFFFFFFh - jnz near %%proclinebyline - mov eax,[BG3PRI+ebx] - cmp eax,[BG3PRI+ebx+4] - jne near %%proclinebyline - test dword[intrlng+ebx],01010101h - jnz near %%proclinebyline - test dword[intrlng+ebx+4],01010101h - jnz near %%proclinebyline - test byte[mosenng+ebx],1 << %1 - jnz %%mosaic -%%nomosaic - call %3 - add ebx,8 - add esi,288*8 - cmp [resolutn],bx - ja near %%nextline - jmp %%donextbg -%%mosaic - cmp byte[mosszng+ebx],0 - je %%nomosaic - jmp %%proclinebyline -%%donextbg -%endmacro - -%macro Procbgpr1 6 - ; Draw BG - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16 -; add esi,16+288 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - test dword[BGMS1+ebx*2],%5 - jz %%nogo - test dword[BGMS1+ebx*2],%6 - jnz %%nogo - ; Check if at a tile alignment - cmp byte[%4+ebx],1 - je %%tile -%%proclinebyline - ; process line by line - call %2 -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - jne %%nextline - jmp %%donextbg -%%tile - call %3 - add ebx,8 - add esi,288*8 - cmp [resolutn],bx - ja %%nextline -%%donextbg -%endmacro - -%macro Procbg3pr1 6 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - test dword[BGMS1+ebx*2],%5 - jz %%nogo - test dword[BGMS1+ebx*2],%6 - jnz %%nogo - cmp byte[BGMA+ebx],1 - jne %%nomode1 - cmp byte[BG3PRI+ebx],0 - jne %%nogo -%%nomode1 - ; Check if at a tile alignment - cmp byte[%4+ebx],1 - je %%tile -%%proclinebyline - ; process line by line - call %2 -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja %%nextline - jmp %%donextbg -%%tile - call %3 - add ebx,8 - add esi,288*8 - cmp [resolutn],bx - ja %%nextline -%%donextbg -%endmacro - -%macro Procbg3pr1b 6 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - test dword[BGMS1+ebx*2],%5 - jz %%nogo - test dword[BGMS1+ebx*2],%6 - jnz %%nogo - cmp byte[BGMA+ebx],1 - jne %%nogo - cmp byte[BG3PRI+ebx],0 - je %%nogo - ; Check if at a tile alignment - cmp byte[%4+ebx],1 - je %%tile -%%proclinebyline - ; process line by line - call %2 -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja %%nextline - jmp %%donextbg -%%tile - call %3 - add ebx,8 - add esi,288*8 - cmp [resolutn],bx - ja %%nextline -%%donextbg -%endmacro - -%macro Procsprng 2 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16+288 - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - test dword[BGMS1+ebx*2],%1 - jz %%nogo - test dword[BGMS1+ebx*2],%2 - jnz %%nogo - xor eax,eax - mov al,[sprtlng+ebx] - mov cl,[sprlefttot+ebx] - mov [csprival],eax - inc byte[sprtlng+ebx] - test byte[sprleftpr+ebx*4+eax],1 - jz %%nogo - or cl,cl - jz %%nogo - call drawsprng - cmp byte[BGMA+ebx],5 - jb %%nogo - cmp byte[hiresstuff],0 - je %%nogo - add esi,75036 - mov cl,[sprlefttot+ebx] - call drawsprng - sub esi,75036 -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja near %%nextline -%endmacro - -%macro Procsprng01 2 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16+288 - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - test dword[BGMS1+ebx*2],%1 - jz %%nogo - test dword[BGMS1+ebx*2],%2 - jnz %%nogo - cmp byte[BGMA+ebx],1 - ja %%nogo - xor eax,eax - mov al,[sprtlng+ebx] - mov cl,[sprlefttot+ebx] - mov [csprival],eax - inc byte[sprtlng+ebx] - test byte[sprleftpr+ebx*4+eax],1 - jz %%nogo - or cl,cl - jz %%nogo - call drawsprng - cmp byte[BGMA+ebx],5 - jb %%nogo - cmp byte[hiresstuff],0 - je %%nogo - add esi,75036 - mov cl,[sprlefttot+ebx] - call drawsprng - sub esi,75036 -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja near %%nextline -%endmacro - -%macro Procsprng234567 2 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16+288 - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - test dword[BGMS1+ebx*2],%1 - jz %%nogo - test dword[BGMS1+ebx*2],%2 - jnz %%nogo - cmp byte[BGMA+ebx],1 - jbe %%nogo - xor eax,eax - mov al,[sprtlng+ebx] - mov cl,[sprlefttot+ebx] - mov [csprival],eax - inc byte[sprtlng+ebx] - test byte[sprleftpr+ebx*4+eax],1 - jz %%nogo - or cl,cl - jz %%nogo - call drawsprng - cmp byte[BGMA+ebx],5 - jb %%nogo - cmp byte[hiresstuff],0 - je %%nogo - add esi,75036 - mov cl,[sprlefttot+ebx] - call drawsprng - sub esi,75036 -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja near %%nextline -%endmacro - -%macro ProcMode7ng 2 - mov byte[winon],0 - ; Draw BG - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16+288 - mov ebx,[mode7A] - mov [Mode7BackA],ebx - mov ebx,[mode7C] - mov [Mode7BackC],ebx - mov ebx,[mode7X0] - mov [Mode7BackX0],ebx - mov bl,[mode7set] - mov [Mode7BackSet],ebx - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne near %%nogo - cmp byte[BGMA+ebx],7 - jne near %%nogo - test byte[intrlng+ebx],40h - jnz near %%nogo - test dword[BGMS1+ebx*2],%1 - jz near %%nogo - test dword[BGMS1+ebx*2],%2 - jnz near %%nogo - push ebx - ; Process mosaic - mov byte[curmosaicsz],1 - xor ecx,ecx - test byte[mosenng+ebx],1 - jz %%nomosaic - mov cl,[mosszng+ebx] - or cl,cl - jz %%nomosaic - inc cl - mov [curmosaicsz],cl - xor edx,edx - mov eax,ebx - div cl - xor edx,edx - mul cl - mov ebx,eax -%%nomosaic - ; process line by line - mov edx,[mode7ab+ebx*4] - mov [mode7A],edx - mov edx,[mode7cd+ebx*4] - mov [mode7C],edx - - mov edx,[mode7xy+ebx*4] - mov [mode7X0],edx - mov edx,[mode7st+ebx] - mov [mode7set],dl - xor edx,edx - mov eax,ebx - test byte[mode7set],02h - jz %%noflip - mov eax,255 - sub eax,ebx -%%noflip - mov dx,[BG1SXl+ebx*2] - mov [m7starty],ax - mov ax,[BG1SYl+ebx*2] - mov [curvidoffset],esi - pop ebx - push eax - push edx - push esi - push ebx - call drawmode7win - pop ebx - pop esi - pop edx - pop eax - cmp byte[Mode7HiRes],0 - je %%nogo - call processmode7hires -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja near %%nextline - mov ebx,[Mode7BackA] - mov [mode7A],ebx - mov ebx,[Mode7BackC] - mov [mode7C],ebx - mov ebx,[Mode7BackX0] - mov [mode7X0],ebx - mov ebx,[Mode7BackSet] - mov [mode7set],bl -%endmacro - - -%macro ProcMode7ngextbg 2 - mov byte[winon],0 - ; Draw BG - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16+288 - mov ebx,[mode7A] - mov [Mode7BackA],ebx - mov ebx,[mode7C] - mov [Mode7BackC],ebx - mov ebx,[mode7X0] - mov [Mode7BackX0],ebx - mov bl,[mode7set] - mov [Mode7BackSet],ebx - mov ebx,1 -%%nextline - mov byte[esi-1],0 - cmp byte[BGFB+ebx],0 - jne near %%nogo - cmp byte[BGMA+ebx],7 - jne near %%nogo - test dword[BGMS1+ebx*2],%1 - jz near %%nogo - test dword[BGMS1+ebx*2],%2 - jnz near %%nogo - test byte[intrlng+ebx],40h - jz near %%nogo - mov byte[esi-1],1 - push ebx - ; Process mosaic - mov byte[curmosaicsz],1 - xor ecx,ecx - test byte[mosenng+ebx],1 - jz %%nomosaic - mov cl,[mosszng+ebx] - or cl,cl - jz %%nomosaic - inc cl - mov [curmosaicsz],cl - xor edx,edx - mov eax,ebx - div cl - xor edx,edx - mul cl - mov ebx,eax -%%nomosaic - ; process line by line - mov edx,[mode7ab+ebx*4] - mov [mode7A],edx - mov edx,[mode7cd+ebx*4] - mov [mode7C],edx - mov edx,[mode7xy+ebx*4] - mov [mode7X0],edx - mov edx,[mode7st+ebx] - mov [mode7set],dl - xor edx,edx - mov eax,ebx - test byte[mode7set],02h - jz %%noflip - mov eax,255 - sub eax,ebx -%%noflip - mov dx,[BG1SXl+ebx*2] - mov [m7starty],ax - mov ax,[BG1SYl+ebx*2] - mov [curvidoffset],esi - push esi - call drawmode7ngextbg - pop esi - pop ebx -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja near %%nextline - mov ebx,[Mode7BackA] - mov [mode7A],ebx - mov ebx,[Mode7BackC] - mov [mode7C],ebx - mov ebx,[Mode7BackX0] - mov [mode7X0],ebx - mov ebx,[Mode7BackSet] - mov [mode7set],bl -%endmacro - -%macro ProcMode7ngextbg2 2 - mov byte[winon],0 - ; Draw BG - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16+288 - mov ebx,[mode7A] - mov [Mode7BackA],ebx - mov ebx,[mode7C] - mov [Mode7BackC],ebx - mov ebx,[mode7X0] - mov [Mode7BackX0],ebx - mov bl,[mode7set] - mov [Mode7BackSet],ebx - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne near %%nogo - cmp byte[BGMA+ebx],7 - jne near %%nogo - test dword[BGMS1+ebx*2],%1 - jz near %%nogo - test dword[BGMS1+ebx*2],%2 - jnz near %%nogo - test byte[intrlng+ebx],40h - jz near %%nogo - push ebx - ; Process mosaic - mov byte[curmosaicsz],1 - xor ecx,ecx - test byte[mosenng+ebx],1 - jz %%nomosaic - mov cl,[mosszng+ebx] - or cl,cl - jz %%nomosaic - inc cl - mov [curmosaicsz],cl - xor edx,edx - mov eax,ebx - div cl - xor edx,edx - mul cl - mov ebx,eax -%%nomosaic - ; process line by line - mov edx,[mode7ab+ebx*4] - mov [mode7A],edx - mov edx,[mode7cd+ebx*4] - mov [mode7C],edx - mov edx,[mode7xy+ebx*4] - mov [mode7X0],edx - mov edx,[mode7st+ebx] - mov [mode7set],dl - xor edx,edx - mov eax,ebx - test byte[mode7set],02h - jz %%noflip - mov eax,255 - sub eax,ebx -%%noflip - mov dx,[BG1SXl+ebx*2] - mov [m7starty],ax - mov ax,[BG1SYl+ebx*2] - mov [curvidoffset],esi - push esi - jmp %%drawb - cmp byte[esi-1],1 - je %%drawb - call drawmode7ngextbg - jmp %%drawa -%%drawb - call drawmode7ngextbg2 -%%drawa - pop esi - pop ebx -%%nogo - inc ebx - add esi,288 - cmp [resolutn],bx - ja near %%nextline - mov ebx,[Mode7BackA] - mov [mode7A],ebx - mov ebx,[Mode7BackC] - mov [mode7C],ebx - mov ebx,[Mode7BackX0] - mov [mode7X0],ebx - mov ebx,[Mode7BackSet] - mov [mode7set],bl -%endmacro - -%macro preparet4ba 0 - shl cx,5 - add ecx,ecx - add ecx,[vcache4b] -%endmacro - -%macro preparet2ba 0 - shl cx,4 - shl ecx,2 - add ecx,[vcache2b] -%endmacro - -%macro preparet8ba 0 - shl cx,6 - add ecx,[vcache8b] -%endmacro - -%macro test4ba 0 - and ecx,2047 - test dword[vidmemch4+ecx*2],0FFFFh -%endmacro - -%macro test2ba 0 - and ecx,4095 - add edx,dword[mode0add] - test dword[vidmemch2+ecx],0FFh -%endmacro - -%macro test8ba 0 - and ecx,1023 - test dword[vidmemch8+ecx*4],0FFFFFFFFh -%endmacro - -%macro drawtileng 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - mov ebx,[ecx] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+4],ebx - mov ebx,[ecx+8] - add ebx,edx - mov [edi+288],ebx - mov ebx,[ecx+12] - add ebx,edx - mov [edi+288+4],ebx - mov ebx,[ecx+16] - add ebx,edx - mov [edi+288*2],ebx - mov ebx,[ecx+20] - add ebx,edx - mov [edi+288*2+4],ebx - mov ebx,[ecx+24] - add ebx,edx - mov [edi+288*3],ebx - mov ebx,[ecx+28] - add ebx,edx - mov [edi+288*3+4],ebx - mov ebx,[ecx+32] - add ebx,edx - mov [edi+288*4],ebx - mov ebx,[ecx+36] - add ebx,edx - mov [edi+288*4+4],ebx - mov ebx,[ecx+40] - add ebx,edx - mov [edi+288*5],ebx - mov ebx,[ecx+44] - add ebx,edx - mov [edi+288*5+4],ebx - mov ebx,[ecx+48] - add ebx,edx - mov [edi+288*6],ebx - mov ebx,[ecx+52] - add ebx,edx - mov [edi+288*6+4],ebx - mov ebx,[ecx+56] - add ebx,edx - mov [edi+288*7],ebx - mov ebx,[ecx+60] - add ebx,edx - mov [edi+288*7+4],ebx - jmp %5 -%%flipxfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+4],ebx - mov ebx,[ecx+12] - bswap ebx - add ebx,edx - mov [edi+288],ebx - mov ebx,[ecx+8] - bswap ebx - add ebx,edx - mov [edi+288+4],ebx - mov ebx,[ecx+20] - bswap ebx - add ebx,edx - mov [edi+288*2],ebx - mov ebx,[ecx+16] - bswap ebx - add ebx,edx - mov [edi+288*2+4],ebx - mov ebx,[ecx+28] - bswap ebx - add ebx,edx - mov [edi+288*3],ebx - mov ebx,[ecx+24] - bswap ebx - add ebx,edx - mov [edi+288*3+4],ebx - mov ebx,[ecx+36] - bswap ebx - add ebx,edx - mov [edi+288*4],ebx - mov ebx,[ecx+32] - bswap ebx - add ebx,edx - mov [edi+288*4+4],ebx - mov ebx,[ecx+44] - bswap ebx - add ebx,edx - mov [edi+288*5],ebx - mov ebx,[ecx+40] - bswap ebx - add ebx,edx - mov [edi+288*5+4],ebx - mov ebx,[ecx+52] - bswap ebx - add ebx,edx - mov [edi+288*6],ebx - mov ebx,[ecx+48] - bswap ebx - add ebx,edx - mov [edi+288*6+4],ebx - mov ebx,[ecx+60] - bswap ebx - add ebx,edx - mov [edi+288*7],ebx - mov ebx,[ecx+56] - bswap ebx - add ebx,edx - mov [edi+288*7+4],ebx - jmp %5 -%%flipyfull - test word[vrama+eax],4000h - jnz near %%flipxyfull - mov ebx,[ecx] - add ebx,edx - mov [edi+288*7],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+288*7+4],ebx - mov ebx,[ecx+8] - add ebx,edx - mov [edi+288*6],ebx - mov ebx,[ecx+12] - add ebx,edx - mov [edi+288*6+4],ebx - mov ebx,[ecx+16] - add ebx,edx - mov [edi+288*5],ebx - mov ebx,[ecx+20] - add ebx,edx - mov [edi+288*5+4],ebx - mov ebx,[ecx+24] - add ebx,edx - mov [edi+288*4],ebx - mov ebx,[ecx+28] - add ebx,edx - mov [edi+288*4+4],ebx - mov ebx,[ecx+32] - add ebx,edx - mov [edi+288*3],ebx - mov ebx,[ecx+36] - add ebx,edx - mov [edi+288*3+4],ebx - mov ebx,[ecx+40] - add ebx,edx - mov [edi+288*2],ebx - mov ebx,[ecx+44] - add ebx,edx - mov [edi+288*2+4],ebx - mov ebx,[ecx+48] - add ebx,edx - mov [edi+288],ebx - mov ebx,[ecx+52] - add ebx,edx - mov [edi+288+4],ebx - mov ebx,[ecx+56] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+60] - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipxyfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi+288*7],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+288*7+4],ebx - mov ebx,[ecx+12] - bswap ebx - add ebx,edx - mov [edi+288*6],ebx - mov ebx,[ecx+8] - bswap ebx - add ebx,edx - mov [edi+288*6+4],ebx - mov ebx,[ecx+20] - bswap ebx - add ebx,edx - mov [edi+288*5],ebx - mov ebx,[ecx+16] - bswap ebx - add ebx,edx - mov [edi+288*5+4],ebx - mov ebx,[ecx+28] - bswap ebx - add ebx,edx - mov [edi+288*4],ebx - mov ebx,[ecx+24] - bswap ebx - add ebx,edx - mov [edi+288*4+4],ebx - mov ebx,[ecx+36] - bswap ebx - add ebx,edx - mov [edi+288*3],ebx - mov ebx,[ecx+32] - bswap ebx - add ebx,edx - mov [edi+288*3+4],ebx - mov ebx,[ecx+44] - bswap ebx - add ebx,edx - mov [edi+288*2],ebx - mov ebx,[ecx+40] - bswap ebx - add ebx,edx - mov [edi+288*2+4],ebx - mov ebx,[ecx+52] - bswap ebx - add ebx,edx - mov [edi+288],ebx - mov ebx,[ecx+48] - bswap ebx - add ebx,edx - mov [edi+288+4],ebx - mov ebx,[ecx+60] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+56] - bswap ebx - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - mov dword[tleftnb],8 -%%nextb - mov ebx,[ecx] - or ebx,ebx - jz %%drawd - add ebx,edx - test bl,%8 - jz %%drawa - mov [edi],bl -%%drawa - test bh,%8 - jz %%drawb - mov [edi+1],bh -%%drawb - shr ebx,16 - test bl,%8 - jz %%drawc - mov [edi+2],bl -%%drawc - test bh,%8 - jz %%drawd - mov [edi+3],bh -%%drawd - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2 - add ebx,edx - test bl,%8 - jz %%drawa2 - mov [edi+4],bl -%%drawa2 - test bh,%8 - jz %%drawb2 - mov [edi+5],bh -%%drawb2 - shr ebx,16 - test bl,%8 - jz %%drawc2 - mov [edi+6],bl -%%drawc2 - test bh,%8 - jz %%drawd2 - mov [edi+7],bh -%%drawd2 - add ecx,8 - add edi,288 - dec dword[tleftnb] - jnz %%nextb - sub edi,288*8 - jmp %5 -%%flipxpart - mov dword[tleftnb],8 -%%nextbf - mov ebx,[ecx] - or ebx,ebx - jz %%drawdf - add ebx,edx - test bl,%8 - jz %%drawaf - mov [edi+7],bl -%%drawaf - test bh,%8 - jz %%drawbf - mov [edi+6],bh -%%drawbf - shr ebx,16 - test bl,%8 - jz %%drawcf - mov [edi+5],bl -%%drawcf - test bh,%8 - jz %%drawdf - mov [edi+4],bh -%%drawdf - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2f - add ebx,edx - test bl,%8 - jz %%drawa2f - mov [edi+3],bl -%%drawa2f - test bh,%8 - jz %%drawb2f - mov [edi+2],bh -%%drawb2f - shr ebx,16 - test bl,%8 - jz %%drawc2f - mov [edi+1],bl -%%drawc2f - test bh,%8 - jz %%drawd2f - mov [edi],bh -%%drawd2f - add ecx,8 - add edi,288 - dec dword[tleftnb] - jnz %%nextbf - sub edi,288*8 - jmp %5 -%%flipypart - add edi,288*7 - test word[vrama+eax],4000h - jnz near %%flipxypart - mov dword[tleftnb],8 -%%nextbm - mov ebx,[ecx] - or ebx,ebx - jz %%drawdm - add ebx,edx - test bl,%8 - jz %%drawam - mov [edi],bl -%%drawam - test bh,%8 - jz %%drawbm - mov [edi+1],bh -%%drawbm - shr ebx,16 - test bl,%8 - jz %%drawcm - mov [edi+2],bl -%%drawcm - test bh,%8 - jz %%drawdm - mov [edi+3],bh -%%drawdm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2m - add ebx,edx - test bl,%8 - jz %%drawa2m - mov [edi+4],bl -%%drawa2m - test bh,%8 - jz %%drawb2m - mov [edi+5],bh -%%drawb2m - shr ebx,16 - test bl,%8 - jz %%drawc2m - mov [edi+6],bl -%%drawc2m - test bh,%8 - jz %%drawd2m - mov [edi+7],bh -%%drawd2m - add ecx,8 - sub edi,288 - dec dword[tleftnb] - jnz %%nextbm - add edi,288 - jmp %5 -%%flipxypart - mov dword[tleftnb],8 -%%nextbfm - mov ebx,[ecx] - or ebx,ebx - jz %%drawdfm - add ebx,edx - test bl,%8 - jz %%drawafm - mov [edi+7],bl -%%drawafm - test bh,%8 - jz %%drawbfm - mov [edi+6],bh -%%drawbfm - shr ebx,16 - test bl,%8 - jz %%drawcfm - mov [edi+5],bl -%%drawcfm - test bh,%8 - jz %%drawdfm - mov [edi+4],bh -%%drawdfm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2fm - add ebx,edx - test bl,%8 - jz %%drawa2fm - mov [edi+3],bl -%%drawa2fm - test bh,%8 - jz %%drawb2fm - mov [edi+2],bh -%%drawb2fm - shr ebx,16 - test bl,%8 - jz %%drawc2fm - mov [edi+1],bl -%%drawc2fm - test bh,%8 - jz %%drawd2fm - mov [edi],bh -%%drawd2fm - add ecx,8 - sub edi,288 - dec dword[tleftnb] - jnz %%nextbfm - add edi,288 -%5 - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - add edi,8 - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawtileng16x16 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %%done - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - push eax - mov ebx,[ecx] - mov eax,[ecx+4] - add ebx,edx - add eax,edx - mov [edi],ebx - mov [edi+4],eax - mov ebx,[ecx+8] - mov eax,[ecx+12] - add ebx,edx - add eax,edx - mov [edi+288],ebx - mov [edi+288+4],eax - mov ebx,[ecx+16] - mov eax,[ecx+20] - add ebx,edx - add eax,edx - mov [edi+288*2],ebx - mov [edi+288*2+4],eax - mov ebx,[ecx+24] - mov eax,[ecx+28] - add ebx,edx - add eax,edx - mov [edi+288*3],ebx - mov [edi+288*3+4],eax - mov ebx,[ecx+32] - mov eax,[ecx+36] - add ebx,edx - add eax,edx - mov [edi+288*4],ebx - mov [edi+288*4+4],eax - mov ebx,[ecx+40] - mov eax,[ecx+44] - add ebx,edx - add eax,edx - mov [edi+288*5],ebx - mov [edi+288*5+4],eax - mov ebx,[ecx+48] - mov eax,[ecx+52] - add ebx,edx - add eax,edx - mov [edi+288*6],ebx - mov [edi+288*6+4],eax - mov ebx,[ecx+56] - mov eax,[ecx+60] - add ebx,edx - add eax,edx - mov [edi+288*7],ebx - mov [edi+288*7+4],eax - pop eax - jmp %%done -%%flipxfull - push eax - mov ebx,[ecx+4] - mov eax,[ecx] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi],ebx - mov [edi+4],eax - mov ebx,[ecx+12] - mov eax,[ecx+8] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288],ebx - mov [edi+288+4],eax - mov ebx,[ecx+20] - mov eax,[ecx+16] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*2],ebx - mov [edi+288*2+4],eax - mov ebx,[ecx+28] - mov eax,[ecx+24] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*3],ebx - mov [edi+288*3+4],eax - mov ebx,[ecx+36] - mov eax,[ecx+32] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*4],ebx - mov [edi+288*4+4],eax - mov ebx,[ecx+44] - mov eax,[ecx+40] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*5],ebx - mov [edi+288*5+4],eax - mov ebx,[ecx+52] - mov eax,[ecx+48] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*6],ebx - mov [edi+288*6+4],eax - mov ebx,[ecx+60] - mov eax,[ecx+56] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*7],ebx - mov [edi+288*7+4],eax - pop eax - jmp %%done -%%flipyfull - test word[vrama+eax],4000h - jnz near %%flipxyfull - push eax - mov ebx,[ecx] - mov eax,[ecx+4] - add ebx,edx - add eax,edx - mov [edi+288*7],ebx - mov [edi+288*7+4],eax - mov ebx,[ecx+8] - mov eax,[ecx+12] - add ebx,edx - add eax,edx - mov [edi+288*6],ebx - mov [edi+288*6+4],eax - mov ebx,[ecx+16] - mov eax,[ecx+20] - add ebx,edx - add eax,edx - mov [edi+288*5],ebx - mov [edi+288*5+4],eax - mov ebx,[ecx+24] - mov eax,[ecx+28] - add ebx,edx - add eax,edx - mov [edi+288*4],ebx - mov [edi+288*4+4],eax - mov ebx,[ecx+32] - mov eax,[ecx+36] - add ebx,edx - add eax,edx - mov [edi+288*3],ebx - mov [edi+288*3+4],eax - mov ebx,[ecx+40] - mov eax,[ecx+44] - add ebx,edx - add eax,edx - mov [edi+288*2],ebx - mov [edi+288*2+4],eax - mov ebx,[ecx+48] - mov eax,[ecx+52] - add ebx,edx - add eax,edx - mov [edi+288],ebx - mov [edi+288+4],eax - mov ebx,[ecx+56] - mov eax,[ecx+60] - add ebx,edx - add eax,edx - mov [edi],ebx - mov [edi+4],eax - pop eax - jmp %%done -%%flipxyfull - push eax - mov ebx,[ecx+4] - mov eax,[ecx] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*7],ebx - mov [edi+288*7+4],eax - mov ebx,[ecx+12] - mov eax,[ecx+8] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*6],ebx - mov [edi+288*6+4],eax - mov ebx,[ecx+20] - mov eax,[ecx+16] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*5],ebx - mov [edi+288*5+4],eax - mov ebx,[ecx+28] - mov eax,[ecx+24] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*4],ebx - mov [edi+288*4+4],eax - mov ebx,[ecx+36] - mov eax,[ecx+32] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*3],ebx - mov [edi+288*3+4],eax - mov ebx,[ecx+44] - mov eax,[ecx+40] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288*2],ebx - mov [edi+288*2+4],eax - mov ebx,[ecx+52] - mov eax,[ecx+48] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi+288],ebx - mov [edi+288+4],eax - mov ebx,[ecx+60] - mov eax,[ecx+56] - bswap ebx - bswap eax - add ebx,edx - add eax,edx - mov [edi],ebx - mov [edi+4],eax - pop eax - jmp %%done -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - mov dword[tleftnb],8 -%%nextb - mov ebx,[ecx] - or ebx,ebx - jz %%drawd - add ebx,edx - test bl,%8 - jz %%drawa - mov [edi],bl -%%drawa - test bh,%8 - jz %%drawb - mov [edi+1],bh -%%drawb - shr ebx,16 - test bl,%8 - jz %%drawc - mov [edi+2],bl -%%drawc - test bh,%8 - jz %%drawd - mov [edi+3],bh -%%drawd - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2 - add ebx,edx - test bl,%8 - jz %%drawa2 - mov [edi+4],bl -%%drawa2 - test bh,%8 - jz %%drawb2 - mov [edi+5],bh -%%drawb2 - shr ebx,16 - test bl,%8 - jz %%drawc2 - mov [edi+6],bl -%%drawc2 - test bh,%8 - jz %%drawd2 - mov [edi+7],bh -%%drawd2 - add ecx,8 - add edi,288 - dec dword[tleftnb] - jnz %%nextb - sub edi,288*8 - jmp %%done -%%flipxpart - mov dword[tleftnb],8 -%%nextbf - mov ebx,[ecx] - or ebx,ebx - jz %%drawdf - add ebx,edx - test bl,%8 - jz %%drawaf - mov [edi+7],bl -%%drawaf - test bh,%8 - jz %%drawbf - mov [edi+6],bh -%%drawbf - shr ebx,16 - test bl,%8 - jz %%drawcf - mov [edi+5],bl -%%drawcf - test bh,%8 - jz %%drawdf - mov [edi+4],bh -%%drawdf - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2f - add ebx,edx - test bl,%8 - jz %%drawa2f - mov [edi+3],bl -%%drawa2f - test bh,%8 - jz %%drawb2f - mov [edi+2],bh -%%drawb2f - shr ebx,16 - test bl,%8 - jz %%drawc2f - mov [edi+1],bl -%%drawc2f - test bh,%8 - jz %%drawd2f - mov [edi],bh -%%drawd2f - add ecx,8 - add edi,288 - dec dword[tleftnb] - jnz %%nextbf - sub edi,288*8 - jmp %%done -%%flipypart - add edi,288*7 - test word[vrama+eax],4000h - jnz near %%flipxypart - mov dword[tleftnb],8 -%%nextbm - mov ebx,[ecx] - or ebx,ebx - jz %%drawdm - add ebx,edx - test bl,%8 - jz %%drawam - mov [edi],bl -%%drawam - test bh,%8 - jz %%drawbm - mov [edi+1],bh -%%drawbm - shr ebx,16 - test bl,%8 - jz %%drawcm - mov [edi+2],bl -%%drawcm - test bh,%8 - jz %%drawdm - mov [edi+3],bh -%%drawdm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2m - add ebx,edx - test bl,%8 - jz %%drawa2m - mov [edi+4],bl -%%drawa2m - test bh,%8 - jz %%drawb2m - mov [edi+5],bh -%%drawb2m - shr ebx,16 - test bl,%8 - jz %%drawc2m - mov [edi+6],bl -%%drawc2m - test bh,%8 - jz %%drawd2m - mov [edi+7],bh -%%drawd2m - add ecx,8 - sub edi,288 - dec dword[tleftnb] - jnz %%nextbm - add edi,288 - jmp %%done -%%flipxypart - mov dword[tleftnb],8 -%%nextbfm - mov ebx,[ecx] - or ebx,ebx - jz %%drawdfm - add ebx,edx - test bl,%8 - jz %%drawafm - mov [edi+7],bl -%%drawafm - test bh,%8 - jz %%drawbfm - mov [edi+6],bh -%%drawbfm - shr ebx,16 - test bl,%8 - jz %%drawcfm - mov [edi+5],bl -%%drawcfm - test bh,%8 - jz %%drawdfm - mov [edi+4],bh -%%drawdfm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2fm - add ebx,edx - test bl,%8 - jz %%drawa2fm - mov [edi+3],bl -%%drawa2fm - test bh,%8 - jz %%drawb2fm - mov [edi+2],bh -%%drawb2fm - shr ebx,16 - test bl,%8 - jz %%drawc2fm - mov [edi+1],bl -%%drawc2fm - test bh,%8 - jz %%drawd2fm - mov [edi],bh -%%drawd2fm - add ecx,8 - sub edi,288 - dec dword[tleftnb] - jnz %%nextbfm - add edi,288 -%%done - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,8 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - ret -%5 - add edi,16 - jmp %%ntile -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro ProcessBuildWindow 1 - mov dword[ngwinen],0 - test byte[winbg1enval+ebx+%1*256],0Ah - jz %%nowindowing - push eax - push ebx - mov al,[winlogicaval+ebx*2] - shr al,%1*2 - and al,03h - mov [nglogicval],al - mov eax,ebx - add ebx,%1*256 - call BuildWindow - mov eax,edi - sub eax,esi - cmp dword[ngwintable],0 - jne %%notzero - sub [ngwintable+4],eax - jmp %%done -%%notzero - sub [ngwintable],eax -%%done - pop ebx - pop eax -%%nowindowing -%endmacro - -%macro drawbgtileng 2 - mov dword[ng16bprval],0 - mov dword[ng16bbgval],%1 - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16 - push ebx - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,100h - jz .noyinc - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc - lea ecx,[ecx*8] - and ecx,07C0h ; 1Fh*40h - add eax,ecx - mov ecx,[BG1SXl+ebx*2+%1*512] - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,100h - jz .noxinc - add eax,edx - neg dx -.noxinc - mov edi,ecx - sub dx,64 - and ecx,0F8h - and eax,0FFFFh - shr ecx,2 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,07h - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - cmp dl,2 - jne near .no4bit - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawtileng4b -.no4bit - cmp dl,1 - jne near .no2bit - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode0 - mov ebx,[mode0ads] - mov [mode0add],ebx -.nomode0 - jmp drawtileng2b -.no2bit - cmp dl,3 - jne near .no8bit - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawtileng8b -.no8bit - pop ebx - ret - -.tiles16x16 - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy - push ebx - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,200h - jz .noyinc2 - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc2 - lea ecx,[ecx*4] - and ecx,07C0h ; 1Fh*40h - add eax,ecx - mov ecx,[BG1SXl+ebx*2+%1*512] - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,200h - jz .noxinc2 - add eax,edx - neg dx -.noxinc2 - mov edi,ecx - sub dx,64 - and ecx,1F0h - and eax,0FFFFh - shr ecx,3 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,0Fh - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - cmp dl,2 - jne near .no4bit2 - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawtileng16x164b -.no4bit2 - cmp dl,1 - jne near .no2bit2 - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode02 - mov ebx,[mode0ads] - mov [mode0add],ebx -.nomode02 - jmp drawtileng16x162b -.no2bit2 - cmp dl,3 - jne near .no8bit - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawtileng16x168b -.no8bit2 - pop ebx - ret -%endmacro - -%macro drawbgtilengpr1 2 - mov dword[ng16bprval],2000h - mov dword[ng16bbgval],%1 - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16 - push ebx - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - cmp dl,2 - jne near .no4bit - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawtileng4b -.no4bit - cmp dl,1 - jne near .no2bit - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode0 - mov ebx,[mode0ads] - mov [mode0add],ebx -.nomode0 - jmp drawtileng2b -.no2bit - cmp dl,3 - jne near .no8bit - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawtileng8b -.no8bit - pop ebx - ret -.tiles16x16 - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - mov dword[taddnfy16x16],0 - add ecx,ebx - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy - push ebx - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - cmp dl,2 - jne near .no4bit2 - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawtileng16x164b -.no4bit2 - cmp dl,1 - jne near .no2bit2 - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode02 - mov ebx,[mode0ads] - mov [mode0add],ebx -.nomode02 - jmp drawtileng16x162b -.no2bit2 - cmp dl,3 - jne near .no8bit2 - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawtileng16x168b -.no8bit2 - pop ebx - ret -%endmacro - -%macro drawlineng 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfull - add ecx,[yposng] - test dword[vrama+eax],4000h - jnz near %%flipxfull - mov ebx,[ecx] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipxfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipyfull - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxyfull - mov ebx,[ecx] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipxyfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - add ecx,[yposng] - test word[vrama+eax],4000h - jnz near %%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawd - add ebx,edx - test bl,%8 - jz %%drawa - mov [edi],bl -%%drawa - test bh,%8 - jz %%drawb - mov [edi+1],bh -%%drawb - shr ebx,16 - test bl,%8 - jz %%drawc - mov [edi+2],bl -%%drawc - test bh,%8 - jz %%drawd - mov [edi+3],bh -%%drawd - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2 - add ebx,edx - test bl,%8 - jz %%drawa2 - mov [edi+4],bl -%%drawa2 - test bh,%8 - jz %%drawb2 - mov [edi+5],bh -%%drawb2 - shr ebx,16 - test bl,%8 - jz %%drawc2 - mov [edi+6],bl -%%drawc2 - test bh,%8 - jz %%drawd2 - mov [edi+7],bh -%%drawd2 - jmp %5 - -%%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdf - add ebx,edx - test bl,%8 - jz %%drawaf - mov [edi+7],bl -%%drawaf - test bh,%8 - jz %%drawbf - mov [edi+6],bh -%%drawbf - shr ebx,16 - test bl,%8 - jz %%drawcf - mov [edi+5],bl -%%drawcf - test bh,%8 - jz %%drawdf - mov [edi+4],bh -%%drawdf - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2f - add ebx,edx - test bl,%8 - jz %%drawa2f - mov [edi+3],bl -%%drawa2f - test bh,%8 - jz %%drawb2f - mov [edi+2],bh -%%drawb2f - shr ebx,16 - test bl,%8 - jz %%drawc2f - mov [edi+1],bl -%%drawc2f - test bh,%8 - jz %%drawd2f - mov [edi],bh -%%drawd2f - jmp %5 - -%%flipypart - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdm - add ebx,edx - test bl,%8 - jz %%drawam - mov [edi],bl -%%drawam - test bh,%8 - jz %%drawbm - mov [edi+1],bh -%%drawbm - shr ebx,16 - test bl,%8 - jz %%drawcm - mov [edi+2],bl -%%drawcm - test bh,%8 - jz %%drawdm - mov [edi+3],bh -%%drawdm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2m - add ebx,edx - test bl,%8 - jz %%drawa2m - mov [edi+4],bl -%%drawa2m - test bh,%8 - jz %%drawb2m - mov [edi+5],bh -%%drawb2m - shr ebx,16 - test bl,%8 - jz %%drawc2m - mov [edi+6],bl -%%drawc2m - test bh,%8 - jz %%drawd2m - mov [edi+7],bh -%%drawd2m - jmp %5 - -%%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdfm - add ebx,edx - test bl,%8 - jz %%drawafm - mov [edi+7],bl -%%drawafm - test bh,%8 - jz %%drawbfm - mov [edi+6],bh -%%drawbfm - shr ebx,16 - test bl,%8 - jz %%drawcfm - mov [edi+5],bl -%%drawcfm - test bh,%8 - jz %%drawdfm - mov [edi+4],bh -%%drawdfm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2fm - add ebx,edx - test bl,%8 - jz %%drawa2fm - mov [edi+3],bl -%%drawa2fm - test bh,%8 - jz %%drawb2fm - mov [edi+2],bh -%%drawb2fm - shr ebx,16 - test bl,%8 - jz %%drawc2fm - mov [edi+1],bl -%%drawc2fm - test bh,%8 - jz %%drawd2fm - mov [edi],bh -%%drawd2fm -%5 - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - add edi,8 - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawlineng16x16 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %%done - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfull - add ecx,[yposng] - test dword[vrama+eax],4000h - jnz near %%flipxfull - mov ebx,[ecx] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+4],ebx - jmp %%done -%%flipxfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+4],ebx - jmp %%done -%%flipyfull - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxyfull - mov ebx,[ecx] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+4],ebx - jmp %%done -%%flipxyfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+4],ebx - jmp %%done -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - add ecx,[yposng] - test word[vrama+eax],4000h - jnz near %%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawd - add ebx,edx - test bl,%8 - jz %%drawa - mov [edi],bl -%%drawa - test bh,%8 - jz %%drawb - mov [edi+1],bh -%%drawb - shr ebx,16 - test bl,%8 - jz %%drawc - mov [edi+2],bl -%%drawc - test bh,%8 - jz %%drawd - mov [edi+3],bh -%%drawd - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2 - add ebx,edx - test bl,%8 - jz %%drawa2 - mov [edi+4],bl -%%drawa2 - test bh,%8 - jz %%drawb2 - mov [edi+5],bh -%%drawb2 - shr ebx,16 - test bl,%8 - jz %%drawc2 - mov [edi+6],bl -%%drawc2 - test bh,%8 - jz %%drawd2 - mov [edi+7],bh -%%drawd2 - jmp %%done - -%%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdf - add ebx,edx - test bl,%8 - jz %%drawaf - mov [edi+7],bl -%%drawaf - test bh,%8 - jz %%drawbf - mov [edi+6],bh -%%drawbf - shr ebx,16 - test bl,%8 - jz %%drawcf - mov [edi+5],bl -%%drawcf - test bh,%8 - jz %%drawdf - mov [edi+4],bh -%%drawdf - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2f - add ebx,edx - test bl,%8 - jz %%drawa2f - mov [edi+3],bl -%%drawa2f - test bh,%8 - jz %%drawb2f - mov [edi+2],bh -%%drawb2f - shr ebx,16 - test bl,%8 - jz %%drawc2f - mov [edi+1],bl -%%drawc2f - test bh,%8 - jz %%drawd2f - mov [edi],bh -%%drawd2f - jmp %%done - -%%flipypart - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdm - add ebx,edx - test bl,%8 - jz %%drawam - mov [edi],bl -%%drawam - test bh,%8 - jz %%drawbm - mov [edi+1],bh -%%drawbm - shr ebx,16 - test bl,%8 - jz %%drawcm - mov [edi+2],bl -%%drawcm - test bh,%8 - jz %%drawdm - mov [edi+3],bh -%%drawdm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2m - add ebx,edx - test bl,%8 - jz %%drawa2m - mov [edi+4],bl -%%drawa2m - test bh,%8 - jz %%drawb2m - mov [edi+5],bh -%%drawb2m - shr ebx,16 - test bl,%8 - jz %%drawc2m - mov [edi+6],bl -%%drawc2m - test bh,%8 - jz %%drawd2m - mov [edi+7],bh -%%drawd2m - jmp %%done - -%%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdfm - add ebx,edx - test bl,%8 - jz %%drawafm - mov [edi+7],bl -%%drawafm - test bh,%8 - jz %%drawbfm - mov [edi+6],bh -%%drawbfm - shr ebx,16 - test bl,%8 - jz %%drawcfm - mov [edi+5],bl -%%drawcfm - test bh,%8 - jz %%drawdfm - mov [edi+4],bh -%%drawdfm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2fm - add ebx,edx - test bl,%8 - jz %%drawa2fm - mov [edi+3],bl -%%drawa2fm - test bh,%8 - jz %%drawb2fm - mov [edi+2],bh -%%drawb2fm - shr ebx,16 - test bl,%8 - jz %%drawc2fm - mov [edi+1],bl -%%drawc2fm - test bh,%8 - jz %%drawd2fm - mov [edi],bh -%%drawd2fm -%%done - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,8 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -%5 - add edi,16 - jmp %%ntile -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawbglineng 2 - mov dword[ng16bprval],0 - mov dword[ng16bbgval],%1 - cmp byte[bgmode],5 - jb %%nointerl - test byte[intrlng+ebx],01h - jz %%nointerl - add ecx,ebx - add ecx,[cfieldad] -%%nointerl - push ebx - mov byte[curmosaicsz],1 - xor eax,eax - test byte[mosenng+ebx],1 << %1 - jz %%nomosaic - mov al,[mosszng+ebx] - or al,al - jz %%nomosaic - inc al - mov [curmosaicsz],al - mov cl,al - mov al,bl - div cl - mul cl - mov ebx,eax - mov [pesimpng],esi - mov edi,xtravbuf+16 - mov ecx,64 - xor eax,eax - mov esi,xtravbuf+16 - rep stosd - or ebx,ebx - jnz %%nozeroline - inc ebx -%%nozeroline - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - add ecx,ebx - jmp %%yesmosaic -%%nomosaic - cmp byte[BGMA+ebx],5 - jae near .tiles16x8 -%%yesmosaic - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16 - cmp byte[osm2dis],1 - je .nooffsetm - cmp byte[BGMA+ebx],2 - je near .offsetm - cmp byte[bgmode],4 - je .nooffsetm - cmp byte[BGMA+ebx],4 - je near .offsetm -.nooffsetm - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,100h - jz .noyinc - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc - lea ecx,[ecx*8] - mov edx,ecx - and ecx,07C0h ; 1Fh*40h - and edx,38h - add eax,ecx - mov [yposng],edx - xor edx,38h - mov ecx,[BG1SXl+ebx*2+%1*512] - mov [flipyposng],edx - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,100h - jz .noxinc - add eax,edx - neg dx -.noxinc - mov edi,ecx - sub dx,64 - and ecx,0F8h - and eax,0FFFFh - shr ecx,2 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,07h - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - cmp dl,2 - jne near .no4bit - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawlineng4b -.no4bit - cmp dl,1 - jne near .no2bit - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode0 - mov ebx,[mode0ads] - mov [mode0add],ebx -.nomode0 - jmp drawlineng2b -.no2bit - cmp dl,3 - jne near .no8bit - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawlineng8b -.no8bit - pop ebx - ret - -.tiles16x16 - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,200h - jz .noyinc2 - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc2 - lea edx,[ecx*8] - lea ecx,[ecx*4] - and edx,38h - and ecx,07C0h ; 1Fh*40h - mov [yposng],edx - xor edx,38h - add eax,ecx - mov [flipyposng],edx - mov ecx,[BG1SXl+ebx*2+%1*512] - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,200h - jz .noxinc2 - add eax,edx - neg dx -.noxinc2 - mov edi,ecx - sub dx,64 - and ecx,1F0h - and eax,0FFFFh - shr ecx,3 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,0Fh - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - cmp dl,2 - jne near .no4bit2 - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawlineng16x164b -.no4bit2 - cmp dl,1 - jne near .no2bit2 - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode02 - mov ebx,[mode0ads] - mov [mode0add],ebx -.nomode02 - jmp drawlineng16x162b -.no2bit2 - cmp dl,3 - jne near .no8bit - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawlineng16x168b -.no8bit2 - pop ebx - ret - -.tiles16x8 - cmp byte[t16x161+ebx+%1*256],1 - je .tiles16x16hr - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],0 - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,100h - jz .noyinc2c - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc2c - lea ecx,[ecx*8] - mov edx,ecx - and ecx,07C0h ; 1Fh*40h - and edx,38h - jmp .tiles16x8hr -.tiles16x16hr - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy2 - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy2 - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,200h - jz .noyinc2b - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc2b - lea edx,[ecx*8] - lea ecx,[ecx*4] - and edx,38h - and ecx,07C0h ; 1Fh*40h -.tiles16x8hr - mov [yposng],edx - xor edx,38h - add eax,ecx - mov [flipyposng],edx - mov ecx,[BG1SXl+ebx*2+%1*512] - add ecx,ecx - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,200h - jz .noxinc2b - add eax,edx - neg dx -.noxinc2b - mov edi,ecx - sub dx,64 - and ecx,01F0h - and eax,0FFFFh - shr ecx,3 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,0Fh - and edx,07h - and ecx,0FFFFh - shr edi,1 - mov edx,[colormodedef+edx*4+%1] - neg edi - cmp dl,2 - jne near .no4bit2b - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[cbgval],%1 - jmp drawlineng16x84b -.no4bit2b - cmp dl,1 - jne near .no2bit2b - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - mov dword[cbgval],%1 - jmp drawlineng16x82b -.no2bit2b - pop ebx - ret - - ; Offsetmode calculation : *1024+*32+ -.offsetm - xor edx,edx - mov dx,[BG3SYl+ebx*2] -; and dx,0F8h - shr edx,3 - shl edx,6 - xor eax,eax - mov ax,[BGPT3+ebx*2] - add ax,dx - xor edx,edx - mov dx,[BG3SXl+ebx*2] - and dx,0F8h - mov [ofsmcyps],ebx - shr edx,3 - shl edx,1 - add ax,dx - mov dx,[bg3scrolx] - test dx,8000h - jz .nooma - and dx,0F000h - shr dx,5 - add ax,dx -.nooma -; cmp byte[BGMA+ebx],4 -; je .offsetm4 - add eax,40h -;.offsetm4 - mov edx,eax - and edx,0FFFFFFC0h - add edx,[vram] - mov [ofsmcptr],edx - and eax,3Fh - mov [ofsmcptr2],eax - mov eax,[BGPT1Y+ebx*2+%1*512] - mov [ofsmady],eax - mov eax,[BGPT1X+ebx*2+%1*512] - mov [ofsmadx],eax - mov eax,[BGPT1+ebx*2+%1*512] - mov [ofsmtptr],eax - mov [ofsmtptrs],eax - test ecx,100h - jz .noyincd - add eax,[BGPT1Y+ebx*2+%1*512] -.noyincd - lea ecx,[ecx*8] - mov edx,ecx - and ecx,07C0h ; 1Fh*40h - and edx,38h - add eax,ecx - mov [yposng],edx - mov [yposngom],edx - xor edx,38h - mov ecx,[BG1SXl+ebx*2+%1*512] - mov [flipyposng],edx - mov [flipyposngom],edx - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,100h - jz .noxincd - add eax,edx - add [ofsmtptr],edx - neg dx -.noxincd - mov edi,ecx - sub dx,64 - and ecx,0F8h - and eax,0FFFFh - shr ecx,2 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - add [ofsmtptr],ecx - mov [ofsmmptr],eax - - mov word[bgtxadd2],0 - cmp word[BGPT3X+ebx*2],0 - je .yesoverfl - mov cx,[BG3SXl+ebx*2] - add cx,16 - test cx,100h - jz .notoverfl - add dword[ofsmcptr],800h - sub word[bgtxadd2],800h - jmp .yesoverfl -.notoverfl - add word[bgtxadd2],800h -.yesoverfl - - mov dword[ofshvaladd],0 - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,07h - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - cmp dl,2 - jne near .no4bitd - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[ofsmval],2000h << %1 - mov dword[ofsmvalh],2000h << %1 - mov dword[cbgval],%1 - ProcessBuildWindow %1 - jmp drawlinengom4b -.no4bitd - cmp dl,1 - jne near .no2bitdn - ; eax = pointer to beginning of tile area - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - mov byte[tleftn],33 -.loopdn - mov cx,[vrama+eax] - test cx,2000h - jnz near .fintiledn - drawlinengom2 tltype2b, preparet2ba, cachesingle2bng,.loopdn,.fintiledn,ngpalcon2b,test2ba,03h,%1 -.no2bitdn - cmp dl,3 - jne near .no8bitdn - ; eax = pointer to beginning of tile area - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov byte[tleftn],33 -.loopdn2 - mov cx,[vrama+eax] - test cx,2000h - jnz near .fintiledn2 - drawlinengom2 tltype8b, preparet8ba, cachesingle8bng,.loopdn2,.fintiledn2,ngpalcon8b,test8ba,0FFh,%1 -.no8bitdn - pop ebx - ret -%endmacro - -%macro mosender 1 -.nodraw - add edi,%1 - add esi,%1 - dec ecx - jnz .next - pop esi - mov dword[ignor512],0 - ret -%endmacro - -%macro drawbglinengpr1 2 - mov dword[ng16bprval],2000h - mov dword[ng16bbgval],%1 - push ebx - mov byte[curmosaicsz],1 - xor eax,eax - test byte[mosenng+ebx],1 << %1 - jz %%nomosaic - mov al,[mosszng+ebx] - or al,al - jz %%nomosaic - inc al - mov [curmosaicsz],al - mov cl,al - mov al,bl - div cl - mul cl - mov ebx,eax - mov [pesimpng],esi - mov edi,xtravbuf+16 - mov ecx,64 - xor eax,eax - mov esi,xtravbuf+16 - rep stosd - or ebx,ebx - jnz %%nomosaic - inc ebx - jmp %%yesmosaic -%%nomosaic - cmp byte[BGMA+ebx],5 - jae near .tiles16x8 -%%yesmosaic - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16 - cmp byte[osm2dis],1 - je .nooffsetm - cmp byte[BGMA+ebx],2 - je near .offsetm -; cmp byte[BGMA+ebx],4 -; je near .offsetm -.nooffsetm - mov eax,[BG1SYl+ebx*2+%1*512] - and eax,0FFFFh - add eax,ebx - test byte[intrlng+ebx],01h - jz %%nointerl - add eax,ebx - add eax,[cfieldad] -%%nointerl - lea eax,[eax*8] - and eax,38h - mov [yposng],eax - xor eax,38h - mov [flipyposng],eax - - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - cmp dl,2 - jne near .no4bit - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawlineng4b -.no4bit - cmp dl,1 - jne near .no2bit - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode0 - mov ebx,[mode0ads] - mov [mode0add],ebx -.nomode0 - jmp drawlineng2b -.no2bit - cmp dl,3 - jne near .no8bit - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawlineng8b -.no8bit - pop ebx - ret - -.tiles16x16 - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - mov dword[taddnfy16x16],0 - add ecx,ebx - test byte[intrlng+ebx],01h - jz %%nointerl2 - add ecx,ebx - add ecx,[cfieldad] -%%nointerl2 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy - - lea eax,[ecx*8] - and eax,38h - mov [yposng],eax - xor eax,38h - mov [flipyposng],eax - - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - cmp dl,2 - jne near .no4bit2 - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawlineng16x164b -.no4bit2 - cmp dl,1 - jne near .no2bit2 - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode02 - mov ebx,[mode0ads] - mov [mode0add],ebx -.nomode02 - jmp drawlineng16x162b -.no2bit2 - cmp dl,3 - jne near .no8bit2 - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - jmp drawlineng16x168b -.no8bit2 - pop ebx - ret - -.tiles16x8 - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - add ecx,ebx - test byte[intrlng+ebx],01h - jz %%nointerl3 - add ecx,ebx - add ecx,[cfieldad] -%%nointerl3 - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomyb - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomyb - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16hr - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],0 -.tiles16x16hr - - lea eax,[ecx*8] - and eax,38h - mov [yposng],eax - xor eax,38h - mov [flipyposng],eax - - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - cmp dl,2 - jne near .no4bit2b - ; eax = pointer to beginning of tile area - mov dword[cbgval],%1 - jmp drawlineng16x84b -.no4bit2b - cmp dl,1 - jne near .no2bit2b - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - mov dword[cbgval],%1 - jmp drawlineng16x82b -.no2bit2b - pop ebx - ret - -.offsetm - xor edx,edx - mov dx,[BG3SYl+ebx*2] -; and dx,0F8h - shr edx,3 - shl edx,6 - xor eax,eax - mov ax,[BGPT3+ebx*2] - add ax,dx - xor edx,edx - mov dx,[BG3SXl+ebx*2] - and dx,0F8h - mov [ofsmcyps],ebx - shr edx,3 - shl edx,1 - add ax,dx - mov dx,[bg3scrolx] - test dx,8000h - jz .nooma - and dx,0F000h - shr dx,5 - add ax,dx -.nooma - mov edx,eax -; cmp byte[BGMA+ebx],4 -; je .offsetm4 - add edx,40h -;.offsetm4 - and edx,0FFC0h - add edx,[vram] - mov [ofsmcptr],edx - and eax,3Fh - mov [ofsmcptr2],eax - mov eax,[BGPT1Y+ebx*2+%1*512] - mov [ofsmady],eax - mov eax,[BGPT1X+ebx*2+%1*512] - mov [ofsmadx],eax - mov eax,[BGPT1+ebx*2+%1*512] - mov [ofsmtptr],eax - mov [ofsmtptrs],eax - - mov word[bgtxadd2],0 - cmp word[BGPT3X+ebx*2],0 - je .yesoverfl - mov cx,[BG3SXl+ebx*2] - add cx,16 - test cx,100h - jz .notoverfl - add dword[ofsmcptr],800h - sub word[bgtxadd2],800h - jmp .yesoverfl -.notoverfl - add word[bgtxadd2],800h -.yesoverfl - - mov ecx,[BG1SXl+ebx*2+%1*512] - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,100h - jz .noxincdd - add [ofsmtptr],edx -.noxincdd - and ecx,0F8h - shr ecx,2 - add [ofsmtptr],ecx - mov eax,[BG1SYl+ebx*2+%1*512] - and eax,0FFFFh - add eax,ebx - lea eax,[eax*8] - and eax,38h - mov [yposng],eax - mov [yposngom],eax - xor eax,38h - mov [flipyposng],eax - mov [flipyposngom],eax - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - mov [ofsmmptr],eax - mov dword[ofshvaladd],0 - cmp dl,2 - jne near .no4bitd - ; eax = pointer to beginning of tile area - mov dword[ofsmval],2000h << %1 - mov dword[ofsmvalh],2000h << %1 - mov dword[cbgval],%1 - ProcessBuildWindow %1 - jmp drawlinengom4b -.no4bitd - cmp dl,1 - jne near .no2bitdn - ; eax = pointer to beginning of tile area - mov byte[tleftn],33 -.loopdn - mov cx,[vrama+eax] - test cx,2000h - jz near .fintiledn - drawlinengom2 tltype2b, preparet2ba, cachesingle2bng,.loopdn,.fintiledn,ngpalcon2b,test2ba,03h,%1 -.no2bitdn - cmp dl,3 - jne near .no8bitdn - ; eax = pointer to beginning of tile area - mov byte[tleftn],33 -.loopdn2 - mov cx,[vrama+eax] - test cx,2000h - jz near .fintiledn2 - drawlinengom2 tltype8b, preparet8ba, cachesingle8bng,.loopdn2,.fintiledn2,ngpalcon8b,test8ba,0FFh,%1 -.no8bitdn - pop ebx - ret -%endmacro diff --git a/tools/zsnes/src/video/newgfx16.asm b/tools/zsnes/src/video/newgfx16.asm deleted file mode 100644 index 7dad736..0000000 --- a/tools/zsnes/src/video/newgfx16.asm +++ /dev/null @@ -1,3634 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 BG116x16t,BG1SXl,BG1SYl,BG216x16t,BG2SXl,BG2SYl,BG316x16t,BG3PRI,BG3SXl -EXTSYM BG3SYl,BG416x16t,BG4SXl,BG4SYl,BGFB,BGMA,BGMS1,BGOPT1,BGOPT2,BGOPT3 -EXTSYM BGOPT4,BGPT1,BGPT1X,BGPT1Y,BGPT2,BGPT2X,BGPT2Y,BGPT3,BGPT3X,BGPT3Y,BGPT4 -EXTSYM BGPT4X,BGPT4Y,bg1drwng,bg1objptr,bg1ptr,bg1ptrx,bg1ptry,bg1scrolx -EXTSYM bg1scroly,bg1totng,bg2drwng,bg2objptr,bg2ptr,bg2ptrx,bg2ptry,bg2scrolx -EXTSYM bg2scroly,bg2totng,bg3drwng,bg3highst,bg3objptr,bg3ptr,bg3ptrx,bg3ptry -EXTSYM bg3scrolx,bg3scroly,bg3totng,bg4drwng,bg4objptr,bg4ptr,bg4ptrx,bg4ptry -EXTSYM bg4scrolx,bg4scroly,bg4totng,bgcmsung,bgmode,bgtxad,bgtxadd,ngextbg -EXTSYM cachesingle2bng,cachesingle8bng,cfieldad,cgmod,cgram,coladdb,coladdg -EXTSYM coladdr,colleft16b,colormodedef,cpalval,csprbit,csprival,curmosaicsz -EXTSYM curvidoffset,curypos,firstdrawn,flipyposng,forceblnk,interlval,intrlng -EXTSYM mode0add,mode0ads,mode7A,mode7C,mode7X0,mode7ab,mode7cd,mode7set,mode7st -EXTSYM mode7xy,modeused,mosaicon,mosaicsz,mosenng,mosszng,ngceax,ngcedi -EXTSYM ngpalcon2b,ngpalcon8b,ngptrdat,pesimpng,prdata,prdatb,prdatc,prevbright -EXTSYM reslbyl,resolutn,scaddset,scaddtype,scadsng,scadtng,scfbl,scrndis,scrnon -EXTSYM spritetablea,sprleftpr,sprlefttot,sprprdrn,sprpriodata,sprtbng,sprtlng -EXTSYM t16x161,t16x162,t16x163,t16x164,taddfy16x16,taddnfy16x16,ngptrdat2 -EXTSYM tleftn,tltype2b,tltype8b,vcache2b,vcache8b,vidbright,ofshvaladd -EXTSYM vidbuffer,vidmemch2,vidmemch8,vrama,winon,xtravbuf,yposng -EXTSYM vbufdptr,drawtileng2b16b,drawtileng4b16b,drawtileng8b16b,bgwinchange -EXTSYM drawtileng16x162b16b,drawtileng16x164b16b,drawtileng16x168b16b,winbg1en -EXTSYM drawlineng2b16b,drawlineng4b16b,drawlineng8b16b,BuildWindow,winenabs -EXTSYM drawlineng16x162b16b,drawlineng16x164b16b,drawlineng16x168b16b,winenabm -EXTSYM disableeffects,winl1,winbg1enval,winbg1envalm,winlogica,winlogicaval -EXTSYM winboundary,winobjen,winlogicb,nglogicval,ngwintable,winbg2enval,doveg -EXTSYM winbg3enval,winbg4enval,winbgobjenval,Mode7HiRes16b,res640,hiresstuff -EXTSYM Mode7BackA,Mode7BackC,Mode7BackX0,Mode7BackSet,drawmode7win16b,ngwinen -EXTSYM drawlineng16x84b16b,drawlineng16x82b16b,ofsmcyps,vram,ofsmcptr,ofsmady -EXTSYM ofsmadx,ofsmtptr,yposngom,flipyposngom,ofsmmptr,ofsmval,ofsmvalh,V8Mode -EXTSYM cbgval,drawlinengom4b16b,ignor512,winbg1envals,m7starty -EXTSYM FillSubScr,scanlines,drawmode7win16bd,SpecialLine,vidmemch2s,dovegrest -EXTSYM drawlinengom16x164b16b,bgallchange -EXTSYM bg1change,bg2change,bg3change,bg4change,ngwinptr,objwlrpos,objwen -EXTSYM objclineptr,CSprWinPtr,BuildWindow2,NGNumSpr,fulladdtab,MMXSupport -EXTSYM bgtxadd2,gammalevel16b,drawmode7ngextbg16b,processmode7hires16b -EXTSYM processmode7hires16bd,drawmode7ngextbg216b,osm2dis,ofsmtptrs,ofsmcptr2 - -%ifdef __MSDOS__ -EXTSYM smallscreenon,ScreenScale -%endif - -%include "video/vidmacro.mac" -%include "video/newgfx16.mac" -%include "video/newg162.mac" - -; Different routines for: -; Normal (just one screen) -; Transparency -; No Transparency - -; Sub+Main: -; Different Window Modes for each: -; SubWin+MainWin -; Sub+MainWin -; SubWin+Main - -; cgfxmod : -; 0 = No addition whatsoever -; 1 = Addition in the back area only -; 2 = All of subscreen added to all of mainscreen -; 3 = All of subscreen added to specific mainscreens -; 4 = Add+Sub enabled - -SECTION .text - -NEWSYM setpalallng - - mov dword[palchanged],1 - mov byte[cgmod],0 - push esi - push eax - push edx - push ebp - mov esi,[cpalptrng] - mov byte[colleft16b],0 - add esi,1024 - xor ebp,ebp - and esi,255*1024 - mov [cpalptrng],esi - - add esi,[vbufdptr] - -.loopa - mov dx,[cgram+ebp] - mov [prevpal2+ebp],dx - mov ax,dx - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .nogr - mov al,31 -.nogr - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[ngrposng] - xor ebx,ebx - shl ax,cl - add bx,ax - mov ax,dx - shr ax,5 - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .nogg - mov al,31 -.nogg - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[nggposng] - shl ax,cl - add bx,ax - mov ax,dx - shr ax,10 - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .nogb - mov al,31 -.nogb - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[ngbposng] - shl ax,cl - add bx,ax - mov ax,bx - mov [esi],bx ; standard - or bx,[UnusedBit] - mov [esi+512],bx ; standard - add esi,2 - add ebp,2 - inc byte[colleft16b] - jnz near .loopa - mov al,[vidbright] - mov [prevbright],al - pop ebp - pop edx - pop eax - pop esi - xor ecx,ecx - cmp byte[V8Mode],1 - jne .noveg2 - call dovegrest -.noveg2 - ret - -NEWSYM setpalette16bng - cmp byte[V8Mode],1 - jne .noveg - call doveg -.noveg - mov bl,[vidbright] - cmp bl,[prevbright] - jne near setpalallng - cmp byte[cgmod],0 - je near .skipall - push esi - push edi - push eax - push edx - push ebp - mov byte[cgmod],0 - xor ebp,ebp - mov esi,[cpalptrng] - mov edi,esi - add esi,1024 - and esi,255*1024 - mov [cpalptrng],esi - - add esi,[vbufdptr] - add edi,[vbufdptr] - - mov byte[colleft16b],0 - jmp .loopa -.skipa - mov bx,[edi] - mov [esi],bx - mov bx,[edi+512] - mov [esi+512],bx - add edi,2 - add esi,2 - add ebp,2 - inc byte[colleft16b] - jz near .endpal -.loopa - mov dx,[cgram+ebp] - cmp [prevpal2+ebp],dx - je .skipa - mov [prevpal2+ebp],dx - cmp byte[colleft16b],0 - je .notchanged - mov dword[palchanged],1 -.notchanged - mov ax,dx - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .norr - mov al,31 -.norr - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[ngrposng] - xor ebx,ebx - shl ax,cl - add bx,ax - mov ax,dx - shr ax,5 - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .norg - mov al,31 -.norg - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[nggposng] - shl ax,cl - add bx,ax - mov ax,dx - shr ax,10 - and al,01Fh - add al,[gammalevel16b] - cmp al,31 - jbe .norb - mov al,31 -.norb - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[ngbposng] - shl ax,cl - add bx,ax - mov [esi],bx ; standard - or bx,[UnusedBit] - mov [esi+512],bx ; standard - add edi,2 - add esi,2 - add ebp,2 - inc byte[colleft16b] - jnz near .loopa -.endpal - pop ebp - pop edx - pop eax - pop edi - pop esi - xor ecx,ecx -.skipall - cmp byte[V8Mode],1 - jne .noveg2 - call dovegrest -.noveg2 - ret - -section .data -prevpal2 times 256 dw 0F00Fh -section .text - -%macro WinBGCheck 1 - mov bl,[winbg1en+%1] - mov bh,bl - test bl,0Ah - jz %%disable - - test byte[scrnon],1 << %1 - jz %%nomainbg - test byte[scrnon+1],1 << %1 - jnz %%bg - xor bh,bh - jmp %%bg -%%nomainbg - xor bl,bl - test byte[scrnon+1],1 << %1 - jnz %%bg - xor bh,bh - jmp %%skip -%%disable - xor bl,bl - xor bh,bh - jmp %%skip -%%bg - test byte[winenabs],1 << %1 - jnz %%nbgs - xor bh,bh -%%nbgs - test byte[winenabm],1 << %1 - jnz %%nbgm - xor bl,bl -%%nbgm - jmp %%skip - mov cl,bl - or cl,bh - and cl,0Ah - cmp cl,0Ah - je %%skip - mov ch,bl - or ch,bh - mov edx,[winl1] - cmp cl,02h - je %%bg1 - shr ch,2 - shr edx,16 -%%bg1 - test ch,01h - jnz %%outside - cmp dl,dh - jbe %%skip - xor bl,bl - xor bh,bh - jmp %%skip -%%outside - cmp dl,0 - ja %%skip - cmp dh,255 - jb %%skip - xor bl,bl - xor bh,bh -%%skip - mov [winbg1envalm+eax+%1*256],bl - mov [winbg1envals+eax+%1*256],bh - or bl,bh - mov [winbg1enval+eax+%1*256],bl -%endmacro - -%macro WinBGCheckb 1 - mov bl,[winbg1en+%1] - test bl,0Ah - jz %%disable - test byte[scrnon],1 << %1 - jnz %%nbgen - test byte[winenabs],1 << %1 - jnz %%bg - jmp %%disable -%%nbgen - test byte[winenabm],1 << %1 - jnz %%bg -%%disable - xor bl,bl - jmp %%skip -%%bg - mov cl,bl - and cl,0Ah - cmp cl,0Ah - je %%skip -; jne %%notskip -; and bl,03h -; and cl,03h -;%%notskip - mov ch,bl - mov edx,[winl1] - cmp cl,02h - je %%bg1 - shr ch,2 - shr edx,16 -%%bg1 - test ch,01h - jnz %%outside - cmp dl,dh - jbe %%skip - xor bl,bl - jmp %%skip -%%outside - cmp dl,0 - ja %%skip - cmp dh,255 - jb %%skip - xor bl,bl -%%skip - mov [winbg1enval+eax+%1*256],bl - mov [winbg1envalm+eax+%1*256],bl - mov [winbg1envals+eax+%1*256],bl -%endmacro - -%macro WinBGCheck2 1 - mov bl,[winbg1en+%1] - test bl,0Ah - jnz %%nodisable - xor bl,bl - jmp %%skip -%%nodisable - mov cl,bl - or cl,bh - and cl,0Ah - cmp cl,0Ah - je %%skip - mov ch,bl - or ch,bh - mov edx,[winl1] - cmp cl,02h - je %%bg1 - shr ch,2 - shr edx,16 -%%bg1 - test ch,01h - jnz %%outside - cmp dl,dh - jbe %%skip - xor bl,bl - jmp %%skip -%%outside - cmp dl,0 - ja %%skip - cmp dh,255 - jb %%skip - xor bl,bl -%%skip - mov [winbg1enval+eax+%1*256],bl -%endmacro - -section .data -BackAreaAdd dd 0 -BackAreaUnFillCol dd 0 -BackAreaFillCol dd 0 -clinemainsub dd 0 -section .text - -BackAreaFill: - cmp byte[winbg1enval+eax+5*256],0 - je near .nowindowb - mov ebx,[BackAreaFillCol] - cmp ebx,[BackAreaUnFillCol] - je near .nowindowb - push ecx - push edx - push eax - push edi - - mov ebx,eax - mov ecx,[vidbuffer] - add ecx,16*2 - shl eax,9 - add ecx,eax - mov eax,ebx - shl eax,6 - add ecx,eax - add ecx,[BackAreaAdd] - - ; Construct Window in ecx - mov edi,ngwintable - sub ecx,2 - mov eax,256 -.procnotemptyb - mov edx,[edi] - add edi,4 - or edx,edx - jz .procemptyb - dec edx - mov ebx,[BackAreaUnFillCol] -.swloopb - mov [ecx],ebx - mov [ecx+4],ebx - add ecx,8 - sub eax,4 - jc .doneb - sub edx,4 - jnc .swloopb - sub eax,edx - add ecx,edx - add ecx,edx - dec eax - add ecx,2 -.procemptyb - mov edx,[edi] - dec edx - add edi,4 - mov ebx,[BackAreaFillCol] -.swloop2b - mov [ecx],ebx - mov [ecx+4],ebx - add ecx,8 - sub eax,4 - jc .doneb - sub edx,4 - jnc .swloop2b - sub eax,edx - add ecx,edx - add ecx,edx - dec eax - add ecx,2 - jmp .procnotemptyb -.doneb - pop edi - pop eax - pop edx - pop ecx - jmp .yeswindowb -.nowindowb - push eax - push ecx - mov ebx,eax - mov ecx,[vidbuffer] - mov eax,ebx - add ecx,16*2 - shl eax,9 - add ecx,eax - mov eax,ebx - shl eax,6 - add ecx,eax - add ecx,[BackAreaAdd] - mov ebx,[BackAreaUnFillCol] - mov eax,64 -.nowinloop - mov [ecx],ebx - mov [ecx+4],ebx - add ecx,8 - dec eax - jnz .nowinloop - pop ecx - pop eax -.yeswindowb - ret - -NEWSYM newengine16b - ; store line by line data - ; BGMode, BGxScrollX, BGxScrollY, both BGPtrs - mov eax,[curypos] - and eax,0FFh - - cmp eax,1 - jne .noclearcache - push eax - push ecx - mov ebx,vidmemch2s - mov ecx,1024+512+256 - mov eax,0FFFFFFFFh -.loopcc - mov [ebx],eax - add ebx,4 - dec ecx - jnz .loopcc - pop ecx - pop eax - mov dword[startlinet],0 - mov dword[endlinet],255 - xor ebx,ebx -.noclearcache - - mov byte[bgallchange+eax],0 - mov byte[bgallchange+eax+1],0FFh - mov byte[bg1change+eax],0 - mov byte[bg2change+eax],0 - mov byte[bg3change+eax],0 - mov byte[bg4change+eax],0 - mov dword[palchanged],0 - - ; BG3 Priority - test byte[scaddset],2 - jz .noscaddset - or [bgcmsung],ebx -.noscaddset - - mov bl,[bg3highst] - ;cmp byte[bgmode],7 - ;mov bl,1 - ;je .notmode7 -;.notmode7 - mov [BG3PRI+eax],bl - cmp [BG3PRI+eax-1],bl - je .nosbg3pr - mov byte[bgallchange+eax],1 -.nosbg3pr - - mov ebx,[scrnon] - ; clear - push ecx - mov cl,[scrnon] - and cl,1Fh - or cl,20h - and cl,[scaddtype] - and cl,3Fh - mov byte[FillSubScr+eax],1 - or cl,cl - jnz .yessub - xor bh,bh - mov byte[FillSubScr+eax],0 -.yessub - pop ecx - test byte[scaddset],2 - jnz .subscrnon - xor bh,bh -.subscrnon - or [bgcmsung],ebx - mov [BGMS1+eax*2],ebx - cmp [BGMS1+eax*2-2],bx - je .nosbgms1 - mov byte[bgallchange+eax],1 -.nosbgms1 - - ; if palette[0] = 0 and transparency is just add to back area, - ; set ngmsdraw to 1 - mov byte[clinemainsub],0 - cmp word[cgram],0 - jne .ngmsdraw0 - mov bl,[scrnon] - and bl,1Fh - or bl,0E0h - and bl,[scaddtype] - cmp bl,20h - jne .ngmsdraw0 - mov byte[ngmsdraw],1 - mov byte[FillSubScr+eax],0 - mov byte[clinemainsub],1 -.ngmsdraw0 - - ; Scroll Values - mov bx,[bg1scrolx] - mov [BG1SXl+eax*2],bx - cmp [BG1SXl+eax*2-2],bx - je .nosbgx1 - mov byte[bg1change+eax],1 -.nosbgx1 - mov bx,[bg2scrolx] - mov [BG2SXl+eax*2],bx - cmp [BG2SXl+eax*2-2],bx - je .nosbgx2 - mov byte[bg2change+eax],1 -.nosbgx2 - mov bx,[bg3scrolx] - mov [BG3SXl+eax*2],bx - cmp [BG3SXl+eax*2-2],bx - je .nosbgx3 - mov byte[bg3change+eax],1 -.nosbgx3 - mov bx,[bg4scrolx] - mov [BG4SXl+eax*2],bx - cmp [BG4SXl+eax*2-2],bx - je .nosbgx4 - mov byte[bg4change+eax],1 -.nosbgx4 - - mov bx,[bg1scroly] - mov [BG1SYl+eax*2],bx - cmp [BG1SYl+eax*2-2],bx - je .nosbgy1 - mov byte[bg1change+eax],1 -.nosbgy1 - mov bx,[bg2scroly] - mov [BG2SYl+eax*2],bx - cmp [BG2SYl+eax*2-2],bx - je .nosbgy2 - mov byte[bg2change+eax],1 -.nosbgy2 - mov bx,[bg3scroly] - mov [BG3SYl+eax*2],bx - cmp [BG3SYl+eax*2-2],bx - je .nosbgy3 - mov byte[bg3change+eax],1 -.nosbgy3 - mov bx,[bg4scroly] - mov [BG4SYl+eax*2],bx - cmp [BG4SYl+eax*2-2],bx - je .nosbgy4 - mov byte[bg1change+eax],1 -.nosbgy4 - - ; Background Mode - mov bl,[bgmode] - and bl,07h - mov [BGMA+eax],bl - cmp bl,4 - je .changedmode4 - cmp [BGMA+eax-1],bl - je .nobgma -.changedmode4 - mov byte[bgallchange+eax],1 -.nobgma - - ; new graphics fix, thanks to TRAC - and ebx,07h - mov byte[modeused+ebx],1 - - ; Pointer to OBJ tile data - mov ebx,[bg1objptr] - mov [BGOPT1+eax*2],ebx - cmp [BGOPT1+eax*2-2],bx - je .nosbgo1 - mov byte[bg1change+eax],1 -.nosbgo1 - mov ebx,[bg2objptr] - mov [BGOPT2+eax*2],ebx - cmp [BGOPT2+eax*2-2],bx - je .nosbgo2 - mov byte[bg2change+eax],1 -.nosbgo2 - mov ebx,[bg3objptr] - mov [BGOPT3+eax*2],ebx - cmp [BGOPT3+eax*2-2],bx - je .nosbgo3 - mov byte[bg3change+eax],1 -.nosbgo3 - mov ebx,[bg4objptr] - mov [BGOPT4+eax*2],ebx - cmp [BGOPT4+eax*2-2],bx - je .nosbgo4 - mov byte[bg4change+eax],1 -.nosbgo4 - - ; Pointer to tile status data - mov ebx,[bg1ptr] - mov [BGPT1+eax*2],ebx - cmp [BGPT1+eax*2-2],bx - je .nosbgp1 - mov byte[bg1change+eax],1 -.nosbgp1 - mov ebx,[bg2ptr] - mov [BGPT2+eax*2],ebx - cmp [BGPT2+eax*2-2],bx - je .nosbgp2 - mov byte[bg2change+eax],1 -.nosbgp2 - mov ebx,[bg3ptr] - mov [BGPT3+eax*2],ebx - cmp [BGPT3+eax*2-2],bx - je .nosbgp3 - mov byte[bg3change+eax],1 -.nosbgp3 - mov ebx,[bg4ptr] - mov [BGPT4+eax*2],ebx - cmp [BGPT4+eax*2-2],bx - je .nosbgp4 - mov byte[bg4change+eax],1 -.nosbgp4 - - mov ebx,[bg1ptrx] - mov [BGPT1X+eax*2],ebx - cmp [BGPT1X+eax*2-2],bx - je .nosbgpx1 - mov byte[bg1change+eax],1 -.nosbgpx1 - mov ebx,[bg2ptrx] - mov [BGPT2X+eax*2],ebx - cmp [BGPT2X+eax*2-2],bx - je .nosbgpx2 - mov byte[bg2change+eax],1 -.nosbgpx2 - mov ebx,[bg3ptrx] - mov [BGPT3X+eax*2],ebx - cmp [BGPT3X+eax*2-2],bx - je .nosbgpx3 - mov byte[bg3change+eax],1 -.nosbgpx3 - mov ebx,[bg4ptrx] - mov [BGPT4X+eax*2],ebx - cmp [BGPT4X+eax*2-2],bx - je .nosbgpx4 - mov byte[bg4change+eax],1 -.nosbgpx4 - - mov ebx,[bg1ptry] - mov [BGPT1Y+eax*2],ebx - cmp [BGPT1Y+eax*2-2],bx - je .nosbgpy1 - mov byte[bg1change+eax],1 -.nosbgpy1 - mov ebx,[bg2ptry] - mov [BGPT2Y+eax*2],ebx - cmp [BGPT2Y+eax*2-2],bx - je .nosbgpy2 - mov byte[bg2change+eax],1 -.nosbgpy2 - mov ebx,[bg3ptry] - mov [BGPT3Y+eax*2],ebx - cmp [BGPT3Y+eax*2-2],bx - je .nosbgpy3 - mov byte[bg3change+eax],1 -.nosbgpy3 - mov ebx,[bg4ptry] - mov [BGPT4Y+eax*2],ebx - cmp [BGPT4Y+eax*2-2],bx - je .nosbgpy4 - mov byte[bg4change+eax],1 -.nosbgpy4 - mov ebx,[forceblnk] - or bl,bl - jne .dontdraw - mov dword[scfbl],0 -.dontdraw - ; Variable size write error fix [TRAC] - mov [BGFB+eax],bl - cmp [BGFB+eax-1],bl - je .nosbgfb - mov byte[bgallchange+eax],1 -.nosbgfb - - test byte[interlval],40h - jz .nointrl - mov byte[bgallchange+eax],1 -.nointrl - - mov ebx,[mode7A] - mov [mode7ab+eax*4],ebx - mov ebx,[mode7C] - mov [mode7cd+eax*4],ebx - mov ebx,[mode7X0] - mov [mode7xy+eax*4],ebx - mov ebx,[mode7set] - mov [mode7st+eax],ebx - - ; 16x16 tiles - mov ebx,[BG116x16t] - mov [t16x161+eax],ebx - cmp [t16x161+eax-1],bl - je .not16x161 - mov byte[bg1change+eax],1 -.not16x161 - mov ebx,[BG216x16t] - mov [t16x162+eax],ebx - cmp [t16x162+eax-1],bl - je .not16x162 - mov byte[bg2change+eax],1 -.not16x162 - mov ebx,[BG316x16t] - mov [t16x163+eax],ebx - cmp [t16x163+eax-1],bl - je .not16x163 - mov byte[bg3change+eax],1 -.not16x163 - mov ebx,[BG416x16t] - mov [t16x164+eax],ebx - cmp [t16x164+eax-1],bl - je .not16x164 - mov byte[bg4change+eax],1 -.not16x164 - -; mov byte[mode7hr+eax],0 - cmp byte[bgmode],7 - jne .noextbg -; cmp byte[res640],0 -; je .nomode7512 -; mov byte[mode7hr+eax],1 -;.nomode7512 - test byte[interlval],40h - jz .noextbg - mov byte[ngextbg],1 -.noextbg - - ; mosaic - mov ebx,[mosaicon] - mov [mosenng+eax],ebx - mov ebx,[mosaicsz] - mov [mosszng+eax],ebx - - ; Interlaced - mov ebx,[interlval] - mov [intrlng+eax],ebx - - ; Set palette - call setpalette16bng - - cmp dword[palchanged],1 - jne .notpchanged - cmp eax,112 - jae .endl - mov [startlinet],eax - jmp .notpchanged -.endl - cmp dword[endlinet],255 - jb .notpchanged - mov [endlinet],eax -.notpchanged - - mov ebx,[cpalptrng] - add ebx,[vbufdptr] - mov [cpalval+eax*4],ebx - - ; Set Transparency - mov bl,[scaddtype] - mov [scadtng+eax],bl - cmp [scadtng+eax-1],bl - je .noscadt - mov byte[bgallchange+eax],1 -.noscadt - - mov bl,[scaddset] - mov [scadsng+eax],bl - cmp [scadsng+eax-1],bl - je .noscads - mov byte[bgallchange+eax],1 -.noscads - -; Windowing Stuff -;NEWSYM winl1, 0 ; window 1 left position -;NEWSYM winr1, 0 ; window 1 right position -;NEWSYM winl2, 0 ; window 2 left position -;NEWSYM winr2, 0 ; window 2 right position -;NEWSYM winbg1en, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG1 -;NEWSYM winbg2en, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG2 -;NEWSYM winbg3en, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG3 -;NEWSYM winbg4en, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on BG4 -;NEWSYM winobjen, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on sprites -;NEWSYM wincolen, 0 ; Win1 on (IN/OUT) or Win2 on (IN/OUT) on backarea -;NEWSYM winlogica, 0 ; Window logic type for BG1 to 4 -;NEWSYM winlogicb, 0 ; Window logic type for Sprites and Backarea -;NEWSYM winenabm, 0 ; Window logic enable for main screen -;NEWSYM winenabs, 0 ; Window logic enable for sub screen - - mov byte[bgwinchange+eax],0 - cmp byte[disableeffects],1 - je near .finishwin - push ecx - push edx - WinBGCheck 0 - WinBGCheck 1 - WinBGCheck 2 - WinBGCheck 3 - WinBGCheck 4 - WinBGCheck2 5 - - mov ebx,[winlogica] - mov [winlogicaval+eax*2],ebx - cmp [winlogicaval+eax*2-2],bx - je .winnchangedb - mov byte[bgwinchange+eax],1 -.winnchangedb - mov ebx,[winl1] - mov [winboundary+eax*4],ebx - cmp [winboundary+eax*4-4],ebx - je .winnchanged - mov byte[bgwinchange+eax],1 -.winnchanged - - ; generate sprite window - cmp byte[winbg1enval+eax+4*256],0 - je near .skipobjw - - mov ebx,[winl1] - mov dl,[winobjen] - mov dh,[winlogicb] - and dh,03h - ; Same as previous line? - cmp dword[objwlrpos+eax*4-4],0FFFFFFFFh - je .changed - cmp [objwlrpos+eax*4-4],ebx - jne .changedb - cmp [objwen+eax*2-2],dx - je near .notchanged -.changedb - cmp [objwlrpos+eax*4],ebx - jne .changed - cmp [objwen+eax*2],dx - jne .changed - mov ecx,[CSprWinPtr] - cmp [objclineptr+eax*4],ecx - ja near .usecurrent -.changed - mov [objwlrpos+eax*4],ebx - mov [objwen+eax*2],dx - - mov bl,[winlogicb] - and bl,03h - mov [nglogicval],bl - mov ebx,4*256 - add ebx,eax - mov dword[ngwinen],0 - call BuildWindow2 - cmp dword[ngwinen],0 - je near .disablesprwin - mov ecx,[CSprWinPtr] - add ecx,260 - mov [CSprWinPtr],ecx - mov [objclineptr+eax*4],ecx - add ecx,[ngwinptr] - ; Construct Window in ecx - push eax - mov ebx,ngwintable - dec ecx - mov eax,256 -.procnotempty - mov edx,[ebx] - add ebx,4 - or edx,edx - jz .procempty - dec edx -.swloop - mov dword[ecx],0 - add ecx,4 - sub eax,4 - jc .done - sub edx,4 - jnc .swloop - sub eax,edx - add ecx,edx - dec eax - inc ecx -.procempty - mov edx,[ebx] - dec edx - add ebx,4 -.swloop2 - mov dword[ecx],01010101h - add ecx,4 - sub eax,4 - jc .done - sub edx,4 - jnc .swloop2 - sub eax,edx - add ecx,edx - dec eax - inc ecx - jmp .procnotempty -.done - pop eax - jmp .skipobjw -.usecurrent - mov ecx,[objclineptr+eax*4] - mov [CSprWinPtr],ecx - cmp ecx,0FFFFFFFFh - jnz .skipobjw - jmp .disablesprwin - ; copy over if it's the same -.notchanged - mov [objwlrpos+eax*4],ebx - mov [objwen+eax*2],dx - mov ebx,[objclineptr+eax*4-4] - mov [objclineptr+eax*4],ebx - cmp ebx,0FFFFFFFFh - je .disablesprwin -.skipobjw - pop edx - pop ecx - jmp .okaywin -.disablesprwin - mov dword[objclineptr+eax*4],0FFFFFFFFh - mov byte[winbg1enval+eax+4*256],0 - mov byte[winbg1envals+eax+4*256],0 - mov byte[winbg1envalm+eax+4*256],0 - pop edx - pop ecx - jmp .okaywin -.finishwin - mov byte[winbg1enval+eax],0 - mov byte[winbg2enval+eax],0 - mov byte[winbg3enval+eax],0 - mov byte[winbg4enval+eax],0 - mov byte[winbgobjenval+eax],0 -.okaywin - xor ebx,ebx - - mov ebx,[coladdr-1] - mov bl,[vidbright] - cmp [Prevcoladdr],ebx - je .samecolor - mov [Prevcoladdr],ebx - push ecx - push eax - mov al,[coladdr] - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[ngrposng] - xor ebx,ebx - shl ax,cl - add bx,ax - mov al,[coladdg] - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[nggposng] - shl ax,cl - add bx,ax - mov al,[coladdb] - mov cl,[vidbright] - mul cl - mov cl,15 - div cl - xor ah,ah - mov cl,[ngbposng] - shl ax,cl - add bx,ax - mov [ColResult],bx - mov [ColResult+2],bx - pop eax - pop ecx -.samecolor - cmp word[ColResult],0 - je .black - cmp byte[FillSubScr+eax],0 - je .notblack - or byte[FillSubScr+eax],2 - jmp .notblack -.black - cmp byte[scrnon+1],0 - jne .notblack -; mov byte[clinemainsub],1 - test byte[scadtng+eax],40h - jnz .notblack - xor byte[scadtng+eax],1 -; mov byte[FillSubScr+eax],0 -.notblack - - - ; fill back area - ; get back window settings - mov dword[ngwinen],0 - push ecx - push edx - cmp byte[winbg1enval+eax+5*256],0 - je .nowindowb - mov bl,[winlogicb] - shr bl,2 - and bl,03h - mov [nglogicval],bl - mov ebx,5*256 - add ebx,eax - call BuildWindow2 -.nowindowb - mov dword[BackAreaAdd],0 - - cmp byte[clinemainsub],1 - jne near .domainscreen - mov ebx,[ColResult] - or ebx,[UnusedBit] - mov edx,[UnusedBit] - mov cl,[scaddset] -.filledscreen - ; get sub-screen colors - test cl,10h - jnz .inside - test cl,20h - jnz .outside -.insideb - mov [BackAreaUnFillCol],ebx - mov [BackAreaFillCol],ebx - jmp .donesubscreen -.inside - test cl,20h - jnz .filled - mov [BackAreaUnFillCol],edx - mov [BackAreaFillCol],ebx - jmp .donesubscreen -.outside - mov [BackAreaUnFillCol],ebx - mov [BackAreaFillCol],edx - jmp .donesubscreen -.filled - xor ebx,ebx - mov [BackAreaUnFillCol],edx - mov [BackAreaFillCol],edx - jmp .donesubscreen -.domainscreen - mov ebx,[vbufdptr] - add ebx,dword[cpalptrng] - xor edx,edx - mov cx,[ebx] - shl ecx,16 - mov cx,[ebx] - mov ebx,ecx - mov cl,[scaddset] - shr cl,2 - test byte[scaddtype],20h - jz .notaddbackub - or ebx,[UnusedBit] - mov edx,[UnusedBit] -.notaddbackub - jmp .filledscreen -.donesubscreen - cmp dword[ngwinen],0 - jne .nowinsc2 - mov edx,[BackAreaUnFillCol] - mov [BackAreaFillCol],edx -.nowinsc2 - cmp byte[forceblnk],0 - je .notforceblanked - mov dword[BackAreaUnFillCol],0 - mov dword[BackAreaFillCol],0 -.notforceblanked - call BackAreaFill - test byte[FillSubScr+eax],1 - jz near .nosubscreen2 - mov dword[BackAreaAdd],75036*2 - mov ebx,[ColResult] - mov edx,[UnusedBit] - test byte[scaddset],02h - jz .notbackfixed - or ebx,[UnusedBit] -.notbackfixed - mov cl,[scaddset] - ; get sub-screen colors - test cl,10h - jnz .inside2 - test cl,20h - jnz .outside2 -.inside2b - mov [BackAreaUnFillCol],ebx - mov [BackAreaFillCol],ebx - jmp .donesubscreen2 -.inside2 - test cl,20h - jnz .filled2 - mov [BackAreaUnFillCol],edx - mov [BackAreaFillCol],ebx - jmp .donesubscreen2 -.outside2 - mov [BackAreaUnFillCol],ebx - mov [BackAreaFillCol],edx - jmp .donesubscreen2 -.filled2 - xor ebx,ebx - mov [BackAreaUnFillCol],edx - mov [BackAreaFillCol],edx -.donesubscreen2 - cmp dword[ngwinen],0 - jne .nowinsc - mov edx,[BackAreaUnFillCol] - mov [BackAreaFillCol],edx -.nowinsc - call BackAreaFill -.nosubscreen2 - pop edx - pop ecx - - mov byte[SpecialLine+eax],0 -%ifdef __MSDOS__ - cmp byte[smallscreenon],1 - je .nomode7hr - cmp byte[ScreenScale],1 - je .nomode7hr -%endif - cmp byte[scanlines],0 - jne .nomode7hr - cmp byte[bgmode],7 - jb .hrstuff - test byte[interlval],40h - jnz .nomode7hr - cmp byte[Mode7HiRes16b],1 - jne .nomode7hr - jmp .hrstuff -.nomode7hr - jmp .no512 -.hrstuff - cmp byte[res640],0 - je near .no512 - cmp byte[bgmode],5 - jb .no512 - mov byte[SpecialLine+eax],3 - cmp byte[bgmode],7 - je .hires - mov byte[SpecialLine+eax],2 -.hires - mov byte[hiresstuff],1 - push edi - push esi - push eax - push ecx - push eax - mov ebx,eax - mov edi,[vidbuffer] - add edi,16*2 - shl eax,9 - add edi,eax - mov eax,ebx - shl eax,6 - add edi,eax - mov esi,edi - add edi,75036*4 - push esi - mov ecx,128 - rep movsd - pop esi - pop eax - test byte[FillSubScr+eax],1 - jz .nosubscreenhires - add esi,75036*2 - mov edi,esi - add edi,75036*4 - mov ecx,128 - rep movsd -.nosubscreenhires - pop ecx - pop eax - pop esi - pop edi -.no512 - - cmp byte[scanlines],0 - jne .notinterl - test byte[interlval],01h - jz .notinterl - or byte[SpecialLine+eax],4 -.notinterl - - mov ebx,[sprleftpr+eax*4] - cmp ebx,00000001h - je .single - cmp ebx,00000100h - je .single - cmp ebx,00010000h - je .single - cmp ebx,01000000h - je .single - or [sprprdrn],ebx - xor ebx,ebx - ret -.single - or [sprprdrn],ebx - or dword[sprleftpr+eax*4],80000000h - xor ebx,ebx - ret - -section .data -align 32 -NEWSYM ngwinenval, dd 0 -NEWSYM cdrawbuffer, dd 0 -NEWSYM draw16bnng, dd 0 -NEWSYM scaddsngb, dd 0 -NEWSYM scaddtngb, dd 0 -NEWSYM scaddtngbx, dd 0 -NEWSYM prevbcolng, dd 0 -NEWSYM bcolvalng, dd 0 -NEWSYM cebppos, dd 0 -NEWSYM subscreenonng, dd 0 -NEWSYM cdrawmeth, dd 0 -NEWSYM cpalptrng, dd 0 -NEWSYM prevcoladdrng, dd 0 -NEWSYM prevcolvalng, dd 0 -NEWSYM subscrng, dd 0 -NEWSYM ngmsdraw, dd 0 -NEWSYM CMainWinScr, dd 0 -NEWSYM CSubWinScr, dd 0 -NEWSYM Prevcoladdr, dd 0 -NEWSYM ColResult, dd 0 -NEWSYM CPalPtrng, dd 0 -NEWSYM WindowRedraw, dd 0 -NEWSYM mostranspval, dd 0 -NEWSYM mosclineval, dd 0 -NEWSYM startlinet, dd 0 -NEWSYM endlinet, dd 0 -NEWSYM palchanged, dd 0 - -NEWSYM ng16bbgval, dd 0 ; bg # (mov dword[ng16bbgval],%1) -NEWSYM ng16bprval, dd 0 ; 0 = pr0, 2000h = pr1 - -NEWSYM mosjmptab16b, times 15 dd 0 -NEWSYM mosjmptab16bt, times 15 dd 0 -NEWSYM mosjmptab16btms, times 15 dd 0 -NEWSYM mosjmptab16bntms, times 15 dd 0 -section .text - -NEWSYM StartDrawNewGfx16b - push edx - push esi - push edi - push ebp - mov byte[WindowRedraw],1 - sub dword[endlinet],8 - - cmp dword[scfbl],0 - jne near .dontdraw - - ; Sprite Layering : - ; Mode 0/1 - BG4/BG3pr0 * BG4/BG3pr1 * BG2/BG1pr0 * BG2/BG1pr0 * BG3pr1 - ; Mode 2-6 - BG2pr0 * BG1pr0 * BG2pr1 * BG1pr1 * - ; Mode 7 - * BG1pr0 * BG1pr1 * * - - ; Copy data to sprite table - mov ecx,256 - mov eax,[spritetablea] - mov ebx,sprlefttot - mov edi,sprtbng -.loop - mov [edi],eax - add eax,512 - inc ebx - add edi,4 - dec ecx - jnz .loop - - xor eax,eax - mov edi,sprtlng - mov ecx,64 - rep stosd - - mov byte[firstdrawn],1 - mov dword[bg1totng],0 - mov dword[bg2totng],0 - mov dword[bg3totng],0 - mov dword[bg4totng],0 - mov dword[bg1drwng],0 - mov dword[bg2drwng],0 - mov dword[bg3drwng],0 - mov dword[bg4drwng],0 - - cmp byte[ngmsdraw],0 - je near .skipallsub - - mov dword[CMainWinScr],winbg1envals - mov dword[CSubWinScr],winbg1envals - mov dword[subscrng],1 - - ; Draw SubScreens - test byte[scrndis],8h - jnz near .nodobg4s - test dword[bgcmsung],800h - jz near .nodobg4s - mov dword[mode0ads],60606060h - Procbgpr016b 3, drawbg4line16b, drawbg4tile16b, ngsub, 8h -.nodobg4s - test byte[scrndis],4h - jnz near .nodobg3s - test dword[bgcmsung],400h - jz near .nodobg3s - mov dword[mode0ads],40404040h - Procbg3pr016b 2, drawbg3line16b, drawbg3tile16b, ngsub, 4h -.nodobg3s - - ; draw sprites mode 0-1 - test byte[scrndis],10h - jnz near .nosprpra - test dword[modeused],00000101h - jz near .nosprpra - test dword[bgcmsung],1000h - jz near .nosprpra - Procsprng0116b ngsub, 10h -.nosprpra - - test byte[scrndis],8h - jnz near .nodobg4sb - test dword[bgcmsung],800h - jz near .nodobg4sb - mov eax,[bg4totng] - cmp eax,[bg4drwng] - je near .nodobg4sb - mov dword[mode0ads],60606060h - Procbgpr116b 3, drawbg4linepr116b, drawbg4tilepr116b, prdata, ngsub, 8h -.nodobg4sb - test byte[scrndis],4h - jnz near .nodobg3sb - test dword[bgcmsung],400h - jz near .nodobg3sb - mov eax,[bg3totng] - cmp eax,[bg3drwng] - je near .nodobg3sb - mov dword[mode0ads],40404040h - Procbg3pr116b 2, drawbg3linepr116b, drawbg3tilepr116b, prdatc, ngsub, 4h -.nodobg3sb - - ; draw sprites mode 0-1 - test byte[scrndis],10h - jnz near .nosprprb - test dword[modeused],00000101h - jz near .nosprprb - test dword[bgcmsung],1000h - jz near .nosprprb - Procsprng0116b ngsub, 10h -.nosprprb - - test byte[scrndis],2h - jnz near .nodobg2s - test dword[bgcmsung],200h - jz near .nodobg2s - mov dword[mode0ads],20202020h - Procbgpr016b 1, drawbg2line16b, drawbg2tile16b, ngsub, 2h -.nodobg2s - - ; draw mode 7 extbg pr 0 - cmp byte[ngextbg],0 - je near .noextbgsc - test dword[bgcmsung],300h - jz near .noextbgsc - ProcMode7ngextbg16b ngsub, 3h -.noextbgsc - - ; draw sprites mode 2-7 - test byte[scrndis],10h - jnz near .nosprprc - test dword[modeused],01010000h - jnz near .yessprprc - test dword[modeused+4],01010101h - jz near .nosprprc -.yessprprc - test dword[bgcmsung],1000h - jz near .nosprprc - Procsprng23456716b ngsub, 10h -.nosprprc - - test byte[scrndis],1h - jnz near .nodobg1s - test dword[bgcmsung],100h - jz near .nodobg1s - mov dword[mode0ads],00000000h - Procbgpr016b 0, drawbg1line16b, drawbg1tile16b, ngsub, 1h -.nodobg1s - - ; draw mode 7, priority 0 - cmp byte[modeused+7],0 - je near .nomode7 - test dword[bgcmsung],300h - jz near .nomode7 - ProcMode7ng16b ngsub, 1h -.nomode7 - - ; draw sprites mode 0-7 - test byte[scrndis],10h - jnz near .nosprprd - test dword[bgcmsung],1000h - jz near .nosprprd - Procsprng16b ngsub, 10h -.nosprprd - - test byte[scrndis],2h - jnz near .nodobg2sb - test dword[bgcmsung],200h - jz near .nodobg2sb - mov eax,[bg2totng] - cmp eax,[bg2drwng] - je near .nodobg2sb - mov dword[mode0ads],20202020h - Procbgpr116b 1, drawbg2linepr116b, drawbg2tilepr116b, prdata, ngsub, 2h -.nodobg2sb - - ; draw mode 7 extbg pr 1 - cmp byte[ngextbg],0 - je near .noextbgscb - test dword[bgcmsung],300h - jz near .noextbgscb - ProcMode7ngextbg216b ngsub, 2h -.noextbgscb - - ; draw sprites mode 2-7 - test byte[scrndis],10h - jnz near .nosprpre - test dword[modeused],01010000h - jnz near .yessprpre - test dword[modeused+4],01010101h - jz near .nosprpre -.yessprpre - test dword[bgcmsung],1000h - jz near .nosprpre - Procsprng23456716b ngsub, 10h -.nosprpre - - test byte[scrndis],1h - jnz near .nodobg1sb - test dword[bgcmsung],100h - jz near .nodobg1sb - mov eax,[bg1totng] - cmp eax,[bg1drwng] - je near .nodobg1sb - mov dword[mode0ads],00000000h - Procbgpr116b 0, drawbg1linepr116b, drawbg1tilepr116b, prdatb, ngsub, 1h -.nodobg1sb - - ; draw sprites mode 0-7 - test byte[scrndis],10h - jnz near .nosprprf - test dword[bgcmsung],1000h - jz near .nosprprf - Procsprng16b ngsub, 10h -.nosprprf - - test byte[scrndis],4h - jnz near .nodobg3sb2 - cmp byte[modeused+1],0 - je near .nodobg3sb2 - test dword[bgcmsung],400h - jz near .nodobg3sb2 - mov eax,[bg3totng] - cmp eax,[bg3drwng] - je near .nodobg3sb2 - mov dword[mode0ads],40404040h - Procbg3pr1b16b 2, drawbg3linepr116b, drawbg3tilepr116b, prdatc, ngsub, 4h -.nodobg3sb2 - - mov dword[bg1totng],0 - mov dword[bg2totng],0 - mov dword[bg3totng],0 - mov dword[bg4totng],0 - mov dword[bg1drwng],0 - mov dword[bg2drwng],0 - mov dword[bg3drwng],0 - mov dword[bg4drwng],0 - -.skipallsub - mov dword[CMainWinScr],winbg1envalm - mov dword[CSubWinScr],winbg1envals - mov dword[subscrng],0 - - ; Draw MainScreens - test byte[scrndis],8h - jnz near .nodobg4m - test dword[bgcmsung],808h - jz near .nodobg4m - mov dword[mode0ads],60606060h - Procbgpr016b 3, drawbg4line16b, drawbg4tile16b, ngmain, 8h -.nodobg4m - test byte[scrndis],4h - jnz near .nodobg3m - test dword[bgcmsung],404h - jz near .nodobg3m - mov dword[mode0ads],40404040h - Procbg3pr016b 2, drawbg3line16b, drawbg3tile16b, ngmain, 4h -.nodobg3m - - ; draw sprites mode 0-1 - test byte[scrndis],10h - jnz near .nosprprma - test dword[modeused],00000101h - jz near .nosprprma - test dword[bgcmsung],1010h - jz near .nosprprma - Procsprng0116b ngmain, 10h -.nosprprma - - test byte[scrndis],8h - jnz near .nodobg4mb - test dword[bgcmsung],808h - jz near .nodobg4mb - mov eax,[bg4totng] - cmp eax,[bg4drwng] - je near .nodobg4mb - mov dword[mode0ads],60606060h - Procbgpr116b 3, drawbg4linepr116b, drawbg4tilepr116b, prdata, ngmain, 8h -.nodobg4mb - test byte[scrndis],4h - jnz near .nodobg3mb - test dword[bgcmsung],4h - jz near .nodobg3mb - mov eax,[bg3totng] - cmp eax,[bg3drwng] - je near .nodobg3mb - mov dword[mode0ads],40404040h - Procbg3pr116b 2, drawbg3linepr116b, drawbg3tilepr116b, prdatc, ngmain, 4h -.nodobg3mb - - ; draw sprites mode 0-1 - test byte[scrndis],10h - jnz near .nosprprmb - test dword[modeused],00000101h - jz near .nosprprmb - test dword[bgcmsung],1010h - jz near .nosprprmb - Procsprng0116b ngmain, 10h -.nosprprmb - - test byte[scrndis],2h - jnz near .nodobg2m - test dword[bgcmsung],202h - jz near .nodobg2m - mov dword[mode0ads],20202020h - Procbgpr016b 1, drawbg2line16b, drawbg2tile16b, ngmain, 2h -.nodobg2m - - ; draw mode 7 extbg pr 0 - cmp byte[ngextbg],0 - je near .noextbgmn - test dword[bgcmsung],303h - jz near .noextbgmn - ProcMode7ngextbg16b ngmain ,3h -.noextbgmn - - ; draw sprites mode 2-7 - test byte[scrndis],10h - jnz near .nosprprmc - test dword[modeused],01010000h - jnz near .yessprprmc - test dword[modeused+4],01010101h - jz near .nosprprmc -.yessprprmc - test dword[bgcmsung],1010h - jz near .nosprprmc - Procsprng23456716b ngmain ,10h -.nosprprmc - - test byte[scrndis],1h - jnz near .nodobg1m - test dword[bgcmsung],101h - jz near .nodobg1m - mov dword[mode0ads],00000000h - Procbgpr016b 0, drawbg1line16b, drawbg1tile16b, ngmain, 1h -.nodobg1m - - ; draw mode 7, priority 0 - cmp byte[modeused+7],0 - je near .nomode7m - test dword[bgcmsung],101h - jz near .nomode7m - ProcMode7ng16b ngmain ,1h -.nomode7m - - ; draw sprites mode 0-7 - test byte[scrndis],10h - jnz near .nosprprmd - test dword[bgcmsung],1010h - jz near .nosprprmd - Procsprng16b ngmain ,10h -.nosprprmd - - ; draw mode 7 extbg pr 1 - cmp byte[ngextbg],0 - je near .noextbgmn2 - test dword[bgcmsung],303h - jz near .noextbgmn2 - ProcMode7ngextbg216b ngmain ,2h -.noextbgmn2 - - test byte[scrndis],2h - jnz near .nodobg2mb - test dword[bgcmsung],202h - jz near .nodobg2mb - mov eax,[bg2totng] - cmp eax,[bg2drwng] - je near .nodobg2mb - mov dword[mode0ads],20202020h - Procbgpr116b 1, drawbg2linepr116b, drawbg2tilepr116b, prdata, ngmain, 2h -.nodobg2mb - - ; draw sprites mode 2-7 - test byte[scrndis],10h - jnz near .nosprprme - test dword[modeused],01010000h - jnz near .yessprprme - test dword[modeused+4],01010101h - jz near .nosprprme -.yessprprme - test dword[bgcmsung],1010h - jz near .nosprprme - Procsprng23456716b ngmain ,10h -.nosprprme - - test byte[scrndis],1h - jnz near .nodobg1mb - test dword[bgcmsung],101h - jz near .nodobg1mb - mov eax,[bg1totng] - cmp eax,[bg1drwng] - je near .nodobg1mb - mov dword[mode0ads],00000000h - Procbgpr116b 0, drawbg1linepr116b, drawbg1tilepr116b, prdatb, ngmain, 1h -.nodobg1mb - - ; draw sprites mode 0-7 - test byte[scrndis],10h - jnz near .nosprprmf - test dword[bgcmsung],1010h - jz near .nosprprmf - Procsprng16b ngmain, 10h -.nosprprmf - - test byte[scrndis],4h - jnz near .nodobg3mb2 - cmp byte[modeused+1],0 - je near .nodobg3mb2 - test dword[bgcmsung],404h - jz near .nodobg3mb2 - mov eax,[bg3totng] - cmp eax,[bg3drwng] - je near .nodobg3mb2 - mov dword[mode0ads],40404040h - Procbg3pr1b16b 2, drawbg3linepr116b, drawbg3tilepr116b, prdatc, ngmain, 4h -.nodobg3mb2 - call MainScreenClip - call ProcessTransparencies -.dontdraw - xor ebx,ebx - xor ecx,ecx - xor eax,eax - pop ebp - pop edi - pop esi - pop edx - ret - - -NEWSYM domosaicng16b - mov esi,[pesimpng] - xor eax,eax - mov edi,xtravbuf+32 - mov al,[curmosaicsz] - cmp al,16 - ja .notokay - cmp al,1 - jbe .notokay - push esi - push ebx - mov ebx,[mosclineval] - mov cl,[mostranspval] - cmp byte[BGMA+ebx],7 - je .main - test byte[BGMS1+ebx*2],cl - jz .nosubmain - test byte[FillSubScr+ebx],1 - jnz .transpstuff - jmp .main -.nosubmain - test byte[FillSubScr+ebx],1 - jz .main - add esi,75036*2 -.main - pop ebx - jmp [mosjmptab16b+eax*4-8] - pop esi -.notokay - ret -.transpstuff - test byte[BGMS1+ebx*2+1],cl - jnz near .mosaicms - test byte[scadtng+ebx],cl - jz near .main - pop ebx - jmp [mosjmptab16bt+eax*4-8] - pop esi - ret -.mosaicms - test byte[scadtng+ebx],cl - jz near .mosaicmsnt - pop ebx - jmp [mosjmptab16btms+eax*4-8] - pop esi - ret -.mosaicmsnt - pop ebx - jmp [mosjmptab16bntms+eax*4-8] - pop esi - ret - -%macro mosaic2 1 - mov [esi+%1],ax - mov [esi+%1+2],ax -%endmacro -%macro mosaic3 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax -%endmacro -%macro mosaic4 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax -%endmacro -%macro mosaic5 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax -%endmacro -%macro mosaic6 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax -%endmacro -%macro mosaic7 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax -%endmacro -%macro mosaic8 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax - mov [esi+%1+14],ax -%endmacro -%macro mosaic9 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax - mov [esi+%1+14],ax - mov [esi+%1+16],ax -%endmacro -%macro mosaic10 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax - mov [esi+%1+14],ax - mov [esi+%1+16],ax - mov [esi+%1+18],ax -%endmacro -%macro mosaic11 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax - mov [esi+%1+14],ax - mov [esi+%1+16],ax - mov [esi+%1+18],ax - mov [esi+%1+20],ax -%endmacro -%macro mosaic12 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax - mov [esi+%1+14],ax - mov [esi+%1+16],ax - mov [esi+%1+18],ax - mov [esi+%1+20],ax - mov [esi+%1+22],ax -%endmacro -%macro mosaic13 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax - mov [esi+%1+14],ax - mov [esi+%1+16],ax - mov [esi+%1+18],ax - mov [esi+%1+20],ax - mov [esi+%1+22],ax - mov [esi+%1+24],ax -%endmacro -%macro mosaic14 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax - mov [esi+%1+14],ax - mov [esi+%1+16],ax - mov [esi+%1+18],ax - mov [esi+%1+20],ax - mov [esi+%1+22],ax - mov [esi+%1+24],ax - mov [esi+%1+26],ax -%endmacro -%macro mosaic15 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax - mov [esi+%1+14],ax - mov [esi+%1+16],ax - mov [esi+%1+18],ax - mov [esi+%1+20],ax - mov [esi+%1+22],ax - mov [esi+%1+24],ax - mov [esi+%1+26],ax - mov [esi+%1+28],ax -%endmacro -%macro mosaic16 1 - mov [esi+%1],ax - mov [esi+%1+2],ax - mov [esi+%1+4],ax - mov [esi+%1+6],ax - mov [esi+%1+8],ax - mov [esi+%1+10],ax - mov [esi+%1+12],ax - mov [esi+%1+14],ax - mov [esi+%1+16],ax - mov [esi+%1+18],ax - mov [esi+%1+20],ax - mov [esi+%1+22],ax - mov [esi+%1+24],ax - mov [esi+%1+26],ax - mov [esi+%1+28],ax - mov [esi+%1+30],ax -%endmacro - -%macro mosaicproc 3 - mov ecx,%1 -.next - mov ax,[edi] - cmp ax,0FFFFh - je .nodraw - %2 0 - mosender %3 -%endmacro - -%macro mosaicproct 3 - mov ecx,%1 -.next - mov ax,[edi] - cmp ax,0FFFFh - je .nodraw - or ax,[UnusedBit] - %2 0 - mosender %3 -%endmacro - -%macro mosaicprocntms 3 - mov ecx,%1 -.next - mov ax,[edi] - cmp ax,0FFFFh - je near .nodraw - %2 0 - %2 75036*2 - mosender %3 -%endmacro - -%macro mosaicproctms 3 - mov ecx,%1 -.next - mov ax,[edi] - cmp ax,0FFFFh - je near .nodraw - or ax,[UnusedBit] - %2 0 - and ax,[UnusedBit] - %2 75036*2 - mosender %3 -%endmacro - -NEWSYM mosdraw216b - mosaicproc 128,mosaic2,2 -NEWSYM mosdraw316b - mosaicproc 86,mosaic3,3 -NEWSYM mosdraw416b - mosaicproc 64,mosaic4,4 -NEWSYM mosdraw516b - mosaicproc 52,mosaic5,5 -NEWSYM mosdraw616b - mosaicproc 43,mosaic6,6 -NEWSYM mosdraw716b - mosaicproc 37,mosaic7,7 -NEWSYM mosdraw816b - mosaicproc 32,mosaic8,8 -NEWSYM mosdraw916b - mosaicproc 29,mosaic9,9 -NEWSYM mosdraw1016b - mosaicproc 26,mosaic10,10 -NEWSYM mosdraw1116b - mosaicproc 24,mosaic11,11 -NEWSYM mosdraw1216b - mosaicproc 22,mosaic12,12 -NEWSYM mosdraw1316b - mosaicproc 20,mosaic13,13 -NEWSYM mosdraw1416b - mosaicproc 19,mosaic14,14 -NEWSYM mosdraw1516b - mosaicproc 18,mosaic15,15 -NEWSYM mosdraw1616b - mosaicproc 16,mosaic16,16 - -NEWSYM mosdraw216bt - mosaicproct 128,mosaic2,2 -NEWSYM mosdraw316bt - mosaicproct 86,mosaic3,3 -NEWSYM mosdraw416bt - mosaicproct 64,mosaic4,4 -NEWSYM mosdraw516bt - mosaicproct 52,mosaic5,5 -NEWSYM mosdraw616bt - mosaicproct 43,mosaic6,6 -NEWSYM mosdraw716bt - mosaicproct 37,mosaic7,7 -NEWSYM mosdraw816bt - mosaicproct 32,mosaic8,8 -NEWSYM mosdraw916bt - mosaicproct 29,mosaic9,9 -NEWSYM mosdraw1016bt - mosaicproct 26,mosaic10,10 -NEWSYM mosdraw1116bt - mosaicproct 24,mosaic11,11 -NEWSYM mosdraw1216bt - mosaicproct 22,mosaic12,12 -NEWSYM mosdraw1316bt - mosaicproct 20,mosaic13,13 -NEWSYM mosdraw1416bt - mosaicproct 19,mosaic14,14 -NEWSYM mosdraw1516bt - mosaicproct 18,mosaic15,15 -NEWSYM mosdraw1616bt - mosaicproct 16,mosaic16,16 - -NEWSYM mosdraw216btms - mosaicproctms 128,mosaic2,2 -NEWSYM mosdraw316btms - mosaicproctms 86,mosaic3,3 -NEWSYM mosdraw416btms - mosaicproctms 64,mosaic4,4 -NEWSYM mosdraw516btms - mosaicproctms 52,mosaic5,5 -NEWSYM mosdraw616btms - mosaicproctms 43,mosaic6,6 -NEWSYM mosdraw716btms - mosaicproctms 37,mosaic7,7 -NEWSYM mosdraw816btms - mosaicproctms 32,mosaic8,8 -NEWSYM mosdraw916btms - mosaicproctms 29,mosaic9,9 -NEWSYM mosdraw1016btms - mosaicproctms 26,mosaic10,10 -NEWSYM mosdraw1116btms - mosaicproctms 24,mosaic11,11 -NEWSYM mosdraw1216btms - mosaicproctms 22,mosaic12,12 -NEWSYM mosdraw1316btms - mosaicproctms 20,mosaic13,13 -NEWSYM mosdraw1416btms - mosaicproctms 19,mosaic14,14 -NEWSYM mosdraw1516btms - mosaicproctms 18,mosaic15,15 -NEWSYM mosdraw1616btms - mosaicproctms 16,mosaic16,16 - -NEWSYM mosdraw216bntms - mosaicprocntms 128,mosaic2,2 -NEWSYM mosdraw316bntms - mosaicprocntms 86,mosaic3,3 -NEWSYM mosdraw416bntms - mosaicprocntms 64,mosaic4,4 -NEWSYM mosdraw516bntms - mosaicprocntms 52,mosaic5,5 -NEWSYM mosdraw616bntms - mosaicprocntms 43,mosaic6,6 -NEWSYM mosdraw716bntms - mosaicprocntms 37,mosaic7,7 -NEWSYM mosdraw816bntms - mosaicprocntms 32,mosaic8,8 -NEWSYM mosdraw916bntms - mosaicprocntms 29,mosaic9,9 -NEWSYM mosdraw1016bntms - mosaicprocntms 26,mosaic10,10 -NEWSYM mosdraw1116bntms - mosaicprocntms 24,mosaic11,11 -NEWSYM mosdraw1216bntms - mosaicprocntms 22,mosaic12,12 -NEWSYM mosdraw1316bntms - mosaicprocntms 20,mosaic13,13 -NEWSYM mosdraw1416bntms - mosaicprocntms 19,mosaic14,14 -NEWSYM mosdraw1516bntms - mosaicprocntms 18,mosaic15,15 -NEWSYM mosdraw1616bntms - mosaicprocntms 16,mosaic16,16 - - -NEWSYM drawbg1tile16b - mov byte[prdatb+ebx],1 - drawbgtileng16b 0,0 - ret - -NEWSYM drawbg2tile16b - mov byte[prdata+ebx],1 - drawbgtileng16b 1,1 - ret - -NEWSYM drawbg3tile16b - mov byte[prdatc+ebx],1 - drawbgtileng16b 2,2 - ret - -NEWSYM drawbg4tile16b - mov byte[prdata+ebx],1 - drawbgtileng16b 3,3 - ret - -NEWSYM drawbg1tilepr116b - drawbgtilengpr116b 0,0 - ret - -NEWSYM drawbg2tilepr116b - drawbgtilengpr116b 1,1 - ret - -NEWSYM drawbg3tilepr116b - drawbgtilengpr116b 2,2 - ret - -NEWSYM drawbg4tilepr116b - drawbgtilengpr116b 3,3 - ret - -NEWSYM drawbg1line16b - mov byte[prdatb+ebx],0 - drawbglineng16b 0,0 - -NEWSYM drawbg2line16b - mov byte[prdata+ebx],0 - drawbglineng16b 1,1 - -NEWSYM drawbg3line16b - mov byte[prdatc+ebx],0 - drawbglineng16b 2,2 - -NEWSYM drawbg4line16b - mov byte[prdata+ebx],0 - drawbglineng16b 3,3 - -NEWSYM drawbg1linepr116b - drawbglinengpr116b 0,0 - -NEWSYM drawbg2linepr116b - drawbglinengpr116b 1,1 - -NEWSYM drawbg3linepr116b - drawbglinengpr116b 2,2 - -NEWSYM drawbg4linepr116b - drawbglinengpr116b 3,3 - -%macro normalsprng16b 2 - test dword[sprleftpr+ebx*4],80000000h - jnz near .drawsingle - push esi - push ebx - add edi,esi - mov esi,[sprtbng+ebx*4] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa16b %1 - pop edx -.nodrawspr - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - ret -.drawspriteflipx - mov bx,[esi] - push edx - mov ch,[esi+6] - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf16b %1 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - pop ebx - pop esi - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec cl - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - pop ebx - pop esi - ret - -.drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - mov edx,ecx - and edx,0FFh - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - or byte[esi+4],0 ;this prevents some games from crashing - jz near .exitnow - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawa16b %2 - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 -.exitnow - pop ebx - pop esi - ret -.drawspriteflipx2 - mov bx,[esi] - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawaf16b %2 - sub edx,8 - mov esi,edx - dec cl - jnz near .loopobj2 - pop ebx - pop esi - ret -%endmacro - - -%macro normalwsprng16b 2 -; cmp byte[winbg1enval+eax+4*256],0 -; je near .skipobjw - xor eax,eax - mov [NGNumSpr],cl - mov ecx,[objclineptr+ebx*4] - add ecx,[ngwinptr] - test dword[sprleftpr+ebx*4],80000000h - jnz near .drawsingle - push esi - push ebx - add edi,esi - mov esi,[sprtbng+ebx*4] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push edx - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notprio - mov dh,[esi+6] - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa16b %1 - pop edx -.nodrawspr - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - xor ecx,ecx - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - xor ecx,ecx - ret -.drawspriteflipx - mov bx,[esi] - push edx - mov dl,[esi+7] - and edx,03h - cmp edx,[csprival] - jne near .notpriof - mov dh,[esi+6] - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf16b %1 - pop edx - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - pop ebx - pop esi - xor ecx,ecx - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop edx - add edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - pop ebx - pop esi - xor ecx,ecx - xor ecx,ecx - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - pop ebx - pop esi - ret - -.drawsingle - push esi - push ebx - mov edi,esi - mov esi,[sprtbng+ebx*4] - xor edx,edx - mov dl,[NGNumSpr] - and edx,0FFh - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - push edx - mov bx,[esi] - mov dh,[esi+6] - mov esi,[esi+2] - sprdrawa16b %2 - pop edx - sub edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj2 - pop ebx - pop esi - xor ecx,ecx - ret -.drawspriteflipx2 - push edx - mov bx,[esi] - mov dh,[esi+6] - mov esi,[esi+2] - sprdrawaf16b %2 - pop edx - sub edx,8 - mov esi,edx - dec byte[NGNumSpr] - jnz near .loopobj2 - pop ebx - pop esi - xor ecx,ecx - ret -%endmacro - -; FillSubScr bit 0 sets to 1 if there is no subscreen present -; ms,wms,wm,ws -; FillSubScr scadtng -NEWSYM drawsprng16b - test byte[BGMS1+ebx*2],10h - jz .nosubmain - test byte[FillSubScr+ebx],1 - jnz near drawsprng16bt -.nosubmain - mov ebp,[cpalval+ebx*4] - xor eax,eax - mov edi,[CMainWinScr] - test byte[FillSubScr+ebx],1 - jz .main2 - test byte[BGMS1+ebx*2],10h - jnz .main2 - mov edi,[CSubWinScr] -.main2 - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16b - test byte[FillSubScr+ebx],1 - jz .main - test byte[BGMS1+ebx*2],10h - jnz .main - add esi,75036*2 -.main - xor edi,edi - normalsprng16b sprdrawpra16bng,sprdrawprb16bng -NEWSYM drawsprngw16b - xor edi,edi - test byte[FillSubScr+ebx],1 - jz .main - test byte[BGMS1+ebx*2],10h - jnz .main - add esi,75036*2 -.main - normalwsprng16b sprdrawprawb16bng,sprdrawprbwb16bng - -drawsprng16bt: - test byte[scadtng+ebx],10h - jz near drawsprng16bnt - mov ebp,[cpalval+ebx*4] - xor eax,eax - test byte[BGMS1+ebx*2+1],10h - jnz near drawsprng16bmst - mov al,[BGMS1+ebx*2] - shr al,2 - test byte[BGMS1+ebx*2],al - jnz .transpwin - test byte[scaddset],0C0h - jz .transpwin - cmp byte[BGMS1+ebx*2+1],0 - jnz .main -.transpwin - mov edi,[CMainWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bt -.main - xor edi,edi - normalsprng16b sprdrawpra16bngt,sprdrawprb16bngt -NEWSYM drawsprngw16bt - xor edi,edi - normalwsprng16b sprdrawprawb16bngt,sprdrawprbwb16bngt -drawsprng16bmst: - mov edi,[CMainWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bmt - mov edi,[CSubWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bst - xor edi,edi - normalsprng16b sprdrawpra16bngmst,sprdrawprb16bngmst -drawsprngw16bst: - xor edi,edi - normalwsprng16b sprdrawprawb16bngst,sprdrawprbwb16bngst -drawsprngw16bmt: - mov edi,[CSubWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bmst - xor edi,edi - normalwsprng16b sprdrawprawb16bngmt,sprdrawprbwb16bngmt -drawsprngw16bmst: - xor edi,edi - normalwsprng16b sprdrawprawb16bngmst,sprdrawprbwb16bngmst - -drawsprng16bnt: - mov ebp,[cpalval+ebx*4] - xor eax,eax - test byte[BGMS1+ebx*2+1],10h - jnz near drawsprng16bmsnt - mov edi,[CMainWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16b - xor edi,edi - normalsprng16b sprdrawpra16bngnt,sprdrawprb16bngnt -drawsprngw16bnt - xor edi,edi - normalwsprng16b sprdrawprawb16bngnt,sprdrawprbwb16bngnt -drawsprng16bmsnt: - mov edi,[CMainWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bmnt - mov edi,[CSubWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bsnt - xor edi,edi - normalsprng16b sprdrawpra16bngmsnt,sprdrawprb16bngmsnt -drawsprngw16bsnt: - xor edi,edi - normalwsprng16b sprdrawprawb16bngsnt,sprdrawprbwb16bngsnt -drawsprngw16bmnt: - mov edi,[CSubWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bmsnt - xor edi,edi - normalwsprng16b sprdrawprawb16bngmnt,sprdrawprbwb16bngmnt -drawsprngw16bmsnt: - xor edi,edi - normalwsprng16b sprdrawprawb16bngmsnt,sprdrawprbwb16bngmsnt - -NEWSYM drawsprng16bhr - test byte[BGMS1+ebx*2],10h - jz .nosubmain - test byte[FillSubScr+ebx],1 - jnz near drawsprng16bthr -.nosubmain - mov ebp,[cpalval+ebx*4] - xor eax,eax - mov edi,[CMainWinScr] - test byte[FillSubScr+ebx],1 - jz .main2 - test byte[BGMS1+ebx*2],10h - jnz .main2 - mov edi,[CSubWinScr] -.main2 - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bhr - test byte[FillSubScr+ebx],1 - jz .main - test byte[BGMS1+ebx*2],10h - jnz .main - add esi,75036*2 -.main - xor edi,edi - normalsprng16b sprdrawpra16bnghr,sprdrawprb16bnghr -NEWSYM drawsprngw16bhr - xor edi,edi - test byte[FillSubScr+ebx],1 - jz .main - test byte[BGMS1+ebx*2],10h - jnz .main - add esi,75036*2 -.main - normalwsprng16b sprdrawprawb16bnghr,sprdrawprbwb16bnghr -drawsprng16bthr: - test byte[scadtng+ebx],10h - jz near drawsprng16bnthr - mov ebp,[cpalval+ebx*4] - xor eax,eax - test byte[BGMS1+ebx*2+1],10h - jnz near drawsprng16bmsthr - mov edi,[CMainWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bthr - xor edi,edi - normalsprng16b sprdrawpra16bngthr,sprdrawprb16bngthr -NEWSYM drawsprngw16bthr - xor edi,edi - normalwsprng16b sprdrawprawb16bngthr,sprdrawprbwb16bngthr -drawsprng16bmsthr: - mov edi,[CMainWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bmthr - mov edi,[CSubWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bsthr - xor edi,edi - normalsprng16b sprdrawpra16bngmsthr,sprdrawprb16bngmsthr -drawsprngw16bsthr: - xor edi,edi - normalwsprng16b sprdrawprawb16bngsthr,sprdrawprbwb16bngsthr -drawsprngw16bmthr: - mov edi,[CSubWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bmsthr - xor edi,edi - normalwsprng16b sprdrawprawb16bngmthr,sprdrawprbwb16bngmthr -drawsprngw16bmsthr: - xor edi,edi - normalwsprng16b sprdrawprawb16bngmsthr,sprdrawprbwb16bngmsthr -drawsprng16bnthr: - mov ebp,[cpalval+ebx*4] - xor eax,eax - test byte[BGMS1+ebx*2+1],10h - jnz near drawsprng16bmsnthr - mov edi,[CMainWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bhr - xor edi,edi - normalsprng16b sprdrawpra16bngnthr,sprdrawprb16bngnthr -drawsprngw16bnthr - xor edi,edi - normalwsprng16b sprdrawprawb16bngnthr,sprdrawprbwb16bngnthr -drawsprng16bmsnthr: - mov edi,[CMainWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bmnthr - mov edi,[CSubWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bsnthr - xor edi,edi - normalsprng16b sprdrawpra16bngmsnthr,sprdrawprb16bngmsnthr -drawsprngw16bsnthr: - xor edi,edi - normalwsprng16b sprdrawprawb16bngsnthr,sprdrawprbwb16bngsnthr -drawsprngw16bmnthr: - mov edi,[CSubWinScr] - cmp byte[edi+ebx+4*256],0 - jne near drawsprngw16bmsnthr - xor edi,edi - normalwsprng16b sprdrawprawb16bngmnthr,sprdrawprbwb16bngmnthr -drawsprngw16bmsnthr: - xor edi,edi - normalwsprng16b sprdrawprawb16bngmsnthr,sprdrawprbwb16bngmsnthr - - -ProcessTransparencies: - cmp byte[NGNoTransp],0 - je .yestransp - ret -.yestransp - cmp byte[MMXSupport],1 - je near ProcessTransparenciesMMX - mov esi,[vidbuffer] - add esi,16*2+288*2 - mov ebx,1 -.nextline - test byte[FillSubScr+ebx],1 - jz near .notransp - mov dword[HiResDone],0 -.againtransp - test byte[scadtng+ebx],40h - jz near .fulltransp - test byte[scadtng+ebx],80h - jnz near .subtract - - ; Half Add - push esi - push ebx - ; filter out all fixed color sub-screen - test byte[FillSubScr+ebx],2 - jnz .halfaddcomb - mov ecx,256 - mov ebx,[UnusedBit] - mov edi,[HalfTrans] - xor eax,eax - jmp .next2 -.notranspha - add esi,2 - dec ecx - jz .done -.next2 - mov ax,[esi] - test ax,bx - jz .notranspha - mov dx,[esi+75036*2] - test dx,bx - jnz .notranspha - and eax,edi - and edx,edi - add eax,edx - shr eax,1 - mov [esi],ax - add esi,2 - dec ecx - jnz .next2 -.done - pop ebx - pop esi - jmp .donetransp -.halfaddcomb - mov ecx,256 - mov ebx,[UnusedBit] - mov edi,[HalfTrans] - xor eax,eax - xor edx,edx - jmp .next2c -.notransphac - add esi,2 - dec ecx - jz .donec -.next2c - mov ax,[esi] - test ax,bx - jz .notransphac - mov dx,[esi+75036*2] - test dx,bx - jnz .fulladdtranspc - and eax,edi - and edx,edi - add eax,edx - shr eax,1 - mov [esi],ax - add esi,2 - dec ecx - jnz .next2c -.donec - pop ebx - pop esi - jmp .donetransp -.fulladdtranspc - and eax,edi - and edx,edi - add eax,edx - shr eax,1 - mov ax,[fulladdtab+eax*2] - mov [esi],ax - add esi,2 - dec ecx - jnz .next2c - pop ebx - pop esi - jmp .donetransp - -.subtract - push ebx - push esi - ; half adder - mov ecx,256 - mov ebp,[HalfTrans] - xor edx,edx - mov bx,[UnusedBit] -.nextfshs - mov ax,[esi] - test ax,bx - je .notranspfshs - mov dx,[esi+75036*2] - xor ax,0FFFFh - and edx,ebp - and eax,ebp - add edx,eax - shr edx,1 - mov dx,[fulladdtab+edx*2] - xor dx,0FFFFh - test word[esi+75036*2],bx - jnz .nothalfhs - and edx,ebp - shr edx,1 -.nothalfhs - mov [esi],dx -.notranspfshs - add esi,2 - dec ecx - jnz .nextfshs - pop esi - pop ebx - jmp .donetransp -.fulltransp - test byte[scadtng+ebx],80h - jnz near .fullsubtract - push ebx - push esi - mov ecx,256 - mov ebp,[HalfTrans] - xor edx,edx - xor eax,eax - mov bx,[UnusedBit] -.nextfa - mov ax,[esi] - test ax,bx - jz .notranspfa - mov dx,[esi+75036*2] - and eax,ebp - and edx,ebp - add edx,eax - shr edx,1 - mov dx,[fulladdtab+edx*2] - mov [esi],dx -.notranspfa - add esi,2 - dec ecx - jnz .nextfa - pop esi - pop ebx - jmp .donetransp -.fullsubtract - push ebx - push esi - ; half adder - mov ecx,256 - mov ebp,[HalfTrans] - xor edx,edx - xor eax,eax - mov bx,[UnusedBit] -.nextfs - mov ax,[esi] - test ax,bx - jz .notranspfs - mov dx,[esi+75036*2] - xor ax,0FFFFh - and edx,ebp - and eax,ebp - add edx,eax - shr edx,1 - mov dx,[fulladdtab+edx*2] - xor dx,0FFFFh - mov [esi],dx -.notranspfs - add esi,2 - dec ecx - jnz .nextfs - pop esi - pop ebx -.donetransp - test byte[SpecialLine+ebx],3 - jz .notransp - xor dword[HiResDone],1 - cmp dword[HiResDone],0 - je .okaytransp - add esi,75036*4 - jmp .againtransp -.okaytransp - sub esi,75036*4 -.notransp - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne near .nextline - ret - -%macro TranspMMX 3 - mov esi,[vidbuffer] - add esi,16*2+288*2 - mov ebx,1 -.nextline - test byte[FillSubScr+ebx],1 - jz near .notransp - mov dword[HiResDone],0 -.againtransp - test byte[scadtng+ebx],40h - jz near .fulltransp - test byte[scadtng+ebx],80h - jnz near .subtract - - ; Half Add - push esi - push ebx - ; filter out all fixed color sub-screen - mov ecx,64 - mov eax,[UnusedBit] -.faddl2h - test dword[esi],eax - jnz near .faddloopbh - test dword[esi+4],eax - jnz near .faddloopbh - add esi,8 - dec ecx - jnz .faddl2h - jmp .faddloopdoneh -.prochalfadd - test dword[esi+75036*2],eax - jnz near .faddloopbh - test dword[esi+75036*2+4],eax - jnz near .faddloopbh - mov ebx,[esi] - and ebx,eax - cmp ebx,eax - jne near .faddlooph - mov ebx,[esi+4] - and ebx,eax - cmp ebx,eax - jne near .faddlooph -.prochalfadddo - movq mm0,[esi] - movq mm1,[esi+75036*2] - pand mm0,[HalfTrans] - pand mm1,[HalfTrans] - psrlw mm0,1 - psrlw mm1,1 - paddw mm0,mm1 - movq [esi],mm0 - add esi,8 - dec ecx - jnz .prochalfadd - jmp .faddloopdoneh -.procfulladdnext: - movq [esi-8],mm0 -.procfulladd - mov ebx,[esi] - and ebx,eax - cmp ebx,eax - jne near .faddlooph - mov ebx,[esi+4] - and ebx,eax - cmp ebx,eax - jne near .faddlooph - mov ebx,[esi+75036*2] - and ebx,eax - cmp ebx,eax - jne near .faddlooph - mov ebx,[esi+75036*2+4] - and ebx,eax - cmp ebx,eax - jne near .faddlooph -.procfulladddo - movq mm0,[esi] - movq mm1,[esi+75036*2] - pand mm0,[UnusedBitXor] - movq mm4,mm1 - movq mm2,mm0 - %if %1>0 - psllw mm0,%1 - psllw mm1,%1 - movq mm3,mm2 - %else - movq mm3,mm0 - %endif - psllw mm2,%2 - pand mm1,[FullBitAnd] - paddusw mm0,mm1 - pand mm0,[FullBitAnd] - movq mm1,mm4 - psllw mm4,%2 - add esi,byte 8 - %if %1>0 - psrlw mm0,%1 - %endif - paddusw mm2,mm4 - psllw mm3,%3 - pand mm2,[FullBitAnd] - psllw mm1,%3 - psrlw mm2,%2 - pand mm1,[FullBitAnd] - paddusw mm3,mm1 - por mm0,mm2 - pand mm3,[FullBitAnd] - psrlw mm3,%3 - por mm0,mm3 - dec ecx - jnz near .procfulladdnext - movq [esi],mm0 - jmp .faddloopdoneh -.faddlooph - mov ebx,[esi] - test ebx,eax - jz near .faddl2h - and ebx,eax - cmp ebx,eax - jne .faddloopbh - mov ebx,[esi+4] - and ebx,eax - cmp ebx,eax - jne .faddloopbh - mov ebx,[esi+75036*2] - and ebx,eax - or ebx,ebx - jz .faddla - cmp ebx,eax - jne .faddloopbh - mov ebx,[esi+75036*2+4] - and ebx,eax - cmp ebx,eax - jne .faddloopbh - jmp .procfulladddo -.faddla - test dword[esi+75036*2+4],eax - jz near .prochalfadddo -.faddloopbh - movq mm0,[esi] - movq mm5,mm0 - movq mm6,mm0 - pand mm5,[UnusedBitXor] - movq mm1,[esi+75036*2] - movq mm7,mm1 - movq mm2,mm0 - pand mm1,[UnusedBitXor] - movq mm3,mm0 - movq mm4,mm1 - %if %1>0 - psllw mm0,%1 - psllw mm1,%1 - %endif - pand mm1,[FullBitAnd] - paddusw mm0,mm1 - pand mm0,[FullBitAnd] - movq mm1,mm4 - %if %1>0 - psrlw mm0,%1 - %endif - psllw mm2,%2 - psllw mm1,%2 - pand mm1,[FullBitAnd] - paddusw mm2,mm1 - pand mm2,[FullBitAnd] - movq mm1,mm4 - psrlw mm2,%2 - psllw mm3,%3 - psllw mm1,%3 - paddusw mm3,mm1 - pand mm3,[FullBitAnd] - psrlw mm3,%3 - por mm0,mm3 - por mm0,mm2 - pand mm6,[UnusedBit] - pcmpeqw mm6,[UnusedBit] - pand mm0,mm6 - movq mm1,mm5 - pand mm1,mm6 - pand mm4,mm6 - pxor mm6,[UnusedBitXor] - pand mm5,mm6 - pand mm7,[UnusedBit] - pand mm4,[HalfTrans] - pand mm1,[HalfTrans] - psrlw mm1,1 - psrlw mm4,1 - paddw mm1,mm4 - pcmpeqw mm7,[UnusedBit] - pand mm0,mm7 - pxor mm7,[UnusedBitXor] - pand mm1,mm7 - por mm0,mm1 - por mm0,mm5 - movq [esi],mm0 - add esi,8 - dec ecx - jnz near .faddlooph -.faddloopdoneh - pop ebx - pop esi - jmp .donetransp - -.subtract - push ebx - push esi - mov ecx,64 - mov eax,[UnusedBit] -.fsubl2h - test dword[esi],eax - jnz .fsubloopbh - test dword[esi+4],eax - jnz .fsubloopbh - add esi,8 - dec ecx - jnz .fsubl2h - jmp .fsubloopdoneh -.fsublooph - test dword[esi],eax - jz .fsubl2h -.fsubloopbh - movq mm0,[esi] - movq mm5,mm0 - movq mm6,mm0 - pxor mm0,[UnusedBitXor] - pand mm5,[UnusedBitXor] - movq mm1,[esi+75036*2] - movq mm7,mm1 - movq mm2,mm0 - pand mm1,[UnusedBitXor] - movq mm3,mm0 - movq mm4,mm1 - %if %1>0 - psllw mm0,%1 - psllw mm1,%1 - %endif - pand mm1,[FullBitAnd] - paddusw mm0,mm1 - pand mm0,[FullBitAnd] - movq mm1,mm4 - %if %1>0 - psrlw mm0,%1 - %endif - psllw mm2,%2 - psllw mm1,%2 - paddusw mm2,mm1 - pand mm2,[FullBitAnd] - psrlw mm2,%2 - psllw mm3,%3 - psllw mm4,%3 - pand mm4,[FullBitAnd] - paddusw mm3,mm4 - pand mm3,[FullBitAnd] - psrlw mm3,%3 - por mm0,mm3 - por mm0,mm2 - pand mm6,[UnusedBit] - pxor mm0,[UnusedBitXor] - pcmpeqw mm6,[UnusedBit] - pand mm0,mm6 - pxor mm6,[UnusedBitXor] - pand mm5,mm6 - pand mm7,[UnusedBit] - movq mm1,mm0 - pand mm1,[HalfTrans] - psrlw mm1,1 - pcmpeqw mm7,[UnusedBit] - pand mm0,mm7 - pxor mm7,[UnusedBitXor] - pand mm1,mm7 - por mm0,mm1 - por mm0,mm5 - movq [esi],mm0 - add esi,8 - dec ecx - jnz near .fsublooph -.fsubloopdoneh - pop esi - pop ebx - jmp .donetransp - -.fulltransp - test byte[scadtng+ebx],80h - jnz near .fullsubtract - push ebx - push esi - mov ecx,64 - mov eax,[UnusedBit] -.faddl2 - test dword[esi],eax - jnz .faddloopb -.faddl2_2 - test dword[esi+4],eax - jnz .faddloopb - add esi,8 - dec ecx - jnz .faddl2 - jmp .faddloopdone -.faddloopnext - movq [esi-8],mm0 -.faddloop - test dword[esi],eax - jz .faddl2_2 -.faddloopb - movq mm0,[esi] - movq mm1,[esi+75036*2] - movq mm6,mm0 - pand mm0,[UnusedBitXor] - movq mm4,mm1 - movq mm2,mm0 - %if %1>0 - psllw mm0,%1 - psllw mm1,%1 - movq mm3,mm2 - movq mm5,mm2 - %else - movq mm3,mm0 - movq mm5,mm0 - %endif - pand mm1,[FullBitAnd] - paddusw mm0,mm1 - pand mm0,[FullBitAnd] - psllw mm2,%2 - movq mm1,mm4 - psllw mm4,%2 - paddusw mm2,mm4 - psllw mm3,%3 - pand mm2,[FullBitAnd] - psllw mm1,%3 - psrlw mm2,%2 - pand mm1,[FullBitAnd] - paddusw mm3,mm1 - pand mm3,[FullBitAnd] - %if %1>0 - psrlw mm0,%1 - %endif - psrlw mm3,%3 - pand mm6,[UnusedBit] - por mm0,mm2 - pcmpeqw mm6,[UnusedBit] - por mm0,mm3 - pand mm0,mm6 - pxor mm6,[UnusedBitXor] - pand mm5,mm6 - add esi,byte 8 - por mm0,mm5 - dec ecx - jnz near .faddloopnext - movq [esi-8],mm0 -.faddloopdone - pop esi - pop ebx - jmp .donetransp -.fullsubtract - push ebx - push esi - mov ecx,64 - mov eax,[UnusedBit] -.fsubl2 - test dword[esi],eax - jnz .fsubloopb - test dword[esi+4],eax - jnz .fsubloopb - add esi,8 - dec ecx - jnz .fsubl2 - jmp .fsubloopdone -.fsubloop - test dword[esi],eax - jz .fsubl2 -.fsubloopb - movq mm0,[esi] - movq mm5,mm0 - movq mm6,mm0 - pxor mm0,[UnusedBitXor] - pand mm5,[UnusedBitXor] - movq mm1,[esi+75036*2] - movq mm2,mm0 - pand mm1,[UnusedBitXor] - movq mm3,mm0 - movq mm4,mm1 - %if %1>0 - psllw mm0,%1 - psllw mm1,%1 - %endif - pand mm1,[FullBitAnd] - paddusw mm0,mm1 - pand mm0,[FullBitAnd] - movq mm1,mm4 - %if %1>0 - psrlw mm0,%1 - %endif - psllw mm2,%2 - psllw mm1,%2 - paddusw mm2,mm1 - pand mm2,[FullBitAnd] - psrlw mm2,%2 - psllw mm3,%3 - psllw mm4,%3 - pand mm4,[FullBitAnd] - paddusw mm3,mm4 - pand mm3,[FullBitAnd] - psrlw mm3,%3 - por mm0,mm3 - por mm0,mm2 - pand mm6,[UnusedBit] - pxor mm0,[UnusedBitXor] - pcmpeqw mm6,[UnusedBit] - pand mm0,mm6 - pxor mm6,[UnusedBitXor] - pand mm5,mm6 - por mm0,mm5 - movq [esi],mm0 - add esi,8 - dec ecx - jnz near .fsubloop -.fsubloopdone - pop esi - pop ebx -.donetransp - test byte[SpecialLine+ebx],3 - jz .notransp - xor dword[HiResDone],1 - cmp dword[HiResDone],0 - je .okaytransp - add esi,75036*4 - jmp .againtransp -.okaytransp - sub esi,75036*4 -.notransp - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne near .nextline - emms - ret -%endmacro - -ProcessTransparenciesMMX: - cmp byte[ngrposng],10 - je near ProcessTransparenciesMMXargb - TranspMMX 0,5,11 -ProcessTransparenciesMMXargb - TranspMMX 1,6,11 - -; movq mm0,[esi] -; movq mm1,[esi+75036*2] -; movq mm2,mm0 -; movq mm4,mm1 -; movq mm3,mm0 -; movq mm5,mm0 -; movq mm6,mm0 -; ;psllw mm0,0 -; ;psllw mm1,0 -; paddusw mm0,mm1 -; pand mm6,[UnusedBitXor] -; pand mm0,[FullBitAnd] -; movq mm1,mm4 -; ;psrlw mm0,0 -; psllw mm2,5 -; psllw mm1,5 -; paddusw mm2,mm1 -; pand mm2,[FullBitAnd] -; psrlw mm2,5 -; psllw mm3,11 -; psllw mm4,11 -; paddusw mm3,mm4 -; pand mm3,[FullBitAnd] -; psrlw mm3,11 -; por mm0,mm3 -; por mm0,mm2 -; pand mm6,[UnusedBit] -; pcmpeqw mm6,[UnusedBit] -; pand mm0,mm6 -; pxor mm6,[UnusedBitXor] -; pand mm5,mm6 -; por mm0,mm5 -; movq [esi],mm0 - -; PADDUSW - Add Unsigned with Saturation on Word -; PAND (source can be a memory location) -; PANDN - bitwise AND NOT -; PCMPEQW - packed compare for equal, word -; PSLLW - Shift Left, Logical, Word -; PSRLW - Shirt Right, Logical -; POR - -section .data -ALIGN32 -NEWSYM UnusedBit, dd 00000000001000000000000000100000b,00000000001000000000000000100000b -NEWSYM HalfTrans, dd 11110111110111101111011111011110b,11110111110111101111011111011110b,0,0 -NEWSYM UnusedBitXor, dd 11111111110111111111111111011111b,11111111110111111111111111011111b -NEWSYM ngrposng, dd 11,0 -NEWSYM nggposng, dd 6,0 -NEWSYM ngbposng, dd 0,0 -NEWSYM HiResDone, dd 0,0 -NEWSYM FullBitAnd, dd 0F800F800h,0F800F800h -NEWSYM HalfTransB, dd 00001000010000010000100001000001b,00001000010000010000100001000001b -NEWSYM HalfTransC, dd 11110111100111101111011110011110b,11110111100111101111011110011110b -NEWSYM NGNoTransp, dd 0 -section .text - -%macro SCMainA 0 -%endmacro - -%macro SCSubA 0 - shl al,2 -%endmacro - -%macro SCMainB 0 - and word[esi],bx - or word[esi+75036*2],bx -%endmacro - -%macro SCSubB 0 - and word[esi],bx -%endmacro - -%macro SCMainC 0 -%endmacro - -%macro SCSubC 0 - xor ebx,0FFFFFFFFh -%endmacro - -%macro SCMainD 0 - and dword[esi],ebx - or dword[esi+75036*2],ebx -%endmacro - -%macro SCSubD 0 - and dword[esi],ebx -%endmacro - -%macro ScreenClip 4 - mov esi,[vidbuffer] - add esi,16*2+288*2 - mov ebx,1 -.nextline - mov al,[scadsng+ebx] - %1 - test al,0C0h - jz near .notthisone - push esi - push ebx - and al,0C0h - cmp al,0C0h - jne .notentire - mov ebx,[UnusedBit] - %3 - mov ecx,256 - mov edx,256 - jmp .startclippingfull -.notentire - - mov dword[ngwinen],0 - test byte[winbg1enval+ebx+5*256],0Ah - jz .nowindowing - push eax - push ebx - mov al,[winlogicaval+ebx*2+1] - shr al,2 - and al,03h - mov [nglogicval],al - mov eax,ebx - add ebx,5*256 - call BuildWindow -;ngwintable - pop ebx - pop eax -.nowindowing - - mov ebx,[UnusedBit] - %3 - mov edx,256 - cmp dword[ngwinen],0 - jne .windowenabled - cmp al,80h - je near .finclipping - mov ecx,256 - jmp .startclippingfull -.windowenabled - cmp al,80h - je near .outsideclipping - mov edi,ngwintable - mov ecx,[edi] - cmp ecx,0 - je .nodec - dec ecx -.nodec - add edi,4 - or ecx,ecx - jnz near .startclippingb - mov ecx,[edi] - add edi,4 - jmp .noclipping -.outsideclipping - mov edi,ngwintable - mov ecx,[edi] - add edi,4 - or ecx,ecx - jnz .noclipping - mov ecx,[edi] - cmp ecx,0 - je .nodec2 - dec ecx -.nodec2 - add edi,4 - jmp .startclippingb -.startclippingb - cmp ecx,256 - jae near .startclippingfull -.startclipping - %2 - add esi,2 - dec edx - jz .finclipping - dec ecx - jnz .startclipping - mov ecx,[edi] - add edi,4 -.noclipping - sub edx,ecx - jz .finclipping - jc .finclipping - add ecx,ecx - add esi,ecx - mov ecx,[edi] - add edi,4 - jmp .startclipping -.startclippingfull - mov ecx,128 -.loopclipfull - %4 - add esi,4 - dec ecx - jnz .loopclipfull -.finclipping - pop ebx - pop esi -.notthisone - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne near .nextline -%endmacro - -MainScreenClip: - ScreenClip SCMainA,SCMainB,SCMainC,SCMainD -SubScreenClip: - ScreenClip SCSubA,SCSubB,SCSubC,SCSubD - ret diff --git a/tools/zsnes/src/video/newgfx16.mac b/tools/zsnes/src/video/newgfx16.mac deleted file mode 100644 index 9116598..0000000 --- a/tools/zsnes/src/video/newgfx16.mac +++ /dev/null @@ -1,3815 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -; drawtileng16b - -%macro ngsub 2 - test dword[BGMS1+ebx*2+1],%1 - jz near %2 - test dword[BGMS1+ebx*2],%1 - jnz near %2 - test byte[FillSubScr+ebx],1 - jnz near %2 -%endmacro - -%macro ngmain 2 - test dword[BGMS1+ebx*2],%1 - jnz %%yesmain - test byte[FillSubScr+ebx],1 - jz near %2 - test dword[BGMS1+ebx*2+1],%1 - jz near %2 -%%yesmain -%endmacro - -%macro sprdrawpra16bng 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - xor eax,eax - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprb16bng 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bng 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - cmp byte[ecx+ebx-%1],1 - je %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bng 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawpra16bngt 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2+512] - or byte[sprpriodata+ebx-%1+16],dl - cmp ch,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprb16bngt 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2+512] - cmp ch,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngt 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - cmp byte[ecx+ebx-%1],1 - je %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bngt 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawpra16bngmst 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2+512] - cmp ch,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - xor eax,eax - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprb16bngmst 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2+512] - cmp ch,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngmst 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - cmp byte[ecx+ebx-%1],1 - je %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bngmst 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngst 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprbwb16bngst 1 - or al,al - jz %%skip - add al,dh - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprawb16bngmt 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*2],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - or ax,[UnusedBit] - mov [edi+ebx*2-%1*2],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprbwb16bngmt 1 - or al,al - jz %%skip - add al,dh - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*2],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - or ax,[UnusedBit] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawpra16bngnt 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - xor eax,eax - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprb16bngnt 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngnt 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bngnt 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawpra16bngmsnt 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*2],ax - xor eax,eax - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprb16bngmsnt 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngmsnt 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bngmsnt 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngsnt 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - mov [edi+ebx*2-%1*2+75036*2],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprbwb16bngsnt 1 - or al,al - jz %%skip - add al,dh - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - mov [edi+ebx*2-%1*2+75036*2],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprawb16bngmnt 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*2],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - mov [edi+ebx*2-%1*2],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprbwb16bngmnt 1 - or al,al - jz %%skip - add al,dh - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*2],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - mov [edi+ebx*2-%1*2],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawpra216bng 1 - or al,al - jz %%skip - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawpra16bnghr 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - xor eax,eax - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprb16bnghr 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*4],ax - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bnghr 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - cmp byte[ecx+ebx-%1],1 - je %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*4],ax - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bnghr 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*4],ax - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawpra16bngthr 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2+512] - or byte[sprpriodata+ebx-%1+16],dl - cmp ch,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprb16bngthr 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2+512] - cmp ch,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngthr 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - cmp byte[ecx+ebx-%1],1 - je %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bngthr 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawpra16bngmsthr 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2+512] - cmp ch,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - xor eax,eax - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprb16bngmsthr 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2+512] - cmp ch,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngmsthr 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - cmp byte[ecx+ebx-%1],1 - je %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bngmsthr 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngsthr 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprbwb16bngsthr 1 - or al,al - jz %%skip - add al,dh - mov ax,[ebp+eax*2+512] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - and eax,[UnusedBitXor] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprawb16bngmthr 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - or ax,[UnusedBit] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprbwb16bngmthr 1 - or al,al - jz %%skip - add al,dh - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - or ax,[UnusedBit] - cmp dh,128+64 - jae %%yestransp - and eax,[UnusedBitXor] -%%yestransp - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawpra16bngnthr 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - xor eax,eax - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprb16bngnthr 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngnthr 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bngnthr 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawpra16bngmsnthr 1 - or al,al - jz %%skip - add al,ch - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - xor eax,eax - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprb16bngmsnthr 1 - or al,al - jz %%skip - add al,ch - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngmsnthr 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbwb16bngmsnthr 1 - or al,al - jz %%skip - add al,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprawb16bngsnthr 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprbwb16bngsnthr 1 - or al,al - jz %%skip - add al,dh - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprawb16bngmnthr 1 - or al,al - jz %%skip - add al,dh - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - or byte[sprpriodata+ebx-%1+16],dl - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawprbwb16bngmnthr 1 - or al,al - jz %%skip - add al,dh - mov ax,[ebp+eax*2] - mov [edi+ebx*2-%1*2+75036*2],ax - mov [edi+ebx*2-%1*2+75036*6],ax - cmp byte[ecx+ebx-%1],1 - je %%skip - mov [edi+ebx*2-%1*2],ax - mov [edi+ebx*2-%1*2+75036*4],ax -%%skip - xor eax,eax -%endmacro - -%macro sprdrawpra216bnghr 1 - or al,al - jz %%skip - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro Procbgpr016b 5 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2 -; add esi,16*2+288*2 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - %4 %5, %%nogo - ; Check if at a tile alignment - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - add ecx,ebx - test ecx,07h - jz %%tilecheck -%%proclinebyline - ; process line by line - push esi - mov eax,[cpalval+ebx*4] - mov [CPalPtrng],eax - call %2 - pop esi -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne %%nextline - jmp %%donextbg -%%tilecheck - cmp dword[startlinet],ebx - jae %%proclinebyline - cmp dword[endlinet],ebx - jbe %%proclinebyline - test dword[bgwinchange+ebx],0FFFFFF00h - jnz %%linebyline - test dword[bgwinchange+ebx+4],0FFFFFFFFh - jz %%tilebytile -%%linebyline - test dword[winbg1enval+ebx+%1*256],0A0A0A0Ah - jnz %%proclinebyline - test dword[winbg1enval+ebx+%1*256+4],0A0A0A0Ah - jnz %%proclinebyline -%%tilebytile - cmp ebx,[reslbyl] - jae %%proclinebyline - test dword[bgallchange+ebx],0FFFFFF00h - jnz %%proclinebyline - test dword[bgallchange+ebx+4],0FFFFFFFFh - jnz near %%proclinebyline - test dword[bg1change+ebx+%1*256],0FFFFFF00h - jnz near %%proclinebyline - test dword[bg1change+ebx+%1*256+4],0FFFFFFFFh - jnz near %%proclinebyline - cmp byte[BGMA+ebx],5 - jae near %%proclinebyline - cmp byte[BGMA+ebx],2 - je near %%proclinebyline - test byte[mosenng+ebx],1 << %1 - jnz %%mosaic -%%nomosaic - mov ax,[resolutn] - sub ax,8 - cmp bx,ax - jae near %%proclinebyline - push esi - call %3 - pop esi - add ebx,8 - add esi,288*2*8 - cmp [resolutn],bx - ja near %%nextline - jmp %%donextbg -%%mosaic - cmp byte[mosszng+ebx],0 - je %%nomosaic - jmp %%proclinebyline -%%donextbg -%endmacro - -%macro Procbg3pr016b 5 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2 -; add esi,16+288 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - %4 %5, %%nogo - ; Check if at a tile alignment - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - add ecx,ebx - test ecx,07h - jz %%tilecheck -%%proclinebyline - ; process line by line - push esi - mov eax,[cpalval+ebx*4] - mov [CPalPtrng],eax - call %2 - pop esi -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne %%nextline - jmp %%donextbg -%%tilecheck - cmp dword[startlinet],ebx - jae %%proclinebyline - cmp dword[endlinet],ebx - jbe %%proclinebyline - test dword[bgwinchange+ebx],0FFFFFF00h - jnz %%linebyline - test dword[bgwinchange+ebx+4],0FFFFFFFFh - jz %%tilebytile -%%linebyline - test dword[winbg1enval+ebx+%1*256],0A0A0A0Ah - jnz %%proclinebyline - test dword[winbg1enval+ebx+%1*256+4],0A0A0A0Ah - jnz %%proclinebyline -%%tilebytile - cmp ebx,[reslbyl] - jae %%proclinebyline - test dword[bgallchange+ebx],0FFFFFF00h - jnz %%proclinebyline - test dword[bgallchange+ebx+4],0FFFFFFFFh - jnz near %%proclinebyline - test dword[bg1change+ebx+%1*256],0FFFFFF00h - jnz near %%proclinebyline - test dword[bg1change+ebx+%1*256+4],0FFFFFFFFh - jnz near %%proclinebyline - mov eax,[BG3PRI+ebx] - cmp eax,[BG3PRI+ebx+4] - jne near %%proclinebyline - test byte[mosenng+ebx],1 << %1 - jnz %%mosaic -%%nomosaic - mov ax,[resolutn] - sub ax,8 - cmp bx,ax - jae near %%proclinebyline - push esi - call %3 - pop esi - add ebx,8 - add esi,288*8*2 - cmp [resolutn],bx - ja near %%nextline - jmp %%donextbg -%%mosaic - cmp byte[mosszng+ebx],0 - je %%nomosaic - jmp %%proclinebyline -%%donextbg -%endmacro - -%macro Procbgpr116b 6 - ; Draw BG - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2 -; add esi,16*2+288*2 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne %%nogo - %5 %6, %%nogo - ; Check if at a tile alignment - cmp byte[%4+ebx],1 - je %%tile -%%proclinebyline - ; process line by line - push esi - mov eax,[cpalval+ebx*4] - mov [CPalPtrng],eax - call %2 - pop esi -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne %%nextline - jmp %%donextbg -%%tile - push esi - mov eax,[cpalval+ebx*4] - mov [CPalPtrng],eax - call %3 - pop esi - add ebx,8 - add esi,288*2*8 - cmp [resolutn],bx - ja near %%nextline -%%donextbg -%endmacro - -%macro Procbg3pr116b 6 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne near %%nogo - %5 %6, %%nogo - cmp byte[BGMA+ebx],1 - jne %%nomode1 - cmp byte[BG3PRI+ebx],0 - jne %%nogo -%%nomode1 - ; Check if at a tile alignment - cmp byte[%4+ebx],1 - je %%tile -%%proclinebyline - ; process line by line - push esi - mov eax,[cpalval+ebx*4] - mov [CPalPtrng],eax - call %2 - pop esi -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne %%nextline - jmp %%donextbg -%%tile - push esi - mov eax,[cpalval+ebx*4] - mov [CPalPtrng],eax - call %3 - pop esi - add ebx,8 - add esi,288*2*8 - cmp [resolutn],bx - ja near %%nextline -%%donextbg -%endmacro - -%macro Procbg3pr1b16b 6 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2 - xor ebx,ebx -%%nextline - cmp byte[BGFB+ebx],0 - jne near %%nogo - %5 %6, %%nogo - cmp byte[BGMA+ebx],1 - jne %%nogo - cmp byte[BG3PRI+ebx],0 - je %%nogo - ; Check if at a tile alignment - cmp byte[%4+ebx],1 - je %%tile -%%proclinebyline - ; process line by line - push esi - mov eax,[cpalval+ebx*4] - mov [CPalPtrng],eax - call %2 - pop esi -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne %%nextline - jmp %%donextbg -%%tile - push esi - mov eax,[cpalval+ebx*4] - mov [CPalPtrng],eax - call %3 - pop esi - add ebx,8 - add esi,288*2*8 - cmp [resolutn],bx - ja near %%nextline -%%donextbg -%endmacro - -%macro Procsprng16b 2 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2+288*2 - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne near %%nogo - %1 %2, %%nogo - xor eax,eax - mov al,[sprtlng+ebx] - mov cl,[sprlefttot+ebx] - mov [csprival],eax - inc byte[sprtlng+ebx] - test byte[sprleftpr+ebx*4+eax],1 - jz %%nogo - or cl,cl - jz %%nogo - test byte[SpecialLine+ebx],2 - jnz %%hires - push esi - call drawsprng16b - pop esi - jmp %%nogo -%%hires - mov cl,[sprlefttot+ebx] - push esi - call drawsprng16bhr - pop esi -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne near %%nextline -%endmacro - -%macro Procsprng0116b 2 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2+288*2 - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne near %%nogo - %1 %2, %%nogo - cmp byte[BGMA+ebx],1 - ja %%nogo - xor eax,eax - mov al,[sprtlng+ebx] - mov cl,[sprlefttot+ebx] - mov [csprival],eax - inc byte[sprtlng+ebx] - test byte[sprleftpr+ebx*4+eax],1 - jz %%nogo - or cl,cl - jz %%nogo - test byte[SpecialLine+ebx],2 - jnz %%hires - push esi - call drawsprng16b - pop esi - jmp %%nogo -%%hires - mov cl,[sprlefttot+ebx] - push esi - call drawsprng16bhr - pop esi -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne near %%nextline -%endmacro - -%macro Procsprng23456716b 2 - ; Draw BG 2 - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2+288*2 - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne near %%nogo - %1 %2, %%nogo - cmp byte[BGMA+ebx],1 - jbe %%nogo - xor eax,eax - mov al,[sprtlng+ebx] - mov cl,[sprlefttot+ebx] - mov [csprival],eax - inc byte[sprtlng+ebx] - test byte[sprleftpr+ebx*4+eax],1 - jz %%nogo - or cl,cl - jz %%nogo - test byte[SpecialLine+ebx],2 - jnz %%hires - push esi - call drawsprng16b - pop esi - jmp %%nogo -%%hires - mov cl,[sprlefttot+ebx] - push esi - call drawsprng16bhr - pop esi -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne near %%nextline -%endmacro - -%macro ProcMode7ng16b 2 - mov byte[winon],0 - ; Draw BG - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2+288*2 - mov ebx,[mode7A] - mov [Mode7BackA],ebx - mov ebx,[mode7C] - mov [Mode7BackC],ebx - mov ebx,[mode7X0] - mov [Mode7BackX0],ebx - mov bl,[mode7set] - mov [Mode7BackSet],ebx - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne near %%nogo - cmp byte[BGMA+ebx],7 - jne near %%nogo - test byte[intrlng+ebx],40h - jnz near %%nogo - %1 %2, %%nogo - push ebx - mov ebp,[cpalval+ebx*4] - ; Process mosaic - mov byte[curmosaicsz],1 - xor ecx,ecx - test byte[mosenng+ebx],1 - jz %%nomosaic - mov cl,[mosszng+ebx] - or cl,cl - jz %%nomosaic - inc cl - mov [curmosaicsz],cl - xor edx,edx - mov eax,ebx - div cl - xor edx,edx - mul cl - mov ebx,eax -%%nomosaic - ; process line by line - mov edx,[mode7ab+ebx*4] - mov [mode7A],edx - mov edx,[mode7cd+ebx*4] - mov [mode7C],edx - - mov edx,[mode7xy+ebx*4] - mov [mode7X0],edx - mov edx,[mode7st+ebx] - mov [mode7set],dl - xor edx,edx - mov eax,ebx - test byte[mode7set],02h - jz %%noflip - mov eax,255 - sub eax,ebx -%%noflip - mov dx,[BG1SXl+ebx*2] - mov [m7starty],ax - mov ax,[BG1SYl+ebx*2] - mov [curvidoffset],esi - pop ebx - push eax - push edx - push esi - push ebx - test byte[scadsng+ebx],1 - jnz %%directmode - push esi - push ebx - call drawmode7win16b - pop ebx - pop esi - jmp %%donemode7 -%%directmode - push esi - push ebx - call drawmode7win16bd - pop ebx - pop esi -%%donemode7 - pop ebx - pop esi - pop edx - pop eax - - cmp byte[Mode7HiRes16b],0 - je %%nogoc - cmp byte[scanlines],0 - jne %%nogoc - test byte[scadsng+ebx],1 - jnz %%directmodeb - call processmode7hires16b - jmp %%nogoc -%%directmodeb - call processmode7hires16bd -%%nogoc - -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne near %%nextline - mov ebx,[Mode7BackA] - mov [mode7A],ebx - mov ebx,[Mode7BackC] - mov [mode7C],ebx - mov ebx,[Mode7BackX0] - mov [mode7X0],ebx - mov ebx,[Mode7BackSet] - mov [mode7set],bl -%endmacro - - -%macro ProcMode7ngextbg16b 2 - mov byte[winon],0 - ; Draw BG - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2+288*2 - mov ebx,[mode7A] - mov [Mode7BackA],ebx - mov ebx,[mode7C] - mov [Mode7BackC],ebx - mov ebx,[mode7X0] - mov [Mode7BackX0],ebx - mov bl,[mode7set] - mov [Mode7BackSet],ebx - mov ebx,1 -%%nextline - mov byte[esi-1],0 - cmp byte[BGFB+ebx],0 - jne near %%nogo - cmp byte[BGMA+ebx],7 - jne near %%nogo - %1 %2, %%nogo - test byte[intrlng+ebx],40h - jz near %%nogo - mov byte[esi-1],1 - push ebx - mov ebp,[cpalval+ebx*4] - ; Process mosaic - mov byte[curmosaicsz],1 - xor ecx,ecx - test byte[mosenng+ebx],1 - jz %%nomosaic - mov cl,[mosszng+ebx] - or cl,cl - jz %%nomosaic - inc cl - mov [curmosaicsz],cl - xor edx,edx - mov eax,ebx - div cl - xor edx,edx - mul cl - mov ebx,eax -%%nomosaic - ; process line by line - mov edx,[mode7ab+ebx*4] - mov [mode7A],edx - mov edx,[mode7cd+ebx*4] - mov [mode7C],edx - mov edx,[mode7xy+ebx*4] - mov [mode7X0],edx - mov edx,[mode7st+ebx] - mov [mode7set],dl - xor edx,edx - mov eax,ebx - test byte[mode7set],02h - jz %%noflip - mov eax,255 - sub eax,ebx -%%noflip - mov dx,[BG1SXl+ebx*2] - mov [m7starty],ax - mov ax,[BG1SYl+ebx*2] - mov [curvidoffset],esi - push esi - call drawmode7ngextbg16b - pop esi - pop ebx -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne near %%nextline - mov ebx,[Mode7BackA] - mov [mode7A],ebx - mov ebx,[Mode7BackC] - mov [mode7C],ebx - mov ebx,[Mode7BackX0] - mov [mode7X0],ebx - mov ebx,[Mode7BackSet] - mov [mode7set],bl -%endmacro - -%macro ProcMode7ngextbg216b 2 - mov byte[winon],0 - ; Draw BG - ; Start line by line drawing/check - mov esi,[vidbuffer] - add esi,16*2+288*2 - mov ebx,[mode7A] - mov [Mode7BackA],ebx - mov ebx,[mode7C] - mov [Mode7BackC],ebx - mov ebx,[mode7X0] - mov [Mode7BackX0],ebx - mov bl,[mode7set] - mov [Mode7BackSet],ebx - mov ebx,1 -%%nextline - cmp byte[BGFB+ebx],0 - jne near %%nogo - cmp byte[BGMA+ebx],7 - jne near %%nogo - %1 %2, %%nogo - test byte[intrlng+ebx],40h - jz near %%nogo - - push ebx - mov ebp,[cpalval+ebx*4] - ; Process mosaic - mov byte[curmosaicsz],1 - xor ecx,ecx - test byte[mosenng+ebx],1 - jz %%nomosaic - mov cl,[mosszng+ebx] - or cl,cl - jz %%nomosaic - inc cl - mov [curmosaicsz],cl - xor edx,edx - mov eax,ebx - div cl - xor edx,edx - mul cl - mov ebx,eax -%%nomosaic - ; process line by line - mov edx,[mode7ab+ebx*4] - mov [mode7A],edx - mov edx,[mode7cd+ebx*4] - mov [mode7C],edx - mov edx,[mode7xy+ebx*4] - mov [mode7X0],edx - mov edx,[mode7st+ebx] - mov [mode7set],dl - xor edx,edx - mov eax,ebx - test byte[mode7set],02h - jz %%noflip - mov eax,255 - sub eax,ebx -%%noflip - mov dx,[BG1SXl+ebx*2] - mov [m7starty],ax - mov ax,[BG1SYl+ebx*2] - mov [curvidoffset],esi - push esi - jmp %%drawb - cmp byte[esi-1],1 - je %%drawb - call drawmode7ngextbg16b - jmp %%drawa -%%drawb - call drawmode7ngextbg216b -%%drawa - pop esi - pop ebx -%%nogo - inc ebx - add esi,288*2 - cmp [resolutn],bx - jne near %%nextline - mov ebx,[Mode7BackA] - mov [mode7A],ebx - mov ebx,[Mode7BackC] - mov [mode7C],ebx - mov ebx,[Mode7BackX0] - mov [mode7X0],ebx - mov ebx,[Mode7BackSet] - mov [mode7set],bl -%endmacro - -%macro preparet4ba 0 - shl cx,5 - add ecx,ecx - add ecx,[vcache4b] -%endmacro - -%macro preparet2ba 0 - shl cx,4 - shl ecx,2 - add ecx,[vcache2b] -%endmacro - -%macro preparet8ba 0 - shl cx,6 - add ecx,[vcache8b] -%endmacro - -%macro preparet2batile 0 - shl ecx,8 - add ecx,[vcache2bs] -%endmacro -%macro preparet4batile 0 - shl ecx,8 - add ecx,[vcache4bs] -%endmacro -%macro preparet8batile 0 - shl ecx,8 - add ecx,[vcache8bs] -%endmacro - -%macro test4ba 0 - and ecx,2047 - test dword[vidmemch4+ecx*2],0FFFFh -%endmacro - -%macro test2ba 0 - and ecx,4095 - add edx,dword[mode0add] - test dword[vidmemch2+ecx],0FFh -%endmacro - -%macro test8ba 0 - and ecx,1023 - test dword[vidmemch8+ecx*4],0FFFFFFFFh -%endmacro - -%macro tilenormal 2 - mov ebx,[ecx+%2] - mov [edi+%1],ebx - mov ebx,[ecx+%2+4] - mov [edi+%1+4],ebx - mov ebx,[ecx+%2+8] - mov [edi+%1+8],ebx - mov ebx,[ecx+%2+12] - mov [edi+%1+12],ebx -%endmacro - -%macro tilenormalb 1 - cmp word[ecx+%1],0FFFFh - je %%nott - mov bx,[ecx+%1] - mov [edi+%1],bx -%%nott -%endmacro - -%macro tilenormals 2 - mov ebx,[ecx+%2] - mov [edi+%1+75036*2],ebx - mov ebx,[ecx+%2+4] - mov [edi+%1+4+75036*2],ebx - mov ebx,[ecx+%2+8] - mov [edi+%1+8+75036*2],ebx - mov ebx,[ecx+%2+12] - mov [edi+%1+12+75036*2],ebx -%endmacro - -%macro tilenormalbs 1 - cmp word[ecx+%1],0FFFFh - je %%nott - mov bx,[ecx+%1] - mov [edi+%1+75036*2],bx -%%nott -%endmacro - -%macro tilenormalt 2 - mov ebx,[ecx+%2] - or ebx,[UnusedBit] - mov [edi+%1],ebx - mov ebx,[ecx+%2+4] - or ebx,[UnusedBit] - mov [edi+%1+4],ebx - mov ebx,[ecx+%2+8] - or ebx,[UnusedBit] - mov [edi+%1+8],ebx - mov ebx,[ecx+%2+12] - or ebx,[UnusedBit] - mov [edi+%1+12],ebx -%endmacro - -%macro tilenormalbt 1 - cmp word[ecx+%1],0FFFFh - je %%nott - mov bx,[ecx+%1] - or bx,[UnusedBit] - mov [edi+%1],bx -%%nott -%endmacro - -%macro tilenormalmsnt 2 - mov ebx,[ecx+%2] - mov [edi+%1],ebx - mov [edi+%1+75036*2],ebx - mov ebx,[ecx+%2+4] - mov [edi+%1+4],ebx - mov [edi+%1+4+75036*2],ebx - mov ebx,[ecx+%2+8] - mov [edi+%1+8],ebx - mov [edi+%1+8+75036*2],ebx - mov ebx,[ecx+%2+12] - mov [edi+%1+12],ebx - mov [edi+%1+12+75036*2],ebx -%endmacro - -%macro tilenormalbmsnt 1 - cmp word[ecx+%1],0FFFFh - je %%nott - mov bx,[ecx+%1] - mov [edi+%1],bx - mov [edi+%1+75036*2],bx -%%nott -%endmacro - -%macro tilenormalmst 2 - mov ebx,[ecx+%2] - mov [edi+%1+75036*2],ebx - or ebx,[UnusedBit] - mov [edi+%1],ebx - mov ebx,[ecx+%2+4] - mov [edi+%1+4+75036*2],ebx - or ebx,[UnusedBit] - mov [edi+%1+4],ebx - mov ebx,[ecx+%2+8] - mov [edi+%1+8+75036*2],ebx - or ebx,[UnusedBit] - mov [edi+%1+8],ebx - mov ebx,[ecx+%2+12] - mov [edi+%1+12+75036*2],ebx - or ebx,[UnusedBit] - mov [edi+%1+12],ebx -%endmacro - -%macro tilenormalbmst 1 - cmp word[ecx+%1],0FFFFh - je %%nott - mov bx,[ecx+%1] - mov [edi+%1+75036*2],bx - or bx,[UnusedBit] - mov [edi+%1],bx -%%nott -%endmacro - -%macro drawtileng16b 12 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache - cmp byte[%9+ecx],dl - je %%returnfromcache - mov [%9+ecx],dl - call %10 -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],4000h - jz %%noflipxfull - add ecx,128 -%%noflipxfull - test dword[vrama+eax],8000h - jnz near %%flipyfull - %11 0,0 - %11 288*2,16 - %11 288*4,32 - %11 288*6,48 - %11 288*8,64 - %11 288*10,80 - %11 288*12,96 - %11 288*14,112 - jmp %5 -%%flipyfull - %11 288*14,0 - %11 288*12,16 - %11 288*10,32 - %11 288*8,48 - %11 288*6,64 - %11 288*4,80 - %11 288*2,96 - %11 0,112 - jmp %5 -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],4000h - jz %%noflipxpart - add ecx,128 -%%noflipxpart - test word[vrama+eax],8000h - jnz near %%flipypart - mov dword[tleftnb],8 -%%nextb - %12 0 - %12 2 - %12 4 - %12 6 - %12 8 - %12 10 - %12 12 - %12 14 - add ecx,16 - add edi,288*2 - dec dword[tleftnb] - jnz near %%nextb - sub edi,288*2*8 - jmp %5 -%%flipypart - add edi,288*2*7 - mov dword[tleftnb],8 -%%nextbm - %12 0 - %12 2 - %12 4 - %12 6 - %12 8 - %12 10 - %12 12 - %12 14 - add ecx,16 - sub edi,288*2 - dec dword[tleftnb] - jnz near %%nextbm - add edi,288*2 -%5 - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - add edi,16 - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - ret -%%docache - call %3 - mov [%9+ecx],dl - call %10 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawtileng16x1616b 12 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache - cmp byte[%9+ecx],dl - je %%returnfromcache - mov [%9+ecx],dl - call %10 -%%returnfromcache - cmp byte[%1+ecx],2 - je near %%done - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],4000h - jz %%noflipxfull - add ecx,128 -%%noflipxfull - test dword[vrama+eax],8000h - jnz near %%flipyfull - %11 0,0 - %11 288*2,16 - %11 288*4,32 - %11 288*6,48 - %11 288*8,64 - %11 288*10,80 - %11 288*12,96 - %11 288*14,112 - jmp %%done -%%flipyfull - %11 288*14,0 - %11 288*12,16 - %11 288*10,32 - %11 288*8,48 - %11 288*6,64 - %11 288*4,80 - %11 288*2,96 - %11 0,112 - jmp %%done -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],4000h - jz %%noflipxpart - add ecx,128 -%%noflipxpart - test word[vrama+eax],8000h - jnz near %%flipypart - mov dword[tleftnb],8 -%%nextb - %12 0 - %12 2 - %12 4 - %12 6 - %12 8 - %12 10 - %12 12 - %12 14 - add ecx,16 - add edi,288*2 - dec dword[tleftnb] - jnz near %%nextb - sub edi,288*2*8 - jmp %%done -%%flipypart - add edi,288*2*7 - mov dword[tleftnb],8 -%%nextbm - %12 0 - %12 2 - %12 4 - %12 6 - %12 8 - %12 10 - %12 12 - %12 14 - add ecx,16 - sub edi,288*2 - dec dword[tleftnb] - jnz near %%nextbm - add edi,288*2 -%%done - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,16 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - ret -%5 - add edi,32 - jmp %%ntile -%%docache - call %3 - mov [%9+ecx],dl - call %10 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro ProcessBuildWindow 1 - mov dword[ngwinen],0 - test byte[winbg1enval+ebx+%1*256],0Ah - jz %%nowindowing - push eax - push ebx - mov al,[winlogicaval+ebx*2] - shr al,%1*2 - and al,03h - mov [nglogicval],al - mov eax,ebx - add ebx,%1*256 - call BuildWindow - mov eax,edi - sub eax,esi - sar eax,1 - cmp dword[ngwintable],0 - jne %%notzero - sub [ngwintable+4],eax - jmp %%done -%%notzero - sub [ngwintable],eax -%%done - pop ebx - pop eax -%%nowindowing -%endmacro - -%macro drawbgtileng16b 2 - mov dword[ng16bprval],0 - mov dword[ng16bbgval],%1 - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16 - push ebx - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,100h - jz .noyinc - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc - lea ecx,[ecx*8] - and ecx,07C0h ; 1Fh*40h - add eax,ecx - mov ecx,[BG1SXl+ebx*2+%1*512] - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,100h - jz .noxinc - add eax,edx - neg dx -.noxinc - mov edi,ecx - sub dx,64 - and ecx,0F8h - and eax,0FFFFh - shr ecx,2 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,07h - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - add edi,edi - cmp dl,2 - jne near .no4bit - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng4b16b -.no4bit - cmp dl,1 - jne near .no2bit - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode0 - push ebx - mov ebx,[mode0ads] - mov [mode0add],ebx - pop ebx -.nomode0 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng2b16b -.no2bit - cmp dl,3 - jne near .no8bit - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng8b16b -.no8bit - pop ebx - ret - -.tiles16x16 - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy - push ebx - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,200h - jz .noyinc2 - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc2 - lea ecx,[ecx*4] - and ecx,07C0h ; 1Fh*40h - add eax,ecx - mov ecx,[BG1SXl+ebx*2+%1*512] - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,200h - jz .noxinc2 - add eax,edx - neg dx -.noxinc2 - mov edi,ecx - sub dx,64 - and ecx,1F0h - and eax,0FFFFh - shr ecx,3 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,0Fh - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - add edi,edi - cmp dl,2 - jne near .no4bit2 - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng16x164b16b -.no4bit2 - cmp dl,1 - jne near .no2bit2 - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode02 - push ebx - mov ebx,[mode0ads] - mov [mode0add],ebx - pop ebx -.nomode02 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng16x162b16b -.no2bit2 - cmp dl,3 - jne near .no8bit - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng16x168b16b -.no8bit2 - pop ebx - ret -%endmacro - -%macro drawbgtilengpr116b 2 - mov dword[ng16bprval],2000h - mov dword[ng16bbgval],%1 - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16 - push ebx - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - cmp dl,2 - jne near .no4bit - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng4b16b -.no4bit - cmp dl,1 - jne near .no2bit - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode0 - push ebx - mov ebx,[mode0ads] - mov [mode0add],ebx - pop ebx -.nomode0 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng2b16b -.no2bit - cmp dl,3 - jne near .no8bit - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng8b16b -.no8bit - pop ebx - ret -.tiles16x16 - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - mov dword[taddnfy16x16],0 - add ecx,ebx - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy - push ebx - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - cmp dl,2 - jne near .no4bit2 - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng16x164b16b -.no4bit2 - cmp dl,1 - jne near .no2bit2 - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode02 - push ebx - mov ebx,[mode0ads] - mov [mode0add],ebx - pop ebx -.nomode02 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng16x162b16b -.no2bit2 - cmp dl,3 - jne near .no8bit2 - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawtileng16x168b16b -.no8bit2 - pop ebx - ret -%endmacro - -%macro procpixels 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2] - shl ebx,16 - mov bx,[eax+ecx*2] - mov [edi+%3],ebx - xor ebx,ebx -%endmacro - -%macro procpixelst 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx -%%nodraw -%endmacro - -%macro procpixelstr 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2+512] - shl ebx,16 - mov bx,[eax+ecx*2+512] - mov [edi+%3],ebx - xor ebx,ebx -%endmacro - -%macro procpixelstt 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2+512] - mov [edi+%2],cx -%%nodraw -%endmacro - -%macro procpixelsnt 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2] - shl ebx,16 - mov bx,[eax+ecx*2] - mov [edi+%3],ebx - xor ebx,ebx -%endmacro - -%macro procpixelstnt 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx -%%nodraw -%endmacro - -%macro procpixelsmst 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2+512] - shl ebx,16 - mov bx,[eax+ecx*2+512] - and ebx,[UnusedBitXor] - mov [edi+%3],ebx - mov [edi+%3+75036*2],ebx - xor ebx,ebx -%endmacro - -%macro procpixelstmst 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2+512] - mov [edi+%2],cx - and cx,[UnusedBitXor] - mov [edi+%2+75036*2],cx -%%nodraw -%endmacro - -%macro procpixelsmsnt 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2] - shl ebx,16 - mov bx,[eax+ecx*2] - mov [edi+%3],ebx - mov [edi+%3+75036*2],ebx - xor ebx,ebx -%endmacro - -%macro procpixelstmsnt 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2],cx - mov [edi+%2+75036*2],cx -%%nodraw -%endmacro - -%macro procpixelss 3 - mov bl,[esi+%2] - mov cl,[esi+%1] - add bl,dl - add cl,dl - mov bx,[eax+ebx*2] - shl ebx,16 - mov bx,[eax+ecx*2] - mov [edi+%3+75036*2],ebx - xor ebx,ebx -%endmacro - -%macro procpixelsts 3 - mov bl,[esi+%1] - add bl,dl - test bl,%3 - jz %%nodraw - mov cx,[eax+ebx*2] - mov [edi+%2+75036*2],cx -%%nodraw -%endmacro - -%macro drawlineng16b 10 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - jmp %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jz %%notflipyfull - add ecx,[flipyposng] - jmp %%yesflipyfull -%%notflipyfull - add ecx,[yposng] -%%yesflipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 0,1,0 - %9 2,3,4 - %9 4,5,8 - %9 6,7,12 - pop eax - jmp %5 -%%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 7,6,0 - %9 5,4,4 - %9 3,2,8 - %9 1,0,12 - pop eax - jmp %5 -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jz %%noflipypart - add ecx,[flipyposng] - jmp %%yesflipypart -%%noflipypart - add ecx,[yposng] -%%yesflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 0,0,%8 - %10 1,2,%8 - %10 2,4,%8 - %10 3,6,%8 - %10 4,8,%8 - %10 5,10,%8 - %10 6,12,%8 - %10 7,14,%8 - pop eax - jmp %5 -%%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 7,0,%8 - %10 6,2,%8 - %10 5,4,%8 - %10 4,6,%8 - %10 3,8,%8 - %10 2,10,%8 - %10 1,12,%8 - %10 0,14,%8 - pop eax -%5 - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - add edi,16 - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawlineng16x1616b 10 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %%done - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test word[vrama+eax],8000h - jz %%noflipyfull - add ecx,[flipyposng] - jmp %%yesflipyfull -%%noflipyfull - add ecx,[yposng] -%%yesflipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 0,1,0 - %9 2,3,4 - %9 4,5,8 - %9 6,7,12 - pop eax - jmp %%done -%%flipxfull - push eax - mov esi,ecx - xor ecx,ecx - xor ebx,ebx - mov eax,[CPalPtrng] - %9 7,6,0 - %9 5,4,4 - %9 3,2,8 - %9 1,0,12 - pop eax - jmp %%done -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jz %%noflipypart - add ecx,[flipyposng] - jmp %%yesflipypart -%%noflipypart - add ecx,[yposng] -%%yesflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 0,0,%8 - %10 1,2,%8 - %10 2,4,%8 - %10 3,6,%8 - %10 4,8,%8 - %10 5,10,%8 - %10 6,12,%8 - %10 7,14,%8 - pop eax - jmp %%done -%%flipxpart - push eax - mov eax,[CPalPtrng] - mov esi,ecx - xor ebx,ebx - %10 7,0,%8 - %10 6,2,%8 - %10 5,4,%8 - %10 4,6,%8 - %10 3,8,%8 - %10 2,10,%8 - %10 1,12,%8 - %10 0,14,%8 - pop eax -%%done - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,16 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng16b - ret -%5 - add edi,32 - jmp %%ntile -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawbglineng16b 2 - mov dword[ng16bprval],0 - mov [pesimpng],esi - mov dword[ng16bbgval],%1 - cmp byte[bgmode],5 - jb %%nointerl - test byte[intrlng+ebx],01h - jz %%nointerl - add ecx,ebx - add ecx,[cfieldad] -%%nointerl - push ebx - mov byte[curmosaicsz],1 - xor eax,eax - test byte[mosenng+ebx],1 << %1 - jz %%nomosaic - mov al,[mosszng+ebx] - or al,al - jz %%nomosaic - inc al - mov [curmosaicsz],al - mov cl,al - mov al,bl - div cl - mul cl - mov ebx,eax - mov edi,xtravbuf+32 - mov ecx,128 - mov eax,0FFFFFFFFh - mov esi,xtravbuf+32 - rep stosd - or ebx,ebx - jnz %%nozeroline - inc ebx -%%nozeroline - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - add ecx,ebx - jmp %%yesmosaic -%%nomosaic -%%yesmosaic - cmp byte[BGMA+ebx],5 - jae near .tiles16x8 - cmp byte[osm2dis],1 - je .nooffsetm - cmp byte[BGMA+ebx],2 - je near .offsetm - cmp byte[bgmode],4 - je .nooffsetm4 - cmp byte[BGMA+ebx],4 - je near .offsetm -.nooffsetm4 - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16 -.nooffsetm - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,100h - jz .noyinc - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc - lea ecx,[ecx*8] - mov edx,ecx - and ecx,07C0h ; 1Fh*40h - and edx,38h - add eax,ecx - mov [yposng],edx - xor edx,38h - mov ecx,[BG1SXl+ebx*2+%1*512] - mov [flipyposng],edx - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,100h - jz .noxinc - add eax,edx - neg dx -.noxinc - mov edi,ecx - sub dx,64 - and ecx,0F8h - and eax,0FFFFh - shr ecx,2 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,07h - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - add edi,edi - cmp dl,2 - jne near .no4bit - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - add ecx,%2*256 - mov dl,1 << %2 - jmp drawlineng4b16b -.no4bit - cmp dl,1 - jne near .no2bit - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode0 - mov ecx,[mode0ads] - mov [mode0add],ecx -.nomode0 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng2b16b -.no2bit - cmp dl,3 - jne near .no8bit - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng8b16b -.no8bit - pop ebx - ret - -.tiles16x16 - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,200h - jz .noyinc2 - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc2 - lea edx,[ecx*8] - lea ecx,[ecx*4] - and edx,38h - and ecx,07C0h ; 1Fh*40h - mov [yposng],edx - xor edx,38h - add eax,ecx - mov [flipyposng],edx - mov ecx,[BG1SXl+ebx*2+%1*512] - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,200h - jz .noxinc2 - add eax,edx - neg dx -.noxinc2 - mov edi,ecx - sub dx,64 - and ecx,1F0h - and eax,0FFFFh - shr ecx,3 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,0Fh - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - add edi,edi - cmp dl,2 - jne near .no4bit2 - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x164b16b -.no4bit2 - cmp dl,1 - jne near .no2bit2 - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode02 - push ebx - mov ebx,[mode0ads] - mov [mode0add],ebx - pop ebx -.nomode02 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x162b16b -.no2bit2 - cmp dl,3 - jne near .no8bit - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x168b16b -.no8bit2 - pop ebx - ret - -.tiles16x8 - cmp byte[t16x161+ebx+%1*256],1 - je .tiles16x16hr - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],0 - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,100h - jz .noyinc2c - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc2c - lea ecx,[ecx*8] - mov edx,ecx - and ecx,07C0h ; 1Fh*40h - and edx,38h - jmp .tiles16x8hr -.tiles16x16hr - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy2 - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy2 - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,200h - jz .noyinc2b - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc2b - lea edx,[ecx*8] - lea ecx,[ecx*4] - and edx,38h - and ecx,07C0h ; 1Fh*40h -.tiles16x8hr - mov [yposng],edx - xor edx,38h - add eax,ecx - mov [flipyposng],edx - mov ecx,[BG1SXl+ebx*2+%1*512] - add ecx,ecx - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,200h - jz .noxinc2b - add eax,edx - neg dx -.noxinc2b - mov edi,ecx - sub dx,64 - and ecx,01F0h - and eax,0FFFFh - shr ecx,3 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,0Fh - and edx,07h - and ecx,0FFFFh - shr edi,1 - mov edx,[colormodedef+edx*4+%1] - neg edi - add edi,edi - cmp dl,2 - jne near .no4bit2b - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[cbgval],%1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x84b16b -.no4bit2b - cmp dl,1 - jne near .no2bit2b - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - mov dword[cbgval],%1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x82b16b -.no2bit2b - pop ebx - ret - - -.offsetm16x16 - pushad - xor edx,edx - mov dx,[BG3SYl+ebx*2] -; and dx,0F8h - shr edx,3 - shl edx,6 - xor eax,eax - mov ax,[BGPT3+ebx*2] - add ax,dx - xor edx,edx - mov dx,[BG3SXl+ebx*2] - and dx,0F8h - mov [ofsmcyps],ebx - shr edx,3 - shl edx,1 - add ax,dx - mov dx,[bg3scrolx] - test dx,1000h - jz .nooma16x16 - and dx,0F000h - shr dx,5 - add ax,dx -.nooma16x16 - cmp byte[BGMA+ebx],4 - je .offsetm416x16 - add eax,40h -.offsetm416x16 - mov edx,eax - and edx,0FFFFFFC0h - add edx,[vram] - mov [ofsmcptr],edx - and eax,3Fh - mov [ofsmcptr2],eax - mov eax,[BGPT1Y+ebx*2+%1*512] - mov [ofsmady],eax - mov eax,[BGPT1X+ebx*2+%1*512] - mov [ofsmadx],eax - mov eax,[BGPT1+ebx*2+%1*512] - mov [ofsmtptr],eax - mov [ofsmtptrs],eax - test ecx,100h - jz .noyincd16x16 - add eax,[BGPT1Y+ebx*2+%1*512] -.noyincd16x16 - lea ecx,[ecx*8] - mov edx,ecx - and ecx,07C0h ; 1Fh*40h - and edx,38h - add eax,ecx - mov [yposng],edx - mov [yposngom],edx - xor edx,38h - mov ecx,[BG1SXl+ebx*2+%1*512] - mov [flipyposng],edx - mov [flipyposngom],edx - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,100h - jz .noxincd16x16 - add eax,edx - add [ofsmtptr],edx - neg dx -.noxincd16x16 - mov edi,ecx - sub dx,64 - and ecx,0F8h - and eax,0FFFFh - shr ecx,2 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - add [ofsmtptr],ecx - mov [ofsmmptr],eax - mov dword[ofshvaladd],0 - popad - - mov eax,[BGPT1+ebx*2+%1*512] - mov [ofsmtptr],eax - mov [ofsmtptrs],eax - - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy16om - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy16om - mov eax,[BGPT1+ebx*2+%1*512] - test ecx,200h - jz .noyinc216om - add eax,[BGPT1Y+ebx*2+%1*512] -.noyinc216om - lea edx,[ecx*8] - lea ecx,[ecx*4] - and edx,38h - and ecx,07C0h ; 1Fh*40h - mov [yposng],edx - xor edx,38h - add eax,ecx - mov [flipyposng],edx - mov [flipyposngom],edx - mov ecx,[BG1SXl+ebx*2+%1*512] - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,200h - jz .noxinc216om - add eax,edx - add [ofsmtptr],edx - neg dx -.noxinc216om - mov edi,ecx - sub dx,64 - and ecx,1F0h - and eax,0FFFFh - shr ecx,3 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - add [ofsmtptr],ecx - mov [ofsmmptr],eax - - mov word[bgtxadd2],0 - cmp word[BGPT3X+ebx*2],0 - je .yesoverfl - mov cx,[BG3SXl+ebx*2] - add cx,16 - test cx,100h - jz .notoverfl - add dword[ofsmcptr],800h - sub word[bgtxadd2],800h - jmp .yesoverfl -.notoverfl - add word[bgtxadd2],800h -.yesoverfl - - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,0Fh - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - add edi,edi - cmp dl,2 - jne near .no4bitom16x16 - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[ofsmval],2000h << %1 - mov dword[ofsmvalh],2000h << %1 - mov dword[cbgval],%1 - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlinengom16x164b16b -.no4bitom16x16 - pop ebx - ret - - ; Offsetmode calculation : *1024+*32+ -.offsetm - cmp byte[t16x161+ebx+%1*256],1 - je near .offsetm16x16 - xor edx,edx - mov dx,[BG3SYl+ebx*2] - test dx,08h - jz .overflow - and dx,0F8h -.overflow - shr edx,3 - shl edx,6 - xor eax,eax - mov ax,[BGPT3+ebx*2] - add ax,dx - xor edx,edx - mov dx,[BG3SXl+ebx*2] - and dx,0F8h - mov [ofsmcyps],ebx - shr edx,3 - shl edx,1 - add ax,dx - mov dx,[bg3scrolx] - test dx,1000h - jz .nooma - and dx,0F000h - shr dx,5 - add ax,dx -.nooma -; cmp byte[BGMA+ebx],4 -; je .offsetm4 - add eax,40h -.offsetm4 - mov edx,eax - and edx,0FFFFFFC0h - add edx,[vram] - mov [ofsmcptr],edx - and eax,3Fh - mov [ofsmcptr2],eax - mov eax,[BGPT1Y+ebx*2+%1*512] - mov [ofsmady],eax - mov eax,[BGPT1X+ebx*2+%1*512] - mov [ofsmadx],eax - mov eax,[BGPT1+ebx*2+%1*512] - mov [ofsmtptr],eax - mov [ofsmtptrs],eax - - test ecx,100h - jz .noyincd - add eax,[BGPT1Y+ebx*2+%1*512] -.noyincd - lea ecx,[ecx*8] - mov edx,ecx - and ecx,07C0h ; 1Fh*40h - and edx,38h - add eax,ecx - mov [yposng],edx - mov [yposngom],edx - xor edx,38h - mov ecx,[BG1SXl+ebx*2+%1*512] - mov [flipyposng],edx - mov [flipyposngom],edx - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,100h - jz .noxincd - add eax,edx - add [ofsmtptr],edx - neg dx -.noxincd - mov edi,ecx - sub dx,64 - and ecx,0F8h - and eax,0FFFFh - shr ecx,2 - mov [bgtxadd],edx - mov [bgtxad+ebx*2+%2*512],dx - add eax,ecx - add [ofsmtptr],ecx - mov [ofsmmptr],eax - - mov word[bgtxadd2],0 - cmp word[BGPT3X+ebx*2],0 - je .yesoverfl3 - mov cx,[BG3SXl+ebx*2] - add cx,16 - test cx,100h - jz .notoverfl3 - add dword[ofsmcptr],800h - sub word[bgtxadd2],800h - jmp .yesoverfl3 -.notoverfl3 - add word[bgtxadd2],800h -.yesoverfl3 - - mov dword[ofshvaladd],0 - mov ecx,[BGOPT1+ebx*2+%1*512] - mov edx,[BGMA+ebx] - and edi,07h - and edx,07h - and ecx,0FFFFh - mov edx,[colormodedef+edx*4+%1] - neg edi - add edi,edi - cmp dl,2 - jne near .no4bitd - shr ecx,5 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[ofsmval],2000h << %1 - mov dword[ofsmvalh],2000h << %1 - mov dword[cbgval],%1 - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlinengom4b16b -.no4bitd - cmp dl,1 - jne near .no2bitdn - ; eax = pointer to beginning of tile area - shr ecx,4 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - mov byte[tleftn],33 - -.loopdn - mov cx,[vrama+eax] - test cx,2000h - jnz near .fintiledn - drawlinengom216b tltype2b, preparet2ba, cachesingle2bng,.loopdn,.fintiledn,ngpalcon2b,test2ba,03h,%1 -.no2bitdn - cmp dl,3 - jne near .no8bitdn - ; eax = pointer to beginning of tile area - shr ecx,6 - add edi,esi - mov [ngptrdat+%2*1024+ebx*4],ecx - mov [ngptrdat2],ecx - mov [ngceax+%2*1024+ebx*4],eax - mov [ngcedi+%2*1024+ebx*4],edi - ; eax = pointer to beginning of tile area - mov byte[tleftn],33 - -.loopdn2 - mov cx,[vrama+eax] - test cx,2000h - jnz near .fintiledn2 - drawlinengom216b tltype8b, preparet8ba, cachesingle8bng,.loopdn2,.fintiledn2,ngpalcon8b,test8ba,0FFh,%1 -.no8bitdn - pop ebx - ret -%endmacro - -%macro mosender 1 -.nodraw - add edi,%1*2 - add esi,%1*2 - dec ecx - jnz near .next - pop esi - mov dword[ignor512],0 - ret -%endmacro - -%macro drawbglinengpr116b 2 - mov dword[ng16bprval],2000h - mov [pesimpng],esi - mov dword[ng16bbgval],%1 - push ebx - mov byte[curmosaicsz],1 - xor eax,eax - test byte[mosenng+ebx],1 << %1 - jz %%nomosaic - mov al,[mosszng+ebx] - or al,al - jz %%nomosaic - inc al - mov [curmosaicsz],al - mov cl,al - mov al,bl - div cl - mul cl - mov ebx,eax - mov edi,xtravbuf+32 - mov ecx,128 - mov eax,0FFFFFFFFh - mov esi,xtravbuf+32 - rep stosd - or ebx,ebx - jnz %%nomosaic - inc ebx - jmp %%yesmosaic -%%nomosaic -%%yesmosaic - cmp byte[BGMA+ebx],5 - jae near .tiles16x8 - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16 - cmp byte[osm2dis],1 - je .nooffsetm - cmp byte[BGMA+ebx],2 - je near .offsetm -; cmp byte[BGMA+ebx],4 -; je near .offsetm -.nooffsetm - mov eax,[BG1SYl+ebx*2+%1*512] - and eax,0FFFFh - add eax,ebx - test byte[intrlng+ebx],01h - jz %%nointerl - add eax,ebx - add eax,[cfieldad] -%%nointerl - lea eax,[eax*8] - and eax,38h - mov [yposng],eax - xor eax,38h - mov [flipyposng],eax - - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - - cmp dl,2 - jne near .no4bit - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng4b16b -.no4bit - cmp dl,1 - jne near .no2bit - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode0 - mov ecx,[mode0ads] - mov [mode0add],ecx -.nomode0 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng2b16b -.no2bit - cmp dl,3 - jne near .no8bit - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng8b16b -.no8bit - pop ebx - ret - -.tiles16x16 - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - mov dword[taddnfy16x16],0 - add ecx,ebx - - test byte[intrlng+ebx],01h - jz %%nointerl7 - add ecx,ebx - add ecx,[cfieldad] -%%nointerl7 - - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomy - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomy - - lea eax,[ecx*8] - and eax,38h - mov [yposng],eax - xor eax,38h - mov [flipyposng],eax - - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - cmp dl,2 - jne near .no4bit2 - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x164b16b -.no4bit2 - cmp dl,1 - jne near .no2bit2 - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - ProcessBuildWindow %1 - cmp byte[BGMA+ebx],0 - jne .nomode02 - push ebx - mov ebx,[mode0ads] - mov [mode0add],ebx - pop ebx -.nomode02 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x162b16b -.no2bit2 - cmp dl,3 - jne near .no8bit2 - ; eax = pointer to beginning of tile area - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x168b16b -.no8bit2 - pop ebx - ret - -.tiles16x8 - mov ecx,[BG1SYl+ebx*2+%1*512] - and ecx,0FFFFh - add ecx,ebx - - test byte[intrlng+ebx],01h - jz %%nointerl8 - add ecx,ebx - add ecx,[cfieldad] -%%nointerl8 - - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],16 - test ecx,08h - jz .nobottomyb - mov dword[taddnfy16x16],16 - mov dword[taddfy16x16],-16 -.nobottomyb - cmp byte[t16x161+ebx+%1*256],1 - je near .tiles16x16hr - mov dword[taddnfy16x16],0 - mov dword[taddfy16x16],0 -.tiles16x16hr - - lea eax,[ecx*8] - and eax,38h - mov [yposng],eax - xor eax,38h - mov [flipyposng],eax - - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - cmp dl,2 - jne near .no4bit2b - ; eax = pointer to beginning of tile area - mov dword[cbgval],%1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x84b16b -.no4bit2b - cmp dl,1 - jne near .no2bit2b - ; eax = pointer to beginning of tile area - mov dword[mode0add],0 - mov dword[cbgval],%1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlineng16x82b16b -.no2bit2b - pop ebx - ret - -.offsetm - xor edx,edx - mov dx,[BG3SYl+ebx*2] -; and dx,0F8h - shr edx,3 - shl edx,6 - xor eax,eax - mov ax,[BGPT3+ebx*2] - add ax,dx - xor edx,edx - mov dx,[BG3SXl+ebx*2] - and dx,0F8h - mov [ofsmcyps],ebx - shr edx,3 - shl edx,1 - add ax,dx - mov dx,[bg3scrolx] - test dx,1000h - jz .nooma - and dx,0F000h - shr dx,5 - add ax,dx -.nooma - mov edx,eax -; cmp byte[BGMA+ebx],4 -; je .offsetm4 - add edx,40h -.offsetm4 - and edx,0FFC0h - add edx,[vram] - mov [ofsmcptr],edx - and eax,3Fh - mov [ofsmcptr2],eax - mov eax,[BGPT1Y+ebx*2+%1*512] - mov [ofsmady],eax - mov eax,[BGPT1X+ebx*2+%1*512] - mov [ofsmadx],eax - mov eax,[BGPT1+ebx*2+%1*512] - mov [ofsmtptr],eax - mov [ofsmtptrs],eax - - mov word[bgtxadd2],0 - cmp word[BGPT3X+ebx*2],0 - je .yesoverfl - mov cx,[BG3SXl+ebx*2] - add cx,16 - test cx,100h - jz .notoverfl - add dword[ofsmcptr],800h - sub word[bgtxadd2],800h - jmp .yesoverfl -.notoverfl - add word[bgtxadd2],800h -.yesoverfl - - mov ecx,[BG1SXl+ebx*2+%1*512] - mov edx,[BGPT1X+ebx*2+%1*512] - test ecx,100h - jz .noxincdd - add [ofsmtptr],edx -.noxincdd - and ecx,0F8h - shr ecx,2 - add [ofsmtptr],ecx - mov eax,[BG1SYl+ebx*2+%1*512] - and eax,0FFFFh - add eax,ebx - lea eax,[eax*8] - and eax,38h - mov [yposng],eax - mov [yposngom],eax - xor eax,38h - mov [flipyposng],eax - mov [flipyposngom],eax - mov edx,[BGMA+ebx] - mov ecx,[bgtxad+ebx*2+%2*512] - and edx,07h - mov [bgtxadd],cx - mov ecx,[ngptrdat+%2*1024+ebx*4] - mov edx,[colormodedef+edx*4+%1] - mov [ngptrdat2],ecx - mov eax,[ngceax+%2*1024+ebx*4] - mov edi,[ngcedi+%2*1024+ebx*4] - mov [ofsmmptr],eax - mov dword[ofshvaladd],0 - cmp dl,2 - jne near .no4bitd - ; eax = pointer to beginning of tile area - mov dword[ofsmval],2000h << %1 - mov dword[ofsmvalh],2000h << %1 - mov dword[cbgval],%1 - ProcessBuildWindow %1 - mov ecx,ebx - mov dl,1 << %2 - add ecx,%2*256 - jmp drawlinengom4b16b -.no4bitd - cmp dl,1 - jne near .no2bitdn - ; eax = pointer to beginning of tile area - mov byte[tleftn],33 - -.loopdn - mov cx,[vrama+eax] - test cx,2000h - jz near .fintiledn - drawlinengom216b tltype2b, preparet2ba, cachesingle2bng,.loopdn,.fintiledn,ngpalcon2b,test2ba,03h,%1 -.no2bitdn - cmp dl,3 - jne near .no8bitdn - ; eax = pointer to beginning of tile area - mov byte[tleftn],33 - -.loopdn2 - mov cx,[vrama+eax] - test cx,2000h - jz near .fintiledn2 - drawlinengom216b tltype8b, preparet8ba, cachesingle8bng,.loopdn2,.fintiledn2,ngpalcon8b,test8ba,0FFh,%1 -.no8bitdn - pop ebx - ret -%endmacro diff --git a/tools/zsnes/src/video/newgfx2.asm b/tools/zsnes/src/video/newgfx2.asm deleted file mode 100644 index fe030a5..0000000 --- a/tools/zsnes/src/video/newgfx2.asm +++ /dev/null @@ -1,672 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 ngwintable,ngwinen,ngcwinptr,ngcpixleft,ngcwinmode,cachesingle4bng -EXTSYM tleftn,ng16bprval,vrama,bg1drwng,ng16bbgval,bg1totng,ngptrdat2 -EXTSYM bgtxadd,taddnfy16x16,taddfy16x16,switch16x16,curmosaicsz,domosaicng -EXTSYM vidmemch4,vidmemch2,vidmemch8,mode0add,vcache4b,vcache2b,vcache8b -EXTSYM cachesingle2bng,cachesingle8bng,ngpalcon4b,ngpalcon8b,ofshvaladd -EXTSYM ngpalcon2b,tleftnb,tltype2b,tltype4b,tltype8b,yposng,flipyposng -EXTSYM ofsmcptr,ofsmtptr,ofsmmptr,ofsmcyps,ofsmady,ofsmadx,ofsmtptrs,ofsmcptr2 -EXTSYM yposngom,flipyposngom,cbgval,ofsmval,ofsmvalh,bgtxadd2 - -%include "video/vidmacro.mac" -%include "video/newgfx2.mac" -%include "video/newgfx.mac" -%include "video/newgfxwn.mac" - - -;****************************************** -; 8x8 tiles - tile engine -;****************************************** - -%macro WinClipMacro 1 - mov byte[tleftn],33 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %1 - sub dword[ebx],8 - add ax,2 - mov ebx,[ng16bbgval] - add edi,8 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jnz .notileadd - add ax,[bgtxadd] -.notileadd - dec byte[tleftn] - jnz .winclipped - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %1 - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline -%endmacro - -SECTION .text - -NEWSYM drawtileng2b - cmp byte[ngwinen],1 - je near drawtileng2bwin - mov byte[tleftn],33 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawtileng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h - ret -drawtileng2bwin: - WinClipMacro Processwinclip2bt - drawtileng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h -Processwinclip2bt: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawtilengwin tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawtileng2bwin.winclipped - jmp drawtileng2bwin.loop - - -NEWSYM drawtileng4b - cmp byte[ngwinen],1 - je near drawtileng4bwin - mov byte[tleftn],33 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawtileng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh - ret -drawtileng4bwin: - WinClipMacro Processwinclip4bt - drawtileng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh -Processwinclip4bt: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawtilengwin tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawtileng4bwin.winclipped - jmp drawtileng4bwin.loop - -NEWSYM drawtileng8b - cmp byte[ngwinen],1 - je near drawtileng8bwin - mov byte[tleftn],33 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawtileng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh - ret - -drawtileng8bwin: - WinClipMacro Processwinclip8bt - drawtileng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh -Processwinclip8bt: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawtilengwin tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawtileng8bwin.winclipped - jmp drawtileng8bwin.loop - -;****************************************** -; 16x16 tiles - tile engine -;****************************************** - -%macro WinClipMacro16x16 1 - mov byte[tleftn],17 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %1 - sub dword[ebx],16 - add ax,2 - mov ebx,[ng16bbgval] - add edi,16 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jnz .notileadd - add ax,[bgtxadd] -.notileadd - dec byte[tleftn] - jnz .winclipped - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],16 - jbe near %1 - sub dword[ebx],16 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline -%endmacro - -NEWSYM drawtileng16x162b - cmp byte[ngwinen],1 - je near drawtileng16x162bwin - mov byte[tleftn],17 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawtileng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h - ret -drawtileng16x162bwin: - WinClipMacro16x16 Processwinclip16x162bt - drawtileng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h -Processwinclip16x162bt: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawtileng16x16win tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawtileng16x162bwin.winclipped - jmp drawtileng16x162bwin.loop - -NEWSYM drawtileng16x164b - cmp byte[ngwinen],1 - je near drawtileng16x164bwin - mov byte[tleftn],17 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawtileng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh - ret -drawtileng16x164bwin: - WinClipMacro16x16 Processwinclip16x164bt - drawtileng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh -Processwinclip16x164bt: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawtileng16x16win tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawtileng16x164bwin.winclipped - jmp drawtileng16x164bwin.loop - -NEWSYM drawtileng16x168b - mov byte[tleftn],17 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawtileng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh - ret -drawtileng16x168bwin: - WinClipMacro16x16 Processwinclip16x168bt - drawtileng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh -Processwinclip16x168bt: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawtileng16x16win tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawtileng16x168bwin.winclipped - jmp drawtileng16x168bwin.loop - -;****************************************** -; 8x8 tiles - line by line engine -;****************************************** - -NEWSYM drawlineng2b - cmp byte[ngwinen],1 - je near drawlineng2bwin - mov byte[tleftn],33 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlineng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h - ret -drawlineng2bwin: - WinClipMacro Processwinclip2b - drawlineng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h -Processwinclip2b: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawlinengwin tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawlineng2bwin.winclipped - jmp drawlineng2bwin.loop - -NEWSYM drawlineng4b - cmp byte[ngwinen],1 - je near drawlineng4bwin - mov byte[tleftn],33 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlineng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh - ret -drawlineng4bwin: - WinClipMacro Processwinclip4b - drawlineng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh -Processwinclip4b: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawlinengwin tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawlineng4bwin.winclipped - jmp drawlineng4bwin.loop - -NEWSYM drawlineng8b - cmp byte[ngwinen],1 - je near drawlineng8bwin - mov byte[tleftn],33 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlineng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh - ret -drawlineng8bwin: - WinClipMacro Processwinclip8b - drawlineng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh -Processwinclip8b: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawlinengwin tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawlineng8bwin.winclipped - jmp drawlineng8bwin.loop - -;****************************************** -; 16x16 tiles - line by line engine -;****************************************** - -NEWSYM drawlineng16x162b - cmp byte[ngwinen],1 - je near drawlineng16x162bwin - mov byte[tleftn],17 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlineng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h - ret -drawlineng16x162bwin: - WinClipMacro16x16 Processwinclip16x162b - drawlineng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h -Processwinclip16x162b: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawlineng16x16win tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawlineng16x162bwin.winclipped - jmp drawlineng16x162bwin.loop - -NEWSYM drawlineng16x164b - cmp byte[ngwinen],1 - je near drawlineng16x164bwin - mov byte[tleftn],17 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlineng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh - ret -drawlineng16x164bwin: - WinClipMacro16x16 Processwinclip16x164b - drawlineng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh -Processwinclip16x164b: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawlineng16x16win tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawlineng16x164bwin.winclipped - jmp drawlineng16x164bwin.loop - -NEWSYM drawlineng16x168b - cmp byte[ngwinen],1 - je near drawlineng16x168bwin - mov byte[tleftn],17 -.loop - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline - drawlineng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh - ret -drawlineng16x168bwin: - WinClipMacro16x16 Processwinclip16x168b - drawlineng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh -Processwinclip16x168b: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .finline - drawlineng16x16win tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawlineng16x168bwin.winclipped - jmp drawlineng16x168bwin.loop - -NEWSYM drawlineng16x84b - mov byte[tleftn],33 -.loop2b - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .fintile2b - drawlineng16x8 tltype4b, preparet4ba, cachesingle4bng,.loop2b,.fintile2b,ngpalcon4b,test4ba,0Fh - -NEWSYM drawlineng16x82b - mov byte[tleftn],33 -.loopb2b - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .fintileb2b - drawlineng16x8 tltype2b, preparet2ba, cachesingle2bng,.loopb2b,.fintileb2b,ngpalcon2b,test2ba,03h - -%macro WinClipMacroom 1 - mov byte[tleftn],33 - mov dword[ngcwinptr],ngwintable - mov dword[ngcwinmode],0 - cmp dword[ngwintable],0 - jne near .loop - add dword[ngcwinptr],4 - mov dword[ngcwinmode],1 -.winclipped - mov ebx,[ngcwinptr] - cmp dword[ebx],8 - jbe near %1 - sub dword[ebx],8 - - mov ebx,[cbgval] - add word[ofsmmptr],2 - inc dword[bg1totng+ebx*4] - add word[ofsmtptr],2 - mov ax,[ofsmmptr] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - add edi,8 - test eax,03Fh - jnz .next - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx -.next - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - mov ecx,[ofsmval] - add dword[ofshvaladd],8 - test dword[ebx],ecx - jz .noofsm2 - mov ebx,[ebx] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz .noupper2 - add ax,[ofsmady] -.noupper2 - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -.noofsm2 - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofsmcptr2],2 - mov ecx,[ofsmvalh] - and dword[ofsmcptr2],3Fh - test dword[ebx-40h],ecx - jz .noofsmh - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz .noleft - add ax,[ofsmadx] -.noleft - and ebx,0F8h - shr ebx,2 - add ax,bx -.noofsmh - - dec byte[tleftn] - jnz near .winclipped - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -.loop - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - cmp dword[ebx],8 - jbe near %1 - sub dword[ebx],8 - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .finline -%endmacro - -NEWSYM drawlinengom4b - cmp byte[ngwinen],1 - je near drawlinengom4bwin - mov byte[tleftn],33 -.loopd - mov cx,[vrama+eax] - xor ecx,[ng16bprval] - test ecx,2000h - jnz near .fintiled - drawlinengom tltype4b, preparet4ba, cachesingle4bng,.loopd,.fintiled,ngpalcon4b,test4ba,0Fh -drawlinengom4bwin: - WinClipMacroom Processwinclipom4b - drawlinengom tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh -Processwinclipom4b: - mov ebx,[ngcwinptr] - mov cx,[vrama+eax] - mov ebx,[ebx] - xor ecx,[ng16bprval] - mov [ngcpixleft],ebx - test ecx,2000h - jnz near .fintiled - drawlinengomwin tltype4b, preparet4ba, cachesingle4bng,.loop,.fintiled,ngpalcon4b,test4ba,0Fh -.loop - push eax - mov ebx,[ngcwinptr] - mov eax,[ngcpixleft] - mov [ebx],eax - pop eax - cmp dword[ngcwinmode],1 - je near drawlinengom4bwin.winclipped - jmp drawlinengom4bwin.loop - - diff --git a/tools/zsnes/src/video/newgfx2.mac b/tools/zsnes/src/video/newgfx2.mac deleted file mode 100644 index f4b4536..0000000 --- a/tools/zsnes/src/video/newgfx2.mac +++ /dev/null @@ -1,1009 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -; Finish up parttile - -%macro drawlineng16x8 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[cbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %%done - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfull - add ecx,[yposng] - test dword[vrama+eax],4000h - jnz near %%flipxfull - mov ebx,[ecx] - add ebx,edx - mov [edi],bl - mov [edi+75036],bh - shr ebx,16 - mov [edi+1],bl - mov [edi+75037],bh - mov ebx,[ecx+4] - add ebx,edx - mov [edi+2],bl - mov [edi+75038],bh - shr ebx,16 - mov [edi+3],bl - mov [edi+75039],bh - jmp %%done -%%flipxfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],bl - mov [edi+75036],bh - shr ebx,16 - mov [edi+1],bl - mov [edi+75037],bh - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+2],bl - mov [edi+75038],bh - shr ebx,16 - mov [edi+3],bl - mov [edi+75039],bh - jmp %%done -%%flipyfull - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxyfull - mov ebx,[ecx] - add ebx,edx - mov [edi],bl - mov [edi+75036],bh - shr ebx,16 - mov [edi+1],bl - mov [edi+75037],bh - mov ebx,[ecx+4] - add ebx,edx - mov [edi+2],bl - mov [edi+75038],bh - shr ebx,16 - mov [edi+3],bl - mov [edi+75039],bh - jmp %%done -%%flipxyfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],bl - mov [edi+75036],bh - shr ebx,16 - mov [edi+1],bl - mov [edi+75037],bh - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+2],bl - mov [edi+75038],bh - shr ebx,16 - mov [edi+3],bl - mov [edi+75039],bh - jmp %%done -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - add ecx,[yposng] - test word[vrama+eax],4000h - jnz near %%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawd - add ebx,edx - test bl,%8 - jz %%drawa - mov [edi],bl -%%drawa - test bh,%8 - jz %%drawb - mov [edi+75036],bh -%%drawb - shr ebx,16 - test bl,%8 - jz %%drawc - mov [edi+1],bl -%%drawc - test bh,%8 - jz %%drawd - mov [edi+75037],bh -%%drawd - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2 - add ebx,edx - test bl,%8 - jz %%drawa2 - mov [edi+2],bl -%%drawa2 - test bh,%8 - jz %%drawb2 - mov [edi+75038],bh -%%drawb2 - shr ebx,16 - test bl,%8 - jz %%drawc2 - mov [edi+3],bl -%%drawc2 - test bh,%8 - jz %%drawd2 - mov [edi+75039],bh -%%drawd2 - jmp %%done - -%%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdf - add ebx,edx - test bl,%8 - jz %%drawaf - mov [edi+75039],bl -%%drawaf - test bh,%8 - jz %%drawbf - mov [edi+3],bh -%%drawbf - shr ebx,16 - test bl,%8 - jz %%drawcf - mov [edi+75038],bl -%%drawcf - test bh,%8 - jz %%drawdf - mov [edi+2],bh -%%drawdf - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2f - add ebx,edx - test bl,%8 - jz %%drawa2f - mov [edi+75037],bl -%%drawa2f - test bh,%8 - jz %%drawb2f - mov [edi+1],bh -%%drawb2f - shr ebx,16 - test bl,%8 - jz %%drawc2f - mov [edi+75036],bl -%%drawc2f - test bh,%8 - jz %%drawd2f - mov [edi],bh -%%drawd2f - jmp %%done - -%%flipypart - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdm - add ebx,edx - test bl,%8 - jz %%drawam - mov [edi],bl -%%drawam - test bh,%8 - jz %%drawbm - mov [edi+75036],bh -%%drawbm - shr ebx,16 - test bl,%8 - jz %%drawcm - mov [edi+1],bl -%%drawcm - test bh,%8 - jz %%drawdm - mov [edi+75037],bh -%%drawdm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2m - add ebx,edx - test bl,%8 - jz %%drawa2m - mov [edi+2],bl -%%drawa2m - test bh,%8 - jz %%drawb2m - mov [edi+75038],bh -%%drawb2m - shr ebx,16 - test bl,%8 - jz %%drawc2m - mov [edi+3],bl -%%drawc2m - test bh,%8 - jz %%drawd2m - mov [edi+75039],bh -%%drawd2m - jmp %%done - -%%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdfm - add ebx,edx - test bl,%8 - jz %%drawafm - mov [edi+75039],bl -%%drawafm - test bh,%8 - jz %%drawbfm - mov [edi+3],bh -%%drawbfm - shr ebx,16 - test bl,%8 - jz %%drawcfm - mov [edi+75038],bl -%%drawcfm - test bh,%8 - jz %%drawdfm - mov [edi+2],bh -%%drawdfm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2fm - add ebx,edx - test bl,%8 - jz %%drawa2fm - mov [edi+75037],bl -%%drawa2fm - test bh,%8 - jz %%drawb2fm - mov [edi+1],bh -%%drawb2fm - shr ebx,16 - test bl,%8 - jz %%drawc2fm - mov [edi+75036],bl -%%drawc2fm - test bh,%8 - jz %%drawd2fm - mov [edi],bh -%%drawd2fm -%%done - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,4 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[cbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -%5 - add edi,8 - jmp %%ntile -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawlinengom2 9 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov dl,ch - inc dword[bg1drwng+%9*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfull - add ecx,[yposng] - test dword[vrama+eax],4000h - jnz near %%flipxfull - mov ebx,[ecx] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipxfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipyfull - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxyfull - mov ebx,[ecx] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipxyfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - add ecx,[yposng] - test word[vrama+eax],4000h - jnz near %%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawd - add ebx,edx - test bl,%8 - jz %%drawa - mov [edi],bl -%%drawa - test bh,%8 - jz %%drawb - mov [edi+1],bh -%%drawb - shr ebx,16 - test bl,%8 - jz %%drawc - mov [edi+2],bl -%%drawc - test bh,%8 - jz %%drawd - mov [edi+3],bh -%%drawd - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2 - add ebx,edx - test bl,%8 - jz %%drawa2 - mov [edi+4],bl -%%drawa2 - test bh,%8 - jz %%drawb2 - mov [edi+5],bh -%%drawb2 - shr ebx,16 - test bl,%8 - jz %%drawc2 - mov [edi+6],bl -%%drawc2 - test bh,%8 - jz %%drawd2 - mov [edi+7],bh -%%drawd2 - jmp %5 - -%%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdf - add ebx,edx - test bl,%8 - jz %%drawaf - mov [edi+7],bl -%%drawaf - test bh,%8 - jz %%drawbf - mov [edi+6],bh -%%drawbf - shr ebx,16 - test bl,%8 - jz %%drawcf - mov [edi+5],bl -%%drawcf - test bh,%8 - jz %%drawdf - mov [edi+4],bh -%%drawdf - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2f - add ebx,edx - test bl,%8 - jz %%drawa2f - mov [edi+3],bl -%%drawa2f - test bh,%8 - jz %%drawb2f - mov [edi+2],bh -%%drawb2f - shr ebx,16 - test bl,%8 - jz %%drawc2f - mov [edi+1],bl -%%drawc2f - test bh,%8 - jz %%drawd2f - mov [edi],bh -%%drawd2f - jmp %5 - -%%flipypart - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdm - add ebx,edx - test bl,%8 - jz %%drawam - mov [edi],bl -%%drawam - test bh,%8 - jz %%drawbm - mov [edi+1],bh -%%drawbm - shr ebx,16 - test bl,%8 - jz %%drawcm - mov [edi+2],bl -%%drawcm - test bh,%8 - jz %%drawdm - mov [edi+3],bh -%%drawdm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2m - add ebx,edx - test bl,%8 - jz %%drawa2m - mov [edi+4],bl -%%drawa2m - test bh,%8 - jz %%drawb2m - mov [edi+5],bh -%%drawb2m - shr ebx,16 - test bl,%8 - jz %%drawc2m - mov [edi+6],bl -%%drawc2m - test bh,%8 - jz %%drawd2m - mov [edi+7],bh -%%drawd2m - jmp %5 - -%%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdfm - add ebx,edx - test bl,%8 - jz %%drawafm - mov [edi+7],bl -%%drawafm - test bh,%8 - jz %%drawbfm - mov [edi+6],bh -%%drawbfm - shr ebx,16 - test bl,%8 - jz %%drawcfm - mov [edi+5],bl -%%drawcfm - test bh,%8 - jz %%drawdfm - mov [edi+4],bh -%%drawdfm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2fm - add ebx,edx - test bl,%8 - jz %%drawa2fm - mov [edi+3],bl -%%drawa2fm - test bh,%8 - jz %%drawb2fm - mov [edi+2],bh -%%drawb2fm - shr ebx,16 - test bl,%8 - jz %%drawc2fm - mov [edi+1],bl -%%drawc2fm - test bh,%8 - jz %%drawd2fm - mov [edi],bh -%%drawd2fm -%5 - inc dword[bg1totng+%9*4] - add word[ofsmmptr],2 - add word[ofsmtptr],2 - mov ax,[ofsmmptr] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - add edi,8 - test eax,03Fh - jz near %%tileadd -%%next - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofshvaladd],8 - test dword[ebx-40h],8000h - jz near %%noofsm - test dword[ebx-40h],2000h << %9 - jz %%noofsm - mov ebx,[ebx-40h] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz %%noupper - add ax,[ofsmady] -%%noupper - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -%%noofsm - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofsmcptr2],2 - and dword[ofsmcptr2],3Fh - test dword[ebx-40h],8000h - jnz near %%noofsmh - test dword[ebx-40h],2000h << %9 - jz %%noofsmh - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz %%noleft - add ax,[ofsmadx] -%%noleft - and ebx,0F8h - shr ebx,2 - add ax,bx -%%noofsmh - dec byte[tleftn] - jnz near %4 -%%fin - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx - jmp %%next -%endmacro - - -%macro drawlinengom 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[cbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfull - add ecx,[yposng] - test dword[vrama+eax],4000h - jnz near %%flipxfull - mov ebx,[ecx] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipxfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipyfull - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxyfull - mov ebx,[ecx] - add ebx,edx - mov [edi],ebx - mov ebx,[ecx+4] - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%flipxyfull - mov ebx,[ecx+4] - bswap ebx - add ebx,edx - mov [edi],ebx - mov ebx,[ecx] - bswap ebx - add ebx,edx - mov [edi+4],ebx - jmp %5 -%%parttile - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - add ecx,[yposng] - test word[vrama+eax],4000h - jnz near %%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawd - add ebx,edx - test bl,%8 - jz %%drawa - mov [edi],bl -%%drawa - test bh,%8 - jz %%drawb - mov [edi+1],bh -%%drawb - shr ebx,16 - test bl,%8 - jz %%drawc - mov [edi+2],bl -%%drawc - test bh,%8 - jz %%drawd - mov [edi+3],bh -%%drawd - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2 - add ebx,edx - test bl,%8 - jz %%drawa2 - mov [edi+4],bl -%%drawa2 - test bh,%8 - jz %%drawb2 - mov [edi+5],bh -%%drawb2 - shr ebx,16 - test bl,%8 - jz %%drawc2 - mov [edi+6],bl -%%drawc2 - test bh,%8 - jz %%drawd2 - mov [edi+7],bh -%%drawd2 - jmp %5 - -%%flipxpart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdf - add ebx,edx - test bl,%8 - jz %%drawaf - mov [edi+7],bl -%%drawaf - test bh,%8 - jz %%drawbf - mov [edi+6],bh -%%drawbf - shr ebx,16 - test bl,%8 - jz %%drawcf - mov [edi+5],bl -%%drawcf - test bh,%8 - jz %%drawdf - mov [edi+4],bh -%%drawdf - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2f - add ebx,edx - test bl,%8 - jz %%drawa2f - mov [edi+3],bl -%%drawa2f - test bh,%8 - jz %%drawb2f - mov [edi+2],bh -%%drawb2f - shr ebx,16 - test bl,%8 - jz %%drawc2f - mov [edi+1],bl -%%drawc2f - test bh,%8 - jz %%drawd2f - mov [edi],bh -%%drawd2f - jmp %5 - -%%flipypart - add ecx,[flipyposng] - test word[vrama+eax],4000h - jnz near %%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdm - add ebx,edx - test bl,%8 - jz %%drawam - mov [edi],bl -%%drawam - test bh,%8 - jz %%drawbm - mov [edi+1],bh -%%drawbm - shr ebx,16 - test bl,%8 - jz %%drawcm - mov [edi+2],bl -%%drawcm - test bh,%8 - jz %%drawdm - mov [edi+3],bh -%%drawdm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2m - add ebx,edx - test bl,%8 - jz %%drawa2m - mov [edi+4],bl -%%drawa2m - test bh,%8 - jz %%drawb2m - mov [edi+5],bh -%%drawb2m - shr ebx,16 - test bl,%8 - jz %%drawc2m - mov [edi+6],bl -%%drawc2m - test bh,%8 - jz %%drawd2m - mov [edi+7],bh -%%drawd2m - jmp %5 - -%%flipxypart - mov ebx,[ecx] - or ebx,ebx - jz %%drawdfm - add ebx,edx - test bl,%8 - jz %%drawafm - mov [edi+7],bl -%%drawafm - test bh,%8 - jz %%drawbfm - mov [edi+6],bh -%%drawbfm - shr ebx,16 - test bl,%8 - jz %%drawcfm - mov [edi+5],bl -%%drawcfm - test bh,%8 - jz %%drawdfm - mov [edi+4],bh -%%drawdfm - mov ebx,[ecx+4] - or ebx,ebx - jz %%drawd2fm - add ebx,edx - test bl,%8 - jz %%drawa2fm - mov [edi+3],bl -%%drawa2fm - test bh,%8 - jz %%drawb2fm - mov [edi+2],bh -%%drawb2fm - shr ebx,16 - test bl,%8 - jz %%drawc2fm - mov [edi+1],bl -%%drawc2fm - test bh,%8 - jz %%drawd2fm - mov [edi],bh -%%drawd2fm -%5 - mov ebx,[cbgval] - add word[ofsmmptr],2 - inc dword[bg1totng+ebx*4] - add word[ofsmtptr],2 - mov ax,[ofsmmptr] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - add edi,8 - test eax,03Fh - jz near %%tileadd -%%next - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - mov ecx,[ofsmval] - add dword[ofshvaladd],8 - test dword[ebx],ecx - jz .noofsm - mov ebx,[ebx] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz .noupper - add ax,[ofsmady] -.noupper - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -.noofsm - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofsmcptr2],2 - mov ecx,[ofsmvalh] - and dword[ofsmcptr2],3Fh - test dword[ofsmcptr2],3Fh - jnz %%notzeroed - mov bx,[bgtxadd2] - add word[ofsmcptr],bx -%%notzeroed - test dword[ebx-40h],ecx - jz %%noofsmh - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz %%noleft - add ax,[ofsmadx] -%%noleft - and ebx,0F8h - shr ebx,2 - add ax,bx -%%noofsmh - dec byte[tleftn] - jnz near %4 -%%fin - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx - jmp %%next -%endmacro diff --git a/tools/zsnes/src/video/newgfxwn.mac b/tools/zsnes/src/video/newgfxwn.mac deleted file mode 100644 index 4714a0d..0000000 --- a/tools/zsnes/src/video/newgfxwn.mac +++ /dev/null @@ -1,1045 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -SECTION .text - -Nextwinmode: - push ebx - mov ebx,[ngcwinptr] - xor dword[ngcwinmode],1 - mov ebx,[ebx+4] - add dword[ngcwinptr],4 - mov [ngcpixleft],ebx - pop ebx - ret - -%macro processnextdrawwin 3 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - cmp dword[ngcwinmode],1 - je %%nodraw - test %1,%3 - jz %%nodraw - mov [edi+%2],%1 -%%nodraw -%endmacro - -%macro processwinpixel 0 - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - dec dword[ngcpixleft] - jnz %%notzero2 - call Nextwinmode -%%notzero2 -%endmacro - -%macro drawlinengwin 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jz %%noflipypart - add ecx,[flipyposng] - jmp %%flipypart -%%noflipypart - add ecx,[yposng] -%%flipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - mov ebx,[ecx] - add ebx,edx - processnextdrawwin bl,0,%8 - processnextdrawwin bh,1,%8 - shr ebx,16 - processnextdrawwin bl,2,%8 - processnextdrawwin bh,3,%8 - mov ebx,[ecx+4] - add ebx,edx - processnextdrawwin bl,4,%8 - processnextdrawwin bh,5,%8 - shr ebx,16 - processnextdrawwin bl,6,%8 - processnextdrawwin bh,7,%8 - jmp .fin -%%flipxpart - mov ebx,[ecx+4] - add ebx,edx - rol ebx,16 - processnextdrawwin bh,0,%8 - processnextdrawwin bl,1,%8 - shr ebx,16 - processnextdrawwin bh,2,%8 - processnextdrawwin bl,3,%8 - mov ebx,[ecx] - add ebx,edx - rol ebx,16 - processnextdrawwin bh,4,%8 - processnextdrawwin bl,5,%8 - shr ebx,16 - processnextdrawwin bh,6,%8 - processnextdrawwin bl,7,%8 - jmp .fin -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel -.fin - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - add edi,8 - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawlineng16x16win 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz %%flipypart - add ecx,[yposng] - jmp %%noflipypart -%%flipypart - add ecx,[flipyposng] -%%noflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - mov ebx,[ecx] - add ebx,edx - processnextdrawwin bl,0,%8 - processnextdrawwin bh,1,%8 - shr ebx,16 - processnextdrawwin bl,2,%8 - processnextdrawwin bh,3,%8 - mov ebx,[ecx+4] - add ebx,edx - processnextdrawwin bl,4,%8 - processnextdrawwin bh,5,%8 - shr ebx,16 - processnextdrawwin bl,6,%8 - processnextdrawwin bh,7,%8 - jmp %%done -%%flipxpart - mov ebx,[ecx+4] - add ebx,edx - rol ebx,16 - processnextdrawwin bh,0,%8 - processnextdrawwin bl,1,%8 - shr ebx,16 - processnextdrawwin bh,2,%8 - processnextdrawwin bl,3,%8 - mov ebx,[ecx] - add ebx,edx - rol ebx,16 - processnextdrawwin bh,4,%8 - processnextdrawwin bl,5,%8 - shr ebx,16 - processnextdrawwin bh,6,%8 - processnextdrawwin bl,7,%8 -%%done - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,8 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz near %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - add edi,16 - jmp %%ntile -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawlinengomwin 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[cbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - %2 - ; start drawing from ecx to edi - test word[vrama+eax],8000h - jnz near %%flipypart - add ecx,[yposng] - jmp %%notflipypart -%%flipypart - add ecx,[flipyposng] -%%notflipypart - test word[vrama+eax],4000h - jnz near %%flipxpart - mov ebx,[ecx] - add ebx,edx - processnextdrawwin bl,0,%8 - processnextdrawwin bh,1,%8 - shr ebx,16 - processnextdrawwin bl,2,%8 - processnextdrawwin bh,3,%8 - mov ebx,[ecx+4] - add ebx,edx - processnextdrawwin bl,4,%8 - processnextdrawwin bh,5,%8 - shr ebx,16 - processnextdrawwin bl,6,%8 - processnextdrawwin bh,7,%8 - jmp %%endokay - -%%flipxpart - mov ebx,[ecx+4] - add ebx,edx - rol ebx,16 - processnextdrawwin bh,0,%8 - processnextdrawwin bl,1,%8 - shr ebx,16 - processnextdrawwin bh,2,%8 - processnextdrawwin bl,3,%8 - mov ebx,[ecx] - add ebx,edx - rol ebx,16 - processnextdrawwin bh,4,%8 - processnextdrawwin bl,5,%8 - shr ebx,16 - processnextdrawwin bh,6,%8 - processnextdrawwin bl,7,%8 - jmp %%endokay -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel -%%endokay - mov ebx,[cbgval] - add word[ofsmmptr],2 - inc dword[bg1totng+ebx*4] - add word[ofsmtptr],2 - mov ax,[ofsmmptr] - mov ebx,[yposngom] - mov edx,[flipyposngom] - mov [yposng],ebx - mov [flipyposng],edx - add edi,8 - test eax,03Fh - jz near %%tileadd -%%next - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - mov ecx,[ofsmval] - add dword[ofshvaladd],8 - test dword[ebx],ecx - jz .noofsm - mov ebx,[ebx] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz .noupper - add ax,[ofsmady] -.noupper - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yposng],edx - xor edx,38h - mov [flipyposng],edx -.noofsm - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofsmcptr2],2 - mov ecx,[ofsmval] - and dword[ofsmcptr2],3Fh - test dword[ebx-40h],ecx - jz %%noofsmh - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz %%noleft - add ax,[ofsmadx] -%%noleft - and ebx,0F8h - shr ebx,2 - add ax,bx -%%noofsmh - dec byte[tleftn] - jnz near %4 -%%fin - pop ebx - cmp byte[curmosaicsz],1 - jne near domosaicng - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add word[ofsmtptr],bx - jmp %%next -%endmacro - -%macro parttilewin 2 - cmp dword[ngcwinmode],1 - je %%nodraw - mov bl,[ecx+%1*8] - or bl,bl - jz %%nodraw - add bl,dl - mov [edi+%2*288],bl -%%nodraw -%endmacro - -%macro drawtilengwin 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %5 - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - mov dword[tleftnb],8 -%%loopfa - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - cmp dword[ngcwinmode],1 - je %%nodraw - mov bl,[ecx] - add bl,dl - mov [edi],bl - mov bl,[ecx+8] - add bl,dl - mov [edi+288],bl - mov bl,[ecx+8*2] - add bl,dl - mov [edi+288*2],bl - mov bl,[ecx+8*3] - add bl,dl - mov [edi+288*3],bl - mov bl,[ecx+8*4] - add bl,dl - mov [edi+288*4],bl - mov bl,[ecx+8*5] - add bl,dl - mov [edi+288*5],bl - mov bl,[ecx+8*6] - add bl,dl - mov [edi+288*6],bl - mov bl,[ecx+8*7] - add bl,dl - mov [edi+288*7],bl -%%nodraw - inc ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfa - sub edi,8 - jmp %%end -%%flipxfull - mov dword[tleftnb],8 - add ecx,7 -%%loopfb - dec dword[ngcpixleft] - jnz %%notzerob - call Nextwinmode -%%notzerob - cmp dword[ngcwinmode],1 - je %%nodrawb - mov bl,[ecx] - add bl,dl - mov [edi],bl - mov bl,[ecx+8] - add bl,dl - mov [edi+288],bl - mov bl,[ecx+8*2] - add bl,dl - mov [edi+288*2],bl - mov bl,[ecx+8*3] - add bl,dl - mov [edi+288*3],bl - mov bl,[ecx+8*4] - add bl,dl - mov [edi+288*4],bl - mov bl,[ecx+8*5] - add bl,dl - mov [edi+288*5],bl - mov bl,[ecx+8*6] - add bl,dl - mov [edi+288*6],bl - mov bl,[ecx+8*7] - add bl,dl - mov [edi+288*7],bl -%%nodrawb - dec ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfb - sub edi,8 - jmp %%end -%%flipyfull - test word[vrama+eax],4000h - jnz near %%flipxyfull - mov dword[tleftnb],8 -%%loopfc - dec dword[ngcpixleft] - jnz %%notzeroc - call Nextwinmode -%%notzeroc - cmp dword[ngcwinmode],1 - je %%nodrawc - mov bl,[ecx+8*7] - add bl,dl - mov [edi],bl - mov bl,[ecx+8*6] - add bl,dl - mov [edi+288],bl - mov bl,[ecx+8*5] - add bl,dl - mov [edi+288*2],bl - mov bl,[ecx+8*4] - add bl,dl - mov [edi+288*3],bl - mov bl,[ecx+8*3] - add bl,dl - mov [edi+288*4],bl - mov bl,[ecx+8*2] - add bl,dl - mov [edi+288*5],bl - mov bl,[ecx+8] - add bl,dl - mov [edi+288*6],bl - mov bl,[ecx] - add bl,dl - mov [edi+288*7],bl -%%nodrawc - inc ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfc - sub edi,8 - jmp %%end -%%flipxyfull - mov dword[tleftnb],8 - add ecx,7 -%%loopfd - dec dword[ngcpixleft] - jnz %%notzerod - call Nextwinmode -%%notzerod - cmp dword[ngcwinmode],1 - je %%nodrawd - mov bl,[ecx+8*7] - add bl,dl - mov [edi],bl - mov bl,[ecx+8*6] - add bl,dl - mov [edi+288],bl - mov bl,[ecx+8*5] - add bl,dl - mov [edi+288*2],bl - mov bl,[ecx+8*4] - add bl,dl - mov [edi+288*3],bl - mov bl,[ecx+8*3] - add bl,dl - mov [edi+288*4],bl - mov bl,[ecx+8*2] - add bl,dl - mov [edi+288*5],bl - mov bl,[ecx+8] - add bl,dl - mov [edi+288*6],bl - mov bl,[ecx] - add bl,dl - mov [edi+288*7],bl -%%nodrawd - dec ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfd - sub edi,8 - jmp %%end -%%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfullp - test dword[vrama+eax],4000h - jnz near %%flipxfullp - mov dword[tleftnb],8 -%%loopfap - dec dword[ngcpixleft] - jnz %%notzerop - call Nextwinmode -%%notzerop - parttilewin 0,0 - parttilewin 1,1 - parttilewin 2,2 - parttilewin 3,3 - parttilewin 4,4 - parttilewin 5,5 - parttilewin 6,6 - parttilewin 7,7 - inc ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfap - sub edi,8 - jmp %%end -%%flipxfullp - mov dword[tleftnb],8 - add ecx,7 -%%loopfbp - dec dword[ngcpixleft] - jnz %%notzerobp - call Nextwinmode -%%notzerobp - parttilewin 0,0 - parttilewin 1,1 - parttilewin 2,2 - parttilewin 3,3 - parttilewin 4,4 - parttilewin 5,5 - parttilewin 6,6 - parttilewin 7,7 - dec ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfbp - sub edi,8 - jmp %%end -%%flipyfullp - test word[vrama+eax],4000h - jnz near %%flipxyfullp - mov dword[tleftnb],8 -%%loopfcp - dec dword[ngcpixleft] - jnz %%notzerocp - call Nextwinmode -%%notzerocp - parttilewin 7,0 - parttilewin 6,1 - parttilewin 5,2 - parttilewin 4,3 - parttilewin 3,4 - parttilewin 2,5 - parttilewin 1,6 - parttilewin 0,7 - inc ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfcp - sub edi,8 - jmp %%end -%%flipxyfullp - mov dword[tleftnb],8 - add ecx,7 -%%loopfdp - dec dword[ngcpixleft] - jnz %%notzerodp - call Nextwinmode -%%notzerodp - parttilewin 7,0 - parttilewin 6,1 - parttilewin 5,2 - parttilewin 4,3 - parttilewin 3,4 - parttilewin 2,5 - parttilewin 1,6 - parttilewin 0,7 - dec ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfdp - sub edi,8 - jmp %%end -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel -%%end - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - add edi,8 - test eax,03Fh - jz %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - ret -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro - -%macro drawtileng16x16win 8 - ; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value - ; bit 10-12 = palette, 0-9=tile# - mov ebx,[ng16bbgval] - mov dl,ch - inc dword[bg1drwng+ebx*4] - and ecx,3FFh - and edx,1Fh - add ecx,[ngptrdat2] - add cx,[taddnfy16x16] - test dword[vrama+eax],8000h - jz %%noflipy - add cx,[taddfy16x16] -%%noflipy - test dword[vrama+eax],4000h - jz %%noflipx - inc cx -%%noflipx -%%nexttile - push ecx - push edx - mov edx,[%6+edx*4] - %7 - jnz near %%docache -%%returnfromcache - cmp byte[%1+ecx],2 - je near %%skip - cmp byte[%1+ecx],0 - je near %%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfull - test dword[vrama+eax],4000h - jnz near %%flipxfull - mov dword[tleftnb],8 -%%loopfa - dec dword[ngcpixleft] - jnz %%notzero - call Nextwinmode -%%notzero - cmp dword[ngcwinmode],1 - je %%nodraw - mov bl,[ecx] - add bl,dl - mov [edi],bl - mov bl,[ecx+8] - add bl,dl - mov [edi+288],bl - mov bl,[ecx+8*2] - add bl,dl - mov [edi+288*2],bl - mov bl,[ecx+8*3] - add bl,dl - mov [edi+288*3],bl - mov bl,[ecx+8*4] - add bl,dl - mov [edi+288*4],bl - mov bl,[ecx+8*5] - add bl,dl - mov [edi+288*5],bl - mov bl,[ecx+8*6] - add bl,dl - mov [edi+288*6],bl - mov bl,[ecx+8*7] - add bl,dl - mov [edi+288*7],bl -%%nodraw - inc ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfa - sub edi,8 - jmp %%end -%%flipxfull - mov dword[tleftnb],8 - add ecx,7 -%%loopfb - dec dword[ngcpixleft] - jnz %%notzerob - call Nextwinmode -%%notzerob - cmp dword[ngcwinmode],1 - je %%nodrawb - mov bl,[ecx] - add bl,dl - mov [edi],bl - mov bl,[ecx+8] - add bl,dl - mov [edi+288],bl - mov bl,[ecx+8*2] - add bl,dl - mov [edi+288*2],bl - mov bl,[ecx+8*3] - add bl,dl - mov [edi+288*3],bl - mov bl,[ecx+8*4] - add bl,dl - mov [edi+288*4],bl - mov bl,[ecx+8*5] - add bl,dl - mov [edi+288*5],bl - mov bl,[ecx+8*6] - add bl,dl - mov [edi+288*6],bl - mov bl,[ecx+8*7] - add bl,dl - mov [edi+288*7],bl -%%nodrawb - dec ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfb - sub edi,8 - jmp %%end -%%flipyfull - test word[vrama+eax],4000h - jnz near %%flipxyfull - mov dword[tleftnb],8 -%%loopfc - dec dword[ngcpixleft] - jnz %%notzeroc - call Nextwinmode -%%notzeroc - cmp dword[ngcwinmode],1 - je %%nodrawc - mov bl,[ecx+8*7] - add bl,dl - mov [edi],bl - mov bl,[ecx+8*6] - add bl,dl - mov [edi+288],bl - mov bl,[ecx+8*5] - add bl,dl - mov [edi+288*2],bl - mov bl,[ecx+8*4] - add bl,dl - mov [edi+288*3],bl - mov bl,[ecx+8*3] - add bl,dl - mov [edi+288*4],bl - mov bl,[ecx+8*2] - add bl,dl - mov [edi+288*5],bl - mov bl,[ecx+8] - add bl,dl - mov [edi+288*6],bl - mov bl,[ecx] - add bl,dl - mov [edi+288*7],bl -%%nodrawc - inc ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfc - sub edi,8 - jmp %%end -%%flipxyfull - mov dword[tleftnb],8 - add ecx,7 -%%loopfd - dec dword[ngcpixleft] - jnz %%notzerod - call Nextwinmode -%%notzerod - cmp dword[ngcwinmode],1 - je %%nodrawd - mov bl,[ecx+8*7] - add bl,dl - mov [edi],bl - mov bl,[ecx+8*6] - add bl,dl - mov [edi+288],bl - mov bl,[ecx+8*5] - add bl,dl - mov [edi+288*2],bl - mov bl,[ecx+8*4] - add bl,dl - mov [edi+288*3],bl - mov bl,[ecx+8*3] - add bl,dl - mov [edi+288*4],bl - mov bl,[ecx+8*2] - add bl,dl - mov [edi+288*5],bl - mov bl,[ecx+8] - add bl,dl - mov [edi+288*6],bl - mov bl,[ecx] - add bl,dl - mov [edi+288*7],bl -%%nodrawd - dec ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfd - sub edi,8 - jmp %%end -%%parttile - %2 - ; start drawing from ecx - test dword[vrama+eax],8000h - jnz near %%flipyfullp - test dword[vrama+eax],4000h - jnz near %%flipxfullp - mov dword[tleftnb],8 -%%loopfap - dec dword[ngcpixleft] - jnz %%notzerop - call Nextwinmode -%%notzerop - parttilewin 0,0 - parttilewin 1,1 - parttilewin 2,2 - parttilewin 3,3 - parttilewin 4,4 - parttilewin 5,5 - parttilewin 6,6 - parttilewin 7,7 - inc ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfap - sub edi,8 - jmp %%end -%%flipxfullp - mov dword[tleftnb],8 - add ecx,7 -%%loopfbp - dec dword[ngcpixleft] - jnz %%notzerobp - call Nextwinmode -%%notzerobp - parttilewin 0,0 - parttilewin 1,1 - parttilewin 2,2 - parttilewin 3,3 - parttilewin 4,4 - parttilewin 5,5 - parttilewin 6,6 - parttilewin 7,7 - dec ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfbp - sub edi,8 - jmp %%end -%%flipyfullp - test word[vrama+eax],4000h - jnz near %%flipxyfullp - mov dword[tleftnb],8 -%%loopfcp - dec dword[ngcpixleft] - jnz %%notzerocp - call Nextwinmode -%%notzerocp - parttilewin 7,0 - parttilewin 6,1 - parttilewin 5,2 - parttilewin 4,3 - parttilewin 3,4 - parttilewin 2,5 - parttilewin 1,6 - parttilewin 0,7 - inc ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfcp - sub edi,8 - jmp %%end -%%flipxyfullp - mov dword[tleftnb],8 - add ecx,7 -%%loopfdp - dec dword[ngcpixleft] - jnz %%notzerodp - call Nextwinmode -%%notzerodp - parttilewin 7,0 - parttilewin 6,1 - parttilewin 5,2 - parttilewin 4,3 - parttilewin 3,4 - parttilewin 2,5 - parttilewin 1,6 - parttilewin 0,7 - dec ecx - inc edi - dec dword[tleftnb] - jnz near %%loopfdp - sub edi,8 - jmp %%end -%%skip - processwinpixel - processwinpixel - processwinpixel - processwinpixel -%%end - pop edx - pop ecx - inc cx - test dword[vrama+eax],4000h - jz %%noflipxb - sub cx,2 -%%noflipxb - add edi,8 - xor dword[switch16x16],1 - jnz near %%nexttile -%%ntile - mov ebx,[ng16bbgval] - add ax,2 - inc dword[bg1totng+ebx*4] - test eax,03Fh - jz near %%tileadd -%%next - dec byte[tleftn] - jnz near %4 - pop ebx - ret -%%done -%5 - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - processwinpixel - add edi,16 - jmp %%ntile -%%docache - call %3 - jmp %%returnfromcache -%%tileadd - add ax,[bgtxadd] - jmp %%next -%endmacro diff --git a/tools/zsnes/src/video/ntsc.c b/tools/zsnes/src/video/ntsc.c deleted file mode 100644 index d71041c..0000000 --- a/tools/zsnes/src/video/ntsc.c +++ /dev/null @@ -1,209 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef restrict - #if defined (__GNUC__) - #define restrict __restrict__ - #elif defined (_MSC_VER) && (_MSC_VER > 1400) - #define restrict __restrict - #else - /* no support for restricted pointers */ - #define restrict - #endif -#endif - -#include "ntsc.h" - - /* Source image */ - /* width = 288 pixels, height = 223 pixels or more */ - extern unsigned short* vidbuffer; - - static snes_ntsc_t ntsc_snes; - static unsigned char ntsc_phase = 0; - - static void ntsc_blit( snes_ntsc_t const* ntsc, unsigned short const* input, long in_pitch, - int burst_phase, int out_width, int out_height, void* rgb_out, long out_pitch ); - -void set_ntsc_preset( int i ) -{ - static const signed char presets [4] [6] = { - /*Sharp Sat Res Art Fringe Bleed */ - { 0, 0, 0, 0, 0, 0},/* Composite */ - {20, 0, 20, -100, -100, 0},/* S-Video */ - {20, 0, 70, -100, -100, -100},/* RGB */ - {20, -100, 20, -20, -20, -100} /* Monochrome */ - }; - if ( i >= 0 && i < 4 ) - { - NTSCSharp = presets [i] [0]; - NTSCSat = presets [i] [1]; - NTSCRes = presets [i] [2]; - NTSCArt = presets [i] [3]; - NTSCFringe = presets [i] [4]; - NTSCBleed = presets [i] [5]; - NTSCHue = 0; - NTSCCont = 0; - NTSCBright = 0; - NTSCGamma = 0; - NTSCBleed = 0; - NTSCWarp = 0; - } -} - -void NTSCFilterInit() -{ - /* Set GUI options */ - snes_ntsc_setup_t ntsc_setup = snes_ntsc_composite; /* start with preset */ - float to_float = 1.0f / 100.0f; /* convert to -1.0 to +1.0 range */ - - /* artifacts */ - float enhance = to_float * NTSCWarp; /* new use of NTSCWarp control */ - ntsc_setup.resolution = (enhance < 0.0f ? 0.0f : enhance); - ntsc_setup.artifacts = -enhance; - ntsc_setup.fringing = -enhance; - - /* standard controls */ - ntsc_setup.sharpness = to_float * NTSCSharp; - ntsc_setup.hue = to_float * NTSCHue; - ntsc_setup.saturation = to_float * NTSCSat; - ntsc_setup.contrast = to_float * NTSCCont; - ntsc_setup.brightness = to_float * NTSCBright; - ntsc_setup.gamma = to_float * NTSCGamma; - ntsc_setup.resolution = to_float * NTSCRes; - ntsc_setup.artifacts = to_float * NTSCArt; - ntsc_setup.fringing = to_float * NTSCFringe; - ntsc_setup.bleed = to_float * NTSCBleed; - - /*ntsc_setup.hue_warping = to_float * NTSCWarp; // not supported anymore */ - ntsc_setup.merge_fields = NTSCBlend; - - switch (NTSCPresetVar) - { - case 0: - snes_ntsc_init( &ntsc_snes, &snes_ntsc_composite ); - set_ntsc_preset(NTSCPresetVar); - break; - case 1: - snes_ntsc_init( &ntsc_snes, &snes_ntsc_svideo ); - set_ntsc_preset(NTSCPresetVar); - break; - case 2: - snes_ntsc_init( &ntsc_snes, &snes_ntsc_rgb ); - set_ntsc_preset(NTSCPresetVar); - break; - case 3: - snes_ntsc_init( &ntsc_snes, &snes_ntsc_monochrome ); - set_ntsc_preset(NTSCPresetVar); - break; - case 4: - snes_ntsc_init( &ntsc_snes, &ntsc_setup ); - break; - default: - break; - } - -} - - - -void NTSCFilterDraw( int out_width, int out_height, int out_pitch, unsigned char* rgb16_out ) -{ - ntsc_blit( &ntsc_snes, vidbuffer+16+576, 576, ntsc_phase, - out_width, out_height, rgb16_out, out_pitch ); - - /* Change phase on alternating frames unless blending is enabled */ - if ( !NTSCBlend ) - ntsc_phase ^= 1; -} - -/* custom blitter that doubles image height and darkens every other row */ -static void ntsc_blit( snes_ntsc_t const* ntsc, unsigned short const* input, long in_pitch, - int burst_phase, int out_width, int out_height, void* rgb_out, long out_pitch ) -{ - int const final_pixels = 5; - int chunk_count = (out_width - final_pixels) / snes_ntsc_out_chunk; - int in_height = out_height >> 1; - for ( ; in_height; --in_height ) - { - unsigned short const* line_in = input; - SNES_NTSC_BEGIN_ROW( ntsc, burst_phase, - snes_ntsc_black, snes_ntsc_black, *line_in ); - /* use of __restrict allows compiler to optimize memory accesses better */ - unsigned short* restrict line_out = (unsigned short*) rgb_out; - unsigned short* restrict line_out2 = (unsigned short*) ((char*) line_out + out_pitch); - int n; - line_in++; - - /* output second scanline darkened by 25% */ - #define PIXEL_OUT( x )\ - {\ - unsigned pixel;\ - SNES_NTSC_RGB_OUT( x, pixel, 16 );\ - line_out [x] = pixel;\ - line_out2 [x] = pixel - (pixel >> 2 & 0x39E7);\ - } - - for ( n = chunk_count; n; --n ) - { - /* order of input and output pixels must not be altered */ - SNES_NTSC_COLOR_IN( 0, line_in [0] ); - PIXEL_OUT( 0 ); - PIXEL_OUT( 1 ); - - SNES_NTSC_COLOR_IN( 1, line_in [1] ); - PIXEL_OUT( 2 ); - PIXEL_OUT( 3 ); - - SNES_NTSC_COLOR_IN( 2, line_in [2] ); - PIXEL_OUT( 4 ); - PIXEL_OUT( 5 ); - PIXEL_OUT( 6 ); - - line_in += 3; - line_out += 7; - line_out2 += 7; - } - - /* finish final pixels */ - SNES_NTSC_COLOR_IN( 0, snes_ntsc_black ); - PIXEL_OUT( 0 ); - PIXEL_OUT( 1 ); - - SNES_NTSC_COLOR_IN( 1, snes_ntsc_black ); - PIXEL_OUT( 2 ); - PIXEL_OUT( 3 ); - - SNES_NTSC_COLOR_IN( 2, snes_ntsc_black ); - PIXEL_OUT( 4 ); - /* last pixels is cut off a bit, so would be good to uncomment these two */ - /* (and change final_pixels to 7), though this would require a minimum of */ - /* 602 output pixels instead of the current 600 */ - /*PIXEL_OUT( 5 ); */ - /*PIXEL_OUT( 6 ); */ - - burst_phase = (burst_phase + 1) % snes_ntsc_burst_count; - input = (unsigned short const*) ((char const*) input + in_pitch); - rgb_out = (char*) rgb_out + out_pitch * 2; - } -} - -/* included here to avoid modifying makefile */ -#include "snes_ntsc/snes_ntsc.c" diff --git a/tools/zsnes/src/video/ntsc.h b/tools/zsnes/src/video/ntsc.h deleted file mode 100644 index c532b3b..0000000 --- a/tools/zsnes/src/video/ntsc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -/* NTSC video filter */ - -#ifndef NTSC_H -#define NTSC_H - -#include "snes_ntsc/snes_ntsc.h" - -/* Parameters vary from -100 to +100 */ -extern signed char NTSCHue, NTSCSat, NTSCCont, NTSCWarp, NTSCBright, NTSCSharp, NTSCGamma, NTSCRes, NTSCArt, NTSCFringe, NTSCBleed; -extern unsigned char NTSCBlend; /* 0 or 1 */ -extern unsigned char NTSCPresetVar; /* 0 to 3 */ - -/* (Re)initialize filter with new NTSC settings above */ -void NTSCFilterInit(); - -/* Draw current image to specified output pixels */ -void NTSCFilterDraw( int out_width, int out_height, int out_pitch, unsigned char* rgb16_out ); - -#endif diff --git a/tools/zsnes/src/video/procvid.asm b/tools/zsnes/src/video/procvid.asm deleted file mode 100644 index b440ce1..0000000 --- a/tools/zsnes/src/video/procvid.asm +++ /dev/null @@ -1,3180 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 BGMA,V8Mode,antienab,cacheud,cbitmode,ccud,cfield,cgram,coladdb,coladdg -EXTSYM coladdr,curblank,curfps,cvidmode,delay,extlatch,En2xSaI -EXTSYM gammalevel,hirestiledat,ignor512,latchx,latchy,maxbr,ForceNewGfxOff -EXTSYM newengen,nextframe,objptr,pressed,prevpal,res512switch,resolutn -EXTSYM romispal,scaddtype,scanlines,selcA000,t1cc,vcache4b,vesa2_bpos -EXTSYM spritetablea,vesa2_clbit,vesa2_gpos,vesa2_rpos,vesa2red10 -EXTSYM vidbuffer,vram,KeyStateSelct,soundon -EXTSYM bg1objptr,DecompAPtr,HalfTransB,HalfTransC -EXTSYM DrawScreen,MMXSupport -EXTSYM Get_MouseData,Get_MousePositionDisplacement,GUIEnableTransp,GUIFontData -EXTSYM StopSound,StartSound,PrevPicture,nggposng,current_zst,newest_zst -EXTSYM GetTimeInSeconds,bg3ptr,bg3scroly,bg3scrolx,C4Ram -EXTSYM genfulladdtab,genfulladdtabng,TimerEnable,ShowTimer,debugdisble,GUIOn -EXTSYM FilteredGUI,HalfTrans,SmallMsgText,Mode7HiRes,mosenng,mosszng -EXTSYM intrlng,mode7hr,newgfx16b,vesa2_clbitng,vesa2_clbitng2,CSStatus -EXTSYM CSStatus2,CSStatus3,CSStatus4,SpecialLine,Clear2xSaIBuffer,vidbufferofsb,bg1scroly -EXTSYM MovieProcessing,MovieFrameStr,GetMovieFrameStr,mouse1lh,mouse2lh -EXTSYM MovieDisplayFrame,SloMo,MouseCount,device2,LoadPicture -EXTSYM zst_determine_newest,newestfiledate,zst_exists,ClockBox,SSAutoFire - -%ifndef __MSDOS__ -EXTSYM MouseMoveX,MouseMoveY,MouseButtons,MultiMouseProcess,mouse -%else -EXTSYM SB_blank,vsyncon,Triplebufen,granadd,Palette0,smallscreenon,ScreenScale,vesa2selec -EXTSYM displayfpspal,superscopepal,saveselectpal -%endif - -%ifdef __UNIXSDL__ -EXTSYM numlockptr -%endif - -%ifdef __MSDOS__ -%include "video/2xsaimmx.inc" -%endif -%include "video/copyvid.inc" - -SECTION .text - -;******************************************************* -; ShowVideo Processes & displays video -;******************************************************* - -NEWSYM showvideo - push esi - push edi - push edx - push ebx - push ebp - inc byte[ccud] - mov bl,[ccud] - cmp byte[cacheud],bl - je .noinc - mov byte[ccud],0 -.noinc - call copyvid - mov eax,[KeyStateSelct] - test byte[pressed+eax],1 - jz .nosavesel - call saveselect -.nosavesel - xor ecx,ecx - pop ebp - pop ebx - pop edx - pop edi - pop esi - ret - -NEWSYM SwapMouseButtons - test bl,3 - jpe .noswap - xor bl,3 -.noswap - ret - -NEWSYM processmouse1 - push esi - push edi - push edx - push ebx -%ifndef __MSDOS__ - cmp byte[MouseCount],1 - jle .nomultimouse - pushad - mov byte[mouse],0 - call MultiMouseProcess - popad - mov bx,[MouseButtons] - cmp byte[mouse1lh],1 - jne .notlefthanded1 - call SwapMouseButtons -.notlefthanded1 - mov [mousebuttons],bx - mov cx,[MouseMoveX] - mov dx,[MouseMoveY] - jmp .mousestuff -.nomultimouse -%endif - call Get_MouseData - cmp byte[mouse1lh],1 - jne .notlefthanded2 - call SwapMouseButtons -.notlefthanded2 - mov [mousebuttons],bx - call Get_MousePositionDisplacement -.mousestuff - mov word[mousexpos],0 - cmp cx,0 - je .noxchange - mov byte[mousexdir],0 - cmp cx,0 - jge .noneg - mov byte[mousexdir],1 - neg cx -.noneg - mov [mousexpos],cx -.noxchange - mov word[mouseypos],0 - cmp dx,0 - je .noychange - mov byte[mouseydir],0 - cmp dx,0 - jge .noneg2 - mov byte[mouseydir],1 - neg dx -.noneg2 - mov [mouseypos],dx -.noychange - xor ecx,ecx - pop ebx - pop edx - pop edi - pop esi - ret - -NEWSYM processmouse2 - push esi - push edi - push edx - push ebx -%ifndef __MSDOS__ - cmp byte[MouseCount],1 - jle .nomultimouse - pushad - mov byte[mouse],1 - call MultiMouseProcess - popad - mov bx,[MouseButtons+2] - jmp .mousestuff -.nomultimouse -%endif - call Get_MouseData -.mousestuff - cmp byte[mouse2lh],1 - jne .notlefthanded - call SwapMouseButtons -.notlefthanded - mov [mousebuttons],bx - cmp byte[device2],2 - jne .ss - push eax - mov eax,[SSAutoFire] - cmp byte[pressed+eax],0 - pop eax - je .noautosw - cmp byte[ssautoswb],1 - je .ss - xor byte[ssautosw],20h - mov byte[ssautoswb],1 - mov dword[Msgptr],.ssautoen - cmp byte[ssautosw],0 - jne .nononauto - mov dword[Msgptr],.ssautodi -.nononauto - mov eax,[MsgCount] - mov [MessageOn],eax - jmp .ss -.noautosw - mov byte[ssautoswb],0 -.ss -%ifndef __MSDOS__ - cmp byte[MouseCount],1 - jle .nomultimouse2 - mov cx,[MouseMoveX+2] - mov dx,[MouseMoveY+2] - jmp .mousestuff2 -.nomultimouse2 -%endif - call Get_MousePositionDisplacement -.mousestuff2 - cmp byte[device2],3 - je .le - cmp byte[device2],4 - je .le - cmp byte[device2],2 - jne .ss2 -.le - add word[mousexloc],cx - test word[mousexloc],8000h - jz .nowrapleft - mov word[mousexloc],0 -.nowrapleft - cmp word[mousexloc],255 - jbe .nowrapright - mov word[mousexloc],255 -.nowrapright - mov ax,[mousexloc] - add ax,40 - mov [latchx],ax - mov byte[extlatch],40h -.ss2 - mov word[mousexpos],0 - cmp cx,0 - je .noxchange - mov byte[mousexdir],0 - cmp cx,0 - jge .noneg - mov byte[mousexdir],1 - neg cx -.noneg - mov [mousexpos],cx -.noxchange - cmp byte[device2],3 - je .le2 - cmp byte[device2],4 - je .le2 - cmp byte[device2],2 - jne .ss3 -.le2 - add word[mouseyloc],dx - test word[mouseyloc],8000h - jz .nowrapup - mov word[mouseyloc],0 -.nowrapup - cmp word[mouseyloc],223 - jbe .nowrapdown - mov word[mouseyloc],223 -.nowrapdown - mov ax,[mouseyloc] - mov [latchy],ax -.ss3 - mov word[mouseypos],0 - cmp dx,0 - je .noychange - mov byte[mouseydir],0 - cmp dx,0 - jge .noneg2 - mov byte[mouseydir],1 - neg dx -.noneg2 - mov [mouseypos],dx -.noychange - xor ecx,ecx - pop ebx - pop edx - pop edi - pop esi - ret - -SECTION .data -.ssautoen db 'AUTOFIRE ENABLED.',0 -.ssautodi db 'AUTOFIRE DISABLED.',0 - -NEWSYM ssautosw, db 20h - -NEWSYM mousexloc, dw 128 -NEWSYM mouseyloc, dw 112 - -SECTION .bss -NEWSYM ssautoswb, resb 1 -NEWSYM mousebuttons, resw 1 -NEWSYM mousexpos, resw 1 -NEWSYM mousexdir, resb 1 -NEWSYM mouseypos, resw 1 -NEWSYM mouseydir, resb 1 -NEWSYM mousechan, resb 1 -SECTION .text - -;******************************************************* -; Output Hex Outputs the hex in al @ esi -;******************************************************* - -NEWSYM outputhex - push edi - push esi - push eax - push ebx - push ecx - push esi - mov edi,FontData - xor ebx,ebx - mov bl,al - shr bl,4 - shl ebx,3 - add edi,ebx - add edi,8 - mov cl,8 -.loopa - mov ah,[edi] - mov ch,8 -.loopb - test ah,80h - jz .nowrite - mov byte[esi],128 - mov byte[esi+289],192 -.nowrite - shl ah,1 - inc esi - dec ch - jnz .loopb - add esi,280 - inc edi - dec cl - jnz .loopa - pop esi - add esi,8 - mov edi,FontData - xor ebx,ebx - mov bl,al - and bl,0Fh - shl ebx,3 - add edi,ebx - add edi,8 - mov cl,8 -.loopa2 - mov ah,[edi] - mov ch,8 -.loopb2 - test ah,80h - jz .nowrite2 - mov byte[esi],128 - mov byte[esi+289],192 -.nowrite2 - shl ah,1 - inc esi - dec ch - jnz .loopb2 - add esi,280 - inc edi - dec cl - jnz .loopa2 - pop ecx - pop ebx - pop eax - pop esi - pop edi - ret - -OutputText16b: - cmp byte[ForceNonTransp],1 - je near OutText16bnt - cmp byte[GUIEnableTransp],0 - je near OutText16bnt - ; output text in edi to esi - push ebx - push eax - mov cl,9 -.loopa - mov ch,9 - xor eax,eax - cmp cl,1 - je .not1 - mov al,[edi] - shl eax,1 -.not1 - xor ebx,ebx - cmp cl,9 - je .loopb - mov bl,[edi-1] -.loopb - test ax,100h - jz .nowrite - push eax - and word[esi],dx - shr word[esi],1 - and word[esi+75036*4],dx - shr word[esi+75036*4],1 - ror edx,16 - add word[esi],dx - add word[esi+75036*4],dx - ror edx,16 - pop eax - jmp .nowrite2 -.nowrite - test bx,100h - jz .nowrite2 - and word[esi],dx - shr word[esi],1 - and word[esi+75036*4],dx - shr word[esi+75036*4],1 -.nowrite2 - shl ax,1 - shl bx,1 - add esi,2 - dec ch - jnz .loopb - add esi,279*2 - inc edi - dec cl - jnz .loopa - pop eax - pop ebx - ret - -OutText16bnt: - ; output text in edi to esi - push ebx - push eax - mov cl,9 -.loopa - mov ch,9 - xor eax,eax - cmp cl,1 - je .not1 - mov al,[edi] - shl eax,1 -.not1 - xor ebx,ebx - cmp cl,9 - je .loopb - mov bl,[edi-1] -.loopb - test ax,100h - jz .nowrite - mov word[esi],0FFFFh - mov word[esi+75036*4],0FFFFh - jmp .nowrite2 -.nowrite - test bx,100h - jz .nowrite2 - and word[esi],dx - and word[esi+75036*4],dx - shr word[esi],1 - shr word[esi+75036*4],1 -.nowrite2 - shl ax,1 - shl bx,1 - add esi,2 - dec ch - jnz .loopb - add esi,279*2 - inc edi - dec cl - jnz .loopa - pop eax - pop ebx - ret - -NEWSYM outputhex16 - push edi - push esi - push eax - push ebx - push ecx - push edx - push esi - mov dx,[vesa2_clbitng] - ror edx,16 - mov dx,[vesa2_clbitng] - shr dx,1 - ror edx,16 - - mov edi,FontData - xor ebx,ebx - mov bl,al - shr bl,4 - shl ebx,3 - add edi,ebx - add edi,8 - call OutputText16b - pop esi - add esi,16 - mov edi,FontData - xor ebx,ebx - mov bl,al - and bl,0Fh - shl ebx,3 - add edi,ebx - add edi,8 - call OutputText16b - pop edx - pop ecx - pop ebx - pop eax - pop esi - pop edi - ret - -SECTION .data -NEWSYM ASCII2Font - db 00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h - db 00h,00h,00h,00h,00h,00h,00h,00h,00h,30h,00h,00h,00h,00h,00h,00h - db 00h,3Eh,33h,31h,3Fh,37h,2Fh,3Dh,3Ah,3Bh,35h,38h,39h,25h,28h,29h - db 01h,02h,03h,04h,05h,06h,07h,08h,09h,0Ah,2Eh,40h,2Ah,32h,2Bh,36h - db 3Ch,0Bh,0Ch,0Dh,0Eh,0Fh,10h,11h,12h,13h,14h,15h,16h,17h,18h,19h - db 1Ah,1Bh,1Ch,1Dh,1Eh,1Fh,20h,21h,22h,23h,24h,2Ch,34h,2Dh,42h,26h - db 41h,0Bh,0Ch,0Dh,0Eh,0Fh,10h,11h,12h,13h,14h,15h,16h,17h,18h,19h - db 1Ah,1Bh,1Ch,1Dh,1Eh,1Fh,20h,21h,22h,23h,24h,43h,00h,44h,27h,00h - db 0Dh,1Fh,0Fh,0Bh,0Bh,0Bh,0Bh,0Dh,0Fh,0Fh,0Fh,13h,13h,13h,0Bh,0Bh - db 0Fh,0Bh,0Bh,19h,19h,19h,1Fh,1Fh,23h,19h,1Fh,0Dh,10h,23h,1Ah,10h - db 0Bh,4Eh,4Fh,50h,51h,52h,53h,54h,55h,56h,57h,58h,59h,5Ah,5Bh,5Ch - db 5Dh,5Eh,5Fh,60h,61h,62h,63h,64h,65h,66h,67h,68h,69h,6Ah,6Bh,6Ch - db 6Dh,6Eh,6Fh,70h,71h,72h,73h,74h,75h,76h,77h,78h,79h,7Ah,7Bh,7Ch - db 7Dh,7Eh,7Fh,80h,81h,82h,83h,84h,85h,86h,87h,88h,89h,8Ah,8Bh,8Ch - db 00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h - db 00h,00h,00h,00h,00h,00h,00h,4Dh,4Ch,4Bh,4Ah,45h,46h,47h,48h,49h - -NEWSYM FontData -; bitmap 8x8 font ; char, offset for ASCII2Font - db 0,0,0,0,0,0,0,0 ; ' ', 00 - db 01111100b,11000110b,11001110b,11010110b ; 0, 01 - db 11100110b,11000110b,01111100b,00000000b - db 00011000b,00111000b,01111000b,00011000b ; 1, 02 - db 00011000b,00011000b,01111110b,00000000b - db 01111100b,11000110b,00001100b,00011000b ; 2, 03 - db 00110000b,01100110b,11111110b,00000000b - db 01111100b,11000110b,00000110b,00111100b ; 3, 04 - db 00000110b,11000110b,01111100b,00000000b - db 00111100b,01101100b,11001100b,11111110b ; 4, 05 - db 00001100b,00001100b,00001100b,00000000b - db 11111110b,11000000b,11000000b,11111100b ; 5, 06 - db 00000110b,11000110b,01111100b,00000000b - db 00111100b,01100000b,11000000b,11111100b ; 6, 07 - db 11000110b,11000110b,01111100b,00000000b - db 11111110b,11000110b,00000110b,00001100b ; 7, 08 - db 00011000b,00011000b,00011000b,00000000b - db 01111100b,11000110b,11000110b,01111100b ; 8, 09 - db 11000110b,11000110b,01111100b,00000000b - db 01111100b,11000110b,11000110b,01111110b ; 9, 0A - db 00000110b,11000110b,01111100b,00000000b - db 00111000b,01101100b,11000110b,11111110b ; A, 0B - db 11000110b,11000110b,11000110b,00000000b - db 11111100b,11000110b,11000110b,11111100b ; B, 0C - db 11000110b,11000110b,11111100b,00000000b - db 01111100b,11000110b,11000000b,11000000b ; C, 0D - db 11000000b,11000110b,01111100b,00000000b - db 11111100b,11000110b,11000110b,11000110b ; D, 0E - db 11000110b,11000110b,11111100b,00000000b - db 11111110b,11000000b,11000000b,11111000b ; E, 0F - db 11000000b,11000000b,11111110b,00000000b - db 11111110b,11000000b,11000000b,11111000b ; F, 10 - db 11000000b,11000000b,11000000b,00000000b - db 01111100b,11000110b,11000000b,11000000b ; G, 11 - db 11001110b,11000110b,01111100b,00000000b - db 11000110b,11000110b,11000110b,11111110b ; H, 12 - db 11000110b,11000110b,11000110b,00000000b - db 00111100b,00011000b,00011000b,00011000b ; I, 13 - db 00011000b,00011000b,00111100b,00000000b - db 00011110b,00001100b,00001100b,00001100b ; J, 14 - db 00001100b,11001100b,00111100b,00000000b - db 11001100b,11011000b,11110000b,11100000b ; K, 15 - db 11110000b,11011000b,11001100b,00000000b - db 11000000b,11000000b,11000000b,11000000b ; L, 16 - db 11000000b,11000000b,11111110b,00000000b - db 11000110b,11101110b,11111110b,11010110b ; M, 17 - db 11000110b,11000110b,11000110b,00000000b - db 11000110b,11100110b,11110110b,11011110b ; N, 18 - db 11001110b,11000110b,11000110b,00000000b - db 01111100b,11000110b,11000110b,11000110b ; O, 19 - db 11000110b,11000110b,01111100b,00000000b - db 11111100b,11000110b,11000110b,11111100b ; P, 1A - db 11000000b,11000000b,11000000b,00000000b - db 01111100b,11000110b,11000110b,11000110b ; Q, 1B - db 11010110b,11001110b,01111110b,00000000b - db 11111100b,11000110b,11000110b,11111100b ; R, 1C - db 11001100b,11000110b,11000110b,00000000b - db 01111100b,11000110b,11000000b,01111100b ; S, 1D - db 00000110b,11000110b,01111100b,00000000b - db 01111110b,00011000b,00011000b,00011000b ; T, 1E - db 00011000b,00011000b,00011000b,00000000b - db 11000110b,11000110b,11000110b,11000110b ; U, 1F - db 11000110b,11000110b,01111100b,00000000b - db 11000110b,11000110b,11000110b,11000110b ; V, 20 - db 01101100b,00111000b,00010000b,00000000b - db 11000110b,11000110b,11000110b,11010110b ; W, 21 - db 11010110b,11111110b,01101100b,00000000b - db 11000110b,01101100b,00111000b,00010000b ; X, 22 - db 00111000b,01101100b,11000110b,00000000b - db 11001100b,11001100b,01111000b,00110000b ; Y, 23 - db 00110000b,00110000b,00110000b,00000000b - db 11111100b,10001100b,00011000b,00110000b ; Z, 24 - db 01100000b,11000100b,11111100b,00000000b - db 00000000b,00000000b,00000000b,11111110b ; -, 25 - db 00000000b,00000000b,00000000b,00000000b - db 00000000b,00000000b,00000000b,00000000b ; _, 26 - db 00000000b,00000000b,11111110b,00000000b - db 01110000b,11011100b,00000110b,00000000b ; ~, 27 - db 00000000b,00000000b,00000000b,00000000b - db 00000000b,00000000b,00000000b,00000000b ; ., 28 - db 00000000b,00110000b,00110000b,00000000b - db 00000010b,00000100b,00001000b,00010000b ; /, 29 - db 00100000b,01000000b,10000000b,00000000b - db 00001100b,00011000b,00110000b,01100000b ; <, 2A - db 00110000b,00011000b,00001100b,00000000b - db 01100000b,00110000b,00011000b,00001100b ; >, 2B - db 00011000b,00110000b,01100000b,00000000b - db 00111000b,00100000b,00100000b,00100000b ; [, 2C - db 00100000b,00100000b,00111000b,00000000b - db 00111000b,00001000b,00001000b,00001000b ; ], 2D - db 00001000b,00001000b,00111000b,00000000b - db 00000000b,00011000b,00011000b,00000000b ; :, 2E - db 00011000b,00011000b,00000000b,00000000b - db 00011000b,00100100b,00011000b,00111010b ; &, 2F - db 01000100b,01000110b,00111010b,00000000b - ; Arrow, 30 - ; #, 31 (, 3A {, 43 - ; =, 32 ), 3B }, 44 - ; ", 33 @, 3C Up,45 - ; \, 34 ', 3D Dn,46 - ; *, 35 !, 3E Lt,47 - ; ?, 36 $, 3F Rt,48 - ; %, 37 ;, 40 Bk,49 - ; +, 38 `, 41 .5,4A - ; ,, 39 ^, 42 - -SECTION .text - -;******************************************************* -; Output Char Outputs char in al @ esi -;******************************************************* - -NEWSYM outputchar - push edi - push esi - push eax - mov edi,FontData - xor ebx,ebx - mov bl,al - shl ebx,3 - add edi,ebx - mov cl,8 -.loopa - mov ah,[edi] - mov ch,8 -.loopb - test ah,80h - jz .nowrite - mov al,[textcolor] - mov [esi],al - mov byte[esi+289],192 -.nowrite - shl ah,1 - inc esi - dec ch - jnz .loopb - add esi,280 - inc edi - dec cl - jnz .loopa - pop eax - pop esi - pop edi - ret - -NEWSYM outputchar16b - push edi - push esi - push eax - push edx - push ecx - mov dx,[vesa2_clbitng] - ror edx,16 - mov dx,[vesa2_clbitng] - shr dx,1 - ror edx,16 - - mov edi,FontData - xor ebx,ebx - mov bl,al - shl ebx,3 - add edi,ebx - call OutputText16b - pop ecx - pop edx - pop eax - pop esi - pop edi - ret - -SECTION .data -NEWSYM textcolor, db 128 -NEWSYM textcolor16b, dw 0FFFFh -SECTION .text - -NEWSYM outputchar5x5 - push edi - push esi - push eax - mov edi,GUIFontData - xor ebx,ebx - mov bl,al - shl ebx,2 - add edi,ebx - xor ebx,ebx - mov bl,al - add edi,ebx - mov cl,5 -.loopa - mov ah,[edi] - mov ch,5 -.loopb - test ah,80h - jz .nowrite - mov al,[textcolor] - mov [esi],al -.nowrite - shl ah,1 - inc esi - dec ch - jnz .loopb - add esi,283 - inc edi - dec cl - jnz .loopa - pop eax - pop esi - pop edi - ret - -NEWSYM outputchar16b5x5 - push edi - push esi - push eax - mov edi,GUIFontData - xor ebx,ebx - mov bl,al - shl ebx,2 - add edi,ebx - xor ebx,ebx - mov bl,al - add edi,ebx - mov cl,5 -.loopa - mov ah,[edi] - mov ch,5 -.loopb - test ah,80h - jz .nowrite - push eax - mov ax,[textcolor16b] - mov [esi],ax - mov [esi+75036*4],ax - pop eax -.nowrite - shl ah,1 - add esi,2 - dec ch - jnz .loopb - add esi,283*2 - inc edi - dec cl - jnz .loopa - pop eax - pop esi - pop edi - ret - -;******************************************************* -; Output Graphic String Outputs String from edi to esi -;******************************************************* - -NEWSYM OutputGraphicString - cmp byte[cbitmode],1 - je .do16b -.no16bit - xor eax,eax -.nextstr - mov al,[edi] - cmp al,0 - je .nomore - mov al,[ASCII2Font+eax] - call outputchar - add esi,8 - inc edi - jmp .nextstr -.nomore - ret - -.do16b - sub esi,[vidbuffer] - shl esi,1 - add esi,[vidbuffer] - cmp byte[textcolor],128 - jne .no128 - mov word[textcolor16b],0FFFFh -.no128 - cmp byte[textcolor],129 - jne .no129 - mov word[textcolor16b],0 -.no129 - cmp byte[textcolor],130 - jne .no130 - xor ax,ax - xor bx,bx - mov cl,[vesa2_rpos] - mov bx,20 - shl bx,cl - add ax,bx - mov cl,[vesa2_gpos] - mov bx,20 - shl bx,cl - add ax,bx - mov cl,[vesa2_bpos] - mov bx,20 - shl bx,cl - add ax,bx - mov [textcolor16b],ax -.no130 - ; Color #131, Red - cmp byte[textcolor],131 - jne .no131 - xor ax,ax - xor bx,bx - mov cl,[vesa2_rpos] - mov bx,22 - shl bx,cl - add ax,bx - mov cl,[vesa2_gpos] - mov bx,5 - shl bx,cl - add ax,bx - mov cl,[vesa2_bpos] - mov bx,5 - shl bx,cl - add ax,bx - mov [textcolor16b],ax -.no131 - jmp OutputGraphicString16b - -NEWSYM OutputGraphicString16b - xor eax,eax -.nextstr - mov al,[edi] - cmp al,0 - je .nomore - mov al,[ASCII2Font+eax] - call outputchar16b - add esi,16 - inc edi - jmp .nextstr -.nomore - ret - -NEWSYM OutputGraphicString5x5 - cmp byte[cbitmode],1 - je .do16b -.no16bit - xor eax,eax -.nextstr - mov al,[edi] - cmp al,0 - je .nomore - mov al,[ASCII2Font+eax] - call outputchar5x5 - add esi,6 - inc edi - jmp .nextstr -.nomore - ret - -.do16b - sub esi,[vidbuffer] - shl esi,1 - add esi,[vidbuffer] - cmp byte[textcolor],128 - jne .no128 - mov word[textcolor16b],0FFFFh -.no128 - cmp byte[textcolor],129 - jne .no129 - mov word[textcolor16b],0 -.no129 - cmp byte[textcolor],130 - jne .no130 - xor ax,ax - xor bx,bx - mov cl,[vesa2_rpos] - mov bx,20 - shl bx,cl - add ax,bx - mov cl,[vesa2_gpos] - mov bx,20 - shl bx,cl - add ax,bx - mov cl,[vesa2_bpos] - mov bx,20 - shl bx,cl - add ax,bx - mov [textcolor16b],ax -.no130 - ; Color #131, Red - cmp byte[textcolor],131 - jne .no131 - xor ax,ax - xor bx,bx - mov cl,[vesa2_rpos] - mov bx,22 - shl bx,cl - add ax,bx - mov cl,[vesa2_gpos] - mov bx,5 - shl bx,cl - add ax,bx - mov cl,[vesa2_bpos] - mov bx,5 - shl bx,cl - add ax,bx - mov [textcolor16b],ax -.no131 - jmp OutputGraphicString16b5x5 - -NEWSYM OutputGraphicString16b5x5 - xor eax,eax -.nextstr - mov al,[edi] - cmp al,0 - je .nomore - mov al,[ASCII2Font+eax] - call outputchar16b5x5 - add esi,12 - inc edi - jmp .nextstr -.nomore - ret - -;******************************************************* -; Save Select Allows user to select save state slot -;******************************************************* -; For Save State - -SECTION .bss -NEWSYM csounddisable, resb 1 -f3menuen resb 1 -PrevPictureVal resb 1 -CurPictureVal resb 1 -SECTION .text - -NEWSYM drawhline -.loop - mov [esi],al - inc esi - dec ecx - jnz .loop - ret - -NEWSYM drawhline16b -.loop - mov [esi],ax - add esi,2 - dec ecx - jnz .loop - ret - -NEWSYM drawvline -.loop - mov [esi],al - add esi,288 - dec ecx - jnz .loop - ret - -NEWSYM drawvline16b -.loop - mov [esi],ax - add esi,288*2 - dec ecx - jnz .loop - ret - -DetermineNewest: - pushad - mov dword[newestfiledate],0 - mov eax,[current_zst] - push eax - mov bl,10 - div bl - mul bl - movzx ecx,al - add al,bl -.again - mov [current_zst],ecx - pushad - call zst_determine_newest - popad - inc cl - cmp cl,al - jne .again - pop eax - mov [current_zst],eax - popad - ret - -GetPicture: - mov cl,[CurPictureVal] - cmp [PrevPictureVal],cl - jne .notskip - ret -.notskip - mov [PrevPictureVal],cl - - pushad - call LoadPicture - popad - - ; convert to 1:5:5:5 - cmp byte[newengen],0 - je .noneweng - cmp byte[nggposng],5 - jne .noneweng - mov edx,PrevPicture - mov ecx,64*56 -.loop2 - mov ax,[edx] - mov bx,ax - and ax,1111111111000000b - and bx,0000000000011111b - shr ax,1 - or bx,ax - mov [edx],bx - add edx,2 - dec ecx - jnz .loop2 -.noneweng - ; draw border - mov esi,75*2+9*288*2 - add esi,[vidbuffer] - mov edx,58 -.ploopa - mov ecx,66 - push esi -.ploopb - mov word[esi],0FFFFh - add esi,2 - dec ecx - jnz .ploopb - pop esi - add esi,288*2 - dec edx - jnz .ploopa - ; draw picture - mov esi,76*2+10*288*2 - add esi,[vidbuffer] - mov edx,56 - mov edi,PrevPicture -.ploopa2 - mov ecx,64 - push esi -.ploopb2 - mov ax,[edi] - mov [esi],ax - add esi,2 - add edi,2 - dec ecx - jnz .ploopb2 - pop esi - add esi,288*2 - dec edx - jnz .ploopa2 - ret - -NEWSYM drawfillboxsc - pushad - call zst_exists - cmp eax,1 - popad - jne .nodraw - - push eax - ; draws a 10x10 filled box according to position bl and color dl - xor eax,eax - mov al,11 - mul bl - mov esi,76+104*288 - add esi,[vidbuffer] - add esi,eax - mov ecx,10 - mov al,176 - push eax - mov eax,[current_zst] - cmp eax,[newest_zst] - pop eax - jne .next - mov al,208 -.next - push esi - push ecx - mov ecx,10 - call drawhline - pop ecx - pop esi - add esi,288 - dec ecx - jnz .next - pop eax -.nodraw - ret - -NEWSYM drawfillboxsc16b - pushad - call zst_exists - cmp eax,1 - popad - jne .nodraw - - push eax - ; draws a 10x10 filled box according to position bl and color dl - xor eax,eax - mov al,11 - mul bl - mov esi,76*2+104*288*2 - add esi,[vidbuffer] - add esi,eax - add esi,eax - mov ecx,10 - mov ax,[saveselect.allgrn] - push eax - mov eax,[current_zst] - cmp eax,[newest_zst] - pop eax - jne .next - mov ax,[saveselect.allgrnb] -.next - push esi - push ecx - mov ecx,10 - call drawhline16b - pop ecx - pop esi - add esi,288*2 - dec ecx - jnz .next - pop eax -.nodraw - ret - -NEWSYM drawbox - ; draws a box according to position bl and color dl - xor eax,eax - mov al,11 - mul bl - mov esi,75+103*288 - add esi,[vidbuffer] - add esi,eax - mov al,dl - push esi - mov ecx,12 - call drawhline - pop esi - push esi - mov ecx,12 - call drawvline - pop esi - push esi - add esi,11 - mov ecx,12 - call drawvline - pop esi - add esi,11*288 - mov ecx,12 - call drawhline - ret - -NEWSYM drawbox16b - ; draws a box according to position bl and color dx - xor eax,eax - mov al,11 - mul bl - mov esi,75*2+103*288*2 - add esi,[vidbuffer] - add esi,eax - add esi,eax - mov ax,dx - push esi - mov ecx,12 - call drawhline16b - pop esi - push esi - mov ecx,12 - call drawvline16b - pop esi - push esi - add esi,11*2 - mov ecx,12 - call drawvline16b - pop esi - add esi,11*288*2 - mov ecx,12 - call drawhline16b - ret - -%macro drawfillboxbase 2 - push eax - mov eax,[current_zst] - mov bl,10 - div bl - mul bl - mov bl,%1 - add al,bl - mov [current_zst],eax - pop eax - call %2 -%endmacro - -%macro drawfillboxhelp 1 - drawfillboxbase %1,drawfillboxsc -%endmacro - -%macro drawfillboxhelp16b 1 - drawfillboxbase %1,drawfillboxsc16b -%endmacro - -%macro testpressed 1 - push eax - mov eax,[current_zst] - mov bl,10 - div bl - mov bl,ah - mov ah,10 - mul ah - -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try1 - test byte[pressed+04Fh],1 - jz %%try1 - jmp %%yes1 -%%try1 -%endif - test byte[pressed+2],1 - jz %%no1 -%%yes1 - mov bl,1 -%%no1 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try2 - test byte[pressed+050h],1 - jz %%try2 - jmp %%yes2 -%%try2 -%endif - test byte[pressed+3],1 - jz %%no2 -%%yes2 - mov bl,2 -%%no2 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try3 - test byte[pressed+051h],1 - jz %%try3 - jmp %%yes3 -%%try3 -%endif - test byte[pressed+4],1 - jz %%no3 -%%yes3 - mov bl,3 -%%no3 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try4 - test byte[pressed+04Bh],1 - jz %%try4 - jmp %%yes4 -%%try4 -%endif - test byte[pressed+5],1 - jz %%no4 -%%yes4 - mov bl,4 -%%no4 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try5 - test byte[pressed+04Ch],1 - jz %%try5 - jmp %%yes5 -%%try5 -%endif - test byte[pressed+6],1 - jz %%no5 -%%yes5 - mov bl,5 -%%no5 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try6 - test byte[pressed+04Dh],1 - jz %%try6 - jmp %%yes6 -%%try6 -%endif - test byte[pressed+7],1 - jz %%no6 -%%yes6 - mov bl,6 -%%no6 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try7 - test byte[pressed+047h],1 - jz %%try7 - jmp %%yes7 -%%try7 -%endif - test byte[pressed+8],1 - jz %%no7 -%%yes7 - mov bl,7 -%%no7 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try8 - test byte[pressed+048h],1 - jz %%try8 - jmp %%yes8 -%%try8 -%endif - test byte[pressed+9],1 - jz %%no8 -%%yes8 - mov bl,8 -%%no8 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try9 - test byte[pressed+049h],1 - jz %%try9 - jmp %%yes9 -%%try9 -%endif - test byte[pressed+10],1 - jz %%no9 -%%yes9 - mov bl,9 -%%no9 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],0 ; if numlock on, let's try this first - je %%try0 - test byte[pressed+052h],1 - jz %%try0 - jmp %%yes0 -%%try0 -%endif - test byte[pressed+11],1 - jz %%no0 -%%yes0 - mov bl,0 -%%no0 -%ifdef __UNIXSDL__ - cmp dword[numlockptr],1 ; if numlock on, disregard numpad - je %%noleft -%endif - test byte[pressed+75],1 - jz %%noleft - cmp bl,0 - jne %%plzsub - add bl,9 - jmp %%donesub -%%plzsub - dec bl -%%donesub - mov byte[pressed+75],2 -%%noleft -%ifdef __UNIXSDL__ - cmp dword[numlockptr],1 ; if numlock on, disregard numpad - je %%noright -%endif - test byte[pressed+77],1 - jz %%noright - cmp bl,9 - jne %%plzadd - sub bl,9 - jmp %%doneadd -%%plzadd - inc bl -%%doneadd - mov byte[pressed+77],2 -%%noright -%ifdef __UNIXSDL__ - cmp dword[numlockptr],1 ; if numlock on, disregard numpad - je %%noup -%endif - test byte[pressed+72],1 - jz %%noup - cmp al,0 - jne %%plzsubten - add al,90 - jmp %%goneup -%%plzsubten - sub al,10 -%%goneup - mov byte[pressed+72],2 - add al,bl - mov [current_zst],eax - pop eax - jmp .updatescreen%1 -%%noup -%ifdef __UNIXSDL__ - cmp dword[numlockptr],1 ; if numlock on, disregard numpad - je %%nodown -%endif - test byte[pressed+80],1 - jz %%nodown - cmp al,90 - jne %%plzaddten - sub al,90 - jmp %%gonedown -%%plzaddten - add al,10 -%%gonedown - mov byte[pressed+80],2 - add al,bl - mov [current_zst],eax - pop eax - jmp .updatescreen%1 -%%nodown -%ifndef __MSDOS__ -%ifdef __UNIXSDL__ - test byte[pressed+92],1 -%else - test byte[pressed+0CBh],1 -%endif - jz %%noleft2 - cmp bl,0 - jne %%plzsub2 - add bl,9 - jmp %%donesub2 -%%plzsub2 - dec bl -%%donesub2 -%ifdef __UNIXSDL__ - mov byte[pressed+92],2 -%else - mov byte[pressed+0CBh],2 -%endif -%%noleft2 -%ifdef __UNIXSDL__ - test byte[pressed+94],1 -%else - test byte[pressed+0CDh],1 -%endif - jz %%noright2 - cmp bl,9 - jne %%plzadd2 - sub bl,9 - jmp %%doneadd2 -%%plzadd2 - inc bl -%%doneadd2 -%ifdef __UNIXSDL__ - mov byte[pressed+94],2 -%else - mov byte[pressed+0CDh],2 -%endif -%%noright2 -%ifdef __UNIXSDL__ - test byte[pressed+90],1 -%else - test byte[pressed+0C8h],1 -%endif - jz %%noup2 - cmp al,0 - jne %%plzsubten2 - add al,90 - jmp %%goneup2 -%%plzsubten2 - sub al,10 -%%goneup2 -%ifdef __UNIXSDL__ - mov byte[pressed+90],2 -%else - mov byte[pressed+0C8h],2 -%endif - add al,bl - mov [current_zst],eax - pop eax - jmp .updatescreen%1 -%%noup2 -%ifdef __UNIXSDL__ - test byte[pressed+96],1 -%else - test byte[pressed+0D0h],1 -%endif - jz %%nodown2 - cmp al,90 - jne %%plzaddten2 - sub al,90 - jmp %%gonedown2 -%%plzaddten2 - add al,10 -%%gonedown2 -%ifdef __UNIXSDL__ - mov byte[pressed+96],2 -%else - mov byte[pressed+0D0h],2 -%endif - add al,bl - mov [current_zst],eax - pop eax - jmp .updatescreen%1 -%%nodown2 -%endif - add al,bl - mov [current_zst],eax - pop eax -%endmacro - -NEWSYM saveselect - mov byte[f3menuen],1 - mov byte[ForceNonTransp],1 - cmp byte[ForceNewGfxOff],0 - jne .nong16b - cmp byte[cbitmode],0 - je .nong16b -%ifdef __MSDOS__ - call GetScreen -%endif -.nong16b - cmp dword[MessageOn],0 - je .nochangem - mov dword[MessageOn],1 -.nochangem - mov al,[newengen] - mov byte[newengen],0 - push eax - call copyvid - pop eax - mov [newengen],al - call StopSound - cmp byte[soundon],0 - je .nosound - mov byte[csounddisable],1 -%ifdef __MSDOS__ - call SB_blank -%endif -.nosound - cmp byte[cbitmode],1 - je near .16b -.updatescreen8b -%ifdef __MSDOS__ - call saveselectpal -%endif - ; draw a small blue box with a white border - mov esi,70+70*288 - add esi,[vidbuffer] - mov ecx,150 - mov al,80 -.loop - mov byte[esi],144 - inc esi - dec ecx - jnz .loop - add esi,288-150 - dec al - mov ecx,150 - jnz .loop - ; draw filled boxes for existing files - call DetermineNewest - push ebx - mov eax,[current_zst] - push eax - mov bl,10 - div bl - add al,'0' - mov [slotlevelnum],al - drawfillboxhelp 0 - drawfillboxhelp 1 - drawfillboxhelp 2 - drawfillboxhelp 3 - drawfillboxhelp 4 - drawfillboxhelp 5 - drawfillboxhelp 6 - drawfillboxhelp 7 - drawfillboxhelp 8 - drawfillboxhelp 9 - pop eax - mov [current_zst],eax - pop ebx - - mov esi,75+73*288 - add esi,[vidbuffer] - mov edi,.stringa - call OutputGraphicString - mov esi,75+83*288 - add esi,[vidbuffer] - mov edi,.stringb - call OutputGraphicString - mov esi,75+93*288 - add esi,[vidbuffer] - mov edi,.stringb2 - call OutputGraphicString - mov esi,171+93*288 - add esi,[vidbuffer] - mov edi,slotlevelnum - call OutputGraphicString - mov esi,75+118*288 - add esi,[vidbuffer] - mov edi,.stringc - call OutputGraphicString - mov esi,75+128*288 - add esi,[vidbuffer] - mov edi,.stringd - call OutputGraphicString - mov esi,75+138*288 - add esi,[vidbuffer] - mov edi,.stringe - call OutputGraphicString - mov al,128 - mov esi,70+70*288 - add esi,[vidbuffer] - mov ecx,150 - call drawhline - mov esi,70+70*288 - add esi,[vidbuffer] - mov ecx,80 - call drawvline - mov esi,70+149*288 - add esi,[vidbuffer] - mov ecx,150 - call drawhline - mov esi,219+70*288 - add esi,[vidbuffer] - mov ecx,80 - call drawvline - mov esi,75+103*288 - add esi,[vidbuffer] - mov ecx,111 - call drawhline - mov esi,75+114*288 - add esi,[vidbuffer] - mov ecx,111 - call drawhline - mov esi,75+104*288 - add esi,[vidbuffer] - mov bl,11 -.nextvline - mov ecx,10 - push esi - push ebx - call drawvline - pop ebx - pop esi - add esi,11 - dec bl - jnz .nextvline - mov esi,78+106*288 - add esi,[vidbuffer] - mov al,1 - call outputchar - mov bl,9 -.nextnumchar - add esi,11 - inc al - push ebx - call outputchar - pop ebx - dec bl - jnz .nextnumchar - mov byte[curblank],0h - - mov dl,160 - call drawbox - push ebx - call copyvid - pop ebx - ; wait until esc/enter is pressed -.noesc - mov dl,128 - call drawbox - mov ecx,2500 - call delay - testpressed 8b - test byte[pressed+1],1 - jnz near .esc - test byte[pressed+28],1 - jnz near .enter - mov ecx,2500 - call delay - testpressed 8b - test byte[pressed+1],1 - jnz near .esc - test byte[pressed+28],1 - jnz near .enter - push ebx - call copyvid - pop ebx - mov ecx,2500 - call delay - testpressed 8b - test byte[pressed+1],1 - jnz near .esc - test byte[pressed+28],1 - jnz near .enter - mov ecx,2500 - call delay - testpressed 8b - test byte[pressed+1],1 - jnz near .esc - test byte[pressed+28],1 - jnz near .enter - mov dl,160 - call drawbox - push ebx - call copyvid - pop ebx - jmp .noesc -.enter - mov byte[pressed+28],2 -.esc - - mov eax,pressed - mov ecx,256 -.looppr - cmp byte[eax],1 - jne .notpr - mov byte[eax],2 -.notpr - inc eax - dec ecx - jnz .looppr -%ifdef __MSDOS__ - mov byte[pressed+1],0 -%endif - - mov word[t1cc],0 - mov byte[csounddisable],0 - call StartSound - -%ifdef __MSDOS__ - call dosmakepal -%endif - mov byte[f3menuen],0 - mov byte[ForceNonTransp],0 - ret - -SECTION .bss -.allred resw 1 -.allgrn resw 1 -.allgrnb resw 1 -.blue resw 1 -.stepb resw 1 -SECTION .text - -; Start 16-bit stuff here -.16b - cmp byte[newengen],0 - je .notng - mov byte[GUIOn],1 -.notng - ; draw shadow behind box - mov esi,80*2+90*288*2 - add esi,[vidbuffer] - mov ecx,150 - mov al,70 - mov ah,5 -.loop16b2 - mov dx,[esi] - and dx,[vesa2_clbit] - shr dx,1 - mov [esi],dx - add esi,2 - dec ecx - jnz .loop16b2 - add esi,288*2-150*2 - dec al - mov ecx,150 - jnz .loop16b2 - -.updatescreen16b - mov ax,018h - mov cl,[vesa2_rpos] - shl ax,cl - mov [.allgrn],ax - - mov ax,25 - mov cl,[vesa2_rpos] - shl ax,cl - mov [.allgrnb],ax - mov ax,12 - mov cl,[vesa2_gpos] - shl ax,cl - or [.allgrnb],ax - - mov ax,01Fh - mov cl,[vesa2_rpos] - shl ax,cl - mov [.allred],ax - mov ax,012h - mov cl,[vesa2_bpos] - shl ax,cl - mov dx,ax - mov ax,01h - mov cl,[vesa2_gpos] - shl ax,cl - mov bx,ax - mov ax,01h - mov cl,[vesa2_rpos] - shl ax,cl - or bx,ax - - ; draw a small blue box with a white border - mov esi,70*2+70*288*2 - add esi,[vidbuffer] - mov ecx,150 - mov al,80 - mov ah,5 -.loop16b - mov [esi],dx - add esi,2 - dec ecx - jnz .loop16b - add esi,288*2-150*2 - dec ah - jnz .nocolinc16b - add dx,bx - mov ah,5 -.nocolinc16b - dec al - mov ecx,150 - jnz .loop16b - - ; draw filled boxes for existing files - call DetermineNewest - push ebx - mov eax,[current_zst] - push eax - mov bl,10 - div bl - add al,'0' - mov [slotlevelnum],al - drawfillboxhelp16b 0 - drawfillboxhelp16b 1 - drawfillboxhelp16b 2 - drawfillboxhelp16b 3 - drawfillboxhelp16b 4 - drawfillboxhelp16b 5 - drawfillboxhelp16b 6 - drawfillboxhelp16b 7 - drawfillboxhelp16b 8 - drawfillboxhelp16b 9 - pop eax - mov [current_zst],eax - pop ebx - - mov esi,75*2+73*288*2 - add esi,[vidbuffer] - mov edi,.stringa - call OutputGraphicString16b - mov esi,75*2+83*288*2 - add esi,[vidbuffer] - mov edi,.stringb - call OutputGraphicString16b - mov esi,75*2+93*288*2 - add esi,[vidbuffer] - mov edi,.stringb2 - call OutputGraphicString16b - mov esi,171*2+93*288*2 - add esi,[vidbuffer] - mov edi,slotlevelnum - call OutputGraphicString16b - mov esi,75*2+118*288*2 - add esi,[vidbuffer] - mov edi,.stringc - call OutputGraphicString16b - mov esi,75*2+128*288*2 - add esi,[vidbuffer] - mov edi,.stringd - call OutputGraphicString16b - mov esi,75*2+138*288*2 - add esi,[vidbuffer] - mov edi,.stringe - call OutputGraphicString16b - mov ax,0FFFFh - mov esi,70*2+70*288*2 - add esi,[vidbuffer] - mov ecx,150 - call drawhline16b - mov esi,70*2+70*288*2 - add esi,[vidbuffer] - mov ecx,80 - call drawvline16b - mov esi,70*2+149*288*2 - add esi,[vidbuffer] - mov ecx,150 - call drawhline16b - mov esi,219*2+70*288*2 - add esi,[vidbuffer] - mov ecx,80 - call drawvline16b - mov esi,75*2+103*288*2 - add esi,[vidbuffer] - mov ecx,111 - call drawhline16b - mov esi,75*2+114*288*2 - add esi,[vidbuffer] - mov ecx,111 - call drawhline16b - mov esi,75*2+104*288*2 - add esi,[vidbuffer] - mov bl,11 -.nextvline16b - mov ecx,10 - push esi - push ebx - call drawvline16b - pop ebx - pop esi - add esi,22 - dec bl - jnz .nextvline16b - mov esi,78*2+106*288*2 - add esi,[vidbuffer] - mov al,1 - call outputchar16b - mov bl,9 -.nextnumchar16b - add esi,22 - inc al - push ebx - call outputchar16b - pop ebx - dec bl - jnz .nextnumchar16b - - mov byte[curblank],0h -; mov dx,[.allred] -; call drawbox16b - push ebx - mov al,[newengen] - mov byte[newengen],0 - push eax - call copyvid - pop eax - mov [newengen],al - pop ebx - ; wait until esc/enter is pressed - - mov byte[PrevPictureVal],0FFh -.noesc16b - push eax - mov eax,[current_zst] - mov [CurPictureVal],al - pop eax - pushad - call GetPicture - popad - - mov dx,0FFFFh - call drawbox16b - mov ecx,2500 - call delay - testpressed 16b - test byte[pressed+1],1 - jnz near .esc16b - test byte[pressed+28],1 - jnz near .enter16b - mov ecx,2500 - call delay - testpressed 16b - test byte[pressed+1],1 - jnz near .esc16b - test byte[pressed+28],1 - jnz near .enter16b - push ebx - mov al,[newengen] - mov byte[newengen],0 - push eax - call copyvid - pop eax - mov [newengen],al - pop ebx - mov ecx,2500 - call delay - testpressed 16b - test byte[pressed+1],1 - jnz near .esc16b - test byte[pressed+28],1 - jnz near .enter16b - mov ecx,2500 - call delay - testpressed 16b - test byte[pressed+1],1 - jnz near .esc16b - test byte[pressed+28],1 - jnz near .enter16b - mov dx,[.allred] - call drawbox16b - push ebx - mov al,[newengen] - mov byte[newengen],0 - push eax - call copyvid - pop eax - mov [newengen],al - pop ebx - jmp .noesc16b -.enter16b - mov byte[pressed+28],2 -.esc16b - mov eax,pressed - mov ecx,256 -.looppr2 - cmp byte[eax],1 - jne .notpr2 - mov byte[eax],2 -.notpr2 - inc eax - dec ecx - jnz .looppr2 -.prwin -%ifdef __MSDOS__ - mov byte[pressed+1],0 -%endif - mov word[t1cc],0 - mov byte[csounddisable],0 - call StartSound - mov byte[f3menuen],0 - mov byte[ForceNonTransp],0 - mov byte[GUIOn],0 - pushad - call Clear2xSaIBuffer - popad - ret - -SECTION .data -.stringa db 'PLEASE SELECT',0 -.stringb db 'SAVE STATE SLOT',0 -.stringb2 db 'SLOT LEVEL:',0 -.stringc db 'USE CURSOR KEYS',0 -.stringd db 'TO MOVE AND',0 -.stringe db 'ENTER TO SELECT',0 -slotlevelnum db '-',0 - -SECTION .bss -NEWSYM ForceNonTransp, resb 1 - -;******************************************************* -; MakePal Changes the entire palette -;******************************************************* -; set the brightness with [maxbr] -SECTION .bss -NEWSYM cgramback, resw 256 -SECTION .text - -NEWSYM doveg - pushad - ; backup cgram - mov ecx,128 - xor ebx,ebx -.loop - mov eax,[cgram+ebx] - mov [cgramback+ebx],eax - add ebx,4 - dec ecx - jnz .loop - xor eax,eax - mov al,[coladdr] - add al,[coladdg] - add al,[coladdb] - xor dx,dx - mov bx,3 - div bx - and ax,011111b - mov [coladdr],al - mov [coladdg],al - mov [coladdb],al - xor eax,eax -.next - push eax - mov ax,[cgram+eax] - mov bx,ax - mov cx,ax - and bx,011111b - and cx,1111100000b - shr cx,5 - add bx,cx - mov cx,ax - and cx,111110000000000b - shr cx,10 - add bx,cx - mov ax,bx - xor dx,dx - mov bx,3 - div bx - and ax,011111b - mov cx,ax - mov bx,ax - shl bx,5 - or ax,bx - shl cx,10 - or ax,cx - mov bx,ax - pop eax - mov [cgram+eax],bx - add eax,2 - cmp eax,200h - jne .next - popad - ret - -NEWSYM dovegrest - pushad - ; backup cgram - mov ecx,128 - xor ebx,ebx -.loop - mov eax,[cgramback+ebx] - mov [cgram+ebx],eax - add ebx,4 - dec ecx - jnz .loop - popad - ret - -SECTION .bss -NEWSYM tempco0, resw 1 -NEWSYM prevbright, resb 1 ; previous brightness -SECTION .text - -%ifdef __MSDOS__ -NEWSYM dosmakepal - cmp byte[V8Mode],1 - jne .noveg - call doveg -.noveg - mov ax,[cgram] - mov [tempco0],ax - test byte[scaddtype],00100000b - jz near .noaddition - test byte[scaddtype],10000000b - jnz near .noaddition - mov cx,[cgram] - mov ax,cx - and ax,001Fh - add al,[coladdr] - cmp al,01Fh - jb .noadd - mov al,01Fh -.noadd - mov bx,ax - mov ax,cx - shr ax,5 - and ax,001Fh - add al,[coladdg] - cmp al,01Fh - jb .noaddb - mov al,01Fh -.noaddb - shl ax,5 - add bx,ax - mov ax,cx - shr ax,10 - and ax,001Fh - add al,[coladdb] - cmp al,01Fh - jb .noaddc - mov al,01Fh -.noaddc - shl ax,10 - add bx,ax - mov [cgram],bx -.noaddition - cmp byte[Palette0],0 - je .nocol0mod - mov word[cgram],0 -.nocol0mod -NEWSYM makepalb - mov edi,cgram - mov ebx,prevpal - xor ah,ah -.loopa - mov cx,[edi] - push eax - push ebx - mov [ebx],cx - mov al,ah - mov dx,03C8h - out dx,al - mov ax,cx - and al,01Fh - mov bh,[maxbr] - mov bl,bh - mul bl - mov bl,15 - div bl - shl al,1 - mov dx,03C9h - add al,[gammalevel] - cmp al,63 - jbe .nor - mov al,63 -.nor - out dx,al - mov ax,cx - shr ax,5 - and al,01Fh - mov bl,bh - mul bl - mov bl,15 - div bl - shl al,1 - add al,[gammalevel] - cmp al,63 - jbe .nog - mov al,63 -.nog - out dx,al - mov ax,cx - shr ax,10 - and al,01Fh - mov bl,bh - mul bl - mov bl,15 - div bl - shl al,1 - add al,[gammalevel] - cmp al,63 - jbe .nob - mov al,63 -.nob - out dx,al - pop ebx - pop eax - add edi,2 - add ebx,2 - inc ah - jnz near .loopa - mov al,[maxbr] - mov [prevbright],al - mov ax,[tempco0] - mov [cgram],ax - cmp byte[MessageOn],0 - je .nochange128 - mov dx,03C8h - mov al,128 - out dx,al - mov al,63 - inc dx - out dx,al - out dx,al - out dx,al - mov dx,03C8h - mov al,128+64 - out dx,al - mov al,0 - inc dx - out dx,al - out dx,al - out dx,al -.nochange128 - cmp byte[V8Mode],1 - jne .noveg2 - call dovegrest -.noveg2 - ret - -;******************************************************* -; ChangePal Sets up the palette -;******************************************************* - -NEWSYM doschangepal - cmp byte[V8Mode],1 - jne .noveg - call doveg -.noveg - mov ax,[cgram] - mov [tempco0],ax - test byte[scaddtype],00100000b - jz near .noaddition - test byte[scaddtype],10000000b - jnz near .noaddition - mov cx,[cgram] - mov ax,cx - and ax,001Fh - add al,[coladdr] - cmp al,01Fh - jb .noadd - mov al,01Fh -.noadd - mov bx,ax - mov ax,cx - shr ax,5 - and ax,001Fh - add al,[coladdg] - cmp al,01Fh - jb .noaddb - mov al,01Fh -.noaddb - shl ax,5 - add bx,ax - mov ax,cx - shr ax,10 - and ax,001Fh - add al,[coladdb] - cmp al,01Fh - jb .noaddc - mov al,01Fh -.noaddc - shl ax,10 - add bx,ax - mov [cgram],bx -.noaddition - cmp byte[Palette0],0 - je .nocol0mod - mov word[cgram],0 -.nocol0mod - ; check if brightness differs - mov al,[maxbr] - cmp al,[prevbright] - jne near makepalb - ; check for duplicate palette (Compare prevpal with cgram) - mov ebx,prevpal - mov edi,cgram - xor ah,ah -.loopa - mov cx,[edi] - cmp cx,[ebx] - je .nochange - push eax - push ebx - push eax - pop eax - mov [ebx],cx - mov al,ah - mov dx,03C8h - out dx,al - mov ax,cx - and al,01Fh - mov bh,[maxbr] - mov bl,bh - mul bl - mov bl,15 - div bl - shl al,1 - add al,[gammalevel] - cmp al,63 - jbe .nor - mov al,63 -.nor - inc dx - out dx,al - mov ax,cx - shr ax,5 - and al,01Fh - mov bl,bh - mul bl - mov bl,15 - div bl - shl al,1 - add al,[gammalevel] - cmp al,63 - jbe .nog - mov al,63 -.nog - out dx,al - mov ax,cx - shr ax,10 - and al,01Fh - mov bl,bh - mul bl - mov bl,15 - div bl - shl al,1 - add al,[gammalevel] - cmp al,63 - jbe .nob - mov al,63 -.nob - out dx,al - pop ebx - pop eax -.nochange - add edi,2 - add ebx,2 - inc ah - jnz near .loopa - mov ax,[tempco0] - mov [cgram],ax - cmp byte[MessageOn],0 - je .nochange128 - mov dx,03C8h - mov al,128 - out dx,al - mov al,63 - inc dx - out dx,al - out dx,al - out dx,al -.nochange128 - cmp byte[V8Mode],1 - jne .noveg2 - call dovegrest -.noveg2 - ret -%endif - -;******************************************************* -; CopyVid Copies buffer into video -;******************************************************* - -NEWSYM showfps - mov ax,60 - cmp byte[romispal],0 - je .ntsc - mov ax,50 -.ntsc - inc byte[curfps] - cmp byte[nextframe],al - jb .nofrc - mov cl,[curfps] - mov [lastfps],cl - mov cl,[curfps2] - mov [lastfps2],cl - mov byte[curfps],0 - mov byte[curfps2],0 - sub byte[nextframe],al -.nofrc - mov cl,[SloMo] - or cl,cl - jz .noslw - inc cl - div cl -.noslw - mov cl,al - - cmp byte[cbitmode],1 - je near .do16b - -%ifdef __MSDOS__ - call displayfpspal -%endif - - movzx ax,byte[lastfps] - mov bl,10 - div bl - shl al,4 - add ah,al - mov al,ah - mov esi,208*288+32 - add esi,[vidbuffer] - push ecx - call outputhex - - mov esi,208*288+48 - add esi,[vidbuffer] - mov al,29h - call outputchar - pop ecx - - mov al,cl - mov bl,10 - xor ah,ah - div bl - shl al,4 - add ah,al - mov al,ah - mov esi,208*288+56 - add esi,[vidbuffer] - call outputhex - ret - -.do16b - mov esi,208*288*2+48*2 - add esi,[vidbuffer] - mov al,[lastfps] - push ecx - xor ecx,ecx -.strloop - xor ah,ah - add al,48 - sub esi,8*2 -.asciiloop16b - cmp al,58 - jb .h2adone16b - inc ah - sub al,10 - jmp .asciiloop16b -.h2adone16b - mov cl,al - mov al,[ASCII2Font+ecx] - call outputchar16b - mov al,ah - or al,al - jnz .strloop - - mov esi,208*288*2+48*2 - add esi,[vidbuffer] - mov al,41 ; '/' - call outputchar16b - pop ecx - - mov al,cl - mov bl,10 - xor ah,ah - div bl - shl al,4 - add ah,al - mov al,ah - mov esi,208*288*2+56*2 - add esi,[vidbuffer] - call outputhex16 - ret - -SECTION .bss -NEWSYM tempoffset, resw 1 -NEWSYM Testval, resd 1 -SECTION .text - -EXTSYM TwelveHourClock - -NEWSYM ClockOutput - cmp byte[cbitmode],1 - je near .do16b3 -.no16b3 -%ifdef __MSDOS__ - call displayfpspal -%endif - mov esi,215*288+32+192 - add esi,[vidbuffer] - cmp byte[ForceNonTransp],1 - je .menuon8 - cmp byte[ClockBox],1 - jne near .do8b -.menuon8 - mov ebx,7 -.loop2 - mov ecx,12 - mov byte[esi-1],0C0h -.loop - mov dword[esi],0C0C0C0C0h - add esi,4 -.nobox8 - dec ecx - jnz .loop - add esi,288-48 - dec ebx - jnz .loop2 - jmp .do8b -.do16b3 - mov esi,215*288*2+32*2+192*2 - add esi,[vidbuffer] - cmp byte[ForceNonTransp],1 - je .menuon16 - cmp byte[ClockBox],1 - jne .do8b -.menuon16 - mov ebx,7 -.loop2b - mov ecx,24 - mov word[esi-2],0 - mov word[esi-2+75036*4],0 -.loopb - mov dword[esi],0 - mov dword[esi+75036*4],0 - add esi,4 -.nobox16 - dec ecx - jnz .loopb - add esi,288*2-48*2 - dec ebx - jnz .loop2b -.do8b - call GetTimeInSeconds - xor edx,edx - mov ebx,60 - div ebx - push eax - ; edx = seconds - mov eax,edx - xor edx,edx - mov ebx,10 - div ebx - mov esi,216*288+32+228 - call .output - pop eax - mov ebx,60 - xor edx,edx - div ebx - push eax - ; edx = minutes - mov eax,edx - xor edx,edx - mov ebx,10 - div ebx - mov esi,216*288+32+210 - call .output - pop eax - ; eax = hours - cmp byte[TwelveHourClock],1 - jne .no12hour - ; check to see if it's 12 PM - cmp eax,12 - jbe .not12pm - sub eax,12 -.not12pm - cmp eax,0 - jne .no12hour - add eax,12 -.no12hour - xor edx,edx - mov ebx,10 - div ebx - mov esi,216*288+32+192 - call .output - cmp byte[cbitmode],1 - je .do16b2 -.no16b4 - mov esi,216*288+32+222 - add esi,[vidbuffer] - xor eax,eax - add al,':' - mov al,[ASCII2Font+eax] - pushad - call outputchar5x5 - popad - mov esi,216*288+32+204 - add esi,[vidbuffer] - xor eax,eax - add al,':' - mov al,[ASCII2Font+eax] - pushad - call outputchar5x5 - popad - ret - -.do16b2 - mov esi,216*288*2+32*2+222*2 - add esi,[vidbuffer] - xor eax,eax - add al,':' - mov al,[ASCII2Font+eax] - pushad - call outputchar16b5x5 - popad - mov esi,216*288*2+32*2+204*2 - add esi,[vidbuffer] - xor eax,eax - add al,':' - mov al,[ASCII2Font+eax] - pushad - call outputchar16b5x5 - popad - ret -.output - ; output char value at al and dl - cmp byte[cbitmode],1 - je .do16b -.no16b5 - add esi,[vidbuffer] - and eax,0FFh - add al,48 - mov al,[ASCII2Font+eax] - pushad - call outputchar5x5 - popad - xor eax,eax - mov al,dl - add al,48 - mov al,[ASCII2Font+eax] - add esi,6 - pushad - call outputchar5x5 - popad - ret -.do16b - add esi,esi - add esi,[vidbuffer] - and eax,0FFh - add al,48 - mov al,[ASCII2Font+eax] - pushad - call outputchar16b5x5 - popad - xor eax,eax - mov al,dl - add al,48 - mov al,[ASCII2Font+eax] - add esi,12 - pushad - call outputchar16b5x5 - popad - ret - -SECTION .bss -NEWSYM SoundTest, resb 1 -blahrnr resw 1 - -SECTION .text - -NEWSYM hextestoutput - - mov dx,[bg3scroly] -; and dx,0F8h - shr edx,3 - shl edx,6 - xor eax,eax - mov ax,[bg3ptr] - add ax,dx - xor edx,edx - mov dx,[bg3scrolx] - and dx,0F8h - shr edx,3 - shl edx,1 - add ax,dx - mov dx,[bg3scrolx] - test dx,8000h - jz .nooma - and dx,0F000h - shr dx,5 - add ax,dx -.nooma - add eax,40h - mov edx,eax - mov [Testval],edx -%ifdef __MSDOS__ - call displayfpspal -%endif - - mov esi,[vram] - mov ax,0 - mov ecx,400h -.loop -; mov word[esi],ax - add esi,2 - dec ecx - jnz .loop - inc word[blahrnr] - mov esi,216*288+32 - add esi,[vidbuffer] - xor eax,eax - ; 4F00h - mov ebx,[C4Ram] - mov ebx,[vram] - mov al,[DecompAPtr+1h] - call outputhex - mov esi,216*288+32+16 - add esi,[vidbuffer] - xor eax,eax - mov ebx,[C4Ram] - mov ebx,[vram] - mov al,[DecompAPtr] - call outputhex - mov esi,216*288+70 - add esi,[vidbuffer] - xor eax,eax - mov ebx,[C4Ram] - mov al,[bg1objptr+1] - call outputhex - mov esi,216*288+70+16 - add esi,[vidbuffer] - xor eax,eax - mov ebx,[C4Ram] - mov al,[bg1objptr] - call outputhex - mov esi,216*288+108 - add esi,[vidbuffer] - xor eax,eax - mov ebx,[C4Ram] - mov al,[ebx+4] - call outputhex - mov esi,216*288+108+16 - add esi,[vidbuffer] - xor eax,eax - mov ebx,[C4Ram] - mov al,[ebx+9] - call outputhex - mov esi,216*288+146 - add esi,[vidbuffer] - xor eax,eax - mov ebx,[C4Ram] - mov al,[ebx+10] - call outputhex - xor eax,eax - mov esi,216*288+146+16 - add esi,[vidbuffer] - or al,[bg1scroly] - mov ebx,[C4Ram] - mov al,[ebx+11] - call outputhex - ret - -SECTION .bss -NEWSYM SoundPlayed0, resb 1 -NEWSYM SoundPlayed1, resb 1 -NEWSYM SoundPlayed2, resb 1 -NEWSYM SoundPlayed3, resb 1 -NEWSYM SoundPlayed4, resb 1 -NEWSYM SoundPlayed5, resb 1 -NEWSYM SoundPlayed6, resb 1 -NEWSYM SoundPlayed7, resb 1 -SECTION .text - -NEWSYM ShowSound - add esi,[vidbuffer] -.next - mov [esi],ebx - mov [esi+4],ebx - mov [esi+8],bx - sub esi,288 - dec al - jnz .next - ret - -NEWSYM sounddisplay -%ifdef __MSDOS__ - call displayfpspal -%endif - - push esi - push ebx - push eax - mov ebx,80808080h - cmp byte[SoundPlayed0],0 - je .nosnd0 - mov al,[SoundPlayed0] - mov esi,223*288+16 - call ShowSound - sub byte[SoundPlayed0],2 -.nosnd0 - cmp byte[SoundPlayed1],0 - je .nosnd1 - mov al,[SoundPlayed1] - mov esi,223*288+28 - call ShowSound - sub byte[SoundPlayed1],2 -.nosnd1 - cmp byte[SoundPlayed2],0 - je .nosnd2 - mov al,[SoundPlayed2] - mov esi,223*288+40 - call ShowSound - sub byte[SoundPlayed2],2 -.nosnd2 - cmp byte[SoundPlayed3],0 - je .nosnd3 - mov al,[SoundPlayed3] - mov esi,223*288+52 - call ShowSound - sub byte[SoundPlayed3],2 -.nosnd3 - cmp byte[SoundPlayed4],0 - je .nosnd4 - mov al,[SoundPlayed4] - mov esi,223*288+64 - call ShowSound - sub byte[SoundPlayed4],2 -.nosnd4 - cmp byte[SoundPlayed5],0 - je .nosnd5 - mov al,[SoundPlayed5] - mov esi,223*288+76 - call ShowSound - sub byte[SoundPlayed5],2 -.nosnd5 - cmp byte[SoundPlayed6],0 - je .nosnd6 - mov al,[SoundPlayed6] - mov esi,223*288+88 - call ShowSound - sub byte[SoundPlayed6],2 -.nosnd6 - cmp byte[SoundPlayed7],0 - je .nosnd7 - mov al,[SoundPlayed7] - mov esi,223*288+100 - call ShowSound - sub byte[SoundPlayed7],2 -.nosnd7 - pop eax - pop esi - pop ebx - ret - -NEWSYM waitvsync - mov dx,3DAh ;VGA status port -;.loop -; in al,dx -; test al,8 ;check VR bit -; jnz .loop ;in middle of VR, better wait for next one -.loop2 - in al,dx - test al,8 - jz .loop2 ;updating the screen - ret - -SECTION .data -NEWSYM prevengval, db 10 - - -SECTION .text - -NEWSYM copyvid - mov dword[.sdrawptr],0 - ; Test if add table needs updating - cmp byte[cbitmode],0 - je .notatud - cmp byte[vesa2red10],0 - je .notatud - mov al,[newengen] - cmp [prevengval],al - je .notatud - mov [prevengval],al - call genfulladdtab - jmp .notatud -.redadd - call genfulladdtabng -.notatud - cmp dword[MessageOn],0 - je near .nomsg - cmp byte[cbitmode],1 - je near .do16b -.no16b - mov edi,[Msgptr] - mov esi,192*288+32 - add esi,[vidbuffer] - cmp edi,CSStatus - je .fivex5b - cmp byte[SmallMsgText],1 - je .smallmsgtext - call OutputGraphicString.no16bit - jmp .nfivex5b -.fivex5b - call OutputGraphicString5x5 - mov edi,CSStatus2 - mov esi,200*288+32 - add esi,[vidbuffer] - call OutputGraphicString5x5 - mov edi,CSStatus3 - mov esi,208*288+32 - add esi,[vidbuffer] - call OutputGraphicString5x5 - mov edi,CSStatus4 - mov esi,216*288+32 - add esi,[vidbuffer] - call OutputGraphicString5x5 - jmp .nfivex5b -.smallmsgtext - call OutputGraphicString5x5 -.nfivex5b - dec dword[MessageOn] - jnz near .nomsg -%ifdef __MSDOS__ - cmp byte[cbitmode],1 - je near .nomsg - call dosmakepal -%endif - jmp .nomsg -.do16b - mov edi,[Msgptr] - mov esi,192*288*2+32*2 - add esi,[vidbuffer] - cmp edi,CSStatus - je .fivex5 - cmp byte[SmallMsgText],1 - je .smallmsgtext2 - call OutputGraphicString16b - jmp .nfivex5 -.fivex5 - call OutputGraphicString16b5x5 - mov edi,CSStatus2 - mov esi,200*288*2+32*2 - add esi,[vidbuffer] - call OutputGraphicString16b5x5 - mov edi,CSStatus3 - mov esi,208*288*2+32*2 - add esi,[vidbuffer] - call OutputGraphicString16b5x5 - mov edi,CSStatus4 - mov esi,216*288*2+32*2 - add esi,[vidbuffer] - call OutputGraphicString16b5x5 - jmp .nfivex5 -.smallmsgtext2 - call OutputGraphicString16b5x5 -.nfivex5 - dec dword[MessageOn] -.nomsg - cmp byte[MovieProcessing],0 - jz .nomovie4 - cmp byte[MovieDisplayFrame],0 - jz .nomovie4 - pushad - call GetMovieFrameStr - popad - mov edi,MovieFrameStr - cmp byte[cbitmode],1 - jne .not16bframe - mov esi,216*288*2+32*2 - add esi,[vidbuffer] - call OutputGraphicString16b5x5 - jmp .nomovie4 -.not16bframe - mov esi,216*288+32 - add esi,[vidbuffer] - call OutputGraphicString5x5 -.nomovie4 - jmp vidpaste -SECTION .bss -.sdrawptr resd 1 -SECTION .text - -NEWSYM vidpaste -%ifdef __MSDOS__ - cmp byte[vsyncon],0 - je .novsync - cmp byte[Triplebufen],0 - jne .novsync - cmp byte[curblank],0h - jne .novsync - call waitvsync -.novsync - cmp byte[cbitmode],1 - je .nopal - cmp byte[curblank],0 - jne .nopal - call doschangepal -.nopal -%endif - cmp byte[FPSOn],0 - je .nofps - cmp byte[curblank],0 - jne .nofps - call showfps -.nofps - cmp byte[TimerEnable],0 - je .noclock - cmp byte[ShowTimer],0 - je .noclock - call ClockOutput -.noclock - cmp byte[device2],2 - je near .drawss -.returnfromdraw - mov ax,[resolutn] - cmp [prevresolutn],ax - je .noclear - mov [prevresolutn],ax -%ifdef __MSDOS__ - call DOSClearScreen -%endif -.noclear - jmp DrawScreen - -.drawss -%ifdef __MSDOS__ - cmp byte[cbitmode],1 - je .noss8b - call superscopepal -.noss8b -%endif - xor eax,eax - mov al,[mouseyloc] - mov ebx,288 - mul ebx - mov esi,[vidbuffer] - mov edi,SScopeCursor - xor ebx,ebx - mov bl,[mousexloc] - add ebx,6 - cmp byte[cbitmode],1 - je near .ss16b - mov cl,20 -.ssloop - mov ch,20 -.ssloop2 - cmp byte[edi],0 - je .nodraw - mov edx,eax - add edx,ebx - sub edx,288*10 - jb .nodraw - mov byte[esi+edx],128+16 -.nodraw - inc ebx - inc edi - dec ch - jnz .ssloop2 - sub ebx,20 - add eax,288 - dec cl - jnz .ssloop - jmp .returnfromdraw - -.ss16b - push ebx - mov cl,[vesa2_rpos] - mov bx,31 - shl bx,cl - mov [.SSRedCo],bx - pop ebx - shl eax,1 - shl ebx,1 - mov cl,20 -.ssloopb - mov ch,20 -.ssloopb2 - cmp byte[edi],0 - je .nodrawb - mov edx,eax - add edx,ebx - sub edx,288*10*2 - jb .nodrawb - push eax - mov ax,[.SSRedCo] - mov [esi+edx],ax - pop eax -.nodrawb - add ebx,2 - inc edi - dec ch - jnz .ssloopb2 - sub ebx,40 - add eax,288*2 - dec cl - jnz .ssloopb - jmp .returnfromdraw - -SECTION .bss -.SSRedCo resw 1 - -SECTION .data -NEWSYM MsgCount, dd 120 ; How long message will stay (PAL = 100) - -SECTION .bss -NEWSYM lastfps, resb 1 ; stores the last fps encountered -NEWSYM lastfps2, resb 1 ; stores the last fps encountered -NEWSYM curfps2, resb 1 ; current video refresh fps -NEWSYM Msgptr, resd 1 ; Pointer to message -NEWSYM MessageOn, resd 1 ; Message On Countdown -NEWSYM FPSOn, resb 1 - -SECTION .data -prevresolutn dd 224 - -NEWSYM SScopeCursor -db 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 -db 0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0 -db 0,0,0,0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0 -db 0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0 -db 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0 -db 0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0 -db 0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0 -db 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0 -db 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0 -db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 -db 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0 -db 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0 -db 0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0 -db 0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0 -db 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0 -db 0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0 -db 0,0,0,0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0 -db 0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0 -db 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 -db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/tools/zsnes/src/video/procvidc.c b/tools/zsnes/src/video/procvidc.c deleted file mode 100644 index de491f2..0000000 --- a/tools/zsnes/src/video/procvidc.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#else -#include -#include -#include -#include -#include -#ifdef __WIN32__ -#include -#else -#include -#endif -#endif -#include "../zpath.h" -#include "../zmovie.h" -#ifndef __MSDOS__ -#include "ntsc.h" -#endif - -extern unsigned char newengen; -extern unsigned int nggposng[]; -extern unsigned short PrevPicture[64*56], *vidbuffer, *vidbufferofsb; - -void CapturePicture() -{ - unsigned short work1, work2, filter; - unsigned int i, j, offset, pppos=0; - - if (newengen && ((*nggposng & 0xFF) == 5)) - { - filter = 0x7BDE; // 0111 1011 1101 1110 - } - else - { - filter = 0xF7DE; // 1111 0111 1101 1110 - } - - for (j=0 ; j<56 ; j++) - { - offset = 288+16+j*288*4; - - for (i=0 ; i<64 ; i++) - { - work1 = ((vidbuffer[offset] & filter)>>1) + ((vidbuffer[offset+2] & filter)>>1); - work2 = ((vidbuffer[offset+288] & filter)>>1) + ((vidbuffer[offset+288+2] & filter)>>1); - PrevPicture[pppos] = ((work1 & filter)>>1) + ((work2 & filter)>>1); - offset += 4; - pppos++; - } - } - - if (newengen && ((*nggposng & 0xFF) == 5)) - { - for (pppos=0 ; pppos<64*56 ; pppos++) - { - PrevPicture[pppos] = ((PrevPicture[pppos] & 0x7FE0)<<1)|(PrevPicture[pppos] & 0x001F); - } // 0111 1111 1110 0000 and 0000 0000 0001 1111 - } -} - -extern unsigned int cur_zst_size, old_zst_size; - -char *zst_name(); - -void LoadPicture() -{ - const unsigned int pic_size = 64*56*2; - FILE *fp; - - memset(PrevPicture, 0, pic_size); - - if ((MovieProcessing == MOVIE_PLAYBACK) || (MovieProcessing == MOVIE_RECORD)) { mzt_chdir_up(); } - if ((fp = fopen_dir(ZSramPath, zst_name(), "rb"))) - { - unsigned int file_size; - - fseek(fp, 0, SEEK_END); - file_size = ftell(fp); - - if ((file_size-pic_size == cur_zst_size) || (file_size-pic_size == old_zst_size)) - { - fseek(fp, -((signed)pic_size), SEEK_END); - fread(PrevPicture, 1, pic_size, fp); - } - - fclose(fp); - } - if ((MovieProcessing == MOVIE_PLAYBACK) || (MovieProcessing == MOVIE_RECORD)) { mzt_chdir_down(); } -} - -void Clear2xSaIBuffer() -{ - memset(vidbufferofsb, 0xFF, 576*256); -} diff --git a/tools/zsnes/src/video/snes_ntsc/snes_ntsc.c b/tools/zsnes/src/video/snes_ntsc/snes_ntsc.c deleted file mode 100644 index b05e27a..0000000 --- a/tools/zsnes/src/video/snes_ntsc/snes_ntsc.c +++ /dev/null @@ -1,235 +0,0 @@ -/* snes_ntsc 0.2.2. http://www.slack.net/~ant/ */ - -#include "snes_ntsc.h" - -/* Copyright (C) 2006 Shay Green. This module is free software; you -can redistribute it and/or modify it under the terms of the GNU Lesser -General Public License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. This -module 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 Lesser General Public License for more -details. You should have received a copy of the GNU Lesser General Public -License along with this module; if not, write to the Free Software Foundation, -Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - -snes_ntsc_setup_t const snes_ntsc_monochrome = { 0,-1, 0, 0,.2, 0,.2,-.2,-.2,-1, 1, 0 }; -snes_ntsc_setup_t const snes_ntsc_composite = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }; -snes_ntsc_setup_t const snes_ntsc_svideo = { 0, 0, 0, 0,.2, 0,.2, -1, -1, 0, 1, 0 }; -snes_ntsc_setup_t const snes_ntsc_rgb = { 0, 0, 0, 0,.2, 0,.7, -1, -1,-1, 1, 0 }; - - -#define alignment_count 3 -#define burst_count 3 -#define rescale_in 8 -#define rescale_out 7 - -#define artifacts_mid 1.0f -#define fringing_mid 1.0f -#define std_decoder_hue 0 - -#define rgb_bits 7 /* half normal range to allow for doubled hires pixels */ -#define gamma_size 32 - -#include "snes_ntsc_impl.h" - -/* 3 input pixels -> 8 composite samples */ -pixel_info_t const snes_ntsc_pixels [alignment_count] = { - { PIXEL_OFFSET( -4, -9 ), { 1, 1, .6667f, 0 } }, - { PIXEL_OFFSET( -2, -7 ), { .3333f, 1, 1, .3333f } }, - { PIXEL_OFFSET( 0, -5 ), { 0, .6667f, 1, 1 } }, -}; - -static void merge_kernel_fields( snes_ntsc_rgb_t* io ) -{ - int n; - for ( n = burst_size; n; --n ) - { - snes_ntsc_rgb_t p0 = io [burst_size * 0] + rgb_bias; - snes_ntsc_rgb_t p1 = io [burst_size * 1] + rgb_bias; - snes_ntsc_rgb_t p2 = io [burst_size * 2] + rgb_bias; - /* merge colors without losing precision */ - io [burst_size * 0] = - ((p0 + p1 - ((p0 ^ p1) & snes_ntsc_rgb_builder)) >> 1) - rgb_bias; - io [burst_size * 1] = - ((p1 + p2 - ((p1 ^ p2) & snes_ntsc_rgb_builder)) >> 1) - rgb_bias; - io [burst_size * 2] = - ((p2 + p0 - ((p2 ^ p0) & snes_ntsc_rgb_builder)) >> 1) - rgb_bias; - ++io; - } -} - -static void correct_errors( snes_ntsc_rgb_t color, snes_ntsc_rgb_t* out ) -{ - int n; - for ( n = burst_count; n; --n ) - { - unsigned i; - for ( i = 0; i < rgb_kernel_size / 2; i++ ) - { - snes_ntsc_rgb_t error = color - - out [i ] - out [(i+12)%14+14] - out [(i+10)%14+28] - - out [i + 7] - out [i + 5 +14] - out [i + 3 +28]; - DISTRIBUTE_ERROR( i+3+28, i+5+14, i+7 ); - } - out += alignment_count * rgb_kernel_size; - } -} - -void snes_ntsc_init( snes_ntsc_t* ntsc, snes_ntsc_setup_t const* setup ) -{ - int merge_fields; - int entry; - init_t impl; - if ( !setup ) - setup = &snes_ntsc_composite; - init( &impl, setup ); - - merge_fields = setup->merge_fields; - if ( setup->artifacts <= -1 && setup->fringing <= -1 ) - merge_fields = 1; - - for ( entry = 0; entry < snes_ntsc_color_count; entry++ ) - { - /* Reduce number of significant bits of source color. Clearing the - low bits of R and B were least notictable. Modifying green was too - noticeable. */ - float rr = impl.to_float [entry >> 8 & 0x1E]; - float gg = impl.to_float [entry >> 4 & 0x1F]; - float bb = impl.to_float [entry << 1 & 0x1E]; - - float y, i, q = RGB_TO_YIQ( rr, gg, bb, y, i ); - - int r, g, b = YIQ_TO_RGB( y, i, q, impl.to_rgb, int, r, g ); - snes_ntsc_rgb_t rgb = PACK_RGB( r, g, b ); - - snes_ntsc_rgb_t* out = ntsc->table [entry]; - gen_kernel( &impl, y, i, q, out ); - if ( merge_fields ) - merge_kernel_fields( out ); - correct_errors( rgb, out ); - } -} - -#ifndef SNES_NTSC_NO_BLITTERS - -void snes_ntsc_blit( snes_ntsc_t const* ntsc, SNES_NTSC_IN_T const* input, long in_row_width, - int burst_phase, int in_width, int in_height, void* rgb_out, long out_pitch ) -{ - int chunk_count = (in_width - 1) / snes_ntsc_in_chunk; - for ( ; in_height; --in_height ) - { - SNES_NTSC_IN_T const* line_in = input; - SNES_NTSC_BEGIN_ROW( ntsc, burst_phase, - snes_ntsc_black, snes_ntsc_black, SNES_NTSC_ADJ_IN( *line_in ) ); - snes_ntsc_out_t* restrict line_out = (snes_ntsc_out_t*) rgb_out; - int n; - ++line_in; - - for ( n = chunk_count; n; --n ) - { - /* order of input and output pixels must not be altered */ - SNES_NTSC_COLOR_IN( 0, SNES_NTSC_ADJ_IN( line_in [0] ) ); - SNES_NTSC_RGB_OUT( 0, line_out [0], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_RGB_OUT( 1, line_out [1], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 1, SNES_NTSC_ADJ_IN( line_in [1] ) ); - SNES_NTSC_RGB_OUT( 2, line_out [2], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_RGB_OUT( 3, line_out [3], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 2, SNES_NTSC_ADJ_IN( line_in [2] ) ); - SNES_NTSC_RGB_OUT( 4, line_out [4], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_RGB_OUT( 5, line_out [5], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_RGB_OUT( 6, line_out [6], SNES_NTSC_OUT_DEPTH ); - - line_in += 3; - line_out += 7; - } - - /* finish final pixels */ - SNES_NTSC_COLOR_IN( 0, snes_ntsc_black ); - SNES_NTSC_RGB_OUT( 0, line_out [0], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_RGB_OUT( 1, line_out [1], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 1, snes_ntsc_black ); - SNES_NTSC_RGB_OUT( 2, line_out [2], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_RGB_OUT( 3, line_out [3], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 2, snes_ntsc_black ); - SNES_NTSC_RGB_OUT( 4, line_out [4], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_RGB_OUT( 5, line_out [5], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_RGB_OUT( 6, line_out [6], SNES_NTSC_OUT_DEPTH ); - - burst_phase = (burst_phase + 1) % snes_ntsc_burst_count; - input += in_row_width; - rgb_out = (char*) rgb_out + out_pitch; - } -} - -void snes_ntsc_blit_hires( snes_ntsc_t const* ntsc, SNES_NTSC_IN_T const* input, long in_row_width, - int burst_phase, int in_width, int in_height, void* rgb_out, long out_pitch ) -{ - int chunk_count = (in_width - 2) / (snes_ntsc_in_chunk * 2); - for ( ; in_height; --in_height ) - { - SNES_NTSC_IN_T const* line_in = input; - SNES_NTSC_HIRES_ROW( ntsc, burst_phase, - snes_ntsc_black, snes_ntsc_black, snes_ntsc_black, - SNES_NTSC_ADJ_IN( line_in [0] ), - SNES_NTSC_ADJ_IN( line_in [1] ) ); - snes_ntsc_out_t* restrict line_out = (snes_ntsc_out_t*) rgb_out; - int n; - line_in += 2; - - for ( n = chunk_count; n; --n ) - { - /* twice as many input pixels per chunk */ - SNES_NTSC_COLOR_IN( 0, SNES_NTSC_ADJ_IN( line_in [0] ) ); - SNES_NTSC_HIRES_OUT( 0, line_out [0], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 1, SNES_NTSC_ADJ_IN( line_in [1] ) ); - SNES_NTSC_HIRES_OUT( 1, line_out [1], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 2, SNES_NTSC_ADJ_IN( line_in [2] ) ); - SNES_NTSC_HIRES_OUT( 2, line_out [2], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 3, SNES_NTSC_ADJ_IN( line_in [3] ) ); - SNES_NTSC_HIRES_OUT( 3, line_out [3], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 4, SNES_NTSC_ADJ_IN( line_in [4] ) ); - SNES_NTSC_HIRES_OUT( 4, line_out [4], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 5, SNES_NTSC_ADJ_IN( line_in [5] ) ); - SNES_NTSC_HIRES_OUT( 5, line_out [5], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_HIRES_OUT( 6, line_out [6], SNES_NTSC_OUT_DEPTH ); - - line_in += 6; - line_out += 7; - } - - SNES_NTSC_COLOR_IN( 0, snes_ntsc_black ); - SNES_NTSC_HIRES_OUT( 0, line_out [0], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 1, snes_ntsc_black ); - SNES_NTSC_HIRES_OUT( 1, line_out [1], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 2, snes_ntsc_black ); - SNES_NTSC_HIRES_OUT( 2, line_out [2], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 3, snes_ntsc_black ); - SNES_NTSC_HIRES_OUT( 3, line_out [3], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 4, snes_ntsc_black ); - SNES_NTSC_HIRES_OUT( 4, line_out [4], SNES_NTSC_OUT_DEPTH ); - - SNES_NTSC_COLOR_IN( 5, snes_ntsc_black ); - SNES_NTSC_HIRES_OUT( 5, line_out [5], SNES_NTSC_OUT_DEPTH ); - SNES_NTSC_HIRES_OUT( 6, line_out [6], SNES_NTSC_OUT_DEPTH ); - - burst_phase = (burst_phase + 1) % snes_ntsc_burst_count; - input += in_row_width; - rgb_out = (char*) rgb_out + out_pitch; - } -} - -#endif diff --git a/tools/zsnes/src/video/snes_ntsc/snes_ntsc.h b/tools/zsnes/src/video/snes_ntsc/snes_ntsc.h deleted file mode 100644 index b0a780a..0000000 --- a/tools/zsnes/src/video/snes_ntsc/snes_ntsc.h +++ /dev/null @@ -1,205 +0,0 @@ -/* SNES NTSC video filter */ - -/* snes_ntsc 0.2.2 */ -#ifndef SNES_NTSC_H -#define SNES_NTSC_H - -#include "snes_ntsc_config.h" - -#ifdef __cplusplus - extern "C" { -#endif - -/* Image parameters, ranging from -1.0 to 1.0. Actual internal values shown -in parenthesis and should remain fairly stable in future versions. */ -typedef struct snes_ntsc_setup_t -{ - /* Basic parameters */ - double hue; /* -1 = -180 degrees +1 = +180 degrees */ - double saturation; /* -1 = grayscale (0.0) +1 = oversaturated colors (2.0) */ - double contrast; /* -1 = dark (0.5) +1 = light (1.5) */ - double brightness; /* -1 = dark (0.5) +1 = light (1.5) */ - double sharpness; /* edge contrast enhancement/blurring */ - - /* Advanced parameters */ - double gamma; /* -1 = dark (1.5) +1 = light (0.5) */ - double resolution; /* image resolution */ - double artifacts; /* artifacts caused by color changes */ - double fringing; /* color artifacts caused by brightness changes */ - double bleed; /* color bleed (color resolution reduction) */ - int merge_fields; /* if 1, merges even and odd fields together to reduce flicker */ - float const* decoder_matrix; /* optional RGB decoder matrix, 6 elements */ -} snes_ntsc_setup_t; - -/* Video format presets */ -extern snes_ntsc_setup_t const snes_ntsc_composite; /* color bleeding + artifacts */ -extern snes_ntsc_setup_t const snes_ntsc_svideo; /* color bleeding only */ -extern snes_ntsc_setup_t const snes_ntsc_rgb; /* crisp image */ -extern snes_ntsc_setup_t const snes_ntsc_monochrome;/* desaturated + artifacts */ - -/* Initialize and adjust parameters. Can be called multiple times on the same -snes_ntsc_t object. Can pass 0 for second parameter to use default setup. */ -typedef struct snes_ntsc_t snes_ntsc_t; -void snes_ntsc_init( snes_ntsc_t*, snes_ntsc_setup_t const* setup ); - -/* Filter one or more rows of pixels. Input pixel format is set by SNES_NTSC_IN_FORMAT -and output RGB depth is set by NES_NTSC_OUT_DEPTH. Both default to 16-bit RGB. -In_row_width is the number of pixels to get to the next input row. Out_pitch -is the number of *bytes* to get to the next output row. */ -void snes_ntsc_blit( snes_ntsc_t const*, SNES_NTSC_IN_T const* input, - long in_row_width, int burst_phase, int in_width, int in_height, - void* rgb_out, long out_pitch ); - -void snes_ntsc_blit_hires( snes_ntsc_t const*, SNES_NTSC_IN_T const* input, - long in_row_width, int burst_phase, int in_width, int in_height, - void* rgb_out, long out_pitch ); - -/* Number of output pixels written by low-res blitter for given input width. Width -might be rounded down slightly; use SNES_NTSC_IN_WIDTH() on result to find rounded -value. Guaranteed not to round 256 down at all. */ -#define SNES_NTSC_OUT_WIDTH( in_width ) \ - (((in_width) - 1) / snes_ntsc_in_chunk * snes_ntsc_out_chunk + snes_ntsc_out_chunk) - -/* Number of low-res input pixels that will fit within given output width. Might be -rounded down slightly; use SNES_NTSC_OUT_WIDTH() on result to find rounded -value. */ -#define SNES_NTSC_IN_WIDTH( out_width ) \ - ((out_width) / snes_ntsc_out_chunk * snes_ntsc_in_chunk - snes_ntsc_in_chunk + 1) - - -/* Interface for user-defined custom blitters */ - -enum { snes_ntsc_in_chunk = 3 }; /* number of snes pixels read per chunk */ -enum { snes_ntsc_out_chunk = 7 }; /* number of output pixels generated per chunk */ -enum { snes_ntsc_black = 0 }; /* palette index for black */ -enum { snes_ntsc_burst_count = 3 }; /* burst phase cycles through 0, 1, and 2 */ - -/* Begin outputting row and start three pixels. First pixel will be cut off a bit. -Use snes_ntsc_black for unused pixels. Declares variables, so must be before first -statement in a block (unless you're using C++). */ -#define SNES_NTSC_BEGIN_ROW( ntsc, burst, pixel0, pixel1, pixel2 ) \ - char const* ktable = \ - (char const*) (ntsc)->table + burst * (snes_ntsc_burst_size * sizeof (snes_ntsc_rgb_t));\ - SNES_NTSC_BEGIN_ROW_6_( pixel0, pixel1, pixel2, SNES_NTSC_IN_FORMAT, ktable ) - -/* Begin input pixel */ -#define SNES_NTSC_COLOR_IN( index, color ) \ - SNES_NTSC_COLOR_IN_( index, color, SNES_NTSC_IN_FORMAT, ktable ) - -/* Generate output pixel. Bits can be 24, 16, 15, 32 (treated as 24), or 0: -24: RRRRRRRR GGGGGGGG BBBBBBBB -16: RRRRRGGG GGGBBBBB -15: RRRRRGG GGGBBBBB -14: BBBBBGG GGGRRRRR (BGR15) - 0: xxxRRRRR RRRxxGGG GGGGGxxB BBBBBBBx (native internal format; x = junk bits) */ -#define SNES_NTSC_RGB_OUT( index, rgb_out, bits ) \ - SNES_NTSC_RGB_OUT_14_( index, rgb_out, bits, 1 ) - -/* Hires equivalents */ -#define SNES_NTSC_HIRES_ROW( ntsc, burst, pixel1, pixel2, pixel3, pixel4, pixel5 ) \ - char const* ktable = \ - (char const*) (ntsc)->table + burst * (snes_ntsc_burst_size * sizeof (snes_ntsc_rgb_t));\ - int const snes_pixel1_ = (pixel1);\ - snes_ntsc_rgb_t const* kernel1 = SNES_NTSC_IN_FORMAT( ktable, snes_pixel1_ );\ - int const snes_pixel2_ = (pixel2);\ - snes_ntsc_rgb_t const* kernel2 = SNES_NTSC_IN_FORMAT( ktable, snes_pixel2_ );\ - int const snes_pixel3_ = (pixel3);\ - snes_ntsc_rgb_t const* kernel3 = SNES_NTSC_IN_FORMAT( ktable, snes_pixel3_ );\ - int const snes_pixel4_ = (pixel4);\ - snes_ntsc_rgb_t const* kernel4 = SNES_NTSC_IN_FORMAT( ktable, snes_pixel4_ );\ - int const snes_pixel5_ = (pixel5);\ - snes_ntsc_rgb_t const* kernel5 = SNES_NTSC_IN_FORMAT( ktable, snes_pixel5_ );\ - snes_ntsc_rgb_t const* kernel0 = kernel1;\ - snes_ntsc_rgb_t const* kernelx0;\ - snes_ntsc_rgb_t const* kernelx1 = kernel1;\ - snes_ntsc_rgb_t const* kernelx2 = kernel1;\ - snes_ntsc_rgb_t const* kernelx3 = kernel1;\ - snes_ntsc_rgb_t const* kernelx4 = kernel1;\ - snes_ntsc_rgb_t const* kernelx5 = kernel1 - -#define SNES_NTSC_HIRES_OUT( x, rgb_out, bits ) {\ - snes_ntsc_rgb_t raw_ =\ - kernel0 [ x ] + kernel2 [(x+5)%7+14] + kernel4 [(x+3)%7+28] +\ - kernelx0 [(x+7)%7+7] + kernelx2 [(x+5)%7+21] + kernelx4 [(x+3)%7+35] +\ - kernel1 [(x+6)%7 ] + kernel3 [(x+4)%7+14] + kernel5 [(x+2)%7+28] +\ - kernelx1 [(x+6)%7+7] + kernelx3 [(x+4)%7+21] + kernelx5 [(x+2)%7+35];\ - SNES_NTSC_CLAMP_( raw_, 0 );\ - SNES_NTSC_RGB_OUT_( rgb_out, (bits), 0 );\ -} - - -/* private */ -enum { snes_ntsc_entry_size = 128 }; -enum { snes_ntsc_color_count = 0x2000 }; -typedef unsigned long snes_ntsc_rgb_t; -struct snes_ntsc_t -{ - snes_ntsc_rgb_t table [snes_ntsc_color_count] [snes_ntsc_entry_size]; -}; -enum { snes_ntsc_burst_size = snes_ntsc_entry_size / snes_ntsc_burst_count }; - -#define SNES_NTSC_RGB16( ktable, n ) \ - (snes_ntsc_rgb_t const*) (ktable + ((n & 0x001E) | (n >> 1 & 0x03E0) | (n >> 2 & 0x3C00)) * \ - (snes_ntsc_entry_size / 2 * sizeof (snes_ntsc_rgb_t))) - -#define SNES_NTSC_BGR15( ktable, n ) \ - (snes_ntsc_rgb_t const*) (ktable + ((n << 9 & 0x3C00) | (n & 0x03E0) | (n >> 10 & 0x001E)) * \ - (snes_ntsc_entry_size / 2 * sizeof (snes_ntsc_rgb_t))) - -/* common 3->7 ntsc macros */ -#define SNES_NTSC_BEGIN_ROW_6_( pixel0, pixel1, pixel2, ENTRY, table ) \ - unsigned const snes_ntsc_pixel0_ = (pixel0);\ - snes_ntsc_rgb_t const* kernel0 = ENTRY( table, snes_ntsc_pixel0_ );\ - unsigned const snes_ntsc_pixel1_ = (pixel1);\ - snes_ntsc_rgb_t const* kernel1 = ENTRY( table, snes_ntsc_pixel1_ );\ - unsigned const snes_ntsc_pixel2_ = (pixel2);\ - snes_ntsc_rgb_t const* kernel2 = ENTRY( table, snes_ntsc_pixel2_ );\ - snes_ntsc_rgb_t const* kernelx0;\ - snes_ntsc_rgb_t const* kernelx1 = kernel0;\ - snes_ntsc_rgb_t const* kernelx2 = kernel0 - -#define SNES_NTSC_RGB_OUT_14_( x, rgb_out, bits, shift ) {\ - snes_ntsc_rgb_t raw_ =\ - kernel0 [x ] + kernel1 [(x+12)%7+14] + kernel2 [(x+10)%7+28] +\ - kernelx0 [(x+7)%14] + kernelx1 [(x+ 5)%7+21] + kernelx2 [(x+ 3)%7+35];\ - SNES_NTSC_CLAMP_( raw_, shift );\ - SNES_NTSC_RGB_OUT_( rgb_out, bits, shift );\ -} - -/* common ntsc macros */ -#define snes_ntsc_rgb_builder ((1L << 21) | (1 << 11) | (1 << 1)) -#define snes_ntsc_clamp_mask (snes_ntsc_rgb_builder * 3 / 2) -#define snes_ntsc_clamp_add (snes_ntsc_rgb_builder * 0x101) -#define SNES_NTSC_CLAMP_( io, shift ) {\ - snes_ntsc_rgb_t sub = (io) >> (9-(shift)) & snes_ntsc_clamp_mask;\ - snes_ntsc_rgb_t clamp = snes_ntsc_clamp_add - sub;\ - io |= clamp;\ - clamp -= sub;\ - io &= clamp;\ -} - -#define SNES_NTSC_COLOR_IN_( index, color, ENTRY, table ) {\ - unsigned color_;\ - kernelx##index = kernel##index;\ - kernel##index = (color_ = (color), ENTRY( table, color_ ));\ -} - -/* x is always zero except in snes_ntsc library */ -#define SNES_NTSC_RGB_OUT_( rgb_out, bits, x ) {\ - if ( bits == 16 )\ - rgb_out = (raw_>>(13-x)& 0xF800)|(raw_>>(8-x)&0x07E0)|(raw_>>(4-x)&0x001F);\ - if ( bits == 24 || bits == 32 )\ - rgb_out = (raw_>>(5-x)&0xFF0000)|(raw_>>(3-x)&0xFF00)|(raw_>>(1-x)&0xFF);\ - if ( bits == 15 )\ - rgb_out = (raw_>>(14-x)& 0x7C00)|(raw_>>(9-x)&0x03E0)|(raw_>>(4-x)&0x001F);\ - if ( bits == 14 )\ - rgb_out = (raw_>>(24-x)& 0x001F)|(raw_>>(9-x)&0x03E0)|(raw_<<(6+x)&0x7C00);\ - if ( bits == 0 )\ - rgb_out = raw_ << x;\ -} - -#ifdef __cplusplus - } -#endif - -#endif diff --git a/tools/zsnes/src/video/snes_ntsc/snes_ntsc.txt b/tools/zsnes/src/video/snes_ntsc/snes_ntsc.txt deleted file mode 100644 index 288dff5..0000000 --- a/tools/zsnes/src/video/snes_ntsc/snes_ntsc.txt +++ /dev/null @@ -1,128 +0,0 @@ -snes_ntsc 0.2.2: SNES NTSC Video Filter ---------------------------------------- -Author : Shay Green -Website : http://www.slack.net/~ant/ -Forum : http://groups.google.com/group/blargg-sound-libs -License : GNU Lesser General Public License (LGPL) -Language: C or C++ - - -Overview --------- -To perform NTSC filtering, first allocate memory for a snes_ntsc_t object -and call snes_ntsc_init(), then call snes_ntsc_blit() to perform -filtering. By default, snes_ntsc_blit() reads and writes pixels in 16-bit -RGB. You can call snes_ntsc_init() at any time to change image parameters. - - -Image Parameters ----------------- -Many image parameters can be adjusted and presets are provided for -composite video, S-video, RGB, and monochrome. Most are floating-point -values with a general range of -1.0 to 1.0, where 0 is normal. The ranges -are adjusted so that one parameter at an extreme (-1 or +1) and the rest -at zero shouldn't result in any internal overflow (garbage pixels). -Setting multiple parameters to their extreme can produce garbage. Put -another way, the state space defined by all parameters within the range -1 -to +1 is not fully usable, but some extreme corners are very useful so I -don't want to reduce the parameter ranges. - -The sharpness and resolution parameters have similar effects. Resolution -affects how crisp pixels are. Sharpness merely enhances the edges by -increasing contrast, which makes things brighter at the edges. Artifacts -sets how much "junk" is around the edges where colors and brightness -change in the image, where -1 completely eliminates them. Bleed affects -how much colors blend together and the artifact colors at the edges of -pixels surrounded by black. - - -Image Size ----------- -For proper aspect ratio, the image generated by the library must be -doubled vertically. - -Use the SNES_NTSC_OUT_WIDTH() and SNES_NTSC_IN_WIDTH() macros to convert -between input and output widths that the blitter uses. For example, if you -are blitting an image 256 pixels wide, use SNES_NTSC_OUT_WIDTH( 256 ) to -find out how many output pixels are written per row. Another example, use -SNES_NTSC_IN_WIDTH( 640 ) to find how many input pixels will fit within -640 output pixels. The blitter rounds the input width down in some cases, -so the requested width might not be possible. Use SNES_NTSC_IN_WIDTH( -SNES_NTSC_OUT_WIDTH( in_width ) ) to find what a given in_width would be -rounded down to. - - -Burst Phase ------------ -The burst_phase parameter to snes_ntsc_blit() should generally toggle -values between frames, i.e. 0 on first call to snes_ntsc_blit(), 1 on -second call, 0 on third call, 1 on fourth, etc. If merge_fields is enabled -(see below), you should always pass 0. - -If you're using snes_ntsc_blit() to do partial screen updates, burst_phase -should be calculated as (burst_phase + row) % 3, where row is the starting -row (0 through 239). For example, if burst_phase is 1 for the current -frame and you make two calls to snes_ntsc_blit() to blit rows 0 to 100, -then rows 101 to 239, for the first call you should pass 1 for -burst_phase, and for the second call you should pass 0 for burst_phase: (1 -+ 101) % 3 = 0. - - -Flickering ----------- -The displayed image toggles between two different pixel artifact patterns -at a steady rate, making it appear stable. For an emulator to duplicate -this effect, its frame rate must match the host monitor's refresh rate, it -must be synchronizing to the refresh (vsync), and it must not be skipping -any frames. If any of these don't hold, the image will probably flicker -much more than it would on a TV. It is important that you play around with -these factors to get a good feel for the issue, and document it clearly -for end-users, otherwise they will have difficulty getting an authentic -image. - -The library includes a partial workaround for this issue, for the cases -where all the conditions can't be met. When merge_fields is set to 1, -snes_ntsc_blit() does the equivalent of blitting the image twice with the -two different phases and then mixes them together, but without any -performance impact. The result is similar to what you'd see if the -monitor's refresh rate were the same as the emulator's. It does reduce the -shimmer effect when scrolling, so it's not a complete solution to the -refresh rate issue. - -The merge_fields option is also useful when taking a screenshot. If you -capture without merge_fields set to 1, you'll only get the even or odd -artifacts, which will make the image look more grainy than when the -emulator is running. Again, play around with this to get an idea of the -difference. It might be best to simply allow the user to choose when to -enable this option. - -Note that when you have merge_fields set to 1, you should always pass 0 -for the burst_phase parameter to snes_ntsc_blit(). If you don't, you'll -still get some flicker. - - -Custom Blitter --------------- -You can write your own blitter, allowing customization of how SNES pixels -are obtained, the format of output pixels (15, 16, or 32-bit RGB), -optimizations for your platform, and additional effects like efficient -scanline doubling during blitting. - -Macros are included in snes_ntsc.h for writing your blitter so that your code -can be carried over without changes to improved versions of the library. -The default blitters at the end of snes_ntsc.c show how to use the macros. -Contact me for further assistance. - - -Limitations ------------ -The library's horizontal rescaling is too wide by about 3% in order to -allow a much more optimal implementation. This means that a 256 pixel wide -console image should appear as 581 output pixels, but with this library -appears as 602 output pixels. TV aspect ratios probably vary by this much -anyway. If you really need unscaled output, contact me and I'll see about -adding it. - -Input pixels are converted to 13-bit RGB (4 bits red, 5 bits green, 4 bits -blue) to reduce memory usage from 16MB to 4MB. Contact me if you'd like -this reduction made optional. diff --git a/tools/zsnes/src/video/snes_ntsc/snes_ntsc_config.h b/tools/zsnes/src/video/snes_ntsc/snes_ntsc_config.h deleted file mode 100644 index df65d82..0000000 --- a/tools/zsnes/src/video/snes_ntsc/snes_ntsc_config.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Configure library by modifying this file */ - -#ifndef SNES_NTSC_CONFIG_H -#define SNES_NTSC_CONFIG_H - -/* Format of source pixels */ -#define SNES_NTSC_IN_FORMAT SNES_NTSC_RGB16 -/* #define SNES_NTSC_IN_FORMAT SNES_NTSC_BGR15 */ - -/* The following affect the built-in blitter only; a custom blitter can -handle things however it wants. */ - -/* Bits per pixel of output. Can be 15, 16, 32, or 24 (same as 32). */ -#define SNES_NTSC_OUT_DEPTH 16 - -/* Type of input pixel values */ -#define SNES_NTSC_IN_T unsigned short - -/* Each raw pixel input value is passed through this. You might want to mask -the pixel index if you use the high bits as flags, etc. */ -#define SNES_NTSC_ADJ_IN( in ) in - -/* For each pixel, this is the basic operation: -output_color = SNES_NTSC_ADJ_IN( SNES_NTSC_IN_T ) */ - -/* Disable standard blitters */ -#define SNES_NTSC_NO_BLITTERS 1 - -#endif diff --git a/tools/zsnes/src/video/snes_ntsc/snes_ntsc_impl.h b/tools/zsnes/src/video/snes_ntsc/snes_ntsc_impl.h deleted file mode 100644 index 6035f6f..0000000 --- a/tools/zsnes/src/video/snes_ntsc/snes_ntsc_impl.h +++ /dev/null @@ -1,433 +0,0 @@ -/* Common implementation of NTSC filters */ - -#include -#include - -/* Copyright (C) 2006 Shay Green. This module is free software; you -can redistribute it and/or modify it under the terms of the GNU Lesser -General Public License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. This -module 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 Lesser General Public License for more -details. You should have received a copy of the GNU Lesser General Public -License along with this module; if not, write to the Free Software Foundation, -Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - -#define DISABLE_CORRECTION 0 - -#undef PI -#define PI 3.14159265358979323846f - -#ifndef LUMA_CUTOFF - #define LUMA_CUTOFF 0.20 -#endif -#ifndef gamma_size - #define gamma_size 1 -#endif -#ifndef rgb_bits - #define rgb_bits 8 -#endif -#ifndef artifacts_max - #define artifacts_max (artifacts_mid * 1.5f) -#endif -#ifndef fringing_max - #define fringing_max (fringing_mid * 2) -#endif - -#define ext_decoder_hue (std_decoder_hue + 15) -#define rgb_unit (1 << rgb_bits) -#define rgb_offset (rgb_unit * 2 + 0.5f) - -enum { burst_size = snes_ntsc_entry_size / burst_count }; -enum { kernel_half = 16 }; -enum { kernel_size = kernel_half * 2 + 1 }; - -typedef struct init_t -{ - float to_rgb [burst_count * 6]; - float to_float [gamma_size]; - float contrast; - float brightness; - float artifacts; - float fringing; - float kernel [rescale_out * kernel_size * 2]; -} init_t; - -#define ROTATE_IQ( i, q, sin_b, cos_b ) {\ - float t;\ - t = i * cos_b - q * sin_b;\ - q = i * sin_b + q * cos_b;\ - i = t;\ -} - -static void init_filters( init_t* impl, snes_ntsc_setup_t const* setup ) -{ -#if rescale_out > 1 - float kernels [kernel_size * 2]; -#else - float* const kernels = impl->kernel; -#endif - - /* generate luma (y) filter using sinc kernel */ - { - /* sinc with rolloff (dsf) */ - float const rolloff = 1 + (float) setup->sharpness * (float) 0.032; - float const maxh = 32; - float const pow_a_n = (float) pow( rolloff, maxh ); - float sum; - int i; - /* quadratic mapping to reduce negative (blurring) range */ - float to_angle = (float) setup->resolution + 1; - to_angle = PI / maxh * (float) LUMA_CUTOFF * (to_angle * to_angle + 1); - - kernels [kernel_size * 3 / 2] = maxh; /* default center value */ - for ( i = 0; i < kernel_half * 2 + 1; i++ ) - { - int x = i - kernel_half; - float angle = x * to_angle; - /* instability occurs at center point with rolloff very close to 1.0 */ - if ( x || pow_a_n > (float) 1.056 || pow_a_n < (float) 0.981 ) - { - float rolloff_cos_a = rolloff * (float) cos( angle ); - float num = 1 - rolloff_cos_a - - pow_a_n * (float) cos( maxh * angle ) + - pow_a_n * rolloff * (float) cos( (maxh - 1) * angle ); - float den = 1 - rolloff_cos_a - rolloff_cos_a + rolloff * rolloff; - float dsf = num / den; - kernels [kernel_size * 3 / 2 - kernel_half + i] = dsf - (float) 0.5; - } - } - - /* apply blackman window and find sum */ - sum = 0; - for ( i = 0; i < kernel_half * 2 + 1; i++ ) - { - float x = PI * 2 / (kernel_half * 2) * i; - float blackman = 0.42f - 0.5f * (float) cos( x ) + 0.08f * (float) cos( x * 2 ); - sum += (kernels [kernel_size * 3 / 2 - kernel_half + i] *= blackman); - } - - /* normalize kernel */ - sum = 1.0f / sum; - for ( i = 0; i < kernel_half * 2 + 1; i++ ) - { - int x = kernel_size * 3 / 2 - kernel_half + i; - kernels [x] *= sum; - assert( kernels [x] == kernels [x] ); /* catch numerical instability */ - } - } - - /* generate chroma (iq) filter using gaussian kernel */ - { - float const cutoff_factor = -0.03125f; - float cutoff = (float) setup->bleed; - int i; - - if ( cutoff < 0 ) - { - /* keep extreme value accessible only near upper end of scale (1.0) */ - cutoff *= cutoff; - cutoff *= cutoff; - cutoff *= cutoff; - cutoff *= -30.0f / 0.65f; - } - cutoff = cutoff_factor - 0.65f * cutoff_factor * cutoff; - - for ( i = -kernel_half; i <= kernel_half; i++ ) - kernels [kernel_size / 2 + i] = (float) exp( i * i * cutoff ); - - /* normalize even and odd phases separately */ - for ( i = 0; i < 2; i++ ) - { - float sum = 0; - int x; - for ( x = i; x < kernel_size; x += 2 ) - sum += kernels [x]; - - sum = 1.0f / sum; - for ( x = i; x < kernel_size; x += 2 ) - { - kernels [x] *= sum; - assert( kernels [x] == kernels [x] ); /* catch numerical instability */ - } - } - } - - /* - printf( "luma:\n" ); - for ( i = kernel_size; i < kernel_size * 2; i++ ) - printf( "%f\n", kernels [i] ); - printf( "chroma:\n" ); - for ( i = 0; i < kernel_size; i++ ) - printf( "%f\n", kernels [i] ); - */ - - /* generate linear rescale kernels */ - #if rescale_out > 1 - { - float weight = 1.0f; - float* out = impl->kernel; - int n = rescale_out; - do - { - float remain = 0; - int i; - weight -= 1.0f / rescale_in; - for ( i = 0; i < kernel_size * 2; i++ ) - { - float cur = kernels [i]; - float m = cur * weight; - *out++ = m + remain; - remain = cur - m; - } - } - while ( --n ); - } - #endif -} - -static float const default_decoder [6] = - { 0.956f, 0.621f, -0.272f, -0.647f, -1.105f, 1.702f }; - -static void init( init_t* impl, snes_ntsc_setup_t const* setup ) -{ - impl->brightness = (float) setup->brightness * (0.5f * rgb_unit) + rgb_offset; - impl->contrast = (float) setup->contrast * (0.5f * rgb_unit) + rgb_unit; - #ifdef default_palette_contrast - if ( !setup->palette ) - impl->contrast *= default_palette_contrast; - #endif - - impl->artifacts = (float) setup->artifacts; - if ( impl->artifacts > 0 ) - impl->artifacts *= artifacts_max - artifacts_mid; - impl->artifacts = impl->artifacts * artifacts_mid + artifacts_mid; - - impl->fringing = (float) setup->fringing; - if ( impl->fringing > 0 ) - impl->fringing *= fringing_max - fringing_mid; - impl->fringing = impl->fringing * fringing_mid + fringing_mid; - - init_filters( impl, setup ); - - /* generate gamma table */ - if ( gamma_size > 1 ) - { - float const to_float = 1.0f / (gamma_size - (gamma_size > 1)); - float const gamma = 1.1333f - (float) setup->gamma * 0.5f; - /* match common PC's 2.2 gamma to TV's 2.65 gamma */ - int i; - for ( i = 0; i < gamma_size; i++ ) - impl->to_float [i] = - (float) pow( i * to_float, gamma ) * impl->contrast + impl->brightness; - } - - /* setup decoder matricies */ - { - float hue = (float) setup->hue * PI + PI / 180 * ext_decoder_hue; - float sat = (float) setup->saturation + 1; - float const* decoder = setup->decoder_matrix; - if ( !decoder ) - { - decoder = default_decoder; - hue += PI / 180 * (std_decoder_hue - ext_decoder_hue); - } - - { - float s = (float) sin( hue ) * sat; - float c = (float) cos( hue ) * sat; - float* out = impl->to_rgb; - int n; - - n = burst_count; - do - { - float const* in = decoder; - int n = 3; - do - { - float i = *in++; - float q = *in++; - *out++ = i * c - q * s; - *out++ = i * s + q * c; - } - while ( --n ); - if ( burst_count <= 1 ) - break; - ROTATE_IQ( s, c, 0.866025f, -0.5f ); /* +120 degrees */ - } - while ( --n ); - } - } -} - -/* kernel generation */ - -#define RGB_TO_YIQ( r, g, b, y, i ) (\ - (y = (r) * 0.299f + (g) * 0.587f + (b) * 0.114f),\ - (i = (r) * 0.596f - (g) * 0.275f - (b) * 0.321f),\ - ((r) * 0.212f - (g) * 0.523f + (b) * 0.311f)\ -) - -#define YIQ_TO_RGB( y, i, q, to_rgb, type, r, g ) (\ - r = (type) (y + to_rgb [0] * i + to_rgb [1] * q),\ - g = (type) (y + to_rgb [2] * i + to_rgb [3] * q),\ - (type) (y + to_rgb [4] * i + to_rgb [5] * q)\ -) - -#define PACK_RGB( r, g, b ) ((r) << 21 | (g) << 11 | (b) << 1) - -enum { rgb_kernel_size = burst_size / alignment_count }; -enum { rgb_bias = rgb_unit * 2 * snes_ntsc_rgb_builder }; - -typedef struct pixel_info_t -{ - int offset; - float negate; - float kernel [4]; -} pixel_info_t; - -#if rescale_in > 1 - #define PIXEL_OFFSET_( ntsc, scaled ) \ - (kernel_size / 2 + ntsc + (scaled != 0) + (rescale_out - scaled) % rescale_out + \ - (kernel_size * 2 * scaled)) - - #define PIXEL_OFFSET( ntsc, scaled ) \ - PIXEL_OFFSET_( ((ntsc) - (scaled) / rescale_out * rescale_in),\ - (((scaled) + rescale_out * 10) % rescale_out) ),\ - (1.0f - (((ntsc) + 100) & 2)) -#else - #define PIXEL_OFFSET( ntsc, scaled ) \ - (kernel_size / 2 + (ntsc) - (scaled)),\ - (1.0f - (((ntsc) + 100) & 2)) -#endif - -extern pixel_info_t const snes_ntsc_pixels [alignment_count]; - -/* Generate pixel at all burst phases and column alignments */ -static void gen_kernel( init_t* impl, float y, float i, float q, snes_ntsc_rgb_t* out ) -{ - /* generate for each scanline burst phase */ - float const* to_rgb = impl->to_rgb; - int burst_remain = burst_count; - y -= rgb_offset; - do - { - /* Encode yiq into *two* composite signals (to allow control over artifacting). - Convolve these with kernels which: filter respective components, apply - sharpening, and rescale horizontally. Convert resulting yiq to rgb and pack - into integer. Based on algorithm by NewRisingSun. */ - pixel_info_t const* pixel = snes_ntsc_pixels; - int alignment_remain = alignment_count; - do - { - /* negate is -1 when composite starts at odd multiple of 2 */ - float const yy = y * impl->fringing * pixel->negate; - float const ic0 = (i + yy) * pixel->kernel [0]; - float const qc1 = (q + yy) * pixel->kernel [1]; - float const ic2 = (i - yy) * pixel->kernel [2]; - float const qc3 = (q - yy) * pixel->kernel [3]; - - float const factor = impl->artifacts * pixel->negate; - float const ii = i * factor; - float const yc0 = (y + ii) * pixel->kernel [0]; - float const yc2 = (y - ii) * pixel->kernel [2]; - - float const qq = q * factor; - float const yc1 = (y + qq) * pixel->kernel [1]; - float const yc3 = (y - qq) * pixel->kernel [3]; - - float const* k = &impl->kernel [pixel->offset]; - int n; - ++pixel; - for ( n = rgb_kernel_size; n; --n ) - { - float i = k[0]*ic0 + k[2]*ic2; - float q = k[1]*qc1 + k[3]*qc3; - float y = k[kernel_size+0]*yc0 + k[kernel_size+1]*yc1 + - k[kernel_size+2]*yc2 + k[kernel_size+3]*yc3 + rgb_offset; - if ( rescale_out <= 1 ) - k--; - else if ( k < &impl->kernel [kernel_size * 2 * (rescale_out - 1)] ) - k += kernel_size * 2 - 1; - else - k -= kernel_size * 2 * (rescale_out - 1) + 2; - { - int r, g, b = YIQ_TO_RGB( y, i, q, to_rgb, int, r, g ); - *out++ = PACK_RGB( r, g, b ) - rgb_bias; - } - } - } - while ( alignment_count > 1 && --alignment_remain ); - - if ( burst_count <= 1 ) - break; - - to_rgb += 6; - - ROTATE_IQ( i, q, -0.866025f, -0.5f ); /* -120 degrees */ - } - while ( --burst_remain ); -} - -static void correct_errors( snes_ntsc_rgb_t color, snes_ntsc_rgb_t* out ); - -#if DISABLE_CORRECTION - #define CORRECT_ERROR( a ) { out [i] += rgb_bias; } - #define DISTRIBUTE_ERROR( a, b, c ) { out [i] += rgb_bias; } -#else - #define CORRECT_ERROR( a ) { out [a] += error; } - #define DISTRIBUTE_ERROR( a, b, c ) {\ - snes_ntsc_rgb_t fourth = (error + 2 * snes_ntsc_rgb_builder) >> 2;\ - fourth &= (rgb_bias >> 1) - snes_ntsc_rgb_builder;\ - fourth -= rgb_bias >> 2;\ - out [a] += fourth;\ - out [b] += fourth;\ - out [c] += fourth;\ - out [i] += error - (fourth * 3);\ - } -#endif - -#define RGB_PALETTE_OUT( rgb, out_ )\ -{\ - unsigned char* out = (out_);\ - snes_ntsc_rgb_t clamped = (rgb);\ - SNES_NTSC_CLAMP_( clamped, (8 - rgb_bits) );\ - out [0] = (unsigned char) (clamped >> 21);\ - out [1] = (unsigned char) (clamped >> 11);\ - out [2] = (unsigned char) (clamped >> 1);\ -} - -/* blitter related */ - -#ifndef restrict - #if defined (__GNUC__) - #define restrict __restrict__ - #elif defined (_MSC_VER) && _MSC_VER > 1300 - #define restrict __restrict - #else - /* no support for restricted pointers */ - #define restrict - #endif -#endif - -#include - -#if SNES_NTSC_OUT_DEPTH <= 16 - #if USHRT_MAX == 0xFFFF - typedef unsigned short snes_ntsc_out_t; - #else - #error "Need 16-bit int type" - #endif - -#else - #if UINT_MAX == 0xFFFFFFFF - typedef unsigned int snes_ntsc_out_t; - #elif ULONG_MAX == 0xFFFFFFFF - typedef unsigned long snes_ntsc_out_t; - #else - #error "Need 32-bit int type" - #endif - -#endif diff --git a/tools/zsnes/src/video/sw_draw.asm b/tools/zsnes/src/video/sw_draw.asm deleted file mode 100644 index 8fbe7a1..0000000 --- a/tools/zsnes/src/video/sw_draw.asm +++ /dev/null @@ -1,282 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 compiles to zero if not OpenBSD, thus it can be -; left in the Makefile. - - - -%include "macros.mac" - -EXTSYM SurfaceX,SurfaceY,ScreenPtr,SurfBufD,pitch,MMXSupport,resolutn,copymaskRB -EXTSYM copymaskG,copymagic - -ALIGN32 - -SECTION .text - -NEWSYM ClearWin16 - pushad - mov edi, [SurfBufD] - xor eax,eax - xor ebx,ebx -.Blank2: - mov ecx, [SurfaceX] - rep stosw - mov edx, [SurfaceX] - add edi, [pitch] - shl edx,1 - add ebx,1 - sub edi,edx - cmp ebx, [SurfaceY] - jne .Blank2 - popad - ret - -NEWSYM ClearWin32 - pushad - mov ax,ds - mov es,ax - mov edi, [SurfBufD] - xor ebx,ebx -.Blank3: - xor eax,eax - mov ecx, [SurfaceX] - rep stosd - add edi, [pitch] - sub edi, [SurfaceX] - sub edi, [SurfaceX] - sub edi, [SurfaceX] - sub edi, [SurfaceX] - add ebx,1 - cmp ebx, [SurfaceY] - jne .Blank3 - popad - ret - -NEWSYM DrawWin256x224x16 - pushad - cmp byte[MMXSupport],0 - je .noMMX - mov esi, [ScreenPtr] - mov edi, [SurfBufD] - xor eax,eax - movsx edx, word[resolutn] - sub edx,2 -.Copying3: - mov ecx,32 -.CopyLoop: - movq mm0,[esi] - movq mm1,[esi+8] - movq [edi],mm0 - movq [edi+8],mm1 - add esi,16 - add edi,16 - dec ecx - jnz .CopyLoop - inc eax - add edi, [pitch] - sub edi,512 - add esi,64 -%ifdef __WIN32__ - cmp eax,edx -%else - cmp eax,223 -%endif - jne .Copying3 - xor eax,eax - mov ecx,128 - rep stosd - emms - popad - ret -.noMMX: - mov ax,ds - mov es,ax - xor eax,eax - mov esi, [ScreenPtr] - mov edi, [SurfBufD] - movsx edx, word[resolutn] - sub edx,2 -.Copying: - mov ecx,128 - rep movsd - inc eax - add edi, [pitch] - sub edi,512 - sub esi,512 - add esi,576 -%ifdef __WIN32__ - cmp eax,edx -%else - cmp eax,223 -%endif - jne .Copying - xor eax,edx - mov ecx,128 - rep stosd - popad - ret - -NEWSYM DrawWin256x224x32 - pushad - mov ax,ds - mov es,ax - xor eax,eax - movsx edx, word[resolutn] - sub edx,2 - mov esi, [ScreenPtr] - mov edi, [SurfBufD] - movq mm4, [copymaskRB] - movq mm5, [copymaskG] - movq mm6, [copymagic] -.Copying32b: - mov ecx,64 -.CopyLoop32b: - movq mm0, [esi] - movq mm1,mm0 - punpcklwd mm0,mm0 - movq mm2,mm0 - pand mm0,mm4 - pmaddwd mm0,mm6 - punpckhwd mm1,mm1 - movq mm3,mm1 - pand mm1,mm4 - pmaddwd mm1,mm6 - pslld mm2,5 - pslld mm3,5 - pand mm2,mm5 - pand mm3,mm5 - por mm0,mm2 - add esi,8 - por mm1,mm3 - movq [edi],mm0 - movq [edi+8],mm1 - add edi,16 - dec ecx - jnz .CopyLoop32b - inc eax - add edi, [pitch] - sub edi,1024 - sub esi,512 - add esi,576 - cmp eax,edx - jne .Copying32b - popad - emms - ret - -NEWSYM DrawWin320x240x16 - pushad - cmp byte[MMXSupport],0 - je near .noMMX - xor eax,eax - xor ebx,ebx - mov esi, [ScreenPtr] - mov edi, [SurfBufD] -.Blank1MMX: - mov ecx,160 - rep stosd - sub edi,160 - add edi, [pitch] - add ebx,1 - cmp ebx,8 - jne .Blank1MMX - xor ebx,ebx - pxor mm0,mm0 -.Copying2MMX: - mov ecx,4 -.MMXLoopA: - movq [edi+0],mm0 - movq [edi+8],mm0 - add edi,16 - dec ecx - jnz .MMXLoopA - mov ecx,32 -.MMXLoopB: - movq mm1,[esi+0] - movq mm2,[esi+8] - movq [edi+0],mm1 - movq [edi+8],mm2 - add esi,16 - add edi,16 - dec ecx - jnz .MMXLoopB - mov ecx,4 -.MMXLoopC: - movq [edi+0],mm0 - movq [edi+8],mm0 - add edi,16 - dec ecx - jnz .MMXLoopC - inc ebx - add edi, [pitch] - sub edi,640 - add esi,64 -%ifdef __WIN32__ - cmp ebx,239 -%else - cmp ebx,223 -%endif - jne .Copying2MMX - mov ecx,128 - rep stosd - emms - popad - ret -.noMMX: - mov ax,ds - mov es,ax - xor eax,eax - xor ebx,ebx - mov esi, [ScreenPtr] - mov edi, [SurfBufD] - movsx edx, word[resolutn] - sub edx,2 -.Blank1: - xor eax,eax - mov ecx,160 - rep stosd - sub edi,640 - add edi, [pitch] - add ebx,1 - cmp ebx,8 - jne .Blank1 - xor ebx,ebx -.Copying2: - xor eax,eax - mov ecx,16 - rep stosd - mov ecx,128 - rep movsd - xor eax,eax - mov ecx,16 - rep stosd - inc ebx - add edi, [pitch] - sub edi,640 - sub esi,512 - add esi,576 - cmp ebx,edx - jne .Copying2 - xor eax,eax - mov ecx,128 - rep stosd - popad - ret diff --git a/tools/zsnes/src/video/vidmacro.mac b/tools/zsnes/src/video/vidmacro.mac deleted file mode 100644 index 3a38717..0000000 --- a/tools/zsnes/src/video/vidmacro.mac +++ /dev/null @@ -1,1718 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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. - - - -; makev16t macros - -%macro procwindowback 0 - mov byte[winon],0 - mov bl,[wincolen] - and bl,00001010b - cmp bl,00001010b - je near .dualwin - mov bl,[scaddset] - shr bl,4 - and bl,00000011b - - cmp bl,0 - je near .finishwin - cmp bl,3 - je near .clearwin - test byte[wincolen],00001010b - jz near .finishwin - - mov al,[wincolen] - and al,00000101b - - mov esi,windowdata - mov byte[winon],1 - mov byte[numwin],0 - mov cl,[winl2] - mov ch,[winr2] - test byte[wincolen],00000010b - jz .nowin1 - mov cl,[winl1] - mov ch,[winr1] - shl al,2 -.nowin1 - cmp ch,255 - je .noinc - inc ch -.noinc - test al,04h - jnz near .wininside - cmp cl,ch - jae .noinsidemask - mov byte[esi],0 - mov byte[esi+1],01h - mov [esi+2],cl - mov byte[esi+3],0FFh - mov [esi+4],ch - mov byte[esi+5],01h - mov byte[numwin],3 - jmp .finishwin -.noinsidemask - mov byte[winon],2 - jmp .finishwin -.wininside - cmp cl,ch - ja .nooutsidemask -.nonotoutside - cmp ch,254 - jb .skipnodraw - cmp cl,1 - jbe .noinsidemask -.skipnodraw - mov [esi],cl - mov byte[esi+1],01h - mov [esi+2],ch - mov byte[esi+3],0FFh - mov byte[numwin],2 - jmp .finishwin -.nooutsidemask - mov byte[winon],5 - jmp .finishwin -.dualwin - mov al,[wincolen] - mov bl,[scaddset] - and bl,30h - cmp bl,30h - je .clearwin - cmp bl,00h - je .finishwin - call makedualwincol - mov byte[winon],3 - jmp .finishwin -.clearwin - mov byte[winon],4 -.finishwin -%endmacro - -;******************************************************* -; Processes & Draws 4-bit sprites for both main & sub -;******************************************************* - -%macro drawspr16bt 2 - mov al,[esi+%1] - test al,0Fh - jz %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi-%2],dx - mov [ebp-%2],dx -%%skip -%endmacro - - -%macro drawspr16btwo 3 - mov al,[esi+%1] - test al,0Fh - jz %%skip - cmp byte[winspdata+ebx-8+%3+16],0 - jne %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi-%2],dx - mov [ebp-%2],dx -%%skip -%endmacro - - -%macro sprpriorityinit 1 - cmp byte[sprclprio+ebp],0 - je near .endobj - test byte[cwinenabm],10h - jz .drawnowin - cmp byte[winonsp],0 - jne near %1 -.drawnowin -%endmacro - -%macro sprprioritydrawbt 2 - cmp dword[sprsingle],1 - je near .drawsingle - mov [csprprlft],cl - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push esi - mov ch,[esi+6] - mov dl,[esi+7] - xor eax,eax - and edx,03h - cmp edx,ebp - jne near .notprio - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawa16b %1 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.drawspriteflipx - mov bx,[esi] - push esi - mov ch,[esi+6] - mov dl,[esi+7] - xor eax,eax - and edx,03h - cmp edx,ebp - jne near .notpriof - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawaf16b %1 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - ret -.drawsingle - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,ecx - and edx,0FFh - xor eax,eax - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - mov bx,[esi] - push esi - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawa16b %2 - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret -.drawspriteflipx2 - mov bx,[esi] - push esi - mov ch,[esi+6] - mov esi,[esi+2] - sprdrawaf16b %2 - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret -%endmacro - -%macro sprdrawpra16bt 1 - or eax,eax - jz %%skip - test byte[sprpriodata+ebx-%1+16],cl - jnz %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-%1*2],dx - mov [transpbuf+32+ebx*2-%1*2],dx - or byte[sprpriodata+ebx-%1+16],cl -%%skip -%endmacro - -%macro sprdrawprb16bt 1 - or eax,eax - jz %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-%1*2],dx - mov [transpbuf+32+ebx*2-%1*2],dx -%%skip -%endmacro - - -;******************************************************* -; Processes & Draws 4-bit sprites w/ transparency -;******************************************************* - -%macro drawspr16ta 2 - mov al,[esi+%1] - or al,al - jz %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx-%2],dx -%%skip -%endmacro - -%macro drawspr16tb 2 - mov al,[esi+%1] - or al,al - jz %%skip - add al,ch - mov ebx,[ebp-%2] - mov edx,[pal16b+eax*4] - cmp bx,0 - je %%noadd - and edx,[vesa2_clbit] - and ebx,[vesa2_clbit] - add edx,ebx - shr edx,1 -%%noadd - mov [edi-%2],dx -%%skip -%endmacro - - -%macro drawspr16tc 2 - mov al,[esi+%1] - or al,al - jz %%skip - add al,ch - mov ebx,[ebp-%2] - mov edx,[pal16bcl+eax*4] - and ebx,[vesa2_clbit] - add edx,ebx - shr edx,1 - mov edx,[fulladdtab+edx*2] - mov [edi-%2],dx -%%skip -%endmacro - - -%macro drawspr16td 2 - mov al,[esi+%1] - or al,al - jz %%skip - add al,ch - mov ebx,[ebp-%2] - mov edx,[pal16bxcl+eax*4] - and ebx,[vesa2_clbit] - add edx,ebx - shr edx,1 - mov edx,[fulladdtab+edx*2] - xor edx,0FFFFh - mov [edi-%2],dx -%%skip -%endmacro - -%macro drawspr16tawinon 3 - mov al,[esi+%1] - or al,al - jz %%skip - cmp byte[winspdata+ebx-8+%3+16],0 - jne %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-%2],dx -%%skip -%endmacro - -%macro drawspr16tbwinon 3 - mov al,[esi+%1] - or al,al - jz %%skip - cmp byte[winspdata+ebx-8+%3+16],0 - jne %%skip - add al,ch - mov edx,[ebp-%2] - mov eax,[pal16b+eax*4] - cmp dx,0 - je %%noadd - and eax,[vesa2_clbit] - and edx,[vesa2_clbit] - add eax,edx - shr eax,1 -%%noadd - mov [edi-%2],ax - xor eax,eax -%%skip -%endmacro - -%macro drawspr16tcwinon 3 - mov al,[esi+%1] - or al,al - jz %%skip - cmp byte[winspdata+ebx-8+%3+16],0 - jne %%skip - add al,ch - mov edx,[ebp-%2] - mov eax,[pal16bcl+eax*4] - and edx,[vesa2_clbit] - add eax,edx - shr eax,1 - mov eax,[fulladdtab+eax*2] - mov [edi-%2],ax - xor eax,eax -%%skip -%endmacro - -%macro drawspr16tdwinon 3 - mov al,[esi+%1] - or al,al - jz %%skip - cmp byte[winspdata+ebx-8+%3+16],0 - jne %%skip - add al,ch - mov edx,[ebp-%2] - mov eax,[pal16bxcl+eax*4] - and edx,[vesa2_clbit] - add eax,edx - shr eax,1 - mov eax,[fulladdtab+eax*2] - xor eax,0FFFFh - mov [edi-%2],ax - xor eax,eax -%%skip -%endmacro - -%macro drawsprgrp 1 - %1 0, 16 - %1 1, 14 - %1 2, 12 - %1 3, 10 - %1 4, 8 - %1 5, 6 - %1 6, 4 - %1 7, 2 -%endmacro - -%macro drawsprgrpf 1 - %1 7, 16 - %1 6, 14 - %1 5, 12 - %1 4, 10 - %1 3, 8 - %1 2, 6 - %1 1, 4 - %1 0, 2 -%endmacro - -%macro drawsprgrpwin 1 - %1 0, 16, 0 - %1 1, 14, 1 - %1 2, 12, 2 - %1 3, 10, 3 - %1 4, 8, 4 - %1 5, 6, 5 - %1 6, 4, 6 - %1 7, 2, 7 -%endmacro - -%macro drawsprgrpfwin 1 - %1 7, 16, 0 - %1 6, 14, 1 - %1 5, 12, 2 - %1 4, 10, 3 - %1 3, 8, 4 - %1 2, 6, 5 - %1 1, 4, 6 - %1 0, 2, 7 -%endmacro - - -%macro sprprioritydrawt16b 4 - cmp dword[sprsingle],1 - je near .drawsingle - mov [csprprlft],cl - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,esi - xor ebx,ebx -.loopobj - test byte[esi+7],20h - jnz near .drawspriteflipx - mov bx,[esi] - push esi - mov ch,[esi+6] - mov dl,[esi+7] - xor eax,eax - and edx,03h - cmp edx,ebp - jne near .notprio - cmp ch,12*16 - jae near .transpobj - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawa16b %3 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.transpobj - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawa16b %1 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.notprio - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawa sprdrawpra2 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.drawspriteflipx - mov bx,[esi] - push esi - mov ch,[esi+6] - mov dl,[esi+7] - xor eax,eax - and edx,03h - cmp edx,ebp - jne near .notpriof - cmp ch,12*16 - jae near .transpobjf - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawaf16b %3 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem -.endobj - ret -.transpobjf - mov esi,[esi+2] - mov cl,[csprbit] - sprdrawaf16b %1 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.notpriof - mov esi,[esi+2] - mov dl,[csprbit] - sprdrawaf sprdrawpra2 - pop esi - add esi,8 - dec byte[csprprlft] - jnz near .loopobj - rol byte[csprbit],1 - cmp byte[csprbit],1 - je near .clearcsprmem - ret -.clearcsprmem - xor eax,eax - mov ecx,64 - mov edi,sprpriodata+16 - rep stosd - ret -.drawsingle - mov esi,[currentobjptr] - mov edi,[curvidoffset] - mov edx,ecx - and edx,0FFh - xor eax,eax - shl edx,3 - sub edx,8 - add edx,esi - mov esi,edx - xor ebx,ebx -.loopobj2 - test byte[esi+7],20h - jnz near .drawspriteflipx2 - mov bx,[esi] - push esi - mov ch,[esi+6] - mov esi,[esi+2] - cmp ch,12*16 - jae near .transpobj2 - sprdrawa16b %4 - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret -.transpobj2 - sprdrawa16b %2 - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret -.drawspriteflipx2 - mov bx,[esi] - push esi - mov ch,[esi+6] - mov esi,[esi+2] - cmp ch,12*16 - jae near .transpobj2f - sprdrawaf16b %4 - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret -.transpobj2f - sprdrawaf16b %2 - pop esi - sub esi,8 - dec cl - jnz near .loopobj2 - ret -%endmacro - -%macro sprdrawpra16bha 1 - or eax,eax - jz %%skip - test byte[sprpriodata+ebx-%1+16],cl - jnz %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16b+eax*4] - cmp dx,0 - je %%noadd - and edx,[vesa2_clbit] - and eax,[vesa2_clbit] - add eax,edx - shr eax,1 -%%noadd - mov [edi+ebx*2-%1*2],ax - or byte[sprpriodata+ebx-%1+16],cl - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprb16bha 1 - or eax,eax - jz %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16b+eax*4] - cmp dx,0 - je %%noadd - and edx,[vesa2_clbit] - and eax,[vesa2_clbit] - add eax,edx - shr eax,1 -%%noadd - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - -%macro sprdrawpraw16bha 1 - or eax,eax - jz %%skip - test byte[sprpriodata+ebx-%1+16],cl - jnz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16b+eax*4] - cmp dx,0 - je %%noadd - and edx,[vesa2_clbit] - and eax,[vesa2_clbit] - add eax,edx - shr eax,1 -%%noadd - mov [edi+ebx*2-%1*2],ax - or byte[sprpriodata+ebx-%1+16],cl - xor eax,eax -%%skip -%endmacro - -%macro sprdrawprbw16bha 1 - or eax,eax - jz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16b+eax*4] - cmp dx,0 - je %%noadd - and edx,[vesa2_clbit] - and eax,[vesa2_clbit] - add eax,edx - shr eax,1 -%%noadd - mov [edi+ebx*2-%1*2],ax - xor eax,eax -%%skip -%endmacro - - -%macro sprdrawpra16bfa 1 - or eax,eax - jz %%skip - test byte[sprpriodata+ebx-%1+16],cl - jnz %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16bcl+eax*4] - and edx,[vesa2_clbit] - add edx,eax - shr edx,1 - xor eax,eax - mov edx,[fulladdtab+edx*2] - mov [edi+ebx*2-%1*2],dx - or byte[sprpriodata+ebx-%1+16],cl -%%skip -%endmacro - -%macro sprdrawprb16bfa 1 - or eax,eax - jz %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16bcl+eax*4] - and edx,[vesa2_clbit] - add edx,eax - shr edx,1 - xor eax,eax - mov edx,[fulladdtab+edx*2] - mov [edi+ebx*2-%1*2],dx -%%skip -%endmacro - -%macro sprdrawpraw16bfa 1 - or eax,eax - jz %%skip - test byte[sprpriodata+ebx-%1+16],cl - jnz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16bcl+eax*4] - and edx,[vesa2_clbit] - add edx,eax - shr edx,1 - xor eax,eax - mov edx,[fulladdtab+edx*2] - mov [edi+ebx*2-%1*2],dx - or byte[sprpriodata+ebx-%1+16],cl -%%skip -%endmacro - -%macro sprdrawprbw16bfa 1 - or eax,eax - jz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16bcl+eax*4] - and edx,[vesa2_clbit] - add edx,eax - shr edx,1 - xor eax,eax - mov edx,[fulladdtab+edx*2] - mov [edi+ebx*2-%1*2],dx -%%skip -%endmacro - -%macro sprdrawpra16bfs 1 - or eax,eax - jz %%skip - test byte[sprpriodata+ebx-%1+16],cl - jnz %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16bxcl+eax*4] - and edx,[vesa2_clbit] - add edx,eax - shr edx,1 - xor eax,eax - mov edx,[fulladdtab+edx*2] - xor edx,0FFFFh - mov [edi+ebx*2-%1*2],dx - or byte[sprpriodata+ebx-%1+16],cl -%%skip -%endmacro - -%macro sprdrawprb16bfs 1 - or eax,eax - jz %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16bxcl+eax*4] - and edx,[vesa2_clbit] - add edx,eax - shr edx,1 - xor eax,eax - mov edx,[fulladdtab+edx*2] - xor edx,0FFFFh - mov [edi+ebx*2-%1*2],dx -%%skip -%endmacro - -%macro sprdrawpraw16bfs 1 - or eax,eax - jz %%skip - test byte[sprpriodata+ebx-%1+16],cl - jnz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16bxcl+eax*4] - and edx,[vesa2_clbit] - add edx,eax - shr edx,1 - xor eax,eax - mov edx,[fulladdtab+edx*2] - xor edx,0FFFFh - mov [edi+ebx*2-%1*2],dx - or byte[sprpriodata+ebx-%1+16],cl -%%skip -%endmacro - -%macro sprdrawprbw16bfs 1 - or eax,eax - jz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add al,ch - mov edx,[transpbuf+32+ebx*2-%1*2] - mov eax,[pal16bxcl+eax*4] - and edx,[vesa2_clbit] - add edx,eax - shr edx,1 - xor eax,eax - mov edx,[fulladdtab+edx*2] - xor edx,0FFFFh - mov [edi+ebx*2-%1*2],dx -%%skip -%endmacro - -;******************************************************* -; Processes & Draws 8x8 tiles for both main & sub screen -;******************************************************* - -%macro draw8x816bta 2 - mov al,[ebx+%1] - or al,al - jz %%loop - add al,dh - mov ecx,[pal16b+eax*4] - mov [esi+%2],cx - mov [ebp+%2],cx -%%loop -%endmacro - -%macro draw8x816btawinon 2 - mov al,[ebx+%1] - or al,al - jz %%loop - test byte[ecx+%1],0FFh - jnz %%loop - add al,dh - mov eax,[pal16b+eax*4] - mov [esi+%2],ax - mov [ebp+%2],ax - xor eax,eax -%%loop -%endmacro - -%macro draw8x816btawinonb 2 - mov al,[ebx+%1] - or al,al - jz %%loop - test byte[ecx+7-%1],0FFh - jnz %%loop - add al,dh - mov eax,[pal16b+eax*4] - mov [esi+%2],ax - mov [ebp+%2],ax - xor eax,eax -%%loop -%endmacro - -%macro drawtilegrp 1 - cmp dword[ebx],0 - je near %%loop - %1 0, 0 - %1 1, 2 - %1 2, 4 - %1 3, 6 -%%loop - cmp dword[ebx+4],0 - je near %%loop2 - %1 4, 8 - %1 5, 10 - %1 6, 12 - %1 7, 14 -%%loop2 -%endmacro - -%macro drawtilegrpf 1 - cmp dword[ebx+4],0 - je near %%loop - %1 7, 0 - %1 6, 2 - %1 5, 4 - %1 4, 6 -%%loop - cmp dword[ebx],0 - je near %%loop2 - %1 3, 8 - %1 2, 10 - %1 1, 12 - %1 0, 14 -%%loop2 -%endmacro - -%macro drawtilegrpfull 1 - cmp dword[edi],0 - je near %%loop - %1 0, 0 - %1 1, 2 - %1 2, 4 - %1 3, 6 -%%loop - cmp dword[edi+4],0 - je near %%loop2 - %1 4, 8 - %1 5, 10 - %1 6, 12 - %1 7, 14 -%%loop2 -%endmacro - -%macro drawtilegrpfullf 1 - cmp dword[edi+4],0 - je near %%loop - %1 7, 0 - %1 6, 2 - %1 5, 4 - %1 4, 6 -%%loop - cmp dword[edi],0 - je near %%loop2 - %1 3, 8 - %1 2, 10 - %1 1, 12 - %1 0, 14 -%%loop2 -%endmacro - - -;******************************************************* -; Processes & Draws 8x8 tiles in 2, 4, & 8 bit mode -;******************************************************* - -%macro draw8x816ta 2 - mov al,[ebx+%1] - or al,al - jz %%loop - add al,dh - mov ecx,[ebp+%2] - mov eax,[pal16b+eax*4] - test ecx,0FFFFh - je %%noadd - and eax,1111011111011110b ; [vesa2_clbit] - and ecx,1111011111011110b ; [vesa2_clbit] - add eax,ecx - shr eax,1 -%%noadd - mov [esi+%2],ax - xor eax,eax -%%loop -%endmacro - -%macro draw8x816ta2 2 - mov al,[edi+%1] - or al,al - jz %%loop - add al,dh - mov ebx,[ebp+%2] - mov ecx,[pal16b+eax*4] - test ebx,0FFFFh - je %%noadd - and ecx,1111011111011110b ; [vesa2_clbit] - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 -%%noadd - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tb 2 - mov al,[edi+%1] - or al,al - jz %%loop - add al,dh - mov ebx,[ebp+%2] - mov ecx,[pal16bcl+eax*4] - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tc 2 - mov al,[edi+%1] - or al,al - jz %%loop - add al,dh - mov ebx,[ebp+%2] - mov ecx,[pal16bxcl+eax*4] - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - xor ecx,0FFFFh - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tawinon 2 - mov al,[ebx+%1] - or al,al - jz %%loop - test byte[edx+%1],0FFh - jnz %%loop - add al,[coadder16] - mov ecx,[ebp+%2] - mov eax,[pal16b+eax*4] - test ecx,0FFFFh - je %%noadd - and eax,1111011111011110b ; [vesa2_clbit] - and ecx,1111011111011110b ; [vesa2_clbit] - add eax,ecx - shr eax,1 -%%noadd - mov [esi+%2],ax - xor eax,eax -%%loop -%endmacro - -%macro draw8x816tbwinon 2 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+%1],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bcl+eax*4] - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tcwinon 2 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+%1],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bxcl+eax*4] - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - xor ecx,0FFFFh - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tawinon2 3 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+%3],0FFh - jnz %%loop - add al,[coadder16] - mov ecx,[ebp+%2] - mov ebx,[pal16b+eax*4] - test ecx,0FFFFh - je %%noadd - and ebx,1111011111011110b ; [vesa2_clbit] - and ecx,1111011111011110b ; [vesa2_clbit] - add ebx,ecx - shr ebx,1 -%%noadd - mov [esi+%2],bx -%%loop -%endmacro - -%macro draw8x816tbwinon2 3 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+%3],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bcl+eax*4] - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tcwinon2 3 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+%3],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bxcl+eax*4] - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - xor ecx,0FFFFh - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tawinonb 2 - mov al,[ebx+%1] - or al,al - jz %%loop - test byte[edx+7-%1],0FFh - jnz %%loop - add al,[coadder16] - mov ecx,[ebp+%2] - mov eax,[pal16b+eax*4] - test ecx,0FFFFh - je %%noadd - and eax,1111011111011110b ; [vesa2_clbit] - and ecx,1111011111011110b ; [vesa2_clbit] - add eax,ecx - shr eax,1 -%%noadd - mov [esi+%2],ax - xor eax,eax -%%loop -%endmacro - -%macro draw8x816tbwinonb 2 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+7-%1],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bcl+eax*4] - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - mov [esi+%2],cx -%%loop -%endmacro - -%macro draw8x816tcwinonb 2 - mov al,[edi+%1] - or al,al - jz %%loop - test byte[edx+7-%1],0FFh - jnz %%loop - add al,[coadder16] - mov ebx,[ebp+%2] - mov ecx,[pal16bxcl+eax*4] - and ebx,1111011111011110b ; [vesa2_clbit] - add ecx,ebx - shr ecx,1 - mov ecx,[fulladdtab+ecx*2] - xor ecx,0FFFFh - mov [esi+%2],cx -%%loop -%endmacro - - -; end makev16t -; **************************************************** -; **************************************************** - -%macro Draw16x1616bwin 3 - mov al,[ebx+%1] - test al,0FFh - jz %%loop - test byte[ebp+%3],0FFh - jnz %%loop - add al,dh - mov ecx,[pal16b+eax*4] - mov [esi+%2],cx -%%loop -%endmacro - -;******************************************************* -; Processes & Draws 16x16 tiles in 2, 4, & 8 bit mode -;******************************************************* -%macro Draw16x1616b 2 - mov al,[ebx+%1] - test al,0FFh - jz %%loop - add al,dh - mov ecx,[pal16b+eax*4] - mov [esi+%2],cx -%%loop -%endmacro - -%macro drawpixel16b8x8winon 4 - mov al,[ebx+%1] - test al,0FFh - jz %2 - test byte[ebp+%4],0FFh - jnz %2 - add al,dh - mov ecx,[pal16b+eax*4] - mov [esi+%3],cx -%2 -%endmacro - -%macro drawpixel16b8x8 3 - mov al,[ebx+%1] - test al,0FFh - jz %2 - add al,dh - mov ecx,[pal16b+eax*4] - mov [esi+%3],cx -%2 -%endmacro - -%macro Draw8x816bwinmacro 1 - mov al,[ebx+%1] - or al,al - jz %%loop - test byte[ebp+%1],0FFh - jnz %%loop - add al,dh - mov ecx,[pal16b+eax*4] - mov [esi+%1*2],cx -%%loop -%endmacro - -%macro Draw8x816bwinflipmacro 1 - mov al,[ebx+7-%1] - or al,al - jz %%loop - test byte[ebp+%1],0FFh - jnz %%loop - add al,dh - mov ecx,[pal16b+eax*4] - mov [esi+%1*2],cx -%%loop -%endmacro - -;******************************************************* -; DrawLine 16bit Draws the current line -;******************************************************* -; use curypos+bg1scroly for y location and bg1scrolx for x location -; use bg1ptr(b,c,d) for the pointer to the tile number contents -; use bg1objptr for the pointer to the object tile contents - -%macro procmode716b 3 - xor eax,eax - xor edx,edx - mov ax,[curypos] - inc ax - test byte[mode7set],02h - jz .noflip - neg ax - add ax,255 -.noflip - mov byte[curmosaicsz],1 - test byte[mosaicon],%3 - jz .nomos - mov bl,[mosaicsz] - cmp bl,0 - je .nomos - inc bl - mov [curmosaicsz],bl - xor bh,bh - div bx - xor edx,edx - mul bx -.nomos - mov [m7starty],ax - mov ax,%1 - mov dx,%2 - call drawmode716b -%endmacro - - -%macro sprdrawpra16b 1 - or eax,eax - jz %%skip - test byte[sprpriodata+ebx-%1+16],cl - jnz %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-%1*2],dx - or byte[sprpriodata+ebx-%1+16],cl -%%skip -%endmacro - -%macro sprdrawprb16b 1 - or eax,eax - jz %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-%1*2],dx -%%skip -%endmacro - -%macro sprdrawpraw16b 1 - or eax,eax - jz %%skip - test byte[sprpriodata+ebx-%1+16],cl - jnz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-%1*2],dx - or byte[sprpriodata+ebx-%1+16],cl -%%skip -%endmacro - -%macro sprdrawprbw16b 1 - or eax,eax - jz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add al,ch - mov edx,[pal16b+eax*4] - mov [edi+ebx*2-%1*2],dx -%%skip -%endmacro - -;******************************************************* -; Processes & Draws 8x8 tiles in 2, 4, & 8 bit mode -;******************************************************* - -%macro Draw8x816bmacro 1 - mov al,[ebx+%1] - or al,al - jz %%loop - add al,dh - mov ecx,[pal16b+eax*4] - mov [esi+%1*2],cx -%%loop -%endmacro - -%macro Draw8x816bflipmacro 1 - mov al,[ebx+7-%1] - or al,al - jz %%loop - add al,dh - mov ecx,[pal16b+eax*4] - mov [esi+%1*2],cx -%%loop -%endmacro - -%macro sprdrawa16b 1 - xor eax,eax - mov al,[esi] - %1 8 - mov al,[esi+1] - %1 7 - mov al,[esi+2] - %1 6 - mov al,[esi+3] - %1 5 - mov al,[esi+4] - %1 4 - mov al,[esi+5] - %1 3 - mov al,[esi+6] - %1 2 - mov al,[esi+7] - %1 1 -%endmacro - -%macro sprdrawaf16b 1 - xor eax,eax - mov al,[esi] - %1 1 - mov al,[esi+1] - %1 2 - mov al,[esi+2] - %1 3 - mov al,[esi+3] - %1 4 - mov al,[esi+4] - %1 5 - mov al,[esi+5] - %1 6 - mov al,[esi+6] - %1 7 - mov al,[esi+7] - %1 8 -%endmacro - - -%macro sprdrawa 1 - mov ax,[esi] - %1 8, al - %1 7, ah - mov ax,[esi+2] - %1 6, al - %1 5, ah - mov ax,[esi+4] - %1 4, al - %1 3, ah - mov ax,[esi+6] - %1 2, al - %1 1, ah -%endmacro - -%macro sprdrawpra 2 - or %2,%2 - jz %%skip - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - add %2,ch - mov [edi+ebx-%1],%2 - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprawb 2 - or %2,%2 - jz %%skip - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - cmp byte[ecx+ebx-%1],1 - je %%skip - add %2,dh - mov [edi+ebx-%1],%2 - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprb 2 - or %2,%2 - jz %%skip - add %2,ch - mov [edi+ebx-%1],%2 -%%skip -%endmacro - -%macro sprdrawprbwb 2 - or %2,%2 - jz %%skip - add %2,dh - cmp byte[ecx+ebx-%1],1 - je %%skip - mov [edi+ebx-%1],%2 -%%skip -%endmacro - -%macro sprdrawpra2 2 - or %2,%2 - jz %%skip - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawpraw 2 - or %2,%2 - jz %%skip - test byte[sprpriodata+ebx-%1+16],dl - jnz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add %2,ch - mov [edi+ebx-%1],%2 - or byte[sprpriodata+ebx-%1+16],dl -%%skip -%endmacro - -%macro sprdrawprbw 2 - or %2,%2 - jz %%skip - cmp byte[winspdata+ebx-%1+16],0 - jne %%skip - add %2,ch - mov [edi+ebx-%1],%2 -%%skip -%endmacro - -%macro sprdrawaf 1 - mov ax,[esi] - %1 1, al - %1 2, ah - mov ax,[esi+2] - %1 3, al - %1 4, ah - mov ax,[esi+4] - %1 5, al - %1 6, ah - mov ax,[esi+6] - %1 7, al - %1 8, ah -%endmacro - -%macro procoffsetmode 0 - push ebx - push edx - add word[ofsmmptr],2 - add word[ofsmtptr],2 - mov ebx,[yposngom] - mov eax,[flipyposngom] - mov [yadder],ebx - mov [yrevadder],eax - mov ax,[ofsmmptr] - test eax,03Fh - jnz %%next - mov bx,[bgtxadd] - add ax,bx - add [ofsmmptr],bx - add [ofsmtptr],bx -%%next - add eax,[vram] - mov edi,eax - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - mov eax,[OMBGTestVal] - test dword[ebx],eax - jz %%noofsm - mov ebx,[ebx] - mov ax,[ofsmtptr] - and ebx,3FFh - add ebx,[ofsmcyps] - test ebx,100h - jz %%noupper - add ax,[ofsmady] -%%noupper - and ebx,0FFh - mov edx,ebx - shr ebx,3 - and edx,07h - shl ebx,6 - shl edx,3 - add ax,bx - mov [yadder],edx - xor edx,38h - mov [yrevadder],edx - add eax,[vram] - mov edi,eax -%%noofsm - mov ebx,[ofsmcptr] - add ebx,[ofsmcptr2] - add dword[ofshvaladd],8 - mov eax,[OMBGTestVal] - add dword[ofsmcptr2],2 - and dword[ofsmcptr2],3Fh - test dword[ebx-40h],eax - jz %%noofsmh - mov eax,edi - sub eax,[vram] - mov ebx,[ebx-40h] - sub ax,[ofsmtptr] - add ax,[ofsmtptrs] - add ebx,[ofshvaladd] - test ebx,100h - jz %%noleft - add ax,[ofsmadx] -%%noleft - and ebx,0F8h - shr ebx,2 - add ax,bx - add eax,[vram] - mov edi,eax -%%noofsmh - pop edx - pop ebx -%endmacro - -;******************************************************* -; Processes & Draws 8x8 offset mode in Mode 2/4 -;******************************************************* - -%macro initoffsetmode 0 - push ebx - push ecx - mov ebx,2000h - mov ecx,ebp - shl ebx,cl - mov [OMBGTestVal],ebx - mov ecx,[bg1scroly+ebp*2] - and ecx,0FFFFh - add ecx,ebx - push eax - push edx - xor edx,edx - mov dx,[bg3scroly] -; and dx,0F8h - shr edx,3 - shl edx,6 - xor eax,eax - mov ax,[bg3ptr] - add ax,dx - xor edx,edx - mov dx,[bg3scrolx] - and dx,0F8h - xor ebx,ebx - mov ebx,[curypos] - mov [ofsmcyps],ebx - shr edx,3 - shl edx,1 - add ax,dx - mov dx,[bg3scrolx] - test dx,8000h - jz .nooma - and dx,0F000h - shr dx,5 - add ax,dx -.nooma - add eax,40h - mov edx,eax - mov [Testval],edx - and edx,0FFFFFFC0h - add edx,[vram] - mov [ofsmcptr],edx - and eax,3Fh - mov [ofsmcptr2],eax - mov eax,[bg1ptry+ebp*4] - mov [ofsmady],eax - mov eax,[bg1ptrx+ebp*4] - mov [ofsmadx],eax - mov eax,[bg1ptr+ebp*2] - mov [ofsmtptr],eax - mov [ofsmtptrs],eax - test ecx,100h - jz .noyincd - add eax,[bg1ptry+ebp*4] -.noyincd - lea ecx,[ecx*8] - and ecx,07C0h ; 1Fh*40h - add eax,ecx - mov edx,[yadder] - mov [yposngom],edx - mov edx,[yrevadder] - mov [flipyposngom],edx - mov ecx,[bg1scrolx+ebp*2] - mov edx,[bg1ptrx+ebp*4] - test ecx,100h - jz .noxincd - add eax,edx - add [ofsmtptr],edx - neg dx -.noxincd - sub dx,64 - and ecx,0F8h - and eax,0FFFFh - shr ecx,2 - mov [bgtxadd],edx - add eax,ecx - add [ofsmtptr],ecx - mov [ofsmmptr],eax - xor eax,eax - mov ax,[bg1objptr+ebp*2] - shr eax,5 - mov [ngptrdat2],eax - mov eax,edi - sub eax,[vram] - mov [ofsmmptr],eax - mov dword[ofshvaladd],0 - pop edx - pop eax - pop ecx - pop ebx -%endmacro - -%macro offsetmcachechk 0 - ; Cache check - push ecx - mov ecx,eax - add ecx,[ngptrdat2] - and ecx,2047 - cmp word[vidmemch4+ecx*2],0 - je %%nocache - call cachesingle4bng -%%nocache - pop ecx -%endmacro diff --git a/tools/zsnes/src/win/afxres.h b/tools/zsnes/src/win/afxres.h deleted file mode 100644 index 1f5d4e3..0000000 --- a/tools/zsnes/src/win/afxres.h +++ /dev/null @@ -1,235 +0,0 @@ -#ifndef __AFXRES_H__ -#define __AFXRES_H__ - -#include "winresrc.h" // extract from windows header -///////////////////////////////////////////////////////////////////////////// -// MFC resource types (see Technical note TN024 for implementation details) - -#ifndef RC_INVOKED -#define RT_DLGINIT MAKEINTRESOURCE(240) -#define RT_TOOLBAR MAKEINTRESOURCE(241) -#endif - -///////////////////////////////////////////////////////////////////////////// -// General style bits etc - -// ControlBar styles -#define CBRS_ALIGN_LEFT 0x1000L -#define CBRS_ALIGN_TOP 0x2000L -#define CBRS_ALIGN_RIGHT 0x4000L -#define CBRS_ALIGN_BOTTOM 0x8000L -#define CBRS_ALIGN_ANY 0xF000L - -#define CBRS_BORDER_LEFT 0x0100L -#define CBRS_BORDER_TOP 0x0200L -#define CBRS_BORDER_RIGHT 0x0400L -#define CBRS_BORDER_BOTTOM 0x0800L -#define CBRS_BORDER_ANY 0x0F00L - -#define CBRS_TOOLTIPS 0x0010L -#define CBRS_FLYBY 0x0020L -#define CBRS_FLOAT_MULTI 0x0040L -#define CBRS_BORDER_3D 0x0080L -#define CBRS_HIDE_INPLACE 0x0008L -#define CBRS_SIZE_DYNAMIC 0x0004L -#define CBRS_SIZE_FIXED 0x0002L -#define CBRS_FLOATING 0x0001L - -#define CBRS_GRIPPER 0x00400000L - -#define CBRS_ORIENT_HORZ (CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM) -#define CBRS_ORIENT_VERT (CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT) -#define CBRS_ORIENT_ANY (CBRS_ORIENT_HORZ|CBRS_ORIENT_VERT) - -#define CBRS_ALL 0x0040FFFFL - -// the CBRS_ style is made up of an alignment style and a draw border style -// the alignment styles are mutually exclusive -// the draw border styles may be combined -#define CBRS_NOALIGN 0x00000000L -#define CBRS_LEFT (CBRS_ALIGN_LEFT|CBRS_BORDER_RIGHT) -#define CBRS_TOP (CBRS_ALIGN_TOP|CBRS_BORDER_BOTTOM) -#define CBRS_RIGHT (CBRS_ALIGN_RIGHT|CBRS_BORDER_LEFT) -#define CBRS_BOTTOM (CBRS_ALIGN_BOTTOM|CBRS_BORDER_TOP) - -///////////////////////////////////////////////////////////////////////////// -// Standard window components - -// Mode indicators in status bar - these are routed like commands -#define ID_INDICATOR_EXT 0xE700 // extended selection indicator -#define ID_INDICATOR_CAPS 0xE701 // cap lock indicator -#define ID_INDICATOR_NUM 0xE702 // num lock indicator -#define ID_INDICATOR_SCRL 0xE703 // scroll lock indicator -#define ID_INDICATOR_OVR 0xE704 // overtype mode indicator -#define ID_INDICATOR_REC 0xE705 // record mode indicator -#define ID_INDICATOR_KANA 0xE706 // kana lock indicator - -#define ID_SEPARATOR 0 // special separator value - -#ifndef RC_INVOKED // code only -// Standard control bars (IDW = window ID) -#define AFX_IDW_CONTROLBAR_FIRST 0xE800 -#define AFX_IDW_CONTROLBAR_LAST 0xE8FF - -#define AFX_IDW_TOOLBAR 0xE800 // main Toolbar for window -#define AFX_IDW_STATUS_BAR 0xE801 // Status bar window -#define AFX_IDW_PREVIEW_BAR 0xE802 // PrintPreview Dialog Bar -#define AFX_IDW_RESIZE_BAR 0xE803 // OLE in-place resize bar -#define AFX_IDW_REBAR 0xE804 // COMCTL32 "rebar" Bar -#define AFX_IDW_DIALOGBAR 0xE805 // CDialogBar - -// Note: If your application supports docking toolbars, you should -// not use the following IDs for your own toolbars. The IDs chosen -// are at the top of the first 32 such that the bars will be hidden -// while in print preview mode, and are not likely to conflict with -// IDs your application may have used succesfully in the past. - -#define AFX_IDW_DOCKBAR_TOP 0xE81B -#define AFX_IDW_DOCKBAR_LEFT 0xE81C -#define AFX_IDW_DOCKBAR_RIGHT 0xE81D -#define AFX_IDW_DOCKBAR_BOTTOM 0xE81E -#define AFX_IDW_DOCKBAR_FLOAT 0xE81F - -// Macro for mapping standard control bars to bitmask (limit of 32) -#define AFX_CONTROLBAR_MASK(nIDC) (1L << (nIDC - AFX_IDW_CONTROLBAR_FIRST)) - -// parts of Main Frame -#define AFX_IDW_PANE_FIRST 0xE900 // first pane (256 max) -#define AFX_IDW_PANE_LAST 0xE9ff -#define AFX_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max) -#define AFX_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max) - -#define AFX_IDW_SIZE_BOX 0xEA20 // size box for splitters -#define AFX_IDW_PANE_SAVE 0xEA21 // to shift AFX_IDW_PANE_FIRST -#endif //!RC_INVOKED - -#ifndef APSTUDIO_INVOKED - -// common style for form views -#define AFX_WS_DEFAULT_VIEW (WS_CHILD | WS_VISIBLE | WS_BORDER) - -#endif //!APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// -// Standard app configurable strings - -// for application title (defaults to EXE name or name in constructor) -#define AFX_IDS_APP_TITLE 0xE000 -// idle message bar line -#define AFX_IDS_IDLEMESSAGE 0xE001 -// message bar line when in shift-F1 help mode -#define AFX_IDS_HELPMODEMESSAGE 0xE002 -// document title when editing OLE embedding -#define AFX_IDS_APP_TITLE_EMBEDDING 0xE003 -// company name -#define AFX_IDS_COMPANY_NAME 0xE004 -// object name when server is inplace -#define AFX_IDS_OBJ_TITLE_INPLACE 0xE005 - -///////////////////////////////////////////////////////////////////////////// -// Standard Commands - -// File commands -#define ID_FILE_NEW 0xE100 -#define ID_FILE_OPEN 0xE101 -#define ID_FILE_CLOSE 0xE102 -#define ID_FILE_SAVE 0xE103 -#define ID_FILE_SAVE_AS 0xE104 -#define ID_FILE_PAGE_SETUP 0xE105 -#define ID_FILE_PRINT_SETUP 0xE106 -#define ID_FILE_PRINT 0xE107 -#define ID_FILE_PRINT_DIRECT 0xE108 -#define ID_FILE_PRINT_PREVIEW 0xE109 -#define ID_FILE_UPDATE 0xE10A -#define ID_FILE_SAVE_COPY_AS 0xE10B -#define ID_FILE_SEND_MAIL 0xE10C -#define ID_FILE_NEW_FRAME 0xE10D - -#define ID_FILE_MRU_FIRST 0xE110 -#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max -#define ID_FILE_MRU_FILE2 0xE111 -#define ID_FILE_MRU_FILE3 0xE112 -#define ID_FILE_MRU_FILE4 0xE113 -#define ID_FILE_MRU_FILE5 0xE114 -#define ID_FILE_MRU_FILE6 0xE115 -#define ID_FILE_MRU_FILE7 0xE116 -#define ID_FILE_MRU_FILE8 0xE117 -#define ID_FILE_MRU_FILE9 0xE118 -#define ID_FILE_MRU_FILE10 0xE119 -#define ID_FILE_MRU_FILE11 0xE11A -#define ID_FILE_MRU_FILE12 0xE11B -#define ID_FILE_MRU_FILE13 0xE11C -#define ID_FILE_MRU_FILE14 0xE11D -#define ID_FILE_MRU_FILE15 0xE11E -#define ID_FILE_MRU_FILE16 0xE11F -#define ID_FILE_MRU_LAST 0xE11F - -// Edit commands -#define ID_EDIT_CLEAR 0xE120 -#define ID_EDIT_CLEAR_ALL 0xE121 -#define ID_EDIT_COPY 0xE122 -#define ID_EDIT_CUT 0xE123 -#define ID_EDIT_FIND 0xE124 -#define ID_EDIT_PASTE 0xE125 -#define ID_EDIT_PASTE_LINK 0xE126 -#define ID_EDIT_PASTE_SPECIAL 0xE127 -#define ID_EDIT_REPEAT 0xE128 -#define ID_EDIT_REPLACE 0xE129 -#define ID_EDIT_SELECT_ALL 0xE12A -#define ID_EDIT_UNDO 0xE12B -#define ID_EDIT_REDO 0xE12C - -// Window commands -#define ID_WINDOW_NEW 0xE130 -#define ID_WINDOW_ARRANGE 0xE131 -#define ID_WINDOW_CASCADE 0xE132 -#define ID_WINDOW_TILE_HORZ 0xE133 -#define ID_WINDOW_TILE_VERT 0xE134 -#define ID_WINDOW_SPLIT 0xE135 -#ifndef RC_INVOKED // code only -#define AFX_IDM_WINDOW_FIRST 0xE130 -#define AFX_IDM_WINDOW_LAST 0xE13F -#define AFX_IDM_FIRST_MDICHILD 0xFF00 // window list starts here -#endif //!RC_INVOKED - -// Help and App commands -#define ID_APP_ABOUT 0xE140 -#define ID_APP_EXIT 0xE141 -#define ID_HELP_INDEX 0xE142 -#define ID_HELP_FINDER 0xE143 -#define ID_HELP_USING 0xE144 -#define ID_CONTEXT_HELP 0xE145 // shift-F1 -// special commands for processing help -#define ID_HELP 0xE146 // first attempt for F1 -#define ID_DEFAULT_HELP 0xE147 // last attempt - -// Misc -#define ID_NEXT_PANE 0xE150 -#define ID_PREV_PANE 0xE151 - -// Format -#define ID_FORMAT_FONT 0xE160 - -// OLE commands -#define ID_OLE_INSERT_NEW 0xE200 -#define ID_OLE_EDIT_LINKS 0xE201 -#define ID_OLE_EDIT_CONVERT 0xE202 -#define ID_OLE_EDIT_CHANGE_ICON 0xE203 -#define ID_OLE_EDIT_PROPERTIES 0xE204 -#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max -#ifndef RC_INVOKED // code only -#define ID_OLE_VERB_LAST 0xE21F -#endif //!RC_INVOKED - -#define IDC_STATIC (-1) -#ifndef SS_BITMAP -#define SS_BITMAP 14 -#endif - -#ifndef IDCLOSE -#define IDCLOSE 8 -#endif - -#endif //__AFXRES_H__ - -///////////////////////////////////////////////////////////////////////////// diff --git a/tools/zsnes/src/win/lib.c b/tools/zsnes/src/win/lib.c deleted file mode 100644 index 4eee59d..0000000 --- a/tools/zsnes/src/win/lib.c +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 "lib.h" -#include -#include -#include -#include "../zpath.h" - -#define fullpath _fullpath - - -//This file contains library functions that can be found on other OSs - - -#ifdef _MSC_VER - -DIR *opendir(const char *path) -{ - DIR *dir = 0; - if (path && *path) - { - char search[MAX_PATH]; - strcpy(search, path); - strcatslash(search); - strcat(search, "*"); - - dir = malloc(sizeof(DIR)); - if (dir) - { - dir->find_first_handle = _findfirst(search, &dir->fileinfo); - if (dir->find_first_handle == -1) - { - //ENOENT set by findfirst already - free(dir); - dir = 0; - } - } - else - { - errno = ENOMEM; - } - } - else - { - errno = EINVAL; - } - - return(dir); -} - -struct dirent *readdir(DIR *dir) -{ - struct dirent *entry = 0; - if (dir->find_first_handle != -1) - { - entry = &dir->entry; - strcpy(entry->d_name, dir->fileinfo.name); - if (_findnext(dir->find_first_handle, &dir->fileinfo) == -1) - { - _findclose(dir->find_first_handle); - dir->find_first_handle = -1; - } - } - else - { - errno = EBADF; - } - - return(entry); -} - -int closedir(DIR *dir) -{ - int result = 0; - - if (dir) - { - if (dir->find_first_handle != -1) - { - _findclose(dir->find_first_handle); - } - free(dir); - } - else - { - result = -1; - errno = EBADF; - } - - return(result); -} - -#endif - - -char *realpath(const char *path, char *resolved_path) -{ - char *ret = 0; - - if (!path || !resolved_path) { errno = EINVAL; } - else if (!access(path, F_OK)) - { - ret = fullpath(resolved_path, path, PATH_SIZE); - } - - return(ret); -} diff --git a/tools/zsnes/src/win/lib.h b/tools/zsnes/src/win/lib.h deleted file mode 100644 index 0e757ab..0000000 --- a/tools/zsnes/src/win/lib.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef LIB_H -#define LIB_H - -#include -#include - -#ifdef _MSC_VER -#define strcasecmp stricmp -#define strncasecmp strnicmp - -struct dirent -{ - char d_name[256]; -}; - -typedef struct -{ - intptr_t find_first_handle; - struct _finddata_t fileinfo; - struct dirent entry; -} DIR; - -DIR *opendir(const char *path); -struct dirent *readdir(DIR *dir); -int closedir(DIR *dir); - -#endif - -char *realpath(const char *path, char *resolved_path); - -#endif diff --git a/tools/zsnes/src/win/resource.h b/tools/zsnes/src/win/resource.h deleted file mode 100644 index 053fbb5..0000000 --- a/tools/zsnes/src/win/resource.h +++ /dev/null @@ -1 +0,0 @@ -#define IDI_ICON1 101 diff --git a/tools/zsnes/src/win/safelib.c b/tools/zsnes/src/win/safelib.c deleted file mode 100644 index 636f158..0000000 --- a/tools/zsnes/src/win/safelib.c +++ /dev/null @@ -1,134 +0,0 @@ -#include -#include -#include -#define _POSIX_ -#include -#include -#include -#include - -#include "safelib.h" -#include "../argv.h" - -//These are here because I don't believe in MSVC's prefixing affixation -#define dup _dup -#define dup2 _dup2 -#define pipe _pipe -#define flushall _flushall -#define cwait _cwait - - -//Introducing a popen which doesn't return until it knows for sure of program launched or couldn't open -Nach - -#define READ_FD 0 -#define WRITE_FD 1 - -static struct fp_pid_link -{ - FILE *fp; - int pid; - struct fp_pid_link *next; -} fp_pids = { 0, 0, 0 }; - -FILE *safe_popen(char *command, const char *mode) -{ - FILE *ret = 0; - char **argv = build_argv(command); - if (argv) - { - int filedes[2]; - - if (mode && (*mode == 'r' || *mode == 'w') && - !pipe(filedes, 512, (mode[1] == 'b' ? O_BINARY : O_TEXT) | O_NOINHERIT)) - { - int fd_original; - FILE *fp; - - if (*mode == 'r') - { - fd_original = dup(STDOUT_FILENO); - dup2(filedes[WRITE_FD], STDOUT_FILENO); - close(filedes[WRITE_FD]); - if (!(fp = fdopen(filedes[READ_FD], mode))) - { - close(filedes[READ_FD]); - } - } - else - { - fd_original = dup(STDIN_FILENO); - dup2(filedes[READ_FD], STDIN_FILENO); - close(filedes[READ_FD]); - if (!(fp = fdopen(filedes[WRITE_FD], mode))) - { - close(filedes[WRITE_FD]); - } - } - - if (fp) - { - intptr_t childpid; - flushall(); - - childpid = spawnvp(P_NOWAIT, argv[0], (const char* const*)argv); - if (childpid > 0) - { - struct fp_pid_link *link = &fp_pids; - while (link->next) - { - link = link->next; - } - - link->next = (struct fp_pid_link *)malloc(sizeof(struct fp_pid_link)); - if (link->next) - { - link->next->fp = fp; - link->next->pid = childpid; - link->next->next = 0; - ret = fp; - } - else - { - fclose(fp); - TerminateProcess((HANDLE)childpid, 0); - cwait(0, childpid, WAIT_CHILD); - } - } - else - { - fclose(fp); - } - } - - if (*mode == 'r') - { - dup2(fd_original, STDOUT_FILENO); - } - else - { - dup2(fd_original, STDIN_FILENO); - } - close(fd_original); - } - free(argv); - } - return(ret); -} - -void safe_pclose(FILE *fp) -{ - struct fp_pid_link *link = &fp_pids; - - while (link->next && link->next->fp != fp) - { - link = link->next; - } - if (link->next->fp == fp) - { - struct fp_pid_link *dellink = link->next; - fclose(fp); - cwait(0, link->next->pid, WAIT_CHILD); - link->next = link->next->next; - free(dellink); - } -} diff --git a/tools/zsnes/src/win/safelib.h b/tools/zsnes/src/win/safelib.h deleted file mode 100644 index fe212d9..0000000 --- a/tools/zsnes/src/win/safelib.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SAFELIB_H -#define SAFELIB_H - -#include - -#ifndef STDIN_FILENO -#define STDIN_FILENO 0 -#endif - -#ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 -#endif - -FILE *safe_popen(char *, const char *); -void safe_pclose(FILE *fp); - -#define popen safe_popen -#define pclose safe_pclose - -#endif diff --git a/tools/zsnes/src/win/winintrf.asm b/tools/zsnes/src/win/winintrf.asm deleted file mode 100644 index 347af62..0000000 --- a/tools/zsnes/src/win/winintrf.asm +++ /dev/null @@ -1,991 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 GUIkeydelay2,SBHDMA -EXTSYM soundon,DSPDisable,Start60HZ,pressed,putchar,getch -EXTSYM vidbufferofsb,vidbuffer,clearwin,Stop60HZ,initwinvideo,vesa2_rpos -EXTSYM vesa2_gpos,vesa2_bpos,vesa2_rposng,vesa2_gposng,vesa2_bposng,vesa2_usbit -EXTSYM vesa2_clbit,vesa2_clbitng,vesa2_clbitng2,vesa2_clbitng3,vesa2red10,res640 -EXTSYM res480,cbitmode,cvidmode,vesa2_bits,vesa2_x,vesa2_y,genfulladdtab,GUICPC -EXTSYM drawscreenwin,ConvertToAFormat,HalfTrans,UnusedBitXor,UnusedBit -EXTSYM ngrposng,nggposng,ngbposng,HalfTransB,HalfTransC -EXTSYM WinUpdateDevices,UpdateVFrame,GetMouseX,GetMouseY,GetMouseMoveX -EXTSYM GetMouseMoveY,GetMouseButton,SetMouseMinX,SetMouseMaxX,SetMouseMinY -EXTSYM SetMouseMaxY,SetMouseX,SetMouseY,T36HZEnabled,MouseButton,Start36HZ -EXTSYM Stop36HZ,BufferSizeW,BufferSizeB,ProcessSoundBuffer,CheckTimers -EXTSYM vesa2_rfull,vesa2_rtrcl,vesa2_rtrcla,vesa2_gfull,vesa2_gtrcl,vesa2_gtrcla -EXTSYM vesa2_bfull,vesa2_btrcl,vesa2_btrcla,Init_2xSaIMMXW,DoSleep -EXTSYM V8Mode,GrayscaleMode,PrevWinMode,PrevFSMode,FrameSemaphore -EXTSYM DisplayWIPDisclaimer -EXTSYM pl1upk,pl1downk,pl1leftk,pl1rightk,pl1startk,pl1selk -EXTSYM pl1Ak,pl1Bk,pl1Xk,pl1Yk,pl1Lk,pl1Rk -EXTSYM pl2upk,pl2downk,pl2leftk,pl2rightk,pl2startk,pl2selk -EXTSYM pl2Ak,pl2Bk,pl2Xk,pl2Yk,pl2Lk,pl2Rk -EXTSYM pl3upk,pl3downk,pl3leftk,pl3rightk,pl3startk,pl3selk -EXTSYM pl3Ak,pl3Bk,pl3Xk,pl3Yk,pl3Lk,pl3Rk -EXTSYM pl4upk,pl4downk,pl4leftk,pl4rightk,pl4startk,pl4selk -EXTSYM pl4Ak,pl4Bk,pl4Xk,pl4Yk,pl4Lk,pl4Rk -EXTSYM pl5upk,pl5downk,pl5leftk,pl5rightk,pl5startk,pl5selk -EXTSYM pl5Ak,pl5Bk,pl5Xk,pl5Yk,pl5Lk,pl5Rk - -; NOTE: For timing, Game60hzcall should be called at 50hz or 60hz (depending -; on romispal) after a call to InitPreGame and before DeInitPostGame are -; made. GUI36hzcall should be called at 36hz after a call GUIInit and -; before GUIDeInit. - -SECTION .text - -NEWSYM StartUp - ret - -; SystemInit - Initialize all Joystick stuff, load in all configuration data, -; parse commandline data, obtain current directory (One time initialization) - -NEWSYM SystemInit - ; Be sure to set SBHDMA to a value other than 0 if 16bit sound exists -%ifndef __RELEASE__ - pushad - call DisplayWIPDisclaimer - popad -%endif - mov byte[SBHDMA],1 - ret - -NEWSYM PrintStr ; Print ASCIIZ string - pushad -.next - mov al,[edx] - or al,al - jz .finish - push edx - mov dl,al - push edx - call putchar - pop edx -; mov ah,02h -; int 21h - pop edx - inc edx - jmp .next -.finish - popad - ret - -SECTION .data -NEWSYM wfkey, db 0 - -SECTION .text -NEWSYM WaitForKey ; Wait for a key to be pressed - pushad - call getch - mov [wfkey],al - popad - mov al,[wfkey] - ;mov ah,7 - ;int 21h - ; return key in al - ret - -RefreshKeybBuffer: - call JoyRead - mov ebx,[HoldKey] - cmp byte[pressed+ebx],0 - jne .holding - mov dword[HoldKey],0 -.holding - xor eax,eax - xor ebx,ebx -.loop - cmp byte[PKeyBuf+eax],0 - jne .not1 - cmp byte[pressed+eax],0 - je .not1 - mov byte[PKeyBuf+eax],1 - mov ebx,eax -.not1 - cmp byte[pressed+eax],0 - jne .not0 - mov byte[PKeyBuf+eax],0 -.not0 - inc eax - cmp eax,100h - jne .loop - or ebx,ebx - jz .notpressed - mov [HoldKey],ebx - mov byte[GUIkeydelay2],14 - call .processkey -.notpressed - ; Execute the following at 36hz - cmp dword[HoldKey],0 - je .noholder - cmp byte[GUIkeydelay2],0 - jne .noholder - mov byte[GUIkeydelay2],3 - call .processkey -.noholder - ret -.processkey - mov ebx,[HoldKey] - cmp ebx,0A8h - jb .skipdecval - add ebx,-80h -.skipdecval - cmp ebx,58h - jae .none - movzx eax,byte[Keybtail] - inc al - and al,0Fh - cmp al,[Keybhead] - je .none - mov al,[Keybtail] - mov cl,[KeyConvTable+ebx] - cmp byte[pressed+2Ah],0 - jne .shift - cmp byte[pressed+36h],0 - je .noshift -.shift - mov cl,[KeyConvTableS+ebx] -.noshift - mov [HoldKeyBuf+eax],cl - inc al - and al,0Fh - mov [Keybtail],al -.none - ret - -SECTION .data -Keybhead db 0 -Keybtail db 0 -HoldKey dd 0 -HoldKeyBuf times 16 db 0 -PKeyBuf times 100h db 0 -NEWSYM CurKeyPos, dd 0 -NEWSYM CurKeyReadPos, dd 0 -NEWSYM KeyBuffer, times 16 dd 0 - -SECTION .text - -NEWSYM Check_Key - mov al,[CurKeyPos] - cmp al,[CurKeyReadPos] - jne .yeskey - xor al,al - ret -.yeskey - mov al,0FFh - ret - ; returns 0 if there are no keys in the keyboard buffer, 0xFF otherwise - pushad - call RefreshKeybBuffer - mov byte[wfkey],0 - mov al,[Keybhead] - cmp al,[Keybtail] - je .nokeys - mov byte[wfkey],0FFh -.nokeys - popad - mov al,[wfkey] -; mov ah,0Bh -; int 21h - ret - -NEWSYM Get_Key - ; wait if there are no keys in buffer, then return key in al - ; for extended keys, return a 0, then the extended key afterwards - xor eax,eax -.nokey -; call JoyRead - mov al,[CurKeyReadPos] - cmp al,[CurKeyPos] - je .nokey - test word[KeyBuffer+eax*4],100h - jnz .upper - mov al,[KeyBuffer+eax*4] - inc dword[CurKeyReadPos] - and dword[CurKeyReadPos],0Fh - ret -.upper - add word[KeyBuffer+eax*4],-100h - xor al,al - ret - - pushad -.nonewkey - call RefreshKeybBuffer - movzx eax,byte[Keybhead] - cmp al,[Keybtail] - je .nonewkey - mov bl,[HoldKeyBuf+eax] - test bl,80h - jz .notupperkey - xor bl,bl - add byte[HoldKeyBuf+eax],-80h - jmp .yesupperkey -.notupperkey - inc al - and al,0Fh - mov [Keybhead],al -.yesupperkey -; call getch - mov [wfkey],bl - popad - mov al,[wfkey] - ;mov ah,7 - ;int 21h - ; return key in al - ret - -SECTION .data -KeyConvTable: - db 255,27 ,'1','2','3','4','5','6' ; 00h - db '7','8','9','0','-','=',8 ,9 - db 'Q','W','E','R','T','Y','U','I' ; 10h - db 'O','P','[',']',13 ,255,'A','S' - db 'D','F','G','H','J','K','L',';' ; 20h - db 39 ,'`',255,'\','Z','X','C','V' - db 'B','N','M',',','.','/',255,'*' ; 30h - db 255,32 ,255,255,255,255,255,255 - db 255,255,255,255,255,255,255,255 ; 40h - db 200,201,202,203,204,205,206,207 - db 208,209,210,211,255,255,255,255 ; 50h -KeyConvTableS: - db 255,27 ,'!','@','#','$','%','^' ; 00h - db '&','*','(',')','_','+',8 ,9 - db 'Q','W','E','R','T','Y','U','I' ; 10h - db 'O','P','{','}',13 ,255,'A','S' - db 'D','F','G','H','J','K','L',':' ; 20h - db '"','~',255,'|','Z','X','C','V' - db 'B','N','M','<','>','?',255,'*' ; 30h - db 255,32 ,255,255,255,255,255,255 - db 255,255,255,255,255,255,255,255 ; 40h - db 200,201,202,203,204,205,206,207 - db 208,209,210,211,255,255,255,255 ; 50h -SECTION .text - -NEWSYM Get_Memfree - mov eax,02000000h -; mov ax,0500h -; mov edi,edx -; int 31h - ret - -NEWSYM Output_Text ; Output character (ah=02h) or string (ah=09h) - pushad - - ; This function usually displays an error message on-screen - cmp ah,02h - je .char - cmp ah,09h - je .string - ret -.char - push edx - call putchar - pop edx -; int 21h ; print dl - popad - ret -.string - pushad - call PrintStr ; print edx - popad - popad - ret - -NEWSYM InitPreGame ; Executes before starting/continuing a game - mov byte[pressed+1],2 - pushad - call Start60HZ - popad - - pushad - call initwinvideo - popad - - mov al,[GrayscaleMode] - cmp al,[V8Mode] - je .nochangemode - xor byte[V8Mode],1 - xor al,al -.nochangemode - - pushad - xor eax,eax - mov edi,[vidbufferofsb] - mov ecx,288*128 - rep stosd - popad - - pushad - call clearwin - popad - ret - - ; set up interrupt handler - ; get old handler pmode mode address - ; Process stuff such as sound init, interrupt initialization - ret - -NEWSYM SetupPreGame ; Executes after pre-game init, can execute multiple - ; times after a single InitPreGame - mov byte[pressed+1],2 - ret - - -NEWSYM DeInitPostGame ; Called after game is ended - pushad - call Stop60HZ - popad - ret - -; **************************** -; Video Stuff -; **************************** - -; ** init video mode functions ** -SECTION .data -NEWSYM firstvideo, dd 1 -SECTION .text - -NEWSYM initvideo ; Returns 1 in videotroub if trouble occurs - mov byte[res640],1 - mov byte[res480],1 - mov byte[cbitmode],1 - mov word[vesa2_x],512 - mov word[vesa2_y],480 - mov byte[vesa2_bits],16 - mov dword[vesa2_bits],16 - mov dword[vesa2_rpos],11 - mov dword[vesa2_gpos],5 - mov dword[vesa2_bpos],0 - mov byte[vesa2red10],0 - mov byte[vesa2_rposng],11 - mov byte[vesa2_gposng],5 - mov byte[vesa2_bposng],0 - mov dword[vesa2_clbitng],1111011111011110b - mov dword[vesa2_clbitng2],11110111110111101111011111011110b - mov dword[vesa2_clbitng2+4],11110111110111101111011111011110b - mov dword[vesa2_clbitng3],0111101111101111b - - pushad - call initwinvideo - popad - - movzx eax,byte[cvidmode] - cmp byte[GUIWFVID+eax],0 - je .prevwinmode - mov [PrevFSMode],al - jmp .doneprevmode -.prevwinmode - mov [PrevWinMode],al -.doneprevmode - - cmp dword[firstvideo],1 - je .skipinitgfx - pushad - call InitializeGfxStuff - popad - -.skipinitgfx - mov dword[firstvideo],0 - - pushad - call InitializeGfxStuff - popad - ret - -NEWSYM deinitvideo - ret - -; ** copy video mode functions ** -SECTION .data -NEWSYM converta, dd 0 - -SECTION .text -NEWSYM DrawScreen ; In-game screen render w/ triple buffer check - cmp dword[converta],1 - jne near .skipconv - pushad - mov dword[UnusedBit], 10000000000000001000000000000000b - mov dword[HalfTrans], 01111011110111100111101111011110b - mov dword[UnusedBitXor], 01111111111111110111111111111111b - mov dword[UnusedBit+4], 10000000000000001000000000000000b - mov dword[HalfTrans+4], 01111011110111100111101111011110b - mov dword[UnusedBitXor+4],01111111111111110111111111111111b - mov dword[HalfTransB], 00000100001000010000010000100001b - mov dword[HalfTransB+4], 00000100001000010000010000100001b - mov dword[HalfTransC], 01111011110111100111101111011110b - mov dword[HalfTransC+4], 01111011110111100111101111011110b - mov dword[ngrposng],10 - mov dword[nggposng],5 - mov dword[ngbposng],0 - - call ConvertToAFormat - - popad - -.skipconv - pushad - call drawscreenwin - popad - - ret -; jmp DosDrawScreen - -NEWSYM vidpastecopyscr ; GUI screen render - pushad - mov eax,[vidbuffer] - mov ecx,224*288 - mov edx,ecx - add ecx,-288 - dec edx -.loop - movzx ebx,byte[eax+edx] - mov bx,[GUICPC+ebx*2] - mov [eax+edx*2],bx - dec edx - dec ecx - jnz .loop - popad - jmp DrawScreen - -; ** Video Mode Variables ** -SECTION .data - -; Total Number of Video Modes -NEWSYM NumVideoModes, dd 43 - -; GUI Video Mode Names - Make sure that all names are of the same length -; and end with a NULL terminator -NEWSYM GUIVideoModeNames -db '256x224 R W',0 ;0 -db '256x224 R F',0 ;1 -db '512x448 R W',0 ;2 -db '512x448 DR W',0 ;3 -db '640x480 S W',0 ;4 -db '640x480 DS W',0 ;5 -db '640x480 DR F',0 ;6 -db '640x480 DS F',0 ;7 -db '640x480 S F',0 ;8 -db '768x672 R W',0 ;9 -db '768x672 DR W',0 ;10 -db '800x600 S W',0 ;11 -db '800x600 DS W',0 ;12 -db '800x600 S F',0 ;13 -db '800x600 DR F',0 ;14 -db '800x600 DS F',0 ;15 -db '1024x768 S W',0 ;16 -db '1024x768 DS W',0 ;17 -db '1024x768 S F',0 ;18 -db '1024x768 DR F',0 ;19 -db '1024x768 DS F',0 ;20 -db '1024x896 R W',0 ;21 -db '1024x896 DR W',0 ;22 -db '1280x960 S W',0 ;23 -db '1280x960 DS W',0 ;24 -db '1280x960 S F',0 ;25 -db '1280x960 DR F',0 ;26 -db '1280x960 DS F',0 ;27 -db '1280x1024 S W',0 ;28 -db '1280x1024 DS W',0 ;29 -db '1280x1024 S F',0 ;30 -db '1280x1024 DR F',0 ;31 -db '1280x1024 DS F',0 ;32 -db '1600x1200 S W',0 ;33 -db '1600x1200 DS W',0 ;34 -db '1600x1200 DR F',0 ;35 -db '1600x1200 DS F',0 ;36 -db '1600x1200 S F',0 ;37 -db 'CUSTOM D W',0 ;38 -db 'CUSTOM DS F',0 ;39 -db 'CUSTOM W',0 ;40 -db 'CUSTOM S F',0 ;41 -db 'CUSTOM DR F',0 ;42 - -; Video Mode Feature Availability (1 = Available, 0 = Not Available) -; Left side starts with Video Mode 0 -; 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 -NEWSYM GUIWFVID, db 0,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,1,0,1,1; Fullscreen -NEWSYM GUIDSIZE, db 0,0,0,1,0,1,1,1,0,0,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1; D Modes -NEWSYM GUISMODE, db 0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,1,0; Win Stretched Modes -NEWSYM GUIDSMODE, db 0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,0,0; Win D-Stretched Modes -NEWSYM GUIKEEP43, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,1,1,1,1,0; Keep 4:3 Ratio -NEWSYM GUIM7VID, db 0,0,0,1,0,1,1,1,0,0,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1; Hires Mode 7 -NEWSYM GUIHQ2X, db 0,0,0,1,0,1,1,1,0,0,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1; Hq2x Filter -NEWSYM GUIHQ3X, db 0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1; Hq3x Filter -NEWSYM GUIHQ4X, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1; Hq4x Filter -NEWSYM GUINTVID, db 0,0,0,0,0,1,1,1,0,0,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1; NTSC Filter - -SECTION .text - -; **************************** -; Input Device Stuff -; **************************** - -; Variables related to Input Device Routines: -; pl1selk,pl1startk,pl1upk,pl1downk,pl1leftk,pl1rightk,pl1Xk, -; pl1Ak,pl1Lk,pl1Yk,pl1Bk,pl1Rk -; (Change 1 to 2,3,4 for other players) -; Each of these variables contains the corresponding key pressed value -; for the key data -; pressed[] -; - This is an array of pressed/released data (bytes) where the -; corresponding key pressed value is used as the index. The value -; for each entry is 0 for released and 1 for pressed. Also, when -; writing keyboard data to this array, be sure to first check if -; the value of the array entry is 2 or not. If it is 2, do not write 1 -; to that array entry. (however, you can write 0 to it) -; As an example, to access Player 1 L button press data, it is -; done like : pressed[pl1Lk] -; The 3 character key description of that array entry is accessed by the -; GUI through ScanCodeListing[pl1Lk*3] - -; Note: When storing the input device configuration of a dynamic input -; device system (ie. Win9x) rather than a static system (ie. Dos), it -; is best to store in the name of the device and relative button -; assignments in the configuration file, then convert it to ZSNES' -; numerical corresponding key format after reading from it. And then -; convert it back when writing to it back. - -NEWSYM UpdateDevices ; One-time input device init - call WinUpdateDevices - ret - -NEWSYM JoyRead - pushad - call UpdateVFrame - popad - ret - -SECTION .data - -; Total Number of Input Devices -NEWSYM NumInputDevices, dd 2 - -; Input Device Names -NEWSYM GUIInputNames -db 'NONE ',0 -db 'KEYBOARD/GAMEPAD',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 -db ' ',0 - -; GUI Description codes for each corresponding key pressed value -NEWSYM ScanCodeListing - db '---','ESC',' 1 ',' 2 ',' 3 ',' 4 ',' 5 ',' 6 ' ; 00h - db ' 7 ',' 8 ',' 9 ',' 0 ',' - ',' = ','BKS','TAB' - db ' Q ',' W ',' E ',' R ',' T ',' Y ',' U ',' I ' ; 10h - db ' O ',' P ',' [ ',' ] ','RET','LCT',' A ',' S ' - db ' D ',' F ',' G ',' H ',' J ',' K ',' L ',' : ' ; 20h - db ' " ',' ~ ','LSH',' \ ',' Z ',' X ',' C ',' V ' - db ' B ',' N ',' M ',' , ',' . ',' / ','RSH',' * ' ; 30h - db 'LAL','SPC','CAP','F1 ','F2 ','F3 ','F4 ','F5 ' - db 'F6 ','F7 ','F8 ','F9 ','F10','NUM','SCR','KP7' ; 40h - db 'KP8','KP9','KP-','KP4','KP5','KP6','KP+','KP1' - db 'KP2','KP3','KP0','KP.',' ',' ','OEM','F11' ; 50h - db 'F12','59H','5AH','5BH','5CH','5DH','5EH','5FH' - db '60H','61H','62H','63H','64H','65H','66H','67H' ; 60h - db '68H','69H','6AH','6BH','6CH','6DH','6EH','6FH' - db '70H','71H','72H','73H','74H','75H','76H','77H' ; 70h - db '78H','79H','7AH','7BH','7CH','7DH','7EH','7FH' - ; Keyboard continued (Direct Input) - db '80H','81H','82H','83H','84H','85H','86H','87H' ; 80h - db '88H','89H','8AH','8BH','8CH','8DH','8EH','8FH' - db '90H','91H','92H','93H','94H','95H','96H','97H' ; 90h - db '98H','99H','9AH','9BH','9CH','9DH','9EH','9FH' - db 'A0H','A1H','A2H','A3H','A4H','A5H','A6H','A7H' ; A0h - db 'A8H','A9H','AAH','ABH','ACH','ADH','AEH','AFH' - db 'B0H','B1H','B2H','B3H','B4H','B5H','B6H','B7H' ; B0h - db 'B8H','B9H','BAH','BBH','BCH','BDH','BEH','BFH' - db 'C0H','C1H','C2H','C3H','C4H','C5H','C6H','C7H' ; C0h - db 'C8H','C9H','CAH','CBH','CCH','CDH','CEH','CFH' - db 'D0H','D1H','D2H','D3H','D4H','D5H','D6H','D7H' ; D0h - db 'D8H','D9H','DAH','DBH','DCH','DDH','DEH','DFH' - db 'E0H','E1H','E2H','E3H','E4H','E5H','E6H','E7H' ; E0h - db 'E8H','E9H','EAH','EBH','ECH','EDH','EEH','EFH' - db 'F0H','F1H','F2H','F3H','F4H','F5H','F6H','F7H' ; F0h - db 'F8H','F9H','FAH','FBH','FCH','FDH','FEH','FFH' - ; Joystick Stuff (Direct Input) - db 'J00','J01','J02','J03','J04','J05','J06','J07' - db 'J08','J09','J0A','J0B','J0C','J0D','J0E','J0F' - db 'J10','J11','J12','J13','J14','J15','J16','J17' - db 'J18','J19','J1A','J1B','J1C','J1D','J1E','J1F' - db 'J20','J21','J22','J23','J24','J25','J26','J27' - db 'J28','J29','J2A','J2B','J2C','J2D','J2E','J2F' - db 'J30','J31','J32','J33','J34','J35','J36','J37' - db 'J38','J39','J3A','J3B','J3C','J3D','J3E','J3F' - db 'J40','J41','J42','J43','J44','J45','J46','J47' - db 'J48','J49','J4A','J4B','J4C','J4D','J4E','J4F' - db 'J50','J51','J52','J53','J54','J55','J56','J57' - db 'J58','J59','J5A','J5B','J5C','J5D','J5E','J5F' - db 'J60','J61','J62','J63','J64','J65','J66','J67' - db 'J68','J69','J6A','J6B','J6C','J6D','J6E','J6F' - db 'J70','J71','J72','J73','J74','J75','J76','J77' - db 'J78','J79','J7A','J7B','J7C','J7D','J7E','J7F' - ; Extra Stuff (180h) (Parallel Port) - db 'PPB','PPY','PSL','PST','PUP','PDN','PLT','PRT' - db 'PPA','PPX','PPL','PPR',' ',' ',' ',' ' - db 'P2B','P2Y','P2S','P2T','P2U','P2D','P2L','P2R' - db 'P2A','P2X','P2L','P2R',' ',' ',' ',' ' - db 'PPB','PPY','PSL','PST','PUP','PDN','PLT','PRT' - db 'PPA','PPX','PPL','PPR',' ',' ',' ',' ' - db 'P2B','P2Y','P2S','P2T','P2U','P2D','P2L','P2R' - db 'P2A','P2X','P2L','P2R',' ',' ',' ',' ' - -SECTION .text - -; **************************** -; Mouse Stuff -; **************************** - -NEWSYM Init_Mouse - ; return non-zero if successful - mov eax,01h - ret - -SECTION .data -NEWSYM WMouseX, dd 0 -NEWSYM WMouseY, dd 0 -NEWSYM WMouseMoveX, dd 0 -NEWSYM WMouseMoveY, dd 0 -NEWSYM WMouseButton, dd 0 - -SECTION .text - -NEWSYM Get_MouseData ; Returns both pressed and coordinates - ; bx : bit 0 = left button, bit 1 = right button - ; cx = Mouse X Position, dx = Mouse Y Position - pushad - call GetMouseX - mov [WMouseX],eax - call GetMouseY - mov [WMouseY],eax - call GetMouseButton - mov [WMouseButton],eax - popad - mov cx,[WMouseX] - mov dx,[WMouseY] - mov bx,[WMouseButton] - ret - -NEWSYM Set_MouseXMax ; Sets the X boundaries (ecx = left, edx = right) - pushad - push ecx - call SetMouseMinX - pop ecx - push edx - call SetMouseMaxX - pop edx - popad - ret - -NEWSYM Set_MouseYMax ; Sets the Y boundaries (ecx = left, edx = right) - pushad - push ecx - call SetMouseMinY - pop ecx - push edx - call SetMouseMaxY - pop edx - popad - ret - -NEWSYM Set_MousePosition ; Sets Mouse Position (x:cx,y:dx) - pushad - push ecx - call SetMouseX - pop ecx - push edx - call SetMouseY - pop edx - popad - ret - -NEWSYM Get_MousePositionDisplacement - ; returns x,y displacement in pixel in cx,dx - pushad - call GetMouseMoveX - mov [WMouseMoveX],eax - call GetMouseMoveY - mov [WMouseMoveY],eax - popad - mov cx,[WMouseMoveX] - mov dx,[WMouseMoveY] - ret - -NEWSYM MouseWindow - pushad - or byte[MouseButton],2 - mov byte[T36HZEnabled],1 - call GetMouseButton - and byte[MouseButton],0FDh - popad - ret - -NEWSYM GUIInit - pushad - call Start36HZ - popad - ret - -NEWSYM GUIDeInit - pushad - call Stop36HZ - popad - ret - -; **************************** -; Sound Stuff -; **************************** - -NEWSYM StopSound - call Start36HZ - call JoyRead - ret - -NEWSYM StartSound - call Start60HZ - call JoyRead - ret - - -NEWSYM SoundProcess ; This function is called ~60 times/s at full speed - cmp byte[soundon],0 - je .nosound - cmp byte[DSPDisable],1 - je .nosound - mov eax,256 ; Size - mov [BufferSizeB],eax - add eax,eax - mov [BufferSizeW],eax - pushad - call ProcessSoundBuffer - popad - ; DSPBuffer should contain the processed buffer in the specified size - ; You will have to convert/clip it to 16-bit for actual sound process -.nosound - ret - -section .data -NEWSYM delayvalue, dd 0 - -section .text - -NEWSYM delay - mov [delayvalue],ecx - pushad - call DoSleep - popad - ret - -NEWSYM Check60hz - ; Call the timer update function here - pushad - call CheckTimers - call FrameSemaphore - popad - ret - -SECTION .data -BitPosR db 11 -BitPosG db 5 -BitPosB db 0 -BitSizeR db 5 -BitSizeG db 6 -BitSizeB db 5 -SECTION .text - -InitializeGfxStuff: - ; Process Red Stuff - mov al,[BitPosR] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[BitSizeR],6 - jne .no6bit - mov [vesa2_usbit],bx - inc al -.no6bit - or [vesa2_clbit],bx - mov [vesa2_rpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrr - shl bx,cl - jmp .shlr -.shrr - shr bx,1 -.shlr - mov [vesa2_rfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_rtrcl],bx - xor bx,0FFFFh - mov [vesa2_rtrcla],bx - - ; Process Green Stuff - mov al,[BitPosG] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[BitSizeG],6 - jne .no6bitb - mov [vesa2_usbit],bx - inc al -.no6bitb - or [vesa2_clbit],bx - mov [vesa2_gpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrg - shl bx,cl - jmp .shlg -.shrg - shr bx,1 -.shlg - mov [vesa2_gfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_gtrcl],bx - xor bx,0FFFFh - mov [vesa2_gtrcla],bx - - ; Process Blue Stuff - mov al,[BitPosB] - mov cl,al - mov bx,1 - shl bx,cl - cmp byte[BitSizeB],6 - jne .no6bitc - mov [vesa2_usbit],bx - inc al -.no6bitc - or [vesa2_clbit],bx - mov [vesa2_bpos],al - dec al - mov cl,al - mov bx,001Fh - cmp cl,0FFh - je .shrb - shl bx,cl - jmp .shlb -.shrb - shr bx,1 -.shlb - mov [vesa2_bfull],bx - add al,5 - mov bx,1 - mov cl,al - shl bx,cl - mov [vesa2_btrcl],bx - xor bx,0FFFFh - mov [vesa2_btrcla],bx - - xor word[vesa2_clbit],0FFFFh - call genfulladdtab - cmp byte[converta],1 - je .red10 - mov eax,565 - jmp .red11 -.red10 - mov eax,555 -.red11 - push eax - call Init_2xSaIMMXW - pop eax - - ret - -%macro SetDefaultKey2 13 - mov dword[%1upk],%4 ; Up - mov dword[%1downk],%5 ; Down - mov dword[%1leftk],%6 ; Left - mov dword[%1rightk],%7 ; Right - mov dword[%1startk],%3 ; Start - mov dword[%1selk],%2 ; Select - mov dword[%1Ak],%9 ; A - mov dword[%1Bk],%12 ; B - mov dword[%1Xk],%8 ; X - mov dword[%1Yk],%11 ; Y - mov dword[%1Lk],%10 ; L - mov dword[%1Rk],%13 ; R -%endmacro - -%macro SetDefaultKey 12 - cmp bh,0 - jne %%nopl1 - SetDefaultKey2 pl1,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl1 - cmp bh,1 - jne %%nopl2 - SetDefaultKey2 pl2,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl2 - cmp bh,2 - jne %%nopl3 - SetDefaultKey2 pl3,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl3 - cmp bh,3 - jne %%nopl4 - SetDefaultKey2 pl4,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl4 - cmp bh,4 - jne %%nopl5 - SetDefaultKey2 pl5,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12 -%%nopl5 -%endmacro - -NEWSYM SetInputDevice - ; bl = device #, bh = player # (0-4) - ; Sets keys according to input device selected - cmp bl,0 - jne near .nozero - SetDefaultKey 0,0,0,0,0,0,0,0,0,0,0,0 - ret -.nozero - cmp bh,1 - je near .input2 - SetDefaultKey 54,28,200,208,203,205,31,45,32,30,44,46 - ret -.input2 - SetDefaultKey 56,29,36,50,49,51,210,199,201,211,207,209 - ret diff --git a/tools/zsnes/src/win/winlink.cpp b/tools/zsnes/src/win/winlink.cpp deleted file mode 100644 index bdb08b4..0000000 --- a/tools/zsnes/src/win/winlink.cpp +++ /dev/null @@ -1,3339 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 DIRECTINPUT_VERSION 0x0800 -#define DIRECTSOUND_VERSION 0x0800 - -extern "C" { - #include - #include - #include - #include - #include - #include -} -#include -#include -#include -#include -#include "resource.h" -#include "../cfg.h" -#include "../input.h" - - -/* -December 17 2004 -Nach - -I added some macros for inline assembly to keep compatibility between GCC and MSVC - -ASM_BEGIN is to start an assembly section -ASM_END is to end it - -ASM_COMMAND is for any simple command without a , in it example: dec eax -ASM_COMMAND2 is when a command has a , for example: add ebx, 5 -ASM_COMMAND3 is when the parameter after the , is a variable example: mov eax, my_variable - -ASM_CALL is for calling another function inside assembly section - -asm_call() can be treated like any C function, use it to call an assembly function - from any normal C code. -*/ - -#ifdef __GNUC__ //MinGW - -//Simple start and end structure, set as volatile so perhaps we can use -O1+ later -#define ASM_BEGIN asm volatile ( \ -ASM_COMMAND(pushad) -#define ASM_END ASM_COMMAND(popad) \ -); -//All commands need quotes and a newline and tab. C vars are _ prefixed -#define ASM_COMMAND(line) #line"\n\t" -#define ASM_COMMAND2(line, part2) #line", "#part2"\n\t" -#define ASM_COMMAND3(line, var) #line", _"#var"\n\t" -//Just for the prefix -#define ASM_CALL(func) ASM_COMMAND(call _ ## func) -//A function call is a simple register backup, call, restore -#define asm_call(func) ASM_BEGIN \ -ASM_COMMAND(pushad) \ -ASM_CALL(func) \ -ASM_COMMAND(popad) \ -ASM_END - -#else //MSVC - -#define ASM_BEGIN _asm { -#define ASM_END }; - -//MSVC is all straight foward about these -#define ASM_COMMAND(line) line -#define ASM_COMMAND2(line, part2) line, part2 -#define ASM_COMMAND3(line, var) ASM_COMMAND2(line, var) -//Next is not really special either -#define ASM_CALL(func) ASM_COMMAND(call func) -//Using this weird style because of MSVCs bad parsing -#define asm_call(func) { _asm pushad \ -_asm call func \ -_asm popad }; - -#endif - -DWORD WindowWidth = 256; -DWORD WindowHeight = 224; -DWORD FullScreen=0; -DWORD Moving=0; -DWORD SoundBufferSize=1024*18; -DWORD FirstSound=1; - -int SoundEnabled=1; -int UsePrimaryBuffer=0; - -DWORD FirstActivate = 1; - -#define BYTE unsigned char -#define WORD unsigned short -#define DWORD unsigned long - -HWND hMainWindow; -HANDLE debugWindow = 0; - -extern "C" -{ -HINSTANCE hInst; -} - -LPDIRECTSOUND8 lpDirectSound = NULL; -LPDIRECTSOUNDBUFFER8 lpSoundBuffer = NULL; -LPDIRECTSOUNDBUFFER lpPrimaryBuffer = NULL; -DSBUFFERDESC dsbd; - -LPVOID lpvPtr1; -DWORD dwBytes1; -LPVOID lpvPtr2; -DWORD dwBytes2; - -LPDIRECTDRAW BasiclpDD = NULL; - -LPDIRECTDRAW7 lpDD = NULL; -LPDIRECTDRAWSURFACE7 DD_Primary = NULL; -LPDIRECTDRAWSURFACE7 DD_CFB = NULL; -LPDIRECTDRAWSURFACE7 DD_CFB16 = NULL; -LPDIRECTDRAWSURFACE7 DD_BackBuffer = NULL; -LPDIRECTDRAWCLIPPER lpDDClipper = NULL; -RECT rcWindow; - -LPDIRECTINPUT8 DInput = NULL; -LPDIRECTINPUTDEVICE8 MouseInput = NULL; -LPDIRECTINPUTDEVICE8 KeyboardInput = NULL; -LPDIRECTINPUTDEVICE8 JoystickInput[5]; -DIJOYSTATE js[5]; - -DWORD X1Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD X2Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD Y1Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD Y2Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD Z1Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD Z2Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD RX1Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD RX2Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD RY1Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD RY2Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD RZ1Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD RZ2Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD S01Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD S02Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD S11Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD S12Disable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD POVDisable[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD NumPOV[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -DWORD NumBTN[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - -DWORD CurrentJoy=0; - -DWORD BitDepth; -DWORD GBitMask; -BYTE BackColor=0; -DEVMODE mode; - -float MouseMinX=0; -float MouseMaxX=256; -float MouseMinY=0; -float MouseMaxY=223; -float MouseX; -float MouseY; -float MouseMoveX; -float MouseMoveY; -BYTE MouseButtonPressed; - -BYTE IsActivated=1; - -WORD PrevRes=0; -RECT BlitArea; -BYTE AltSurface=0; -extern "C" { -DWORD MouseButton; -DWORD SurfaceX=0; -DWORD SurfaceY=0; -} - -HANDLE hLock, hThread; -DWORD dwThreadId, dwThreadParam, semaphore_run; - -extern "C" { -int SemaphoreMax = 5; -void InitSemaphore(); -void ShutdownSemaphore(); -void DisplayWIPDisclaimer(); -void InitDebugger(); - -void Clear2xSaIBuffer(); -void clear_display(); -} -static char dinput8_dll[] = {"dinput8.dll\0"}; -static char dinput8_imp[] = {"DirectInput8Create\0"}; - -static char ddraw_dll[] = {"ddraw.dll\0"}; -static char ddraw_imp[] = {"DirectDrawCreateEx\0"}; - -static char dsound_dll[] = {"dsound.dll\0"}; -static char dsound_imp[] = {"DirectSoundCreate8\0"}; - -static HMODULE hM_ddraw = NULL, hM_dsound = NULL,hM_dinput8 = NULL; - -typedef HRESULT (WINAPI* lpDirectInput8Create)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); -static lpDirectInput8Create pDirectInput8Create; - -typedef HRESULT (WINAPI* lpDirectDrawCreateEx)( GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid,IUnknown FAR *pUnkOuter ); -static lpDirectDrawCreateEx pDirectDrawCreateEx; - -typedef HRESULT (WINAPI* lpDirectSoundCreate8)(LPCGUID pcGuidDevice, LPDIRECTSOUND8 *ppDS8, LPUNKNOWN pUnkOuter); -static lpDirectSoundCreate8 pDirectSoundCreate8; - -extern "C" void FreeDirectX() -{ - FreeLibrary(hM_dsound); - FreeLibrary(hM_ddraw); - FreeLibrary(hM_dinput8); - exit(0); -} - -extern "C" void DXLoadError() -{ - if (MessageBox(NULL, "Sorry, you need to install or reinstall DirectX v8.0 or higher\nto use ZSNESW.\nWould you like to go to the DirectX homepage?", "Error", MB_ICONINFORMATION | MB_YESNO) == IDYES) - { - ShellExecute(NULL, NULL, "http://www.microsoft.com/directx/", NULL, NULL, 0); - } - FreeDirectX(); -} - -extern "C" void ImportDirectX() -{ - hM_dinput8 = LoadLibrary(dinput8_dll); - - if (hM_dinput8 == NULL) - { - DXLoadError(); - } - - pDirectInput8Create = (lpDirectInput8Create) GetProcAddress(hM_dinput8, dinput8_imp); - - if (pDirectInput8Create == NULL) - { - char err[256]; - wsprintf(err,"Failed to import %s:%s", dinput8_dll, dinput8_imp); - MessageBox(NULL, err, "Error", MB_ICONERROR); - DXLoadError(); - } - - hM_ddraw = LoadLibrary(ddraw_dll); - - if (hM_ddraw == NULL) - { - char err[256]; - wsprintf(err,"Failed to import %s",ddraw_dll); - MessageBox(NULL, err,"Error",MB_ICONERROR); - DXLoadError(); - } - - pDirectDrawCreateEx = (lpDirectDrawCreateEx) GetProcAddress(hM_ddraw, ddraw_imp); - - if (pDirectDrawCreateEx == NULL) - { - char err[256]; - wsprintf(err,"Failed to import %s:%s", ddraw_dll, ddraw_imp); - MessageBox(NULL, err, "Error", MB_ICONERROR); - DXLoadError(); - } - - hM_dsound = LoadLibrary(dsound_dll); - - if (hM_dsound == NULL) - { - char err[256]; - wsprintf(err,"Failed to import %s",dsound_dll); - MessageBox(NULL, err,"Error",MB_ICONERROR); - DXLoadError(); - } - - pDirectSoundCreate8 = (lpDirectSoundCreate8) GetProcAddress(hM_dsound, dsound_imp); - - if (pDirectSoundCreate8 == NULL) - { - char err[256]; - wsprintf(err,"Failed to import %s:%s", dsound_dll, dsound_imp); - MessageBox(NULL, err, "Error", MB_ICONERROR); - DXLoadError(); - } -} - -// milliseconds per world update -#define UPDATE_TICKS_GAME (1000.0/59.948743718592964824120603015060) -#define UPDATE_TICKS_GAMEPAL (20.0) -#define UPDATE_TICKS_GUI (1000.0/36.0) -#define UPDATE_TICKS_UDP (1000.0/60.0) - -double start, end, freq, update_ticks_pc, start2, end2, update_ticks_pc2; - -void ReleaseDirectDraw(); -void ReleaseDirectSound(); -void ReleaseDirectInput(); -int InitDirectDraw(); -int ReInitSound(); - -extern "C" -{ - void drawscreenwin(void); - DWORD LastUsedPos=0; - DWORD CurMode=~0; - void reInitSound() - { - ReInitSound(); - } -} - -void DDrawError(){ - char message1[256]; - - sprintf(message1,"Error drawing to the screen\nMake sure the device is not being used by another process "); - MessageBox (NULL, message1, "DirectDraw Error" , MB_ICONERROR ); -} - -extern "C" BYTE curblank; -extern "C" WORD totlines; - -void DrawScreen() -{ - if (FullScreen == 1) - { - if (TripleBufferWin == 1 || KitchenSync == 1 || (KitchenSyncPAL == 1 && totlines == 314)) - { - if (DD_BackBuffer->Blt(&rcWindow, DD_CFB, &BlitArea, DDBLT_WAIT, NULL) == DDERR_SURFACELOST) - DD_Primary->Restore(); - - if (DD_Primary->Flip(NULL, DDFLIP_WAIT) == DDERR_SURFACELOST) - DD_Primary->Restore(); - - if (KitchenSync == 1 || (KitchenSyncPAL == 1 && totlines == 314)) - { - if (DD_BackBuffer->Blt(&rcWindow, DD_CFB, &BlitArea, DDBLT_WAIT, NULL) == DDERR_SURFACELOST) - DD_Primary->Restore(); - - if (DD_Primary->Flip(NULL, DDFLIP_WAIT) == DDERR_SURFACELOST) - DD_Primary->Restore(); - } - } - else - { - if (vsyncon == 1 && curblank != 0x40) - { - if (lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL) != DD_OK) - { - DDrawError(); - } - } - DD_Primary->Blt(&rcWindow, DD_CFB, &BlitArea, DDBLT_WAIT, NULL); - DD_Primary->Restore(); - } - } - else - { - if (vsyncon == 1) - { - if (lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL) != DD_OK) - { - DDrawError(); - } - } - DD_Primary->Blt(&rcWindow, AltSurface == 0 ? DD_CFB : DD_CFB16, &BlitArea, DDBLT_WAIT, NULL); - } -} - -extern "C" { -void MultiMouseInit(); -void MultiMouseShutdown(); -extern BYTE device1,device2; -extern BYTE GUIOn; -extern BYTE GUIOn2; -DWORD InputEn=0; -} - -BOOL InputAcquire(void) -{ - if (JoystickInput[0]) JoystickInput[0]->Acquire(); - if (JoystickInput[1]) JoystickInput[1]->Acquire(); - if (JoystickInput[2]) JoystickInput[2]->Acquire(); - if (JoystickInput[3]) JoystickInput[3]->Acquire(); - if (JoystickInput[4]) JoystickInput[4]->Acquire(); - if (device1 && device2 && !GUIOn2) MultiMouseInit(); - else if (MouseInput && GUIOn2) MouseInput->Acquire(); - if (KeyboardInput) KeyboardInput->Acquire(); - InputEn = 1; - return TRUE; -} - -BOOL InputDeAcquire(void) -{ - - if (KeyboardInput) KeyboardInput->Unacquire(); - if (JoystickInput[0]) JoystickInput[0]->Unacquire(); - if (JoystickInput[1]) JoystickInput[1]->Unacquire(); - if (JoystickInput[2]) JoystickInput[2]->Unacquire(); - if (JoystickInput[3]) JoystickInput[3]->Unacquire(); - if (JoystickInput[4]) JoystickInput[4]->Unacquire(); - if (device1 && device2 && !GUIOn2) MultiMouseShutdown(); - else if (MouseInput) MouseInput->Unacquire(); - InputEn = 0; - return TRUE; -} - -extern "C" { -void initwinvideo(); -void DosExit(void); -extern BYTE EMUPause; -extern int CurKeyPos; -extern int CurKeyReadPos; -extern int KeyBuffer[16]; -extern BYTE debugger; -} - -extern "C" void CheckPriority() -{ - if (HighPriority == 1) - { - if(!SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS)) - SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); - } - else - { - SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); - } -} - -extern "C" void CheckAlwaysOnTop() -{ - if (AlwaysOnTop == 1) SetWindowPos(hMainWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - else SetWindowPos(hMainWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); -} - -extern "C" void CheckScreenSaver() -{ - if (DisableScreenSaver == 1 && IsActivated == 1) - { - SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, 0, SPIF_SENDCHANGE); - SystemParametersInfo(SPI_SETLOWPOWERACTIVE, FALSE, 0, SPIF_SENDCHANGE); - SystemParametersInfo(SPI_SETPOWEROFFACTIVE, FALSE, 0, SPIF_SENDCHANGE); - } - else - { - SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, 0, SPIF_SENDCHANGE); - SystemParametersInfo(SPI_SETLOWPOWERACTIVE, TRUE, 0, SPIF_SENDCHANGE); - SystemParametersInfo(SPI_SETPOWEROFFACTIVE, TRUE, 0, SPIF_SENDCHANGE); - } -} - -extern "C" void MinimizeWindow() -{ - ShowWindow(hMainWindow, SW_MINIMIZE); - IsActivated = 0; -} - -BOOL InputRead(void) -{ - static int PrevZ=0; - MouseMoveX=0; - MouseMoveY=0; - if (MouseInput&&InputEn==1) - { - DIMOUSESTATE dims; - HRESULT hr; - hr=MouseInput->GetDeviceState(sizeof(DIMOUSESTATE),&dims); - - if (SUCCEEDED(hr)) - { - MouseMoveX=(float)dims.lX; - MouseMoveY=(float)dims.lY; - - if (MouseWheel == 1) - { - long zDelta = dims.lZ-PrevZ; - if (!dims.lZ) zDelta=0; - while (zDelta>0){ - zDelta-=40; - if (!((CurKeyPos+1==CurKeyReadPos) || ((CurKeyPos+1==16) - && (CurKeyReadPos==0)))){ - KeyBuffer[CurKeyPos]=72+256; - CurKeyPos++; - if (CurKeyPos==16) CurKeyPos=0; - } - } - while (zDelta<0){ - zDelta+=40; - if (!((CurKeyPos+1==CurKeyReadPos) || ((CurKeyPos+1==16) - && (CurKeyReadPos==0)))){ - KeyBuffer[CurKeyPos]=80+256; - CurKeyPos++; - if (CurKeyPos==16) CurKeyPos=0; - } - } - PrevZ=dims.lZ; - } - - MouseButton=(dims.rgbButtons[0]>>7)|(dims.rgbButtons[1]>>6)|(dims.rgbButtons[2]>>5)|(dims.rgbButtons[3]>>4); - } - else return FALSE; - } - return TRUE; -} - -void ExitFunction() -{ - // We need to clean up the debug window if it's running - - if (debugWindow) FreeConsole(); - - IsActivated = 0; - CheckScreenSaver(); - ReleaseDirectInput(); - ReleaseDirectSound(); - ReleaseDirectDraw(); - FreeLibrary(hM_dsound); - FreeLibrary(hM_ddraw); - FreeLibrary(hM_dinput8); - DestroyWindow(hMainWindow); -} - -extern "C" { bool ctrlptr = false; } - -LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - static bool shiftpr; - bool accept; - int vkeyval = 0; - - switch (uMsg) - { - case WM_KEYDOWN: // sent when user presses a key - if (!((CurKeyPos+1==CurKeyReadPos) || ((CurKeyPos+1==16) - && (CurKeyReadPos==0)))){ - accept=false; - - if (wParam==16) - shiftpr=true; - else if (wParam==17) - ctrlptr=true; - if (((wParam>='A') && (wParam<='Z')) || - ((wParam>='a') && (wParam<='z')) || (wParam==27) || - (wParam==32) || (wParam==8) || (wParam==13) || (wParam==9)) { - accept=true; vkeyval=wParam; - } - if ((wParam>='0') && (wParam<='9')) { - accept=true; vkeyval=wParam; - if (shiftpr) { - switch (wParam) { - case '1': vkeyval='!'; break; - case '2': vkeyval='@'; break; - case '3': vkeyval='#'; break; - case '4': vkeyval='$'; break; - case '5': vkeyval='%'; break; - case '6': vkeyval='^'; break; - case '7': vkeyval='&'; break; - case '8': vkeyval='*'; break; - case '9': vkeyval='('; break; - case '0': vkeyval=')'; break; - } - } - } - if ((wParam>=VK_NUMPAD0) && (wParam<=VK_NUMPAD9)) { - accept=true; vkeyval=wParam-VK_NUMPAD0+'0'; - } - if (!shiftpr){ - switch (wParam) { - case 189: vkeyval='-'; accept=true; break; - case 187: vkeyval='='; accept=true; break; - case 219: vkeyval='['; accept=true; break; - case 221: vkeyval=']'; accept=true; break; - case 186: vkeyval=';'; accept=true; break; - case 222: vkeyval=39; accept=true; break; - case 188: vkeyval=','; accept=true; break; - case 190: vkeyval='.'; accept=true; break; - case 191: vkeyval='/'; accept=true; break; - case 192: vkeyval='`'; accept=true; break; - case 220: vkeyval=92; accept=true; break; - } - } else { - switch (wParam) { - case 189: vkeyval='_'; accept=true; break; - case 187: vkeyval='+'; accept=true; break; - case 219: vkeyval='{'; accept=true; break; - case 221: vkeyval='}'; accept=true; break; - case 186: vkeyval=':'; accept=true; break; - case 222: vkeyval='"'; accept=true; break; - case 188: vkeyval='<'; accept=true; break; - case 190: vkeyval='>'; accept=true; break; - case 191: vkeyval='?'; accept=true; break; - case 192: vkeyval='~'; accept=true; break; - case 220: vkeyval='|'; accept=true; break; - } - } - switch (wParam) { - case 33: vkeyval=256+73; accept=true; break; - case 38: vkeyval=256+72; accept=true; break; - case 36: vkeyval=256+71; accept=true; break; - case 39: vkeyval=256+77; accept=true; break; - case 12: vkeyval=256+76; accept=true; break; - case 37: vkeyval=256+75; accept=true; break; - case 34: vkeyval=256+81; accept=true; break; - case 40: vkeyval=256+80; accept=true; break; - case 35: vkeyval=256+79; accept=true; break; - case 107: vkeyval='+'; accept=true; break; - case 109: vkeyval='-'; accept=true; break; - case 106: vkeyval='*'; accept=true; break; - case 111: vkeyval='/'; accept=true; break; - case 110: vkeyval='.'; accept=true; break; - } - if (accept){ - KeyBuffer[CurKeyPos]=vkeyval; - CurKeyPos++; - if (CurKeyPos==16) CurKeyPos=0; - } - } - break; - case WM_KEYUP: // sent when user releases a key - if (wParam==16) shiftpr=false; - else if (wParam==17) ctrlptr=false; - break; - case WM_MOUSEMOVE: - if (MouseInput && GUIOn2) MouseInput->Acquire(); - break; - case WM_MOVE: - break; - case WM_PAINT: - ValidateRect(hWnd,NULL); - break; - case WM_ACTIVATE: - if (LOWORD(wParam) != WA_INACTIVE) - { - IsActivated = 1; - if (FirstActivate == 0) initwinvideo(); - if (PauseFocusChange) EMUPause = 0; - InputAcquire(); - if (FirstActivate == 1) FirstActivate = 0; - if (FullScreen == 1) Clear2xSaIBuffer(); - CheckPriority(); - CheckScreenSaver(); - } - if (LOWORD(wParam) == WA_INACTIVE) - { - IsActivated = 0; - if (PauseFocusChange) EMUPause = 1; - InputDeAcquire(); - if (GUIOn || GUIOn2 || EMUPause) SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); - CheckScreenSaver(); - } - break; - case WM_SETFOCUS: - if (FullScreen == 0) ShowWindow(hMainWindow, SW_SHOWNORMAL); - CheckPriority(); - CheckScreenSaver(); - InputAcquire(); - break; - case WM_KILLFOCUS: - InputDeAcquire(); - IsActivated = 0; - if (GUIOn || GUIOn2 || EMUPause) SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); - CheckScreenSaver(); - break; - case WM_DESTROY: - break; - case WM_CLOSE: - break; - } - return DefWindowProc(hWnd,uMsg,wParam,lParam);; -} - -int RegisterWinClass(void) -{ - if (AllowMultipleInst == 0) - { - HWND hFindWindow; - hFindWindow = FindWindow("ZSNES", NULL); - - if (hFindWindow != NULL) - { - ShowWindow(hFindWindow, SW_SHOWNORMAL); - SetForegroundWindow(hFindWindow); - DosExit(); - } - } - - WNDCLASS wcl; - - wcl.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW | CS_NOCLOSE; - wcl.cbClsExtra = 0; - wcl.cbWndExtra = 0; - wcl.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_ICON1)); - wcl.hCursor = NULL; - wcl.hInstance = hInst; - wcl.lpfnWndProc = (WNDPROC)Main_Proc; - wcl.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wcl.lpszMenuName = NULL; - wcl.lpszClassName = "ZSNES"; - - if (RegisterClass(&wcl) == 0) return FALSE; - - return TRUE; -} - -BYTE PrevStereoSound; -DWORD PrevSoundQuality; - -BOOL InitSound() -{ - WAVEFORMATEX wfx; - DSBCAPS dsbcaps; - - SoundEnabled = 0; - - if (soundon == 0) return FALSE; - - PrevSoundQuality=SoundQuality; - PrevStereoSound=StereoSound; - - if (DS_OK == pDirectSoundCreate8(NULL, &lpDirectSound,NULL)) - { - lpDirectSound->Initialize(NULL); - - if (PrimaryBuffer) - { - if (DS_OK != lpDirectSound->SetCooperativeLevel(hMainWindow, DSSCL_WRITEPRIMARY)) - { - if (DS_OK != lpDirectSound->SetCooperativeLevel(hMainWindow, DSSCL_EXCLUSIVE)) - return FALSE; - } - else UsePrimaryBuffer=1; - } - else - { - if (DS_OK != lpDirectSound->SetCooperativeLevel(hMainWindow, DSSCL_NORMAL)) - { - if (DS_OK != lpDirectSound->SetCooperativeLevel(hMainWindow, DSSCL_EXCLUSIVE)) - return FALSE; - } - else UsePrimaryBuffer=0; - } - } - else - { - return FALSE; - } - - wfx.wFormatTag = WAVE_FORMAT_PCM; - - switch (SoundQuality) - { - case 0: - wfx.nSamplesPerSec = 8000; - SoundBufferSize=1024*2; - break; - case 1: - wfx.nSamplesPerSec = 11025; - SoundBufferSize=1024*2; - break; - case 2: - wfx.nSamplesPerSec = 22050; - SoundBufferSize=1024*4; - break; - case 3: - wfx.nSamplesPerSec = 44100; - SoundBufferSize=1024*8; - break; - case 4: - wfx.nSamplesPerSec = 16000; - SoundBufferSize=1024*4; - break; - case 5: - wfx.nSamplesPerSec = 32000; - SoundBufferSize=1024*8; - break; - case 6: - wfx.nSamplesPerSec = 48000; - SoundBufferSize=1024*8; - break; - default: - wfx.nSamplesPerSec = 11025; - SoundBufferSize=1024*2; - } - - if (StereoSound==1) - { - wfx.nChannels = 2; - wfx.nBlockAlign = 4; - SoundBufferSize*=2; - } - else - { - wfx.nChannels = 1; - wfx.nBlockAlign = 2; - } - - wfx.wBitsPerSample = 16; - wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; - wfx.cbSize=0; - - memset(&dsbd, 0, sizeof(DSBUFFERDESC)); - dsbd.dwSize = sizeof(DSBUFFERDESC); - dsbd.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_STICKYFOCUS; - if(UsePrimaryBuffer) dsbd.dwFlags |= DSBCAPS_PRIMARYBUFFER; - dsbd.dwBufferBytes = UsePrimaryBuffer ? 0 : SoundBufferSize; - dsbd.lpwfxFormat = UsePrimaryBuffer ? NULL : &wfx; - - if (DS_OK == lpDirectSound->CreateSoundBuffer(&dsbd, &lpPrimaryBuffer, NULL)) - { - if(!UsePrimaryBuffer) - { - if (DS_OK == lpPrimaryBuffer->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID *) &lpSoundBuffer)) - { - if (DS_OK != lpSoundBuffer->Play(0,0,DSBPLAY_LOOPING)) - { - return FALSE; - } - } - else return FALSE; - } - else - { - lpPrimaryBuffer->SetFormat(&wfx); - dsbcaps.dwSize=sizeof(DSBCAPS); - lpPrimaryBuffer->GetCaps(&dsbcaps); - SoundBufferSize=dsbcaps.dwBufferBytes; - - if (DS_OK != lpPrimaryBuffer->Play(0,0,DSBPLAY_LOOPING)) - { - return FALSE; - } - } - - SoundEnabled=1; - FirstSound=0; - return TRUE; - } - else - { - return FALSE; - } -} - -BOOL ReInitSound() -{ - WAVEFORMATEX wfx; - DSBCAPS dsbcaps; - - if (lpSoundBuffer) - { - lpSoundBuffer->Stop(); - lpSoundBuffer->Release(); - lpSoundBuffer = NULL; - } - - if (lpPrimaryBuffer) - { - lpPrimaryBuffer->Stop(); - lpPrimaryBuffer->Release(); - lpPrimaryBuffer = NULL; - } - - if (soundon == 0) - { - SoundEnabled = 0; - ReleaseDirectSound(); - return FALSE; - } - else if (SoundEnabled == 0) - return InitSound(); - - SoundEnabled = 0; - - PrevSoundQuality=SoundQuality; - PrevStereoSound=StereoSound; - - wfx.wFormatTag = WAVE_FORMAT_PCM; - - switch (SoundQuality) - { - case 0: - wfx.nSamplesPerSec = 8000; - SoundBufferSize=1024*2; - break; - case 1: - wfx.nSamplesPerSec = 11025; - SoundBufferSize=1024*2; - break; - case 2: - wfx.nSamplesPerSec = 22050; - SoundBufferSize=1024*4; - break; - case 3: - wfx.nSamplesPerSec = 44100; - SoundBufferSize=1024*8; - break; - case 4: - wfx.nSamplesPerSec = 16000; - SoundBufferSize=1024*4; - break; - case 5: - wfx.nSamplesPerSec = 32000; - SoundBufferSize=1024*8; - break; - case 6: - wfx.nSamplesPerSec = 48000; - SoundBufferSize=1024*8; - break; - default: - wfx.nSamplesPerSec = 11025; - SoundBufferSize=1024*2; - } - - if (StereoSound==1) - { - wfx.nChannels = 2; - wfx.nBlockAlign = 4; - SoundBufferSize*=2; - } - else - { - wfx.nChannels = 1; - wfx.nBlockAlign = 2; - } - - wfx.wBitsPerSample = 16; - wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; - wfx.cbSize=0; - - memset(&dsbd, 0, sizeof(DSBUFFERDESC)); - dsbd.dwSize = sizeof(DSBUFFERDESC); - dsbd.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_STICKYFOCUS; - if(UsePrimaryBuffer) dsbd.dwFlags |= DSBCAPS_PRIMARYBUFFER; - dsbd.dwBufferBytes = UsePrimaryBuffer ? 0 : SoundBufferSize; - dsbd.lpwfxFormat = UsePrimaryBuffer ? NULL : &wfx; - - if (DS_OK == lpDirectSound->CreateSoundBuffer(&dsbd, &lpPrimaryBuffer, NULL)) - { - if(!UsePrimaryBuffer) - { - if (DS_OK == lpPrimaryBuffer->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID *) &lpSoundBuffer)) - { - if (DS_OK != lpSoundBuffer->Play(0,0,DSBPLAY_LOOPING)) - { - return FALSE; - } - } - else return FALSE; - } - else - { - lpPrimaryBuffer->SetFormat(&wfx); - dsbcaps.dwSize=sizeof(DSBCAPS); - lpPrimaryBuffer->GetCaps(&dsbcaps); - SoundBufferSize=dsbcaps.dwBufferBytes; - - if (DS_OK != lpPrimaryBuffer->Play(0,0,DSBPLAY_LOOPING)) - { - return FALSE; - } - } - - SoundEnabled=1; - FirstSound=0; - return TRUE; - } - else - { - return FALSE; - } -} - -BOOL FAR PASCAL InitJoystickInput(LPCDIDEVICEINSTANCE pdinst, LPVOID pvRef) -{ - LPDIRECTINPUT8 pdi = (LPDIRECTINPUT8)pvRef; - GUID DeviceGuid = pdinst->guidInstance; - - if (CurrentJoy>4) - return DIENUM_CONTINUE; - - // Create the DirectInput joystick device. - if (pdi->CreateDevice(DeviceGuid,&JoystickInput[CurrentJoy], NULL) != DI_OK) - { - return DIENUM_CONTINUE; - } - - if (JoystickInput[CurrentJoy]->SetDataFormat(&c_dfDIJoystick) != DI_OK) - { - JoystickInput[CurrentJoy]->Release(); - return DIENUM_CONTINUE; - } - - if (JoystickInput[CurrentJoy]->SetCooperativeLevel(hMainWindow, DISCL_EXCLUSIVE | DISCL_BACKGROUND) != DI_OK) - { - JoystickInput[CurrentJoy]->Release(); - return DIENUM_CONTINUE; - } - - DIPROPRANGE diprg; - - diprg.diph.dwSize = sizeof(diprg); - diprg.diph.dwHeaderSize = sizeof(diprg.diph); - diprg.diph.dwObj = DIJOFS_X; - diprg.diph.dwHow = DIPH_BYOFFSET; - diprg.lMin = joy_sensitivity*-1; - diprg.lMax = joy_sensitivity; - - if FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph)) - { - X1Disable[CurrentJoy]=1; - X2Disable[CurrentJoy]=1; - } - - diprg.diph.dwObj = DIJOFS_Y; - - if FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph)) - { - Y1Disable[CurrentJoy]=1; - Y2Disable[CurrentJoy]=1; - } - - diprg.diph.dwObj = DIJOFS_Z; - if (FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph))) - { - Z1Disable[CurrentJoy]=1; - Z2Disable[CurrentJoy]=1; - } - - diprg.diph.dwObj = DIJOFS_RX; - if (FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph))) - { - RX1Disable[CurrentJoy]=1; - RX2Disable[CurrentJoy]=1; - } - - diprg.diph.dwObj = DIJOFS_RY; - if (FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph))) - { - RY1Disable[CurrentJoy]=1; - RY2Disable[CurrentJoy]=1; - } - - diprg.diph.dwObj = DIJOFS_RZ; - if (FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph))) - { - RZ1Disable[CurrentJoy]=1; - RZ2Disable[CurrentJoy]=1; - } - - diprg.diph.dwObj = DIJOFS_SLIDER(0); - if (FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph))) - { - S01Disable[CurrentJoy]=1; - S02Disable[CurrentJoy]=1; - } - - diprg.diph.dwObj = DIJOFS_SLIDER(1); - if (FAILED(JoystickInput[CurrentJoy]->SetProperty(DIPROP_RANGE, &diprg.diph))) - { - S11Disable[CurrentJoy]=1; - S12Disable[CurrentJoy]=1; - } - - DIDEVCAPS didc; - - didc.dwSize = sizeof(DIDEVCAPS); - - if (JoystickInput[CurrentJoy]->GetCapabilities(&didc) != DI_OK) - { - JoystickInput[CurrentJoy]->Release(); - return DIENUM_CONTINUE; - } - - if (didc.dwButtons <= 16) - NumBTN[CurrentJoy] = didc.dwButtons; - else - NumBTN[CurrentJoy] = 16; - - if (didc.dwPOVs) - NumPOV[CurrentJoy] = didc.dwPOVs; - else - POVDisable[CurrentJoy] = 1; - - DIPROPDWORD dipdw; - - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(dipdw.diph); - dipdw.diph.dwHow = DIPH_BYOFFSET; - dipdw.dwData = 2500; - dipdw.diph.dwObj = DIJOFS_X; - JoystickInput[CurrentJoy]->SetProperty(DIPROP_DEADZONE, &dipdw.diph); - - dipdw.diph.dwObj = DIJOFS_Y; - JoystickInput[CurrentJoy]->SetProperty(DIPROP_DEADZONE, &dipdw.diph); - - dipdw.diph.dwObj = DIJOFS_Z; - JoystickInput[CurrentJoy]->SetProperty(DIPROP_DEADZONE, &dipdw.diph); - - dipdw.diph.dwObj = DIJOFS_RX; - JoystickInput[CurrentJoy]->SetProperty(DIPROP_DEADZONE, &dipdw.diph); - - dipdw.diph.dwObj = DIJOFS_RY; - JoystickInput[CurrentJoy]->SetProperty(DIPROP_DEADZONE, &dipdw.diph); - - dipdw.diph.dwObj = DIJOFS_RZ; - JoystickInput[CurrentJoy]->SetProperty(DIPROP_DEADZONE, &dipdw.diph); - - dipdw.diph.dwObj = DIJOFS_SLIDER(0); - JoystickInput[CurrentJoy]->SetProperty(DIPROP_DEADZONE, &dipdw.diph); - - dipdw.diph.dwObj = DIJOFS_SLIDER(1); - JoystickInput[CurrentJoy]->SetProperty(DIPROP_DEADZONE, &dipdw.diph); - - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(dipdw.diph); - dipdw.diph.dwHow = DIPH_DEVICE; - dipdw.dwData = DIPROPAXISMODE_ABS; - dipdw.diph.dwObj = 0; - - JoystickInput[CurrentJoy]->SetProperty(DIPROP_AXISMODE, &dipdw.diph); - - CurrentJoy+=1; - - return DIENUM_CONTINUE; -} - -void ReleaseDirectInput() -{ - if (MouseInput) - { - MouseInput->Release(); - MouseInput = NULL; - } - - if (KeyboardInput) - { - KeyboardInput->Release(); - KeyboardInput = NULL; - } - - for (int i=0; i<5; i++) - if (JoystickInput[i]) - { - JoystickInput[i]->Release(); - JoystickInput[i] = NULL; - } - - if (DInput) - { - DInput->Release(); - DInput = NULL; - } - -} - -void ReleaseDirectSound() -{ - if (lpSoundBuffer) - { - lpSoundBuffer->Release(); - lpSoundBuffer = NULL; - } - - if (lpPrimaryBuffer) - { - lpPrimaryBuffer->Release(); - lpPrimaryBuffer = NULL; - } - - if (lpDirectSound) - { - lpDirectSound->Release(); - lpDirectSound = NULL; - } -} - -void ReleaseDirectDraw() -{ - if (DD_CFB) - { - DD_CFB->Release(); - DD_CFB = NULL; - } - - if (DD_CFB16) - { - DD_CFB16->Release(); - DD_CFB16 = NULL; - } - - if (lpDDClipper) - { - lpDDClipper->Release(); - lpDDClipper = NULL; - } - - if (DD_Primary) - { - DD_Primary->Release(); - DD_Primary = NULL; - } - - if (lpDD) - { - lpDD->Release(); - lpDD = NULL; - } -} - -void DInputError(){ - char message1[256]; - - sprintf(message1,"Error initializing DirectInput\nYou may need to install DirectX 8.0a or higher located at www.microsoft.com/directx%c", 0); - MessageBox (NULL, message1, "DirectInput Error" , MB_ICONERROR ); -} - -bool InitInput() -{ - char message1[256]; - HRESULT hr; - - if (FAILED(hr=pDirectInput8Create(hInst,DIRECTINPUT_VERSION,IID_IDirectInput8A,(void **) &DInput,NULL))) - { - sprintf(message1,"Error initializing DirectInput\nYou may need to install DirectX 8.0a or higher located at www.microsoft.com/directx%c", 0); - MessageBox (NULL, message1, "DirectInput Error" , MB_ICONERROR ); - - switch (hr) - { - case DIERR_BETADIRECTINPUTVERSION: - sprintf(message1,"Beta %X\n",(unsigned int)hr); - MessageBox (NULL, message1, "Init", MB_ICONERROR ); - break; - case DIERR_INVALIDPARAM: - sprintf(message1,"Invalid %X\n",(unsigned int)hr); - MessageBox (NULL, message1, "Init", MB_ICONERROR ); - break; - case DIERR_OLDDIRECTINPUTVERSION: - sprintf(message1,"OLDDIRECTINPUTVERSION %X\n",(unsigned int)hr); - MessageBox (NULL, message1, "Init", MB_ICONERROR ); - break; - case DIERR_OUTOFMEMORY: - sprintf(message1,"OUTOFMEMORY %X\n",(unsigned int)hr); - MessageBox (NULL, message1, "Init", MB_ICONERROR ); - break; - default: - sprintf(message1,"UNKNOWN %X\n",(unsigned int)hr); - MessageBox (NULL, message1, "Init", MB_ICONERROR ); - break; - } - return FALSE; - } - - hr=DInput->CreateDevice(GUID_SysKeyboard, &KeyboardInput,NULL); - if (FAILED(hr)) {DInputError();return FALSE;} - - hr=KeyboardInput->SetDataFormat(&c_dfDIKeyboard); - if (FAILED(hr)) {DInputError();return FALSE;} - - hr=KeyboardInput->SetCooperativeLevel(hMainWindow,DISCL_NONEXCLUSIVE | DISCL_FOREGROUND ); - - hr=DInput->CreateDevice(GUID_SysMouse, &MouseInput,NULL); - if (FAILED(hr)) {DInputError();return FALSE;} - - hr=MouseInput->SetDataFormat(&c_dfDIMouse); - if (FAILED(hr)) {DInputError();return FALSE;} - - hr=MouseInput->SetCooperativeLevel(hMainWindow,DISCL_EXCLUSIVE|DISCL_FOREGROUND); - if (FAILED(hr)) {DInputError();return FALSE;} - - JoystickInput[0]=NULL;JoystickInput[1]=NULL;JoystickInput[2]=NULL;JoystickInput[3]=NULL;JoystickInput[4]=NULL; - - hr=DInput->EnumDevices(DI8DEVCLASS_GAMECTRL, InitJoystickInput, - DInput, DIEDFL_ATTACHEDONLY); - - if (FAILED(hr)) {DInputError(); return FALSE;} - - InputAcquire(); - - return TRUE; -} - -void TestJoy() -{ - int i; - - for(i=0;i<5;i++) - { - if (JoystickInput[i]) - { - JoystickInput[i]->Poll(); - - if (JoystickInput[i]->GetDeviceState(sizeof(DIJOYSTATE), &js[i])==DIERR_INPUTLOST) - { - if (JoystickInput[i]) JoystickInput[i]->Acquire(); - if (FAILED(JoystickInput[i]->GetDeviceState(sizeof(DIJOYSTATE), &js[i]))) return; - } - - if (!X1Disable[i]) - { - if (js[i].lX>0) X1Disable[i]=1; - } - - if (!X2Disable[i]) - { - if (js[i].lX<0) X2Disable[i]=1; - } - - if (!Y1Disable[i]) - { - if (js[i].lY>0) Y1Disable[i]=1; - } - - if (!Y2Disable[i]) - { - if (js[i].lY<0) Y2Disable[i]=1; - } - - if (!Z1Disable[i]) - { - if (js[i].lZ>0) Z1Disable[i]=1; - } - - if (!Z2Disable[i]) - { - if (js[i].lZ<0) Z2Disable[i]=1; - } - - if (!RY1Disable[i]) - { - if (js[i].lRy>0) RY1Disable[i]=1; - } - - if (!RY2Disable[i]) - { - if (js[i].lRy<0) RY2Disable[i]=1; - } - - if (!RZ1Disable[i]) - { - if (js[i].lRz>0) RZ1Disable[i]=1; - } - - if (!RZ2Disable[i]) - { - if (js[i].lRz<0) RZ2Disable[i]=1; - } - - if (!S01Disable[i]) - { - if (js[i].rglSlider[0]>0) S01Disable[i]=1; - } - - if (!S02Disable[i]) - { - if (js[i].rglSlider[0]<0) S02Disable[i]=1; - } - - if (!S11Disable[i]) - { - if (js[i].rglSlider[1]>0) S11Disable[i]=1; - } - - if (!S12Disable[i]) - { - if (js[i].rglSlider[1]<0) S12Disable[i]=1; - } - - } - } -} - -extern "C" { -BYTE changeRes=1; -extern DWORD converta; -extern unsigned int BitConv32Ptr; -extern unsigned int RGBtoYUVPtr; -extern unsigned short resolutn; -extern BYTE GUIWFVID[]; -extern BYTE GUIDSIZE[]; -extern BYTE GUISMODE[]; -extern BYTE GUIDSMODE[]; -extern BYTE GUIHQ2X[]; -extern BYTE GUIHQ3X[]; -extern BYTE GUIHQ4X[]; -extern BYTE GUINTVID[]; -extern BYTE hqFilterlevel; -} - -DWORD FirstVid=1; -DWORD FirstFull=1; -DWORD DMode=0; -DWORD SMode=0; -DWORD DSMode=0; -DWORD NTSCMode=0; -DWORD prevHQMode=~0; -DWORD prevNTSCMode=0; -DWORD prevScanlines=~0; -WORD Refresh = 0; - -int InitDirectDraw() -{ - DDSURFACEDESC2 ddsd2; - DDPIXELFORMAT format; - //MK: unused 2003/08/31 - //HRESULT hr; - //char message1[256]; - unsigned int color32,ScreenPtr2; - int i, j, k, r, g, b, Y, u, v; - - ScreenPtr2=BitConv32Ptr; - for(i=0;i<65536;i++) - { - color32=((i&0xF800)<<8)+ - ((i&0x07E0)<<5)+ - ((i&0x001F)<<3)+0xFF000000; - (*(unsigned int *)(ScreenPtr2))=color32; - ScreenPtr2+=4; - } - - for (i=0; i<32; i++) - for (j=0; j<64; j++) - for (k=0; k<32; k++) - { - r = i << 3; - g = j << 2; - b = k << 3; - Y = (r + g + b) >> 2; - u = 128 + ((r - b) >> 2); - v = 128 + ((-r + 2*g -b)>>3); - *(((unsigned int *)RGBtoYUVPtr) + (i << 11) + (j << 5) + k) = (Y<<16) + (u<<8) + v; - } - - if (!hMainWindow) - { - exit(1); - } - - ReleaseDirectDraw(); - - GetClientRect(hMainWindow, &rcWindow); - ClientToScreen(hMainWindow, ( LPPOINT )&rcWindow); - ClientToScreen(hMainWindow, ( LPPOINT )&rcWindow + 1); - - FullScreen=GUIWFVID[cvidmode]; - DSMode=GUIDSMODE[cvidmode]; - - DWORD HQMode=0; - - if ( hqFilter != 0 ) - { - if ((GUIHQ2X[cvidmode] != 0) && (hqFilterlevel == 2)) HQMode=2; - if ((GUIHQ3X[cvidmode] != 0) && (hqFilterlevel == 3)) HQMode=3; - if ((GUIHQ4X[cvidmode] != 0) && (hqFilterlevel == 4)) HQMode=4; - } - - if (FullScreen == 1) - { - if (HQMode && !DSMode) - { - int marginx = (rcWindow.right - rcWindow.left - BlitArea.right + BlitArea.left)/2; - int marginy = (rcWindow.bottom - rcWindow.top - BlitArea.bottom + BlitArea.top)/2; - if (marginx>0) - { - rcWindow.left += marginx; - rcWindow.right -= marginx; - } - if (marginy>0) - { - rcWindow.top += marginy; - rcWindow.bottom -= marginy; - } - } - - if ((DSMode == 1) && (scanlines != 0)) - { - int OldHeight = rcWindow.bottom - rcWindow.top; - if ((OldHeight % 240) == 0) - { - int NewHeight = (OldHeight/240)*resolutn; - rcWindow.top += (OldHeight - NewHeight)/2; - rcWindow.bottom = rcWindow.top + NewHeight; - } - } - } - - if (pDirectDrawCreateEx(NULL, (void **)&lpDD, IID_IDirectDraw7, NULL) != DD_OK) - { - MessageBox(NULL, "DirectDrawCreateEx failed.", "DirectDraw Error", MB_ICONERROR); - return FALSE; - } - - if (FullScreen == 1) - { - if (lpDD->SetCooperativeLevel(hMainWindow, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT) != DD_OK) - { - MessageBox(NULL, "IDirectDraw7::SetCooperativeLevel failed.", "DirectDraw Error", MB_ICONERROR); - return FALSE; - } - if (lpDD->SetDisplayMode(WindowWidth, WindowHeight, 16, Refresh, 0) != DD_OK) - { - if (lpDD->SetDisplayMode(WindowWidth, WindowHeight, 16, 0, 0) != DD_OK) - { - MessageBox(NULL, "IDirectDraw7::SetDisplayMode failed.\nMake sure your video card supports this mode.", "DirectDraw Error", MB_ICONERROR); - return FALSE; - } - else - { - KitchenSync = 0; - KitchenSyncPAL = 0; - Refresh = 0; - } - } - } - else - { - if (lpDD->SetCooperativeLevel(hMainWindow, DDSCL_NORMAL) != DD_OK) - { - MessageBox(NULL, "IDirectDraw7::SetCooperativeLevel failed.", "DirectDraw Error", MB_ICONERROR); - return FALSE; - } - CheckAlwaysOnTop(); - } - - ZeroMemory(&ddsd2, sizeof(DDSURFACEDESC2)); - ddsd2.dwSize = sizeof(DDSURFACEDESC2); - ddsd2.dwFlags = DDSD_CAPS; - ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - - if (FullScreen == 1) - { - ddsd2.dwFlags |= DDSD_BACKBUFFERCOUNT; - ddsd2.dwBackBufferCount = 2; - ddsd2.ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX; - } - - HRESULT hRes = lpDD->CreateSurface(&ddsd2, &DD_Primary, NULL); - - if (FullScreen == 1) - { - if ((hRes == DDERR_OUTOFMEMORY) || (hRes == DDERR_OUTOFVIDEOMEMORY)) - { - ddsd2.dwBackBufferCount = 1; - hRes = lpDD->CreateSurface(&ddsd2, &DD_Primary, NULL); - } - } - - if (hRes != DD_OK) - { - MessageBox(NULL, "IDirectDraw7::CreateSurface failed.", "DirectDraw Error", MB_ICONERROR); - return FALSE; - } - - if (FullScreen == 1) - { - ddsd2.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; - if (DD_Primary->GetAttachedSurface(&ddsd2.ddsCaps, &DD_BackBuffer) != DD_OK) - { - MessageBox(NULL, "IDirectDrawSurface7::GetAttachedSurface failed.", "DirectDraw Error", MB_ICONERROR); - return FALSE; - } - } - else - { - if (lpDD->CreateClipper(0,&lpDDClipper,NULL) != DD_OK) - { - lpDD->Release(); - lpDD=NULL; - return FALSE; - } - - if (lpDDClipper->SetHWnd(0,hMainWindow) != DD_OK) - { - lpDD->Release(); - lpDD=NULL; - return FALSE; - } - - if (DD_Primary->SetClipper(lpDDClipper) != DD_OK) - { - return FALSE; - } - } - - format.dwSize = sizeof(DDPIXELFORMAT); - - if (DD_Primary->GetPixelFormat(&format) != DD_OK) - { - MessageBox(NULL, "IDirectDrawSurface7::GetPixelFormat failed.", "DirectDraw Error", MB_ICONERROR); - return FALSE; - } - - BitDepth=format.dwRGBBitCount; - GBitMask=format.dwGBitMask; // 0x07E0 or not - - if (BitDepth==24) - { - MessageBox(NULL,"ZSNESw does not support 24bit color.\nPlease change your resolution to either 16bit or 32bit color","Error",MB_OK); - exit(0); - } - - converta = (BitDepth==16 && GBitMask!=0x07E0); - - ddsd2.dwSize = sizeof(ddsd2); - ddsd2.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd2.dwWidth = SurfaceX; - ddsd2.dwHeight = SurfaceY; - - // create drawing surface - if (lpDD->CreateSurface(&ddsd2, &DD_CFB, NULL) != DD_OK) - { - MessageBox(NULL, "IDirectDraw7::CreateSurface failed.", "DirectDraw Error", MB_ICONERROR); - return FALSE; - } - - AltSurface = 0; - - // create alt. drawing surface - if ( BitDepth == 32 ) - { - if(DMode == 1 && HQMode == 0) - ddsd2.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; - ddsd2.dwFlags |= DDSD_PIXELFORMAT; - ddsd2.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd2.ddpfPixelFormat.dwFlags = DDPF_RGB; - ddsd2.ddpfPixelFormat.dwRGBBitCount = 16; - ddsd2.ddpfPixelFormat.dwRBitMask = 0xF800; - ddsd2.ddpfPixelFormat.dwGBitMask = 0x07E0; - ddsd2.ddpfPixelFormat.dwBBitMask = 0x001F; - - if (lpDD->CreateSurface(&ddsd2, &DD_CFB16, NULL) != DD_OK) - { - MessageBox(NULL, "IDirectDraw7::CreateSurface failed. You should update your video card drivers. Alternatively, you could use a 16-bit desktop or use a non-D mode.", "DirectDraw Error", MB_ICONERROR); - return FALSE; - } - - if (((SurfaceX==512) || (SurfaceX==602) || (SurfaceX==640)) && (HQMode==0)) - AltSurface = 1; - } - - return TRUE; -} - -BYTE* SurfBuf; -DDSURFACEDESC2 ddsd; - -DWORD LockSurface() -{ - HRESULT hRes; - - if (AltSurface == 0) - { - if (DD_CFB != NULL) - { - memset(&ddsd,0,sizeof(ddsd)); - ddsd.dwSize = sizeof( ddsd ); - ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH; - - hRes = DD_CFB->Lock(NULL,&ddsd,DDLOCK_WAIT,NULL); - - if (hRes == DD_OK) - { - SurfBuf = (BYTE*)ddsd.lpSurface; - return(ddsd.lPitch); - } - else - { - if (hRes == DDERR_SURFACELOST) - { - DD_Primary->Restore(); - DD_CFB->Restore(); - Clear2xSaIBuffer(); - } - return(0); - } - } - else - return(0); - } - else - { - if (DD_CFB16 != NULL) - { - memset(&ddsd,0,sizeof(ddsd)); - ddsd.dwSize = sizeof( ddsd ); - ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH; - - hRes = DD_CFB16->Lock(NULL,&ddsd,DDLOCK_WAIT,NULL); - - if (hRes == DD_OK) - { - SurfBuf = (BYTE*)ddsd.lpSurface; - return(ddsd.lPitch); - } - else - { - if (hRes == DDERR_SURFACELOST) - { - DD_Primary->Restore(); - DD_CFB16->Restore(); - Clear2xSaIBuffer(); - } - return(0); - } - } - else - return(0); - } -} - -void UnlockSurface() -{ - if (AltSurface == 0) - DD_CFB->Unlock((struct tagRECT *)ddsd.lpSurface); - else - DD_CFB16->Unlock((struct tagRECT *)ddsd.lpSurface); -} - -extern "C" { - -void WinUpdateDevices(); - -short Buffer[1800*2]; - -int X, Y; -DWORD pitch; -MSG msg; -DWORD SurfBufD; -int count, x,count2; -HRESULT hr; -int i; -short *Sound; -DWORD CurrentPos; -DWORD WritePos; -DWORD T60HZEnabled=0; -DWORD T36HZEnabled=0; - -DWORD WINAPI SemaphoreThread( LPVOID lpParam ) -{ - while(semaphore_run) - { - if (T60HZEnabled) - { - ReleaseSemaphore(hLock, 1, NULL); - Sleep(1); - } - else - Sleep(20); - } - return 0; -} - -void InitSemaphore() -{ - if (!hLock) - { - hLock = CreateSemaphore(NULL, 1, SemaphoreMax, NULL); - - semaphore_run = 1; - - hThread = CreateThread(NULL, 0, SemaphoreThread, &dwThreadParam, 0, &dwThreadId); - } -} - -void ShutdownSemaphore() -{ - if (hLock) - { - semaphore_run = 0; - - WaitForSingleObject(hThread, INFINITE); - CloseHandle(hThread); - - CloseHandle(hLock); - - hLock = NULL; - } -} - -extern unsigned int pressed; -extern unsigned char romispal; - -void Start60HZ(void) -{ - update_ticks_pc2 = UPDATE_TICKS_UDP * freq / 1000.0; - - if (romispal==1) - { - update_ticks_pc = UPDATE_TICKS_GAMEPAL * freq / 1000.0; - } - else - { - update_ticks_pc = UPDATE_TICKS_GAME * freq / 1000.0; - } - - QueryPerformanceCounter((LARGE_INTEGER*)&start); - QueryPerformanceCounter((LARGE_INTEGER*)&start2); - - T36HZEnabled=0; - T60HZEnabled=1; - - InitSemaphore(); - - if (device1 && device2) - { - MouseInput->Unacquire(); - MultiMouseInit(); - } - - //if (!device1 && !device2) MouseInput->Unacquire(); - -} - -void Stop60HZ(void) -{ - T60HZEnabled=0; - - if (device1 && device2) - MultiMouseShutdown(); - - MouseInput->Acquire(); - - ShutdownSemaphore(); -} - -void Start36HZ(void) -{ - update_ticks_pc2 = UPDATE_TICKS_UDP * freq / 1000.0; - update_ticks_pc = UPDATE_TICKS_GUI * freq / 1000.0; - - QueryPerformanceCounter((LARGE_INTEGER*)&start); - QueryPerformanceCounter((LARGE_INTEGER*)&start2); - - T60HZEnabled=0; - T36HZEnabled=1; -} - -void Stop36HZ(void) -{ - T36HZEnabled=0; -} - -char WinMessage[256]; -void clearwin(); - -char WinName[]={"ZSNESW\0"}; -void NTSCFilterInit(); -void NTSCFilterDraw(int SurfaceX, int SurfaceY, int pitch, unsigned char* buffer); - -extern "C" char GUIM7VID[]; - -void SetHiresOpt() -{ - if(CustomResX >= 512 && CustomResY >= 448) - GUIM7VID[cvidmode] = 1; - else - GUIM7VID[cvidmode] = 0; -} - -void KeepTVRatio() -{ - int ratiox = WindowWidth*3; - int ratioy = WindowHeight*4; - - int marginchange; - int marginmod; - - if (ratiox < ratioy) - { - marginchange = (WindowHeight-(ratiox/4))/2; - marginmod = (WindowHeight-(ratiox/4))%2; - rcWindow.top += marginchange; - rcWindow.bottom -= (marginchange+marginmod); - } - else if (ratiox > ratioy) - { - marginchange = (WindowWidth-(ratioy/3))/2; - marginmod = (WindowWidth-(ratioy/3))%2; - rcWindow.left += marginchange; - rcWindow.right -= (marginchange+marginmod); - } -} - -extern "C" char GUIKEEP43[]; - -bool CheckTVRatioReq() -{ - return(GUIKEEP43[cvidmode] && Keep4_3Ratio); -} - -void initwinvideo(void) -{ - WINDOWPLACEMENT wndpl; - RECT rc1; - DWORD newmode=0; - DWORD HQMode=0; - - if (FirstActivate && NTSCFilter) NTSCFilterInit(); - - if (cvidmode == 37 || cvidmode == 38 || cvidmode == 41) - { - SetHiresOpt(); - } - - if ( hqFilter != 0 ) - { - if ((GUIHQ2X[cvidmode] != 0) && (hqFilterlevel == 2)) HQMode=2; - if ((GUIHQ3X[cvidmode] != 0) && (hqFilterlevel == 3)) HQMode=3; - if ((GUIHQ4X[cvidmode] != 0) && (hqFilterlevel == 4)) HQMode=4; - } - - if ((CurMode!=cvidmode) || (prevHQMode!=HQMode) || (prevNTSCMode!=NTSCFilter) || (changeRes)) - { - CurMode=cvidmode; - prevHQMode=HQMode; - prevNTSCMode=NTSCFilter; - changeRes = 0; - newmode=1; - SurfaceX=256; - SurfaceY=240; - X=0; - Y=0; - FullScreen=GUIWFVID[cvidmode]; - DMode=GUIDSIZE[cvidmode]; - SMode=GUISMODE[cvidmode]; - DSMode=GUIDSMODE[cvidmode]; - NTSCMode=GUINTVID[cvidmode]; - - switch (cvidmode) - { - case 0: - WindowWidth=256; - WindowHeight=224; - break; - case 1: - WindowWidth=640; - WindowHeight=480; - break; - case 2: - case 3: - WindowWidth=512; - WindowHeight=448; - break; - case 4: - case 5: - case 6: - case 7: - case 8: - WindowWidth=640; - WindowHeight=480; - break; - case 9: - case 10: - WindowWidth=768; - WindowHeight=672; - break; - case 11: - case 12: - case 13: - case 14: - case 15: - WindowWidth=800; - WindowHeight=600; - break; - case 16: - case 17: - case 18: - case 19: - case 20: - WindowWidth=1024; - WindowHeight=768; - break; - case 21: - case 22: - WindowWidth=1024; - WindowHeight=896; - break; - case 23: - case 24: - case 25: - case 26: - case 27: - WindowWidth=1280; - WindowHeight=960; - break; - case 28: - case 29: - case 30: - case 31: - case 32: - WindowWidth=1280; - WindowHeight=1024; - break; - case 33: - case 34: - case 35: - case 36: - case 37: - WindowWidth=1600; - WindowHeight=1200; - break; - case 38: - case 39: - case 40: - case 41: - case 42: - WindowWidth=CustomResX; - WindowHeight=CustomResY; - break; - default: - WindowWidth=256; - WindowHeight=224; - break; - } - - if (DMode == 1) - { - if ((DSMode == 1) || (FullScreen == 0)) - SurfaceX = 512; - else - SurfaceX = 640; - - SurfaceY=480; - - if (NTSCMode && NTSCFilter) - { - SurfaceX = 602; - SurfaceY = 446; - } - } - else - { - if ((SMode == 0) && (FullScreen == 1)) - SurfaceX=320; - else - SurfaceX=256; - SurfaceY=240; - } - - switch ( HQMode ) - { - case 2: - SurfaceX=512; - SurfaceY=480; - break; - case 3: - SurfaceX=768; - SurfaceY=720; - break; - case 4: - SurfaceX=1024; - SurfaceY=960; - break; - } - - BlitArea.top = 0; - BlitArea.left = 0; - BlitArea.right = SurfaceX; - - if ((SurfaceX == 602) || (SurfaceX == 640) || (SurfaceX == 320)) - BlitArea.bottom = SurfaceY; - else - if (!NTSCFilter) BlitArea.bottom = (SurfaceY/240)*resolutn; - - if (PrevRes == 0) PrevRes = resolutn; - } - - if (((PrevStereoSound!=StereoSound)||(PrevSoundQuality!=SoundQuality))&&FirstSound!=1) - ReInitSound(); - - if (!FirstVid) - { - if (X<0)X=0; - if (X>(int)(GetSystemMetrics(SM_CXSCREEN) - WindowWidth)) X=(GetSystemMetrics(SM_CXSCREEN) - WindowWidth); - if (Y<0)Y=0; - if (Y>(int)(GetSystemMetrics(SM_CYSCREEN) - WindowHeight)) Y=(GetSystemMetrics(SM_CYSCREEN) - WindowHeight); - - if (FullScreen==1) {X=0; Y=0;} - - if (FullScreen==0 && newmode == 1) { X = MainWindowX; Y = MainWindowY; } - else if (FullScreen==0) { MainWindowX = X; MainWindowY = Y; } - - MoveWindow(hMainWindow, X, Y, WindowWidth, WindowHeight, TRUE); - - wndpl.length = sizeof(wndpl); - GetWindowPlacement(hMainWindow, &wndpl); - SetRect(&rc1, 0, 0, WindowWidth, WindowHeight); - - AdjustWindowRectEx(&rc1,GetWindowLong(hMainWindow, GWL_STYLE), - GetMenu(hMainWindow) != NULL, GetWindowLong(hMainWindow, GWL_EXSTYLE)); - - GetClientRect(hMainWindow, &rcWindow); - ClientToScreen(hMainWindow, (LPPOINT) &rcWindow); - ClientToScreen(hMainWindow, (LPPOINT) &rcWindow + 1); - - if (FullScreen == 1) - { - if (HQMode && !DSMode) - { - int marginx = (rcWindow.right - rcWindow.left - BlitArea.right + BlitArea.left)/2; - int marginy = (rcWindow.bottom - rcWindow.top - BlitArea.bottom + BlitArea.top)/2; - - if (marginx>0) - { - rcWindow.left += marginx; - rcWindow.right -= marginx; - } - if (marginy>0) - { - rcWindow.top += marginy; - rcWindow.bottom -= marginy; - } - } - - if ((DSMode == 1) && (scanlines != 0)) - { - int OldHeight = rcWindow.bottom - rcWindow.top; - if ((OldHeight % 240) == 0) - { - int NewHeight = (OldHeight/240)*resolutn; - rcWindow.top += (OldHeight - NewHeight)/2; - rcWindow.bottom = rcWindow.top + NewHeight; - clear_display(); - } - } - } - - if (CheckTVRatioReq()) - KeepTVRatio(); - } - else - { - atexit(ExitFunction); - - if (!QueryPerformanceFrequency((LARGE_INTEGER*)&freq)) return; - - if (!RegisterWinClass()) - { - exit(1); - } - X=(GetSystemMetrics(SM_CXSCREEN) - WindowWidth) / 2; - Y=(GetSystemMetrics(SM_CYSCREEN) - WindowHeight) / 2; - - if (FullScreen==1) {X=0; Y=0;} - - if (hMainWindow) - { - CloseWindow(hMainWindow); - } - - if (SaveMainWindowPos == 1 && MainWindowX != -1 && FullScreen == 0) { X = MainWindowX; Y = MainWindowY; } - - hMainWindow = CreateWindow( "ZSNES", WinName, WS_VISIBLE|WS_POPUP,X,Y, //WS_OVERLAPPED "ZSNES" - WindowWidth,WindowHeight,NULL,NULL,hInst,NULL); - - if (!hMainWindow) - { - return; - } - - // Hide the cursor - ShowCursor(0); - - // Set window attributes - ShowWindow(hMainWindow, SW_SHOWNORMAL); - SetWindowText(hMainWindow,"ZSNES"); - - // Run ZSNES Windows GUI callback functions to set initial values - CheckPriority(); - CheckAlwaysOnTop(); - CheckScreenSaver(); - - // Init various DirectX subsystems - InitInput(); - InitSound(); - TestJoy(); - -// if (debugger) InitDebugger(); // Start debugger such that it is at this point - - } - - if (FirstVid == 1) - { - FirstVid = 0; - if (KitchenSync) Refresh = totlines == 263 ? 120 : 100; - else if (KitchenSyncPAL && totlines == 314) Refresh = 100; - else if (ForceRefreshRate) Refresh = SetRefreshRate; - InitDirectDraw(); - clearwin(); - Clear2xSaIBuffer(); - clear_display(); - } - - else if (newmode == 1 && Moving != 1) - { - ReleaseDirectDraw(); - InitDirectDraw(); - if (CheckTVRatioReq()) - KeepTVRatio(); - clearwin(); - Clear2xSaIBuffer(); - clear_display(); - } -} - -extern unsigned int vidbuffer; -extern void SoundProcess(); -extern int DSPBuffer; -int * DSPBuffer1; -DWORD ScreenPtr; -DWORD ScreenPtr2; -void GUI36hzcall(void); -void Game60hzcall(void); - -void CheckTimers(void) -{ - - // Lame fix for GUI using 100% CPU - if (GUIOn || GUIOn2 || EMUPause) Sleep(1); - - QueryPerformanceCounter((LARGE_INTEGER*)&end2); - - while ((end2 - start2) >= update_ticks_pc2) - { - start2 += update_ticks_pc2; - } - - if (T60HZEnabled == 1) - { - QueryPerformanceCounter((LARGE_INTEGER*)&end); - - while ((end - start) >= update_ticks_pc) - { - Game60hzcall(); - start += update_ticks_pc; - } - } - - if (T36HZEnabled == 1) - { - QueryPerformanceCounter((LARGE_INTEGER*)&end); - - while ((end - start) >= update_ticks_pc) - { - GUI36hzcall(); - start += update_ticks_pc; - } - } -} - -extern "C" { -volatile int SPCSize; -volatile int buffer_ptr; -extern unsigned char MMXSupport; -} - -void UpdateVFrame(void) -{ - int DataNeeded; - SPCSize=256; - - //if (StereoSound==1) SPCSize=256; - - while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - WinUpdateDevices(); - CheckTimers(); - - if (SoundEnabled == 0) return; - - if(!UsePrimaryBuffer) lpSoundBuffer->GetCurrentPosition(&CurrentPos,&WritePos); - else lpPrimaryBuffer->GetCurrentPosition(&CurrentPos,&WritePos); - - if (LastUsedPos <= CurrentPos) - { - DataNeeded=CurrentPos-LastUsedPos; - } - else - { - DataNeeded=SoundBufferSize - LastUsedPos + CurrentPos; - } - - DataNeeded/=(SPCSize*2); - DataNeeded*=(SPCSize*2); - - while (DataNeeded>0) - { - asm_call(SoundProcess); - - DSPBuffer1=(int *)&DSPBuffer; - - buffer_ptr = (int)&Buffer[0]; - - if (T36HZEnabled == 1) - { - if (MMXSupport == 1) - { - ASM_BEGIN - ASM_COMMAND3(mov edi,buffer_ptr) - ASM_COMMAND3(mov ecx,SPCSize) - ASM_COMMAND2(shr ecx,2) - ASM_COMMAND2(pxor mm0,mm0) -ASM_COMMAND(_blank_top_fpu:) - ASM_COMMAND2(movq [edi],mm0) - ASM_COMMAND2(add edi,8) - ASM_COMMAND(dec ecx) - ASM_COMMAND(jne _blank_top_fpu) - ASM_COMMAND(emms) - ASM_END - } - else - { - ASM_BEGIN - ASM_COMMAND3(mov edi,buffer_ptr) - ASM_COMMAND3(mov ecx,SPCSize) - ASM_COMMAND2(shr ecx,1) - ASM_COMMAND2(xor eax,eax) -ASM_COMMAND(_blank_top:) - ASM_COMMAND2(mov [edi],eax) - ASM_COMMAND2(add edi,4) - ASM_COMMAND(dec ecx) - ASM_COMMAND(jne _blank_top) - ASM_END - } - } - else - { - if (MMXSupport == 1) - { - ASM_BEGIN - ASM_COMMAND3(mov esi,DSPBuffer1) - ASM_COMMAND3(mov edi,buffer_ptr) - ASM_COMMAND3(mov ecx,SPCSize) - ASM_COMMAND2(shr ecx,2) -ASM_COMMAND(_top_mmx:) - ASM_COMMAND2(movq mm0,[esi]) - ASM_COMMAND2(packssdw mm0,[esi+8]) - ASM_COMMAND2(movq [edi],mm0) - ASM_COMMAND2(add esi,16) - ASM_COMMAND2(add edi,8) - ASM_COMMAND(dec ecx) - ASM_COMMAND(jne _top_mmx) - ASM_COMMAND(emms) - ASM_END - } - else - { - for(i=0;i32767)Buffer[i]=32767; - if (DSPBuffer1[i]<-32767)Buffer[i]=-32767; - } - } - } - - if(!UsePrimaryBuffer) - { - if (DS_OK!=lpSoundBuffer->Lock(LastUsedPos, - SPCSize*2, &lpvPtr1, - &dwBytes1, &lpvPtr2, - &dwBytes2, 0)) - { - return; - } - } - else - { - if (DS_OK!=lpPrimaryBuffer->Lock(LastUsedPos, - SPCSize*2, &lpvPtr1, - &dwBytes1, &lpvPtr2, - &dwBytes2, 0)) - { - return; - } - } - - Sound=(short *)lpvPtr1; - - CopyMemory(lpvPtr1, &Buffer[0], dwBytes1); - - if (NULL != lpvPtr2) - { - CopyMemory(lpvPtr2, &Buffer[0]+dwBytes1, dwBytes2); - } - - if(!UsePrimaryBuffer) - { - if (DS_OK != lpSoundBuffer->Unlock(lpvPtr1, dwBytes1, lpvPtr2, dwBytes2)) - { - return; - } - } - else - { - if (DS_OK != lpPrimaryBuffer->Unlock(lpvPtr1, dwBytes1, lpvPtr2, dwBytes2)) - { - return; - } - } - - LastUsedPos+=SPCSize*2; - if (LastUsedPos==SoundBufferSize) LastUsedPos=0; - DataNeeded-=(SPCSize*2); - } -} - -extern unsigned char curblank; -extern DWORD AddEndBytes; -extern DWORD NumBytesPerLine; -extern unsigned char * WinVidMemStart; -void copy640x480x16bwin(void); -void hq2x_16b(void); -void hq2x_32b(void); -void hq3x_16b(void); -void hq3x_32b(void); -void hq4x_16b(void); -void hq4x_32b(void); -extern unsigned char NGNoTransp; -void ClearWin16(); -void ClearWin32(); - -void clearwin() -{ - pitch=LockSurface(); - if (pitch==0) { return; } - - SurfBufD=(DWORD) &SurfBuf[0]; - - if (AltSurface == 0) - { - switch (BitDepth) - { - case 16: - ClearWin16(); - break; - case 32: - ClearWin32(); - break; - } - } - else - ClearWin16(); - - UnlockSurface(); -} - -extern "C" -{ - void initDirectDraw() - { - InitDirectDraw(); - if (CheckTVRatioReq()) - KeepTVRatio(); - clearwin(); - Clear2xSaIBuffer(); - clear_display(); - } -} - -void clear_display() -{ - if (FullScreen == 1) - { - DDBLTFX ddbltfx; - - ddbltfx.dwSize = sizeof(ddbltfx); - ddbltfx.dwFillColor = 0; - - if (TripleBufferWin == 1) - { - if ((DD_Primary != NULL) && (DD_BackBuffer != NULL)) - { - if (DD_BackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST) - DD_Primary->Restore(); - - if (DD_Primary->Flip(NULL, DDFLIP_WAIT) == DDERR_SURFACELOST) - DD_Primary->Restore(); - - if (DD_BackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST) - DD_Primary->Restore(); - - if (DD_Primary->Flip(NULL, DDFLIP_WAIT) == DDERR_SURFACELOST) - DD_Primary->Restore(); - - if (DD_BackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST) - DD_Primary->Restore(); - } - } - else - { - if (DD_Primary != NULL) - { - if (vsyncon == 1) - { - if (lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL) != DD_OK) - { - DDrawError(); - } - } - if (DD_Primary->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST) - DD_Primary->Restore(); - } - } - } -} - -void DrawWin256x224x16(); -void DrawWin256x224x32(); -void DrawWin320x240x16(); - -volatile __int64 copymaskRB = 0x001FF800001FF800LL; -volatile __int64 copymaskG = 0x0000FC000000FC00LL; -volatile __int64 copymagic = 0x0008010000080100LL; - -void drawscreenwin(void) -{ - DWORD i,j,color32; - DWORD *SURFDW; - - NGNoTransp = 0; // Set this value to 1 within the appropriate - // video mode if you want to add a custom - // transparency routine or hardware - // transparency. This only works if - // the value of newengen is equal to 1. - // (see ProcessTransparencies in newgfx16.asm - // for ZSNES' current transparency code) - - UpdateVFrame(); - if (curblank!=0) return; - - if (!(pitch = LockSurface())) - return; - - ScreenPtr=vidbuffer; - ScreenPtr+=16*2+32*2+256*2; - - DWORD HQMode=0; - - if (MMXSupport == 0) - hqFilter=0; - - if ( hqFilter != 0 ) - { - if ((GUIHQ2X[cvidmode] != 0) && (hqFilterlevel == 2)) HQMode=2; - if ((GUIHQ3X[cvidmode] != 0) && (hqFilterlevel == 3)) HQMode=3; - if ((GUIHQ4X[cvidmode] != 0) && (hqFilterlevel == 4)) HQMode=4; - } - - if (PrevRes != resolutn) - { - if ((SurfaceX == 640) || (SurfaceX == 320)) - BlitArea.bottom = SurfaceY; - else - if (!NTSCFilter) BlitArea.bottom = (SurfaceY/240)*resolutn; - - if ((FullScreen == 0) && (SMode == 0) && (DSMode == 0) && !NTSCFilter) - WindowHeight = (WindowHeight/224)*resolutn; - - initwinvideo(); - PrevRes = resolutn; - } - - if (prevHQMode!=HQMode) initwinvideo(); - - if (prevNTSCMode != NTSCFilter) initwinvideo(); - - if (prevScanlines != scanlines) - { - initwinvideo(); - prevScanlines = scanlines; - } - - if (changeRes) initwinvideo(); - - SurfBufD=(DWORD) &SurfBuf[0]; - SURFDW=(DWORD *) &SurfBuf[0]; - - if (!(KitchenSync || (KitchenSyncPAL && totlines == 314)) && Refresh != 0 && !ForceRefreshRate) - { - Refresh = 0; - ReleaseDirectDraw(); - InitDirectDraw(); - clearwin(); - Clear2xSaIBuffer(); - clear_display(); - } - - if (KitchenSync && Refresh != 120 && totlines == 263) - { - Refresh = 120; - ReleaseDirectDraw(); - InitDirectDraw(); - clearwin(); - Clear2xSaIBuffer(); - clear_display(); - } - - if ((KitchenSync || KitchenSyncPAL) && Refresh != 100 && totlines == 314) - { - Refresh = 100; - ReleaseDirectDraw(); - InitDirectDraw(); - clearwin(); - Clear2xSaIBuffer(); - clear_display(); - } - - if (!KitchenSync && KitchenSyncPAL && totlines == 263 && Refresh != SetRefreshRate && ForceRefreshRate) - { - Refresh = SetRefreshRate; - ReleaseDirectDraw(); - InitDirectDraw(); - clearwin(); - Clear2xSaIBuffer(); - clear_display(); - } - - if (!HQMode) - { - if (SurfaceX == 256 && SurfaceY == 240) - { - switch (BitDepth) - { - case 16: - { - DrawWin256x224x16(); - break; - } - case 32: - { - DrawWin256x224x32(); - break; - } -/* SURFDW=(DWORD *) &SurfBuf[(resolutn-1)*pitch]; - color32=0x7F000000; - - for(i=0;i<256;i++) - { - SURFDW[i]=color32; - } - - SURFDW=(DWORD *) &SurfBuf[resolutn*pitch]; - color32=0x7F000000; - - for(i=0;i<256;i++) - { - SURFDW[i]=color32; - } - break;*/ - case 24: - MessageBox (NULL, "Sorry. ZSNESw does not work in windowed 24 bit color modes. \nClick 'OK' to switch to a full screen mode.", "DDRAW Error" , MB_ICONERROR ); - cvidmode=3; - initwinvideo(); - Sleep(1000); - drawscreenwin(); - break; - default: - UnlockSurface(); - MessageBox (NULL, "Mode only available in 16 and 32 bit color", "DDRAW Error" , MB_ICONERROR ); - cvidmode=2; - initwinvideo(); - Sleep(1000); - drawscreenwin(); - break; - } - } - - if (SurfaceX == 320 && SurfaceY == 240) - { - switch (BitDepth) - { - case 16: - { - DrawWin320x240x16(); - break; - } - case 32: - for(j=0;j<8;j++) - { - SURFDW=(DWORD *) &SurfBuf[j*pitch]; - color32=0x7F000000; - - for(i=0;i<320;i++) - { - SURFDW[i]=color32; - } - } - - for(j=8;(int)j<(resolutn-1)+8;j++) - { - color32=0x7F000000; - for(i=0;i<32;i++) - { - SURFDW[i]=color32; - } - - for(i=32;i<(256+32);i++) - { - color32=(((*(WORD *)(ScreenPtr))&0xF800)<<8)+ - (((*(WORD *)(ScreenPtr))&0x07E0)<<5)+ - (((*(WORD *)(ScreenPtr))&0x001F)<<3)+0xFF000000; -// SURFDW[i]=color32; - ScreenPtr+=2; - } - - color32=0x7F000000; - for(i=(256+32);i<320;i++) - { - SURFDW[i]=color32; - } - - ScreenPtr=ScreenPtr+576-512; - SURFDW=(DWORD *) &SurfBuf[(j)*pitch]; - } - - for(j=((resolutn-1)+8);j<240;j++) - { - SURFDW=(DWORD *) &SurfBuf[j*pitch]; - - color32=0x7F000000; - for(i=0;i<320;i++) - { - SURFDW[i]=color32; - } - } - break; - default: - UnlockSurface(); - MessageBox (NULL, "Mode only available in 16 and 32 bit color", "DDRAW Error" , MB_ICONERROR ); - cvidmode=2; - initwinvideo(); - Sleep(1000); - drawscreenwin(); - break; - } - } - - if (SurfaceX==512 && SurfaceY==480) - { - switch (BitDepth) - { - case 16: - case 32: // using 16bpp AltSurface - AddEndBytes=pitch-1024; - NumBytesPerLine=pitch; - WinVidMemStart=&SurfBuf[0]; - asm_call(copy640x480x16bwin); - break; - default: - UnlockSurface(); - MessageBox (NULL, "Mode only available in 16 and 32 bit color", "DDRAW Error" , MB_ICONERROR ); - cvidmode=2; - initwinvideo(); - Sleep(1000); - drawscreenwin(); - } - } - - if (SurfaceX == 640 && SurfaceY == 480) - { - switch (BitDepth) - { - case 16: - case 32: // using 16bpp AltSurface - AddEndBytes=pitch-1024; - NumBytesPerLine=pitch; - WinVidMemStart=&SurfBuf[(240-resolutn)*pitch+64*2]; - asm_call(copy640x480x16bwin); - break; - default: - UnlockSurface(); - MessageBox (NULL, "Mode only available in 16 and 32 bit color", "DDRAW Error" , MB_ICONERROR ); - cvidmode=2; - initwinvideo(); - Sleep(1000); - drawscreenwin(); - } - } - if (SurfaceX == 602 && SurfaceY == 446) - { - switch (BitDepth) - { - case 16: - case 32: // using 16bpp AltSurface - AddEndBytes=pitch-1024; - NumBytesPerLine=pitch; - WinVidMemStart=&SurfBuf[0]; - NTSCFilterDraw(SurfaceX, SurfaceY, pitch, WinVidMemStart); - break; - default: - UnlockSurface(); - MessageBox (NULL, "Mode only available in 16 and 32 bit color", "DDRAW Error" , MB_ICONERROR ); - cvidmode=2; - initwinvideo(); - Sleep(1000); - drawscreenwin(); - } - } - } - else - { - // HQMode != 0 - NumBytesPerLine = pitch; - AddEndBytes = pitch - SurfaceX*(BitDepth/8); - WinVidMemStart=&SurfBuf[0]; - switch (BitDepth) - { - case 16: - { - switch (HQMode) - { - case 2: hq2x_16b(); break; - case 3: hq3x_16b(); break; - case 4: hq4x_16b(); break; - } - break; - } - case 32: - { - switch (HQMode) - { - case 2: hq2x_32b(); break; - case 3: hq3x_32b(); break; - case 4: hq4x_32b(); break; - } - break; - } - default: - { - UnlockSurface(); - MessageBox (NULL, "Mode only available in 16 and 32 bit color", "DDRAW Error" , MB_ICONERROR ); - cvidmode=2; - initwinvideo(); - Sleep(1000); - drawscreenwin(); - } - } - } - UnlockSurface(); - DrawScreen(); -} - -void SwitchFullScreen(void); - -void WinUpdateDevices() -{ - int i,j; - unsigned char * keys; - unsigned char keys2[256]; - - for (i = 0; i<256; i++) - keys2[i] = 0; - keys = (unsigned char *)&pressed; - - if (KeyboardInput&&InputEn==1) - { - KeyboardInput->GetDeviceState(256, keys2); - } - else - { - return; - } - if (keys2[0x38] != 0 && keys2[0x3E] != 0) exit(0); - if (keys2[0xB8] != 0 && keys2[0x1C] != 0 || keys2[0x38] != 0 && keys2[0x1C] != 0) - { - asm_call(SwitchFullScreen); - return; - } - - for(i=0; i<256; i++) - { - if (keys2[i] == 0) keys[i] = 0; - if (keys2[i] != 0 && keys[i] == 0) keys[i] = 1; - } - - keys[0] = 0; - - for(i=0; i<5; i++) - { - if (JoystickInput[i]) - { - for(j=0; j<32; j++) - { - keys[0x100 + i * 32 + j] = 0; - } - - JoystickInput[i]->Poll(); - - if (JoystickInput[i]->GetDeviceState(sizeof(DIJOYSTATE), &js[i])==DIERR_INPUTLOST) - { - if (JoystickInput[i]) JoystickInput[i]->Acquire(); - if (FAILED(JoystickInput[i]->GetDeviceState(sizeof(DIJOYSTATE), &js[i]))) return; - } - - if (!X1Disable[i]) - { - if (js[i].lX>0) keys[0x100 + i * 32 + 0] = 1; - } - - if (!X2Disable[i]) - { - if (js[i].lX<0) keys[0x100 + i * 32 + 1] = 1; - } - - if (!Y1Disable[i]) - { - if (js[i].lY>0) keys[0x100 + i * 32 + 2] = 1; - } - - if (!Y2Disable[i]) - { - if (js[i].lY<0) keys[0x100 + i * 32 + 3] = 1; - } - - if (!Z1Disable[i]) - { - if (js[i].lZ>0) keys[0x100 + i * 32 + 4] = 1; - } - - if (!Z2Disable[i]) - { - if (js[i].lZ<0) keys[0x100 + i * 32 + 5] = 1; - } - - if (!RY1Disable[i]) - { - if (js[i].lRy>0) keys[0x100 + i * 32 + 6] = 1; - } - - if (!RY2Disable[i]) - { - if (js[i].lRy<0) keys[0x100 + i * 32 + 7] = 1; - } - - if (!RZ1Disable[i]) - { - if (js[i].lRz>0) keys[0x100 + i * 32 + 8] = 1; - } - - if (!RZ2Disable[i]) - { - if (js[i].lRz<0) keys[0x100 + i * 32 + 9] = 1; - } - - if (!S01Disable[i]) - { - if (js[i].rglSlider[0]>0) keys[0x100 + i * 32 + 10] = 1; - } - - if (!S02Disable[i]) - { - if (js[i].rglSlider[0]<0) keys[0x100 + i * 32 + 11] = 1; - } - - if (!S11Disable[i]) - { - if (js[i].rglSlider[1]>0) keys[0x100 + i * 32 + 12] = 1; - } - - if (!S12Disable[i]) - { - if (js[i].rglSlider[1]<0) keys[0x100 + i * 32 + 13] = 1; - } - - if (!POVDisable[i]) - { - for (int p=0; (unsigned long)p MouseMaxX) - { - MouseX = MouseMaxX; - - if (TrapMouseCursor == 1) - { - if (abs((int)MouseMoveX) > 10 && T36HZEnabled == 1 && FullScreen == 0 && MouseButtonPressed == 0) - { - MouseInput->Unacquire(); - SetCursorPos(X + WindowWidth + 32, (int)(Y + (MouseY * WindowHeight / 224))); - } - } - else if (FullScreen == 0 && device1 == 0 && device2 == 0 && MouseButtonPressed == 0 && GUIOn2 == 1) - { - MouseInput->Unacquire(); - SetCursorPos(X + WindowWidth + 1, (int)(Y + (MouseY * WindowHeight / 224))); - } - } - - if (MouseX < MouseMinX) - { - MouseX = MouseMinX; - - if (TrapMouseCursor == 1) - { - if (abs((int)MouseMoveX) > 10 && T36HZEnabled == 1 && FullScreen == 0 && MouseButtonPressed == 0) - { - MouseInput->Unacquire(); - SetCursorPos(X - 32, (int)(Y + (MouseY * WindowHeight / 224))); - } - } - else if (FullScreen == 0 && device1 == 0 && device2 == 0 && MouseButtonPressed == 0 && GUIOn2 == 1) - { - MouseInput->Unacquire(); - SetCursorPos(X - 1, (int)(Y + (MouseY * WindowHeight / 224))); - } - } - return((int) MouseX); -} - -int GetMouseY(void) -{ - MouseY += MouseMoveY/MouseSensitivity; - - if (MouseY > MouseMaxY) - { - MouseY = MouseMaxY; - - if (TrapMouseCursor == 1) - { - if (abs((int)MouseMoveY) > 10 && T36HZEnabled == 1 && FullScreen == 0 && MouseButtonPressed == 0) - { - MouseInput->Unacquire(); - SetCursorPos((int)(X+(MouseX * WindowWidth / 256)), Y + WindowHeight + 32); - } - } - else if (FullScreen == 0 && device1 == 0 && device2 == 0 && MouseButtonPressed == 0 && GUIOn2 == 1) - { - MouseInput->Unacquire(); - SetCursorPos((int)(X+(MouseX * WindowWidth / 256)), Y + WindowHeight + 1); - } - } - - if (MouseY < MouseMinY) - { - MouseY = MouseMinY; - - if (TrapMouseCursor == 1) - { - if (abs((int)MouseMoveY) > 10 && T36HZEnabled == 1 && FullScreen == 0 && MouseButtonPressed == 0) - { - MouseInput->Unacquire(); - SetCursorPos((int)(X + (MouseX * WindowWidth / 256)), Y - 32); - } - } - else if (FullScreen == 0 && device1 == 0 && device2 == 0 && MouseButtonPressed == 0 && GUIOn2 == 1) - { - MouseInput->Unacquire(); - SetCursorPos((int)(X + (MouseX * WindowWidth / 256)), Y - 1); - } - } - - return((int) MouseY); -} - -int GetMouseMoveX(void) -{ - return((int)MouseMoveX); -} - -int GetMouseMoveY(void) -{ - return((int)MouseMoveY); -} - -int GetMouseButton(void) -{ - if (MouseButton == (lhguimouse?2:1)) MouseButtonPressed = 1; - else MouseButtonPressed = 0; - if (MouseButton&(lhguimouse?1:2)) - { - while (MouseButton != 0 && T36HZEnabled && FullScreen == 0) - { - Moving = 1; - X += (int) MouseMoveX; - Y += (int) MouseMoveY; - if (X < 0)X = 0; - if (X > (int)(GetSystemMetrics(SM_CXSCREEN) - WindowWidth)) X = (GetSystemMetrics(SM_CXSCREEN) - WindowWidth); - if (Y < 0)Y=0; - if (Y > (int)(GetSystemMetrics(SM_CYSCREEN) - WindowHeight)) Y = (GetSystemMetrics(SM_CYSCREEN) - WindowHeight); - InputRead(); - initwinvideo(); - } - } - if (Moving == 1) - { - Moving = 0; - initwinvideo(); - } - return((int) MouseButton); -} - -void SetMouseMinX(int MinX) -{ - MouseMinX = (float) MinX; -} - -void SetMouseMaxX(int MaxX) -{ - MouseMaxX = (float) MaxX; -} - -void SetMouseMinY(int MinY) -{ - MouseMinY = (float) MinY; -} - -void SetMouseMaxY(int MaxY) -{ - MouseMaxY = (float) MaxY; -} - -void SetMouseX(int X) -{ - MouseX = (float) X; -} - -void SetMouseY(int Y) -{ - MouseY = (float) Y; -} - -void FrameSemaphore() -{ - if (T60HZEnabled) - { - double delay; - QueryPerformanceCounter((LARGE_INTEGER*)&end); - - delay = ((update_ticks_pc - (end - start)) * 1000.0 / freq) - 3.0; - - if (delay>0.0) WaitForSingleObject(hLock, (unsigned int)delay); - } -} - -void ZsnesPage() -{ - ShellExecute(NULL, NULL, "http://www.zsnes.com/", NULL, NULL, 0); - MouseX = 0; - MouseY = 0; -} - -void DocsPage() -{ - ShellExecute(NULL, NULL, "http://zsnes-docs.sourceforge.net/", NULL, NULL, 0); - MouseX = 0; - MouseY = 0; -} - -extern "C" { -char *CBBuffer; -unsigned int CBLength; -void PasteClipBoard() -{ - if (OpenClipboard(0)) - { - char *p = (char *)GetClipboardData(CF_TEXT); - if (p) - { - strncpy(CBBuffer, p, CBLength); - CBBuffer[CBLength-1] = 0; - - for (p = CBBuffer; *p; p++) - { - if (isspace(*p)) { *p = ' '; } - } - for (p--; p >= CBBuffer; p--) - { - if (isspace(*p)) { *p = 0; } - else { break; } - } - } - CloseClipboard(); - } -} -} - -extern "C" signed int NumberOfOpcodes; - -void WriteLine() -{ - char buf[50]; - sprintf(buf, "%d\n", NumberOfOpcodes); - WriteConsole(debugWindow, buf, strlen(buf), NULL, NULL); -} - -// This function creates the debug console -void InitDebugger() -{ - if(AllocConsole()) - { - debugWindow = GetStdHandle(STD_OUTPUT_HANDLE); - WriteConsole(debugWindow, "Welcome to the ZSNES Debugger v0.01\n", sizeof("Welcome to the ZSNES Debugger v0.01\n"), NULL, NULL); - } -} - -int CheckBattery() -{ - SYSTEM_POWER_STATUS SysPowerStat; - GetSystemPowerStatus(&SysPowerStat); - - if (SysPowerStat.ACLineStatus == 0) //Definitly running off of battery - { - return(1); //Running off of battery - } - - if ((SysPowerStat.BatteryFlag == 255) || //Unknown - (SysPowerStat.BatteryFlag & 128)) //No battery - { - return(-1); - } - - if ((SysPowerStat.BatteryFlag & 8) || //Charging - (SysPowerStat.ACLineStatus == 1)) //Plugged in - { - return(0); //Plugged in - } - - return(1); //Running off of battery -} - -int CheckBatteryTime() -{ - SYSTEM_POWER_STATUS SysPowerStat; - GetSystemPowerStatus(&SysPowerStat); - return SysPowerStat.BatteryLifeTime; -} - -int CheckBatteryPercent() -{ - SYSTEM_POWER_STATUS SysPowerStat; - GetSystemPowerStatus(&SysPowerStat); - return((SysPowerStat.BatteryLifePercent == 255) ? -1 : SysPowerStat.BatteryLifePercent); -} - -extern "C" unsigned int delayvalue; - -// Delay function for GUI -void DoSleep() -{ - // Fraction value for windows version of sleep - delayvalue /= 100; - - Sleep(delayvalue); -} - -extern "C" unsigned int PrevBuildNum; - -void DisplayWIPDisclaimer() -{ - unsigned int version_hash(); - unsigned int CurrentBuildNum = version_hash(); - - if (CurrentBuildNum != PrevBuildNum) - { - MessageBox(NULL, "This build of ZSNES is a WORK IN PROGRESS. This means that it is known to contain bugs and certain features\nmay or may not be working correctly. This build is not any representation of final work and is provided AS IS\nfor people to try bleeding edge code.\n\nPlease see http://zsnes.game-host.org/~pagefault/ for a list of current issues.", "Disclaimer", MB_OK); - PrevBuildNum = CurrentBuildNum; - } -} - - -} diff --git a/tools/zsnes/src/win/zsnes.ico b/tools/zsnes/src/win/zsnes.ico deleted file mode 100644 index b154265..0000000 Binary files a/tools/zsnes/src/win/zsnes.ico and /dev/null differ diff --git a/tools/zsnes/src/win/zsnes.rc b/tools/zsnes/src/win/zsnes.rc deleted file mode 100644 index 74a98a4..0000000 --- a/tools/zsnes/src/win/zsnes.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "resource.h" - -IDI_ICON1 ICON DISCARDABLE "zsnes.ico" diff --git a/tools/zsnes/src/zip/unzip.c b/tools/zsnes/src/zip/unzip.c deleted file mode 100644 index 20549e7..0000000 --- a/tools/zsnes/src/zip/unzip.c +++ /dev/null @@ -1,1305 +0,0 @@ -/* unzip.c -- IO on .zip files using zlib - Version 0.15 beta, Mar 19th, 1998, - - Read unzip.h for more info -*/ - -#ifdef __UNIXSDL__ -#include "../gblhdr.h" -#else -#include -#include -#include -#include -#endif - -#include "zunzip.h" - -#ifdef STDC -# include -# include -# include -#endif -#ifdef NO_ERRNO_H - extern int errno; -#else -# include -#endif - - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - - - -#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \ - !defined(CASESENSITIVITYDEFAULT_NO) -#define CASESENSITIVITYDEFAULT_NO -#endif - - -#ifndef UNZ_BUFSIZE -#define UNZ_BUFSIZE (16384) -#endif - -#ifndef UNZ_MAXFILENAMEINZIP -#define UNZ_MAXFILENAMEINZIP (256) -#endif - -#ifndef ALLOC -# define ALLOC(size) (malloc(size)) -#endif -#ifndef TRYFREE -# define TRYFREE(p) {if (p) free(p);} -#endif - -#define SIZECENTRALDIRITEM (0x2e) -#define SIZEZIPLOCALHEADER (0x1e) - - -/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ - -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif - -#ifndef SEEK_END -#define SEEK_END 2 -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - -const char unz_copyright[] = - " unzip 0.15 Copyright 1998 Gilles Vollant "; - -/* unz_file_info_interntal contain internal info about a file in zipfile*/ -typedef struct unz_file_info_internal_s -{ - uLong offset_curfile;/* relative offset of local header 4 bytes */ -} unz_file_info_internal; - - -/* file_in_zip_read_info_s contain internal information about a file in zipfile, - when reading and decompress it */ -typedef struct -{ - char *read_buffer; /* internal buffer for compressed data */ - z_stream stream; /* zLib stream structure for inflate */ - - uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ - uLong stream_initialised; /* flag set if stream structure is initialised*/ - - uLong offset_local_extrafield;/* offset of the local extra field */ - uInt size_local_extrafield;/* size of the local extra field */ - uLong pos_local_extrafield; /* position in the local extra field in read*/ - - uLong crc32; /* crc32 of all data uncompressed */ - uLong crc32_wait; /* crc32 we must obtain after decompress all */ - uLong rest_read_compressed; /* number of byte to be decompressed */ - uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/ - FILE* file; /* io structore of the zipfile */ - uLong compression_method; /* compression method (0==store) */ - uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ -} file_in_zip_read_info_s; - - -/* unz_s contain internal information about the zipfile -*/ -typedef struct -{ - FILE* file; /* io structore of the zipfile */ - unz_global_info gi; /* public global information */ - uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ - uLong num_file; /* number of the current file in the zipfile*/ - uLong pos_in_central_dir; /* pos of the current file in the central dir*/ - uLong current_file_ok; /* flag about the usability of the current file*/ - uLong central_pos; /* position of the beginning of the central dir*/ - - uLong size_central_dir; /* size of the central directory */ - uLong offset_central_dir; /* offset of start of central directory with - respect to the starting disk number */ - - unz_file_info cur_file_info; /* public info about the current file in zip*/ - unz_file_info_internal cur_file_info_internal; /* private info about it*/ - file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current - file if we are decompressing it */ -} unz_s; - - -/* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF - for end of file. - IN assertion: the stream s has been sucessfully opened for reading. -*/ - - -local int unzlocal_getByte(fin,pi) - FILE *fin; - int *pi; -{ - unsigned char c; - int err = fread(&c, 1, 1, fin); - if (err==1) - { - *pi = (int)c; - return UNZ_OK; - } - else - { - if (ferror(fin)) - return UNZ_ERRNO; - else - return UNZ_EOF; - } -} - - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets -*/ -local int unzlocal_getShort (fin,pX) - FILE* fin; - uLong *pX; -{ - uLong x ; - int i; - int err; - - err = unzlocal_getByte(fin,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<8; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - -local int unzlocal_getLong (fin,pX) - FILE* fin; - uLong *pX; -{ - uLong x ; - int i; - int err; - - err = unzlocal_getByte(fin,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<8; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<16; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<24; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - - -/* My own strcmpi / strcasecmp */ -local int strcmpcasenosensitive_internal (fileName1,fileName2) - const char* fileName1; - const char* fileName2; -{ - for (;;) - { - char c1=*(fileName1++); - char c2=*(fileName2++); - if ((c1>='a') && (c1<='z')) - c1 -= 0x20; - if ((c2>='a') && (c2<='z')) - c2 -= 0x20; - if (c1=='\0') - return ((c2=='\0') ? 0 : -1); - if (c2=='\0') - return 1; - if (c1c2) - return 1; - } -} - - -#ifdef CASESENSITIVITYDEFAULT_NO -#define CASESENSITIVITYDEFAULTVALUE 2 -#else -#define CASESENSITIVITYDEFAULTVALUE 1 -#endif - -#ifndef STRCMPCASENOSENTIVEFUNCTION -#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal -#endif - -/* - Compare two filename (fileName1,fileName2). - If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) - If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) - If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) - -*/ -extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity) - const char* fileName1; - const char* fileName2; - int iCaseSensitivity; -{ - if (iCaseSensitivity==0) - iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; - - if (iCaseSensitivity==1) - return strcmp(fileName1,fileName2); - - return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); -} - -#define BUFREADCOMMENT (0x400) - -/* - Locate the Central directory of a zipfile (at the end, just before - the global comment) -*/ -local uLong unzlocal_SearchCentralDir(fin) - FILE *fin; -{ - unsigned char* buf; - uLong uSizeFile; - uLong uBackRead; - uLong uMaxBack=0xffff; /* maximum size of global comment */ - uLong uPosFound=0; - - if (fseek(fin,0,SEEK_END) != 0) - return 0; - - - uSizeFile = ftell( fin ); - - if (uMaxBack>uSizeFile) - uMaxBack = uSizeFile; - - buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); - if (buf==NULL) - return 0; - - uBackRead = 4; - while (uBackReaduMaxBack) - uBackRead = uMaxBack; - else - uBackRead+=BUFREADCOMMENT; - uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? - (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); - if (fseek(fin,uReadPos,SEEK_SET)!=0) - break; - - if (fread(buf,(uInt)uReadSize,1,fin)!=1) - break; - - for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && - ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) - { - uPosFound = uReadPos+i; - break; - } - - if (uPosFound!=0) - break; - } - TRYFREE(buf); - return uPosFound; -} - -/* - Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer - "zlib/zlib109.zip". - If the zipfile cannot be opened (file don't exist or in not valid), the - return value is NULL. - Else, the return value is a unzFile Handle, usable with other function - of this unzip package. -*/ -extern unzFile ZEXPORT unzOpen (path) - const char *path; -{ - unz_s us; - unz_s *s; - uLong central_pos,uL; - FILE * fin ; - - uLong number_disk; /* number of the current dist, used for - spaning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used - for spaning ZIP, unsupported, always 0*/ - uLong number_entry_CD; /* total number of entries in - the central dir - (same than number_entry on nospan) */ - - int err=UNZ_OK; - - if (unz_copyright[0]!=' ') - return NULL; - - fin=fopen(path,"rb"); - if (fin==NULL) - return NULL; - - central_pos = unzlocal_SearchCentralDir(fin); - if (central_pos==0) - err=UNZ_ERRNO; - - if (fseek(fin,central_pos,SEEK_SET)!=0) - err=UNZ_ERRNO; - - /* the signature, already checked */ - if (unzlocal_getLong(fin,&uL)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of this disk */ - if (unzlocal_getShort(fin,&number_disk)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of the disk with the start of the central directory */ - if (unzlocal_getShort(fin,&number_disk_with_CD)!=UNZ_OK) - err=UNZ_ERRNO; - - /* total number of entries in the central dir on this disk */ - if (unzlocal_getShort(fin,&us.gi.number_entry)!=UNZ_OK) - err=UNZ_ERRNO; - - /* total number of entries in the central dir */ - if (unzlocal_getShort(fin,&number_entry_CD)!=UNZ_OK) - err=UNZ_ERRNO; - - if ((number_entry_CD!=us.gi.number_entry) || - (number_disk_with_CD!=0) || - (number_disk!=0)) - err=UNZ_BADZIPFILE; - - /* size of the central directory */ - if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; - - /* offset of start of central directory with respect to the - starting disk number */ - if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; - - /* zipfile comment length */ - if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) - err=UNZ_ERRNO; - - if ((central_pospfile_in_zip_read!=NULL) - unzCloseCurrentFile(file); - - fclose(s->file); - TRYFREE(s); - return UNZ_OK; -} - - -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. */ -extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info) - unzFile file; - unz_global_info *pglobal_info; -{ - unz_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - *pglobal_info=s->gi; - return UNZ_OK; -} - - -/* - Translate date/time from Dos format to tm_unz (readable more easilty) -*/ -local void unzlocal_DosDateToTmuDate (ulDosDate, ptm) - uLong ulDosDate; - tm_unz* ptm; -{ - uLong uDate; - uDate = (uLong)(ulDosDate>>16); - ptm->tm_mday = (uInt)(uDate&0x1f) ; - ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; - ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; - - ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); - ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; - ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; -} - -/* - Get Info about the current file in the zipfile, with internal only info -*/ -local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, - unz_file_info *pfile_info, - unz_file_info_internal - *pfile_info_internal, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); - -local int unzlocal_GetCurrentFileInfoInternal (file, - pfile_info, - pfile_info_internal, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - unz_file_info_internal *pfile_info_internal; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; -{ - unz_s* s; - unz_file_info file_info; - unz_file_info_internal file_info_internal; - int err=UNZ_OK; - uLong uMagic; - long lSeek=0; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (fseek(s->file,s->pos_in_central_dir+s->byte_before_the_zipfile,SEEK_SET)!=0) - err=UNZ_ERRNO; - - - /* we check the magic */ - if (err==UNZ_OK) - { - if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x02014b50) - err=UNZ_BADZIPFILE; - } - - if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.version_needed) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.flag) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.compression_method) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info.dosDate) != UNZ_OK) - err=UNZ_ERRNO; - - unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); - - if (unzlocal_getLong(s->file,&file_info.crc) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info.compressed_size) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info.uncompressed_size) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.size_filename) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.size_file_extra) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.size_file_comment) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.disk_num_start) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.internal_fa) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info.external_fa) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK) - err=UNZ_ERRNO; - - lSeek+=file_info.size_filename; - if ((err==UNZ_OK) && (szFileName!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_filename0) && (fileNameBufferSize>0)) - if (fread(szFileName,(uInt)uSizeRead,1,s->file)!=1) - err=UNZ_ERRNO; - lSeek -= uSizeRead; - } - - - if ((err==UNZ_OK) && (extraField!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_file_extrafile,lSeek,SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - } - if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) - if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1) - err=UNZ_ERRNO; - lSeek += file_info.size_file_extra - uSizeRead; - } - else - lSeek+=file_info.size_file_extra; - - - if ((err==UNZ_OK) && (szComment!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_file_commentfile,lSeek,SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - } - if ((file_info.size_file_comment>0) && (commentBufferSize>0)) - if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1) - err=UNZ_ERRNO; - lSeek+=file_info.size_file_comment - uSizeRead; - } - else - lSeek+=file_info.size_file_comment; - - if ((err==UNZ_OK) && (pfile_info!=NULL)) - *pfile_info=file_info; - - if ((err==UNZ_OK) && (pfile_info_internal!=NULL)) - *pfile_info_internal=file_info_internal; - - return err; -} - - - -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. -*/ -extern int ZEXPORT unzGetCurrentFileInfo (file, - pfile_info, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; -{ - return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL, - szFileName,fileNameBufferSize, - extraField,extraFieldBufferSize, - szComment,commentBufferSize); -} - -/* - Set the current file of the zipfile to the first file. - return UNZ_OK if there is no problem -*/ -extern int ZEXPORT unzGoToFirstFile (file) - unzFile file; -{ - int err=UNZ_OK; - unz_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - s->pos_in_central_dir=s->offset_central_dir; - s->num_file=0; - err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - - -/* - Set the current file of the zipfile to the next file. - return UNZ_OK if there is no problem - return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. -*/ -extern int ZEXPORT unzGoToNextFile (file) - unzFile file; -{ - unz_s* s; - int err; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - if (s->num_file+1==s->gi.number_entry) - return UNZ_END_OF_LIST_OF_FILE; - - s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + - s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; - s->num_file++; - err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - - -/* - Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzipStringFileNameCompare - - return value : - UNZ_OK if the file is found. It becomes the current file. - UNZ_END_OF_LIST_OF_FILE if the file is not found -*/ -extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) - unzFile file; - const char *szFileName; - int iCaseSensitivity; -{ - unz_s* s; - int err; - - - uLong num_fileSaved; - uLong pos_in_central_dirSaved; - - - if (file==NULL) - return UNZ_PARAMERROR; - - if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) - return UNZ_PARAMERROR; - - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - - num_fileSaved = s->num_file; - pos_in_central_dirSaved = s->pos_in_central_dir; - - err = unzGoToFirstFile(file); - - while (err == UNZ_OK) - { - char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; - unzGetCurrentFileInfo(file,NULL, - szCurrentFileName,sizeof(szCurrentFileName)-1, - NULL,0,NULL,0); - if (unzStringFileNameCompare(szCurrentFileName, - szFileName,iCaseSensitivity)==0) - return UNZ_OK; - err = unzGoToNextFile(file); - } - - s->num_file = num_fileSaved ; - s->pos_in_central_dir = pos_in_central_dirSaved ; - return err; -} - - -/* - Read the local header of the current zipfile - Check the coherency of the local header and info in the end of central - directory about this file - store in *piSizeVar the size of extra info in local header - (filename and size of extra field data) -*/ -local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, - poffset_local_extrafield, - psize_local_extrafield) - unz_s* s; - uInt* piSizeVar; - uLong *poffset_local_extrafield; - uInt *psize_local_extrafield; -{ - uLong uMagic,uData,uFlags; - uLong size_filename; - uLong size_extra_field; - int err=UNZ_OK; - - *piSizeVar = 0; - *poffset_local_extrafield = 0; - *psize_local_extrafield = 0; - - if (fseek(s->file,s->cur_file_info_internal.offset_curfile + - s->byte_before_the_zipfile,SEEK_SET)!=0) - return UNZ_ERRNO; - - - if (err==UNZ_OK) - { - if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x04034b50) - err=UNZ_BADZIPFILE; - } - - if (unzlocal_getShort(s->file,&uData) != UNZ_OK) - err=UNZ_ERRNO; -/* - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) - err=UNZ_BADZIPFILE; -*/ - if (unzlocal_getShort(s->file,&uFlags) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&uData) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) - err=UNZ_BADZIPFILE; - - if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; - - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - - if (unzlocal_getShort(s->file,&size_filename) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) - err=UNZ_BADZIPFILE; - - *piSizeVar += (uInt)size_filename; - - if (unzlocal_getShort(s->file,&size_extra_field) != UNZ_OK) - err=UNZ_ERRNO; - *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + - SIZEZIPLOCALHEADER + size_filename; - *psize_local_extrafield = (uInt)size_extra_field; - - *piSizeVar += (uInt)size_extra_field; - - return err; -} - -/* - Open for reading data the current file in the zipfile. - If there is no error and the file is opened, the return value is UNZ_OK. -*/ -extern int ZEXPORT unzOpenCurrentFile (file) - unzFile file; -{ - int err=UNZ_OK; - int Store; - uInt iSizeVar; - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - uLong offset_local_extrafield; /* offset of the local extra field */ - uInt size_local_extrafield; /* size of the local extra field */ - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_PARAMERROR; - - if (s->pfile_in_zip_read != NULL) - unzCloseCurrentFile(file); - - if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, - &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) - return UNZ_BADZIPFILE; - - pfile_in_zip_read_info = (file_in_zip_read_info_s*) - ALLOC(sizeof(file_in_zip_read_info_s)); - if (pfile_in_zip_read_info==NULL) - return UNZ_INTERNALERROR; - - pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); - pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; - pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; - pfile_in_zip_read_info->pos_local_extrafield=0; - - if (pfile_in_zip_read_info->read_buffer==NULL) - { - TRYFREE(pfile_in_zip_read_info); - return UNZ_INTERNALERROR; - } - - pfile_in_zip_read_info->stream_initialised=0; - - if ((s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; - Store = s->cur_file_info.compression_method==0; - - pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; - pfile_in_zip_read_info->crc32=0; - pfile_in_zip_read_info->compression_method = - s->cur_file_info.compression_method; - pfile_in_zip_read_info->file=s->file; - pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; - - pfile_in_zip_read_info->stream.total_out = 0; - - if (!Store) - { - pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; - pfile_in_zip_read_info->stream.zfree = (free_func)0; - pfile_in_zip_read_info->stream.opaque = (voidpf)0; - - err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); - if (err == Z_OK) - pfile_in_zip_read_info->stream_initialised=1; - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. - * In unzip, i don't wait absolutely Z_STREAM_END because I known the - * size of both compressed and uncompressed data - */ - } - pfile_in_zip_read_info->rest_read_compressed = - s->cur_file_info.compressed_size ; - pfile_in_zip_read_info->rest_read_uncompressed = - s->cur_file_info.uncompressed_size ; - - - pfile_in_zip_read_info->pos_in_zipfile = - s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + - iSizeVar; - - pfile_in_zip_read_info->stream.avail_in = (uInt)0; - - - s->pfile_in_zip_read = pfile_in_zip_read_info; - return UNZ_OK; -} - - -/* - Read bytes from the current file. - buf contain buffer where data must be copied - len the size of buf. - - return the number of byte copied if somes bytes are copied - return 0 if the end of file was reached - return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) -*/ -extern int ZEXPORT unzReadCurrentFile (file, buf, len) - unzFile file; - voidp buf; - unsigned len; -{ - int err=UNZ_OK; - uInt iRead = 0; - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - - if ((pfile_in_zip_read_info->read_buffer == NULL)) - return UNZ_END_OF_LIST_OF_FILE; - if (len==0) - return 0; - - pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; - - pfile_in_zip_read_info->stream.avail_out = (uInt)len; - - if (len>pfile_in_zip_read_info->rest_read_uncompressed) - pfile_in_zip_read_info->stream.avail_out = - (uInt)pfile_in_zip_read_info->rest_read_uncompressed; - - while (pfile_in_zip_read_info->stream.avail_out>0) - { - if ((pfile_in_zip_read_info->stream.avail_in==0) && - (pfile_in_zip_read_info->rest_read_compressed>0)) - { - uInt uReadThis = UNZ_BUFSIZE; - if (pfile_in_zip_read_info->rest_read_compressedrest_read_compressed; - if (uReadThis == 0) - return UNZ_EOF; - if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->pos_in_zipfile + - pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) - return UNZ_ERRNO; - if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, - pfile_in_zip_read_info->file)!=1) - return UNZ_ERRNO; - pfile_in_zip_read_info->pos_in_zipfile += uReadThis; - - pfile_in_zip_read_info->rest_read_compressed-=uReadThis; - - pfile_in_zip_read_info->stream.next_in = - (Bytef*)pfile_in_zip_read_info->read_buffer; - pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; - } - - if (pfile_in_zip_read_info->compression_method==0) - { - uInt uDoCopy,i ; - if (pfile_in_zip_read_info->stream.avail_out < - pfile_in_zip_read_info->stream.avail_in) - uDoCopy = pfile_in_zip_read_info->stream.avail_out ; - else - uDoCopy = pfile_in_zip_read_info->stream.avail_in ; - - for (i=0;istream.next_out+i) = - *(pfile_in_zip_read_info->stream.next_in+i); - - pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, - pfile_in_zip_read_info->stream.next_out, - uDoCopy); - pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; - pfile_in_zip_read_info->stream.avail_in -= uDoCopy; - pfile_in_zip_read_info->stream.avail_out -= uDoCopy; - pfile_in_zip_read_info->stream.next_out += uDoCopy; - pfile_in_zip_read_info->stream.next_in += uDoCopy; - pfile_in_zip_read_info->stream.total_out += uDoCopy; - iRead += uDoCopy; - } - else - { - uLong uTotalOutBefore,uTotalOutAfter; - const Bytef *bufBefore; - uLong uOutThis; - int flush=Z_SYNC_FLUSH; - - uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; - bufBefore = pfile_in_zip_read_info->stream.next_out; - - /* - if ((pfile_in_zip_read_info->rest_read_uncompressed == - pfile_in_zip_read_info->stream.avail_out) && - (pfile_in_zip_read_info->rest_read_compressed == 0)) - flush = Z_FINISH; - */ - err=inflate(&pfile_in_zip_read_info->stream,flush); - - uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; - uOutThis = uTotalOutAfter-uTotalOutBefore; - - pfile_in_zip_read_info->crc32 = - crc32(pfile_in_zip_read_info->crc32,bufBefore, - (uInt)(uOutThis)); - - pfile_in_zip_read_info->rest_read_uncompressed -= - uOutThis; - - iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - - if (err==Z_STREAM_END) - return (iRead==0) ? UNZ_EOF : iRead; - if (err!=Z_OK) - break; - } - } - - if (err==Z_OK) - return iRead; - return err; -} - - -/* - Give the current position in uncompressed data -*/ -extern z_off_t ZEXPORT unztell (file) - unzFile file; -{ - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - return (z_off_t)pfile_in_zip_read_info->stream.total_out; -} - - -/* - return 1 if the end of file was reached, 0 elsewhere -*/ -extern int ZEXPORT unzeof (file) - unzFile file; -{ - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - return 1; - else - return 0; -} - - - -/* - Read extra field from the current file (opened by unzOpenCurrentFile) - This is the local-header version of the extra field (sometimes, there is - more info in the local-header version than in the central-header) - - if buf==NULL, it return the size of the local extra field that can be read - - if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code -*/ -extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) - unzFile file; - voidp buf; - unsigned len; -{ - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - uInt read_now; - uLong size_to_read; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - size_to_read = (pfile_in_zip_read_info->size_local_extrafield - - pfile_in_zip_read_info->pos_local_extrafield); - - if (buf==NULL) - return (int)size_to_read; - - if (len>size_to_read) - read_now = (uInt)size_to_read; - else - read_now = (uInt)len ; - - if (read_now==0) - return 0; - - if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->offset_local_extrafield + - pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) - return UNZ_ERRNO; - - if (fread(buf,(uInt)size_to_read,1,pfile_in_zip_read_info->file)!=1) - return UNZ_ERRNO; - - return (int)read_now; -} - -/* - Close the file in zip opened with unzipOpenCurrentFile - Return UNZ_CRCERROR if all the file was read but the CRC is not good -*/ -extern int ZEXPORT unzCloseCurrentFile (file) - unzFile file; -{ - int err=UNZ_OK; - - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - { - if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) - err=UNZ_CRCERROR; - } - - - TRYFREE(pfile_in_zip_read_info->read_buffer); - pfile_in_zip_read_info->read_buffer = NULL; - if (pfile_in_zip_read_info->stream_initialised) - inflateEnd(&pfile_in_zip_read_info->stream); - - pfile_in_zip_read_info->stream_initialised = 0; - TRYFREE(pfile_in_zip_read_info); - - s->pfile_in_zip_read=NULL; - - return err; -} - - -/* - Get the global comment string of the ZipFile, in the szComment buffer. - uSizeBuf is the size of the szComment buffer. - return the number of byte copied or an error code <0 -*/ -extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) - unzFile file; - char *szComment; - uLong uSizeBuf; -{ - unz_s* s; - uLong uReadThis ; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - - uReadThis = uSizeBuf; - if (uReadThis>s->gi.size_comment) - uReadThis = s->gi.size_comment; - - if (fseek(s->file,s->central_pos+22,SEEK_SET)!=0) - return UNZ_ERRNO; - - if (uReadThis>0) - { - *szComment='\0'; - if (fread(szComment,(uInt)uReadThis,1,s->file)!=1) - return UNZ_ERRNO; - } - - if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) - *(szComment+s->gi.size_comment)='\0'; - return (int)uReadThis; -} diff --git a/tools/zsnes/src/zip/zpng.c b/tools/zsnes/src/zip/zpng.c deleted file mode 100644 index 1e95a0c..0000000 --- a/tools/zsnes/src/zip/zpng.c +++ /dev/null @@ -1,286 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef NO_PNG -#include -#endif - -#ifdef __UNIXSDL__ -#include "../gblhdr.h" -#else -#include -#ifdef __WIN32__ -#include -#else -#include -#endif -#endif -#include "../zpath.h" - -#define NUMCONV_FW2 -#define NUMCONV_FW3 -#define NUMCONV_FW4 -#include "../numconv.h" - -#ifdef __MSDOS__ -#define MAX_PNGNAME_LEN 13 -#else -#define MAX_PNGNAME_LEN (strlen(ZSaveName)+11) //11 = _12345.png\0 -#endif - -char *generate_image_filename(const char *image_suffix) -{ - char *filename = (char *)malloc(MAX_PNGNAME_LEN); - if (filename) - { - unsigned int i; -#ifdef __MSDOS__ - char *p = filename+3; - strcpy(filename, "img"); -#else - char *p; - strcpy(filename, ZSaveName); - p = strrchr(filename, '.'); - if (!p) { p = filename+strlen(filename); } - *p++ = '_'; -#endif - for (i = 0; i < 100000; i++) - { - sprintf(p, "%05d.%s", i, image_suffix); - if (access_dir(ZSnapPath, filename, F_OK)) - { - break; - } - } - if (i == 100000) - { - free(filename); - filename = 0; - } - } - return(filename); -} - -extern unsigned short *vidbuffer; -extern unsigned short resolutn; - -#define SNAP_HEIGHT resolutn -#define SNAP_WIDTH 256 -#define PIXEL (vidbuffer[((y+1)*288) + x + 16]) - -#ifndef NO_PNG - -#define PIXEL_SIZE 3 -int Png_Dump(const char *filename, unsigned short width, unsigned short height, unsigned char *image_data, bool usebgr) -{ - FILE *fp = fopen_dir(ZSnapPath, filename, "wb"); - if (fp) - { - //Try to create png write struct, fail if we cannot. - png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); - if (png_ptr) - { - png_infop info_ptr; - - //set png I/O source. - png_init_io(png_ptr, fp); - - //set the zlib compression level - png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); - - //set other zlib parameters - png_set_compression_mem_level(png_ptr, 8); - png_set_compression_strategy(png_ptr, Z_DEFAULT_STRATEGY); - png_set_compression_window_bits(png_ptr, 15); - png_set_compression_method(png_ptr, 8); - png_set_compression_buffer_size(png_ptr, 8192); - - //try to create info struct. Fail and delete existing structs if info struct cannot be created. - info_ptr = png_create_info_struct(png_ptr); - if (info_ptr) - { - png_bytep *row_pointers; - - //Set scanline width for 32-bit color data - unsigned int scanline = width*PIXEL_SIZE; - int png_transforms = 0; - - unsigned int i; - - //set a lot of image info (code adapted from libpng documentation!) - png_set_IHDR(png_ptr, info_ptr, width, height, 8, - PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - info_ptr->color_type = PNG_COLOR_TYPE_RGB; - - //Allocate an array of scanline pointers - row_pointers = (png_bytep*)malloc(height*sizeof(png_bytep)); - for (i = 0; i < height; i++) - { - #ifdef __UPSIDE_DOWN__ - //invert to normal image format. - row_pointers[i] = image_data + scanline*(height-i-1); - #else - row_pointers[i] = image_data + scanline*i; - #endif - } - - //tell the png library what to encode. - png_set_rows(png_ptr, info_ptr, row_pointers); - - if (usebgr) { png_transforms|=PNG_TRANSFORM_BGR; } - //Write image to file - png_write_png(png_ptr, info_ptr, png_transforms, NULL); - fclose(fp); - - //Destroy PNG structs - png_destroy_write_struct(&png_ptr, &info_ptr); - - //clean up dynamically allocated RAM. - free(row_pointers); - - return(0); - } - png_destroy_write_struct(&png_ptr, (png_infopp)NULL); - } - fclose(fp); - } - return(-1); -} - -void Grab_PNG_Data() -{ - char *filename = generate_image_filename("png"); - if (filename) - { - unsigned char *DBits = (unsigned char *)malloc(SNAP_HEIGHT*SNAP_WIDTH*PIXEL_SIZE); - if (DBits) - { - //These are the variables used to perform the 24-bit conversion - unsigned int y = SNAP_HEIGHT, x; - // We can fill the array in any order, so might as well optimize loops - while (y--) - { - for (x=SNAP_WIDTH ; x-- ;) - { - DBits[PIXEL_SIZE*(y*SNAP_WIDTH+x)] = (PIXEL&0xF800) >> 8; - DBits[PIXEL_SIZE*(y*SNAP_WIDTH+x)+1] = (PIXEL&0x07E0) >> 3; - DBits[PIXEL_SIZE*(y*SNAP_WIDTH+x)+2] = (PIXEL&0x001F) << 3; - } - } - //compress and write the PNG - Png_Dump(filename, SNAP_WIDTH, SNAP_HEIGHT, DBits, false); - free(DBits); - } - free(filename); - } -} - -#endif - -void Grab_BMP_Data() -{ - char *filename = generate_image_filename("bmp"); - if (filename) - { - FILE *fp = fopen_dir(ZSnapPath, filename, "wb"); - if (fp) - { - const unsigned int header_size = 26; - const unsigned short width = SNAP_WIDTH; - const unsigned short height = SNAP_HEIGHT; - unsigned short y = height, x; - - fputs("BM", fp); //Header - fwrite4(width*height*3+header_size, fp); //File size - fwrite4(0, fp); //Reserved - fwrite4(header_size, fp); //Offset to bitmap - fwrite4(12, fp); //Length of color explain field; - fwrite2(width, fp); //Width - fwrite2(height, fp); //Height - fwrite2(1, fp); //Planes - fwrite2(24, fp); //Bits per pixel - - while (y--) //Have to write image upside down - { - for (x = 0; x < width; x++) - { - fwrite3(((PIXEL&0xF800) << 8) | ((PIXEL&0x07E0) << 5) | ((PIXEL&0x001F) << 3), fp); - } - } - fclose(fp); - } - free(filename); - } -} - -void Grab_BMP_Data_8() -{ - char *filename = generate_image_filename("bmp"); - if (filename) - { - FILE *fp = fopen_dir(ZSnapPath, filename, "wb"); - if (fp) - { - const unsigned int colors = 256; - const unsigned int palette_size = colors*4; - const unsigned int header_size = palette_size+54; - const unsigned short width = SNAP_WIDTH; - const unsigned short height = SNAP_HEIGHT; - unsigned short y, x; - - fputs("BM", fp); //Header - fwrite4(width*height+header_size, fp); //File size - fwrite4(0, fp); //Reserved - fwrite4(header_size, fp); //Offset to bitmap - fwrite4(40, fp); //Length of color explain field; - fwrite4(width, fp); //Width - fwrite4(height, fp); //Height - fwrite2(1, fp); //Planes - fwrite2(8, fp); //Bits per pixel - fwrite4(0, fp); //Compression Format - fwrite4(width*height, fp); //Bitmap data size - fwrite4(0, fp); //H-Res? - fwrite4(0, fp); //V-Res? - fwrite4(colors, fp); //Colors - fwrite4(colors, fp); //Important Colors - - for (y = 0; y < colors; y++) //Write palette - { - unsigned char byte = 0; - fwrite((unsigned char *)vidbuffer+100000+y*3+3, 1, 1, fp); - fwrite((unsigned char *)vidbuffer+100000+y*3+2, 1, 1, fp); - fwrite((unsigned char *)vidbuffer+100000+y*3+1, 1, 1, fp); - fwrite(&byte, 1, 1, fp); - } - - for (y = height; y-- ;) //Have to write image upside down - { - for (x = 0; x < width; x++) - { - fwrite((unsigned char *)vidbuffer+(y+1)*288+x+16, 1, 1, fp); - } - } - fclose(fp); - } - free(filename); - } -} diff --git a/tools/zsnes/src/zip/zunzip.h b/tools/zsnes/src/zip/zunzip.h deleted file mode 100644 index fb35f7a..0000000 --- a/tools/zsnes/src/zip/zunzip.h +++ /dev/null @@ -1,273 +0,0 @@ -/* unzip.h -- IO for uncompress .zip files using zlib - Version 0.15 beta, Mar 19th, 1998, - - Copyright (C) 1998 Gilles Vollant - - This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g - WinZip, InfoZip tools and compatible. - Encryption and multi volume ZipFile (span) are not supported. - Old compressions used by old PKZip 1.x are not supported - - THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE - CAN CHANGE IN FUTURE VERSION !! - I WAIT FEEDBACK at mail info@winimage.com - Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution - - Condition of use and distribution are the same than zlib : - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - -*/ -/* for more info about .ZIP format, see - ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip - PkWare has also a specification at : - ftp://ftp.pkware.com/probdesc.zip */ - -#ifndef _unz_H -#define _unz_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) -/* like the STRICT of WIN32, we define a pointer that cannot be converted - from (void*) without cast */ -typedef struct TagunzFile__ { int unused; } unzFile__; -typedef unzFile__ *unzFile; -#else -typedef voidp unzFile; -#endif - - -#define UNZ_OK (0) -#define UNZ_END_OF_LIST_OF_FILE (-100) -#define UNZ_ERRNO (Z_ERRNO) -#define UNZ_EOF (0) -#define UNZ_PARAMERROR (-102) -#define UNZ_BADZIPFILE (-103) -#define UNZ_INTERNALERROR (-104) -#define UNZ_CRCERROR (-105) - -/* tm_unz contain date/time info */ -typedef struct tm_unz_s -{ - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ -} tm_unz; - -/* unz_global_info structure contain global data about the ZIPfile - These data comes from the end of central dir */ -typedef struct unz_global_info_s -{ - uLong number_entry; /* total number of entries in - the central dir on this disk */ - uLong size_comment; /* size of the global comment of the zipfile */ -} unz_global_info; - - -/* unz_file_info contain information about a file in the zipfile */ -typedef struct unz_file_info_s -{ - uLong version; /* version made by 2 bytes */ - uLong version_needed; /* version needed to extract 2 bytes */ - uLong flag; /* general purpose bit flag 2 bytes */ - uLong compression_method; /* compression method 2 bytes */ - uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ - uLong crc; /* crc-32 4 bytes */ - uLong compressed_size; /* compressed size 4 bytes */ - uLong uncompressed_size; /* uncompressed size 4 bytes */ - uLong size_filename; /* filename length 2 bytes */ - uLong size_file_extra; /* extra field length 2 bytes */ - uLong size_file_comment; /* file comment length 2 bytes */ - - uLong disk_num_start; /* disk number start 2 bytes */ - uLong internal_fa; /* internal file attributes 2 bytes */ - uLong external_fa; /* external file attributes 4 bytes */ - - tm_unz tmu_date; -} unz_file_info; - -extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, - const char* fileName2, - int iCaseSensitivity)); -/* - Compare two filename (fileName1,fileName2). - If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) - If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) - If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) -*/ - - -extern unzFile ZEXPORT unzOpen OF((const char *path)); -/* - Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer - "zlib/zlib111.zip". - If the zipfile cannot be opened (file don't exist or in not valid), the - return value is NULL. - Else, the return value is a unzFile Handle, usable with other function - of this unzip package. -*/ - -extern int ZEXPORT unzClose OF((unzFile file)); -/* - Close a ZipFile opened with unzipOpen. - If there is files inside the .Zip opened with unzOpenCurrentFile (see later), - these files MUST be closed with unzipCloseCurrentFile before call unzipClose. - return UNZ_OK if there is no problem. */ - -extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, - unz_global_info *pglobal_info)); -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. */ - - -extern int ZEXPORT unzGetGlobalComment OF((unzFile file, - char *szComment, - uLong uSizeBuf)); -/* - Get the global comment string of the ZipFile, in the szComment buffer. - uSizeBuf is the size of the szComment buffer. - return the number of byte copied or an error code <0 -*/ - - -/***************************************************************************/ -/* Unzip package allow you browse the directory of the zipfile */ - -extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); -/* - Set the current file of the zipfile to the first file. - return UNZ_OK if there is no problem -*/ - -extern int ZEXPORT unzGoToNextFile OF((unzFile file)); -/* - Set the current file of the zipfile to the next file. - return UNZ_OK if there is no problem - return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. -*/ - -extern int ZEXPORT unzLocateFile OF((unzFile file, - const char *szFileName, - int iCaseSensitivity)); -/* - Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzStringFileNameCompare - - return value : - UNZ_OK if the file is found. It becomes the current file. - UNZ_END_OF_LIST_OF_FILE if the file is not found -*/ - - -extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, - unz_file_info *pfile_info, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); -/* - Get Info about the current file - if pfile_info!=NULL, the *pfile_info structure will contain somes info about - the current file - if szFileName!=NULL, the filemane string will be copied in szFileName - (fileNameBufferSize is the size of the buffer) - if extraField!=NULL, the extra field information will be copied in extraField - (extraFieldBufferSize is the size of the buffer). - This is the Central-header version of the extra field - if szComment!=NULL, the comment string of the file will be copied in szComment - (commentBufferSize is the size of the buffer) -*/ - -/***************************************************************************/ -/* for reading the content of the current zipfile, you can open it, read data - from it, and close it (you can close it before reading all the file) - */ - -extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); -/* - Open for reading data the current file in the zipfile. - If there is no error, the return value is UNZ_OK. -*/ - -extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); -/* - Close the file in zip opened with unzOpenCurrentFile - Return UNZ_CRCERROR if all the file was read but the CRC is not good -*/ - - -extern int ZEXPORT unzReadCurrentFile OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read bytes from the current file (opened by unzOpenCurrentFile) - buf contain buffer where data must be copied - len the size of buf. - - return the number of byte copied if somes bytes are copied - return 0 if the end of file was reached - return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) -*/ - -extern z_off_t ZEXPORT unztell OF((unzFile file)); -/* - Give the current position in uncompressed data -*/ - -extern int ZEXPORT unzeof OF((unzFile file)); -/* - return 1 if the end of file was reached, 0 elsewhere -*/ - -extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read extra field from the current file (opened by unzOpenCurrentFile) - This is the local-header version of the extra field (sometimes, there is - more info in the local-header version than in the central-header) - - if buf==NULL, it return the size of the local extra field - - if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code -*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _unz_H */ diff --git a/tools/zsnes/src/zloader.c b/tools/zsnes/src/zloader.c deleted file mode 100644 index 8ffcbff..0000000 --- a/tools/zsnes/src/zloader.c +++ /dev/null @@ -1,971 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#ifdef __LIBAO__ -#include -#endif -#else -#define _POSIX_ -#include -#include -#include -#include -#include -#include -#ifdef __WIN32__ -#include -#include -#undef _POSIX_ -#include -#else -#include -#endif -#endif -#include "asm_call.h" -#include "cfg.h" -#include "input.h" -#include "zpath.h" -#include "zloader.h" - -#ifdef __WIN32__ -void ImportDirectX(); -#endif - - -extern unsigned char romtype, MouseDis, ZMVZClose, ZMVRawDump, debugger, debugdisble; -extern unsigned char gammalevel, spcon, ForcePal, DSPDisable, V8Mode; -extern unsigned char autoloadstate, autoloadmovie, MovieForcedLengthEnabled; -extern char *STCart2; -extern unsigned int NumInputDevices, MovieForcedLength; -void zstart(); -#ifdef __WIN32__ -void InitDebugger(); -#endif - -#define put_line(x) \ - if (tty && (lines_out == 22)) \ - { \ - puts(" -- Press Enter to Continue --"); \ - getchar(); \ - lines_out = 0; \ - } \ - puts(x); \ - lines_out++; - -static void display_help() -{ - size_t lines_out = 0; - bool tty = isatty(fileno(stdout)); -#ifdef __UNIXSDL__ -#ifdef __LIBAO__ - int driver_count; - ao_info **driver_info; -#endif - char line[75]; -#endif - - put_line("Usage : zsnes [-d,-f #, ... ] "); - put_line(" Eg : zsnes -s -r 2 game.sfc"); - put_line(""); -#ifdef __MSDOS__ - put_line(" -0 Force black blackground in 8-bit modes"); -#endif - put_line(" -1 #/-2 # Select Player 1/2 Input :"); -#ifdef __MSDOS__ - put_line(" 0 = None 1 = Keyboard 2 = 2 button pad"); - put_line(" 3 = 4 button pad 4 = 6 button pad 5 = 8 button pad"); - put_line(" 6 = Sidewinder #1 7 = Sidewinder #2 8 = Sidewinder #3"); - put_line(" 9 = Sidewinder #4 10 = Gamepad Pro #0 11 = Gamepad Pro #1"); - put_line(" 12 = LPT1 #1 13 = LPT1 #2 14 = LPT1 #3"); - put_line(" 15 = LPT1 #4 16 = LPT1 #5"); -#else - put_line(" 0 = None 1 = Keyboard/Gamepad"); -#endif -#ifndef __UNIXSDL__ - put_line(" -3 Enable triple buffering (replaces vsync)"); -#endif -#ifdef __WIN32__ - put_line(" -6 # Force a user-specified refresh rate for fullscreen modes [50..180]"); -#endif -#ifdef __UNIXSDL__ - put_line(" -ad <> Select Audio Driver :"); - snprintf(line, sizeof(line), "%22s = Automatically select output", "auto"); - put_line(line); -#ifdef __LIBAO__ - driver_info = ao_driver_info_list(&driver_count); - while (driver_count--) - { - if (driver_info[driver_count]->type == AO_TYPE_LIVE) - { - snprintf(line, sizeof(line), "%22s = %s", driver_info[driver_count]->short_name, driver_info[driver_count]->name); - put_line(line); - } - } -#endif - snprintf(line, sizeof(line), "%22s = Simple DirectMedia Layer output", "sdl"); - put_line(line); -#endif -#ifdef __MSDOS__ - put_line(" -8 Force 8-bit sound"); - put_line(" -c Enable full/wide screen (when available)"); - put_line(" -cc Enable small screen (when available)"); -#endif -#ifndef NO_DEBUGGER - put_line(" -d Start with debugger enabled"); -#endif - put_line(" -dd Disable sound SPC700/DSP emulation which also disables sound output"); - put_line(" -ds Disable sound output"); - put_line(" -dh Disable ROM-specific hacks"); - put_line(" -f # Enable fixed frame rate [0..9]"); - put_line(" -g # Specify gamma correction value [0..15]"); - put_line(" -h Force HiROM"); - put_line(" -j Disable mouse (Automatically turns off right mouse click)"); -#ifndef __MSDOS__ - put_line(" -js # Set joystick sensitivity [0..32767]"); -#endif - put_line(" -k # Set volume level [0..100]"); -#ifdef __WIN32__ - put_line(" -kp Enable the KitchenSync for PAL only"); - put_line(" -ks Enable the KitchenSync"); -#endif - put_line(" -l Force LoROM"); - put_line(" -m Disable GUI (Must specify ROM filename)"); - put_line(" -mc Exit ZSNES when closing a movie (use with -zm)"); - put_line(" -md # Dump Video (use with -zm)"); - put_line(" 1 = Raw 2 = FFV1 3 = x264"); - put_line(" 4 = XviD 5 = Custom"); - put_line(" -ml # Define movie dump length in amount of frames (use with -md)"); - put_line(" -n # Enable scanlines (when available)"); - put_line(" 0 = None, 1 = Full, 2 = 25%, 3 = 50%"); - put_line(" -o Disable MMX support"); - put_line(" -p # Percentage of instructions to execute [50..150]"); - put_line(" -r # Set sound sampling rate:"); - put_line(" 0 = 8000Hz 1 = 11025Hz 2 = 22050Hz 3 = 44100Hz"); - put_line(" 4 = 16000Hz 5 = 32000Hz 6 = 48000Hz"); - put_line(" -s Enable sound output and enable SPC700/DSP emulation"); - put_line(" -sa Show all files in GUI (*.*)"); -#ifdef __MSDOS__ - put_line(" -sp Display sound information"); -#endif - put_line(" -t Force NTSC timing"); - put_line(" -u Force PAL timing"); - put_line(" -v # Select video mode :"); -#ifdef __WIN32__ -#define VIDEO_MODE_COUNT 42 - put_line(" 0 = 256x224 R WIN 1 = 256x224 R FULL"); - put_line(" 2 = 512x448 R WIN 3 = 512x448 DR WIN"); - put_line(" 4 = 640x480 S WIN 5 = 640x480 DS WIN"); - put_line(" 6 = 640x480 DR FULL 7 = 640x480 DS FULL"); - put_line(" 8 = 640x480 S FULL 9 = 768x672 R WIN"); - put_line(" 10 = 768x672 DR WIN 11 = 800x600 S WIN"); - put_line(" 12 = 800x600 DS WIN 13 = 800x600 S FULL"); - put_line(" 14 = 800x600 DR FULL 15 = 800x600 DS FULL"); - put_line(" 16 = 1024x768 S WIN 17 = 1024x768 DS WIN"); - put_line(" 18 = 1024x768 S FULL 19 = 1024x768 DR FULL"); - put_line(" 20 = 1024x768 DS FULL 21 = 1024x896 R WIN"); - put_line(" 22 = 1024x896 DR WIN 23 = 1280x960 S WIN"); - put_line(" 24 = 1280x960 DS WIN 25 = 1280x960 S FULL"); - put_line(" 26 = 1280x960 DR FULL 27 = 1280x960 DS FULL"); - put_line(" 28 = 1280x1024 S WIN 29 = 1280x1024 DS WIN"); - put_line(" 30 = 1280x1024 S FULL 31 = 1280x1024 DR FULL"); - put_line(" 32 = 1280x1024 DS FULL 33 = 1600x1200 S WIN"); - put_line(" 34 = 1600x1200 DS WIN 35 = 1600x1200 DR FULL"); - put_line(" 36 = 1600x1200 DS FULL 37 = 1600x1200 S FULL"); - put_line(" 38 = CUSTOM D WIN 39 = CUSTOM DS FULL"); - put_line(" 40 = CUSTOM WIN 41 = CUSTOM S FULL"); - put_line(" 42 = CUSTOM DR FULL"); -#endif -#ifdef __UNIXSDL__ - put_line(" 0 = 256x224 R WIN 1 = 256x224 R FULL"); - put_line(" 2 = 512x448 DR WIN 3 = 512x448 DR FULL"); - put_line(" 4 = 640x480 DR FULL"); -#ifndef __OPENGL__ -#define VIDEO_MODE_COUNT 4 -#else -#define VIDEO_MODE_COUNT 22 - put_line(" 5 = 256x224 O R WIN 6 = 512x448 ODR WIN"); - put_line(" 7 = 640x480 ODS FULL 8 = 640x480 ODS WIN"); - put_line(" 9 = 640x560 ODR WIN 10 = 768x672 ODR WIN"); - put_line(" 11 = 800x600 ODS FULL 12 = 800x600 ODS WIN"); - put_line(" 13 = 896x784 ODR WIN 14 = 1024x768 ODS FULL"); - put_line(" 15 = 1024x768 ODS WIN 16 = 1024x896 ODR WIN"); - put_line(" 17 = 1280x960 ODS FULL 18 = 1280x1024 ODS FULL"); - put_line(" 19 = 1600x1200 ODS FULL 20 = VARIABLE ODR WIN"); - put_line(" 21 = VARIABLE ODS WIN 22 = CUSTOM OD FULL"); -#endif -#endif -#ifdef __MSDOS__ -#define VIDEO_MODE_COUNT 18 - put_line(" 0 = 256x224x8B MODEQ 1 = 256x240x8B MODEQ"); - put_line(" 2 = 256x256x8B MODEQ 3 = 320x224x8B MODEX"); - put_line(" 4 = 320x240x8B MODEX 5 = 320x256x8B MODEX"); - put_line(" 6 = 640x480x16B VESA1 7 = 320x240x8B VESA2"); - put_line(" 8 = 320x240x16B VESA2 9 = 320x480x8B VESA2"); - put_line(" 10 = 320x480x16B VESA2 11 = 512x384x8B VESA2"); - put_line(" 12 = 512x384x16B VESA2 13 = 640x400x8B VESA2"); - put_line(" 14 = 640x400x16B VESA2 15 = 640x480x8B VESA2"); - put_line(" 16 = 640x480x16B VESA2 17 = 800x600x8B VESA2"); - put_line(" 18 = 800x600x16B VESA2"); -#endif - put_line(" -v8 Grayscale mode"); -#ifndef __UNIXSDL__ - put_line(" -w Enable vsync (disables triple buffering)"); -#endif - put_line(" -y Enable anti-aliasing (video interpolation)"); - put_line(" -z Disable stereo sound"); - put_line(" -zm # Auto load specified movie slot on startup [0..9]"); - put_line(" -zs # Auto load specified save state slot on startup [0..99]"); - put_line(""); - put_line(" File Formats Supported by GUI : SMC,SFC,SWC,FIG,MGD,MGH,UFO,BIN,"); - put_line(" GD3,GD7,USA,EUR,JAP,AUS,ST,BS,"); - put_line(" DX2,048,058,078,1,A,GZ,ZIP,JMA"); - put_line(""); -#ifndef __UNIXSDL__ - put_line(" Microsoft-style options (/option) are also accepted"); -#endif -/* -#ifndef __MSDOS__ - put_line(" --Netplay Parameters--"); - put_line(" Commandline: /ABCDE "); - put_line(" nickname = user nickname"); - put_line(" fname = filename w/ full path (if L) or path name (if C)"); - put_line(" IP Addy = IP Address (Client Only)"); - put_line(" A = U (UDP - Recommended if works), T (TCP/IP)"); - put_line(" B = S (Server), C (Client)"); - put_line(" C = C (Chat first), L (load game first)"); - put_line(" D = N (Stay in ZSNES after disconnect), Q (Quit after disconnect)"); - put_line(" E = # of connections (Keep it 2 for now)"); -#ifdef __WIN32__ - put_line(" eg: ZSNESW /UCCN2 nickname d:\\snesroms 202.36.124.28"); -#else - put_line(" eg: zsnes /UCCN2 nickname /home/zuser/snesroms 202.36.124.28"); -#endif -#endif -*/ - - exit(1); -} - -#define ConvertJoyMapHelp(a,b) if (b && (a == b)) { b += 0x81; } - -void ConvertJoyMap1() -{ - unsigned int bl; - // Convert if 2,4,6, or sidewinder - if (pl1contrl == 2) - { - pl1Bk = 0x83; - pl1Yk = 0x82; - pl1upk = 0xCC; - pl1downk = 0xCD; - pl1leftk = 0xCE; - pl1rightk = 0xCF; - } - - bl = (pl1contrl == 3 || pl1contrl == 4) ? 4 : 0; - if (pl1contrl == 5) { bl = 6; } - - if (bl) - { - // Convert button data - pl1upk = 0xCC; - pl1downk = 0xCD; - pl1leftk = 0xCE; - pl1rightk = 0xCF; - ConvertJoyMapHelp(bl, pl1startk); - ConvertJoyMapHelp(bl, pl1selk); - ConvertJoyMapHelp(bl, pl1Yk); - ConvertJoyMapHelp(bl, pl1Xk); - ConvertJoyMapHelp(bl, pl1Bk); - ConvertJoyMapHelp(bl, pl1Ak); - ConvertJoyMapHelp(bl, pl1Lk); - ConvertJoyMapHelp(bl, pl1Rk); - } - - if (pl1contrl == 6) - { - pl1upk = 0xD4; - pl1downk = 0xD5; - pl1leftk = 0xD6; - pl1rightk = 0xD7; - pl1startk = 0xC8; - pl1selk = 0xC9; - pl1Ak = 0x89; - pl1Bk = 0x88; - pl1Xk = 0x8C; - pl1Yk = 0x8B; - pl1Lk = 0x8E; - pl1Rk = 0x8F; - } - return; -} - -void ConvertJoyMap2() -{ - unsigned int bl; - //If pl1contrl=2 and pl2contrl=2, then set pl2 buttons to 3 & 4 - if (pl2contrl == 2) - { - if (pl1contrl != 2) - { - pl2Bk = 0x83; - pl2Yk = 0x82; - pl2upk = 0xCC; - pl2downk = 0xCD; - pl2leftk = 0xCE; - pl2rightk = 0xCF; - } - else - { - pl2Bk = 0x85; - pl2Yk = 0x84; - pl2upk = 0xE8; - pl2downk = 0xE9; - pl2leftk = 0xEA; - pl2rightk = 0xEB; - } - } - - bl = (pl2contrl == 3 || pl2contrl == 4) ? 4 : 0; - if (pl2contrl == 5) { bl = 6; } - - if (bl) - { - //Convert button data - pl2upk = 0xCC; - pl2downk = 0xCD; - pl2leftk = 0xCE; - pl2rightk = 0xCF; - ConvertJoyMapHelp(bl, pl2startk); - ConvertJoyMapHelp(bl, pl2selk); - ConvertJoyMapHelp(bl, pl2Yk); - ConvertJoyMapHelp(bl, pl2Xk); - ConvertJoyMapHelp(bl, pl2Bk); - ConvertJoyMapHelp(bl, pl2Ak); - ConvertJoyMapHelp(bl, pl2Lk); - ConvertJoyMapHelp(bl, pl2Rk); - } - - //If both sidewinder, set pl2 buttons to sw2 - if (pl2contrl == 6) - { - if (pl1contrl != 6) - { - pl2upk = 0xD4; - pl2downk = 0xD5; - pl2leftk = 0xD6; - pl2rightk = 0xD7; - pl2startk = 0xC8; - pl2selk = 0xC9; - pl2Ak = 0x89; - pl2Bk = 0x88; - pl2Xk = 0x8C; - pl2Yk = 0x8B; - pl2Lk = 0x8E; - pl2Rk = 0x8F; - } - else - { - pl2contrl = 7; - pl2upk = 0xDC; - pl2downk = 0xDD; - pl2leftk = 0xDE; - pl2rightk = 0xDF; - pl2startk = 0xD0; - pl2selk = 0xD1; - pl2Ak = 0x91; - pl2Bk = 0x90; - pl2Xk = 0x94; - pl2Yk = 0x93; - pl2Lk = 0x96; - pl2Rk = 0x97; - } - } - return; -} - -struct backup_cmdline_vars saved_cmdline_vars; - -#ifdef __MSDOS__ -#define BACKUP_HELP_DOS(func) \ - func(Palette0); \ - -#else -#define BACKUP_HELP_DOS(func) -#endif - -#ifdef __WIN32__ -#define BACKUP_HELP_WIN(func) \ - func(KitchenSync); \ - func(KitchenSyncPAL); \ - func(ForceRefreshRate); \ - func(SetRefreshRate); \ - func(joy_sensitivity); \ - -#else -#define BACKUP_HELP_WIN(func) -#endif - -#ifdef __UNIXSDL__ -#define BACKUP_HELP_SDL(func) \ -func(joy_sensitivity); \ - -#else -#define BACKUP_HELP_SDL(func) -#endif - - -#define BACKUP_HELP(func) \ - func(guioff) \ - func(per2exec) \ - func(HacksDisable) \ - func(AllowMMX) \ - BACKUP_HELP_DOS(func) \ - BACKUP_HELP_WIN(func) \ - BACKUP_HELP_SDL(func) - -#define BACKUP_VAR(var) saved_cmdline_vars._ ## var = var; -static void backup_all_vars() -{ - BACKUP_HELP(BACKUP_VAR) -} - -#define SWAP_BACKUP_VAR(var) \ - saved_cmdline_vars._ ## var ^= var; \ - var ^= saved_cmdline_vars._ ## var; \ - saved_cmdline_vars._ ## var ^= var; -void swap_backup_vars() -{ - BACKUP_HELP(SWAP_BACKUP_VAR) -} - -static size_t zatoi(const char *str) -{ - const char *orig_str = str; - if (str) - { - while (*str) - { - if (!isdigit(*str++)) { return(~0); } - } - return((size_t)atoi(orig_str)); - } - return(~0); -} - -static void handle_params(int argc, char *argv[]) -{ - int i; - - backup_all_vars(); - - #ifndef __MSDOS__ - - /* - if (argc >= 5 && argv[1][0] == '/' && strlen(argv[1]) == 6) - { - size_t i = 0, j = 0; - char *strp; - - if (toupper(argv[1][1]) == 'T') UDPConfig=0; - - //Next should be # of connections - - while (argv[2][i]!=0) - { - switch (argv[2][i]) - { - case '_': - case '-': - case '^': - case '=': - case '+': - case '[': - case ']': - if ( j < 10) - { - strp[j] = argv[2][i]; - j++; - } - break; - - default: - if (((toupper(argv[2][i]) >= 'A') && (toupper(argv[2][i]) <= 'Z')) || - ((argv[2][i] >= '0') && (argv[2][i] <= '9'))) - { - if (j < 10) - { - strp[j] = argv[2][i]; - j++; - } - } - break; - } - i++; - } - strp[j] = 0; - - } - */ - #endif - - for (i = 1; i < argc; i++) - { - #ifndef __UNIXSDL__ - if (argv[i][0] == '-' || argv[i][0] == '/') - #else - if (argv[i][0] == '-') - #endif - { - if (!argv[i][1]) //Nothing but a - or / - { - display_help(); - } - else if (!argv[i][2]) //- followed by a single letter - { - switch (tolower(argv[i][1])) - { - #ifdef __MSDOS__ - case '0': //Palette color 0 disable - Palette0 = 1; - break; - #endif - - case '1': //Player 1 Input - i++; - - if ((pl1contrl = zatoi(argv[i])) >= NumInputDevices) - { - printf("Player 1 Input must be a value from 0 to %u!\n", NumInputDevices); - exit(1); - } - - ConvertJoyMap1(); - break; - - case '2': //Player 2 Input - i++; - - if ((pl2contrl = zatoi(argv[i])) > NumInputDevices) - { - printf("Player 2 Input must be a value from 0 to %u!\n", NumInputDevices); - exit(1); - } - - ConvertJoyMap2(); - break; - - #ifndef __UNIXSDL__ - case '3': //Enable triple buffering for DOS/Windows - vsyncon = 0; - #ifdef __MSDOS__ - Triplebufen = 1; - #elif __WIN32__ - TripleBufferWin = 1; - #endif - break; - #endif - - #ifdef __WIN32__ - case '6': //Force Refresh Rate - i++; - SetRefreshRate = zatoi(argv[i]); - if((SetRefreshRate < 50) || (SetRefreshRate > 180)) - { - ForceRefreshRate = 0; - puts("Refresh Rate must be a value 50 to 180!"); - exit(1); - } - else - { - ForceRefreshRate = 1; - } - break; - #endif - - #ifdef __MSDOS__ - case '8': //Force 8-bit sound - Force8b = 1; - break; - - case 'c': //Enable full screen (when available) - ScreenScale = 1; - break; - #endif - - #ifndef NO_DEBUGGER - case 'd': //Start with debugger enabled - debugger = 1; - debugdisble = 0; - #ifdef __WIN32__ - InitDebugger(); - #endif - break; - #endif - - case 'f': //Enable fixed frame rate - i++; - if ((frameskip = zatoi(argv[i])+1) > 10) - { - puts("Frame Skip must be a value of 0 to 9!"); - exit(1); - } - break; - - case 'g': //Specify gamma correction value - i++; - if ((gammalevel = zatoi(argv[i])) > 15) - { - puts("Gamma Correction Level must be a value of 0 to 15!"); - exit(1); - } - break; - - case 'h': //Force HiROM - romtype = 2; - break; - - case 'j': //Disable mouse - MouseDis = 1; - break; - - case 'k': //Set volume level - i++; - if ((MusicRelVol = zatoi(argv[i])) > 100) - { - puts("Volume must be a value from 0 to 100!"); - exit(1); - } - break; - - case 'l': //Force LoROM - romtype = 1; - break; - - case 'm': //Disable GUI - guioff = 1; - break; - - case 'n': //Enable scanlines (when available) - i++; - if ((scanlines = zatoi(argv[i])) > 3) - { - puts("Scanlines must be a value 0 to 3!"); - exit(1); - } - break; - - case 'o': //Disable MMX support - AllowMMX = 0; - break; - - case 'p': //Percentage of instructions to execute - i++; - per2exec = zatoi(argv[i]); - if (per2exec > 150 || per2exec < 50) - { - puts("Percentage of instructions to execute must be a value from 50 to 150!"); - exit(1); - } - break; - - case 'r': //Set sampling rate - i++; - if ((SoundQuality = zatoi(argv[i])) > 6) - { - puts("Sound Sampling Rate must be a value of 0 to 6!"); - exit(1); - } - break; - - case 's': //Enable sound output, and SPC700/DSP emulation - spcon = 1; - soundon = 1; - break; - - case 't': //Force NTSC - ForcePal = 1; - break; - - case 'u': //Force PAL - ForcePal = 2; - break; - - case 'v': //Select video mode - i++; - if ((cvidmode = zatoi(argv[i])) > VIDEO_MODE_COUNT) - { - puts("Invalid Video Mode!"); - exit(1); - } - break; - - #ifndef __UNIXSDL__ - case 'w': //Enable vsync for DOS/Windows - vsyncon = 1; - #ifdef __MSDOS__ - Triplebufen = 0; - #elif __WIN32__ - TripleBufferWin = 0; - #endif - break; - #endif - - case 'y': //Enable anti-aliasing - antienab = 1; - break; - - case 'z': //Disable stereo sound - StereoSound = 0; - break; - - default: - display_help(); - break; - } - } - else if (!argv[i][3]) //- followed by two letters - { - if (tolower(argv[i][1]) == 'd' && tolower(argv[i][2]) == 'd') //Disable sound DSP emulation - { - DSPDisable = 1; - } - - #ifdef __UNIXSDL__ - else if (tolower(argv[i][1]) == 'a' && tolower(argv[i][2]) == 'd') //Disable sound DSP emulation - { - i++; - if (!argv[i]) - { - display_help(); - } - - #ifdef __LIBAO__ - if (!strcmp(argv[i], "auto") || !strcmp(argv[i], "sdl") || (ao_driver_id(argv[i]) >= 0)) - #else - if (!strcmp(argv[i], "auto") || !strcmp(argv[i], "sdl")) - #endif - { - strcpy(libAoDriver, argv[i]); - } - else - { - puts("Audio driver selection invalid."); - exit(1); - } - } - #endif - - else if (tolower(argv[i][1]) == 'd' && tolower(argv[i][2]) == 's') //Disable sound output - { - soundon = 0; - } - - #ifdef __MSDOS__ - else if (tolower(argv[i][1]) == 'c' && tolower(argv[i][2]) == 'c') //Enable small screen (when available) - { - smallscreenon = 1; - } - #endif - - else if (tolower(argv[i][1]) == 'd' && tolower(argv[i][2]) == 'h') //Disable hacks - { - HacksDisable = 1; - } - - #ifndef __MSDOS__ - else if (tolower(argv[i][1]) == 'j' && tolower(argv[i][2]) == 's') //Set joystick sensitivity - { - i++; - if ((joy_sensitivity = zatoi(argv[i])+1) > 32767) - { - puts("Joystick sensitivity must be a value of 0 to 32767!"); - exit(1); - } - } - #endif - - #ifdef __WIN32__ - else if (tolower(argv[i][1]) == 'k' && tolower(argv[i][2]) == 's') //Enable KitchenSync - { - KitchenSync = 1; - } - #endif - - #ifdef __WIN32__ - else if (tolower(argv[i][1]) == 'k' && tolower(argv[i][2]) == 'p') //Enable KitchenSync for PAL only - { - KitchenSyncPAL = 1; - KitchenSync = 0; - } - #endif - - else if (tolower(argv[i][1]) == 'm' && tolower(argv[i][2]) == 'c') //Close ZSNES when ZMV closes - { - ZMVZClose = 1; - } - - else if (tolower(argv[i][1]) == 'm' && tolower(argv[i][2]) == 'd') //Dump raw vid with ZMV - { - i++; - if ((ZMVRawDump = zatoi(argv[i])) > 5) - { - puts("Movie mode must be a number 1 to 5"); - exit(1); - } - } - - else if (tolower(argv[i][1]) == 'm' && tolower(argv[i][2]) == 'l') //Force ZMV length - { - i++; - MovieForcedLengthEnabled = true; - MovieForcedLength = zatoi(argv[i]); - } - - #ifdef __MSDOS__ - else if (tolower(argv[i][1]) == 's' && tolower(argv[i][2]) == 'p') //Display sound information - { - DisplayS = 1; - } - #endif - - else if (tolower(argv[i][1]) == 's' && tolower(argv[i][2]) == 'a') //Show all extensions in GUI - { - showallext = 1; - } - - else if (tolower(argv[i][1]) == 'v' && argv[i][2] == '8') //V8 Mode - { - V8Mode = 1; - } - - else if (tolower(argv[i][1]) == 'z' && tolower(argv[i][2]) == 's') //Autoload save state - { - i++; - if ((autoloadstate = zatoi(argv[i])+1) > 100) - { - puts("State load position must be a value of 0 to 99!"); - exit(1); - } - } - - else if (tolower(argv[i][1]) == 'z' && tolower(argv[i][2]) == 'm') //Autoload movie - { - i++; - if ((autoloadmovie = zatoi(argv[i])+1) > 10) - { - puts("Movie load position must be a value of 0 to 9!"); - exit(1); - } - } - - else - { - display_help(); - break; - } - } - else //- followed by more than 2 letters - { - display_help(); - } - } - else //Param with no - or / prefix - { - if (argv[i] && !init_rom_path(argv[i])) - { - printf("Could not load: %s\n", argv[i]); - } - - if ((STCart2 = argv[i+1])) //Sufami Turbo second cart - { - char *p; - - natify_slashes(STCart2); - p = strrchr(STCart2, DIR_SLASH_C); - if (!p) { p = STCart2; } - else { p++; } - strcpy(ZSaveST2Name, p); - setextension(ZSaveST2Name, "srm"); - } - break; - } - } -} - -static void ZCleanup(void) -{ - void deinit_paths(); - void deallocmem(); - void DeallocRewindBuffer(); - void DeallocPauseFrame(); - void DeallocSystemVars(); - void free_all_file_lists(); -#ifdef __UNIXSDL__ - void UnloadSDL(); -#endif - - deinit_paths(); - deallocmem(); - DeallocRewindBuffer(); - DeallocPauseFrame(); - DeallocSystemVars(); - free_all_file_lists(); -#ifdef __UNIXSDL__ - UnloadSDL(); -#endif - -} - -void zmain(int zargc, char *zargv[]) -{ - if (init_paths(*zargv)) - { - #ifdef __LIBAO__ - ao_initialize(); - atexit(ao_shutdown); - #endif - handle_params(zargc, zargv); - - atexit(ZCleanup); - srand(time(0)); - zstart(); - } -} - -#ifdef __WIN32__ -extern HINSTANCE hInst; -int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) -{ - hInst=hInstance; - ImportDirectX(); - zmain(__argc, __argv); - return(0); -} -#else -int main(int zargc, char *zargv[]) -{ - zmain(zargc, zargv); - return(0); -} -#endif diff --git a/tools/zsnes/src/zloader.h b/tools/zsnes/src/zloader.h deleted file mode 100644 index a9f0ed7..0000000 --- a/tools/zsnes/src/zloader.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef ZLOADER_H -#define ZLOADER_H - -struct backup_cmdline_vars -{ -#ifdef __MSDOS__ - unsigned char _Palette0; -#endif -#ifdef __WIN32__ - unsigned char _KitchenSync, _KitchenSyncPAL, _ForceRefreshRate, _SetRefreshRate; -#endif -#ifndef __MSDOS__ - unsigned short _joy_sensitivity; -#endif - unsigned char _guioff; - unsigned char _per2exec; - unsigned char _HacksDisable; - unsigned char _AllowMMX; -}; - -extern struct backup_cmdline_vars saved_cmdline_vars; - -void swap_backup_vars(); - -#endif diff --git a/tools/zsnes/src/zmovie.c b/tools/zsnes/src/zmovie.c deleted file mode 100644 index 4d8cc3f..0000000 --- a/tools/zsnes/src/zmovie.c +++ /dev/null @@ -1,3119 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#include -#define DIR_SLASH "/" -#define WRITE_BINARY "w" -#define NULL_FILE "/dev/null" -#include "linux/safelib.h" -#else -#define _POSIX_ -#include -#include -#include -#include -#include -#include -#include -#define signal(x, y) -#ifdef __WIN32__ -#include -#undef _POSIX_ -#include -#define ftruncate chsize -#include "win/safelib.h" -#include "win/lib.h" -#endif -#define DIR_SLASH "\\" -#define WRITE_BINARY "wb" -#define NULL_FILE "nul" -#endif -#ifndef _MSC_VER -#include -#include -#endif -#include "gblvars.h" -#include "asm_call.h" -#include "md.h" -#include "input.h" -#include "cfg.h" -#include "zpath.h" -#include "zmovie.h" - -#define NUMCONV_FR2 -#define NUMCONV_FR3 -#define NUMCONV_FR4 -#define NUMCONV_FW2 -#define NUMCONV_FW3 -#define NUMCONV_FW4 -#include "numconv.h" - - -#ifdef __GNUC__ -typedef unsigned long long uint64; -#else //MSVC -typedef unsigned __int64 uint64; -#endif - -extern unsigned int versionNumber, CRC32, cur_zst_size, MsgCount, MessageOn; -extern unsigned int JoyAOrig, JoyBOrig, JoyCOrig, JoyDOrig, JoyEOrig; -extern unsigned char GUIReset, ReturnFromSPCStall, GUIQuit; -extern unsigned char CMovieExt, mencoderExists, lameExists; -extern char *Msgptr; -extern bool romispal; -bool MovieWaiting = false; - -extern unsigned char device1, device2; -extern unsigned short latchx, latchy; -#define IS_MOUSE_1() (device1 == 1) -#define IS_MOUSE_2() (device2 == 1) -#define IS_SCOPE() (device2 == 2) - -#define SET_MOUSE_1(x) (device1 = (x) ? 1 : 0) -#define SET_MOUSE_2(x) (device2 = (x) ? 1 : 0) -#define SET_SCOPE(x) (device2 = (x) ? 2 : 0) - -void GUIDoReset(); -void powercycle(bool, bool); -void zst_sram_load(FILE *); -void zst_sram_load_compressed(FILE *); -void zst_save(FILE *, bool, bool); -bool zst_load(FILE *, size_t); -bool zst_compressed_loader(FILE *); - -///////////////////////////////////////////////////////// - -#ifdef DEBUG_INPUT -#define debug_input_start useda = usedb = usedc = usedd = usede = 0; -#define debug_input print_bin(JoyAOrig, &useda); printf(" "); \ - print_bin(JoyBOrig, &usedb); printf(" "); \ - print_bin(JoyCOrig, &usedc); printf(" "); \ - print_bin(JoyDOrig, &usedd); printf(" "); \ - print_bin(JoyEOrig, &usede); printf("\n"); - -static unsigned int useda, usedb, usedc, usedd, usede; -static void print_bin(unsigned int num, unsigned int *used) -{ - unsigned int mask = BIT(31); - while (mask) - { - *used |= num & mask; - printf(num & mask ? "1" : "0"); - mask >>= 1; - } -} - -#define debug_input_used printf("Used: ");\ - print_bin(useda, &useda); printf(" "); \ - print_bin(usedb, &usedb); printf(" "); \ - print_bin(usedc, &usedc); printf(" "); \ - print_bin(usedd, &usedd); printf(" "); \ - print_bin(usede, &usede); printf("\n"); - -#else -#define debug_input_start -#define debug_input -#define debug_input_used -#endif - -///////////////////////////////////////////////////////// - -/* -ZMV Format - ------------------------------------------------------------------ -Header ------------------------------------------------------------------ - -3 bytes - "ZMV" -2 bytes - ZMV Version # (version of ZSNES) -4 bytes - CRC32 of ROM -4 bytes - Number of frames in this movie -4 bytes - Number of rerecords -4 bytes - Number of frames removed by rerecord -4 bytes - Number of frames advanced step-by-step -1 byte - Average recording FPS (includes dropped frames) x4-5 for precision -4 bytes - Number of key combos -2 bytes - Number of internal chapters -2 bytes - Length of author name -3 bytes - Uncompressed ZST size -2 bytes - Initial input configuration - 1 bit - Input 1 enabled - 1 bit - Input 2 enabled - 1 bit - Input 3 enabled - 1 bit - Input 4 enabled - 1 bit - Input 5 enabled - 1 bit - Mouse in first port - 1 bit - Mouse in second port - 1 bit - Super Scope in second port - 8 bits - Reserved -1 byte - Flag Byte - 2 bits - Start from ZST/Power On/Reset/Power On + Clear SRAM - 1 bit - NTSC or PAL - 5 bits - Reserved -3 bytes - 1 bit for compressed or not, 23 bits for size -ZST size - ZST (no thumbnail) - - ------------------------------------------------------------------ -Key input - Repeated for all input / internal chapters ------------------------------------------------------------------ - -1 byte - Flag Byte - 1 bit - Controller 1 changed - 1 bit - Controller 2 changed - 1 bit - Controller 3 changed - 1 bit - Controller 4 changed - 1 bit - Controller 5 changed - 1 bit - Chapter instead of input here - 1 bit - RLE instead of input - 1 bit - Command here - --If Command- -Remaining 7 bits of flag determine command - --Else If RLE- -4 bytes - Frame # to repeat previous input to - --Else If Chapter- - -3 bytes - 1 bit for compressed or not, 23 bits for size -ZST size - ZST -4 bytes - Frame # -2 bytes - Controller Status -9 bytes - Maximum previous input (1 Scope [20] + 4 Regular [12*4] + 4 padded bits) - --Else- - -variable - Input - - 12 bits per regular controller, 18 per mouse, 20 for scope. - Input changed padded to next full byte size - Minimum 2 bytes (12 controller bits + 4 padded bits) - Maximum 9 bytes (20 scope controller bits + 48 regular controller bits [12*4] + 4 padded bits) - - ------------------------------------------------------------------ -Internal chapter offsets - Repeated for all internal chapters ------------------------------------------------------------------ - -4 bytes - Offset to chapter from beginning of file (after input flag byte for ZST) - - ------------------------------------------------------------------ -External chapters - Repeated for all external chapters ------------------------------------------------------------------ - -ZST Size - ZST (never compressed) -4 bytes - Frame # -2 bytes - Controller Status -9 bytes - Maximum previous input (1 Scope [20] + 4 Regular [12*4] + 4 padded bits) -4 bytes - Offset to input for current chapter from beginning of file - - ------------------------------------------------------------------ -External chapter count ------------------------------------------------------------------ - -2 bytes - Number of external chapters - ------------------------------------------------------------------ -Author name ------------------------------------------------------------------ - -Name Len - Author's name - -*/ - - -/* - -ZMV header types, vars, and functions - -*/ - -enum zmv_start_methods { zmv_sm_zst, zmv_sm_power, zmv_sm_reset, zmv_sm_clear_all }; -enum zmv_video_modes { zmv_vm_ntsc, zmv_vm_pal }; -enum zmv_commands { zmv_command_reset }; - -#define INT_CHAP_SIZE(offset) (internal_chapter_length(offset)+4+2+9) -#define EXT_CHAP_SIZE (cur_zst_size+4+2+9+4) - -#define INT_CHAP_INDEX_SIZE (zmv_vars.header.internal_chapters*4) -#define EXT_CHAP_BLOCK_SIZE (zmv_open_vars.external_chapter_count*EXT_CHAP_SIZE + 2) - -#define EXT_CHAP_END_DIST (EXT_CHAP_BLOCK_SIZE + (size_t)zmv_vars.header.author_len) -#define INT_CHAP_END_DIST (INT_CHAP_INDEX_SIZE + EXT_CHAP_END_DIST) - -#define EXT_CHAP_COUNT_END_DIST ((size_t)zmv_vars.header.author_len + 2) - -struct zmv_header -{ - char magic[3]; - unsigned short zsnes_version; - unsigned int rom_crc32; - unsigned int frames; - unsigned int rerecords; - unsigned int removed_frames; - unsigned int incr_frames; - unsigned char average_fps; - unsigned int key_combos; - unsigned short internal_chapters; - unsigned short author_len; - unsigned int zst_size; //We only read/write 3 bytes for this - unsigned short initial_input; - struct - { - enum zmv_start_methods start_method; - enum zmv_video_modes video_mode; - } zmv_flag; -}; - -static void zmv_header_write(struct zmv_header *zmv_head, FILE *fp) -{ - unsigned char flag = 0; - - fwrite(zmv_head->magic, 3, 1, fp); - fwrite2(zmv_head->zsnes_version, fp); - fwrite4(zmv_head->rom_crc32, fp); - fwrite4(zmv_head->frames, fp); - fwrite4(zmv_head->rerecords, fp); - fwrite4(zmv_head->removed_frames, fp); - fwrite4(zmv_head->incr_frames, fp); - fwrite(&zmv_head->average_fps, 1, 1, fp); - fwrite4(zmv_head->key_combos, fp); - fwrite2(zmv_head->internal_chapters, fp); - fwrite2(zmv_head->author_len, fp); - fwrite3(zmv_head->zst_size, fp); - fwrite2(zmv_head->initial_input, fp); - - switch (zmv_head->zmv_flag.start_method) - { - case zmv_sm_zst: - flag &= ~BIT(7); - flag &= ~BIT(6); - break; - - case zmv_sm_power: - flag |= BIT(7); - flag &= ~BIT(6); - break; - - case zmv_sm_reset: - flag &= ~BIT(7); - flag |= BIT(6); - break; - - case zmv_sm_clear_all: - flag |= BIT(7); - flag |= BIT(6); - break; - } - - switch (zmv_head->zmv_flag.video_mode) - { - case zmv_vm_ntsc: - flag &= ~BIT(5); - break; - - case zmv_vm_pal: - flag |= BIT(5); - break; - } - - //Not needed, but oh well, it makes it easier to read for some. - //Reserved bits: - flag &= ~BIT(4); - flag &= ~BIT(3); - flag &= ~BIT(2); - flag &= ~BIT(1); - flag &= ~BIT(0); - - fwrite(&flag, 1, 1, fp); -} - -static bool zmv_header_read(struct zmv_header *zmv_head, FILE *fp) -{ - unsigned char flag; - - fread(zmv_head->magic, 3, 1, fp); - zmv_head->zsnes_version = fread2(fp); - zmv_head->rom_crc32 = fread4(fp); - zmv_head->frames = fread4(fp); - zmv_head->rerecords = fread4(fp); - zmv_head->removed_frames = fread4(fp); - zmv_head->incr_frames = fread4(fp); - fread(&zmv_head->average_fps, 1, 1, fp); - zmv_head->key_combos = fread4(fp); - zmv_head->internal_chapters = fread2(fp); - zmv_head->author_len = fread2(fp); - zmv_head->zst_size = fread3(fp); - zmv_head->initial_input = fread2(fp); - fread(&flag, 1, 1, fp); - - if (feof(fp)) - { - return(false); - } - - switch (flag & (BIT(7)|BIT(6))) - { - case 0: - zmv_head->zmv_flag.start_method = zmv_sm_zst; - break; - - case BIT(7): - zmv_head->zmv_flag.start_method = zmv_sm_power; - break; - - case BIT(6): - zmv_head->zmv_flag.start_method = zmv_sm_reset; - break; - - case BIT(7)|BIT(6): - zmv_head->zmv_flag.start_method = zmv_sm_clear_all; - break; - } - - switch (flag & BIT(5)) - { - case 0: - zmv_head->zmv_flag.video_mode = zmv_vm_ntsc; - break; - - case BIT(5): - zmv_head->zmv_flag.video_mode = zmv_vm_pal; - break; - } - - if (flag & (BIT(4)|BIT(3)|BIT(2)|BIT(1)|BIT(0))) - { - return(false); - } - - return(true); -} - -/* - -Internal chapter types, vars, and functions - -*/ - -#define INTERNAL_CHAPTER_BUF_LIM 16 -struct internal_chapter_buf -{ - size_t offsets[INTERNAL_CHAPTER_BUF_LIM]; - unsigned char used; - struct internal_chapter_buf *next; -}; - -static void internal_chapter_add_offset(struct internal_chapter_buf *icb, size_t offset) -{ - while (icb->next) - { - icb = icb->next; - } - - if (icb->used == INTERNAL_CHAPTER_BUF_LIM) - { - icb->next = (struct internal_chapter_buf *)malloc(sizeof(struct internal_chapter_buf)); - icb = icb->next; - memset(icb, 0, sizeof(struct internal_chapter_buf)); - } - - icb->offsets[icb->used] = offset; - icb->used++; -} - -static void internal_chapter_free_chain(struct internal_chapter_buf *icb) -{ - if (icb) - { - if (icb->next) - { - internal_chapter_free_chain(icb->next); - } - free(icb); - } -} - -static void internal_chapter_write(struct internal_chapter_buf *icb, FILE *fp) -{ - unsigned char i; - for (i = 0; i < icb->used; i++) - { - fwrite4(icb->offsets[i], fp); - } - if (icb->next) - { - internal_chapter_write(icb->next, fp); - } -} - -static void internal_chapter_read(struct internal_chapter_buf *icb, FILE *fp, size_t count) -{ - while (count--) - { - internal_chapter_add_offset(icb, fread4(fp)); - } -} - -size_t internal_chapter_pos(struct internal_chapter_buf *icb, size_t offset) -{ - size_t pos = 0; - do - { - unsigned char i; - for (i = 0; i < icb->used; i++, pos++) - { - if (icb->offsets[i] == offset) - { - return(pos); - } - } - } while ((icb = icb->next)); - return(~0); -} - -static size_t internal_chapter_greater(struct internal_chapter_buf *icb, size_t offset) -{ - size_t greater = ~0; - do - { - unsigned char i; - for (i = 0; i < icb->used; i++) - { - if ((icb->offsets[i] > offset) && (icb->offsets[i] < greater)) - { - greater = icb->offsets[i]; - } - } - } while ((icb = icb->next)); - return((greater == 0xFFFFFFFF) ? offset : greater); -} - -static size_t internal_chapter_lesser(struct internal_chapter_buf *icb, size_t offset) -{ - size_t lesser = 0; - do - { - unsigned char i; - for (i = 0; i < icb->used; i++) - { - if ((icb->offsets[i] < offset) && (icb->offsets[i] > lesser)) - { - lesser = icb->offsets[i]; - } - } - } while ((icb = icb->next)); - return((lesser == 0) ? offset : lesser); -} - -static size_t internal_chapter_delete_after(struct internal_chapter_buf *icb, size_t offset) -{ - if (icb->used) - { - size_t last_offset = 0; - if (icb->offsets[0] == offset) - { - last_offset = offset; - } - else - { - last_offset = internal_chapter_lesser(icb, offset); - if (last_offset == offset) - { - internal_chapter_free_chain(icb->next); - icb->next = 0; - icb->used = 0; - return(0); - } - if (internal_chapter_greater(icb, last_offset) == offset) - { - last_offset = offset; - } - } - - if (last_offset) - { - size_t buffer_pos = internal_chapter_pos(icb, last_offset); - size_t link = buffer_pos/INTERNAL_CHAPTER_BUF_LIM; - - while (link--) - { - icb = icb->next; - } - - internal_chapter_free_chain(icb->next); - icb->next = 0; - icb->used = (buffer_pos%INTERNAL_CHAPTER_BUF_LIM)+1; - return(buffer_pos+1); - } - } - return(0); -} - -static size_t internal_chapter_count_until(struct internal_chapter_buf *icb, size_t offset) -{ - size_t chapter_count = 0; - unsigned char i; - - do - { - for (i = 0; i < icb->used; i++) - { - if (icb->offsets[i] >= offset) { break; } - chapter_count++; - } - } while ((i == icb->used) && (icb = icb->next)); - return(chapter_count); -} - -/* - -Bit Encoder and Decoder - -*/ - -/* -When working with bits, you have to find the bits in a byte. - -Devide the amount of bits by 8 (bit_count >> 3) to find the proper byte. -The proper bit number in the byte is the amount of bits modulo 8 (bit_count & 7). -To get the most signifigant bit, you want the bit which is 7 minus the proper bit number. -*/ -size_t bit_encoder(unsigned int data, unsigned int mask, unsigned char *buffer, size_t skip_bits) -{ - unsigned char bit_loop; - - for (bit_loop = 31; ; bit_loop--) - { - if (mask & BIT(bit_loop)) - { - if (data & BIT(bit_loop)) - { - buffer[skip_bits>>3] |= BIT(7-(skip_bits&7)); - } - else - { - buffer[skip_bits>>3] &= ~BIT(7-(skip_bits&7)); - } - skip_bits++; - } - - if (!bit_loop) { break; } - } - - return(skip_bits); -} - -size_t bit_decoder(unsigned int *data, unsigned int mask, unsigned char *buffer, size_t skip_bits) -{ - unsigned char bit_loop; - *data = 0; - - for (bit_loop = 31; ; bit_loop--) - { - if (mask & BIT(bit_loop)) - { - if (buffer[skip_bits>>3] & BIT(7-(skip_bits&7))) - { - *data |= BIT(bit_loop); - } - skip_bits++; - } - - if (!bit_loop) { break; } - } - - return(skip_bits); -} - -/* - -Shared var between record/replay functions - -*/ - -#define WRITE_BUFFER_SIZE 1024 -static struct -{ - struct zmv_header header; - FILE *fp; - struct - { - unsigned int A; - unsigned int B; - unsigned int C; - unsigned int D; - unsigned int E; - unsigned short latchx; - unsigned short latchy; - } last_joy_state; - unsigned short inputs_enabled; - unsigned char write_buffer[WRITE_BUFFER_SIZE]; - size_t write_buffer_loc; - struct internal_chapter_buf internal_chapters; - size_t last_internal_chapter_offset; - char *filename; - size_t rle_count; -} zmv_vars; - -#define GAMEPAD_MASK 0xFFF00000 -#define MOUSE_MASK 0x00C0FFFF -#define SCOPE_MASK 0xF0000000 - -#define GAMEPAD_ENABLE 0x00008000 -#define MOUSE_ENABLE 0x00010000 -#define SCOPE_ENABLE 0x00FF0000 - -static size_t pad_bit_encoder(unsigned char pad, unsigned char *buffer, size_t skip_bits) -{ - unsigned int last_state = 0; - - switch (pad) - { - case 1: - last_state = zmv_vars.last_joy_state.A; - break; - - case 2: - last_state = zmv_vars.last_joy_state.B; - break; - - case 3: - last_state = zmv_vars.last_joy_state.C; - break; - - case 4: - last_state = zmv_vars.last_joy_state.D; - break; - - case 5: - last_state = zmv_vars.last_joy_state.E; - break; - } - - switch (pad) - { - case 2: - if ((zmv_vars.inputs_enabled & BIT(0x8))) //Super Scope - { - unsigned int xdata = (zmv_vars.last_joy_state.latchx - 40) & 0xFF; - unsigned int ydata = zmv_vars.last_joy_state.latchy & 0xFF; - - skip_bits = bit_encoder(last_state, SCOPE_MASK, buffer, skip_bits); - skip_bits = bit_encoder(xdata, 0x000000FF, buffer, skip_bits); - skip_bits = bit_encoder(ydata, 0x000000FF, buffer, skip_bits); - - break; - } - - case 1: - if ((zmv_vars.inputs_enabled & ((pad == 1) ? BIT(0xA) : BIT(0x9)))) //Mouse ? - { - skip_bits = bit_encoder(last_state, MOUSE_MASK, buffer, skip_bits); - } - else - { - skip_bits = bit_encoder(last_state, GAMEPAD_MASK, buffer, skip_bits); - } - break; - - case 3: case 4: case 5: - //No multitap if both ports use special devices - if ((zmv_vars.inputs_enabled & (BIT(0xA)|BIT(0x9)|BIT(0x8))) <= BIT(0xA)) - { - skip_bits = bit_encoder(last_state, GAMEPAD_MASK, buffer, skip_bits); - } - break; - } - return(skip_bits); -} - -static size_t pad_bit_decoder(unsigned char pad, unsigned char *buffer, size_t skip_bits) -{ - unsigned int *last_state = 0; - unsigned short input_enable_mask = 0; - - switch (pad) - { - case 1: - last_state = &zmv_vars.last_joy_state.A; - input_enable_mask = BIT(0xF); - break; - - case 2: - last_state = &zmv_vars.last_joy_state.B; - input_enable_mask = BIT(0xE); - break; - - case 3: - last_state = &zmv_vars.last_joy_state.C; - input_enable_mask = BIT(0xD); - break; - - case 4: - last_state = &zmv_vars.last_joy_state.D; - input_enable_mask = BIT(0xC); - break; - - case 5: - last_state = &zmv_vars.last_joy_state.E; - input_enable_mask = BIT(0xB); - break; - } - - switch (pad) - { - case 2: - if ((zmv_vars.inputs_enabled & BIT(0x8))) //Super Scope - { - unsigned int xdata, ydata; - - skip_bits = bit_decoder(last_state, SCOPE_MASK, buffer, skip_bits); - skip_bits = bit_decoder(&xdata, 0x000000FF, buffer, skip_bits); - skip_bits = bit_decoder(&ydata, 0x000000FF, buffer, skip_bits); - *last_state |= SCOPE_ENABLE; - - zmv_vars.last_joy_state.latchx = (unsigned short)(xdata + 40); - zmv_vars.last_joy_state.latchy = (unsigned short)ydata; - - break; - } - - case 1: - if (zmv_vars.inputs_enabled & ((pad == 1) ? BIT(0xA) : BIT(0x9))) //Mouse ? - { - skip_bits = bit_decoder(last_state, MOUSE_MASK, buffer, skip_bits); - *last_state |= MOUSE_ENABLE; - } - else - { - skip_bits = bit_decoder(last_state, GAMEPAD_MASK, buffer, skip_bits); - *last_state |= (zmv_vars.inputs_enabled & input_enable_mask) ? GAMEPAD_ENABLE : 0; - } - break; - - case 3: case 4: case 5: - //No multitap if both ports use special devices - if ((zmv_vars.inputs_enabled & (BIT(0xA)|BIT(0x9)|BIT(0x8))) > BIT(0xA)) - { - *last_state = 0; - } - else - { - skip_bits = bit_decoder(last_state, GAMEPAD_MASK, buffer, skip_bits); - *last_state |= (zmv_vars.inputs_enabled & input_enable_mask) ? GAMEPAD_ENABLE : 0; - } - break; - } - return(skip_bits); -} - -static void save_last_joy_state(unsigned char *buffer) -{ - size_t skip_bits = 16; - memcpy(buffer, uint16_to_bytes(zmv_vars.inputs_enabled), 2); - - skip_bits = pad_bit_encoder(1, buffer, skip_bits); - skip_bits = pad_bit_encoder(2, buffer, skip_bits); - skip_bits = pad_bit_encoder(3, buffer, skip_bits); - skip_bits = pad_bit_encoder(4, buffer, skip_bits); - skip_bits = pad_bit_encoder(5, buffer, skip_bits); -} - -static void load_last_joy_state(unsigned char *buffer) -{ - size_t skip_bits = 16; - zmv_vars.inputs_enabled = bytes_to_uint16(buffer); - - skip_bits = pad_bit_decoder(1, buffer, skip_bits); - skip_bits = pad_bit_decoder(2, buffer, skip_bits); - skip_bits = pad_bit_decoder(3, buffer, skip_bits); - skip_bits = pad_bit_decoder(4, buffer, skip_bits); - skip_bits = pad_bit_decoder(5, buffer, skip_bits); -} - -//These things are a total of 11 bytes (2 byte enable field, up to 9 bytes for input bits) -static void write_last_joy_state(FILE *fp) -{ - save_last_joy_state(zmv_vars.write_buffer); - fwrite(zmv_vars.write_buffer, 11, 1, fp); -} - -static void read_last_joy_state(FILE *fp) -{ - fread(zmv_vars.write_buffer, 11, 1, fp); - load_last_joy_state(zmv_vars.write_buffer); -} - -static void flush_input_buffer() -{ - if (zmv_vars.write_buffer_loc) - { - fwrite(zmv_vars.write_buffer, zmv_vars.write_buffer_loc, 1, zmv_vars.fp); - zmv_vars.write_buffer_loc = 0; - } - - if (zmv_vars.rle_count) - { - if (zmv_vars.rle_count > 5) - { - zmv_vars.write_buffer[0] = BIT(1); //RLE bit - fwrite(zmv_vars.write_buffer, 1, 1, zmv_vars.fp); - fwrite4(zmv_vars.header.frames, zmv_vars.fp); - } - else - { - memset(zmv_vars.write_buffer, 0, zmv_vars.rle_count); - fwrite(zmv_vars.write_buffer, zmv_vars.rle_count, 1, zmv_vars.fp); - } - zmv_vars.rle_count = 0; - } - - zmv_vars.header.author_len = 0; //If we're writing, then author is erased if there -} - -static void flush_input_if_needed() -{ - if (zmv_vars.write_buffer_loc > WRITE_BUFFER_SIZE - 15) //14 is a RLE buffer (5) + flag (1) + largest input (9) - { - flush_input_buffer(); - } -} - -//For various ZMV calculations, the length of the last chapter needs to be known -static size_t internal_chapter_length(size_t offset) -{ - size_t current_loc = ftell(zmv_vars.fp); - size_t icl = 0; - - fseek(zmv_vars.fp, offset, SEEK_SET); - icl = fread3(zmv_vars.fp) & 0x007FFFFF; //The upper 9 bits are not part of the length - icl += 3; //Add 3 for the header which says how long it is - - fseek(zmv_vars.fp, current_loc, SEEK_SET); - return(icl); -} - -/* - -Create and record ZMV - -*/ - -static bool zmv_create(char *filename) -{ - memset(&zmv_vars, 0, sizeof(zmv_vars)); - if ((zmv_vars.fp = fopen_dir(ZSramPath, filename,"w+b"))) - { - size_t filename_len = strlen(filename); - strncpy(zmv_vars.header.magic, "ZMV", 3); - zmv_vars.header.zsnes_version = versionNumber & 0xFFFF; - zmv_vars.header.rom_crc32 = CRC32; - zmv_vars.header.zst_size = cur_zst_size; - zmv_vars.header.zmv_flag.start_method = (enum zmv_start_methods)MovieStartMethod; - zmv_vars.header.zmv_flag.video_mode = romispal ? zmv_vm_pal : zmv_vm_ntsc; - zmv_vars.header.average_fps = romispal ? 250 : 240; - zmv_vars.header.initial_input = (pl1contrl ? BIT(0xF) : 0) | - (pl2contrl ? BIT(0xE) : 0) | - (pl3contrl ? BIT(0xD) : 0) | - (pl4contrl ? BIT(0xC) : 0) | - (pl5contrl ? BIT(0xB) : 0) | - (IS_MOUSE_1() ? BIT(0xA) : 0) | - (IS_MOUSE_2() ? BIT(0x9) : 0) | - (IS_SCOPE() ? BIT(0x8) : 0); - - zmv_header_write(&zmv_vars.header, zmv_vars.fp); - - zmv_vars.inputs_enabled = zmv_vars.header.initial_input; - - switch (zmv_vars.header.zmv_flag.start_method) - { - case zmv_sm_zst: - break; - case zmv_sm_power: - MovieWaiting = true; - powercycle(true, false); - break; - case zmv_sm_reset: - MovieWaiting = true; - GUIReset = 1; - asm_call(GUIDoReset); - ReturnFromSPCStall = 0; - break; - case zmv_sm_clear_all: - MovieWaiting = true; - powercycle(false, false); - break; - } - - zst_save(zmv_vars.fp, false, true); - zmv_vars.filename = (char *)malloc(filename_len+1); //+1 for null - strcpy(zmv_vars.filename, filename); - - debug_input_start; - - return(true); - } - return(false); -} - -static void zmv_rle_flush() -{ - if (zmv_vars.rle_count) - { - if (zmv_vars.rle_count > 5) - { - zmv_vars.write_buffer[zmv_vars.write_buffer_loc++] = BIT(1); //RLE bit - memcpy(zmv_vars.write_buffer+zmv_vars.write_buffer_loc, uint32_to_bytes(zmv_vars.header.frames), 4); - zmv_vars.write_buffer_loc += 4; - } - else - { - memset(zmv_vars.write_buffer+zmv_vars.write_buffer_loc, 0, zmv_vars.rle_count); - zmv_vars.write_buffer_loc += zmv_vars.rle_count; - } - zmv_vars.rle_count = 0; - } -} - -static void zmv_record_command(enum zmv_commands command) -{ - zmv_rle_flush(); - - zmv_vars.write_buffer[zmv_vars.write_buffer_loc++] = (command << 1) | BIT(0); - - flush_input_if_needed(); -} - -static void record_pad(unsigned char pad, unsigned char *flag, unsigned char *buffer, size_t *skip_bits) -{ - unsigned int *last_state = 0, current_state = 0; - unsigned char bit_mask = 0; - - switch (pad) - { - case 1: - last_state = &zmv_vars.last_joy_state.A; - current_state = JoyAOrig; - bit_mask = BIT(7); - break; - - case 2: - last_state = &zmv_vars.last_joy_state.B; - current_state = JoyBOrig; - bit_mask = BIT(6); - break; - - case 3: - last_state = &zmv_vars.last_joy_state.C; - current_state = JoyCOrig; - bit_mask = BIT(5); - break; - - case 4: - last_state = &zmv_vars.last_joy_state.D; - current_state = JoyDOrig; - bit_mask = BIT(4); - break; - - case 5: - last_state = &zmv_vars.last_joy_state.E; - current_state = JoyEOrig; - bit_mask = BIT(3); - break; - } - - if ((current_state != *last_state) || - ((zmv_vars.inputs_enabled & BIT(0x8)) && - ((zmv_vars.last_joy_state.latchx != latchx) || (zmv_vars.last_joy_state.latchy != latchy)))) - { - zmv_vars.last_joy_state.latchx = latchx; - zmv_vars.last_joy_state.latchy = latchy; - - *last_state = current_state; - *flag |= bit_mask; - *skip_bits = pad_bit_encoder(pad, buffer, *skip_bits); - } -} - -static void zmv_record(bool pause, unsigned char combos_used, unsigned char slow) -{ - unsigned char flag = 0; - unsigned char press_buf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - size_t skip_bits = 0; - - static float average = 0.0f; - if (!average) { average = (float)zmv_vars.header.average_fps/((romispal) ? 250.0f : 240.0f); } - - if (pause) { zmv_vars.header.incr_frames++; } - - zmv_vars.header.key_combos += combos_used; - - debug_input; - - record_pad(1, &flag, press_buf, &skip_bits); - record_pad(2, &flag, press_buf, &skip_bits); - record_pad(3, &flag, press_buf, &skip_bits); - record_pad(4, &flag, press_buf, &skip_bits); - record_pad(5, &flag, press_buf, &skip_bits); - - if (flag) - { - unsigned char buffer_used = (skip_bits>>3) + ((skip_bits&7) ? 1 : 0); - - zmv_rle_flush(); - - zmv_vars.write_buffer[zmv_vars.write_buffer_loc++] = flag; - memcpy(zmv_vars.write_buffer+zmv_vars.write_buffer_loc, press_buf, buffer_used); - zmv_vars.write_buffer_loc += buffer_used; - - flush_input_if_needed(); - } - else - { - zmv_vars.rle_count++; - } - - // it's the right formula, don't waste time busting your brain on it - average = (average * (zmv_vars.header.frames + zmv_vars.header.removed_frames) + 1.0f/(float)(slow+1)) / - (float)(zmv_vars.header.frames + zmv_vars.header.removed_frames + 1); - // 1/4 precision for NTSC, 1/5 precision for PAL - zmv_vars.header.average_fps = (unsigned char)(average * ((romispal) ? 250 : 240)); - zmv_vars.header.frames++; -} - -static bool zmv_insert_chapter() -{ - if ((zmv_vars.header.internal_chapters < 65535) && zmv_vars.header.frames && - (zmv_vars.last_internal_chapter_offset != (ftell(zmv_vars.fp) + - zmv_vars.write_buffer_loc - INT_CHAP_SIZE(zmv_vars.last_internal_chapter_offset)))) - { - unsigned char flag = BIT(2); - - flush_input_buffer(); - - fwrite(&flag, 1, 1, zmv_vars.fp); - - internal_chapter_add_offset(&zmv_vars.internal_chapters, ftell(zmv_vars.fp)); - zmv_vars.header.internal_chapters++; - zmv_vars.last_internal_chapter_offset = ftell(zmv_vars.fp); - - zst_save(zmv_vars.fp, false, true); - fwrite4(zmv_vars.header.frames, zmv_vars.fp); - write_last_joy_state(zmv_vars.fp); - - return(true); - } - return(false); -} - -static void zmv_record_finish() -{ - FILE *fp; - - flush_input_buffer(); - - //Now write the save for append data - mzt_chdir_up(); - if ((fp = fopen_dir(ZSramPath, "append.zst", "wb"))) - { - zst_save(fp, false, false); - fclose(fp); - - if ((fp = fopen_dir(ZSramPath, "append.mzi","wb"))) - { - fwrite4(zmv_vars.header.frames, fp); - write_last_joy_state(fp); - fwrite4(ftell(zmv_vars.fp), fp); - fclose(fp); - } - } - mzt_chdir_down(); - - //Finish up writing the ZMV - internal_chapter_write(&zmv_vars.internal_chapters, zmv_vars.fp); - internal_chapter_free_chain(zmv_vars.internal_chapters.next); - - if (!zmv_vars.filename) - { - free(zmv_vars.filename); - zmv_vars.filename = 0; - } - - fwrite2(0, zmv_vars.fp); //External chapter count - - rewind(zmv_vars.fp); - zmv_header_write(&zmv_vars.header, zmv_vars.fp); - - if (zmv_vars.fp) - { - fclose(zmv_vars.fp); - zmv_vars.fp = 0; - } - - debug_input_used; -} - -static size_t zmv_frames_recorded() -{ - return(zmv_vars.header.frames); -} - -/* - -Open and replay ZMV - -*/ - -typedef struct internal_chapter_buf external_chapter_buf; - -static struct -{ - external_chapter_buf external_chapters; - unsigned short external_chapter_count; - unsigned int frames_replayed; - size_t last_chapter_frame; - size_t first_chapter_pos; - size_t input_start_pos; -} zmv_open_vars; //Additional vars for open/replay of a ZMV - -static bool zmv_open(char *filename) -{ - memset(&zmv_vars, 0, sizeof(zmv_vars)); - memset(&zmv_open_vars, 0, sizeof(zmv_open_vars)); - - zmv_vars.fp = fopen_dir(ZSramPath, filename,"r+b"); - if (zmv_vars.fp && zmv_header_read(&zmv_vars.header, zmv_vars.fp) && - !strncmp(zmv_vars.header.magic, "ZMV", 3)) - { - unsigned short i; - size_t filename_len = strlen(filename); - - MovieStartMethod = (unsigned char)zmv_vars.header.zmv_flag.start_method; - zmv_vars.inputs_enabled = zmv_vars.header.initial_input; - zmv_open_vars.first_chapter_pos = ftell(zmv_vars.fp); - - if (zmv_vars.header.zsnes_version != (versionNumber & 0xFFFF)) - { - zst_compressed_loader(zmv_vars.fp); - zmv_open_vars.input_start_pos = ftell(zmv_vars.fp); - Msgptr = "ZSNES VERSION MISMATCH."; - } - else - { - switch (zmv_vars.header.zmv_flag.start_method) - { - case zmv_sm_zst: - zst_compressed_loader(zmv_vars.fp); - break; - case zmv_sm_power: - MovieWaiting = true; - powercycle(false, false); - zst_sram_load_compressed(zmv_vars.fp); - break; - case zmv_sm_reset: - GUIReset = 1; - asm_call(GUIDoReset); - ReturnFromSPCStall = 0; - zst_sram_load_compressed(zmv_vars.fp); - break; - case zmv_sm_clear_all: - MovieWaiting = true; - powercycle(false, false); - fseek(zmv_vars.fp, internal_chapter_length(ftell(zmv_vars.fp)), SEEK_CUR); - break; - } - - zmv_open_vars.input_start_pos = ftell(zmv_vars.fp); - Msgptr = "MOVIE STARTED."; - } - - if (zmv_vars.header.rom_crc32 != CRC32) - { - static char buffer[29]; //"ROM MISMATCH. NEED: 01234567" - sprintf(buffer, "ROM MISMATCH. NEED: %08X", zmv_vars.header.rom_crc32); - Msgptr = buffer; - } - - pl1contrl = (zmv_vars.header.initial_input & BIT(0xF)) ? 1 : 0; - pl2contrl = (zmv_vars.header.initial_input & BIT(0xE)) ? 1 : 0; - pl3contrl = (zmv_vars.header.initial_input & BIT(0xD)) ? 1 : 0; - pl4contrl = (zmv_vars.header.initial_input & BIT(0xC)) ? 1 : 0; - pl5contrl = (zmv_vars.header.initial_input & BIT(0xB)) ? 1 : 0; - - SET_MOUSE_1(zmv_vars.header.initial_input & BIT(0xA)); - SET_MOUSE_2(zmv_vars.header.initial_input & BIT(0x9)); - SET_SCOPE(zmv_vars.header.initial_input & BIT(0x8)); - - fseek(zmv_vars.fp, -((signed)EXT_CHAP_COUNT_END_DIST), SEEK_END); - zmv_open_vars.external_chapter_count = fread2(zmv_vars.fp); - - fseek(zmv_vars.fp, -((signed)INT_CHAP_END_DIST), SEEK_END); - - internal_chapter_read(&zmv_vars.internal_chapters, zmv_vars.fp, zmv_vars.header.internal_chapters); - - for (i = 0; i < zmv_open_vars.external_chapter_count; i++) - { - //Seek to 4 bytes before end of chapter, since last 4 bytes is where it contains offset value - fseek(zmv_vars.fp, EXT_CHAP_SIZE-4, SEEK_CUR); - internal_chapter_add_offset(&zmv_open_vars.external_chapters, fread4(zmv_vars.fp)); - } - - fseek(zmv_vars.fp, zmv_open_vars.input_start_pos, SEEK_SET); - - zmv_vars.filename = (char *)malloc(filename_len+1); //+1 for null - strcpy(zmv_vars.filename, filename); - - debug_input_start; - - return(true); - } - return(false); -} - -static bool zmv_replay_command(enum zmv_commands command) -{ - switch (command) - { - - default: - break; - } - return(false); -} - -static void replay_pad(unsigned char pad, unsigned char flag, unsigned char *buffer, size_t *skip_bits) -{ - unsigned int *last_state = 0, *current_state = 0; - unsigned char bit_mask = 0; - - switch (pad) - { - case 1: - last_state = &zmv_vars.last_joy_state.A; - current_state = &JoyAOrig; - bit_mask = BIT(7); - break; - - case 2: - last_state = &zmv_vars.last_joy_state.B; - current_state = &JoyBOrig; - bit_mask = BIT(6); - break; - - case 3: - last_state = &zmv_vars.last_joy_state.C; - current_state = &JoyCOrig; - bit_mask = BIT(5); - break; - - case 4: - last_state = &zmv_vars.last_joy_state.D; - current_state = &JoyDOrig; - bit_mask = BIT(4); - break; - - case 5: - last_state = &zmv_vars.last_joy_state.E; - current_state = &JoyEOrig; - bit_mask = BIT(3); - break; - } - - if (flag & bit_mask) - { - size_t bits_needed = pad_bit_decoder(pad, buffer, 0); - if (bits_needed) - { - size_t leftover_bits = (8 - (*skip_bits&7)) & 7; - bits_needed -= leftover_bits; - - fread(buffer + (*skip_bits>>3) + ((*skip_bits&7) ? 1 : 0), 1, (bits_needed>>3) + ((bits_needed&7) ? 1 : 0), zmv_vars.fp); - *skip_bits = pad_bit_decoder(pad, buffer, *skip_bits); - } - } - *current_state = *last_state; - latchx = zmv_vars.last_joy_state.latchx; - latchy = zmv_vars.last_joy_state.latchy; -} - -static bool zmv_replay() -{ - if (zmv_open_vars.frames_replayed < zmv_vars.header.frames) - { - if (zmv_vars.rle_count) - { - JoyAOrig = zmv_vars.last_joy_state.A; - JoyBOrig = zmv_vars.last_joy_state.B; - JoyCOrig = zmv_vars.last_joy_state.C; - JoyDOrig = zmv_vars.last_joy_state.D; - JoyEOrig = zmv_vars.last_joy_state.E; - latchx = zmv_vars.last_joy_state.latchx; - latchy = zmv_vars.last_joy_state.latchy; - zmv_vars.rle_count--; - - debug_input; - } - else - { - unsigned char flag = 0; - zmv_vars.rle_count = 0; - - fread(&flag, 1, 1, zmv_vars.fp); - - if (flag & BIT(0)) //Command - { - unsigned char command = flag >> 1; - if (command == zmv_command_reset) - { - GUIReset = 1; - ReturnFromSPCStall = 0; - return(true); - } - if (zmv_replay_command(command)) - { - return(zmv_replay()); - } - return(false); - } - - else if (flag & BIT(1)) //RLE - { - zmv_vars.rle_count = fread4(zmv_vars.fp) - zmv_open_vars.frames_replayed; - return(zmv_replay()); - } - - else if (flag & BIT(2)) //Internal Chapter - { - fseek(zmv_vars.fp, INT_CHAP_SIZE(ftell(zmv_vars.fp)), SEEK_CUR); - return(zmv_replay()); - } - - else - { - unsigned char press_buf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - size_t skip_bits = 0; - - replay_pad(1, flag, press_buf, &skip_bits); - replay_pad(2, flag, press_buf, &skip_bits); - replay_pad(3, flag, press_buf, &skip_bits); - replay_pad(4, flag, press_buf, &skip_bits); - replay_pad(5, flag, press_buf, &skip_bits); - - debug_input; - } - } - - zmv_open_vars.frames_replayed++; - return(true); - } - - return(false); -} - -static bool zmv_next_chapter() -{ - size_t current_loc = ftell(zmv_vars.fp); - - size_t next_internal = internal_chapter_greater(&zmv_vars.internal_chapters, current_loc); - size_t next_external = internal_chapter_greater(&zmv_open_vars.external_chapters, current_loc); - - size_t next = 0; - - if (next_internal != current_loc) - { - next = next_internal; - } - else - { - next_internal = ~0; - } - if ((next_external != current_loc) && next_external < next_internal) - { - next = next_external; - } - - if (next) - { - if (next == next_internal) - { - fseek(zmv_vars.fp, next_internal, SEEK_SET); - zst_compressed_loader(zmv_vars.fp); - zmv_open_vars.frames_replayed = fread4(zmv_vars.fp); - read_last_joy_state(zmv_vars.fp); - } - else - { - size_t ext_chapter_loc = EXT_CHAP_END_DIST - internal_chapter_pos(&zmv_open_vars.external_chapters, next)*EXT_CHAP_SIZE; - fseek(zmv_vars.fp, -((signed)ext_chapter_loc), SEEK_END); - zst_load(zmv_vars.fp, 0); - zmv_open_vars.frames_replayed = fread4(zmv_vars.fp); - read_last_joy_state(zmv_vars.fp); - - fseek(zmv_vars.fp, next_external, SEEK_SET); - } - - zmv_vars.rle_count = 0; - return(true); - } - - return(false); -} - -//Have playback start movie from beginning -static void zmv_rewind_playback() -{ - fseek(zmv_vars.fp, zmv_open_vars.first_chapter_pos, SEEK_SET); - zst_compressed_loader(zmv_vars.fp); - zmv_open_vars.frames_replayed = 0; - zmv_open_vars.last_chapter_frame = 0; - zmv_vars.rle_count = 0; - zmv_vars.inputs_enabled = zmv_vars.header.initial_input; - memset(&zmv_vars.last_joy_state, 0, sizeof(zmv_vars.last_joy_state)); -} - -static void zmv_prev_chapter() -{ - size_t current_loc = ftell(zmv_vars.fp); - - size_t prev_internal = internal_chapter_lesser(&zmv_vars.internal_chapters, current_loc); - size_t prev_external = internal_chapter_lesser(&zmv_open_vars.external_chapters, current_loc); - - size_t prev = 0; - - if (prev_internal != current_loc) - { - prev = prev_internal; - } - else - { - prev_internal = 0; - } - if ((prev_external != current_loc) && prev_external > prev_internal) - { - prev = prev_external; - } - - if (!prev) - { - zmv_rewind_playback(); - return; - } - - //Code to go back before the previous chapter if the previous chapter was loaded recently - if ((zmv_open_vars.frames_replayed - zmv_open_vars.last_chapter_frame) < 5*((unsigned int)EmuSpeed+1)) - { //2.5 seconds NTSC when in 100% speed - altered to make slowmo nicer - size_t pprev = prev-1; - size_t pprev_internal = internal_chapter_lesser(&zmv_vars.internal_chapters, pprev); - size_t pprev_external = internal_chapter_lesser(&zmv_open_vars.external_chapters, pprev); - - if ((pprev_internal == pprev) && (pprev_external == pprev)) - { - zmv_rewind_playback(); - return; - } - - if (pprev_internal != pprev) - { - prev = prev_internal = pprev_internal; - } - else - { - pprev_internal = 0; - } - if ((pprev_external != pprev) && pprev_external > pprev_internal) - { - prev = prev_external = pprev_external; - } - } - - if (prev == prev_internal) - { - fseek(zmv_vars.fp, prev_internal, SEEK_SET); - zst_compressed_loader(zmv_vars.fp); - zmv_open_vars.frames_replayed = fread4(zmv_vars.fp); - read_last_joy_state(zmv_vars.fp); - } - else - { - size_t ext_chapter_loc = EXT_CHAP_END_DIST - internal_chapter_pos(&zmv_open_vars.external_chapters, prev)*EXT_CHAP_SIZE; - fseek(zmv_vars.fp, -((signed)ext_chapter_loc), SEEK_END); - zst_load(zmv_vars.fp, 0); - zmv_open_vars.frames_replayed = fread4(zmv_vars.fp); - read_last_joy_state(zmv_vars.fp); - - fseek(zmv_vars.fp, prev_external, SEEK_SET); - } - zmv_open_vars.last_chapter_frame = zmv_open_vars.frames_replayed; - zmv_vars.rle_count = 0; -} - -//External chapter -static void zmv_add_chapter() -{ - if ((zmv_open_vars.external_chapter_count < 65535) && zmv_open_vars.frames_replayed) - { - size_t current_loc = ftell(zmv_vars.fp); - - //Check if there is external here already - should possibly modify this to use - //intern_chapter_lesser() to see if an internal chapter was made right before this - //point in the stream - if ((internal_chapter_pos(&zmv_open_vars.external_chapters, current_loc)) == 0xFFFFFFFF) - { - //Check if we have internal right here - unsigned char flag; - fread(&flag, 1, 1, zmv_vars.fp); - - if (!(flag & BIT(2))) - { - char *author = 0; - - internal_chapter_add_offset(&zmv_open_vars.external_chapters, current_loc); - zmv_open_vars.external_chapter_count++; - - if (zmv_vars.header.author_len) - { - if ((author = (char *)malloc(zmv_vars.header.author_len))) - { - fseek(zmv_vars.fp, -(zmv_vars.header.author_len), SEEK_END); - fread(author, zmv_vars.header.author_len, 1, zmv_vars.fp); - } - } - - fseek(zmv_vars.fp, -((signed)EXT_CHAP_COUNT_END_DIST), SEEK_END); - zst_save(zmv_vars.fp, false, false); - fwrite4(zmv_open_vars.frames_replayed, zmv_vars.fp); - write_last_joy_state(zmv_vars.fp); - fwrite4(current_loc, zmv_vars.fp); - - fwrite2(zmv_open_vars.external_chapter_count, zmv_vars.fp); - - if (author) - { - fwrite(author, zmv_vars.header.author_len, 1, zmv_vars.fp); - free(author); - } - - fseek(zmv_vars.fp, current_loc, SEEK_SET); - } - else //Just skip the internal - { - fseek(zmv_vars.fp, INT_CHAP_SIZE(ftell(zmv_vars.fp)), SEEK_CUR); - } - } - } -} - -static void zmv_replay_finished() -{ - internal_chapter_free_chain(zmv_vars.internal_chapters.next); - internal_chapter_free_chain(zmv_open_vars.external_chapters.next); - if (!zmv_vars.filename) - { - free(zmv_vars.filename); - zmv_vars.filename = 0; - } - if (zmv_vars.fp) - { - fclose(zmv_vars.fp); - zmv_vars.fp = 0; - } -} - -static void zmv_replay_to_record() -{ - internal_chapter_free_chain(zmv_open_vars.external_chapters.next); - zmv_vars.header.rerecords++; - zmv_vars.header.removed_frames += zmv_vars.header.frames - zmv_open_vars.frames_replayed; - zmv_vars.header.frames = zmv_open_vars.frames_replayed; - zmv_vars.header.author_len = 0; - zmv_vars.header.internal_chapters = internal_chapter_delete_after(&zmv_vars.internal_chapters, ftell(zmv_vars.fp)); - zmv_vars.last_internal_chapter_offset = internal_chapter_lesser(&zmv_vars.internal_chapters, ~0); - - if (zmv_vars.rle_count) - { - fseek(zmv_vars.fp, -4, SEEK_CUR); - fwrite4(zmv_vars.header.frames, zmv_vars.fp); - zmv_vars.rle_count = 0; - } - - ftruncate(fileno(zmv_vars.fp), ftell(zmv_vars.fp)); -} - -static size_t zmv_frames_replayed() -{ - return(zmv_open_vars.frames_replayed); -} - -static bool zmv_append(char *filename) -{ - if (zmv_open(filename)) - { - FILE *fp; - - mzt_chdir_up(); - if ((fp = fopen_dir(ZSramPath, "append.zst", "rb"))) - { - zst_load(fp, 0); - fclose(fp); - - if ((fp = fopen_dir(ZSramPath, "append.mzi", "rb"))) - { - zmv_open_vars.frames_replayed = fread4(fp); - read_last_joy_state(fp); - fseek(zmv_vars.fp, fread4(fp), SEEK_SET); - fclose(fp); - - zmv_vars.rle_count = 0; - mzt_chdir_down(); - - zmv_replay_to_record(); - zmv_vars.header.rerecords--; //Remove the rerecord count added by replay to record - return(true); - } - } - mzt_chdir_down(); - zmv_replay_finished(); - } - return(false); -} -/* - -Rewind related functions and vars - -*/ - -struct zmv_rewind -{ - unsigned char last_joy_state[10]; - size_t file_pos; - unsigned int frames; - size_t rle_count; -}; - - -struct zmv_rewind *zmv_rewind_buffer = 0; - -static void zmv_alloc_rewind_buffer(unsigned char rewind_states) -{ - zmv_rewind_buffer = (struct zmv_rewind *)malloc(sizeof(struct zmv_rewind)*rewind_states); -} - -static void zmv_dealloc_rewind_buffer() -{ - if (zmv_rewind_buffer) - { - free(zmv_rewind_buffer); - zmv_rewind_buffer = 0; - } -} - -void zmv_rewind_save(size_t state, bool playback) -{ - save_last_joy_state(zmv_rewind_buffer[state].last_joy_state); - zmv_rewind_buffer[state].file_pos = ftell(zmv_vars.fp) + zmv_vars.write_buffer_loc; - zmv_rewind_buffer[state].frames = playback ? zmv_open_vars.frames_replayed : zmv_vars.header.frames; - zmv_rewind_buffer[state].rle_count = zmv_vars.rle_count; -} - -void zmv_rewind_load(size_t state, bool playback) -{ - size_t file_pos = zmv_rewind_buffer[state].file_pos; - load_last_joy_state(zmv_rewind_buffer[state].last_joy_state); - - if (playback) - { - zmv_open_vars.frames_replayed = zmv_rewind_buffer[state].frames; - fseek(zmv_vars.fp, file_pos, SEEK_SET); - zmv_vars.rle_count = zmv_rewind_buffer[state].rle_count; - } - else - { - flush_input_buffer(); - - zmv_vars.header.rerecords++; - zmv_vars.header.removed_frames += zmv_vars.header.frames - zmv_rewind_buffer[state].frames; - zmv_vars.header.frames = zmv_rewind_buffer[state].frames; - zmv_vars.rle_count = zmv_rewind_buffer[state].rle_count; - - fseek(zmv_vars.fp, file_pos, SEEK_SET); - ftruncate(fileno(zmv_vars.fp), file_pos); - - zmv_vars.header.internal_chapters = internal_chapter_delete_after(&zmv_vars.internal_chapters, file_pos); - zmv_vars.last_internal_chapter_offset = internal_chapter_lesser(&zmv_vars.internal_chapters, ~0); - } -} - -/* - -Save and load MZT - -*/ - -size_t mzt_filename_generate() -{ - size_t filename_len = strlen(zmv_vars.filename); - memcpy(zmv_vars.filename+filename_len-3, "mz", 2); - if (!isdigit(zmv_vars.filename[filename_len-1])) - { - zmv_vars.filename[filename_len-1] = 't'; - } - if (access_dir(ZSramPath, zmv_vars.filename, F_OK)) - { - mkdir_dir(ZSramPath, zmv_vars.filename); - } - return(filename_len); -} - -void mzt_chdir_up() -{ - mzt_filename_generate(); - strcat(ZSramPath, zmv_vars.filename); - strcatslash(ZSramPath); -} - -void mzt_chdir_down() -{ - strdirname(ZSramPath); - strcatslash(ZSramPath); -} - -bool mzt_save(int position, bool thumb, bool playback) -{ - FILE *fp; - bool mzt_saved = false; - char name_buf[7]; - - if (!playback) { flush_input_buffer(); } - mzt_chdir_up(); - - sprintf(name_buf, "%.2d.zst", position); - - if ((fp = fopen_dir(ZSramPath, name_buf, "wb"))) - { - zst_save(fp, thumb, false); - fclose(fp); - - setextension(name_buf, "mzi"); - if ((fp = fopen_dir(ZSramPath, name_buf,"wb"))) - { - gzFile gzp = 0; - size_t rewind_point = ftell(zmv_vars.fp);; - - fwrite4((playback) ? zmv_open_vars.frames_replayed : zmv_vars.header.frames, fp); - write_last_joy_state(fp); - fwrite4(rewind_point, fp); - fclose(fp); - - setextension(name_buf, "zmv"); - if ((gzp = gzopen_dir(ZSramPath, name_buf, "wb9"))) - { - if (playback) - { - size_t amount_written, - int_chap_seek_point = INT_CHAP_END_DIST, - internal_chapter_count = internal_chapter_count_until(&zmv_vars.internal_chapters, rewind_point), - internal_chapters_size = internal_chapter_count << 2, - frames = zmv_vars.header.frames, - internal_chapters = zmv_vars.header.internal_chapters, - author_len = zmv_vars.header.author_len; - - //*Correct* the header for the MZT ZMV file - zmv_vars.header.frames = zmv_open_vars.frames_replayed; - zmv_vars.header.internal_chapters = internal_chapter_count; - zmv_vars.header.author_len = 0; - - rewind(zmv_vars.fp); - zmv_header_write(&zmv_vars.header, zmv_vars.fp); - rewind(zmv_vars.fp); - - //Copy the real ZMV to the MZT GZipped ZMV - for (amount_written = 0; amount_written < rewind_point;) - { - size_t amount = rewind_point-amount_written; - if (amount > WRITE_BUFFER_SIZE) { amount = WRITE_BUFFER_SIZE; } - - amount = fread(zmv_vars.write_buffer, 1, amount, zmv_vars.fp); - gzwrite(gzp, zmv_vars.write_buffer, amount); - amount_written += amount; - } - fseek(zmv_vars.fp, -((signed)int_chap_seek_point), SEEK_END); - for (amount_written = 0; amount_written < internal_chapters_size;) - { - size_t amount = internal_chapters_size-amount_written; - if (amount > WRITE_BUFFER_SIZE) { amount = WRITE_BUFFER_SIZE; } - - amount = fread(zmv_vars.write_buffer, 1, amount, zmv_vars.fp); - gzwrite(gzp, zmv_vars.write_buffer, amount); - amount_written += amount; - } - //External chapter count - gzputc(gzp, 0); - gzputc(gzp, 0); - //Done - gzclose(gzp); - - //Now fix data for the real ZMV file's header since we destroyed it - zmv_vars.header.frames = frames; - zmv_vars.header.internal_chapters = internal_chapters; - zmv_vars.header.author_len = author_len; - - rewind(zmv_vars.fp); - zmv_header_write(&zmv_vars.header, zmv_vars.fp); - } - else //During record is much simpler - { - internal_chapter_write(&zmv_vars.internal_chapters, zmv_vars.fp); - fwrite2(0, zmv_vars.fp); //External chapter count - - rewind(zmv_vars.fp); - zmv_header_write(&zmv_vars.header, zmv_vars.fp); - rewind(zmv_vars.fp); - - while (!feof(zmv_vars.fp)) - { - size_t amount_read = fread(zmv_vars.write_buffer, 1, WRITE_BUFFER_SIZE, zmv_vars.fp); - gzwrite(gzp, zmv_vars.write_buffer, amount_read); - } - gzclose(gzp); - } - mzt_saved = true; - } - fseek(zmv_vars.fp, rewind_point, SEEK_SET); - } - } - mzt_chdir_down(); - return(mzt_saved); -} - -bool mzt_load(int position, bool playback) -{ - FILE *fp; - bool mzt_loaded = false; - char name_buf[7]; - - mzt_chdir_up(); - - sprintf(name_buf, "%.2d.zst", position); - - if ((fp = fopen_dir(ZSramPath, name_buf, "rb"))) - { - zst_load(fp, 0); - fclose(fp); - - setextension(name_buf, "mzi"); - if ((fp = fopen_dir(ZSramPath, name_buf, "rb"))) - { - size_t rewind_point; - - size_t current_frame = fread4(fp); - read_last_joy_state(fp); - rewind_point = fread4(fp); - fclose(fp); - - zmv_vars.rle_count = 0; - - if (!playback) - { - gzFile gzp = 0; - - setextension(name_buf, "zmv"); - if ((gzp = gzopen_dir(ZSramPath, name_buf, "rb"))) - { - size_t rerecords = zmv_vars.header.rerecords+1; - size_t removed_frames = zmv_vars.header.removed_frames + (zmv_vars.header.frames - current_frame); - - internal_chapter_free_chain(zmv_vars.internal_chapters.next); - memset(&zmv_vars.internal_chapters, 0, sizeof(struct internal_chapter_buf)); - - rewind(zmv_vars.fp); - while (!gzeof(gzp)) - { - size_t amount_read = gzread(gzp, zmv_vars.write_buffer, WRITE_BUFFER_SIZE); - fwrite(zmv_vars.write_buffer, 1, amount_read, zmv_vars.fp); - } - gzclose(gzp); - - rewind(zmv_vars.fp); - zmv_header_read(&zmv_vars.header, zmv_vars.fp); - zmv_vars.header.removed_frames = removed_frames; - zmv_vars.header.rerecords = rerecords; - zmv_vars.header.author_len = 0; - zmv_vars.write_buffer_loc = 0; - - fseek(zmv_vars.fp, rewind_point, SEEK_SET); - internal_chapter_read(&zmv_vars.internal_chapters, zmv_vars.fp, zmv_vars.header.internal_chapters); - - fseek(zmv_vars.fp, rewind_point, SEEK_SET); - zmv_vars.last_internal_chapter_offset = internal_chapter_lesser(&zmv_vars.internal_chapters, ~0); - ftruncate(fileno(zmv_vars.fp), ftell(zmv_vars.fp)); - } - } - else - { - zmv_open_vars.frames_replayed = current_frame; - fseek(zmv_vars.fp, rewind_point, SEEK_SET); - } - - mzt_loaded = true; - } - } - mzt_chdir_down(); - return(mzt_loaded); -} - -///////////////////////////////////////////////////////// - -/* - -Code for dumping raw video - -*/ - -#define RAW_WIDTH 256 -#define RAW_HEIGHT 224 -#define RAW_FRAME_SIZE (RAW_WIDTH*RAW_HEIGHT*3) - -//NTSC FPS is 59.948743718592964824120603015060 in AVI that's a fraction of 59649/995 -//which equals 59.948743718592964824120603015075, so videos should not desync for several millenia - -//FPS = Rate*Stereo / Samples per Frame - -//These two numbers help with calculating how many samples are needed per frame -//59.948743718592964824120603015060 = SAMPLE_NTSC_LO*Rate/SAMPLE_NTSC_HI -//Samples per Frame = SAMPLE_NTSC_HI/SAMPLE_NTSC_LO *Stereo - -#define SAMPLE_NTSC_HI_SCALE 995ULL -#define SAMPLE_NTSC_LO 59649ULL - -//* PAL is much simpler, FPS is 50.0000000000000000000 which is a fraction of 50/1 -#define SAMPLE_PAL_HI_SCALE 1ULL -#define SAMPLE_PAL_LO 50ULL - -//Code using this by Bisqwit -//Used by raw videos for calculating sample rate - - -static const unsigned int freqtab[] = { 8000, 11025, 22050, 44100, 16000, 32000, 48000 }; -#define RATE freqtab[SoundQuality] - - -//0 = None; 1 Logging, but not now, 2 Log now -unsigned char AudioLogging; - -extern unsigned char ZMVRawDump; - - -/* -Replaces a substring of str. The replace begins at the beginning of str for rep_len length. -The new charaters are taken from new_str. The entire length of str will not exceed n. -Amount need to contain the entire replaced str is returned. -Thus if return is <= n, the replace was performed. -*/ -static size_t string_replace(char *str, size_t rep_len, const char *new_str, size_t n) -{ - size_t str_len = strlen(str); - size_t new_str_len = strlen(new_str); - size_t replaced_len = (str_len-rep_len)+new_str_len+1; - if (replaced_len <= n) - { - if (new_str_len == rep_len) - { - memcpy(str, new_str, rep_len); - } - else - { - memmove(str+new_str_len, str+rep_len, (str_len-rep_len)+1); - memcpy(str, new_str, new_str_len); - } - } - return(replaced_len); -} - - -#define PICK_HELP(var) if (!strncmp(str, "$"#var, strlen(#var)+1)) { *len = strlen(#var)+1; return(var); } - -static const char *pick_var(char *str, size_t *len) -{ - const char *null = NULL_FILE; - - PICK_HELP(md_prog); - PICK_HELP(md_raw); - PICK_HELP(md_other); - PICK_HELP(md_file); - PICK_HELP(md_sound); - PICK_HELP(md_no_sound); - PICK_HELP(md_pcm_audio); - PICK_HELP(md_compressed_audio); - - if (MovieVideoMode == 5) - { - PICK_HELP(md_custom_temp1); - PICK_HELP(md_custom_temp2); - PICK_HELP(md_custom_temp3); - PICK_HELP(null); - } - - if (!strncmp(str, "$md_video_rate", strlen("$md_video_rate"))) - { - *len = strlen("$md_video_rate"); - return(romispal ? md_pal : md_ntsc); - } - if (!strncmp(str, "$md_vcodec", strlen("$md_vcodec"))) - { - *len = strlen("$md_vcodec"); - switch (MovieVideoMode) - { - case 2: return(md_ffv1); break; - case 3: return(md_x264); break; - case 4: return(md_xvid); break; - } - return(""); - } - if (!strncmp(str, "$md_smode", strlen("$md_smode"))) - { - *len = strlen("$md_smode"); - if (MovieAudioCompress) { return(md_compressed_sound); } - else if (MovieAudio) { return(md_sound); } - else { return(md_no_sound); } - } - fprintf(stderr, "Unknown Variable: %s\n", str); - *len = 0; - return(0); -} - -static char *encode_command(char *p) -{ - static char command[1024]; - strncpy(command, p, sizeof(command)); - command[sizeof(command)-1] = 0; - - for (p = command; *p;) - { - char *var = strchr(p, '$'); - if (var) - { - size_t var_len; - const char *replace = pick_var(var, &var_len); - if (var_len) - { - size_t remaining = sizeof(command)-(var-command); - if (string_replace(var, var_len, replace, remaining) > remaining) - { - fputs("Encoding command has been cut off, check your settings in zmovie.cfg", stderr); - break; - } - } - else - { - p = var+1; - } - } - else - { - break; - } - } - -#ifndef DEBUG //Debug mode prints out commands used in system_dir and popen_dir anyway - puts(command); -#endif - - return(command); -} - -static char *encode_command_custom(unsigned char pass) -{ - char *p; - if (pass == md_custom_passes) { p = md_custom_last_pass; } - else if (pass == 1) { p = md_custom_first_pass; } - else { p = md_custom_middle_passes; } - return(encode_command(p)); -} - -#ifdef __UNIXSDL__ -static void broken_pipe(int sig) -{ - Msgptr = "BROKEN PIPE!"; - MessageOn = MsgCount; -} -#endif - -struct -{ - FILE *vp; - FILE *ap; - - size_t aud_dsize_pos; - - uint64 sample_hi; - uint64 sample_lo; - uint64 sample_balance; -} raw_vid; - -static void raw_embed_logo(bool audio) -{ - gzFile gzp; - if ((gzp = gzopen_dir(ZCfgPath, md_logo, "rb"))) - { - unsigned char logo_buffer[RAW_FRAME_SIZE]; - while (!gzeof(gzp)) - { - if (RAW_FRAME_SIZE == gzread(gzp, logo_buffer, RAW_FRAME_SIZE)) - { - fwrite(logo_buffer, RAW_FRAME_SIZE, 1, raw_vid.vp); - - if (audio) - { - //Thanks Bisqwit for this algorithm - unsigned int samples = (unsigned int)((raw_vid.sample_balance/raw_vid.sample_lo) << StereoSound); - raw_vid.sample_balance %= raw_vid.sample_lo; - raw_vid.sample_balance += raw_vid.sample_hi; - while (samples--) - { - fwrite2(0, raw_vid.ap); - } - } - } - } - } -} - -static unsigned char movie_current_pass = 0; - -static void raw_video_close() -{ - bool audio_and_video = raw_vid.vp && raw_vid.ap; - - if (raw_vid.vp) - { - switch (MovieVideoMode) - { - case 1: - fclose(raw_vid.vp); - break; - case 2: case 3: case 4: case 5: - pclose(raw_vid.vp); - break; - } - - raw_vid.vp = 0; - } - - if (raw_vid.ap) - { - size_t file_size = ftell(raw_vid.ap); //Get file size - if (!fseek(raw_vid.ap, 4, SEEK_SET)) //Seek to after RIFF header - { - fwrite4(file_size - 8, raw_vid.ap); //Don't include header or this write, -8 - } - if (!fseek(raw_vid.ap, raw_vid.aud_dsize_pos, SEEK_SET)) //Seek to where the audio data size goes - { - //Data size is remainder of file, which is file size, less current position, plus - //The 4 bytes needed to hold the data size - fwrite4(file_size - (raw_vid.aud_dsize_pos+4), raw_vid.ap); - } - if (MovieAudioCompress) - { - pclose(raw_vid.ap); - } - else - { - fclose(raw_vid.ap); - } - raw_vid.ap = 0; - AudioLogging = 0; - } - - if (movie_current_pass == md_custom_passes) - { - remove_dir(ZCfgPath, MovieAudioCompress ? md_compressed_audio : md_pcm_audio); - remove_dir(ZCfgPath, md_custom_pass_log_file); - remove_dir(ZCfgPath, md_custom_pass_log_file2); - } - - if ((MovieVideoMode != 5) && (audio_and_video && MovieVideoAudio)) - { - if (mencoderExists) { system_dir(ZCfgPath, encode_command(md_merge)); } - remove_dir(ZCfgPath, MovieAudioCompress ? md_compressed_audio : md_pcm_audio); - remove_dir(ZCfgPath, md_file); - } - signal(SIGPIPE, SIG_IGN); -} - -static bool raw_video_open() -{ - if (ZMVRawDump) //Command line - { - MovieVideoMode = ZMVRawDump; - } - - switch (MovieVideoMode) - { - case 0: - break; - - case 1: - raw_vid.vp = fopen_dir(ZCfgPath, md_raw_file, "wb"); - MovieVideoAudio = false; - break; - - case 2: case 3: case 4: - signal(SIGPIPE, broken_pipe); - mencoderExists = (raw_vid.vp = popen_dir(ZCfgPath, encode_command(md_command), WRITE_BINARY)) ? 1 : 0; - break; - - case 5: - signal(SIGPIPE, broken_pipe); - mencoderExists = (raw_vid.vp = popen_dir(ZCfgPath, encode_command_custom(movie_current_pass), WRITE_BINARY)) ? 1 : 0; - if (movie_current_pass == 1) - { - MovieAudio = 1; - } - else - { - if (*md_logo) { raw_embed_logo(false); } - return(true); - } - break; - - default: - return(false); - break; - } - - if (!MovieAudio && raw_vid.vp) - { - if (*md_logo) { raw_embed_logo(false); } - return(true); - } - - if ((!MovieVideoMode || raw_vid.vp) && MovieAudio) - { - if (MovieAudioCompress) - { - signal(SIGPIPE, broken_pipe); - lameExists = (raw_vid.ap = popen_dir(ZCfgPath, encode_command(md_audio_compress), WRITE_BINARY)) ? 1 : 0; - } - else - { - raw_vid.ap = fopen_dir(ZCfgPath, md_pcm_audio, "wb"); - } - if (raw_vid.ap) - { - fputs("RIFF", raw_vid.ap); //header - fwrite4(~0, raw_vid.ap); //file size - unknown till file close - fputs("WAVEfmt ", raw_vid.ap); //format - fwrite4(0x12, raw_vid.ap); //fmt size - fwrite2(1, raw_vid.ap); //fmt type (PCM) - fwrite2(StereoSound+1, raw_vid.ap); //channels - fwrite4(RATE, raw_vid.ap); //sample rate - fwrite4(RATE*4, raw_vid.ap); //byte rate (sample rate*block align) - fwrite2(16/8*StereoSound, raw_vid.ap); //block align (SignificantBitsPerSample / 8 * NumChannels) - fwrite2(16, raw_vid.ap); //Significant bits per sample - fwrite2(0, raw_vid.ap); //Extra format bytes - fputs("data", raw_vid.ap); //data header - raw_vid.aud_dsize_pos = ftell(raw_vid.ap); //Save current position for use later - fwrite4(~0, raw_vid.ap); //data size - unknown till file close - - if (romispal) - { - raw_vid.sample_hi = SAMPLE_PAL_HI_SCALE*RATE; - raw_vid.sample_lo = SAMPLE_PAL_LO; - } - else - { - raw_vid.sample_hi = SAMPLE_NTSC_HI_SCALE*RATE; - raw_vid.sample_lo = SAMPLE_NTSC_LO; - } - raw_vid.sample_balance = raw_vid.sample_hi; - - AudioLogging = 1; - if (MovieVideoMode && *md_logo) { raw_embed_logo(true); } - return(true); - } - } - - raw_video_close(); - return(false); -} - -static void raw_audio_write(unsigned int samples) -{ - void ProcessSoundBuffer(); - extern int DSPBuffer[1280]; - extern unsigned int BufferSizeB, BufferSizeW; - int *d = DSPBuffer, *d_end; - - while (samples > 1280) //This is in a loop for future proofing if we ever add above 48KHz - { - raw_audio_write(1280); - samples -= 1280; - } - - BufferSizeB = samples; - BufferSizeW = samples<<1; - - asm_call(ProcessSoundBuffer); - - for (d_end = DSPBuffer+samples; d < d_end; d++) - { - if ((unsigned int)(*d + 0x7FFF) < 0xFFFF) { fwrite2((short)*d, raw_vid.ap); continue; } - if (*d > 0x7FFF) { fwrite2(0x7FFF, raw_vid.ap); } - else { fwrite2(0x8001, raw_vid.ap); } - } -} - -#define PIXEL (vidbuffer[((y+1)*288) + x + 16]) -static void raw_video_write_frame() -{ - if (raw_vid.vp) - { - extern unsigned short *vidbuffer; - size_t x, y; - - //Convert 16 bit image to 24 bit image - for (y = 0; y < RAW_HEIGHT; y++) - { - for (x = 0; x < RAW_WIDTH; x++) - { - fwrite3(((PIXEL&0xF800) << 8) | ((PIXEL&0x07E0) << 5) | ((PIXEL&0x001F) << 3), raw_vid.vp); - } - } - } - - if (raw_vid.ap) - { - //Thanks Bisqwit for this algorithm - unsigned int samples = (unsigned int)((raw_vid.sample_balance/raw_vid.sample_lo) << StereoSound); - raw_vid.sample_balance %= raw_vid.sample_lo; - raw_vid.sample_balance += raw_vid.sample_hi; - //printf("Samples: %u\n", samples); - - AudioLogging = 2; - raw_audio_write(samples); - AudioLogging = 1; - } -} - - - -///////////////////////////////////////////////////////// - -/* -Nach's insane subtitle library for movies files :) - -The filename would be gamename.sub in the same directory the ZMV would be in. -If you're playing gamename.zm1, then the sub file will be gamename.su1 etc... - -Format of the sub file: -Start Frame:Frame Duration:Message - -Example: -1:180:Hi how are you? -300:180:Isn't this cool? -700:180:This is great :) -2500:375:Kill 'em! -3500:20:Did you see this? Of course not -*/ - -static struct -{ - FILE *fp; - char linebuf[256]; - size_t message_start; - size_t message_duration; -} MovieSub; - -static void MovieSub_Open(const char *filename) -{ - memset(&MovieSub, 0, sizeof(MovieSub)); - MovieSub.fp = fopen_dir(ZSramPath, filename, "r"); -} - -static void MovieSub_Close() -{ - if (MovieSub.fp) - { - fclose(MovieSub.fp); - MovieSub.fp = 0; - } -} - -static char *MovieSub_GetData(size_t frame_count) -{ - if (MovieSub.fp) - { - char *i, *num; - - if (frame_count > MovieSub.message_start + MovieSub.message_duration) - { - MovieSub.message_duration = 0; - do - { - if (!fgets(MovieSub.linebuf, 256, MovieSub.fp)) - { - return(0); - } - if (!(num = strtok(MovieSub.linebuf, ":"))) { return(0); } - for (i = num; *i; i++) - { - if (!isdigit(*i)) { return(0); } - } - MovieSub.message_start = atoi(num); - } while(MovieSub.message_start < zmv_frames_replayed()); - if (!(num = strtok(0, ":"))) { return(0); } - for (i = num; *i; i++) - { - if (!isdigit(*i)) - { - MovieSub.message_start = 0; - return(0); - } - } - MovieSub.message_duration = atoi(num); - } - - if (frame_count == MovieSub.message_start) - { - return(strtok(0, ":")); - } - } - return(0); -} - -static void MovieSub_ResetStream() -{ - if (MovieSub.fp) - { - rewind(MovieSub.fp); - MovieSub.message_start = 0; - MovieSub.message_duration = 0; - } -} - -static size_t MovieSub_GetDuration() -{ - return(MovieSub.message_duration); -} - - -///////////////////////////////////////////////////////// - -bool RawDumpInProgress = false; -bool PrevSRAMState; - -extern unsigned char ComboCounter, MovieRecordWinVal, AllocatedRewindStates; -extern unsigned char SloMo, EMUPause; -char MovieFrameStr[10]; -bool MovieForcedLengthEnabled = false; -unsigned int MovieForcedLength = 0, MovieForcedLengthInternal; -unsigned char MoviePassWaiting = 0; - -struct -{ - FILE *fp; - size_t frames_replayed; - struct - { - unsigned int A; - unsigned int B; - unsigned int C; - unsigned int D; - unsigned int E; - } last_joy_state; -} old_movie; - - -static void DumpVideoFrame(bool playback_over) -{ - if (RawDumpInProgress) - { - if (playback_over && MovieForcedLengthEnabled) - { - SetMovieMode(MOVIE_ENDING_DUMPING); - //Disable Input - JoyAOrig = JoyBOrig = JoyCOrig = JoyDOrig = JoyEOrig = 0; - } - - if ((playback_over && !MovieForcedLengthEnabled) || (MovieForcedLengthEnabled && (MovieForcedLengthInternal >= MovieForcedLength))) - { - switch (MovieProcessing) - { - case MOVIE_DUMPING_NEW: - zmv_replay_finished(); - MovieSub_Close(); - break; - case MOVIE_DUMPING_OLD: - fclose(old_movie.fp); - MovieSub_Close(); - break; - } - raw_video_close(); - RawDumpInProgress = false; - SetMovieMode(MOVIE_OFF); - if ((MovieVideoMode == 5) && (movie_current_pass < md_custom_passes)) - { - movie_current_pass++; - MoviePassWaiting = 1; - } - else - { - movie_current_pass = 0; - MovieForcedLengthEnabled = 0; - } - } - else - { - raw_video_write_frame(); - MovieForcedLengthInternal++; - if (MovieForcedLengthEnabled == 2) { MovieForcedLength++; } - } - } -} - -/* - -Code to playback old ZMVs - -*/ - -static void OldMovieReplay() -{ - unsigned char byte; - - if (fread(&byte, 1, 1, old_movie.fp)) - { - if (byte < 2) // 1 or 0 are correct values - { - char *sub; - - if (byte == 0) // 0 means the input has changed - { - fread(&old_movie.last_joy_state.A, 1, 4, old_movie.fp); - fread(&old_movie.last_joy_state.B, 1, 4, old_movie.fp); - fread(&old_movie.last_joy_state.C, 1, 4, old_movie.fp); - fread(&old_movie.last_joy_state.D, 1, 4, old_movie.fp); - fread(&old_movie.last_joy_state.E, 1, 4, old_movie.fp); - } - - JoyAOrig = old_movie.last_joy_state.A; - JoyBOrig = old_movie.last_joy_state.B; - JoyCOrig = old_movie.last_joy_state.C; - JoyDOrig = old_movie.last_joy_state.D; - JoyEOrig = old_movie.last_joy_state.E; - - if ((sub = MovieSub_GetData(old_movie.frames_replayed))) - { - Msgptr = sub; - MessageOn = MovieSub_GetDuration(); - } - - DumpVideoFrame(false); - old_movie.frames_replayed++; - } - else // anything else is bad - the file isn't a movie. - { - SetMovieMode(MOVIE_OFF); - MessageOn = 0; - fclose(old_movie.fp); - MovieSub_Close(); - } - } - else - { - if (old_movie.frames_replayed) - { - Msgptr = "MOVIE FINISHED."; - } - else - { - Msgptr = "STATE LOADED."; - } - - MessageOn = MsgCount; - SetMovieMode(MOVIE_OFF); - - fclose(old_movie.fp); - MovieSub_Close(); - - DumpVideoFrame(true); - } -} - -static unsigned char oldframeskip = 0; -static unsigned char oldmaxskip = 0; - -static void OldMoviePlay(FILE *fp) -{ - unsigned char RecData[16]; - extern unsigned char NextLineCache, sramsavedis; - extern size_t Totalbyteloaded; - extern unsigned int curexecstate; - extern unsigned int nmiprevaddrl, nmiprevaddrh, nmirept, nmiprevline, nmistatus; - void loadstate2(); - - memset(&old_movie, 0, sizeof(old_movie)); - old_movie.fp = fp; - - SetMovieMode(MOVIE_OLD_PLAY); - loadstate2(); - SetMovieMode(MOVIE_OFF); - - fseek(fp, Totalbyteloaded, SEEK_SET); - fread(RecData, 1, 16, fp); - printf("Movie made with version: %d\n", RecData[1]); - - if (RecData[2] == 1) - { - timer2upd = bytes_to_uint32(RecData+3); - curexecstate = bytes_to_uint32(RecData+7); - nmiprevaddrl = 0; - nmiprevaddrh = 0; - nmirept = 0; - nmiprevline = 224; - nmistatus = 0; - spcnumread = 0; - NextLineCache = 0; - } - - if (soundon == RecData[0]) - { - if (ramsize) { fread(sram, 1, ramsize, fp); } - - SetMovieMode(MOVIE_OLD_PLAY); - sramsavedis = 1; - DSPMem[0x08] = 0; - DSPMem[0x18] = 0; - DSPMem[0x28] = 0; - DSPMem[0x38] = 0; - DSPMem[0x48] = 0; - DSPMem[0x58] = 0; - DSPMem[0x68] = 0; - DSPMem[0x78] = 0; - - Msgptr = "OLD MOVIE REPLAYING."; - - oldframeskip = frameskip; - oldmaxskip = maxskip; - frameskip = 0; - maxskip = 0; - } - else - { - Msgptr = (!soundon) ? "MUST PLAY WITH SOUND ON." : "MUST PLAY WITH SOUND OFF."; - fclose(fp); - } - MessageOn = MsgCount; -} - -void MovieInsertChapter() -{ - switch (MovieProcessing) - { - case MOVIE_PLAYBACK: case MOVIE_DUMPING_NEW: // replaying - external - zmv_add_chapter(); - Msgptr = "EXTERNAL CHAPTER ADDED."; - break; - case MOVIE_RECORD: // recording - internal - if (zmv_insert_chapter()) - { - Msgptr = "INTERNAL CHAPTER ADDED."; - } - else - { - Msgptr = ""; - } - break; - case MOVIE_OLD_PLAY: - Msgptr = "OLD MOVIES DO NOT SUPPORT CHAPTERS."; - break; - default: // no movie processing - Msgptr = "NO MOVIE PROCESSING."; - } - - MessageOn = MsgCount; -} - -void MovieSeekAhead() -{ - switch (MovieProcessing) - { - case MOVIE_PLAYBACK: // replay seeking ok - if (zmv_next_chapter()) { Msgptr = "NEXT CHAPTER LOADED."; } - else { Msgptr = "NO CHAPTERS AHEAD."; } - break; - case MOVIE_RECORD: // record will use MZTs - Msgptr = "NO SEEKING DURING RECORD."; - break; - case MOVIE_OLD_PLAY: - Msgptr = "OLD MOVIES DO NOT SUPPORT CHAPTERS."; - break; - default: - Msgptr = "NO MOVIE PROCESSING."; - } - - MessageOn = MsgCount; -} - -void MovieSeekBehind() -{ - switch (MovieProcessing) - { - case MOVIE_PLAYBACK: // replay seeking ok - zmv_prev_chapter(); - MovieSub_ResetStream(); - Msgptr = "PREVIOUS CHAPTER LOADED."; - break; - case MOVIE_RECORD: // record will use MZTs - Msgptr = "NO SEEKING DURING RECORD."; - break; - case MOVIE_OLD_PLAY: - Msgptr = "OLD MOVIES DO NOT SUPPORT CHAPTERS."; - break; - default: - Msgptr = "NO MOVIE PROCESSING."; - } - - MessageOn = MsgCount; -} - -void Replay() -{ - if (zmv_replay()) - { - char *sub; - if ((sub = MovieSub_GetData(zmv_frames_replayed()))) - { - Msgptr = sub; - MessageOn = MovieSub_GetDuration(); - } - - DumpVideoFrame(false); - } - else - { - if (zmv_frames_replayed()) - { - Msgptr = "MOVIE FINISHED."; - } - else - { - Msgptr = "STATE LOADED."; - } - MessageOn = MsgCount; - SetMovieMode(MOVIE_OFF); - - zmv_replay_finished(); - zmv_dealloc_rewind_buffer(); - MovieSub_Close(); - - DumpVideoFrame(true); - - SRAMState = PrevSRAMState; - } -} - -void ProcessMovies() -{ - switch (MovieProcessing) - { - case MOVIE_PLAYBACK: case MOVIE_DUMPING_NEW: - Replay(); - break; - case MOVIE_RECORD: - zmv_record(EMUPause ? true : false, ComboCounter, SloMo); - break; - case MOVIE_OLD_PLAY: case MOVIE_DUMPING_OLD: - OldMovieReplay(); - break; - case MOVIE_ENDING_DUMPING: - DumpVideoFrame(true); - break; - } -} - -void ResetDuringMovie() -{ - zmv_record_command(zmv_command_reset); - SetMovieMode(MOVIE_OFF); - asm_call(GUIDoReset); - SetMovieMode(MOVIE_RECORD); -} - -void SkipMovie() -{ - MovieRecordWinVal = 0; -} - -void MovieStop() -{ - if (MovieProcessing && !MovieWaiting) - { - if ((MovieForcedLengthEnabled == 2) || movie_current_pass) - { - MovieForcedLengthEnabled = 1; - MovieForcedLength = MovieForcedLengthInternal; - } - - switch (MovieProcessing) - { - case MOVIE_PLAYBACK: case MOVIE_DUMPING_NEW: - zmv_replay_finished(); - MovieSub_Close(); - MovieForcedLengthInternal = MovieForcedLength; - DumpVideoFrame(true); - MessageOn = 0; - break; - - case MOVIE_RECORD: - zmv_record_finish(); - if (!zmv_frames_recorded()) - { - Msgptr = "STATE SAVED."; - MessageOn = MsgCount; - } - break; - case MOVIE_OLD_PLAY: case MOVIE_DUMPING_OLD: - fclose(old_movie.fp); - MovieSub_Close(); - MovieForcedLengthInternal = MovieForcedLength; - DumpVideoFrame(true); - MessageOn = 0; - break; - case MOVIE_ENDING_DUMPING: - MovieForcedLengthInternal = MovieForcedLength; - DumpVideoFrame(true); - break; - } - - zmv_dealloc_rewind_buffer(); - SetMovieMode(MOVIE_OFF); - SRAMState = PrevSRAMState; - - frameskip = oldframeskip; - maxskip = oldmaxskip; - } - MovieWaiting = false; -} - -void InitRewindVarsForMovie(); - -void MoviePlay() -{ - if (!MovieProcessing) - { - size_t fname_len = strlen(ZSaveName); - FILE *fp; - - PrevSRAMState = SRAMState; - SRAMState = true; - - GUIQuit = 2; - setextension(ZSaveName, "zmv"); - ZSaveName[fname_len-1] = CMovieExt; - - if ((fp = fopen_dir(ZSramPath, ZSaveName, "rb"))) - { - char header_buf[3]; - fread(header_buf, 3, 1, fp); - - if (!strncmp("ZMV", header_buf, 3)) //New Enhanced Format - { - fclose(fp); - - if (zmv_open(ZSaveName)) - { - InitRewindVarsForMovie(); - zmv_alloc_rewind_buffer(AllocatedRewindStates); - SetMovieMode(MOVIE_PLAYBACK); - setextension(ZSaveName, "sub"); - if (isdigit(CMovieExt)) { ZSaveName[fname_len-1] = CMovieExt; } - MovieSub_Open(ZSaveName); - MessageOn = MsgCount; - - oldframeskip = frameskip; - oldmaxskip = maxskip; - frameskip = 0; - maxskip = 0; - } - else - { - Msgptr = "MOVIE COULD NOT BE STARTED."; - MessageOn = MsgCount; - } - } - else //Old Pathetic Format - { - OldMoviePlay(fp); - } - } - else - { - Msgptr = "MOVIE COULD NOT BE OPENED."; - MessageOn = MsgCount; - } - } -} - -void MovieRecord() -{ - if (MovieProcessing == MOVIE_PLAYBACK) - { - zmv_replay_to_record(); - MovieProcessing = MOVIE_RECORD; - } - - if (!MovieProcessing) - { - size_t fname_len = strlen(ZSaveName); - - setextension(ZSaveName, "zmv"); - ZSaveName[fname_len-1] = CMovieExt; - - if (MovieRecordWinVal == 1) - { - //Erase old ZMV - remove_dir(ZSramPath, ZSaveName); - MovieRecordWinVal = 0; - } - - if (access_dir(ZSramPath, ZSaveName, F_OK)) - { - DIR *dir; - - PrevSRAMState = SRAMState; - SRAMState = true; - - SetMovieMode(MOVIE_RECORD); - if (zmv_create(ZSaveName)) - { - InitRewindVarsForMovie(); - zmv_alloc_rewind_buffer(AllocatedRewindStates); - Msgptr = "MOVIE RECORDING."; - MessageOn = MsgCount; - - oldframeskip = frameskip; - oldmaxskip = maxskip; - frameskip = 0; - maxskip = 0; - - //Cleanup old MZTs - mzt_chdir_up(); - if ((dir = opendir(ZSramPath))) - { - struct dirent *entry; - while ((entry = readdir(dir))) - { - if (*entry->d_name != '.') - { - remove_dir(ZSramPath, entry->d_name); - } - } - closedir(dir); - } - mzt_chdir_down(); - } - else - { - SetMovieMode(MOVIE_OFF); - } - } - else - { - MovieRecordWinVal = 1; - } - } -} - -void MovieAppend() -{ - if (!MovieProcessing) - { - size_t fname_len = strlen(ZSaveName); - - setextension(ZSaveName, "zmv"); - ZSaveName[fname_len-1] = CMovieExt; - - if (zmv_append(ZSaveName)) - { - PrevSRAMState = SRAMState; - SRAMState = true; - - SetMovieMode(MOVIE_RECORD); - InitRewindVarsForMovie(); - zmv_alloc_rewind_buffer(AllocatedRewindStates); - Msgptr = "MOVIE APPENDING."; - MessageOn = MsgCount; - - oldframeskip = frameskip; - oldmaxskip = maxskip; - frameskip = 0; - maxskip = 0; - } - } -} - -void GetMovieFrameStr() -{ - *MovieFrameStr = 0; - switch (MovieProcessing) - { - case MOVIE_PLAYBACK: case MOVIE_DUMPING_NEW: - sprintf(MovieFrameStr, "%u",(unsigned int)zmv_frames_replayed()); - break; - case MOVIE_RECORD: - sprintf(MovieFrameStr, "%u",(unsigned int)zmv_frames_recorded()); - break; - case MOVIE_OLD_PLAY: case MOVIE_DUMPING_OLD: - sprintf(MovieFrameStr, "%u",(unsigned int)(old_movie.frames_replayed)); - break; - } -} - -void MovieDumpRaw() -{ - MoviePassWaiting = 0; - if (!MovieProcessing) - { - MoviePlay(); - if ((MovieVideoMode == 5) && !movie_current_pass) { movie_current_pass = 1; } - if (MovieForcedLengthEnabled == 2) { MovieForcedLength = 1; } - MovieForcedLengthInternal = 0; - RawDumpInProgress = raw_video_open(); - - switch (MovieProcessing) - { - case MOVIE_PLAYBACK: - SetMovieMode(MOVIE_DUMPING_NEW); - break; - case MOVIE_OLD_PLAY: - SetMovieMode(MOVIE_DUMPING_OLD); - break; - } - } -} diff --git a/tools/zsnes/src/zmovie.h b/tools/zsnes/src/zmovie.h deleted file mode 100644 index 342eafa..0000000 --- a/tools/zsnes/src/zmovie.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef ZMOVIE_H -#define ZMOVIE_H - -void mzt_chdir_up(); -void mzt_chdir_down(); -bool mzt_save(int, bool, bool); -bool mzt_load(int, bool); - -void MovieRecord(); -void MoviePlay(); -void MovieStop(); -void MovieAppend(); - -extern unsigned char MovieProcessing; - -enum MovieStatus { MOVIE_OFF = 0, MOVIE_PLAYBACK, MOVIE_RECORD, MOVIE_OLD_PLAY, MOVIE_ENDING_DUMPING, MOVIE_DUMPING_NEW, MOVIE_DUMPING_OLD }; -#define SetMovieMode(mode) (MovieProcessing = (unsigned char)mode) - -enum MZT_FORCE_MODE_SWITCH { RTR_OFF = 0, RTR_REPLAY_TO_RECORD, RTR_RECORD_TO_REPLAY }; - -#endif diff --git a/tools/zsnes/src/zpath.c b/tools/zsnes/src/zpath.c deleted file mode 100644 index 5c9e771..0000000 --- a/tools/zsnes/src/zpath.c +++ /dev/null @@ -1,710 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#include "linux/safelib.h" -#include -#else -#ifdef __WIN32__ -#include -#include -#include "win/safelib.h" -#include "win/lib.h" -#else -#include "dos/lib.h" -#include -#endif -#include -#include -#endif -#include - -#include "zpath.h" -#include "cfg.h" - -#ifdef __WIN32__ -#define mkdir_p(path) mkdir(path) -#else -#define mkdir_p(path) mkdir(path, mmode) -#endif - -#ifdef __MSDOS__ -char ZCfgFile[] = "zsnes.cfg"; -#elif defined(__WIN32__) -char ZCfgFile[] = "zsnesw.cfg"; -#else -char ZCfgFile[] = "zsnesl.cfg"; -#endif - -char *ZStartPath = 0, *ZCfgPath = 0, *ZSramPath = 0, *ZRomPath = 0; -char *ZSnapPath = 0, *ZSpcPath = 0; -char *ZCartName = 0, *ZSaveName = 0, *ZStateName = 0, *ZSaveST2Name = 0; - -static bool ZStartAlloc = false, ZCfgAlloc = false, ZSramAlloc = false, ZRomAlloc = false; -static bool ZCartAlloc = false, ZSaveAlloc = false, ZStateAlloc = false, ZSaveST2Alloc = false; - -#ifdef __UNIXSDL__ - -void cfgpath_ensure(const char *launch_command) -{ - struct passwd *userinfo; -#ifdef ZCONF - const char *const zpath = ZCONF; -#else -#ifndef __MACOSX__ - const char *const zpath = ".zsnes"; -#else - const char *const zpath = "Library/Application Support/ZSNES"; -#endif -#endif - - if ((userinfo = getpwuid(getuid()))) - { - ZCfgPath = malloc(PATH_SIZE); - } - else - { - puts("Error obtaining info about your user."); - } - - if (ZCfgPath) - { - struct stat stat_buffer; - - ZCfgAlloc = true; - strcpy(ZCfgPath, userinfo->pw_dir); - strcatslash(ZCfgPath); - strcat(ZCfgPath, zpath); - - if (mkpath(ZCfgPath, 0755) && !stat(ZCfgPath, &stat_buffer) && S_ISDIR(stat_buffer.st_mode) && !access(ZCfgPath, W_OK)) - { - strcatslash(ZCfgPath); - } - else - { - printf("Error creating: %s\n", ZCfgPath); - free(ZCfgPath); - ZCfgAlloc = false; - - ZCfgPath = ZStartPath; - } - } - else - { - ZCfgPath = ZStartPath; - } -} - -#else - -void cfgpath_ensure(const char *launch_command) -{ - ZCfgPath = malloc(PATH_SIZE); - if (ZCfgPath) - { - char *p = 0; - ZCfgAlloc = true; - - if (isextension(launch_command, "exe")) - { - p = realpath(launch_command, ZCfgPath); - } - else - { - char buff[PATH_SIZE]; - strcpy(buff, launch_command); - setextension(buff, "exe"); - p = realpath(buff, ZCfgPath); - } - - if (p) - { - strdirname(ZCfgPath); - strcatslash(ZCfgPath); - } - else - { - free(ZCfgPath); - ZCfgAlloc = false; - ZCfgPath = ZStartPath; - } - } - else - { - ZCfgPath = ZStartPath; - } -} - -#endif - -void SaveGameSpecificInput(); - -void deinit_paths() -{ - //Save data that depends on paths before deinit of them - void SaveSramData(); - void GUISaveVars(); - - strcpy(ROMPath, ZRomPath); - - SaveSramData(); - GUISaveVars(); - SaveGameSpecificInput(); - - //Now deallocate the paths - if (ZStartAlloc && ZStartPath) { free(ZStartPath); } - if (ZCfgAlloc && ZCfgPath) { free(ZCfgPath); } - if (ZSramAlloc && ZSramPath) { free(ZSramPath); } - if (ZRomAlloc && ZRomPath) { free(ZRomPath); } - - if (ZCartAlloc && ZCartName) { free(ZCartName); } - if (ZSaveAlloc && ZSaveName) { free(ZSaveName); } - if (ZStateAlloc && ZStateName) { free(ZStateName); } - if (ZSaveST2Alloc && ZSaveST2Name) { free(ZSaveST2Name); } -} - -#define INIT_PATH_HELPER(x) if ((x##Path = malloc(PATH_SIZE))) { x##Alloc = true; } else { return(false); } -#define INIT_NAME_HELPER(x) if ((x##Name = malloc(NAME_SIZE))) { x##Alloc = true; *x##Name = 0; } else { return(false); } - -bool init_paths(char *launch_command) -{ - void GUIRestoreVars(); - - INIT_PATH_HELPER(ZStart); - INIT_PATH_HELPER(ZRom); - INIT_NAME_HELPER(ZCart); - INIT_NAME_HELPER(ZSave); - INIT_NAME_HELPER(ZState); - INIT_NAME_HELPER(ZSaveST2); - - if (getcwd(ZStartPath, PATH_SIZE)) - { - strcatslash(ZStartPath); - - cfgpath_ensure(launch_command); - - GUIRestoreVars(); - - if (*ROMPath && !access(strcutslash(ROMPath), DIR_R_ACCESS)) - { - strcpy(ZRomPath, ROMPath); - } - else - { - strcpy(ZRomPath, ZStartPath); - } - strcatslash(ZRomPath); - - init_save_paths(); - -#ifdef DEBUG -#ifndef __UNIXSDL__ - fdreopen_dir(ZCfgPath, "stderr.txt", "w", STDERR_FILENO); - fdreopen_dir(ZCfgPath, "stdout.txt", "w", STDOUT_FILENO); -#endif - - printf("ZStartPath: %s\n", ZStartPath); - printf("ZCfgPath: %s\n", ZCfgPath); - printf("ZRomPath: %s\n", ZRomPath); - printf("ZSramPath: %s\n", ZSramPath); - printf("ZSnapPath: %s\n", ZSnapPath); - printf("ZSpcPath: %s\n", ZSpcPath); -#endif - return(true); - } - return(false); -} - -void init_save_paths() -{ - if (*SRAMPath) - { - ZSramPath = SRAMPath; - } - else - { - #ifdef __UNIXSDL__ - ZSramPath = ZCfgPath; - #else - ZSramPath = ZRomPath; - #endif - } - strcatslash(ZSramPath); - - if (*SnapPath) - { - ZSnapPath = SnapPath; - } - else - { - ZSnapPath = ZSramPath; - } - strcatslash(ZSnapPath); - - if (*SPCPath) - { - ZSpcPath = SPCPath; - } - else - { - ZSpcPath = ZSramPath; - } - strcatslash(ZSpcPath); -} - -bool init_rom_path(char *path) -{ - if (realpath_link(path, ZRomPath)) - { - char *p; - SaveGameSpecificInput(); - - natify_slashes(ZRomPath); - p = strrchr(ZRomPath, DIR_SLASH_C); - strcpy(ZCartName, (p) ? p+1 : ZRomPath); - strcpy(ZSaveName, ZCartName); - strcpy(ZStateName, ZCartName); - setextension(ZStateName, "zst"); - - strdirname(ZRomPath); - strcatslash(ZRomPath); - -#ifdef DEBUG - printf("ZRomPath: %s\n", ZRomPath); - printf("ZCartName: %s\n", ZCartName); - printf("ZStateName: %s\n", ZStateName); -#endif - - return(true); - } - return(false); -} - -char *strdupcat(const char *str1, const char *str2) -{ - char *strnew = malloc(strlen(str1)+strlen(str2)+1); - if (strnew) - { - strcpy(strnew, str1); - strcat(strnew, str2); - return(strnew); - } - return(0); -} - -#ifndef DEBUG -//This function is only for this file, and it uses an internal buffer, and is intended for path file merging -static const char *strdupcat_internal(const char *path, const char *file) -{ - static char buffer_dir[PATH_SIZE*2]; - if (!IS_ABSOLUTE(file)) - { - strcpy(buffer_dir, path); - } - else - { - *buffer_dir = 0; - } - strcat(buffer_dir, file); - return(buffer_dir); -} - -#define chdir_dir(path) chdir(path); - -#else - -static const char *strdupcat_internal(const char *path, const char *file, const char *func, const char *mode) -{ - static char buffer_dir[PATH_SIZE*2]; - if (!IS_ABSOLUTE(file)) - { - strcpy(buffer_dir, path); - } - else - { - *buffer_dir = 0; - } - strcat(buffer_dir, file); - -#ifndef NO_DEBUGGER - // maybe checking isendwin() would be better anyway, but only after we scrap - // the old debugger, because that won't work when not actually using curses - if (!debuggeron) { -#endif - if (mode) - { - printf("%s_%s: %s\n", func, mode, buffer_dir); - } - else - { - printf("%s: %s\n", func, buffer_dir); - } -#ifndef NO_DEBUGGER - } -#endif - - return(buffer_dir); -} - -//This is to keep the modeless functions working right -static const char *mode = 0; -static const char *mode_text = 0; - -#define strdupcat_internal(x, y) strdupcat_internal(x, y, __func__, mode ? mode : mode_text) - -int chdir_internal(const char *path, const char *func, const char *command) -{ - printf("%s: %s: %s\n", func, path, command); - return(chdir(path)); -} - -#define chdir_dir(path) chdir_internal(path, __func__, command); - -#endif - - -int access_dir(const char *path, const char *file, int amode) -{ -#ifdef DEBUG - char mode_text[5]; - strcpy(mode_text, "f"); - if (amode & R_OK) { strcat(mode_text, "r"); } - if (amode & W_OK) { strcat(mode_text, "w"); } - if (amode & X_OK) { strcat(mode_text, "x"); } -#endif - - return(access(strdupcat_internal(path, file), amode)); -} - -int stat_dir(const char *path, const char *file, struct stat *buf) -{ - return(stat(strdupcat_internal(path, file), buf)); -} - -FILE *fopen_dir(const char *path, const char *file, const char *mode) -{ - return(fopen(strdupcat_internal(path, file), mode)); -} - -gzFile gzopen_dir(const char *path, const char *file, const char *mode) -{ - return(gzopen(strdupcat_internal(path, file), mode)); -} - -unzFile unzopen_dir(const char *path, const char *file) -{ - return(unzOpen(strdupcat_internal(path, file))); -} - -#ifndef NO_JMA -void load_jma_file_dir(const char *path, const char *file) -{ - load_jma_file(strdupcat_internal(path, file)); -} -#endif - -int remove_dir(const char *path, const char *file) -{ - return(remove(strdupcat_internal(path, file))); -} - -int mkdir_dir(const char *path, const char *dir) -{ - mode_t mmode = 0755; - return(mkdir_p(strdupcat_internal(path, dir))); -} - -char *realpath_dir(const char *path, const char *file, char *buf) -{ -#ifdef __UNIXSDL__ - return(realpath_tilde(strdupcat_internal(path, file), buf)); -#else - return(realpath(strdupcat_internal(path, file), buf)); -#endif -} - -#ifdef __MSDOS__ -char *realpath_sfn_dir(const char *path, const char *file, char *buf) -{ - return(realpath_sfn(strdupcat_internal(path, file), buf)); -} -#endif - -FILE *fdreopen_dir(const char *path, const char *file, const char *mode, int fd) -{ - //Because DOSBox and Windows is stupid, we're implementing this manually; - FILE *fp = fopen(strdupcat_internal(path, file), mode); - if (fp) - { - dup2(fileno(fp), fd); - } - return(fp); -} - -int system_dir(const char *path, const char *command) -{ - int ret_val; - chdir_dir(path); - ret_val = system(command); - chdir(ZStartPath); - return(ret_val); -} - -FILE *popen_dir(const char *path, char *command, const char *type) -{ - FILE *ret_val; - chdir_dir(path); - ret_val = popen(command, type); - chdir(ZStartPath); - return(ret_val); -} - -void natify_slashes(char *str) -{ - while (*str) - { - if (*str == DIR_SLASH_C_OTHER) - { - *str = DIR_SLASH_C; - } - str++; - } -} - -char *strcutslash(char *str) -{ - char *last_char = str+(strlen(str)-1); - - natify_slashes(str); - if (*last_char == DIR_SLASH_C) - { - *last_char = 0; - } - return(str); -} - -char *strcatslash(char *str) -{ - natify_slashes(str); - if (str[strlen(str)-1] != DIR_SLASH_C) - { - strcat(str, DIR_SLASH); - } - return(str); -} - -void setextension(char *base, const char *ext) -{ - char *p = strrchr(base, '.'); - - if(p) - { - strcpy(p+1, ext); - } - else - { - strcat(base, "."); - strcat(base, ext); - } -} - -bool isextension(const char *fname, const char *ext) -{ - size_t fname_len = strlen(fname), - ext_len = strlen(ext); - return((fname[fname_len-(ext_len+1)] == '.') && !strcasecmp(fname+fname_len-ext_len, ext)); -} - -void strdirname(char *str) -{ - char *p; - size_t str_len = strlen(str); - - natify_slashes(str); - - do - { - str_len--; - } while (str_len && (str[str_len] == DIR_SLASH_C)); - str[str_len+1] = 0; - - p = strrchr(str, DIR_SLASH_C); - if (p > str) - { - *p = 0; - } - else if (p == str) - { - str[1] = 0; - } -} - -void strbasename(char *str) -{ - char *p; - - natify_slashes(str); - - if ((p = strrchr(str, DIR_SLASH_C))) - { - memmove(str, p+1, strlen(p)); - } -} - -static bool mkpath_help(char *path, char *element, mode_t mmode) -{ - bool success = true; - if (*path) - { - char *p; - bool created; - - while (*element == DIR_SLASH_C) { element++; } - - if (*element) - { - p = strchr(element, DIR_SLASH_C); - if (p) { *p = 0; } - if ((created = !mkdir_p(path)) || (errno == EEXIST)) //Current path fragment created or already exists - { - if (p) - { - *p = DIR_SLASH_C; - if (!mkpath_help(path, p+1, mmode)) //If creation of next fragment fails - { - if (created) - { - *p = 0; - rmdir(path); - } - success = false; - } - } - } - else { success = false; } - } - } - return(success); -} - -bool mkpath(const char *path, mode_t mode) -{ - bool success = true; - if (path && *path) - { - char *p = strdup(path); - if (p) - { - natify_slashes(p); - success = mkpath_help(p, p, mode); - free(p); - } - else { success = false; } - } - return(success); -} - -#ifdef __UNIXSDL__ - -//Like realpath(), but will return the last element as the link it is -char *realpath_link(const char *path, char *resolved_path) -{ - char buffer[PATH_SIZE], *p, *base, *last_element; - strcpy(buffer, path); - natify_slashes(buffer); - p = strrchr(buffer, DIR_SLASH_C); - if (p) - { - *p = 0; - base = buffer; - last_element = p+1; - } - else - { - base = "."; - last_element = buffer; - } - - p = realpath(base, resolved_path); - if (p) - { - strcatslash(resolved_path); - strcat(resolved_path, last_element); - return(resolved_path); - } - return(0); -} - -//realpath() with ~ support -char *realpath_tilde(const char *path, char *resolved_path) -{ - if (*path == '~') - { - char buffer[PATH_SIZE]; - struct passwd *userinfo; - - strcpy(buffer, "~"); - path++; - - if (isalpha(*path)) - { - char *p = buffer+1; - while (isalnum(*path)) - { - *p++ = *path++; - } - *p = 0; - if ((userinfo = getpwnam(buffer+1))) - { - strcpy(buffer, userinfo->pw_dir); - } - } - else - { - if ((userinfo = getpwuid(getuid()))) - { - strcpy(buffer, userinfo->pw_dir); - } - } - strcat(buffer, path); - - return(realpath(buffer, resolved_path)); - } - return(realpath(path, resolved_path)); -} - -#endif - -void psr_cfg_run(unsigned char (*psr_func)(const char *), const char *dir, const char *fname) -{ - char *path = strdupcat(dir, fname); - if (path) - { - psr_func(path); - free(path); - } - else - { - psr_func(fname); - } -} - diff --git a/tools/zsnes/src/zpath.h b/tools/zsnes/src/zpath.h deleted file mode 100644 index 1e9c8c0..0000000 --- a/tools/zsnes/src/zpath.h +++ /dev/null @@ -1,123 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - -#ifndef ZPATH_H -#define ZPATH_H - -#include -#include -#include - -#include "zip/zunzip.h" - -#ifndef NO_JMA -#include "jma/zsnesjma.h" -#endif - -#ifdef _MSC_VER -#define F_OK 0 -#define X_OK F_OK //Drop down to F_OK because MSVC is stupid -#define W_OK 2 -#define R_OK 4 -typedef unsigned short mode_t; -#endif - -#if !defined(__cplusplus) && !defined(bool) -//C++ style code in C -#define bool unsigned char -#define true 1 -#define false 0 -#endif - -#ifdef __UNIXSDL__ -#define DIR_SLASH "/" -#define DIR_SLASH_C '/' -#define DIR_SLASH_C_OTHER '\\' -#define ROOT_LEN 1 //"/" -#define DIR_R_ACCESS (R_OK|X_OK) -#define IS_ABSOLUTE(path) ((*(path) == '/') || (*(path) == '~')) -#else -#define DIR_SLASH "\\" -#define DIR_SLASH_C '\\' -#define DIR_SLASH_C_OTHER '/' -#define ROOT_LEN 3 //"A:\" -#define DIR_R_ACCESS (F_OK) -#define IS_ABSOLUTE(path) ((*(path) == '\\') || (*(path) && ((path)[1] == ':'))) -#endif - -#ifndef __MSDOS__ -#define PATH_SIZE 4096 -#define NAME_SIZE 512 -#define realpath_native realpath -#else -#define PATH_SIZE 256 -#define NAME_SIZE 13 -#define realpath_native realpath_sfn -#endif - -extern char ZCfgFile[]; -extern char *ZStartPath, *ZCfgPath, *ZSramPath, *ZRomPath; -extern char *ZSnapPath, *ZSpcPath; -extern char *ZCartName, *ZSaveName, *ZStateName, *ZSaveST2Name; - -bool init_paths(char *launch_command); -void init_save_paths(); -bool init_rom_path(char *path); - -char *strdupcat(const char *str1, const char *str2); - -int access_dir(const char *path, const char *file, int mode); -int stat_dir(const char *path, const char *file, struct stat *buf); -FILE *fopen_dir(const char *path, const char *file, const char *mode); -gzFile gzopen_dir(const char *path, const char *file, const char *mode); -unzFile unzopen_dir(const char *path, const char *file); -#ifndef NO_JMA -void load_jma_file_dir(const char *path, const char *file); -#endif -int remove_dir(const char *path, const char *file); -int mkdir_dir(const char *path, const char *dir); -char *realpath_dir(const char *path, const char *file, char *buf); -#ifdef __MSDOS__ -char *realpath_sfn_dir(const char *path, const char *file, char *buf); -#endif -FILE *fdreopen_dir(const char *path, const char *file, const char *mode, int fd); -int system_dir(const char *path, const char *command); -FILE *popen_dir(const char *path, char *command, const char *type); - -void natify_slashes(char *str); -char *strcutslash(char *str); -char *strcatslash(char *str); -void setextension(char *base, const char *ext); -bool isextension(const char *fname, const char *ext); -void strdirname(char *str); -void strbasename(char *str); -bool mkpath(const char *path, mode_t mode); - -#ifdef __UNIXSDL__ -char *realpath_link(const char *path, char *resolved_path); -char *realpath_tilde(const char *path, char *resolved_path); -#else -#define realpath_link realpath_native -#endif - -void psr_cfg_run(unsigned char (*psr_func)(const char *), const char *dir, const char *fname); - -#endif diff --git a/tools/zsnes/src/zstate.c b/tools/zsnes/src/zstate.c deleted file mode 100644 index c01e66f..0000000 --- a/tools/zsnes/src/zstate.c +++ /dev/null @@ -1,1483 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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. -*/ - - - -#ifdef __UNIXSDL__ -#include "gblhdr.h" -#define DIR_SLASH "/" -#else -#include -#include -#include -#include -#include -#include -#ifdef __WIN32__ -#include -#else -#include -#endif -#define DIR_SLASH "\\" -#endif -#include -#include "gblvars.h" -#include "asm_call.h" -#include "zpath.h" -#include "cfg.h" -#include "zmovie.h" -#include "chips/dsp4emu.h" -#include "input.h" - -#define NUMCONV_FR3 -#define NUMCONV_FW3 -#include "numconv.h" - -#ifdef __MSDOS__ -#define clim() __asm__ __volatile__ ("cli"); -#define stim() __asm__ __volatile__ ("sti"); -#else -#define clim() -#define stim() -#endif - -void SA1UpdateDPageC(), unpackfunct(), repackfunct(); -void PrepareOffset(), ResetOffset(), initpitch(), UpdateBanksSDD1(); -void procexecloop(), outofmemory(); - -extern unsigned char cacheud, ccud, intrset, cycpl, cycphb, xdbt, xpbt, xp; -extern unsigned char xe, xirqb, debugger, curnmi; -extern unsigned short curypos, stackand, stackor, xat, xst, xdt, xxt, xyt, xpc; -extern unsigned int Curtableaddr, cycpblt; - -static void copy_snes_data(unsigned char **buffer, void (*copy_func)(unsigned char **, void *, size_t)) -{ - //65816 status, etc. - copy_func(buffer, &curcyc, 1); - copy_func(buffer, &curypos, 2); - copy_func(buffer, &cacheud, 1); - copy_func(buffer, &ccud, 1); - copy_func(buffer, &intrset, 1); - copy_func(buffer, &cycpl, 1); - copy_func(buffer, &cycphb, 1); - copy_func(buffer, &spcon, 1); - copy_func(buffer, &stackand, 2); - copy_func(buffer, &stackor, 2); - copy_func(buffer, &xat, 2); - copy_func(buffer, &xdbt, 1); - copy_func(buffer, &xpbt, 1); - copy_func(buffer, &xst, 2); - copy_func(buffer, &xdt, 2); - copy_func(buffer, &xxt, 2); - copy_func(buffer, &xyt, 2); - copy_func(buffer, &xp, 1); - copy_func(buffer, &xe, 1); - copy_func(buffer, &xpc, 2); - copy_func(buffer, &xirqb, 1); - copy_func(buffer, &debugger, 1); - copy_func(buffer, &Curtableaddr, 4); - copy_func(buffer, &curnmi, 1); - //SPC Timers - copy_func(buffer, &cycpbl, 4); - copy_func(buffer, &cycpblt, 4); - //SNES PPU Register status - copy_func(buffer, &sndrot, 3019); -} - -static void copy_spc_data(unsigned char **buffer, void (*copy_func)(unsigned char **, void *, size_t)) -{ - //SPC stuff, DSP stuff - copy_func(buffer, SPCRAM, PHspcsave); - copy_func(buffer, &BRRBuffer, PHdspsave); - copy_func(buffer, &DSPMem, sizeof(DSPMem)); -} - -static void copy_extra_data(unsigned char **buffer, void (*copy_func)(unsigned char **, void *, size_t)) -{ - copy_func(buffer, &soundcycleft, 4); - copy_func(buffer, &curexecstate, 4); - copy_func(buffer, &nmiprevaddrl, 4); - copy_func(buffer, &nmiprevaddrh, 4); - copy_func(buffer, &nmirept, 4); - copy_func(buffer, &nmiprevline, 4); - copy_func(buffer, &nmistatus, 4); - copy_func(buffer, &joycontren, 4); - copy_func(buffer, &NextLineCache, 1); - copy_func(buffer, &spc700read, 10*4); - copy_func(buffer, &timer2upd, 4); - copy_func(buffer, &xa, 14*4); - copy_func(buffer, &spcnumread, 1); - copy_func(buffer, &opcd, 6*4); - copy_func(buffer, &HIRQCycNext, 4); - copy_func(buffer, &HIRQNextExe, 1); - copy_func(buffer, &oamaddr, 14*4); - copy_func(buffer, &prevoamptr, 1); -} - -static size_t load_save_size; - -enum copy_state_method { csm_save_zst_new, - csm_load_zst_new, - csm_load_zst_old, - csm_save_rewind, - csm_load_rewind }; - -extern unsigned char *SPC7110PackPtr; - -static void copy_state_data(unsigned char *buffer, void (*copy_func)(unsigned char **, void *, size_t), enum copy_state_method method) -{ - copy_snes_data(&buffer, copy_func); - - //WRAM (128k), VRAM (64k) - copy_func(&buffer, wramdata, 8192*16); - copy_func(&buffer, vram, 4096*16); - - if (spcon) - { - copy_spc_data(&buffer, copy_func); - /* - if (buffer) //Rewind stuff - { - copy_func(&buffer, &echoon0, PHdspsave2); - } - */ - } - - if (C4Enable) - { - copy_func(&buffer, C4Ram, 2048*4); - } - - if (SFXEnable) - { - copy_func(&buffer, sfxramdata, 8192*16); - copy_func(&buffer, &SfxR0, PHnum2writesfxreg); - } - - if (SA1Enable) - { - copy_func(&buffer, &SA1Mode, PHnum2writesa1reg); - copy_func(&buffer, SA1RAMArea, 8192*16); - if (method != csm_load_zst_old) - { - copy_func(&buffer, &SA1Status, 3); - copy_func(&buffer, &SA1xpc, 1*4); - copy_func(&buffer, &sa1dmaptr, 2*4); - } - } - - if (DSP1Enable && (method != csm_load_zst_old)) - { - copy_func(&buffer, &DSP1COp, 70+128); - copy_func(&buffer, &Op00Multiplicand, 3*4+128); - copy_func(&buffer, &Op10Coefficient, 4*4+128); - copy_func(&buffer, &Op04Angle, 4*4+128); - copy_func(&buffer, &Op08X, 5*4+128); - copy_func(&buffer, &Op18X, 5*4+128); - copy_func(&buffer, &Op28X, 4*4+128); - copy_func(&buffer, &Op0CA, 5*4+128); - copy_func(&buffer, &Op02FX, 11*4+3*4+28*8+128); - copy_func(&buffer, &Op0AVS, 5*4+14*8+128); - copy_func(&buffer, &Op06X, 6*4+10*8+4+128); - copy_func(&buffer, &Op01m, 4*4+128); - copy_func(&buffer, &Op0DX, 6*4+128); - copy_func(&buffer, &Op03F, 6*4+128); - copy_func(&buffer, &Op14Zr, 9*4+128); - copy_func(&buffer, &Op0EH, 4*4+128); - } - - if (SETAEnable) - { - copy_func(&buffer, setaramdata, 256*16); - - //Todo: copy the SetaCmdEnable? For completeness we should do it - //but currently we ignore it anyway. - } - - if (SPC7110Enable) - { - copy_func(&buffer, SPC7110PackPtr, 65536); - copy_func(&buffer, &SPCMultA, PHnum2writespc7110reg); - } - - if (DSP4Enable) - { - copy_func(&buffer, &DSP4.waiting4command, sizeof(DSP4.waiting4command)); - copy_func(&buffer, &DSP4.half_command, sizeof(DSP4.half_command)); - copy_func(&buffer, &DSP4.command, sizeof(DSP4.command)); - copy_func(&buffer, &DSP4.in_count, sizeof(DSP4.in_count)); - copy_func(&buffer, &DSP4.in_index, sizeof(DSP4.in_index)); - copy_func(&buffer, &DSP4.out_count, sizeof(DSP4.out_count)); - copy_func(&buffer, &DSP4.out_index, sizeof(DSP4.out_index)); - copy_func(&buffer, &DSP4.parameters, sizeof(DSP4.parameters)); - copy_func(&buffer, &DSP4.output, sizeof(DSP4.output)); - - copy_func(&buffer, &DSP4_vars.DSP4_Logic, sizeof(DSP4_vars.DSP4_Logic)); - copy_func(&buffer, &DSP4_vars.lcv, sizeof(DSP4_vars.lcv)); - copy_func(&buffer, &DSP4_vars.distance, sizeof(DSP4_vars.distance)); - copy_func(&buffer, &DSP4_vars.raster, sizeof(DSP4_vars.raster)); - copy_func(&buffer, &DSP4_vars.segments, sizeof(DSP4_vars.segments)); - copy_func(&buffer, &DSP4_vars.world_x, sizeof(DSP4_vars.world_x)); - copy_func(&buffer, &DSP4_vars.world_y, sizeof(DSP4_vars.world_y)); - copy_func(&buffer, &DSP4_vars.world_dx, sizeof(DSP4_vars.world_dx)); - copy_func(&buffer, &DSP4_vars.world_dy, sizeof(DSP4_vars.world_dy)); - copy_func(&buffer, &DSP4_vars.world_ddx, sizeof(DSP4_vars.world_ddx)); - copy_func(&buffer, &DSP4_vars.world_ddy, sizeof(DSP4_vars.world_ddy)); - copy_func(&buffer, &DSP4_vars.world_xenv, sizeof(DSP4_vars.world_xenv)); - copy_func(&buffer, &DSP4_vars.world_yofs, sizeof(DSP4_vars.world_yofs)); - copy_func(&buffer, &DSP4_vars.view_x1, sizeof(DSP4_vars.view_x1)); - copy_func(&buffer, &DSP4_vars.view_y1, sizeof(DSP4_vars.view_y1)); - copy_func(&buffer, &DSP4_vars.view_x2, sizeof(DSP4_vars.view_x2)); - copy_func(&buffer, &DSP4_vars.view_y2, sizeof(DSP4_vars.view_y2)); - copy_func(&buffer, &DSP4_vars.view_dx, sizeof(DSP4_vars.view_dx)); - copy_func(&buffer, &DSP4_vars.view_dy, sizeof(DSP4_vars.view_dy)); - copy_func(&buffer, &DSP4_vars.view_xofs1, sizeof(DSP4_vars.view_xofs1)); - copy_func(&buffer, &DSP4_vars.view_yofs1, sizeof(DSP4_vars.view_yofs1)); - copy_func(&buffer, &DSP4_vars.view_xofs2, sizeof(DSP4_vars.view_xofs2)); - copy_func(&buffer, &DSP4_vars.view_yofs2, sizeof(DSP4_vars.view_yofs2)); - copy_func(&buffer, &DSP4_vars.view_yofsenv, sizeof(DSP4_vars.view_yofsenv)); - copy_func(&buffer, &DSP4_vars.view_turnoff_x, sizeof(DSP4_vars.view_turnoff_x)); - copy_func(&buffer, &DSP4_vars.view_turnoff_dx, sizeof(DSP4_vars.view_turnoff_dx)); - copy_func(&buffer, &DSP4_vars.viewport_cx, sizeof(DSP4_vars.viewport_cx)); - copy_func(&buffer, &DSP4_vars.viewport_cy, sizeof(DSP4_vars.viewport_cy)); - copy_func(&buffer, &DSP4_vars.viewport_left, sizeof(DSP4_vars.viewport_left)); - copy_func(&buffer, &DSP4_vars.viewport_right, sizeof(DSP4_vars.viewport_right)); - copy_func(&buffer, &DSP4_vars.viewport_top, sizeof(DSP4_vars.viewport_top)); - copy_func(&buffer, &DSP4_vars.viewport_bottom, sizeof(DSP4_vars.viewport_bottom)); - copy_func(&buffer, &DSP4_vars.sprite_x, sizeof(DSP4_vars.sprite_x)); - copy_func(&buffer, &DSP4_vars.sprite_y, sizeof(DSP4_vars.sprite_y)); - copy_func(&buffer, &DSP4_vars.sprite_attr, sizeof(DSP4_vars.sprite_attr)); - copy_func(&buffer, &DSP4_vars.sprite_size, sizeof(DSP4_vars.sprite_size)); - copy_func(&buffer, &DSP4_vars.sprite_clipy, sizeof(DSP4_vars.sprite_clipy)); - copy_func(&buffer, &DSP4_vars.sprite_count, sizeof(DSP4_vars.sprite_count)); - copy_func(&buffer, &DSP4_vars.poly_clipLf, sizeof(DSP4_vars.poly_clipLf)); - copy_func(&buffer, &DSP4_vars.poly_clipRt, sizeof(DSP4_vars.poly_clipRt)); - copy_func(&buffer, &DSP4_vars.poly_ptr, sizeof(DSP4_vars.poly_ptr)); - copy_func(&buffer, &DSP4_vars.poly_raster, sizeof(DSP4_vars.poly_raster)); - copy_func(&buffer, &DSP4_vars.poly_top, sizeof(DSP4_vars.poly_top)); - copy_func(&buffer, &DSP4_vars.poly_bottom, sizeof(DSP4_vars.poly_bottom)); - copy_func(&buffer, &DSP4_vars.poly_cx, sizeof(DSP4_vars.poly_cx)); - copy_func(&buffer, &DSP4_vars.poly_start, sizeof(DSP4_vars.poly_start)); - copy_func(&buffer, &DSP4_vars.poly_plane, sizeof(DSP4_vars.poly_plane)); - copy_func(&buffer, &DSP4_vars.OAM_attr, sizeof(DSP4_vars.OAM_attr)); - copy_func(&buffer, &DSP4_vars.OAM_index, sizeof(DSP4_vars.OAM_index)); - copy_func(&buffer, &DSP4_vars.OAM_bits, sizeof(DSP4_vars.OAM_bits)); - copy_func(&buffer, &DSP4_vars.OAM_RowMax, sizeof(DSP4_vars.OAM_RowMax)); - copy_func(&buffer, &DSP4_vars.OAM_Row, sizeof(DSP4_vars.OAM_Row)); - } - - if (method != csm_load_zst_old) - { - copy_extra_data(&buffer, copy_func); - - //We don't load SRAM from new states if box isn't checked - if ((method != csm_load_zst_new) || SRAMState) - { - copy_func(&buffer, sram, ramsize); - } - - if ((method == csm_save_rewind) || (method == csm_load_rewind)) - { - copy_func(&buffer, &tempesi, 4); - copy_func(&buffer, &tempedi, 4); - copy_func(&buffer, &tempedx, 4); - copy_func(&buffer, &tempebp, 4); - } - } -} - -static void memcpyinc(unsigned char **dest, void *src, size_t len) -{ - memcpy(*dest, src, len); - *dest += len; -} - -static void memcpyrinc(unsigned char **src, void *dest, size_t len) -{ - memcpy(dest, *src, len); - *src += len; -} - -extern unsigned int RewindTimer, DblRewTimer; -extern unsigned char EMUPause; - -unsigned char *StateBackup = 0; -unsigned char AllocatedRewindStates, LatestRewindPos, EarliestRewindPos; -bool RewindPosPassed; - -size_t rewind_state_size, cur_zst_size, old_zst_size; - -extern unsigned char romispal; -void zmv_rewind_save(size_t, bool); -void zmv_rewind_load(size_t, bool); - -void ClearCacheCheck() -{ - memset(vidmemch2, 1, sizeof(vidmemch2)); - memset(vidmemch4, 1, sizeof(vidmemch4)); - memset(vidmemch8, 1, sizeof(vidmemch8)); -} - -//Code to handle special frames for pausing, and desync checking -unsigned char *SpecialPauseBackup = 0, PauseFrameMode = 0; -/* -Pause frame modes - -0 - no pause frame stored -1 - pause frame ready to be stored -2 - pause frame stored -3 - pause frame ready for reload -*/ - -void BackupPauseFrame() -{ - if (SpecialPauseBackup) - { - copy_state_data(SpecialPauseBackup, memcpyinc, csm_save_rewind); - PauseFrameMode = 2; - } -} - -void RestorePauseFrame() -{ - if (SpecialPauseBackup) - { - copy_state_data(SpecialPauseBackup, memcpyrinc, csm_load_rewind); - //ClearCacheCheck(); - PauseFrameMode = 0; - } -} - -void DeallocPauseFrame() -{ - if (SpecialPauseBackup) { free(SpecialPauseBackup); } -} - -#define ActualRewindFrames (unsigned int)(RewindFrames * (romispal ? 10 : 12)) - -void BackupCVFrame() -{ - unsigned char *RewindBufferPos = StateBackup + LatestRewindPos*rewind_state_size; - - if (MovieProcessing == MOVIE_PLAYBACK) { zmv_rewind_save(LatestRewindPos, true); } - else if (MovieProcessing == MOVIE_RECORD) { zmv_rewind_save(LatestRewindPos, false); } - copy_state_data(RewindBufferPos, memcpyinc, csm_save_rewind); - - if (RewindPosPassed) - { - EarliestRewindPos = (EarliestRewindPos+1)%AllocatedRewindStates; - RewindPosPassed = false; - } -// printf("Backing up in #%u, earliest: #%u, allocated: %u\n", LatestRewindPos, EarliestRewindPos, AllocatedRewindStates); - - LatestRewindPos = (LatestRewindPos+1)%AllocatedRewindStates; - - if (LatestRewindPos == EarliestRewindPos) { RewindPosPassed = true; } - - RewindTimer = ActualRewindFrames; - DblRewTimer += (DblRewTimer) ? 0 : ActualRewindFrames; -// printf("New backup slot: #%u, timer %u, check %u\n", LatestRewindPos, RewindTimer, DblRewTimer); -} - -void RestoreCVFrame() -{ - unsigned char *RewindBufferPos; - - if (LatestRewindPos != ((EarliestRewindPos+1)%AllocatedRewindStates)) - { - if (DblRewTimer > ActualRewindFrames) - { - if (LatestRewindPos == 1 || AllocatedRewindStates == 1) - { LatestRewindPos = AllocatedRewindStates-1; } - else { LatestRewindPos = (LatestRewindPos) ? LatestRewindPos-2 : AllocatedRewindStates-2; } - } - else - { - LatestRewindPos = (LatestRewindPos) ? LatestRewindPos-1 : AllocatedRewindStates-1; - } - } - else { LatestRewindPos = EarliestRewindPos; } - - RewindBufferPos = StateBackup + LatestRewindPos*rewind_state_size; - //printf("Restoring from #%u, earliest: #%u\n", LatestRewindPos, EarliestRewindPos); - - if (MovieProcessing == MOVIE_RECORD) - { - zmv_rewind_load(LatestRewindPos, false); - } - else - { - if (MovieProcessing == MOVIE_PLAYBACK) - { - zmv_rewind_load(LatestRewindPos, true); - } - - if (PauseRewind || EMUPause) - { - PauseFrameMode = EMUPause = true; - } - } - - copy_state_data(RewindBufferPos, memcpyrinc, csm_load_rewind); - ClearCacheCheck(); - - LatestRewindPos = (LatestRewindPos+1)%AllocatedRewindStates; - RewindTimer = ActualRewindFrames; - DblRewTimer = 2*ActualRewindFrames; -} - -void SetupRewindBuffer() -{ - //For special rewind case to help out pauses - DeallocPauseFrame(); - SpecialPauseBackup = malloc(rewind_state_size); - - //For standard rewinds - if (StateBackup) { free(StateBackup); } - for (; RewindStates; RewindStates--) - { - StateBackup = 0; - StateBackup = (unsigned char *)malloc(rewind_state_size*RewindStates); - if (StateBackup) { break; } - } - AllocatedRewindStates = RewindStates; -} - -void DeallocRewindBuffer() -{ - if (StateBackup) { free(StateBackup); } -} - -static size_t state_size; - -static void state_size_tally(unsigned char **dest, void *src, size_t len) -{ - state_size += len; -} - -void InitRewindVars() -{ - unsigned char almost_useless_array[1]; //An array is needed for copy_state_data to give the correct size - state_size = 0; - copy_state_data(almost_useless_array, state_size_tally, csm_save_rewind); - rewind_state_size = state_size; - - SetupRewindBuffer(); - LatestRewindPos = 0; - EarliestRewindPos = 0; - RewindPosPassed = false; - RewindTimer = 1; - DblRewTimer = 1; -} - -void InitRewindVarsForMovie() -{ - LatestRewindPos = 0; - EarliestRewindPos = 0; - RewindPosPassed = false; - RewindTimer = 1; - DblRewTimer = 1; -} - -//This is used to preserve system load state between game loads -static unsigned char *BackupSystemBuffer = 0; - -void BackupSystemVars() -{ - unsigned char *buffer; - - if (!BackupSystemBuffer) - { - state_size = 0; - copy_snes_data(&buffer, state_size_tally); - copy_spc_data(&buffer, state_size_tally); - copy_extra_data(&buffer, state_size_tally); - BackupSystemBuffer = (unsigned char *)malloc(state_size); - } - - if (BackupSystemBuffer) - { - buffer = BackupSystemBuffer; - copy_snes_data(&buffer, memcpyinc); - copy_spc_data(&buffer, memcpyinc); - copy_extra_data(&buffer, memcpyinc); - } -} - -void RestoreSystemVars() -{ - if (BackupSystemBuffer) - { - unsigned char *buffer = BackupSystemBuffer; - InitRewindVars(); - copy_snes_data(&buffer, memcpyrinc); - copy_spc_data(&buffer, memcpyrinc); - copy_extra_data(&buffer, memcpyrinc); - } -} - -void DeallocSystemVars() -{ - if (BackupSystemBuffer) { free(BackupSystemBuffer); } -} - -extern unsigned int spcBuffera; -extern unsigned int Voice0BufPtr, Voice1BufPtr, Voice2BufPtr, Voice3BufPtr; -extern unsigned int Voice4BufPtr, Voice5BufPtr, Voice6BufPtr, Voice7BufPtr; -extern unsigned int spcPCRam, spcRamDP; - -void PrepareSaveState() -{ - spcPCRam -= (unsigned int)SPCRAM; - spcRamDP -= (unsigned int)SPCRAM; - - Voice0BufPtr -= spcBuffera; - Voice1BufPtr -= spcBuffera; - Voice2BufPtr -= spcBuffera; - Voice3BufPtr -= spcBuffera; - Voice4BufPtr -= spcBuffera; - Voice5BufPtr -= spcBuffera; - Voice6BufPtr -= spcBuffera; - Voice7BufPtr -= spcBuffera; -} - -extern unsigned int SA1Stat; -extern unsigned char IRAM[2049], *SA1Ptr, *SA1RegPCS, *CurBWPtr, *SA1BWPtr; -extern unsigned char *SNSBWPtr; - -void SaveSA1() -{ - SA1Stat &= 0xFFFFFF00; - SA1Ptr -= (unsigned int)SA1RegPCS; - - if (SA1RegPCS == IRAM) - { - SA1Stat = (SA1Stat & 0xFFFFFF00) + 1; - } - - if (SA1RegPCS == IRAM-0x3000) - { - SA1Stat = (SA1Stat & 0xFFFFFF00) + 2; - } - - SA1RegPCS -= (unsigned int)romdata; - CurBWPtr -= (unsigned int)romdata; - SA1BWPtr -= (unsigned int)romdata; - SNSBWPtr -= (unsigned int)romdata; -} - -void RestoreSA1() -{ - SA1RegPCS += (unsigned int)romdata; - CurBWPtr += (unsigned int)romdata; - SA1BWPtr += (unsigned int)romdata; - SNSBWPtr += (unsigned int)romdata; - - if ((SA1Stat & 0xFF) == 1) - { - SA1RegPCS = IRAM; - } - - if ((SA1Stat & 0xFF) == 2) - { - SA1RegPCS = IRAM-0x3000; - } - - SA1Ptr += (unsigned int)SA1RegPCS; - SA1RAMArea = romdata + 4096*1024; -} - -#define ResState(Voice_BufPtr) \ - Voice_BufPtr += spcBuffera; \ - if (Voice_BufPtr >= spcBuffera + 65536*4) \ - { \ - Voice_BufPtr = spcBuffera; \ - } - -void ResetState() -{ - spcPCRam += (unsigned int)SPCRAM; - spcRamDP += (unsigned int)SPCRAM; - - ResState(Voice0BufPtr); - ResState(Voice1BufPtr); - ResState(Voice2BufPtr); - ResState(Voice3BufPtr); - ResState(Voice4BufPtr); - ResState(Voice5BufPtr); - ResState(Voice6BufPtr); - ResState(Voice7BufPtr); -} - -extern unsigned int SfxRomBuffer, SfxCROM; -extern unsigned int SfxLastRamAdr, SfxRAMMem, MsgCount, MessageOn; -extern unsigned char AutoIncSaveSlot, cbitmode, NoPictureSave; -extern char *Msgptr; -extern unsigned short PrevPicture[64*56]; - -static FILE *fhandle; -void CapturePicture(); - -static void write_save_state_data(unsigned char **dest, void *data, size_t len) -{ - fwrite(data, 1, len, fhandle); -} - -static const char zst_header_old[] = "ZSNES Save State File V0.6\x1a\x3c"; -static const char zst_header_cur[] = "ZSNES Save State File V143\x1a\x8f"; - -void calculate_state_sizes() -{ - state_size = 0; - copy_state_data(0, state_size_tally, csm_save_zst_new); - cur_zst_size = state_size + sizeof(zst_header_cur)-1; - - state_size = 0; - copy_state_data(0, state_size_tally, csm_load_zst_old); - old_zst_size = state_size + sizeof(zst_header_old)-1; -} - -unsigned int current_zst = 0; -unsigned int newest_zst = 0; -time_t newestfiledate; - -char *zst_name() -{ - static char buffer[7]; - if ((MovieProcessing == MOVIE_PLAYBACK) || (MovieProcessing == MOVIE_RECORD)) - { - sprintf(buffer, "%.2d.zst", current_zst); - return(buffer); - } - strcpy(buffer, "zst"); - if (current_zst) - { - buffer[2] = (current_zst%10)+'0'; - if (current_zst > 9) - { - buffer[1] = (current_zst/10)+'0'; - } - } - setextension(ZStateName, buffer); - return(ZStateName); -} - -void zst_determine_newest() -{ - struct stat filestat; - - if ((MovieProcessing == MOVIE_PLAYBACK) || (MovieProcessing == MOVIE_RECORD)) { mzt_chdir_up(); } - if (!stat_dir(ZSramPath, zst_name(), &filestat) && filestat.st_mtime > newestfiledate) - { - newestfiledate = filestat.st_mtime; - newest_zst = current_zst; - } - if ((MovieProcessing == MOVIE_PLAYBACK) || (MovieProcessing == MOVIE_RECORD)) { mzt_chdir_down(); } -} - -void zst_init() -{ - if (LatestSave) - { - for (current_zst = 0; current_zst < 100; current_zst++) - { - zst_determine_newest(); - } - current_zst = newest_zst; - zst_name(); - } -} - -int zst_exists() -{ - int ret; - - if ((MovieProcessing == MOVIE_PLAYBACK) || (MovieProcessing == MOVIE_RECORD)) { mzt_chdir_up(); } - ret = access_dir(ZSramPath, zst_name(), F_OK) ? 0 : 1; - if ((MovieProcessing == MOVIE_PLAYBACK) || (MovieProcessing == MOVIE_RECORD)){ mzt_chdir_down(); } - - return(ret); -} - - -static bool zst_save_compressed(FILE *fp) -{ - size_t data_size = cur_zst_size - (sizeof(zst_header_cur)-1); - unsigned char *buffer = 0; - - bool worked = false; - - if ((buffer = (unsigned char *)malloc(data_size))) - { - //Compressed buffer which must be at least 0.1% larger than source buffer plus 12 bytes - //We devide by 1000 then add an extra 1 as a quick way to get a buffer large enough when - //using integer division - unsigned long compressed_size = data_size + data_size/1000 + 13; - unsigned char *compressed_buffer = 0; - - if ((compressed_buffer = (unsigned char *)malloc(compressed_size))) - { - copy_state_data(buffer, memcpyinc, csm_save_zst_new); - if (compress2(compressed_buffer, &compressed_size, buffer, data_size, Z_BEST_COMPRESSION) == Z_OK) - { - fwrite3(compressed_size, fp); - fwrite(compressed_buffer, 1, compressed_size, fp); - worked = true; - } - free(compressed_buffer); - } - free(buffer); - } - - if (!worked) //Compression failed for whatever reason - { - fwrite3(cur_zst_size | 0x00800000, fp); //Uncompressed ZST will never break 8MB - } - - return(worked); -} - -void zst_save(FILE *fp, bool Thumbnail, bool Compress) -{ - PrepareOffset(); - PrepareSaveState(); - unpackfunct(); - - if (SFXEnable) - { - SfxRomBuffer -= SfxCROM; - SfxLastRamAdr -= SfxRAMMem; - } - - if (SA1Enable) - { - SaveSA1(); //Convert SA-1 stuff to standard, non displacement format - } - - if (!Compress || !zst_save_compressed(fp)) //If we don't want compressed or compression failed - { - fwrite(zst_header_cur, 1, sizeof(zst_header_cur)-1, fp); //-1 for null - - fhandle = fp; //Set global file handle - copy_state_data(0, write_save_state_data, csm_save_zst_new); - - if (Thumbnail) - { - CapturePicture(); - fwrite(PrevPicture, 1, 64*56*sizeof(unsigned short), fp); - } - } - - if (SFXEnable) - { - SfxRomBuffer += SfxCROM; - SfxLastRamAdr += SfxRAMMem; - } - - if (SA1Enable) - { - RestoreSA1(); //Convert back SA-1 stuff - } - - ResetOffset(); - ResetState(); -} - -/* -Merges all the passed strings into buffer. Make sure to pass an extra parameter as 0 after all the strings. -Copies at most buffer_len characters. Result is always null terminated. -Returns how many bytes are needed to store all strings. -Thus if return is <= buffer_len, everything was copied. -*/ -static size_t string_merge(char *buffer, size_t buffer_len, ...) -{ - char *s; - size_t copied = 0, needed = 0; - - va_list ap; - va_start(ap, buffer_len); - - if (buffer && buffer_len) { *buffer = 0; } - - while ((s = va_arg(ap, char *))) - { - needed += strlen(s); - if (buffer && (copied+1 < buffer_len)) - { - strncpy(buffer+copied, s, buffer_len-copied); - buffer[buffer_len-1] = 0; - copied += strlen(buffer+copied); - } - } - - va_end(ap); - return(needed+1); -} - -static char txtmsg[30]; - -void set_state_message(char *prefix, char *suffix) -{ - char num[3]; - sprintf(num, "%d", current_zst); - string_merge(txtmsg, sizeof(txtmsg), prefix, isextension(ZStateName, "zss") ? "AUTO" : num, suffix, 0); - - Msgptr = txtmsg; - MessageOn = MsgCount; -} - -void statesaver() -{ - if (MovieProcessing == MOVIE_RECORD) - { - //'Auto increment savestate slot' code - current_zst += AutoIncSaveSlot; - current_zst %= 100; - - if (mzt_save(current_zst, (cbitmode && !NoPictureSave) ? true : false, false)) - { - set_state_message("RR STATE ", " SAVED."); - } - else - { - current_zst += 100-AutoIncSaveSlot; - current_zst %= 100; - } - return; - } - - if ((MovieProcessing == MOVIE_PLAYBACK) || (MovieProcessing == MOVIE_DUMPING_NEW)) - { - //'Auto increment savestate slot' code - current_zst += AutoIncSaveSlot; - current_zst %= 100; - - if (mzt_save(current_zst, (cbitmode && !NoPictureSave) ? true : false, true)) - { - set_state_message("RR STATE ", " SAVED."); - } - else - { - current_zst += 100-AutoIncSaveSlot; - current_zst %= 100; - } - return; - } - - clim(); - - //'Auto increment savestate slot' code - if(!isextension(ZStateName, "zss")) - { - current_zst += (char) AutoIncSaveSlot; - current_zst %= 100; - zst_name(); - } - - if ((fhandle = fopen_dir(ZSramPath, ZStateName, "wb"))) - { - zst_save(fhandle, (bool)(cbitmode && !NoPictureSave), false); - fclose(fhandle); - - //Display message onscreen, 'STATE XX SAVED.' - set_state_message("STATE ", " SAVED."); - } - else - { - //Display message onscreen, 'UNABLE TO SAVE.' - Msgptr = "UNABLE TO SAVE."; - MessageOn = MsgCount; - - if(!isextension(ZStateName, "zss")) - { - current_zst += 100-(char) AutoIncSaveSlot; - current_zst %= 100; - zst_name(); - } - } - - stim(); -} - -extern unsigned int Totalbyteloaded, SfxMemTable[256], SfxCPB; -extern unsigned int SfxPBR, SfxROMBR, SfxRAMBR, SCBRrel, SfxSCBR; -extern unsigned char pressed[256+128+64], multchange, ioportval, SDD1Enable; -extern unsigned char nexthdma; - -static void read_save_state_data(unsigned char **dest, void *data, size_t len) -{ - load_save_size += fread(data, 1, len, fhandle); -} - -static bool zst_load_compressed(FILE *fp, size_t compressed_size) -{ - unsigned long data_size = cur_zst_size - (sizeof(zst_header_cur)-1); - unsigned char *buffer = 0; - bool worked = false; - - if ((buffer = (unsigned char *)malloc(data_size))) - { - unsigned char *compressed_buffer = 0; - - if ((compressed_buffer = (unsigned char *)malloc(compressed_size))) - { - fread(compressed_buffer, 1, compressed_size, fp); - if (uncompress(buffer, &data_size, compressed_buffer, compressed_size) == Z_OK) - { - copy_state_data(buffer, memcpyrinc, csm_load_zst_new); - worked = true; - } - free(compressed_buffer); - } - free(buffer); - } - return(worked); -} - -bool zst_load(FILE *fp, size_t Compressed) -{ - size_t zst_version = 0; - - if (Compressed) - { - if (!zst_load_compressed(fp, Compressed)) - { - return(false); - } - } - else - { - char zst_header_check[sizeof(zst_header_cur)-1]; - - Totalbyteloaded += fread(zst_header_check, 1, sizeof(zst_header_check), fp); - - if (!memcmp(zst_header_check, zst_header_cur, sizeof(zst_header_check)-2)) - { - zst_version = 143; //v1.43+ - } - - if (!memcmp(zst_header_check, zst_header_old, sizeof(zst_header_check)-2)) - { - zst_version = 60; //v0.60 - v1.42 - } - - if (!zst_version) { return(false); } //Pre v0.60 saves are no longer loaded - - load_save_size = 0; - fhandle = fp; //Set global file handle - copy_state_data(0, read_save_state_data, (zst_version == 143) ? csm_load_zst_new: csm_load_zst_old ); - Totalbyteloaded += load_save_size; - } - - if (SFXEnable) - { - SfxCPB = SfxMemTable[(SfxPBR & 0xFF)]; - SfxCROM = SfxMemTable[(SfxROMBR & 0xFF)]; - SfxRAMMem = (unsigned int)sfxramdata + ((SfxRAMBR & 0xFF) << 16); - SfxRomBuffer += SfxCROM; - SfxLastRamAdr += SfxRAMMem; - SCBRrel = (SfxSCBR << 10) + (unsigned int)sfxramdata; - } - - if (SA1Enable) - { - RestoreSA1(); //Convert back SA-1 stuff - SA1UpdateDPageC(); - } - - if (SDD1Enable) - { - UpdateBanksSDD1(); - } - - //Clear cache check if state loaded - ClearCacheCheck(); - - if (zst_version < 143) //Set new vars which old states did not have - { - prevoamptr = 0xFF; - ioportval = 0xFF; - spcnumread = 0; - } - - if (MovieProcessing != MOVIE_RECORD) - { - nexthdma = 0; - } - - repackfunct(); - initpitch(); - ResetOffset(); - ResetState(); - procexecloop(); - - return(true); -} - -//Wrapper for above -bool zst_compressed_loader(FILE *fp) -{ - size_t data_size = fread3(fp); - return((data_size & 0x00800000) ? zst_load(fp, 0) : zst_load(fp, data_size)); -} - -#define PH65816regsize 36 -void zst_sram_load(FILE *fp) -{ - fseek(fp, sizeof(zst_header_cur)-1 + PH65816regsize + 199635, SEEK_CUR); - if (spcon) { fseek(fp, PHspcsave + PHdspsave + sizeof(DSPMem), SEEK_CUR); } - if (C4Enable) { fseek(fp, 8192, SEEK_CUR); } - if (SFXEnable) { fseek(fp, PHnum2writesfxreg + 131072, SEEK_CUR); } - if (SA1Enable) - { - fseek(fp, PHnum2writesa1reg, SEEK_CUR); - fread(SA1RAMArea, 1, 131072, fp); // SA-1 sram - fseek(fp, 15, SEEK_CUR); - } - if (DSP1Enable) { fseek(fp, 2874, SEEK_CUR); } - if (SETAEnable) { fread(setaramdata, 1, 4096, fp); } // SETA sram - if (SPC7110Enable) { fseek(fp, PHnum2writespc7110reg + 65536, SEEK_CUR); } - if (DSP4Enable) {fseek(fp, 1294, SEEK_CUR); } - fseek(fp, 220, SEEK_CUR); - if (ramsize) { fread(sram, 1, ramsize, fp); } // normal sram -} - -void zst_sram_load_compressed(FILE *fp) -{ - size_t compressed_size = fread3(fp); - - if (compressed_size & 0x00800000) - { - zst_sram_load(fp); - } - else - { - unsigned long data_size = cur_zst_size - (sizeof(zst_header_cur)-1); - unsigned char *buffer = 0; - - if ((buffer = (unsigned char *)malloc(data_size))) - { - unsigned char *compressed_buffer = 0; - if ((compressed_buffer = (unsigned char *)malloc(compressed_size))) - { - fread(compressed_buffer, 1, compressed_size, fp); - if (uncompress(buffer, &data_size, compressed_buffer, compressed_size) == Z_OK) - { - unsigned char *data = buffer + PH65816regsize + 199635; - if (spcon) { data += PHspcsave + PHdspsave + sizeof(DSPMem); } - if (C4Enable) { data += 8192; } - if (SFXEnable) { data += PHnum2writesfxreg + 131072; } - if (SA1Enable) - { - data += PHnum2writesa1reg; - memcpyrinc(&data, SA1RAMArea, 131072); // SA-1 sram - data += 15; - } - if (DSP1Enable) { data += 2874; } - if (SETAEnable) { memcpyrinc(&data, setaramdata, 4096); } // SETA sram - if (SPC7110Enable) { data += PHnum2writespc7110reg + 65536; } - if (DSP4Enable) { data += 1294; } - data += 220; - if (ramsize) { memcpyrinc(&data, sram, ramsize); } // normal sram - } - free(compressed_buffer); - } - free(buffer); - } - } -} - - -extern unsigned char Voice0Disable, Voice1Disable, Voice2Disable, Voice3Disable; -extern unsigned char Voice4Disable, Voice5Disable, Voice6Disable, Voice7Disable; - -void stateloader(char *statename, bool keycheck, bool xfercheck) -{ - extern unsigned char PauseLoad; - - if (keycheck) - { - pressed[1] = 0; - pressed[KeyLoadState] = 2; - multchange = 1; - MessageOn = MsgCount; - } - - if (MZTForceRTR == RTR_REPLAY_TO_RECORD && (MovieProcessing == MOVIE_PLAYBACK)) - { - MovieRecord(); - } - else if (MZTForceRTR == RTR_RECORD_TO_REPLAY && (MovieProcessing == MOVIE_RECORD)) - { - MovieStop(); - MoviePlay(); - } - - switch (MovieProcessing) - { - case MOVIE_PLAYBACK: - if (mzt_load(current_zst, true)) - { - Msgptr = "CHAPTER LOADED."; - MessageOn = MsgCount; - } - else - { - set_state_message("UNABLE TO LOAD STATE ", "."); - } - return; - case MOVIE_RECORD: - if (mzt_load(current_zst, false)) - { - set_state_message("RR STATE ", " LOADED."); - - if (PauseLoad || EMUPause) - { - PauseFrameMode = EMUPause = true; - } - } - else - { - set_state_message("UNABLE TO LOAD STATE ", "."); - } - return; - case MOVIE_OLD_PLAY: - { - extern unsigned char CMovieExt; - size_t fname_len = strlen(statename); - setextension(statename, "zmv"); - if (isdigit(CMovieExt)) { statename[fname_len-1] = CMovieExt; } - } - case MOVIE_ENDING_DUMPING: case MOVIE_DUMPING_NEW: case MOVIE_DUMPING_OLD: - return; - break; - } - - clim(); - - if(!isextension(ZStateName, "zss")) - { - zst_name(); - } - - //Actual state loading code - if ((fhandle = fopen_dir(ZSramPath, statename, "rb"))) - { - if (xfercheck) { Totalbyteloaded = 0; } - - if (zst_load(fhandle, 0)) - { - set_state_message("STATE ", " LOADED."); // 'STATE XX LOADED.' - - if (PauseLoad || EMUPause) - { - PauseFrameMode = EMUPause = true; - } - } - else - { - set_state_message("STATE ", " TOO OLD."); // 'STATE X TOO OLD.' - I don't think this is always accurate -Nach - } - fclose(fhandle); - } - else - { - set_state_message("UNABLE TO LOAD STATE ", "."); // 'UNABLE TO LOAD STATE XX.' - } - - Voice0Disable = Voice1Disable = Voice2Disable = Voice3Disable = 1; - Voice4Disable = Voice5Disable = Voice6Disable = Voice7Disable = 1; - - stim(); -} - -void debugloadstate() -{ - stateloader(ZStateName, 0, 0); -} - -void loadstate() -{ - stateloader(ZStateName, 1, 0); -} - -void loadstate2() -{ - stateloader(ZStateName, 0, 1); -} - -void LoadSecondState() -{ - setextension(ZStateName, "zss"); - loadstate2(); - zst_name(); -} - -void SaveSecondState() -{ - setextension(ZStateName, "zss"); - statesaver(); - zst_name(); -} - -extern unsigned char CHIPBATT, sramsavedis, *sram2, nosaveSRAM; -void SaveCombFile(); - -// Sram saving -void SaveSramData() -{ - extern unsigned int sramb4save; - if (*ZSaveName && (!SRAMSave5Sec || sramb4save)) - { - FILE *fp = 0; - unsigned char special = 0; - unsigned int *data_to_save; - - setextension(ZSaveName, "srm"); - - if (ramsize && !sramsavedis) - { - if (SFXEnable) - { - data_to_save=sfxramdata; - special = 1; - } - else if (SA1Enable) - { - data_to_save = (unsigned int *)SA1RAMArea; - special=1; - } - else if (SETAEnable) - { - data_to_save = setaramdata; - special=1; - } - else { data_to_save = sram; } - - if (!special || CHIPBATT) - { - clim(); - if (!nosaveSRAM && (fp = fopen_dir(ZSramPath, ZSaveName,"wb"))) - { - fwrite(data_to_save, 1, ramsize, fp); - fclose(fp); - } - if (!nosaveSRAM && *ZSaveST2Name && (fp = fopen_dir(ZSramPath, ZSaveST2Name, "wb"))) - { - fwrite(sram2, 1, ramsize, fp); - fclose(fp); - } - stim(); - } - } - sramb4save = 0; - } - SaveCombFile(); -} - -extern bool SramExists; -void OpenSramFile() -{ - FILE *fp; - - setextension(ZSaveName, "srm"); - if ((fp = fopen_dir(ZSramPath, ZSaveName, "rb"))) - { - fread(sram, 1, ramsize, fp); - fclose(fp); - - SramExists = true; - - if (*ZSaveST2Name && (fp = fopen_dir(ZSramPath, ZSaveST2Name, "rb"))) - { - fread(sram2, 1, ramsize, fp); - fclose(fp); - } - } - else - { - SramExists = false; - } -} - -/* -SPC File Format - Invented by _Demo_ & zsKnight -Cleaned up by Nach - -00000h-00020h - File Header : SNES-SPC700 Sound File Data v0.00 (33 bytes) -00021h-00023h - 0x1a,0x1a,0x1a (3 bytes) -00024h - 10 (1 byte) -00025h - PC Register value (1 Word) -00027h - A Register Value (1 byte) -00028h - X Register Value (1 byte) -00029h - Y Register Value (1 byte) -0002Ah - Status Flags Value (1 byte) -0002Bh - Stack Register Value (1 byte) -0002Ch-0002Dh - Reserved (1 byte) -0002Eh-0004Dh - SubTitle/Song Name (32 bytes) -0004Eh-0006Dh - Title of Game (32 bytes) -0006Eh-0007Dh - Name of Dumper (32 bytes) -0007Eh-0009Dh - Comments (32 bytes) -0009Eh-000A1h - Date the SPC was Dumped (4 bytes) -000A2h-000A8h - Reserved (7 bytes) -000A9h-000ACh - Length of SPC in seconds (4 bytes) -000ADh-000AFh - Fade out length in milliseconds (3 bytes) -000B0h-000CFh - Author of Song (32 bytes) -000D0h - Default Channel Disables (0 = enable, 1 = disable) (1 byte) -000D1h - Emulator used to dump .spc file (1 byte) - (0 = UNKNOWN, 1 = ZSNES, 2 = SNES9X) - (Note : Contact the authors if you're an snes emu author with - an .spc capture in order to assign you a number) -000D2h-000FFh - Reserved (46 bytes) -00100h-100FFh - SPCRam (64 KB) -10100h-101FFh - DSPRam (256 bytes) -*/ - -extern unsigned char spcextraram[64]; -extern unsigned char spcP, spcA, spcX, spcY, spcS, spcNZ; -extern unsigned int infoloc; - -char spcsaved[16]; -void savespcdata() -{ - size_t fname_len; - unsigned int i = 0; - - setextension(ZSaveName, "spc"); - fname_len = strlen(ZSaveName); - - while (i < 100) - { - if (i) - { - sprintf(ZSaveName-1+fname_len - ((i < 10) ? 0 : 1), "%d", i); - } - if (access_dir(ZSpcPath, ZSaveName, F_OK)) - { - break; - } - i++; - } - if (i < 100) - { - FILE *fp = fopen_dir(ZSpcPath, ZSaveName, "wb"); - if (fp) - { - unsigned char ssdatst[256]; - time_t t = time(0); - struct tm *lt = localtime(&t); - - //Assemble N/Z flags into P - spcP &= 0xFD; - if (!spcNZ) - { - spcP |= 2; - } - spcP &= 0x7F; - if (spcNZ & 0x80) - { - spcP |= 0x80; - } - - strcpy((char *)ssdatst, "SNES-SPC700 Sound File Data v0.30"); //00000h - File Header : SNES-SPC700 Sound File Data v0.00 - ssdatst[0x21] = ssdatst[0x22] = ssdatst[0x23] = 0x1a; //00021h - 0x1a,0x1a,0x1a - ssdatst[0x24] = 10; //00024h - 10 - *((unsigned short *)(ssdatst+0x25)) = spcPCRam-(unsigned int)SPCRAM; //00025h - PC Register value (1 Word) - ssdatst[0x27] = spcA; //00027h - A Register Value (1 byte) - ssdatst[0x28] = spcX; //00028h - X Register Value (1 byte) - ssdatst[0x29] = spcY; //00029h - Y Register Value (1 byte) - ssdatst[0x2A] = spcP; //0002Ah - Status Flags Value (1 byte) - ssdatst[0x2B] = spcS; //0002Bh - Stack Register Value (1 byte) - - ssdatst[0x2C] = 0; //0002Ch - Reserved - ssdatst[0x2D] = 0; //0002Dh - Reserved - - PrepareSaveState(); - - memset(ssdatst+0x2E, 0, 32); //0002Eh-0004Dh - SubTitle/Song Name - memset(ssdatst+0x4E, 0, 32); //0004Eh-0006Dh - Title of Game - memcpy(ssdatst+0x4E, ((unsigned char *)romdata)+infoloc, 21); - memset(ssdatst+0x6E, 0, 16); //0006Eh-0007Dh - Name of Dumper - memset(ssdatst+0x7E, 0, 32); //0007Eh-0009Dh - Comments - - //0009Eh-000A1h - Date the SPC was Dumped - ssdatst[0x9E] = lt->tm_mday; - ssdatst[0x9F] = lt->tm_mon+1; - ssdatst[0xA0] = (lt->tm_year+1900) & 0xFF; - ssdatst[0xA1] = ((lt->tm_year+1900) >> 8) & 0xFF; - - memset(ssdatst+0xA2, 0, 7); //000A2h-000A8h - Reserved - memset(ssdatst+0xA9, 0, 4); //000A9h-000ACh - Length of SPC in seconds - memset(ssdatst+0xAD, 0, 3); //000ADh-000AFh - Fade out time in milliseconds - memset(ssdatst+0xB0, 0, 32); //000B0h-000CFh - Author of Song - - //Set Channel Disables - ssdatst[0xD0] = 0; //000D0h - Default Channel Disables (0 = enable, 1 = disable) - if (Voice0Disable) { ssdatst[0xD0] |= BIT(0); } - if (Voice1Disable) { ssdatst[0xD0] |= BIT(1); } - if (Voice2Disable) { ssdatst[0xD0] |= BIT(2); } - if (Voice3Disable) { ssdatst[0xD0] |= BIT(3); } - if (Voice4Disable) { ssdatst[0xD0] |= BIT(4); } - if (Voice5Disable) { ssdatst[0xD0] |= BIT(5); } - if (Voice6Disable) { ssdatst[0xD0] |= BIT(6); } - if (Voice7Disable) { ssdatst[0xD0] |= BIT(7); } - - ssdatst[0xD1] = 1; //000D1h - Emulator used to dump .spc file - memset(ssdatst+0xD2, 0, 46); //000D2h-000FFh - Reserved - - fwrite(ssdatst, 1, sizeof(ssdatst), fp); - fwrite(SPCRAM, 1, 65536, fp); //00100h-100FFh - SPCRam - fwrite(DSPMem, 1, 192, fp); //10100h-101FFh - DSPRam - fwrite(spcextraram, 1, 64, fp); //Seems DSPRam is split in two, but I don't get what's going on here - fclose(fp); - - ResetState(); - - sprintf(spcsaved, "%s FILE SAVED.", ZSaveName+fname_len-3); - } - } -} - -void SaveGameSpecificInput() -{ - if (!*ZSaveName) - { - psr_cfg_run(write_input_vars, ZCfgPath, "zinput.cfg"); - } - - if (GameSpecificInput && *ZSaveName) - { - setextension(ZSaveName, "inp"); - psr_cfg_run(write_input_vars, ZSramPath, ZSaveName); - } -} - -void LoadGameSpecificInput() -{ - if (GameSpecificInput && *ZSaveName) - { - psr_cfg_run(read_input_vars, ZCfgPath, "zinput.cfg"); - - setextension(ZSaveName, "inp"); - psr_cfg_run(read_input_vars, ZSramPath, ZSaveName); - } -} - diff --git a/tools/zsnes/src/ztime.asm b/tools/zsnes/src/ztime.asm deleted file mode 100644 index 6c4691e..0000000 --- a/tools/zsnes/src/ztime.asm +++ /dev/null @@ -1,80 +0,0 @@ -;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) -; -;http://www.zsnes.com -;http://sourceforge.net/projects/zsnes -;https://zsnes.bountysource.com -; -;This program is free software; you can redistribute it and/or -;modify it under the terms of the GNU General Public License -;version 2 as published by the Free Software Foundation. -; -;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 GetTime,GetDate,GetLocalTime -EXTSYM SystemTimewHour,SystemTimewMinute,SystemTimewSecond - -SECTION .text - -NEWSYM Get_Time - pushad - call GetTime - mov [TempVarSeek],eax - popad - mov eax,[TempVarSeek] - ret - -NEWSYM Get_TimeDate - pushad - call GetDate - mov [TempVarSeek],eax - popad - mov eax,[TempVarSeek] - ret - -NEWSYM Get_Date - ; dl = day, dh = month, cx = year - pushad - call GetDate - mov [TempVarSeek],eax - popad - mov eax,[TempVarSeek] - movzx edx,al ;Move day into edx, day is in BCD - shr edx,4 ;Chop off the second digit - imul edx,10 ;Multiply first digit by 10, since we want decimal - and al,0xF ;Remove first BCD digit - add dl,al ;Add second digit to first*10 - mov dh,ah ;Copy month - ;Year Calculation - shr eax,16 - movzx ecx,al - shr ecx,4 - imul ecx,10 - and al,0xF - add cl,al - add cx,1900 - ret - -NEWSYM GetTimeInSeconds - call GetLocalTime - movzx eax,word[SystemTimewHour] - mov ebx,60 - mul ebx - movzx ebx,word[SystemTimewMinute] - add eax,ebx - mov ebx,60 - mul ebx - movzx ebx,word[SystemTimewSecond] - add eax,ebx - ret - -SECTION .data -TempVarSeek dd 0 diff --git a/tools/zsnes/src/ztimec.c b/tools/zsnes/src/ztimec.c deleted file mode 100644 index e267346..0000000 --- a/tools/zsnes/src/ztimec.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach ) - -http://www.zsnes.com -http://sourceforge.net/projects/zsnes -https://zsnes.bountysource.com - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - -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 - -short SystemTimewHour; -short SystemTimewMinute; -short SystemTimewSecond; - -void GetLocalTime() -{ - time_t current; - struct tm *timeptr; - - time(¤t); - timeptr = localtime(¤t); - SystemTimewHour = timeptr->tm_hour; - SystemTimewMinute = timeptr->tm_min; - SystemTimewSecond = timeptr->tm_sec; -} - -unsigned int GetTime() -{ - unsigned int 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); -} - -unsigned int GetDate() -{ - unsigned int 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); -}